aboutsummaryrefslogtreecommitdiff
path: root/src/FbTk/Button.cc
diff options
context:
space:
mode:
Diffstat (limited to 'src/FbTk/Button.cc')
-rw-r--r--src/FbTk/Button.cc19
1 files changed, 10 insertions, 9 deletions
diff --git a/src/FbTk/Button.cc b/src/FbTk/Button.cc
index 0c568a2..4a9063f 100644
--- a/src/FbTk/Button.cc
+++ b/src/FbTk/Button.cc
@@ -19,7 +19,7 @@
19// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 19// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
20// DEALINGS IN THE SOFTWARE. 20// DEALINGS IN THE SOFTWARE.
21 21
22// $Id: Button.cc,v 1.3 2002/12/25 11:27:29 fluxgen Exp $ 22// $Id: Button.cc,v 1.4 2003/01/10 02:16:29 fluxgen Exp $
23 23
24#include "Button.hh" 24#include "Button.hh"
25 25
@@ -57,11 +57,11 @@ Button::~Button() {
57} 57}
58 58
59void Button::setOnClick(RefCount<Command> &cmd, int button) { 59void Button::setOnClick(RefCount<Command> &cmd, int button) {
60 // we only handle buttons 1 to 5 60 // we only handle buttons 1 to 5
61 if (button > 5 || button == 0) 61 if (button > 5 || button == 0)
62 return; 62 return;
63 //set on click command for the button 63 //set on click command for the button
64 m_onclick[button - 1] = cmd; 64 m_onclick[button - 1] = cmd;
65} 65}
66 66
67void Button::move(int x, int y) { 67void Button::move(int x, int y) {
@@ -124,7 +124,7 @@ void Button::buttonReleaseEvent(XButtonEvent &event) {
124 124
125 if (m_gc == 0) // get default gc 125 if (m_gc == 0) // get default gc
126 m_gc = DefaultGC(disp, m_win.screenNumber()); 126 m_gc = DefaultGC(disp, m_win.screenNumber());
127 127
128 XCopyArea(disp, m_foreground_pm, m_win.window(), m_gc, 0, 0, width(), height(), 0, 0); 128 XCopyArea(disp, m_foreground_pm, m_win.window(), m_gc, 0, 0, width(), height(), 0, 0);
129 } 129 }
130 130
@@ -132,8 +132,9 @@ void Button::buttonReleaseEvent(XButtonEvent &event) {
132 event.x > width() || event.y > height()) 132 event.x > width() || event.y > height())
133 return; 133 return;
134 134
135 if (event.button > 0 && event.button <= 5) 135 if (event.button > 0 && event.button <= 5 &&
136 m_onclick[event.button - 1]->execute(); 136 m_onclick[event.button -1].get() != 0)
137 m_onclick[event.button - 1]->execute();
137 138
138} 139}
139 140