1 #ifndef WMDOCK_H 2 #define WMDOCK_H 3 4 #include "ywindow.h" 5 #include "ytimer.h" 6 #include "yaction.h" 7 #include "ypopup.h" 8 9 class YFrameClient; 10 class YMenu; 11 12 class DockApp: 13 private YWindow, 14 private YTimerListener, 15 private YActionListener, 16 private YPopDownListener 17 { 18 public: 19 DockApp(); 20 ~DockApp(); 21 using YWindow::handle; 22 using YWindow::created; 23 using YWindow::visible; 24 25 operator bool() const { return docks.nonempty(); } 26 bool dock(YFrameClient* client); 27 bool undock(YFrameClient* client); 28 void adapt(); layer()29 int layer() const { return layered; } 30 31 private: 32 void handleButton(const XButtonEvent& button) override; 33 void handleClick(const XButtonEvent& button, int count) override; 34 void actionPerformed(YAction action, unsigned modifiers) override; 35 bool handleBeginDrag(const XButtonEvent& down, const XMotionEvent& move) override; 36 void handleDrag(const XButtonEvent& down, const XMotionEvent& move) override; 37 void handleEndDrag(const XButtonEvent& down, const XButtonEvent& up) override; 38 void handlePopDown(YPopupWindow *popup) override; 39 bool handleTimer(YTimer* timer) override; 40 lazy<YTimer> timer; 41 lazy<YMenu> menu; 42 43 struct docking { 44 Window window; 45 YFrameClient* client; 46 int order; dockingdocking47 docking(Window w, YFrameClient* c, int o) : 48 window(w), client(c), order(o) { } 49 }; 50 YArray<docking> docks; 51 YArray<Window> recover; 52 YFrameClient* dragged; 53 54 void undock(int index); 55 int ordering(YFrameClient* client, bool* startClose, bool* forced); 56 bool isChild(Window window); 57 bool setup(); 58 void grabit(); 59 void ungrab(); 60 void proper(); retime()61 void retime() { timer->setTimer(None, this, true); } 62 void revoke(int k, bool kill); 63 Window savewin(); 64 Window saveset; 65 66 Atom intern; 67 int center; 68 int layered; 69 int direction; 70 int dragxpos; 71 int dragypos; 72 bool restack; 73 bool isRight; 74 75 static const char propertyName[]; 76 }; 77 78 #endif 79