aboutsummaryrefslogtreecommitdiff
path: root/src/Slit.hh
diff options
context:
space:
mode:
Diffstat (limited to 'src/Slit.hh')
-rw-r--r--src/Slit.hh248
1 files changed, 121 insertions, 127 deletions
diff --git a/src/Slit.hh b/src/Slit.hh
index cce1d97..10b141a 100644
--- a/src/Slit.hh
+++ b/src/Slit.hh
@@ -1,5 +1,8 @@
1// Slit.hh for Fluxbox
2// Copyright (c) 2002 - 2003 Henrik Kinnunen (fluxgen at users.sourceforge.net)
3//
1// Slit.hh for Blackbox - an X11 Window manager 4// Slit.hh for Blackbox - an X11 Window manager
2// Copyright (c) 1997 - 2000 Brad Hughes (bhughes@tcac.net) 5// Copyright (c) 1997 - 2000 Brad Hughes (bhughes at tcac.net)
3// 6//
4// Permission is hereby granted, free of charge, to any person obtaining a 7// Permission is hereby granted, free of charge, to any person obtaining a
5// copy of this software and associated documentation files (the "Software"), 8// copy of this software and associated documentation files (the "Software"),
@@ -18,142 +21,133 @@
18// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 21// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
19// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 22// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
20// DEALINGS IN THE SOFTWARE. 23// DEALINGS IN THE SOFTWARE.
21 24
22#ifndef _SLIT_HH_ 25/// $Id: Slit.hh,v 1.30 2003/05/17 11:00:50 fluxgen Exp $
23#define _SLIT_HH_
24
25#include <X11/Xlib.h>
26#include <X11/Xutil.h>
27
28// forward declaration
29class Slit;
30class Slitmenu;
31
32#include "Basemenu.hh"
33#include "LinkedList.hh"
34
35
36class Slitmenu : public Basemenu {
37private:
38 class Directionmenu : public Basemenu {
39 private:
40 Slitmenu *slitmenu;
41
42 protected:
43 virtual void itemSelected(int, int);
44
45 public:
46 Directionmenu(Slitmenu *);
47 };
48 26
49 class Placementmenu : public Basemenu { 27#ifndef SLIT_HH
50 private: 28#define SLIT_HH
51 Slitmenu *slitmenu;
52 29
53 protected: 30#include "Menu.hh"
54 virtual void itemSelected(int, int); 31#include "FbWindow.hh"
55 32#include "Timer.hh"
56 public: 33#include "XLayerItem.hh"
57 Placementmenu(Slitmenu *); 34#include "LayerMenu.hh"
58 };
59
60 Directionmenu *directionmenu;
61 Placementmenu *placementmenu;
62
63 Slit *slit;
64
65 friend class Directionmenu;
66 friend class Placementmenu;
67 friend class Slit;
68 35
36#include <X11/Xlib.h>
37#include <X11/Xutil.h>
69 38
70protected: 39#include <list>
71 virtual void itemSelected(int, int); 40#include <string>
72 virtual void internal_hide(void); 41#include <memory>
73 42
43class SlitTheme;
44class SlitClient;
45class BScreen;
46class FbMenu;
74 47
48/// Handles dock apps
49class Slit : public FbTk::TimeoutHandler, public FbTk::EventHandler {
75public: 50public:
76 Slitmenu(Slit *); 51
77 virtual ~Slitmenu(void); 52 /**
78 53 Client alignment
79 inline Basemenu *getDirectionmenu(void) { return directionmenu; } 54 */
80 inline Basemenu *getPlacementmenu(void) { return placementmenu; } 55 enum Direction { VERTICAL = 1, HORIZONTAL };
81 56 /**
82 void reconfigure(void); 57 Placement on screen
83}; 58 */
59 enum Placement { TOPLEFT = 1, CENTERLEFT, BOTTOMLEFT, TOPCENTER, BOTTOMCENTER,
60 TOPRIGHT, CENTERRIGHT, BOTTOMRIGHT };
61 Slit(BScreen &screen, FbTk::XLayer &layer, const char *filename = 0);
62 virtual ~Slit();
63
64 inline bool isHidden() const { return m_hidden; }
65 inline bool doAutoHide() const { return m_do_auto_hide; }
66 inline Direction direction() const { return m_direction; }
67 inline Placement placement() const { return m_placement; }
68 FbTk::Menu &menu() { return m_slitmenu; }
69
70 inline const FbTk::FbWindow &window() const { return frame.window; }
71
72 inline int x() const { return (m_hidden ? frame.x_hidden : frame.x); }
73 inline int y() const { return (m_hidden ? frame.y_hidden : frame.y); }
74
75 inline unsigned int width() const { return frame.width; }
76 inline unsigned int height() const { return frame.height; }
77
78 void setDirection(Direction dir);
79 void setPlacement(Placement place);
80 void setAutoHide(bool val);
81 void addClient(Window clientwin);
82 void removeClient(Window clientwin, bool remap = true);
83 void reconfigure();
84 void reposition();
85 void shutdown();
86 /// save clients name in a file
87 void saveClientList();
88 /// cycle slit clients up one step
89 void cycleClientsUp();
90 /// cycle slit clients down one step
91 void cycleClientsDown();
92
93 BScreen &screen() { return m_screen; }
94 const BScreen &screen() const { return m_screen; }
95 /**
96 @name eventhandlers
97 */
98 //@{
99 void handleEvent(XEvent &event);
100 void buttonPressEvent(XButtonEvent &event);
101 void enterNotifyEvent(XCrossingEvent &event);
102 void leaveNotifyEvent(XCrossingEvent &event);
103 void configureRequestEvent(XConfigureRequestEvent &event);
104 void exposeEvent(XExposeEvent &event);
105 //@}
106
107 void moveToLayer(int layernum);
108 FbTk::XLayerItem &layerItem() { return *m_layeritem; }
109
110 virtual void timeout();
84 111
85 112
86class Slit : public TimeoutHandler {
87private: 113private:
88 class SlitClient { 114 void clearWindow();
89 public: 115 void setupMenu();
90 Window window, client_window, icon_window; 116
91 117 void removeClient(SlitClient *client, bool remap, bool destroy);
92 int x, y; 118 void loadClientList(const char *filename);
93 unsigned int width, height; 119 void updateClientmenu();
94 }; 120
95 121 bool m_hidden, m_do_auto_hide;
96 Bool on_top, hidden, do_auto_hide; 122 Direction m_direction;
97 Display *display; 123 Placement m_placement;
98 124
99 Fluxbox *fluxbox; 125 BScreen &m_screen;
100 BScreen *screen; 126 FbTk::Timer m_timer;
101 BTimer *timer; 127
102 128 typedef std::list<SlitClient *> SlitClients;
103 LinkedList<SlitClient> *clientList; 129
104 Slitmenu *slitmenu; 130 SlitClients m_client_list;
105 131 FbMenu m_slitmenu, m_placement_menu, m_clientlist_menu;
106 struct frame { 132 std::auto_ptr<LayerMenu<Slit> > m_layermenu;
107 Pixmap pixmap; 133 std::string m_filename;
108 Window window; 134
109 135 struct frame {
110 int x, y, x_hidden, y_hidden; 136 Pixmap pixmap;
111 unsigned int width, height; 137 FbTk::FbWindow window;
112 } frame; 138
113 139 int x, y, x_hidden, y_hidden;
114 friend class Slitmenu; 140 unsigned int width, height;
115 friend class Slitmenu::Directionmenu; 141 } frame;
116 friend class Slitmenu::Placementmenu; 142
117 143 // for KDE
118 144 Atom m_kwm1_dockwindow, m_kwm2_dockwindow;
119public: 145
120 Slit(BScreen *); 146 std::auto_ptr<FbTk::XLayerItem> m_layeritem;
121 virtual ~Slit(); 147 std::auto_ptr<SlitTheme> m_slit_theme;
122 148 std::auto_ptr<FbTk::Transparent> m_transp;
123 inline const Bool &isOnTop(void) const { return on_top; } 149 static unsigned int s_eventmask;
124 inline const Bool &isHidden(void) const { return hidden; }
125 inline const Bool &doAutoHide(void) const { return do_auto_hide; }
126
127 inline Slitmenu *getMenu() { return slitmenu; }
128
129 inline const Window &getWindowID() const { return frame.window; }
130
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); }
135
136 inline const unsigned int &getWidth(void) const { return frame.width; }
137 inline const unsigned int &getHeight(void) const { return frame.height; }
138
139 void addClient(Window);
140 void removeClient(SlitClient *, Bool = True);
141 void removeClient(Window, Bool = True);
142 void reconfigure(void);
143 void reposition(void);
144 void shutdown(void);
145
146 void buttonPressEvent(XButtonEvent *);
147 void enterNotifyEvent(XCrossingEvent *);
148 void leaveNotifyEvent(XCrossingEvent *);
149 void configureRequestEvent(XConfigureRequestEvent *);
150
151 virtual void timeout(void);
152
153 enum { Vertical = 1, Horizontal };
154 enum { TopLeft = 1, CenterLeft, BottomLeft, TopCenter, BottomCenter,
155 TopRight, CenterRight, BottomRight };
156}; 150};
157 151
158 152
159#endif // __Slit_hh 153#endif // SLIT_HH