diff options
| author | Simon Robertshaw <simon@hardwired.org.uk> | 2012-07-18 19:34:58 (GMT) |
|---|---|---|
| committer | Simon Robertshaw <simon@hardwired.org.uk> | 2012-07-18 19:34:58 (GMT) |
| commit | dd0e6e7f4ddc5a1a9c25111275187b767d51bdb4 (patch) | |
| tree | 79213c37eab4ad4715a00d53029fd6d6c865bc73 /src/interface | |
| parent | 26dbd547d3a3662c62e7b3ecadae5609f1726df4 (diff) | |
| download | powder-dd0e6e7f4ddc5a1a9c25111275187b767d51bdb4.zip powder-dd0e6e7f4ddc5a1a9c25111275187b767d51bdb4.tar.gz | |
Add descriptions to toolbuttons, add Tooltips to Button, ToolTip event for Windows
Diffstat (limited to 'src/interface')
| -rw-r--r-- | src/interface/Button.cpp | 9 | ||||
| -rw-r--r-- | src/interface/Button.h | 3 | ||||
| -rw-r--r-- | src/interface/Window.h | 2 |
3 files changed, 11 insertions, 3 deletions
diff --git a/src/interface/Button.cpp b/src/interface/Button.cpp index ac1f87e..b70d41e 100644 --- a/src/interface/Button.cpp +++ b/src/interface/Button.cpp @@ -13,7 +13,7 @@ namespace ui { -Button::Button(Point position, Point size, std::string buttonText): +Button::Button(Point position, Point size, std::string buttonText, std::string toolTip): Component(position, size), ButtonText(buttonText), isMouseInside(false), @@ -21,7 +21,8 @@ Button::Button(Point position, Point size, std::string buttonText): isTogglable(false), toggle(false), actionCallback(NULL), - Enabled(true) + Enabled(true), + toolTip(toolTip) { TextPosition(); } @@ -141,6 +142,10 @@ void Button::OnMouseEnter(int x, int y) return; if(actionCallback) actionCallback->MouseEnterCallback(this); + if(toolTip.length()>0 && GetParentWindow()) + { + GetParentWindow()->ToolTip(this, ui::Point(x, y), toolTip); + } } diff --git a/src/interface/Button.h b/src/interface/Button.h index 19f7fe7..2358d49 100644 --- a/src/interface/Button.h +++ b/src/interface/Button.h @@ -27,7 +27,7 @@ public: class Button : public Component { public: - Button(Point position = Point(0, 0), Point size = Point(0, 0), std::string buttonText = ""); + Button(Point position = Point(0, 0), Point size = Point(0, 0), std::string buttonText = "", std::string toolTip = ""); virtual ~Button(); bool Toggleable; @@ -55,6 +55,7 @@ public: void SetIcon(Icon icon); protected: + std::string toolTip; std::string buttonDisplayText; std::string ButtonText; diff --git a/src/interface/Window.h b/src/interface/Window.h index c077abb..c2c5e16 100644 --- a/src/interface/Window.h +++ b/src/interface/Window.h @@ -46,6 +46,8 @@ enum ChromeStyle // Remove a component from state. NOTE: This WILL free component from memory. void RemoveComponent(unsigned idx); + virtual void ToolTip(Component * sender, ui::Point mousePosition, std::string toolTip) {} + virtual void DoInitialized(); virtual void DoExit(); virtual void DoTick(float dt); |
