diff options
author | fluxgen <fluxgen> | 2002-12-16 11:02:41 (GMT) |
---|---|---|
committer | fluxgen <fluxgen> | 2002-12-16 11:02:41 (GMT) |
commit | ce899439c9c26a767bcfc39aab8d5ea94fa9dacc (patch) | |
tree | 09a1660fa6922ffbe006bd2a4a7bdd5a457f3beb /src/FbTk | |
parent | e0ae69d0b97b2d7adf6b3bcfd00e23c172cc1bad (diff) | |
download | fluxbox_pavel-ce899439c9c26a767bcfc39aab8d5ea94fa9dacc.zip fluxbox_pavel-ce899439c9c26a767bcfc39aab8d5ea94fa9dacc.tar.bz2 |
two more commans for right and middle click
Diffstat (limited to 'src/FbTk')
-rw-r--r-- | src/FbTk/Button.hh | 28 |
1 files changed, 20 insertions, 8 deletions
diff --git a/src/FbTk/Button.hh b/src/FbTk/Button.hh index 5d0842d..c49815d 100644 --- a/src/FbTk/Button.hh +++ b/src/FbTk/Button.hh | |||
@@ -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.hh,v 1.1 2002/12/13 20:24:33 fluxgen Exp $ | 22 | // $Id: Button.hh,v 1.2 2002/12/16 11:02:41 fluxgen Exp $ |
23 | 23 | ||
24 | #ifndef FBTK_BUTTON_HH | 24 | #ifndef FBTK_BUTTON_HH |
25 | #define FBTK_BUTTON_HH | 25 | #define FBTK_BUTTON_HH |
@@ -29,29 +29,35 @@ | |||
29 | #include "RefCount.hh" | 29 | #include "RefCount.hh" |
30 | #include "FbWindow.hh" | 30 | #include "FbWindow.hh" |
31 | #include "Command.hh" | 31 | #include "Command.hh" |
32 | #include "Color.hh" | ||
32 | 33 | ||
33 | #include <X11/Xlib.h> | 34 | #include <X11/Xlib.h> |
34 | #include <memory> | 35 | #include <memory> |
35 | 36 | ||
36 | namespace FbTk { | 37 | namespace FbTk { |
37 | 38 | ||
38 | class Color; | ||
39 | |||
40 | class Button:public EventHandler, | 39 | class Button:public EventHandler, |
41 | private NotCopyable { | 40 | private NotCopyable { |
42 | public: | 41 | public: |
43 | Button(int screen_num, int x, int y, unsigned int width, unsigned int height); | 42 | Button(int screen_num, int x, int y, unsigned int width, unsigned int height); |
44 | Button(FbWindow &parent, int x, int y, unsigned int width, unsigned int height); | 43 | Button(const FbWindow &parent, int x, int y, unsigned int width, unsigned int height); |
45 | virtual ~Button(); | 44 | virtual ~Button(); |
46 | /// sets action when the button is clicked | 45 | /// sets action when the button is clicked with left mouse btn |
47 | void setOnClick(RefCount<Command> &com) { m_onclick = com; } | 46 | void setOnClick(RefCount<Command> &com) { m_onclick_left = com; } |
47 | /// sets action when the button is clicked with middle mouse btn | ||
48 | void setOnClickMiddle(RefCount<Command> &com) { m_onclick_middle = com; } | ||
49 | /// sets action when the button is clicked with right mouse btn | ||
50 | void setOnClickRight(RefCount<Command> &com) { m_onclick_right = com; } | ||
51 | |||
48 | void move(int x, int y); | 52 | void move(int x, int y); |
49 | void resize(unsigned int width, unsigned int height); | 53 | void resize(unsigned int width, unsigned int height); |
50 | void moveResize(int x, int y, unsigned int width, unsigned int height); | 54 | void moveResize(int x, int y, unsigned int width, unsigned int height); |
51 | /// sets the pixmap to be viewd when the button is in normal state (ie not pressed) | 55 | |
56 | /// sets foreground pixmap | ||
52 | void setPixmap(Pixmap pm); | 57 | void setPixmap(Pixmap pm); |
53 | /// sets the pixmap to be viewed when the button is pressed | 58 | /// sets the pixmap to be viewed when the button is pressed |
54 | void setPressedPixmap(Pixmap pm); | 59 | void setPressedPixmap(Pixmap pm); |
60 | /// sets graphic context for drawing | ||
55 | void setGC(GC gc) { m_gc = gc; } | 61 | void setGC(GC gc) { m_gc = gc; } |
56 | /// sets background pixmap, this will override background color | 62 | /// sets background pixmap, this will override background color |
57 | void setBackgroundPixmap(Pixmap pm); | 63 | void setBackgroundPixmap(Pixmap pm); |
@@ -70,6 +76,7 @@ public: | |||
70 | virtual void buttonReleaseEvent(XButtonEvent &event); | 76 | virtual void buttonReleaseEvent(XButtonEvent &event); |
71 | virtual void exposeEvent(XExposeEvent &event); | 77 | virtual void exposeEvent(XExposeEvent &event); |
72 | //@} | 78 | //@} |
79 | |||
73 | /// @return true if the button is pressed, else false | 80 | /// @return true if the button is pressed, else false |
74 | bool pressed() const { return m_pressed; } | 81 | bool pressed() const { return m_pressed; } |
75 | /** | 82 | /** |
@@ -84,13 +91,18 @@ public: | |||
84 | FbWindow &window() { return m_win; } | 91 | FbWindow &window() { return m_win; } |
85 | const FbWindow &window() const { return m_win; } | 92 | const FbWindow &window() const { return m_win; } |
86 | GC gc() const { return m_gc; } | 93 | GC gc() const { return m_gc; } |
94 | |||
87 | private: | 95 | private: |
88 | FbTk::FbWindow m_win; ///< window for button | 96 | FbTk::FbWindow m_win; ///< window for button |
89 | Pixmap m_foreground_pm; ///< foreground pixmap | 97 | Pixmap m_foreground_pm; ///< foreground pixmap |
98 | Pixmap m_background_pm; ///< background pixmap | ||
99 | Color m_background_color; ///< background color | ||
90 | Pixmap m_pressed_pm; ///< pressed pixmap | 100 | Pixmap m_pressed_pm; ///< pressed pixmap |
91 | GC m_gc; ///< graphic context for button | 101 | GC m_gc; ///< graphic context for button |
92 | bool m_pressed; ///< if the button is pressed | 102 | bool m_pressed; ///< if the button is pressed |
93 | RefCount<Command> m_onclick; ///< what to do when this button is clicked | 103 | RefCount<Command> m_onclick_left; ///< what to do when this button is clicked with lmb |
104 | RefCount<Command> m_onclick_middle; ///< what to do when this button is clicked with mmb | ||
105 | RefCount<Command> m_onclick_right; ///< what to do when this button is clicked with rmb | ||
94 | }; | 106 | }; |
95 | 107 | ||
96 | }; | 108 | }; |