Debian Codegraph @

src/Slit.hh

raw
1 // -*- mode: C++; indent-tabs-mode: nil; c-basic-offset: 2; -*-
2 // Slit.hh for Blackbox - an X11 Window manager
3 // Copyright (c) 2001 - 2005 Sean 'Shaleh' Perry <[email protected]>
4 // Copyright (c) 1997 - 2000, 2002 - 2005
5 // Bradley T Hughes <bhughes at trolltech.com>
6 //
7 // Permission is hereby granted, free of charge, to any person obtaining a
8 // copy of this software and associated documentation files (the "Software"),
9 // to deal in the Software without restriction, including without limitation
10 // the rights to use, copy, modify, merge, publish, distribute, sublicense,
11 // and/or sell copies of the Software, and to permit persons to whom the
12 // Software is furnished to do so, subject to the following conditions:
13 //
14 // The above copyright notice and this permission notice shall be included in
15 // all copies or substantial portions of the Software.
16 //
17 // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
18 // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
19 // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
20 // THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
21 // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
22 // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
23 // DEALINGS IN THE SOFTWARE.
24
25 #ifndef __Slit_hh
26 #define __Slit_hh
27
28 #include <Util.hh>
29
30 #include "BlackboxResource.hh"
31 #include "Screen.hh"
32
33 class Slit : public StackEntity, public bt::TimeoutHandler,
34 public bt::EventHandler, public bt::NoCopy
35 {
36 public:
37 struct SlitClient {
38 Window window;
39 Window client_window;
40 Window icon_window;
41 bt::Rect rect;
42 };
43
44 private:
45 typedef std::list<SlitClient*> SlitClientList;
46
47 bool hidden;
48 Display *display;
49
50 Blackbox *blackbox;
51 BScreen *screen;
52 bt::Timer *timer;
53 bt::EWMH::Strut strut;
54
55 SlitClientList clientList;
56
57 struct SlitFrame {
58 Pixmap pixmap;
59 Window window;
60
61 int x_hidden, y_hidden;
62 bt::Rect rect;
63 } frame;
64
65 void updateStrut(void);
66
67 public:
68 Slit(BScreen *scr);
69 virtual ~Slit(void);
70
71 bool isHidden(void) const { return hidden; }
72
73 // StackEntity interface
74 Window windowID(void) const { return frame.window; }
75
76 unsigned int exposedWidth(void) const;
77 unsigned int exposedHeight(void) const;
78
79 void addClient(Window w);
80 void removeClient(SlitClient *client, bool remap = True);
81 void removeClient(Window w, bool remap = True);
82 void reconfigure(void);
83 void updateSlit(void);
84 void reposition(void);
85 void shutdown(void);
86 void toggleAutoHide(void);
87
88 // EventHandler interface
89 void buttonPressEvent(const XButtonEvent * const event);
90 void enterNotifyEvent(const XCrossingEvent * const /*unused*/);
91 void leaveNotifyEvent(const XCrossingEvent * const /*unused*/);
92 void configureRequestEvent(const XConfigureRequestEvent * const event);
93 void unmapNotifyEvent(const XUnmapEvent * const event);
94 void reparentNotifyEvent(const XReparentEvent * const event);
95 void exposeEvent(const XExposeEvent * const event);
96
97 virtual void timeout(bt::Timer *);
98
99 enum Direction { Vertical = 1, Horizontal };
100 enum Placement { TopLeft = 1, CenterLeft, BottomLeft,
101 TopCenter, BottomCenter,
102 TopRight, CenterRight, BottomRight };
103
104 Direction direction(void) const;
105 Placement placement(void) const;
106 };
107
108 #endif // __Slit_hh