diff options
author | fluxgen <fluxgen> | 2002-12-25 11:28:43 (GMT) |
---|---|---|
committer | fluxgen <fluxgen> | 2002-12-25 11:28:43 (GMT) |
commit | 885ddd9322ea4a175e992e4a6fe757d19e8e86e2 (patch) | |
tree | d4dab0e28e646cf13534f29762a5101cfae703ec /src/FbTk/Button.cc | |
parent | 2202914053a7fe1d586dfed19ad41965b51fa4b1 (diff) | |
download | fluxbox_pavel-885ddd9322ea4a175e992e4a6fe757d19e8e86e2.zip fluxbox_pavel-885ddd9322ea4a175e992e4a6fe757d19e8e86e2.tar.bz2 |
using number for buttons and max five buttons
Diffstat (limited to 'src/FbTk/Button.cc')
-rw-r--r-- | src/FbTk/Button.cc | 30 |
1 files changed, 12 insertions, 18 deletions
diff --git a/src/FbTk/Button.cc b/src/FbTk/Button.cc index b415724..0c568a2 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.2 2002/12/16 11:05:35 fluxgen Exp $ | 22 | // $Id: Button.cc,v 1.3 2002/12/25 11:27:29 fluxgen Exp $ |
23 | 23 | ||
24 | #include "Button.hh" | 24 | #include "Button.hh" |
25 | 25 | ||
@@ -56,6 +56,14 @@ Button::~Button() { | |||
56 | FbTk::EventManager::instance()->remove(m_win); | 56 | FbTk::EventManager::instance()->remove(m_win); |
57 | } | 57 | } |
58 | 58 | ||
59 | void Button::setOnClick(RefCount<Command> &cmd, int button) { | ||
60 | // we only handle buttons 1 to 5 | ||
61 | if (button > 5 || button == 0) | ||
62 | return; | ||
63 | //set on click command for the button | ||
64 | m_onclick[button - 1] = cmd; | ||
65 | } | ||
66 | |||
59 | void Button::move(int x, int y) { | 67 | void Button::move(int x, int y) { |
60 | m_win.move(x, y); | 68 | m_win.move(x, y); |
61 | } | 69 | } |
@@ -124,23 +132,9 @@ void Button::buttonReleaseEvent(XButtonEvent &event) { | |||
124 | event.x > width() || event.y > height()) | 132 | event.x > width() || event.y > height()) |
125 | return; | 133 | return; |
126 | 134 | ||
127 | // call commands | 135 | if (event.button > 0 && event.button <= 5) |
128 | switch (event.button) { | 136 | m_onclick[event.button - 1]->execute(); |
129 | case Button1: | 137 | |
130 | if (*m_onclick_left != 0) | ||
131 | m_onclick_left->execute(); | ||
132 | break; | ||
133 | case Button2: | ||
134 | if (*m_onclick_middle != 0) | ||
135 | m_onclick_middle->execute(); | ||
136 | break; | ||
137 | case Button3: | ||
138 | if (*m_onclick_right != 0) | ||
139 | m_onclick_right->execute(); | ||
140 | break; | ||
141 | }; | ||
142 | |||
143 | |||
144 | } | 138 | } |
145 | 139 | ||
146 | void Button::exposeEvent(XExposeEvent &event) { | 140 | void Button::exposeEvent(XExposeEvent &event) { |