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.

227 lines
8.2 KiB

  1. /////////////////////////////////////////////////////////////////////////////
  2. // Copyright (C) 1993-1996 Microsoft Corporation. All Rights Reserved.
  3. //
  4. // MODULE: navpane.h
  5. //
  6. // PURPOSE: Defines CNavPane class
  7. //
  8. #pragma once
  9. /////////////////////////////////////////////////////////////////////////////
  10. // Forward Dec's
  11. //
  12. class CTreeView;
  13. interface IMsgrAb;
  14. interface IAthenaBrowser;
  15. class CPaneFrame;
  16. class CNavPane : public IDockingWindow,
  17. public IObjectWithSite,
  18. public IOleCommandTarget,
  19. public IInputObjectSite,
  20. public IInputObject
  21. {
  22. public:
  23. /////////////////////////////////////////////////////////////////////////
  24. // Construction and Initialization
  25. //
  26. CNavPane();
  27. ~CNavPane();
  28. HRESULT Initialize(CTreeView *pTreeView);
  29. BOOL IsTreeVisible() { return m_fTreeVisible; }
  30. BOOL ShowFolderList(BOOL fShow);
  31. BOOL ShowContacts(BOOL fShow);
  32. BOOL IsContactsFocus();
  33. /////////////////////////////////////////////////////////////////////////
  34. // IUnknown
  35. //
  36. STDMETHODIMP QueryInterface(THIS_ REFIID riid, LPVOID *ppvObj);
  37. STDMETHOD_(ULONG, AddRef)(THIS);
  38. STDMETHOD_(ULONG, Release)(THIS);
  39. /////////////////////////////////////////////////////////////////////////
  40. // IOleWindow
  41. //
  42. STDMETHODIMP GetWindow(HWND* lphwnd);
  43. STDMETHODIMP ContextSensitiveHelp(BOOL fEnterMode);
  44. /////////////////////////////////////////////////////////////////////////
  45. // IDockingWindow
  46. //
  47. STDMETHODIMP ShowDW(BOOL fShow);
  48. STDMETHODIMP ResizeBorderDW(LPCRECT prcBorder, IUnknown* punkToolbarSite,
  49. BOOL fReserved);
  50. STDMETHODIMP CloseDW(DWORD dwReserved);
  51. /////////////////////////////////////////////////////////////////////////
  52. // IObjectWithSite
  53. //
  54. STDMETHODIMP GetSite(REFIID riid, LPVOID *ppvSite);
  55. STDMETHODIMP SetSite(IUnknown *pUnkSite);
  56. /////////////////////////////////////////////////////////////////////////
  57. // IOleCommandTarget
  58. //
  59. STDMETHODIMP QueryStatus(const GUID *pguidCmdGroup, ULONG cCmds, OLECMD prgCmds[],
  60. OLECMDTEXT *pCmdText);
  61. STDMETHODIMP Exec(const GUID *pguidCmdGroup, DWORD nCmdID, DWORD nCmdExecOpt,
  62. VARIANTARG *pvaIn, VARIANTARG *pvaOut);
  63. /////////////////////////////////////////////////////////////////////////
  64. // IInputObjectSite
  65. //
  66. STDMETHODIMP OnFocusChangeIS(IUnknown* punkSrc, BOOL fSetFocus);
  67. /////////////////////////////////////////////////////////////////////////
  68. // IInputObject
  69. //
  70. STDMETHODIMP UIActivateIO(BOOL fActivate, LPMSG lpMsg);
  71. STDMETHODIMP HasFocusIO(void);
  72. STDMETHODIMP TranslateAcceleratorIO(LPMSG pMsg);
  73. private:
  74. /////////////////////////////////////////////////////////////////////////
  75. // Window Proc Goo
  76. //
  77. static LRESULT CALLBACK _WndProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam);
  78. LRESULT CALLBACK _NavWndProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam);
  79. void _OnSize(HWND hwnd, UINT state, int cx, int cy);
  80. void _OnLButtonDown(HWND hwnd, BOOL fDoubleClick, int x, int y, UINT keyFlags);
  81. void _OnMouseMove(HWND hwnd, int x, int y, UINT keyFlags);
  82. void _OnLButtonUp(HWND hwnd, int x, int y, UINT keyFlags);
  83. BOOL _OnSetCursor(HWND hwnd, HWND hwndCursor, UINT codeHitTest, UINT msg);
  84. UINT _OnNCHitTest(HWND hwnd, int x, int y);
  85. /////////////////////////////////////////////////////////////////////////
  86. // Utility stuff
  87. //
  88. HRESULT _CreateChildWindows(void);
  89. void _UpdateVisibleState(void);
  90. private:
  91. /////////////////////////////////////////////////////////////////////////
  92. // Member Data
  93. //
  94. // All kinds of state
  95. ULONG m_cRef; // Ref count
  96. BOOL m_fShow; // TRUE if we're visible
  97. BOOL m_fTreeVisible; // TRUE if the treeview is visible
  98. BOOL m_fContactsVisible; // TRUE if contacts are visible
  99. // Groovy window handles
  100. HWND m_hwnd; // Our window handle
  101. HWND m_hwndParent; // Our parent's window handle
  102. HWND m_hwndTree; // The folder list window handle
  103. HWND m_hwndContacts; // The contacts control window
  104. // Interfaces you only wish you could have
  105. IDockingWindowSite *m_pSite; // Our site
  106. CTreeView *m_pTreeView; // Folder list pointer
  107. IMsgrAb *m_pContacts; // Contacts control
  108. IOleCommandTarget *m_pContactsTarget; // Command target for contacts
  109. CPaneFrame *m_pContactsFrame; // Contacts control frame
  110. // Sizing information
  111. int m_cxWidth; // How wide our outer window is
  112. BOOL m_fResizing; // TRUE if we're in the process of resizing
  113. BOOL m_fSplitting; // TRUE if we're splitting
  114. int m_cySplitPct; // Split percentage between the two panes
  115. RECT m_rcSplit; // Rectangle of the split bar in screen coordinates
  116. RECT m_rcSizeBorder; // Rectangle of the right hand sizing bar
  117. int m_cyTitleBar; // Height of the pane's title bar
  118. };
  119. class CPaneFrame : IInputObjectSite
  120. {
  121. public:
  122. /////////////////////////////////////////////////////////////////////////
  123. // Construction and Initialization
  124. //
  125. CPaneFrame();
  126. ~CPaneFrame();
  127. HWND Initialize(HWND hwndParent, IInputObjectSite *pSite, int idsTitle, int idMenu = 0);
  128. BOOL SetChild(HWND hwndChild, DWORD dwDispId, IAthenaBrowser *pBrowser, IObjectWithSite *pObject,
  129. IOleCommandTarget *pTarget = 0);
  130. void ShowMenu(void);
  131. /////////////////////////////////////////////////////////////////////////
  132. // IUnknown
  133. //
  134. STDMETHODIMP QueryInterface(THIS_ REFIID riid, LPVOID *ppvObj);
  135. STDMETHOD_(ULONG, AddRef)(THIS);
  136. STDMETHOD_(ULONG, Release)(THIS);
  137. /////////////////////////////////////////////////////////////////////////
  138. // IInputObjectSite
  139. //
  140. STDMETHODIMP OnFocusChangeIS(IUnknown* punkSrc, BOOL fSetFocus);
  141. private:
  142. /////////////////////////////////////////////////////////////////////////
  143. // Window Proc Goo
  144. //
  145. static LRESULT CALLBACK _WndProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam);
  146. LRESULT CALLBACK _FrameWndProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam);
  147. BOOL _OnCreate(HWND hwnd, LPCREATESTRUCT lpCreateStruct);
  148. void _OnSize(HWND hwnd, UINT state, int cx, int cy);
  149. void _OnPaint(HWND hwnd);
  150. void _OnCommand(HWND hwnd, int id, HWND hwndCtl, UINT codeNotify);
  151. void _OnToggleClosePin(HWND hwnd, BOOL fPin);
  152. void _OnLButtonDown(HWND hwnd, BOOL fDoubleClick, int x, int y, UINT keyFlags);
  153. void _OnMouseMove(HWND hwnd, int x, int y, UINT keyFlags);
  154. void _OnTimer(HWND hwnd, UINT id);
  155. void _UpdateDrawingInfo(void);
  156. void _CreateCloseToolbar();
  157. void _SizeCloseToolbar();
  158. void _PositionToolbar(LPPOINT pt);
  159. private:
  160. /////////////////////////////////////////////////////////////////////////
  161. // Member Data
  162. //
  163. ULONG m_cRef;
  164. // Groovy Window Handles
  165. HWND m_hwnd;
  166. HWND m_hwndChild;
  167. HWND m_hwndParent;
  168. // Child info
  169. IAthenaBrowser *m_pBrowser;
  170. DWORD m_dwDispId;
  171. IOleCommandTarget *m_pTarget;
  172. int m_idMenu;
  173. IInputObjectSite *m_pSite;
  174. // Drawing Info
  175. TCHAR m_szTitle[CCHMAX_STRINGRES];
  176. HFONT m_hFont;
  177. HBRUSH m_hbr3DFace;
  178. UINT m_cyTitleBar;
  179. RECT m_rcChild;
  180. RECT m_rcTitleButton;
  181. BOOL m_fHighlightIndicator;
  182. BOOL m_fHighlightPressed;
  183. // Toolbar Info
  184. HWND m_hwndClose;
  185. DWORD m_cButtons;
  186. BOOL m_fPin;
  187. };