diff options
Diffstat (limited to 'src/Toolbar.hh')
-rw-r--r-- | src/Toolbar.hh | 244 |
1 files changed, 122 insertions, 122 deletions
diff --git a/src/Toolbar.hh b/src/Toolbar.hh index ce7dbd1..259e23d 100644 --- a/src/Toolbar.hh +++ b/src/Toolbar.hh | |||
@@ -22,7 +22,7 @@ | |||
22 | // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER | 22 | // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER |
23 | // DEALINGS IN THE SOFTWARE. | 23 | // DEALINGS IN THE SOFTWARE. |
24 | 24 | ||
25 | // $Id: Toolbar.hh,v 1.14 2002/11/27 12:20:23 fluxgen Exp $ | 25 | // $Id: Toolbar.hh,v 1.15 2002/12/01 13:42:02 rathnor Exp $ |
26 | 26 | ||
27 | #ifndef TOOLBAR_HH | 27 | #ifndef TOOLBAR_HH |
28 | #define TOOLBAR_HH | 28 | #define TOOLBAR_HH |
@@ -41,48 +41,48 @@ class Toolbar; | |||
41 | */ | 41 | */ |
42 | class Toolbarmenu:public Basemenu { | 42 | class Toolbarmenu:public Basemenu { |
43 | public: | 43 | public: |
44 | explicit Toolbarmenu(Toolbar &tb); | 44 | explicit Toolbarmenu(Toolbar &tb); |
45 | ~Toolbarmenu(); | 45 | ~Toolbarmenu(); |
46 | 46 | ||
47 | inline const Basemenu *headmenu() const { return m_headmenu.get(); } | 47 | inline const Basemenu *headmenu() const { return m_headmenu.get(); } |
48 | 48 | ||
49 | inline Basemenu *placementmenu() { return &m_placementmenu; } | 49 | inline Basemenu *placementmenu() { return &m_placementmenu; } |
50 | inline const Basemenu *placementmenu() const { return &m_placementmenu; } | 50 | inline const Basemenu *placementmenu() const { return &m_placementmenu; } |
51 | 51 | ||
52 | void reconfigure(); | 52 | void reconfigure(); |
53 | 53 | ||
54 | protected: | 54 | protected: |
55 | virtual void itemSelected(int button, unsigned int index); | 55 | virtual void itemSelected(int button, unsigned int index); |
56 | virtual void internal_hide(); | 56 | virtual void internal_hide(); |
57 | 57 | ||
58 | private: | 58 | private: |
59 | class Placementmenu : public Basemenu { | 59 | class Placementmenu : public Basemenu { |
60 | public: | 60 | public: |
61 | Placementmenu(Toolbarmenu &tm); | 61 | Placementmenu(Toolbarmenu &tm); |
62 | protected: | 62 | protected: |
63 | virtual void itemSelected(int button, unsigned int index); | 63 | virtual void itemSelected(int button, unsigned int index); |
64 | private: | 64 | private: |
65 | Toolbarmenu &m_toolbarmenu; | 65 | Toolbarmenu &m_toolbarmenu; |
66 | }; | 66 | }; |
67 | friend class Placementmenu; | 67 | friend class Placementmenu; |
68 | 68 | ||
69 | class Headmenu : public Basemenu { | 69 | class Headmenu : public Basemenu { |
70 | public: | 70 | public: |
71 | Headmenu(Toolbarmenu &tm); | 71 | Headmenu(Toolbarmenu &tm); |
72 | protected: | 72 | protected: |
73 | virtual void itemSelected(int button, unsigned int index); | 73 | virtual void itemSelected(int button, unsigned int index); |
74 | private: | 74 | private: |
75 | Toolbarmenu &m_toolbarmenu; | 75 | Toolbarmenu &m_toolbarmenu; |
76 | }; | 76 | }; |
77 | std::auto_ptr<Headmenu> m_headmenu; | 77 | std::auto_ptr<Headmenu> m_headmenu; |
78 | friend class Headmenu; | 78 | friend class Headmenu; |
79 | 79 | ||
80 | 80 | ||
81 | Toolbar &m_toolbar; | 81 | Toolbar &m_toolbar; |
82 | Placementmenu m_placementmenu; | 82 | Placementmenu m_placementmenu; |
83 | 83 | ||
84 | 84 | ||
85 | friend class Toolbar; | 85 | friend class Toolbar; |
86 | 86 | ||
87 | }; | 87 | }; |
88 | 88 | ||
@@ -91,106 +91,106 @@ private: | |||
91 | */ | 91 | */ |
92 | class Toolbar : public TimeoutHandler { | 92 | class Toolbar : public TimeoutHandler { |
93 | public: | 93 | public: |
94 | /** | 94 | /** |
95 | Toolbar placement on the screen | 95 | Toolbar placement on the screen |
96 | */ | 96 | */ |
97 | enum Placement{ TOPLEFT = 1, BOTTOMLEFT, TOPCENTER, | 97 | enum Placement{ TOPLEFT = 1, BOTTOMLEFT, TOPCENTER, |
98 | BOTTOMCENTER, TOPRIGHT, BOTTOMRIGHT }; | 98 | BOTTOMCENTER, TOPRIGHT, BOTTOMRIGHT }; |
99 | 99 | ||
100 | explicit Toolbar(BScreen *screen); | 100 | explicit Toolbar(BScreen *screen); |
101 | virtual ~Toolbar(); | 101 | virtual ~Toolbar(); |
102 | 102 | ||
103 | /// add icon to iconbar | 103 | /// add icon to iconbar |
104 | void addIcon(FluxboxWindow *w); | 104 | void addIcon(FluxboxWindow *w); |
105 | /// remove icon from iconbar | 105 | /// remove icon from iconbar |
106 | void delIcon(FluxboxWindow *w); | 106 | void delIcon(FluxboxWindow *w); |
107 | 107 | ||
108 | inline const Toolbarmenu &menu() const { return m_toolbarmenu; } | 108 | inline const Toolbarmenu &menu() const { return m_toolbarmenu; } |
109 | /// are we in workspacename editing? | 109 | /// are we in workspacename editing? |
110 | inline bool isEditing() const { return editing; } | 110 | inline bool isEditing() const { return editing; } |
111 | /// always on top? | 111 | /// always on top? |
112 | inline bool isOnTop() const { return on_top; } | 112 | inline bool isOnTop() const { return on_top; } |
113 | /// are we hidden? | 113 | /// are we hidden? |
114 | inline bool isHidden() const { return hidden; } | 114 | inline bool isHidden() const { return hidden; } |
115 | /// do we auto hide the toolbar? | 115 | /// do we auto hide the toolbar? |
116 | inline bool doAutoHide() const { return do_auto_hide; } | 116 | inline bool doAutoHide() const { return do_auto_hide; } |
117 | /// @return X window of the toolbar | 117 | /// @return X window of the toolbar |
118 | inline Window getWindowID() const { return frame.window; } | 118 | inline Window getWindowID() const { return frame.window; } |
119 | inline BScreen *screen() { return m_screen; } | 119 | inline BScreen *screen() { return m_screen; } |
120 | inline const BScreen *screen() const { return m_screen; } | 120 | inline const BScreen *screen() const { return m_screen; } |
121 | inline unsigned int width() const { return frame.width; } | 121 | inline unsigned int width() const { return frame.width; } |
122 | inline unsigned int height() const { return frame.height; } | 122 | inline unsigned int height() const { return frame.height; } |
123 | inline unsigned int exposedHeight() const { return ((do_auto_hide) ? frame.bevel_w : frame.height); } | 123 | inline unsigned int exposedHeight() const { return ((do_auto_hide) ? frame.bevel_w : frame.height); } |
124 | inline int x() const { return ((hidden) ? frame.x_hidden : frame.x); } | 124 | inline int x() const { return ((hidden) ? frame.x_hidden : frame.x); } |
125 | inline int y() const { return ((hidden) ? frame.y_hidden : frame.y); } | 125 | inline int y() const { return ((hidden) ? frame.y_hidden : frame.y); } |
126 | /// @return pointer to iconbar if it got one, else 0 | 126 | /// @return pointer to iconbar if it got one, else 0 |
127 | inline const IconBar *iconBar() const { return m_iconbar.get(); } | 127 | inline const IconBar *iconBar() const { return m_iconbar.get(); } |
128 | /** | 128 | /** |
129 | @name eventhandlers | 129 | @name eventhandlers |
130 | */ | 130 | */ |
131 | //@{ | 131 | //@{ |
132 | void buttonPressEvent(XButtonEvent *be); | 132 | void buttonPressEvent(XButtonEvent *be); |
133 | void buttonReleaseEvent(XButtonEvent *be); | 133 | void buttonReleaseEvent(XButtonEvent *be); |
134 | void enterNotifyEvent(XCrossingEvent *ce); | 134 | void enterNotifyEvent(XCrossingEvent *ce); |
135 | void leaveNotifyEvent(XCrossingEvent *ce); | 135 | void leaveNotifyEvent(XCrossingEvent *ce); |
136 | void exposeEvent(XExposeEvent *ee); | 136 | void exposeEvent(XExposeEvent *ee); |
137 | void keyPressEvent(XKeyEvent *ke); | 137 | void keyPressEvent(XKeyEvent *ke); |
138 | //@} | 138 | //@} |
139 | 139 | ||
140 | void redrawWindowLabel(bool redraw= false); | 140 | void redrawWindowLabel(bool redraw= false); |
141 | void redrawWorkspaceLabel(bool redraw= false); | 141 | void redrawWorkspaceLabel(bool redraw= false); |
142 | void redrawPrevWorkspaceButton(bool pressed = false, bool redraw = false); | 142 | void redrawPrevWorkspaceButton(bool pressed = false, bool redraw = false); |
143 | void redrawNextWorkspaceButton(bool pressed = false, bool redraw = false); | 143 | void redrawNextWorkspaceButton(bool pressed = false, bool redraw = false); |
144 | void redrawPrevWindowButton(bool pressed = false, bool redraw = false); | 144 | void redrawPrevWindowButton(bool pressed = false, bool redraw = false); |
145 | void redrawNextWindowButton(bool pressed = false, bool redraw = false); | 145 | void redrawNextWindowButton(bool pressed = false, bool redraw = false); |
146 | /// enter edit mode on workspace label | 146 | /// enter edit mode on workspace label |
147 | void edit(); | 147 | void edit(); |
148 | void reconfigure(); | 148 | void reconfigure(); |
149 | 149 | ||
150 | void checkClock(bool redraw = false, bool date = false); | 150 | void checkClock(bool redraw = false, bool date = false); |
151 | 151 | ||
152 | virtual void timeout(); | 152 | virtual void timeout(); |
153 | 153 | ||
154 | 154 | ||
155 | private: | 155 | private: |
156 | bool on_top; ///< always on top | 156 | bool on_top; ///< always on top |
157 | bool editing; ///< edit workspace label mode | 157 | bool editing; ///< edit workspace label mode |
158 | bool hidden; ///< hidden state | 158 | bool hidden; ///< hidden state |
159 | bool do_auto_hide; ///< do we auto hide | 159 | bool do_auto_hide; ///< do we auto hide |
160 | Display *display; ///< display connection | 160 | Display *display; ///< display connection |
161 | 161 | ||
162 | struct frame { | 162 | struct frame { |
163 | unsigned long button_pixel, pbutton_pixel; | 163 | unsigned long button_pixel, pbutton_pixel; |
164 | Pixmap base, label, wlabel, clk, button, pbutton; | 164 | Pixmap base, label, wlabel, clk, button, pbutton; |
165 | Window window, workspace_label, window_label, clock, psbutton, nsbutton, | 165 | Window window, workspace_label, window_label, clock, psbutton, nsbutton, |
166 | pwbutton, nwbutton; | 166 | pwbutton, nwbutton; |
167 | 167 | ||
168 | int x, y, x_hidden, y_hidden, hour, minute, grab_x, grab_y; | 168 | int x, y, x_hidden, y_hidden, hour, minute, grab_x, grab_y; |
169 | unsigned int width, height, window_label_w, workspace_label_w, clock_w, | 169 | unsigned int width, height, window_label_w, workspace_label_w, clock_w, |
170 | button_w, bevel_w, label_h; | 170 | button_w, bevel_w, label_h; |
171 | } frame; | 171 | } frame; |
172 | 172 | ||
173 | class HideHandler : public TimeoutHandler { | 173 | class HideHandler : public TimeoutHandler { |
174 | public: | 174 | public: |
175 | Toolbar *toolbar; | 175 | Toolbar *toolbar; |
176 | 176 | ||
177 | virtual void timeout(); | 177 | virtual void timeout(); |
178 | } hide_handler; | 178 | } hide_handler; |
179 | 179 | ||
180 | BScreen *m_screen; | 180 | BScreen *m_screen; |
181 | BImageControl *image_ctrl; | 181 | BImageControl *image_ctrl; |
182 | BTimer clock_timer; ///< timer to update clock | 182 | BTimer clock_timer; ///< timer to update clock |
183 | BTimer hide_timer; ///< timer to for auto hide toolbar | 183 | BTimer hide_timer; ///< timer to for auto hide toolbar |
184 | Toolbarmenu m_toolbarmenu; | 184 | Toolbarmenu m_toolbarmenu; |
185 | std::auto_ptr<IconBar> m_iconbar; | 185 | std::auto_ptr<IconBar> m_iconbar; |
186 | 186 | ||
187 | std::string new_workspace_name; ///< temp variable in edit workspace name mode | 187 | std::string new_workspace_name; ///< temp variable in edit workspace name mode |
188 | 188 | ||
189 | friend class HideHandler; | 189 | friend class HideHandler; |
190 | friend class Toolbarmenu; | 190 | friend class Toolbarmenu; |
191 | friend class Toolbarmenu::Placementmenu; | 191 | friend class Toolbarmenu::Placementmenu; |
192 | 192 | ||
193 | friend class Toolbarmenu::Headmenu; | 193 | friend class Toolbarmenu::Headmenu; |
194 | }; | 194 | }; |
195 | 195 | ||
196 | 196 | ||