summaryrefslogtreecommitdiff
path: root/src/gui/game/GameView.cpp
diff options
context:
space:
mode:
authorjacob1 <jfu614@gmail.com>2013-06-08 00:13:18 (GMT)
committer jacob1 <jfu614@gmail.com>2013-06-08 00:13:18 (GMT)
commit69961956bfae1529e6c451c57804b0d2aa93f422 (patch)
treec09b75699ca16ba6899890940e681af11683ed4c /src/gui/game/GameView.cpp
parent1d00e712ad08c363adb554aa27687794917ecad2 (diff)
downloadpowder-69961956bfae1529e6c451c57804b0d2aa93f422.zip
powder-69961956bfae1529e6c451c57804b0d2aa93f422.tar.gz
fix ToolTips on split buttons not working correctly (button overrode them), fix tooltips displaying on disabled buttons
Diffstat (limited to 'src/gui/game/GameView.cpp')
-rw-r--r--src/gui/game/GameView.cpp53
1 files changed, 24 insertions, 29 deletions
diff --git a/src/gui/game/GameView.cpp b/src/gui/game/GameView.cpp
index ca4272c..08387e7 100644
--- a/src/gui/game/GameView.cpp
+++ b/src/gui/game/GameView.cpp
@@ -51,54 +51,49 @@ public:
void SetShowSplit(bool split) { showSplit = split; }
SplitButtonAction * GetSplitActionCallback() { return splitActionCallback; }
void SetSplitActionCallback(SplitButtonAction * newAction) { splitActionCallback = newAction; }
- virtual void OnMouseUnclick(int x, int y, unsigned int button)
- {
- if(isButtonDown)
- {
- if(leftDown)
- DoLeftAction();
- else if(rightDown)
- DoRightAction();
- }
- ui::Button::OnMouseUnclick(x, y, button);
-
- }
- virtual void OnMouseMovedInside(int x, int y, int dx, int dy)
+ void SetToolTip(int x, int y)
{
if(x >= splitPosition || !showSplit)
{
- if(toolTip.length()>0 && GetParentWindow())
+ if(toolTip2.length()>0 && GetParentWindow())
{
GetParentWindow()->ToolTip(this, ui::Point(x, y), toolTip2);
}
}
else if(x < splitPosition)
{
- if(toolTip2.length()>0 && GetParentWindow())
+ if(toolTip.length()>0 && GetParentWindow())
{
GetParentWindow()->ToolTip(this, ui::Point(x, y), toolTip);
}
}
}
+ virtual void OnMouseUnclick(int x, int y, unsigned int button)
+ {
+ if(isButtonDown)
+ {
+ if(leftDown)
+ DoLeftAction();
+ else if(rightDown)
+ DoRightAction();
+ }
+ ui::Button::OnMouseUnclick(x, y, button);
+
+ }
+ virtual void OnMouseHover(int x, int y, int dx, int dy)
+ {
+ SetToolTip(x, y);
+ }
+ virtual void OnMouseHover(int x, int y)
+ {
+ SetToolTip(x, y);
+ }
virtual void OnMouseEnter(int x, int y)
{
isMouseInside = true;
if(!Enabled)
return;
- if(x >= splitPosition || !showSplit)
- {
- if(toolTip.length()>0 && GetParentWindow())
- {
- GetParentWindow()->ToolTip(this, ui::Point(x, y), toolTip2);
- }
- }
- else if(x < splitPosition)
- {
- if(toolTip2.length()>0 && GetParentWindow())
- {
- GetParentWindow()->ToolTip(this, ui::Point(x, y), toolTip);
- }
- }
+ SetToolTip(x, y);
}
virtual void TextPosition()
{