1
0

wndtrack.h 3.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104
  1. #ifndef __WNDTRACK_H
  2. #define __WNDTRACK_H
  3. #include "cwndtrack.h"
  4. #include <bfc/tlist.h>
  5. #include <bfc/ptrlist.h>
  6. #include <api/wndmgr/layout.h>
  7. class ifc_window;
  8. #define WNDTRACKCB_POPUPEXIT 0x8797
  9. #define WNDTRACKCB_POPUPEXITALL 0x8798
  10. const int DEFAULT_DOCK_DIST=10;
  11. const int MIN_DOCK_DIST=1;
  12. const int MAX_DOCK_DIST=64;
  13. class coopEntry {
  14. public:
  15. coopEntry(ifc_window *w, int lock=0) : wnd(w), locked(lock) {}
  16. ~coopEntry() {}
  17. ifc_window *wnd;
  18. int locked;
  19. };
  20. #ifndef _REDOCK_STRUCT_DEFINED
  21. #define _REDOCK_STRUCT_DEFINED
  22. typedef struct {
  23. Layout *l;
  24. RECT original_rect;
  25. } redock_struct;
  26. #endif
  27. class WindowTracker {
  28. public:
  29. WindowTracker();
  30. ~WindowTracker();
  31. void addWindow(ifc_window *wnd);
  32. void removeWindow(ifc_window *wnd);
  33. int checkWindow(ifc_window *wnd);
  34. ifc_window *enumWindows(int n);
  35. int getNumWindows();
  36. ifc_window *enumAllWindows(int n);
  37. int getNumAllWindows();
  38. bool autoDock(ifc_window *thiswnd, RECT *newPosition, int mask);
  39. bool autoDock(ifc_window *thiswnd, RECT *newPosition, RECT *oldPosition, int mask);
  40. static bool touches(const RECT &z, const RECT &r);
  41. RECT findOpenRect(const RECT &prev, ifc_window *exclude=NULL);
  42. static void setDockDistance(int dd);
  43. static int getDockDistance();
  44. static void setEnableDocking(int ed);
  45. void startCooperativeMove(ifc_window *wnd);
  46. void endCooperativeMove();
  47. int wasCooperativeMove();
  48. void invalidateAllWindows();
  49. int getNumDocked();
  50. ifc_window *enumDocked(int n);
  51. static void addRootWnd(ifc_window *wnd);
  52. static void removeRootWnd(ifc_window *wnd);
  53. static ifc_window *rootWndFromPoint(POINT *pt);
  54. static ifc_window *rootWndFromHwnd(OSWINDOWHANDLE h);
  55. static void layoutChanged(Layout *previouswnd, Layout *newwnd); // re-dock windows when changing layout
  56. static void beforeRedock(Layout *l, redock_struct *rs);
  57. static void afterRedock(Layout *l, redock_struct *rs);
  58. static ifc_window *getNextDesktopWindow(ifc_window *w, int next);
  59. static void snapAdjustWindowRect(ifc_window *w, RECT *r, RECT *adjustvals=NULL);
  60. static void unsnapAdjustWindowRect(ifc_window *w, RECT *r, RECT *adjustvals=NULL);
  61. private:
  62. void addCooperative(ifc_window *thiswnd);
  63. void addCoopWnd(ifc_window *w, int forced=0);
  64. int hasCoopWnd(ifc_window *w);
  65. void flushCoopWnds();
  66. static void recursAddToMoveWindows(ifc_window *wnd, redock_struct *rs, int v=-1); // used by layoutChanged()
  67. static PtrList<ifc_window> desktopwnds;
  68. static PtrList<ifc_window> nonvirtuals;
  69. static PtrList<coopEntry> coopList;
  70. static PtrList<ifc_window> recursList;
  71. static ifc_window *coopWnd;
  72. static PtrList<ifc_window> allWnd;
  73. static PtrList<ifc_window> tomoveWindows_top;
  74. static PtrList<ifc_window> tomoveWindows_left;
  75. static PtrList<ifc_window> tomoveWindows_bottom;
  76. static PtrList<ifc_window> tomoveWindows_right;
  77. static int dockDist;
  78. static int dock_enabled;
  79. int wascoop;
  80. int disabledock;
  81. ifc_window *coopcachewnd;
  82. int coopcache;
  83. };
  84. extern WindowTracker *windowTracker;
  85. #endif