diff options
Diffstat (limited to 'src/FbPager.hh')
-rw-r--r-- | src/FbPager.hh | 162 |
1 files changed, 162 insertions, 0 deletions
diff --git a/src/FbPager.hh b/src/FbPager.hh new file mode 100644 index 0000000..c6b71c5 --- /dev/null +++ b/src/FbPager.hh | |||
@@ -0,0 +1,162 @@ | |||
1 | // FbPager.hh for FbPager | ||
2 | // Copyright (c) 2003-2007 Henrik Kinnunen (fluxgen at fluxbox org) | ||
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_HH | ||
25 | #define FBPAGER_HH | ||
26 | |||
27 | #include "FbTk/FbWindow.hh" | ||
28 | #include "FbTk/EventHandler.hh" | ||
29 | #include "FbTk/Resource.hh" | ||
30 | #include "FbTk/NotCopyable.hh" | ||
31 | |||
32 | #include "ClientWindow.hh" | ||
33 | #include "FbRootWindow.hh" | ||
34 | #include "Pager.hh" | ||
35 | |||
36 | #include <vector> | ||
37 | #include <list> | ||
38 | #include <set> | ||
39 | |||
40 | namespace FbPager { | ||
41 | |||
42 | class Workspace; | ||
43 | class ClientHandler; | ||
44 | |||
45 | /// Shows a pager window with all workspaces and their windows | ||
46 | class FbPager:public FbTk::EventHandler, public Pager, private FbTk::NotCopyable { | ||
47 | public: | ||
48 | enum Alignment { LEFT_TO_RIGHT, TOP_TO_BOTTOM}; | ||
49 | FbPager(int screen_num, bool withdraw, | ||
50 | bool use_fbhandler, | ||
51 | bool use_ewhmhandler, | ||
52 | bool show_resources, | ||
53 | int layer_flags, | ||
54 | const char *resource_filename=0); | ||
55 | ~FbPager(); | ||
56 | void hide(); | ||
57 | void show(); | ||
58 | |||
59 | /// NOT IMPLEMENTED! | ||
60 | void toggleWithdrawn(); | ||
61 | /** | ||
62 | @name event handlers | ||
63 | */ | ||
64 | //@{ | ||
65 | void handleEvent(XEvent &event); | ||
66 | void buttonPressEvent(XButtonEvent &event); | ||
67 | void buttonReleaseEvent(XButtonEvent &event); | ||
68 | void motionNotifyEvent(XMotionEvent &event); | ||
69 | void exposeEvent(XExposeEvent &event); | ||
70 | //@} | ||
71 | |||
72 | /// add a window to workspace | ||
73 | void addWindow(Window win, unsigned int workspace_num); | ||
74 | void moveToWorkspace(Window win, unsigned int workspace_num); | ||
75 | void setFocusedWindow(Window win); | ||
76 | /// remove a window from workspace | ||
77 | void removeWindow(Window win); | ||
78 | void raiseWindow(Window win); | ||
79 | void lowerWindow(Window win); | ||
80 | /// update number of workspaces | ||
81 | void updateWorkspaceCount(unsigned int num); | ||
82 | void setCurrentWorkspace(unsigned int num); | ||
83 | bool haveWindow(Window win) { | ||
84 | if (m_windows.find(win) == m_windows.end()) | ||
85 | return false; | ||
86 | return true; | ||
87 | } | ||
88 | private: | ||
89 | void clientMessageEvent(XClientMessageEvent &event); | ||
90 | void propertyEvent(XPropertyEvent &event); | ||
91 | void clearWindows(); | ||
92 | |||
93 | |||
94 | void alignWorkspaces(); | ||
95 | |||
96 | void sendChangeToWorkspace(unsigned int num); | ||
97 | void updateWindowHints(Window win); | ||
98 | void load(const std::string &filename); | ||
99 | |||
100 | FbRootWindow m_rootwin; | ||
101 | FbTk::FbWindow m_window; | ||
102 | |||
103 | typedef std::vector<Workspace *> WorkspaceList; | ||
104 | typedef std::list<ClientHandler *> ClientHandlerList; | ||
105 | typedef std::set<Window> WindowList; | ||
106 | |||
107 | ClientHandlerList m_clienthandlers; | ||
108 | WorkspaceList m_workspaces; | ||
109 | WindowList m_windows; | ||
110 | |||
111 | unsigned int m_curr_workspace; | ||
112 | |||
113 | struct MoveWindow { | ||
114 | MoveWindow():client(0), curr_window(0), curr_workspace(0) { } | ||
115 | ClientWindow client; | ||
116 | FbTk::FbWindow *curr_window; | ||
117 | Workspace* curr_workspace; | ||
118 | } m_move_window; | ||
119 | |||
120 | int m_grab_x, m_grab_y; | ||
121 | |||
122 | FbTk::ResourceManager m_resmanager; | ||
123 | FbTk::Resource<int> m_alpha; | ||
124 | FbTk::Resource<int> m_start_x, m_start_y; | ||
125 | FbTk::Resource<int> m_workspace_width, m_workspace_height; | ||
126 | FbTk::Resource<int> m_workspaces_per_row; | ||
127 | FbTk::Resource<std::string> m_layer; | ||
128 | FbTk::Resource<bool> m_follow_drag; | ||
129 | FbTk::Resource<bool> m_follow_move; | ||
130 | FbTk::Resource<std::string> m_follow_scale; | ||
131 | FbTk::Resource<std::string> m_change_workspace_button; | ||
132 | FbTk::Resource<std::string> m_raise_window_button; | ||
133 | FbTk::Resource<std::string> m_lower_window_button; | ||
134 | FbTk::Resource<std::string> m_close_window_button; | ||
135 | FbTk::Resource<std::string> m_exit_button; | ||
136 | FbTk::Resource<std::string> m_next_workspace_button; | ||
137 | FbTk::Resource<std::string> m_prev_workspace_button; | ||
138 | FbTk::Resource<int> m_move_in_workspace_button; | ||
139 | FbTk::Resource<int> m_drag_to_workspace_button; | ||
140 | |||
141 | FbTk::Resource<Alignment> m_align; | ||
142 | FbTk::Resource<std::string> m_color_str; | ||
143 | FbTk::Resource<std::string> m_window_color_str, m_focused_window_color_str; | ||
144 | FbTk::Resource<std::string> m_window_bordercolor_str; | ||
145 | FbTk::Resource<std::string> m_background_color_str; | ||
146 | FbTk::Resource<std::string> m_current_background_color_str; | ||
147 | FbTk::Resource<int> m_multiclick_time; | ||
148 | FbTk::Resource<bool> m_window_icons; | ||
149 | FbTk::Resource<int> m_window_border_width; | ||
150 | FbTk::Resource<int> m_workspace_border_width; | ||
151 | FbTk::Resource<int> m_workspace_border_inactive_width; | ||
152 | FbTk::Resource<std::string> m_workspace_border_active_color, | ||
153 | m_workspace_border_inactive_color; | ||
154 | std::string m_button_queue; | ||
155 | XButtonEvent m_last_button_event; | ||
156 | int m_last_workspace_num; | ||
157 | |||
158 | }; | ||
159 | |||
160 | } // end namespace FbPager | ||
161 | |||
162 | #endif //FBPAGER_HH | ||