]> Dogcows Code - chaz/openbox/blob - src/Slit.h
89d76dafa36ab1e62e4898873c5d5e0353975065
[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 virtual void setValues();
46
47 public:
48 Directionmenu(Slitmenu &);
49 void reconfigure();
50 };
51
52 class Placementmenu : public Basemenu {
53 private:
54 Slitmenu &slitmenu;
55
56 protected:
57 virtual void itemSelected(int, int);
58
59 public:
60 Placementmenu(Slitmenu &);
61 };
62
63 Directionmenu *directionmenu;
64 Placementmenu *placementmenu;
65
66 Slit &slit;
67
68 friend class Directionmenu;
69 friend class Placementmenu;
70 friend class Slit;
71
72
73 protected:
74 virtual void itemSelected(int, int);
75 virtual void internal_hide();
76 virtual void setValues();
77
78 public:
79 Slitmenu(Slit &);
80 virtual ~Slitmenu();
81
82 inline Basemenu *getDirectionmenu() { return directionmenu; }
83 inline Basemenu *getPlacementmenu() { return placementmenu; }
84
85 void reconfigure();
86 };
87
88
89 class Slit : public TimeoutHandler {
90 private:
91 class SlitClient {
92 public:
93 Window window, client_window, icon_window;
94
95 int x, y;
96 unsigned int width, height;
97 };
98
99 bool m_ontop, m_autohide, m_hidden;
100 int m_direction, m_placement;
101 Display *display;
102
103 Openbox &openbox;
104 BScreen &screen;
105 Resource &config;
106 BTimer *timer;
107
108 LinkedList<SlitClient> *clientList;
109 Slitmenu *slitmenu;
110
111 struct frame {
112 Pixmap pixmap;
113 Window window;
114
115 Rect area;
116 Point hidden;
117 } frame;
118
119
120 friend class Slitmenu;
121 friend class Slitmenu::Directionmenu;
122 friend class Slitmenu::Placementmenu;
123
124
125 public:
126 Slit(BScreen &, Resource &);
127 virtual ~Slit();
128
129 inline Slitmenu *getMenu() { return slitmenu; }
130
131 inline const Window &getWindowID() const { return frame.window; }
132
133 inline const Point &origin() const { return frame.area.origin(); }
134 inline const Size &size() const { return frame.area.size(); }
135 inline const Rect &area() const { return frame.area; }
136 inline const Point &hiddenOrigin() const { return frame.hidden; }
137
138 void addClient(Window);
139 void removeClient(SlitClient *, Bool = True);
140 void removeClient(Window, Bool = True);
141 void reconfigure();
142 void load();
143 void save();
144 void reposition();
145 void shutdown();
146
147 void buttonPressEvent(XButtonEvent *);
148 void enterNotifyEvent(XCrossingEvent *);
149 void leaveNotifyEvent(XCrossingEvent *);
150 void configureRequestEvent(XConfigureRequestEvent *);
151
152 virtual void timeout();
153
154 inline bool isHidden() const { return m_hidden; }
155
156 inline bool onTop() const { return m_ontop; }
157 void setOnTop(bool);
158
159 inline bool autoHide() const { return m_autohide; }
160 void setAutoHide(bool);
161
162 inline int placement() const { return m_placement; }
163 void setPlacement(int);
164
165 inline int direction() const { return m_direction; }
166 void setDirection(int);
167
168 enum { Vertical = 1, Horizontal };
169 enum { TopLeft = 1, CenterLeft, BottomLeft, TopCenter, BottomCenter,
170 TopRight, CenterRight, BottomRight };
171 };
172
173
174 #endif // __Slit_hh
This page took 0.038078 seconds and 3 git commands to generate.