00001
00002
00003
00004
00005
00006 #ifndef __MONITOR_H
00007 #define __MONITOR_H
00008
00009 extern "C" {
00010 #include <X11/Xlib.h>
00011 }
00012
00013 #include <list>
00014 #include <map>
00015 #include <string>
00016 #include "ncwm.h"
00017
00018 #include "container.h"
00019 #include "rectangle.h"
00020
00021 class Action;
00022 class Box;
00023 class Client;
00024 class ClientBar;
00025 class Frame;
00026 class InputBar;
00027 class Manager;
00028 class MultiFrame;
00029 #ifdef SLOT_SUPPORT
00030 class Slot;
00031 #endif // SLOT_SUPPORT
00032 class StatusBar;
00033 class Theme;
00034 class Thing;
00035 class WFont;
00036 class Workspace;
00037 class XFont;
00038
00039 typedef list<Client *> LClient;
00040 typedef list<Thing *> LThing;
00041 typedef list<Workspace *> LWorkspace;
00042 typedef map<long, Client *, less<long> > MClient;
00043 typedef map<string, string, less<string> > MSettings;
00044 typedef Container<Monitor, LClient, LClient::iterator, Client> CClient;
00045
00051 class Monitor :
00052 public Container<Display, LWorkspace, LWorkspace::iterator, Workspace>,
00053 public Rectangle
00054 {
00055
00056 public:
00057
00059
00060 Monitor(Display *display, unsigned int id);
00061 ~Monitor();
00062
00063 unsigned int id() const;
00064
00066 Window rootWindow() const;
00067
00068 string displayString() const;
00069
00070 Theme *theme() const;
00071
00072 unsigned int resizeFactor() const;
00073
00074 string prefix() const;
00075
00076 void serialize();
00077
00079
00080 StatusBar *statusBar() const;
00081
00082 ClientBar *clientBar() const;
00083
00084 InputBar *inputBar() const;
00085
00086 void toggleStatusBar();
00087
00088 void toggleClientBar();
00089
00090 void scanWindows();
00091 void updateBars();
00092
00094
00095
00096 Client *focusedClient();
00097
00104 Client *clientForWindow(Window window);
00105
00107 void addClient(Client *client);
00108
00110 void removeClient(Client *client);
00111
00112 void detachClient();
00113 void detachClient(Client *client);
00114 void attachLastClient();
00115 void attachClientByName(string name);
00116
00117 void attachClient(Client *client);
00118
00120 void attachAllClients();
00121 void detachAllClients();
00122 void toggleAllClientStates();
00123
00124 CClient *detachedClients();
00125
00127 void toggleThingMaximization();
00128
00129 bool isThingMaximized();
00130
00132 void attachDetachedClient(Workspace *workspace, Client *client);
00133
00134 unsigned int titleBarHeight() const;
00135 unsigned int buttonWidth() const;
00136
00138
00139 void createNewWorkspace(string name);
00140
00141 void focus(Workspace *workspace);
00142 void focusWorkspaceNum(unsigned int workspaceNum);
00143 void focusWorkspaceByName(string name);
00144 void focusClientByName(string name);
00145 void focusClientById(string id);
00146
00147 void destroyWorkspace(Workspace *workspace);
00148
00150 void renameWorkspace(Workspace *workspace, string newName);
00151
00152 void matchWorkspace(Workspace *workspace, Direction dir);
00153 void illuminateTransRect(Rectangle *rect, unsigned int barHeight = 0);
00154 void illuminateTransText(Rectangle *rect, string text);
00155
00156 Thing *thingWindow(Window window);
00157
00158 Bar *barWindow(Window window);
00159
00160 Menu *menuWindow(Window window);
00161
00162 #ifdef SLOT_SUPPORT
00163 Slot *slotWindow(Window window);
00164 Slot *slot() const;
00165 void unslotClient();
00166 void slotClient();
00167 void toggleSlot();
00168 void cycleSlotTabPrev();
00169 void cycleSlotTabNext();
00170 #endif // SLOT_SUPPORT
00171
00176 unsigned int nextClientId();
00177
00178 void resetClientId() {
00179 clientIds_ = 0;
00180 };
00181
00182 GC borderGC();
00183
00184 CClient *stickyClients();
00185
00186 WFont *font() const;
00187
00192 void cleanup();
00193
00194 MClient *clients();
00195 void banish();
00196
00197 Workspace *workspaceForName(string name);
00198
00199 Box *box() const;
00200
00201 void hookClient();
00202 void unhookClient();
00203
00204 private:
00205
00207 void initFonts();
00208
00210 void initDisplayString();
00211
00213 void initWorkspaces();
00214
00216 void initBars();
00217
00219 void initGC();
00220
00222 void rectForWorkspace(Workspace *workspace);
00223
00224 void focusClient(Client *client);
00225
00226 GC pseudoBorderGC_;
00227 GC borderGC_;
00228 Window rootWindow_;
00229 WFont *font_;
00230 XFont *fixed_;
00231
00232
00233
00234 Box *box_;
00235 StatusBar *statusBar_;
00236 ClientBar *clientBar_;
00237 InputBar *inputBar_;
00238
00239 #ifdef SLOT_SUPPORT
00240
00241 void initSlot();
00242
00243 Slot *slot_;
00244 #endif // SLOT_SUPPORT
00245
00246
00247 unsigned int resizeFactor_;
00248
00249 unsigned int id_;
00250
00251 string displayString_;
00252
00253 Theme *theme_;
00254
00255 MClient clients_;
00256
00257 CClient detachedClients_;
00258 CClient stickyClients_;
00259
00260 MSettings *themeSettings_;
00261 MSettings *sessionSettings_;
00262 MSettings *commonSettings_;
00263 string prefix_;
00264
00265 Thing *maxThing_;
00266
00267 unsigned int clientIds_;
00268 };
00269
00270 #endif // __MONITOR_H