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"
33 // forward declaration
37 class Slitmenu : public Basemenu {
39 class Directionmenu : public Basemenu {
44 virtual void itemSelected(int, int);
47 Directionmenu(Slitmenu &);
50 class Placementmenu : public Basemenu {
55 virtual void itemSelected(int, int);
58 Placementmenu(Slitmenu &);
61 Directionmenu *directionmenu;
62 Placementmenu *placementmenu;
66 friend class Directionmenu;
67 friend class Placementmenu;
72 virtual void itemSelected(int, int);
73 virtual void internal_hide();
80 inline Basemenu *getDirectionmenu() { return directionmenu; }
81 inline Basemenu *getPlacementmenu() { return placementmenu; }
87 class Slit : public TimeoutHandler {
91 Window window, client_window, icon_window;
94 unsigned int width, height;
97 bool m_ontop, m_autohide, m_hidden;
98 int m_direction, m_placement;
106 LinkedList<SlitClient> *clientList;
118 friend class Slitmenu;
119 friend class Slitmenu::Directionmenu;
120 friend class Slitmenu::Placementmenu;
124 Slit(BScreen &, Resource &);
127 inline Slitmenu *getMenu() { return slitmenu; }
129 inline const Window &getWindowID() const { return frame.window; }
131 inline const Point &origin() const { return frame.area.origin(); }
132 inline const Size &size() const { return frame.area.size(); }
133 inline const Rect &area() const { return frame.area; }
135 void addClient(Window);
136 void removeClient(SlitClient *, Bool = True);
137 void removeClient(Window, Bool = True);
144 void buttonPressEvent(XButtonEvent *);
145 void enterNotifyEvent(XCrossingEvent *);
146 void leaveNotifyEvent(XCrossingEvent *);
147 void configureRequestEvent(XConfigureRequestEvent *);
149 virtual void timeout();
151 inline bool isHidden() const { return m_hidden; }
153 inline bool onTop() const { return m_ontop; }
156 inline bool autoHide() const { return m_autohide; }
157 void setAutoHide(bool);
159 inline int placement() const { return m_placement; }
160 void setPlacement(int);
162 inline int direction() const { return m_direction; }
163 void setDirection(int);
165 enum { Vertical = 1, Horizontal };
166 enum { TopLeft = 1, CenterLeft, BottomLeft, TopCenter, BottomCenter,
167 TopRight, CenterRight, BottomRight };