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);
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 LinkedList<SlitClient> *clientList;
120 friend class Slitmenu;
121 friend class Slitmenu::Directionmenu;
122 friend class Slitmenu::Placementmenu;
126 Slit(BScreen &, Resource &);
129 inline Slitmenu *getMenu() { return slitmenu; }
131 inline const Window &getWindowID() const { return frame.window; }
133 inline const Point &origin() const { return frame.area.origin(); }
134 inline const Size &size() const { return frame.area.size(); }
135 inline const Rect &area() const { return frame.area; }
137 void addClient(Window);
138 void removeClient(SlitClient *, Bool = True);
139 void removeClient(Window, Bool = True);
146 void buttonPressEvent(XButtonEvent *);
147 void enterNotifyEvent(XCrossingEvent *);
148 void leaveNotifyEvent(XCrossingEvent *);
149 void configureRequestEvent(XConfigureRequestEvent *);
151 virtual void timeout();
153 inline bool isHidden() const { return m_hidden; }
155 inline bool onTop() const { return m_ontop; }
158 inline bool autoHide() const { return m_autohide; }
159 void setAutoHide(bool);
161 inline int placement() const { return m_placement; }
162 void setPlacement(int);
164 inline int direction() const { return m_direction; }
165 void setDirection(int);
167 enum { Vertical = 1, Horizontal };
168 enum { TopLeft = 1, CenterLeft, BottomLeft, TopCenter, BottomCenter,
169 TopRight, CenterRight, BottomRight };