diff options
Diffstat (limited to 'src/Slit.hh')
-rw-r--r-- | src/Slit.hh | 189 |
1 files changed, 96 insertions, 93 deletions
diff --git a/src/Slit.hh b/src/Slit.hh index 2c29af6..d07cfe0 100644 --- a/src/Slit.hh +++ b/src/Slit.hh | |||
@@ -1,3 +1,6 @@ | |||
1 | // Slit.hh for Fluxbox | ||
2 | // Copyright (c) 2002 Henrik Kinnunen (fluxgen@linuxmail.org) | ||
3 | // | ||
1 | // Slit.hh for Blackbox - an X11 Window manager | 4 | // Slit.hh for Blackbox - an X11 Window manager |
2 | // Copyright (c) 1997 - 2000 Brad Hughes (bhughes@tcac.net) | 5 | // Copyright (c) 1997 - 2000 Brad Hughes (bhughes@tcac.net) |
3 | // | 6 | // |
@@ -18,9 +21,9 @@ | |||
18 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING | 21 | // 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 | 22 | // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER |
20 | // DEALINGS IN THE SOFTWARE. | 23 | // DEALINGS IN THE SOFTWARE. |
21 | 24 | ||
22 | #ifndef SLIT_HH | 25 | #ifndef SLIT_HH |
23 | #define SLIT_HH | 26 | #define SLIT_HH |
24 | 27 | ||
25 | #include <X11/Xlib.h> | 28 | #include <X11/Xlib.h> |
26 | #include <X11/Xutil.h> | 29 | #include <X11/Xutil.h> |
@@ -35,126 +38,126 @@ class Slitmenu; | |||
35 | 38 | ||
36 | class Slitmenu : public Basemenu { | 39 | class Slitmenu : public Basemenu { |
37 | private: | 40 | private: |
38 | class Directionmenu : public Basemenu { | 41 | class Directionmenu : public Basemenu { |
39 | private: | 42 | private: |
40 | Slitmenu *slitmenu; | 43 | Slitmenu *slitmenu; |
41 | 44 | ||
42 | protected: | 45 | protected: |
43 | virtual void itemSelected(int, int); | 46 | virtual void itemSelected(int, int); |
44 | 47 | ||
45 | public: | 48 | public: |
46 | Directionmenu(Slitmenu *); | 49 | Directionmenu(Slitmenu *); |
47 | }; | 50 | }; |
48 | 51 | ||
49 | class Placementmenu : public Basemenu { | 52 | class Placementmenu : public Basemenu { |
50 | private: | 53 | private: |
51 | Slitmenu *slitmenu; | 54 | Slitmenu *slitmenu; |
52 | 55 | ||
53 | protected: | 56 | protected: |
54 | virtual void itemSelected(int, int); | 57 | virtual void itemSelected(int, int); |
55 | 58 | ||
56 | public: | 59 | public: |
57 | Placementmenu(Slitmenu *); | 60 | Placementmenu(Slitmenu *); |
58 | }; | 61 | }; |
59 | 62 | ||
60 | Directionmenu *directionmenu; | 63 | Directionmenu *directionmenu; |
61 | Placementmenu *placementmenu; | 64 | Placementmenu *placementmenu; |
62 | 65 | ||
63 | Slit *slit; | 66 | Slit *slit; |
64 | 67 | ||
65 | friend class Directionmenu; | 68 | friend class Directionmenu; |
66 | friend class Placementmenu; | 69 | friend class Placementmenu; |
67 | friend class Slit; | 70 | friend class Slit; |
68 | 71 | ||
69 | 72 | ||
70 | protected: | 73 | protected: |
71 | virtual void itemSelected(int, int); | 74 | virtual void itemSelected(int, int); |
72 | virtual void internal_hide(void); | 75 | virtual void internal_hide(void); |
73 | 76 | ||
74 | 77 | ||
75 | public: | 78 | public: |
76 | Slitmenu(Slit *); | 79 | explicit Slitmenu(Slit *); |
77 | virtual ~Slitmenu(void); | 80 | virtual ~Slitmenu(void); |
78 | 81 | ||
79 | inline Basemenu *getDirectionmenu(void) { return directionmenu; } | 82 | inline Basemenu *getDirectionmenu(void) { return directionmenu; } |
80 | inline Basemenu *getPlacementmenu(void) { return placementmenu; } | 83 | inline Basemenu *getPlacementmenu(void) { return placementmenu; } |
81 | 84 | ||
82 | void reconfigure(void); | 85 | void reconfigure(void); |
83 | }; | 86 | }; |
84 | 87 | ||
85 | 88 | ||
86 | class Slit : public TimeoutHandler { | 89 | 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 | typedef std::list<SlitClient *> SlitClients; | ||
104 | |||
105 | SlitClients clientList; | ||
106 | Slitmenu *slitmenu; | ||
107 | |||
108 | struct frame { | ||
109 | Pixmap pixmap; | ||
110 | Window window; | ||
111 | |||
112 | int x, y, x_hidden, y_hidden; | ||
113 | unsigned int width, height; | ||
114 | } frame; | ||
115 | |||
116 | friend class Slitmenu; | ||
117 | friend class Slitmenu::Directionmenu; | ||
118 | friend class Slitmenu::Placementmenu; | ||
119 | |||
120 | |||
121 | public: | 90 | public: |
122 | Slit(BScreen *); | 91 | explicit Slit(BScreen *); |
123 | virtual ~Slit(); | 92 | virtual ~Slit(); |
93 | |||
94 | inline const bool isOnTop(void) const { return on_top; } | ||
95 | inline const bool isHidden(void) const { return hidden; } | ||
96 | inline const bool doAutoHide(void) const { return do_auto_hide; } | ||
124 | 97 | ||
125 | inline const Bool &isOnTop(void) const { return on_top; } | 98 | Slitmenu &getMenu() { return slitmenu; } |
126 | inline const Bool &isHidden(void) const { return hidden; } | ||
127 | inline const Bool &doAutoHide(void) const { return do_auto_hide; } | ||
128 | 99 | ||
129 | inline Slitmenu *getMenu() { return slitmenu; } | 100 | inline const Window &getWindowID() const { return frame.window; } |
130 | 101 | ||
131 | inline const Window &getWindowID() const { return frame.window; } | 102 | inline const int getX(void) const |
103 | { return ((hidden) ? frame.x_hidden : frame.x); } | ||
104 | inline const int getY(void) const | ||
105 | { return ((hidden) ? frame.y_hidden : frame.y); } | ||
132 | 106 | ||
133 | inline const int &getX(void) const | 107 | inline const unsigned int getWidth(void) const { return frame.width; } |
134 | { return ((hidden) ? frame.x_hidden : frame.x); } | 108 | inline const unsigned int getHeight(void) const { return frame.height; } |
135 | inline const int &getY(void) const | ||
136 | { return ((hidden) ? frame.y_hidden : frame.y); } | ||
137 | 109 | ||
138 | inline const unsigned int &getWidth(void) const { return frame.width; } | 110 | void addClient(Window); |
139 | inline const unsigned int &getHeight(void) const { return frame.height; } | 111 | void removeClient(Window, bool = true); |
112 | void reconfigure(void); | ||
113 | void reposition(void); | ||
114 | void shutdown(void); | ||
140 | 115 | ||
141 | void addClient(Window); | 116 | void buttonPressEvent(XButtonEvent *); |
142 | void removeClient(SlitClient *, bool = true); | 117 | void enterNotifyEvent(XCrossingEvent *); |
143 | void removeClient(Window, bool = true); | 118 | void leaveNotifyEvent(XCrossingEvent *); |
144 | void reconfigure(void); | 119 | void configureRequestEvent(XConfigureRequestEvent *); |
145 | void reposition(void); | ||
146 | void shutdown(void); | ||
147 | 120 | ||
148 | void buttonPressEvent(XButtonEvent *); | 121 | virtual void timeout(void); |
149 | void enterNotifyEvent(XCrossingEvent *); | ||
150 | void leaveNotifyEvent(XCrossingEvent *); | ||
151 | void configureRequestEvent(XConfigureRequestEvent *); | ||
152 | 122 | ||
153 | virtual void timeout(void); | 123 | enum { VERTICAL = 1, HORIZONTAL }; |
124 | enum { TOPLEFT = 1, CENTERLEFT, BOTTOMLEFT, TOPCENTER, BOTTOMCENTER, | ||
125 | TOPRIGHT, CENTERRIGHT, BOTTOMRIGHT }; | ||
154 | 126 | ||
155 | enum { VERTICAL = 1, HORIZONTAL }; | 127 | private: |
156 | enum { TOPLEFT = 1, CENTERLEFT, BOTTOMLEFT, TOPCENTER, BOTTOMCENTER, | 128 | class SlitClient { |
157 | TOPRIGHT, CENTERRIGHT, BOTTOMRIGHT }; | 129 | public: |
130 | Window window, client_window, icon_window; | ||
131 | |||
132 | int x, y; | ||
133 | unsigned int width, height; | ||
134 | }; | ||
135 | |||
136 | void removeClient(SlitClient *, bool = true); | ||
137 | |||
138 | Bool on_top, hidden, do_auto_hide; | ||
139 | Display *display; | ||
140 | |||
141 | Fluxbox *fluxbox; | ||
142 | BScreen *screen; | ||
143 | BTimer timer; | ||
144 | |||
145 | typedef std::list<SlitClient *> SlitClients; | ||
146 | |||
147 | SlitClients clientList; | ||
148 | Slitmenu slitmenu; | ||
149 | |||
150 | struct frame { | ||
151 | Pixmap pixmap; | ||
152 | Window window; | ||
153 | |||
154 | int x, y, x_hidden, y_hidden; | ||
155 | unsigned int width, height; | ||
156 | } frame; | ||
157 | |||
158 | friend class Slitmenu; | ||
159 | friend class Slitmenu::Directionmenu; | ||
160 | friend class Slitmenu::Placementmenu; | ||
158 | }; | 161 | }; |
159 | 162 | ||
160 | 163 | ||