]>
Dogcows Code - chaz/openbox/blob - src/Toolbar.h
1 // Toolbar.h for Openbox
2 // Copyright (c) 2001 Sean 'Shaleh' Perry <shaleh@debian.org>
3 // Copyright (c) 1997 - 2000 Brad Hughes (bhughes@tcac.net)
5 // Permission is hereby granted, free of charge, to any person obtaining a
6 // copy of this software and associated documentation files (the "Software"),
7 // to deal in the Software without restriction, including without limitation
8 // the rights to use, copy, modify, merge, publish, distribute, sublicense,
9 // and/or sell copies of the Software, and to permit persons to whom the
10 // Software is furnished to do so, subject to the following conditions:
12 // The above copyright notice and this permission notice shall be included in
13 // all copies or substantial portions of the Software.
15 // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
18 // THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
20 // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
21 // DEALINGS IN THE SOFTWARE.
31 // forward declaration
34 class Toolbarmenu
: public Basemenu
{
36 class Placementmenu
: public Basemenu
{
38 Toolbarmenu
&toolbarmenu
;
41 virtual void itemSelected(int, int);
44 Placementmenu(Toolbarmenu
&);
48 Placementmenu
*placementmenu
;
50 friend class Placementmenu
;
55 virtual void itemSelected(int, int);
56 virtual void internal_hide(void);
59 Toolbarmenu(Toolbar
&);
62 inline Basemenu
*getPlacementmenu(void) { return placementmenu
; }
64 void reconfigure(void);
68 class Toolbar
: public TimeoutHandler
{
70 Bool on_top
, editing
, hidden
, do_auto_hide
, do_hide
;
74 unsigned long button_pixel
, pbutton_pixel
;
75 Pixmap base
, label
, wlabel
, clk
, button
, pbutton
;
76 Window window
, workspace_label
, window_label
, clock
, psbutton
, nsbutton
,
79 int x
, y
, x_hidden
, y_hidden
, hour
, minute
, grab_x
, grab_y
;
80 unsigned int width
, height
, window_label_w
, workspace_label_w
, clock_w
,
81 button_w
, bevel_w
, label_h
;
84 class HideHandler
: public TimeoutHandler
{
88 virtual void timeout(void);
92 BImageControl
*image_ctrl
;
94 BTimer
*clock_timer
, *hide_timer
;
95 Toolbarmenu
*toolbarmenu
;
97 char *new_workspace_name
;
100 friend class HideHandler
;
101 friend class Toolbarmenu
;
102 friend class Toolbarmenu::Placementmenu
;
107 virtual ~Toolbar(void);
109 inline Toolbarmenu
*getMenu(void) { return toolbarmenu
; }
111 inline const Bool
&isEditing(void) const { return editing
; }
112 inline const Bool
&isOnTop(void) const { return on_top
; }
113 inline const Bool
&isHidden(void) const { return hidden
; }
114 inline const Bool
&doAutoHide(void) const { return do_auto_hide
; }
116 inline const Window
&getWindowID(void) const { return frame
.window
; }
118 inline const unsigned int &getWidth(void) const { return frame
.width
; }
119 inline const unsigned int &getHeight(void) const { return frame
.height
; }
120 inline const unsigned int getExposedHeight(void) const {
121 if (do_hide
) return 0;
122 else if (do_auto_hide
) return frame
.bevel_w
;
123 else return frame
.height
;
126 inline const int &getX(void) const
127 { return ((hidden
) ? frame
.x_hidden
: frame
.x
); }
128 inline const int getY(void) const
129 { return ((hidden
|| do_hide
) ? frame
.y_hidden
: frame
.y
); }
131 void buttonPressEvent(XButtonEvent
*);
132 void buttonReleaseEvent(XButtonEvent
*);
133 void enterNotifyEvent(XCrossingEvent
*);
134 void leaveNotifyEvent(XCrossingEvent
*);
135 void exposeEvent(XExposeEvent
*);
136 void keyPressEvent(XKeyEvent
*);
138 void redrawWindowLabel(Bool
= False
);
139 void redrawWorkspaceLabel(Bool
= False
);
140 void redrawPrevWorkspaceButton(Bool
= False
, Bool
= False
);
141 void redrawNextWorkspaceButton(Bool
= False
, Bool
= False
);
142 void redrawPrevWindowButton(Bool
= False
, Bool
= False
);
143 void redrawNextWindowButton(Bool
= False
, Bool
= False
);
145 void reconfigure(void);
146 void mapToolbar(void);
147 void unMapToolbar(void);
149 void checkClock(Bool
= False
);
150 #else // HAVE_STRFTIME
151 void checkClock(Bool
= False
, Bool
= False
);
152 #endif // HAVE_STRFTIME
154 virtual void timeout(void);
156 enum { TopLeft
= 1, BottomLeft
, TopCenter
,
157 BottomCenter
, TopRight
, BottomRight
};
161 #endif // __Toolbar_hh
This page took 0.04146 seconds and 4 git commands to generate.