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.
27 #include <X11/Xutil.h>
30 #include "LinkedList.h"
32 // forward declaration
36 class Slitmenu : public Basemenu {
38 class Directionmenu : public Basemenu {
43 virtual void itemSelected(int, int);
46 Directionmenu(Slitmenu *);
49 class Placementmenu : public Basemenu {
54 virtual void itemSelected(int, int);
57 Placementmenu(Slitmenu *);
60 Directionmenu *directionmenu;
61 Placementmenu *placementmenu;
65 friend class Directionmenu;
66 friend class Placementmenu;
71 virtual void itemSelected(int, int);
72 virtual void internal_hide(void);
77 virtual ~Slitmenu(void);
79 inline Basemenu *getDirectionmenu(void) { return directionmenu; }
80 inline Basemenu *getPlacementmenu(void) { return placementmenu; }
82 void reconfigure(void);
86 class Slit : public TimeoutHandler {
90 Window window, client_window, icon_window;
93 unsigned int width, height;
96 Bool on_top, hidden, do_auto_hide;
103 LinkedList<SlitClient> *clientList;
110 int x, y, x_hidden, y_hidden;
111 unsigned int width, height;
114 friend class Slitmenu;
115 friend class Slitmenu::Directionmenu;
116 friend class Slitmenu::Placementmenu;
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; }
127 inline Slitmenu *getMenu() { return slitmenu; }
129 inline const Window &getWindowID() const { return frame.window; }
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); }
136 inline const unsigned int &getWidth(void) const { return frame.width; }
137 inline const unsigned int &getHeight(void) const { return frame.height; }
139 void addClient(Window);
140 void removeClient(SlitClient *, Bool = True);
141 void removeClient(Window, Bool = True);
142 void reconfigure(void);
143 void reposition(void);
146 void buttonPressEvent(XButtonEvent *);
147 void enterNotifyEvent(XCrossingEvent *);
148 void leaveNotifyEvent(XCrossingEvent *);
149 void configureRequestEvent(XConfigureRequestEvent *);
151 virtual void timeout(void);
153 enum { Vertical = 1, Horizontal };
154 enum { TopLeft = 1, CenterLeft, BottomLeft, TopCenter, BottomCenter,
155 TopRight, CenterRight, BottomRight };