diff options
author | fluxgen <fluxgen> | 2001-12-11 20:47:02 (GMT) |
---|---|---|
committer | fluxgen <fluxgen> | 2001-12-11 20:47:02 (GMT) |
commit | 18830ac9add80cbd3bf7369307d7e35a519dca9b (patch) | |
tree | 4759a5434a34ba317fe77bbf8b0ed9bb57bb6018 /src/Slit.hh | |
parent | 1523b48bff07dead084af3064ad11c79a9b25df0 (diff) | |
download | fluxbox_pavel-18830ac9add80cbd3bf7369307d7e35a519dca9b.zip fluxbox_pavel-18830ac9add80cbd3bf7369307d7e35a519dca9b.tar.bz2 |
Initial revision
Diffstat (limited to 'src/Slit.hh')
-rw-r--r-- | src/Slit.hh | 159 |
1 files changed, 159 insertions, 0 deletions
diff --git a/src/Slit.hh b/src/Slit.hh new file mode 100644 index 0000000..cce1d97 --- /dev/null +++ b/src/Slit.hh | |||
@@ -0,0 +1,159 @@ | |||
1 | // Slit.hh for Blackbox - an X11 Window manager | ||
2 | // Copyright (c) 1997 - 2000 Brad Hughes (bhughes@tcac.net) | ||
3 | // | ||
4 | // Permission is hereby granted, free of charge, to any person obtaining a | ||
5 | // copy of this software and associated documentation files (the "Software"), | ||
6 | // to deal in the Software without restriction, including without limitation | ||
7 | // the rights to use, copy, modify, merge, publish, distribute, sublicense, | ||
8 | // and/or sell copies of the Software, and to permit persons to whom the | ||
9 | // Software is furnished to do so, subject to the following conditions: | ||
10 | // | ||
11 | // The above copyright notice and this permission notice shall be included in | ||
12 | // all copies or substantial portions of the Software. | ||
13 | // | ||
14 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
15 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
16 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL | ||
17 | // THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
18 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING | ||
19 | // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER | ||
20 | // DEALINGS IN THE SOFTWARE. | ||
21 | |||
22 | #ifndef _SLIT_HH_ | ||
23 | #define _SLIT_HH_ | ||
24 | |||
25 | #include <X11/Xlib.h> | ||
26 | #include <X11/Xutil.h> | ||
27 | |||
28 | // forward declaration | ||
29 | class Slit; | ||
30 | class Slitmenu; | ||
31 | |||
32 | #include "Basemenu.hh" | ||
33 | #include "LinkedList.hh" | ||
34 | |||
35 | |||
36 | class Slitmenu : public Basemenu { | ||
37 | private: | ||
38 | class Directionmenu : public Basemenu { | ||
39 | private: | ||
40 | Slitmenu *slitmenu; | ||
41 | |||
42 | protected: | ||
43 | virtual void itemSelected(int, int); | ||
44 | |||
45 | public: | ||
46 | Directionmenu(Slitmenu *); | ||
47 | }; | ||
48 | |||
49 | class Placementmenu : public Basemenu { | ||
50 | private: | ||
51 | Slitmenu *slitmenu; | ||
52 | |||
53 | protected: | ||
54 | virtual void itemSelected(int, int); | ||
55 | |||
56 | public: | ||
57 | Placementmenu(Slitmenu *); | ||
58 | }; | ||
59 | |||
60 | Directionmenu *directionmenu; | ||
61 | Placementmenu *placementmenu; | ||
62 | |||
63 | Slit *slit; | ||
64 | |||
65 | friend class Directionmenu; | ||
66 | friend class Placementmenu; | ||
67 | friend class Slit; | ||
68 | |||
69 | |||
70 | protected: | ||
71 | virtual void itemSelected(int, int); | ||
72 | virtual void internal_hide(void); | ||
73 | |||
74 | |||
75 | public: | ||
76 | Slitmenu(Slit *); | ||
77 | virtual ~Slitmenu(void); | ||
78 | |||
79 | inline Basemenu *getDirectionmenu(void) { return directionmenu; } | ||
80 | inline Basemenu *getPlacementmenu(void) { return placementmenu; } | ||
81 | |||
82 | void reconfigure(void); | ||
83 | }; | ||
84 | |||
85 | |||
86 | class Slit : public TimeoutHandler { | ||
87 | private: | ||
88 | class SlitClient { | ||
89 | public: | ||
90 | Window window, client_window, icon_window; | ||
91 | |||
92 | int x, y; | ||
93 | unsigned int width, height; | ||
94 | }; | ||
95 | |||
96 | Bool on_top, hidden, do_auto_hide; | ||
97 | Display *display; | ||
98 | |||
99 | Fluxbox *fluxbox; | ||
100 | BScreen *screen; | ||
101 | BTimer *timer; | ||
102 | |||
103 | LinkedList<SlitClient> *clientList; | ||
104 | Slitmenu *slitmenu; | ||
105 | |||
106 | struct frame { | ||
107 | Pixmap pixmap; | ||
108 | Window window; | ||
109 | |||
110 | int x, y, x_hidden, y_hidden; | ||
111 | unsigned int width, height; | ||
112 | } frame; | ||
113 | |||
114 | friend class Slitmenu; | ||
115 | friend class Slitmenu::Directionmenu; | ||
116 | friend class Slitmenu::Placementmenu; | ||
117 | |||
118 | |||
119 | public: | ||
120 | Slit(BScreen *); | ||
121 | virtual ~Slit(); | ||
122 | |||
123 | inline const Bool &isOnTop(void) const { return on_top; } | ||
124 | inline const Bool &isHidden(void) const { return hidden; } | ||
125 | inline const Bool &doAutoHide(void) const { return do_auto_hide; } | ||
126 | |||
127 | inline Slitmenu *getMenu() { return slitmenu; } | ||
128 | |||
129 | inline const Window &getWindowID() const { return frame.window; } | ||
130 | |||
131 | inline const int &getX(void) const | ||
132 | { return ((hidden) ? frame.x_hidden : frame.x); } | ||
133 | inline const int &getY(void) const | ||
134 | { return ((hidden) ? frame.y_hidden : frame.y); } | ||
135 | |||
136 | inline const unsigned int &getWidth(void) const { return frame.width; } | ||
137 | inline const unsigned int &getHeight(void) const { return frame.height; } | ||
138 | |||
139 | void addClient(Window); | ||
140 | void removeClient(SlitClient *, Bool = True); | ||
141 | void removeClient(Window, Bool = True); | ||
142 | void reconfigure(void); | ||
143 | void reposition(void); | ||
144 | void shutdown(void); | ||
145 | |||
146 | void buttonPressEvent(XButtonEvent *); | ||
147 | void enterNotifyEvent(XCrossingEvent *); | ||
148 | void leaveNotifyEvent(XCrossingEvent *); | ||
149 | void configureRequestEvent(XConfigureRequestEvent *); | ||
150 | |||
151 | virtual void timeout(void); | ||
152 | |||
153 | enum { Vertical = 1, Horizontal }; | ||
154 | enum { TopLeft = 1, CenterLeft, BottomLeft, TopCenter, BottomCenter, | ||
155 | TopRight, CenterRight, BottomRight }; | ||
156 | }; | ||
157 | |||
158 | |||
159 | #endif // __Slit_hh | ||