appbarwnd.h 4.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155
  1. #ifndef _APPBARWND_H
  2. #define _APPBARWND_H
  3. #include <bfc/common.h>
  4. #include <shellapi.h>
  5. #include <api/wnd/wndclass/clickwnd.h>
  6. #define APPBARWND_PARENT ClickWnd
  7. #define APPBAR_TOP_ENABLED 1
  8. #define APPBAR_LEFT_ENABLED 2
  9. #define APPBAR_BOTTOM_ENABLED 4
  10. #define APPBAR_RIGHT_ENABLED 8
  11. #define APPABR_ALL_ENABLED (APPBAR_TOP_ENABLED|APPBAR_LEFT_ENABLED|APPBAR_BOTTOM_ENABLED|APPBAR_RIGHT_ENABLED)
  12. #define APPBAR_CALLBACK WM_USER + 1010
  13. #define IDT_AUTOHIDE 0x10000
  14. #define IDT_AUTOUNHIDE 0x10001
  15. #ifdef WIN32
  16. #define APPBAR_NOTDOCKED -1
  17. #define APPBAR_LEFT ABE_LEFT
  18. #define APPBAR_TOP ABE_TOP
  19. #define APPBAR_RIGHT ABE_RIGHT
  20. #define APPBAR_BOTTOM ABE_BOTTOM
  21. #else
  22. #error port me
  23. #endif
  24. // todo : dispatch
  25. class AppBar {
  26. public:
  27. virtual void appbar_dock(int side)=0;
  28. virtual int appbar_isDocked()=0;
  29. virtual int appbar_getSide()=0;
  30. virtual void appbar_setEnabledSides(int mask)=0;
  31. virtual int appbar_getEnabledSides()=0;
  32. virtual int appbar_isSideEnabled(int side)=0;
  33. virtual int appbar_testDock(int x, int y, RECT *dockrect=NULL)=0;
  34. virtual int appbar_updateAutoHide()=0;
  35. virtual int appbar_updateAlwaysOnTop()=0;
  36. virtual int appbar_isHiding()=0;
  37. virtual int appbar_wantAutoHide()=0;
  38. virtual int appbar_wantAlwaysOnTop()=0;
  39. virtual int appbar_isAutoHiding()=0;
  40. virtual void appbar_onDock(int side) {}
  41. virtual void appbar_onUnDock() {}
  42. virtual void appbar_onSlide() {}
  43. virtual void appbar_posChanged()=0;
  44. virtual int appbar_isSideAutoHideSafe(int side)=0;
  45. virtual int appbar_getAutoHideWidthHeight()=0;
  46. virtual void appbar_setNoRestore(int no)=0;
  47. };
  48. // {242CFAA4-31B3-4b01-97C8-2F0A9FFDEF79}
  49. static const GUID appBarGuid =
  50. { 0x242cfaa4, 0x31b3, 0x4b01, { 0x97, 0xc8, 0x2f, 0xa, 0x9f, 0xfd, 0xef, 0x79 } };
  51. class api_region;
  52. // TODO: benski> only class making active use of being derived from this seems to be Layout and GuiObjectWnd
  53. // maybe just layout ...
  54. class AppBarWnd : public APPBARWND_PARENT, public AppBar {
  55. public:
  56. AppBarWnd();
  57. virtual ~AppBarWnd();
  58. void appbar_dock(int side);
  59. int appbar_isDocked();
  60. int appbar_getSide();
  61. void appbar_setEnabledSides(int mask);
  62. int appbar_getEnabledSides();
  63. int appbar_isSideEnabled(int side);
  64. int appbar_testDock(int x, int y, RECT *dockrect=NULL);
  65. int appbar_updateAutoHide();
  66. int appbar_updateAlwaysOnTop();
  67. int appbar_isSideAutoHideSafe(int side);
  68. virtual int appbar_wantAutoHide() { return 1; }
  69. virtual int appbar_wantAlwaysOnTop() { return 1; }
  70. int appbar_isHiding();
  71. int appbar_isAutoHiding();
  72. void appbar_posChanged();
  73. void appbar_setNoRestore(int no);
  74. virtual int appbar_getAutoHideWidthHeight() { return 2; }
  75. virtual LRESULT wndProc(HWND hwnd, UINT msg, WPARAM wparam, LPARAM lparam);
  76. virtual void onAfterReinit();
  77. virtual void onSetVisible(int show);
  78. virtual void onRatioChanged();
  79. private:
  80. void appBarCallback(UINT uMsg, WPARAM wParam, LPARAM lParam);
  81. int registerWinAppBar();
  82. void unregisterWinAppBar();
  83. void notifyWinAppBarPosition(int side, RECT rect);
  84. OSWINDOWHANDLE getCurAutoHide(int side);
  85. void getDockRect(int side, RECT *rc);
  86. void getEdge(int side, RECT *rc);
  87. void straightenRect(int side, RECT *r);
  88. void updateDocking();
  89. void updateSide();
  90. void updateTimers();
  91. void resetAutoHideSide(int side);
  92. void setAutoHideSide(int side);
  93. void setAutoHideTimer();
  94. void setAutoUnHideTimer();
  95. void resetAutoHideTimer();
  96. void resetAutoUnHideTimer();
  97. void onAutoHideTimer();
  98. void onAutoUnHideTimer();
  99. void autoHide();
  100. void autoUnHide();
  101. void slideWindow(RECT *prc);
  102. int screenCorner(POINT *pt);
  103. void snapAdjust(RECT *r, int way);
  104. void dock(int side);
  105. void unDock();
  106. void unOwn();
  107. void reOwn();
  108. int m_registered;
  109. int m_side;
  110. int m_enabled;
  111. int m_cur_autohide;
  112. int m_cur_side;
  113. int m_cur_hiding;
  114. OSWINDOWHANDLE m_oldZOrder;
  115. int m_destroying;
  116. int m_norestore;
  117. int m_autohide_timer_set;
  118. int m_autounhide_timer_set;
  119. int m_sliding;
  120. int m_suspended;
  121. int m_fs;
  122. int m_wahidden;
  123. };
  124. #endif //_APPBARWND_H