aboutsummaryrefslogtreecommitdiff
path: root/src/Slit.hh
diff options
context:
space:
mode:
Diffstat (limited to 'src/Slit.hh')
-rw-r--r--src/Slit.hh262
1 files changed, 134 insertions, 128 deletions
diff --git a/src/Slit.hh b/src/Slit.hh
index cce1d97..5fa80bd 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,145 @@
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.35 2003/06/24 13:42:23 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;
47class Strut;
74 48
49/// Handles dock apps
50class Slit : public FbTk::TimeoutHandler, public FbTk::EventHandler {
75public: 51public:
76 Slitmenu(Slit *); 52
77 virtual ~Slitmenu(void); 53 /**
78 54 Client alignment
79 inline Basemenu *getDirectionmenu(void) { return directionmenu; } 55 */
80 inline Basemenu *getPlacementmenu(void) { return placementmenu; } 56 enum Direction { VERTICAL = 1, HORIZONTAL };
81 57 /**
82 void reconfigure(void); 58 Placement on screen
83}; 59 */
84 60 enum Placement { TOPLEFT = 1, CENTERLEFT, BOTTOMLEFT, TOPCENTER, BOTTOMCENTER,
61 TOPRIGHT, CENTERRIGHT, BOTTOMRIGHT };
62
63 Slit(BScreen &screen, FbTk::XLayer &layer, const char *filename = 0);
64 virtual ~Slit();
65
66 inline bool isHidden() const { return m_hidden; }
67 inline bool doAutoHide() const { return *m_rc_auto_hide; }
68 inline Direction direction() const { return *m_rc_direction; }
69 inline Placement placement() const { return *m_rc_placement; }
70 inline int getOnHead() const { return *m_rc_on_head; }
71 inline void saveOnHead(int head) { m_rc_on_head = head; }
72 FbTk::Menu &menu() { return m_slitmenu; }
73
74 inline const FbTk::FbWindow &window() const { return frame.window; }
75
76 inline int x() const { return (m_hidden ? frame.x_hidden : frame.x); }
77 inline int y() const { return (m_hidden ? frame.y_hidden : frame.y); }
78
79 inline unsigned int width() const { return frame.width; }
80 inline unsigned int height() const { return frame.height; }
81
82 void setDirection(Direction dir);
83 void setPlacement(Placement place);
84 void setAutoHide(bool val);
85 void addClient(Window clientwin);
86 void removeClient(Window clientwin, bool remap = true);
87 void reconfigure();
88 void reposition();
89 void shutdown();
90 /// save clients name in a file
91 void saveClientList();
92 /// cycle slit clients up one step
93 void cycleClientsUp();
94 /// cycle slit clients down one step
95 void cycleClientsDown();
96
97 BScreen &screen() { return m_screen; }
98 const BScreen &screen() const { return m_screen; }
99 SlitTheme &theme() { return *m_slit_theme.get(); }
100 const SlitTheme &theme() const { return *m_slit_theme.get(); }
101 /**
102 @name eventhandlers
103 */
104 //@{
105 void handleEvent(XEvent &event);
106 void buttonPressEvent(XButtonEvent &event);
107 void enterNotifyEvent(XCrossingEvent &event);
108 void leaveNotifyEvent(XCrossingEvent &event);
109 void configureRequestEvent(XConfigureRequestEvent &event);
110 void exposeEvent(XExposeEvent &event);
111 //@}
112
113 void moveToLayer(int layernum);
114 FbTk::XLayerItem &layerItem() { return *m_layeritem; }
115
116 virtual void timeout();
85 117
86class Slit : public TimeoutHandler {
87private: 118private:
88 class SlitClient { 119 void clearWindow();
89 public: 120 void setupMenu();
90 Window window, client_window, icon_window; 121
91 122 void removeClient(SlitClient *client, bool remap, bool destroy);
92 int x, y; 123 void loadClientList(const char *filename);
93 unsigned int width, height; 124 void updateClientmenu();
94 }; 125 void clearStrut();
95 126 void updateStrut();
96 Bool on_top, hidden, do_auto_hide; 127
97 Display *display; 128 bool m_hidden;
98 129
99 Fluxbox *fluxbox; 130 BScreen &m_screen;
100 BScreen *screen; 131 FbTk::Timer m_timer;
101 BTimer *timer; 132
102 133 typedef std::list<SlitClient *> SlitClients;
103 LinkedList<SlitClient> *clientList; 134
104 Slitmenu *slitmenu; 135 SlitClients m_client_list;
105 136 FbMenu m_slitmenu, m_placement_menu, m_clientlist_menu;
106 struct frame { 137 std::auto_ptr<LayerMenu<Slit> > m_layermenu;
107 Pixmap pixmap; 138 std::string m_filename;
108 Window window; 139
109 140 struct frame {
110 int x, y, x_hidden, y_hidden; 141 Pixmap pixmap;
111 unsigned int width, height; 142 FbTk::FbWindow window;
112 } frame; 143
113 144 int x, y, x_hidden, y_hidden;
114 friend class Slitmenu; 145 unsigned int width, height;
115 friend class Slitmenu::Directionmenu; 146 } frame;
116 friend class Slitmenu::Placementmenu; 147
117 148 // for KDE
118 149 Atom m_kwm1_dockwindow, m_kwm2_dockwindow;
119public: 150
120 Slit(BScreen *); 151 std::auto_ptr<FbTk::XLayerItem> m_layeritem;
121 virtual ~Slit(); 152 std::auto_ptr<SlitTheme> m_slit_theme;
122 153 std::auto_ptr<FbTk::Transparent> m_transp;
123 inline const Bool &isOnTop(void) const { return on_top; } 154 static unsigned int s_eventmask;
124 inline const Bool &isHidden(void) const { return hidden; } 155 Strut *m_strut;
125 inline const Bool &doAutoHide(void) const { return do_auto_hide; } 156
126 157 FbTk::Resource<bool> m_rc_auto_hide, m_rc_maximize_over;
127 inline Slitmenu *getMenu() { return slitmenu; } 158 FbTk::Resource<Slit::Placement> m_rc_placement;
128 159 FbTk::Resource<Slit::Direction> m_rc_direction;
129 inline const Window &getWindowID() const { return frame.window; } 160 FbTk::Resource<int> m_rc_alpha, m_rc_on_head;
130 161 FbTk::Resource<Fluxbox::Layer> m_rc_layernum;
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}; 162};
157 163
158 164
159#endif // __Slit_hh 165#endif // SLIT_HH