00001
00002
00003
00004
00005
00006 #ifndef __WORKSPACE_H
00007 #define __WORKSPACE_H
00008
00009 #include <string>
00010 #include <list>
00011
00012 #include "rectangle.h"
00013 #include "container.h"
00014 #include "client.h"
00015
00016
00017 class Frame;
00018 class Monitor;
00019 class Settings;
00020 class Thing;
00021 class Tree;
00022 class Workspace;
00023 class XCore;
00024
00025 typedef list<Client *> LClient;
00026 typedef list<Frame *> LFrame;
00027 typedef Container<Monitor, LClient, LClient::iterator, Client> CClient;
00028 typedef Container<Monitor, LFrame, LFrame::iterator, Frame> CFrame;
00029
00033 class Workspace :
00034 public Rectangle
00035 {
00036
00037 public:
00038
00039 Workspace(Monitor *monitor, unsigned int id, Rectangle *rect);
00040
00041 ~Workspace();
00042
00043 unsigned int id() const;
00044
00046 void hide();
00047
00049 void show();
00050
00051 void illuminate();
00052
00053 void setName(string name);
00054
00055 string name() const;
00056
00057 string prefix() const;
00058
00059 Tree* root() const;
00060
00061 bool isFrameMode() const;
00062
00063 void toggleMode();
00064 void raiseFrames();
00065
00072 void attachClient(Client *client, bool isChangeMode = false);
00073 void detachClient(Client *client);
00074
00079 void splitFrame(Direction dir);
00080 void joinFrame(Direction dir);
00081 void sendClient(Direction dir);
00082
00086 void resizeFrame(Direction dir, bool grow);
00087
00088 void resizeClient(Direction dir, bool grow);
00089
00091 void moveClient(Direction dir);
00092
00093 void selectFrame(Direction dir);
00094 void swapFrame(Direction dir);
00095 void swapClient(Direction dir);
00096
00097 Thing *focusedThing();
00098 Frame *frameForPoint(unsigned int x, unsigned int y);
00099
00100 void focus(Thing *thing, bool raise = true);
00101
00102 Thing *thingWindow(Window window);
00103
00104 void matchBarNeighbors(Direction dir);
00105
00106 void raise();
00107 void lower();
00108
00109 void toggleClientMode();
00110 void toggleClientSticky();
00111 void changeClientMode(Client *client, Client::Mode mode);
00112
00113 void serialize();
00114
00115 Tree *neighborTree(Direction dir);
00116
00117 void toggleBars(bool visible);
00118 void toggleBorders(bool visible);
00119
00120 void cycleClientNext();
00121 void cycleClientPrev();
00122
00123 void removeClient(Client *client);
00124
00129 unsigned int nextFrameId();
00130
00131 void setClientBarVisible(bool visible);
00132 void setStatusBarVisible(bool visible);
00133 #ifdef SLOT_SUPPORT
00134 void setSlotVisible(bool visible);
00135 bool isSlotVisible() const;
00136 string slotTabName() const;
00137 #endif // SLOT_SUPPORT
00138
00139 void resize(Thing *thing, Direction dir, bool grow);
00140
00141 Client *topClient();
00142 void removePushClient(Client *client);
00143
00144 void fitClient();
00145
00146 bool isClientBarVisible() const;
00147 bool isStatusBarVisible() const;
00148
00149 Frame *focusedFrame() const;
00150 Monitor *attached() const;
00151
00152 LClient *clients();
00153 CClient *floatingClients();
00154 CFrame *frames();
00155
00156 bool requestsFocus() const;
00157 void setRequestsFocus(bool requestsFocus);
00158 void destroyFrame(Frame *frame);
00159
00160 private:
00161
00162 Monitor *monitor_;
00163 void pushClient(Client *client);
00164 bool stackContainsClient(Client *client);
00165
00166 Frame *nextFrame(Direction dir, bool isResize = true);
00167
00169 Frame *recentVisitedFrame(Direction dir);
00170
00173 void attachFrame(Frame *frame, Direction dir = DOWN);
00174
00176 Frame *newFrame();
00177
00178 LClient globalClientStack_;
00179 CClient floatingClients_;
00180 CFrame frames_;
00181 bool isFrameMode_;
00182 bool requestsFocus_;
00183 unsigned int id_;
00184 string name_;
00185 string prefix_;
00186
00187 Tree *root_;
00188 unsigned int frameIds_;
00189
00190 bool isClientBarVisible_;
00191 bool isStatusBarVisible_;
00192 #ifdef SLOT_SUPPORT
00193 string slotTabName_;
00194 #endif // SLOT_SUPPORT
00195 };
00196
00197 #endif // __WORKSPACE_H