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