Leaked source code of windows server 2003
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

172 lines
5.6 KiB

  1. #ifndef _THEATER_H
  2. #define _THEATER_H
  3. // Metrics for this view mode
  4. #define THEATER_CYTOOLBAR 26
  5. #define CLOSEMIN_HEIGHT 16
  6. #define CLOSEMIN_YOFFSET 1
  7. #define CLOSEMIN_XOFFSET 1
  8. #define CLOSEMIN_WIDTH 54
  9. #define PROGRESS_WIDTH (CLOSEMIN_WIDTH + 2)
  10. #define PROGRESS_HEIGHT 6
  11. #define PROGRESS_YPOS (CLOSEMIN_HEIGHT + (2 * CLOSEMIN_YOFFSET) + 1)
  12. #define BRAND_YOFFSET 0
  13. #define BRAND_WIDTH 34
  14. #define BRAND_HEIGHT 26
  15. #define CX_HIT (GetSystemMetrics(SM_CXEDGE) * 3)
  16. #define CX_BROWOVERLAP (GetSystemMetrics(SM_CXEDGE) / 2)
  17. #define CX_FLOATERSHOWN (BRAND_WIDTH + CLOSEMIN_WIDTH + (2 * CLOSEMIN_XOFFSET))
  18. #define SHORT_DELAY 90
  19. #define LONG_DELAY (4 * SHORT_DELAY)
  20. // Theatre mode controls
  21. #define TMC_PROGRESSBAR 1
  22. #define TMC_BRANDBAND 2
  23. #define TMC_STATUSBAR 3
  24. #define TM_STATUS_PANES 2
  25. #define TM_STATUS_PANE_NAVIGATION 0
  26. #define TM_STATUS_PANE_SSL 1
  27. class CShellBrowser2;
  28. class CTheater:
  29. public IOleWindow,
  30. public IOleCommandTarget,
  31. public IServiceProvider
  32. {
  33. public:
  34. HWND GetMasterWindow() {return _hwndBrowser;};
  35. void Begin();
  36. CTheater(HWND hwnd, HWND hwndToolbar, IUnknown *punkOwner);
  37. ~CTheater();
  38. // *** IUnknown ***
  39. virtual STDMETHODIMP QueryInterface(REFIID riid, void **ppvObj);
  40. virtual STDMETHODIMP_(ULONG) AddRef(void);
  41. virtual STDMETHODIMP_(ULONG) Release(void);
  42. // *** IOleWindow methods ***
  43. virtual STDMETHODIMP GetWindow(HWND * lphwnd);
  44. virtual STDMETHODIMP ContextSensitiveHelp(BOOL fEnterMode) { return E_NOTIMPL; }
  45. // IOleCommandTarget
  46. virtual STDMETHODIMP QueryStatus(const GUID *pguidCmdGroup, ULONG cCmds, OLECMD rgCmds[], OLECMDTEXT *pcmdtext);
  47. virtual STDMETHODIMP Exec(const GUID *pguidCmdGroup, DWORD nCmdID, DWORD nCmdexecopt, VARIANTARG *pvarargIn, VARIANTARG *pvarargOut);
  48. // *** IServiceProvider methods ***
  49. virtual STDMETHODIMP QueryService(REFGUID guidService, REFIID riid, void **ppvObj);
  50. HRESULT SetBrowserBar(IUnknown* punk, int cxHidden, int cxExpanded);
  51. void GetPreviousWindowPlacement(WINDOWPLACEMENT* pwp, LPRECT prc) { *pwp = _wp; *prc = _rcOld;};
  52. void SetAutoHideToolbar(long val) { _fAutoHideToolbar = val; };
  53. void RecalcSizing();
  54. protected:
  55. friend class CShellBrowser2;
  56. // save data
  57. // we put the save state data in here so that the browser doesn't have to waste memory with this data when not in theater mode
  58. // also, because it's transient, don't use bitfields. save code instead of memory for transient stuff
  59. private:
  60. int _cyLast;
  61. HWND _hwndToolbar; // this is the toolbar window that we want to make sure the hidden window encompasses
  62. HWND _hwndBrowser; // this is the hwnd that we slide down
  63. HWND _hwndTaskbar;
  64. BOOL _fShown;
  65. BOOL _fTaskbarShown;
  66. BOOL _fDelay;
  67. BOOL _fAutoHideToolbar;
  68. BOOL _fInitialBrowserBar;
  69. BOOL _fAutoHideBrowserBar;
  70. HHOOK _hhook;
  71. IUnknown *_punkOwner;
  72. IUnknown *_punkBrowBar;
  73. HWND _hwndBrowBar;
  74. WINDOWPLACEMENT _wp;
  75. RECT _rcOld;
  76. UINT _cRef;
  77. IDeskBand* _pdbBrand;
  78. HWND _hwndClose;
  79. HWND _hwndFloater; // the Floating pallete window
  80. HWND _hwndProgress; // used in CShellBrowser(2) - maybe move to interface
  81. int _cActiveRef; // the ref count for activating the Floatering palette
  82. static CAssociationList _al; // associate threadid with CTheater objects
  83. void _SwapParents(HWND hwndOld, HWND hwndNew);
  84. void _Initialize();
  85. void _SizeBrowser();
  86. void _SizeFloater();
  87. void _CreateCloseMinimize();
  88. void _PositionCloseRestore();
  89. void _DelayHideFloater();
  90. void _DelayHideToolbar();
  91. void _HideToolbar();
  92. void _ShowToolbar();
  93. void _ContinueHideToolbar();
  94. LRESULT _OnMsgHook(int nCode, WPARAM wParam, MOUSEHOOKSTRUCT *pmhs, BOOL fFake);
  95. BOOL _IsBrowserActive();
  96. void _ShowTaskbar();
  97. void _HideTaskbar();
  98. void _Unhide(int iWhich, UINT uDelay);
  99. int _iUnhidee;
  100. BOOL _PtNearWindow(POINT pt, HWND hwnd);
  101. BOOL _PtOnEdge(POINT pt, int iEdge);
  102. BOOL _GetWindowRectRel(HWND hWnd, LPRECT lpRect);
  103. BOOL_PTR _HasBegun() { return (BOOL_PTR)_hhook; }
  104. BOOL _fBrowBarShown;
  105. int _cxBrowBarShown;
  106. int _cxBrowBarHidden;
  107. void _ContinueHideBrowBar();
  108. void _HideBrowBar();
  109. void _ShowBrowBar();
  110. BOOL _CanHideWindow(HWND hwnd);
  111. BOOL _fFloaterShown;
  112. COLORREF _clrBrandBk;
  113. void _ContinueHideFloater();
  114. void _HideFloater();
  115. void _ShowFloater();
  116. void _SanityCheckZorder();
  117. void _OnCommand(UINT idCmd);
  118. static LRESULT _MsgHook(int nCode, WPARAM wParam, LPARAM lParam);
  119. static LRESULT _FloaterWndProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam);
  120. };
  121. #define THID_ACTIVATE 1
  122. #define THID_DEACTIVATE 2
  123. #define THID_SETBROWSERBARWIDTH 3 // tells the browser bar what it's fixed width should be
  124. #define THID_SETTOOLBARAUTOHIDE 4
  125. #define THID_SETBROWSERBARAUTOHIDE 5
  126. #define THID_TOOLBARACTIVATED 6
  127. #define THID_ONINTERNET 7
  128. #define THID_RECALCSIZING 8
  129. // Explorer bar registry save structure
  130. typedef struct _BROWBARSAVE {
  131. UINT uiWidthOrHeight;
  132. BOOL fAutoHide : 1;
  133. } BROWBARSAVE;
  134. #define SZ_REGVALUE_EXPLORERBARA "ExplorerBar"
  135. #define SZ_REGVALUE_EXPLORERBAR TEXT(SZ_REGVALUE_EXPLORERBARA)
  136. #endif