]> Dogcows Code - chaz/openbox/blob - src/Slit.h
reversed tehmouse wheel buttons on the root window. scrolling up now goes to the...
[chaz/openbox] / src / Slit.h
1 // Slit.h for Openbox
2 // Copyright (c) 2001 Sean 'Shaleh' Perry <shaleh@debian.org>
3 // Copyright (c) 1997 - 2000 Brad Hughes (bhughes@tcac.net)
4 //
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:
11 //
12 // The above copyright notice and this permission notice shall be included in
13 // all copies or substantial portions of the Software.
14 //
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.
22
23 #ifndef __Slit_hh
24 #define __Slit_hh
25
26 #include <X11/Xlib.h>
27 #include <X11/Xutil.h>
28
29 #include "Basemenu.h"
30 #include "LinkedList.h"
31 #include "Geometry.h"
32
33 // forward declaration
34 class Slit;
35 class Slitmenu;
36
37 class Slitmenu : public Basemenu {
38 private:
39 class Directionmenu : public Basemenu {
40 private:
41 Slitmenu &slitmenu;
42
43 protected:
44 virtual void itemSelected(int, int);
45
46 public:
47 Directionmenu(Slitmenu &);
48 };
49
50 class Placementmenu : public Basemenu {
51 private:
52 Slitmenu &slitmenu;
53
54 protected:
55 virtual void itemSelected(int, int);
56
57 public:
58 Placementmenu(Slitmenu &);
59 };
60
61 Directionmenu *directionmenu;
62 Placementmenu *placementmenu;
63
64 Slit &slit;
65
66 friend class Directionmenu;
67 friend class Placementmenu;
68 friend class Slit;
69
70
71 protected:
72 virtual void itemSelected(int, int);
73 virtual void internal_hide(void);
74
75
76 public:
77 Slitmenu(Slit &);
78 virtual ~Slitmenu(void);
79
80 inline Basemenu *getDirectionmenu(void) { return directionmenu; }
81 inline Basemenu *getPlacementmenu(void) { return placementmenu; }
82
83 void reconfigure(void);
84 };
85
86
87 class Slit : public TimeoutHandler {
88 private:
89 class SlitClient {
90 public:
91 Window window, client_window, icon_window;
92
93 int x, y;
94 unsigned int width, height;
95 };
96
97 Bool on_top, hidden, do_auto_hide;
98 Display *display;
99
100 Openbox &openbox;
101 BScreen &screen;
102 BTimer *timer;
103
104 LinkedList<SlitClient> *clientList;
105 Slitmenu *slitmenu;
106
107 struct frame {
108 Pixmap pixmap;
109 Window window;
110
111 //int x, y, x_hidden, y_hidden;
112 //unsigned int width, height;
113 Rect area;
114 Point hidden;
115 } frame;
116
117
118 friend class Slitmenu;
119 friend class Slitmenu::Directionmenu;
120 friend class Slitmenu::Placementmenu;
121
122
123 public:
124 Slit(BScreen &);
125 virtual ~Slit();
126
127 inline const Bool &isOnTop(void) const { return on_top; }
128 inline const Bool &isHidden(void) const { return hidden; }
129 inline const Bool &doAutoHide(void) const { return do_auto_hide; }
130
131 inline Slitmenu *getMenu() { return slitmenu; }
132
133 inline const Window &getWindowID() const { return frame.window; }
134
135 //inline const int &getX(void) const
136 //{ return ((hidden) ? frame.x_hidden : frame.x); }
137 //inline const int &getY(void) const
138 //{ return ((hidden) ? frame.y_hidden : frame.y); }
139 inline const Point &origin() const { return frame.area.origin(); }
140
141 //inline const unsigned int &getWidth(void) const { return frame.width; }
142 //inline const unsigned int &getHeight(void) const { return frame.height; }
143 inline const Size &size() const { return frame.area.size(); }
144
145 inline const Rect &area() const { return frame.area; }
146
147 void addClient(Window);
148 void removeClient(SlitClient *, Bool = True);
149 void removeClient(Window, Bool = True);
150 void reconfigure(void);
151 void reposition(void);
152 void shutdown(void);
153
154 void buttonPressEvent(XButtonEvent *);
155 void enterNotifyEvent(XCrossingEvent *);
156 void leaveNotifyEvent(XCrossingEvent *);
157 void configureRequestEvent(XConfigureRequestEvent *);
158
159 virtual void timeout(void);
160
161 enum { Vertical = 1, Horizontal };
162 enum { TopLeft = 1, CenterLeft, BottomLeft, TopCenter, BottomCenter,
163 TopRight, CenterRight, BottomRight };
164 };
165
166
167 #endif // __Slit_hh
This page took 0.042986 seconds and 4 git commands to generate.