diff options
author | Henrik Kinnunen <fluxgen@fluxbox.org> | 2007-10-17 16:02:07 (GMT) |
---|---|---|
committer | Henrik Kinnunen <fluxgen@fluxbox.org> | 2007-10-17 16:02:07 (GMT) |
commit | 48e3a31cab2c6b515c26e69878f606a6d4d6df6f (patch) | |
tree | 976a0798689d3aa51548f422a41f35240807e354 /src/Workspace.hh | |
download | fbpager-48e3a31cab2c6b515c26e69878f606a6d4d6df6f.zip fbpager-48e3a31cab2c6b515c26e69878f606a6d4d6df6f.tar.bz2 |
initial commit
Diffstat (limited to 'src/Workspace.hh')
-rw-r--r-- | src/Workspace.hh | 121 |
1 files changed, 121 insertions, 0 deletions
diff --git a/src/Workspace.hh b/src/Workspace.hh new file mode 100644 index 0000000..6a14fb5 --- /dev/null +++ b/src/Workspace.hh | |||
@@ -0,0 +1,121 @@ | |||
1 | // Workspace.hh for FbPager | ||
2 | // Copyright (c) 2003 Henrik Kinnunen (fluxgen at users.sourceforge.net) | ||
3 | // | ||
4 | // Permission is hereby granted, free of charge, to any person obtaining a | ||
5 | // copy of this software and associated documentation files (the "Software"), | ||
6 | // to deal in the Software without restriction, including without limitation | ||
7 | // the rights to use, copy, modify, merge, publish, distribute, sublicense, | ||
8 | // and/or sell copies of the Software, and to permit persons to whom the | ||
9 | // Software is furnished to do so, subject to the following conditions: | ||
10 | // | ||
11 | // The above copyright notice and this permission notice shall be included in | ||
12 | // all copies or substantial portions of the Software. | ||
13 | // | ||
14 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
15 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
16 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL | ||
17 | // THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
18 | // 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 | ||
20 | // DEALINGS IN THE SOFTWARE. | ||
21 | |||
22 | // $Id$ | ||
23 | |||
24 | #ifndef FBPAGER_WORKSPACE_HH | ||
25 | #define FBPAGER_WORKSPACE_HH | ||
26 | |||
27 | #include "FbTk/FbWindow.hh" | ||
28 | #include "FbTk/FbPixmap.hh" | ||
29 | #include "FbTk/NotCopyable.hh" | ||
30 | #include "FbTk/EventHandler.hh" | ||
31 | #include "FbTk/Color.hh" | ||
32 | |||
33 | #include "ClientWindow.hh" | ||
34 | |||
35 | #include <string> | ||
36 | #include <map> | ||
37 | #include <memory> | ||
38 | |||
39 | namespace FbPager { | ||
40 | |||
41 | /** | ||
42 | Workspace window for fbpager | ||
43 | */ | ||
44 | class Workspace:private FbTk::NotCopyable { | ||
45 | public: | ||
46 | |||
47 | /// create a workspace with specified name, size, parent and eventhandler | ||
48 | Workspace(FbTk::EventHandler &evh, | ||
49 | FbTk::FbWindow &parent, unsigned int width, unsigned int height, | ||
50 | const FbTk::Color &focused_win_color, | ||
51 | const FbTk::Color &wincolor, | ||
52 | const FbTk::Color &border_color, | ||
53 | const FbTk::Color &background_color, | ||
54 | const char *name = 0, | ||
55 | const bool use_pixmap = true, | ||
56 | const int window_border_width = 1); | ||
57 | /// destructor | ||
58 | ~Workspace(); | ||
59 | /// set new name for this workspace | ||
60 | void setName(const char *name) { m_name = (name ? name : ""); } | ||
61 | /// add a window to workspace, and associate a FbWindow to it | ||
62 | void add(Window win); | ||
63 | void resize(unsigned int width, unsigned int height); | ||
64 | /// remove a window from workspace | ||
65 | void remove(Window win); | ||
66 | void shadeWindow(Window win); | ||
67 | void unshadeWindow(Window win); | ||
68 | void iconifyWindow(Window win); | ||
69 | void deiconifyWindow(Window win); | ||
70 | void raiseWindow(Window win); | ||
71 | void lowerWindow(Window win); | ||
72 | void updateGeometry(Window win); | ||
73 | void updateFocusedWindow(); | ||
74 | void setWindowColor(const std::string &focused, | ||
75 | const std::string &unfocused, | ||
76 | const std::string &bordercolor_str); | ||
77 | void setAlpha(unsigned char alpha); | ||
78 | void clearWindows(); | ||
79 | |||
80 | ClientWindow findClient(const FbTk::FbWindow &win) const; | ||
81 | |||
82 | /** | ||
83 | @brief Find associated FbWindow to win | ||
84 | @return 0 on failure | ||
85 | */ | ||
86 | FbTk::FbWindow *find(Window win); | ||
87 | /// find associated FbWindow to win | ||
88 | const FbTk::FbWindow *find(Window win) const; | ||
89 | /// @return workspace name | ||
90 | const std::string &name() const { return m_name; } | ||
91 | /// @return the workspace's FbWindow | ||
92 | const FbTk::FbWindow &window() const { return m_window; } | ||
93 | /// @return the workspace's FbWindow | ||
94 | FbTk::FbWindow &window() { return m_window; } | ||
95 | |||
96 | static void setFocusedWindow(Window win) { s_focused_window = win; } | ||
97 | |||
98 | private: | ||
99 | |||
100 | void updateBackground(Window win, const FbTk::Color& bg_color); | ||
101 | |||
102 | std::string m_name; ///< name of this workspace | ||
103 | FbTk::FbWindow m_window; ///< FbWindow of this workspace | ||
104 | FbTk::EventHandler &m_eventhandler; | ||
105 | |||
106 | typedef std::map<Window, FbTk::FbWindow*> WindowList; | ||
107 | WindowList m_windowlist; ///< holds a set of Window to FbWindow association | ||
108 | |||
109 | FbTk::Color m_window_color, m_focused_window_color, m_window_bordercolor; | ||
110 | FbTk::FbWindow *m_focused_window; | ||
111 | |||
112 | static Window s_focused_window; | ||
113 | |||
114 | bool m_use_pixmap; | ||
115 | int m_window_border_width; | ||
116 | |||
117 | }; | ||
118 | |||
119 | }; // end namespace FbPager | ||
120 | |||
121 | #endif // FBPAGER_WORKSPACE_HH | ||