aboutsummaryrefslogtreecommitdiff
path: root/src/Workspace.hh
diff options
context:
space:
mode:
Diffstat (limited to 'src/Workspace.hh')
-rw-r--r--src/Workspace.hh141
1 files changed, 87 insertions, 54 deletions
diff --git a/src/Workspace.hh b/src/Workspace.hh
index 17de03c..e461bd5 100644
--- a/src/Workspace.hh
+++ b/src/Workspace.hh
@@ -1,3 +1,6 @@
1// Workspace.hh for Fluxbox
2// Copyright (c) 2002 Henrik Kinnunen (fluxgen@linuxmail.org)
3//
1// Workspace.hh for Blackbox - an X11 Window manager 4// Workspace.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@tcac.net)
3// 6//
@@ -19,72 +22,102 @@
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 _WORKSPACE_HH_ 25#ifndef WORKSPACE_HH
23#define _WORKSPACE_HH_ 26#define WORKSPACE_HH
27
28#include "Clientmenu.hh"
29#include "Window.hh"
30#include "NotCopyable.hh"
24 31
25#include <X11/Xlib.h> 32#include <X11/Xlib.h>
33#include <string>
34#include <vector>
35#include <list>
26 36
27class BScreen; 37class BScreen;
28class Clientmenu;
29class Workspace;
30class FluxboxWindow;
31
32#include "LinkedList.hh"
33
34
35class Workspace {
36private:
37 BScreen *screen;
38 FluxboxWindow *lastfocus;
39 Clientmenu *clientmenu;
40
41 LinkedList<FluxboxWindow> *stackingList, *windowList;
42
43 char *name;
44 int id, cascade_x, cascade_y;
45
46
47protected:
48 void placeWindow(FluxboxWindow *);
49
50 38
39/**
40 Handles a single workspace
41*/
42class Workspace:private NotCopyable {
51public: 43public:
52 Workspace(BScreen *, int = 0); 44 typedef std::vector<FluxboxWindow *> Windows;
53 ~Workspace(void); 45
54 46 Workspace(BScreen *screen, unsigned int workspaceid = 0);
55 inline BScreen *getScreen(void) { return screen; } 47 ~Workspace();
56 48
57 inline FluxboxWindow *getLastFocusedWindow(void) { return lastfocus; } 49 inline void setLastFocusedWindow(FluxboxWindow *w) { lastfocus = w; }
58 50 /**
59 inline Clientmenu *getMenu(void) { return clientmenu; } 51 Set workspace name
52 */
53 void setName(const std::string &name);
54 void showAll();
55 void hideAll();
56 void removeAll();
57 void raiseWindow(FluxboxWindow *win);
58 void lowerWindow(FluxboxWindow *win);
59 void reconfigure();
60 void update();
61 void setCurrent();
62 void shutdown();
63 int addWindow(FluxboxWindow *win, bool place = false);
64 int removeWindow(FluxboxWindow *win);
65 BScreen *getScreen() { return screen; }
66 FluxboxWindow *getLastFocusedWindow() { return lastfocus; }
67
68 const BScreen *getScreen() const { return screen; }
69 const FluxboxWindow *getLastFocusedWindow() const { return lastfocus; }
70 Clientmenu *menu() { return &m_clientmenu; }
71 /**
72 @return client menu
73 */
74 inline const Clientmenu *menu() const { return &m_clientmenu; }
75 /**
76 @return name of this workspace
77 */
78 inline const std::string &name() const { return m_name; }
79 /**
80 @return the number of this workspace, note: obsolete, should be in BScreen
81 */
82 inline unsigned int workspaceID() const { return m_id; }
83 /**
84 @param id the window id number
85 @return window that match the id, else 0
86 */
87 FluxboxWindow *getWindow(unsigned int id);
88 const FluxboxWindow *getWindow(unsigned int id) const;
89 const Windows &getWindowList() const { return windowList; }
90 Windows &getWindowList() { return windowList; }
91
92 bool isCurrent() const;
93 bool isLastWindow(FluxboxWindow *window) const;
94 int getCount() const;
95 void checkGrouping(FluxboxWindow &win);
96 static bool loadGroups(const std::string &filename);
97protected:
98 void placeWindow(FluxboxWindow *win);
60 99
61 inline const char *getName(void) const { return name; } 100private:
101
62 102
63 inline const int &getWorkspaceID(void) const { return id; } 103 BScreen *screen;
64 104 FluxboxWindow *lastfocus;
65 inline void setLastFocusedWindow(FluxboxWindow *w) { lastfocus = w; } 105 Clientmenu m_clientmenu;
66 106
67 FluxboxWindow *getWindow(int); 107 typedef std::list<FluxboxWindow *> WindowStack;
108 typedef std::vector<std::string> Group;
109 typedef std::vector<Group> GroupList;
110
111 static GroupList m_groups; ///< handle auto groupings
68 112
69 Bool isCurrent(void); 113 WindowStack stackingList;
70 Bool isLastWindow(FluxboxWindow *); 114 Windows windowList;
71
72 const int addWindow(FluxboxWindow *, Bool = False);
73 const int removeWindow(FluxboxWindow *);
74 const int getCount(void);
75 115
76 void showAll(void); 116 std::string m_name; ///< name of this workspace
77 void hideAll(void); 117 unsigned int m_id; ///< id, obsolete, this should be in BScreen
78 void removeAll(void); 118 int cascade_x, cascade_y;
79 void raiseWindow(FluxboxWindow *);
80 void lowerWindow(FluxboxWindow *);
81 void reconfigure();
82 void update();
83 void setCurrent(void);
84 void setName(char *);
85 void shutdown(void);
86}; 119};
87 120
88 121
89#endif // _WORKSPACE_HH_ 122#endif // WORKSPACE_HH
90 123