From 36edf3f842c25c8793d8f57e94bc8ed0cef0548a Mon Sep 17 00:00:00 2001
From: David Capello <david@igarastudio.com>
Date: Thu, 13 Dec 2018 15:25:31 -0300
Subject: [PATCH] Fix tooltip in SpriteProperties dialog

---
 data/widgets/sprite_properties.xml         | 2 +-
 src/app/commands/cmd_sprite_properties.cpp | 9 +++++++++
 2 files changed, 10 insertions(+), 1 deletion(-)

diff --git a/data/widgets/sprite_properties.xml b/data/widgets/sprite_properties.xml
index a0eedde86..29214bd28 100644
--- a/data/widgets/sprite_properties.xml
+++ b/data/widgets/sprite_properties.xml
@@ -21,7 +21,7 @@
 
       <label text="@.transparent_color" />
       <hbox>
-	<hbox id="transparent_color_placeholder" tooltip="@.transparent_color_tooltip" />
+	<hbox id="transparent_color_placeholder" />
       </hbox>
 
       <label text="@.pixel_ratio" />
diff --git a/src/app/commands/cmd_sprite_properties.cpp b/src/app/commands/cmd_sprite_properties.cpp
index c5d12ad5f..dbb5b94bc 100644
--- a/src/app/commands/cmd_sprite_properties.cpp
+++ b/src/app/commands/cmd_sprite_properties.cpp
@@ -16,6 +16,7 @@
 #include "app/commands/command.h"
 #include "app/context_access.h"
 #include "app/doc_api.h"
+#include "app/i18n/strings.h"
 #include "app/modules/gui.h"
 #include "app/pref/preferences.h"
 #include "app/tx.h"
@@ -117,6 +118,14 @@ void SpritePropertiesCommand::onExecute(Context* context)
                                      ColorButtonOptions());
 
       window.transparentColorPlaceholder()->addChild(color_button);
+
+      // TODO add a way to get or create an existent TooltipManager
+      TooltipManager* tooltipManager = new TooltipManager;
+      window.addChild(tooltipManager);
+      tooltipManager->addTooltipFor(
+        color_button,
+        Strings::sprite_properties_transparent_color_tooltip(),
+        LEFT);
     }
     else {
       window.transparentColorPlaceholder()->addChild(new Label("(only for indexed images)"));