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>
33 // forward declaration
37 class Slitmenu : public Basemenu {
39 class Directionmenu : public Basemenu {
44 virtual void itemSelected(int, int);
45 virtual void setValues();
48 Directionmenu(Slitmenu &);
52 class Placementmenu : public Basemenu {
57 virtual void itemSelected(int, int);
60 Placementmenu(Slitmenu &);
63 Directionmenu *directionmenu;
64 Placementmenu *placementmenu;
68 friend class Directionmenu;
69 friend class Placementmenu;
74 virtual void itemSelected(int, int);
75 virtual void internal_hide();
76 virtual void setValues();
82 inline Basemenu *getDirectionmenu() { return directionmenu; }
83 inline Basemenu *getPlacementmenu() { return placementmenu; }
89 class Slit : public TimeoutHandler {
93 Window window, client_window, icon_window;
96 unsigned int width, height;
99 bool m_ontop, m_autohide, m_hidden;
100 int m_direction, m_placement;
108 typedef std::list<SlitClient *> slitClientList;
109 slitClientList clientList;
121 friend class Slitmenu;
122 friend class Slitmenu::Directionmenu;
123 friend class Slitmenu::Placementmenu;
127 Slit(BScreen &, Resource &);
130 inline Slitmenu *getMenu() { return slitmenu; }
132 inline const Window &getWindowID() const { return frame.window; }
134 inline const Point &origin() const { return frame.area.origin(); }
135 inline const Size &size() const { return frame.area.size(); }
136 inline const Rect &area() const { return frame.area; }
137 inline const Point &hiddenOrigin() const { return frame.hidden; }
139 void addClient(Window);
140 void removeClient(SlitClient *, Bool = True);
141 void removeClient(Window, Bool = True);
148 void buttonPressEvent(XButtonEvent *);
149 void enterNotifyEvent(XCrossingEvent *);
150 void leaveNotifyEvent(XCrossingEvent *);
151 void configureRequestEvent(XConfigureRequestEvent *);
153 virtual void timeout();
155 inline bool isHidden() const { return m_hidden; }
157 inline bool onTop() const { return m_ontop; }
160 inline bool autoHide() const { return m_autohide; }
161 void setAutoHide(bool);
163 inline int placement() const { return m_placement; }
164 void setPlacement(int);
166 inline int direction() const { return m_direction; }
167 void setDirection(int);
169 enum { Vertical = 1, Horizontal };
170 enum { TopLeft = 1, CenterLeft, BottomLeft, TopCenter, BottomCenter,
171 TopRight, CenterRight, BottomRight };