diff options
| author | jacob1 <jfu614@gmail.com> | 2012-12-06 16:01:46 (GMT) |
|---|---|---|
| committer | jacob1 <jfu614@gmail.com> | 2012-12-06 16:01:46 (GMT) |
| commit | 122599763ef9827d7aadc0fe0295c2fbc96e82ab (patch) | |
| tree | dcf0a21b20cd38a12dee93d9db6115da6c0fdb35 /src/interface/Button.cpp | |
| parent | 2d7ac84c1dca8521f41cf023774b7a90e300b3bf (diff) | |
| parent | 9bf5eeeef919260458637e84f3388b4d7d8204c5 (diff) | |
| download | powder-122599763ef9827d7aadc0fe0295c2fbc96e82ab.zip powder-122599763ef9827d7aadc0fe0295c2fbc96e82ab.tar.gz | |
Merge remote-tracking branch 'origin/master'
Diffstat (limited to 'src/interface/Button.cpp')
| -rw-r--r-- | src/interface/Button.cpp | 44 |
1 files changed, 32 insertions, 12 deletions
diff --git a/src/interface/Button.cpp b/src/interface/Button.cpp index fbf9b54..4b9c5d9 100644 --- a/src/interface/Button.cpp +++ b/src/interface/Button.cpp @@ -156,26 +156,38 @@ void Button::Draw(const Point& screenPos) void Button::OnMouseUnclick(int x, int y, unsigned int button) { - if(button != 1) + if(button == 1) { - return; + if(isButtonDown) + { + isButtonDown = false; + DoAction(); + } } - - if(isButtonDown) + else if(button == 3) { - isButtonDown = false; - DoAction(); - } + if(isAltButtonDown) + { + isAltButtonDown = false; + DoAltAction(); + } + } } void Button::OnMouseClick(int x, int y, unsigned int button) { - if(button != 1) return; - if(isTogglable) - { - toggle = !toggle; + if(button == 1) + { + if(isTogglable) + { + toggle = !toggle; + } + isButtonDown = true; + } + else if(button == 3) + { + isAltButtonDown = true; } - isButtonDown = true; } void Button::OnMouseEnter(int x, int y) @@ -206,6 +218,14 @@ void Button::DoAction() actionCallback->ActionCallback(this); } +void Button::DoAltAction() +{ + if(!Enabled) + return; + if(actionCallback) + actionCallback->AltActionCallback(this); +} + void Button::SetActionCallback(ButtonAction * action) { if(actionCallback) |
