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.

210 lines
8.0 KiB

  1. /////////////////////////////////////////////////////////////////////////////
  2. // Copyright (C) 1993-1998 Microsoft Corporation. All Rights Reserved.
  3. //
  4. // MODULE: outbar.h
  5. //
  6. // PURPOSE: Defines the class that implements the Outlook Bar
  7. //
  8. #pragma once
  9. interface IAthenaBrowser;
  10. interface INotify;
  11. typedef struct tagFOLDERNOTIFY FOLDERNOTIFY;
  12. class CDropTarget;
  13. /////////////////////////////////////////////////////////////////////////////
  14. //
  15. // Types
  16. //
  17. #define OUTLOOK_BAR_VERSION 0x0001
  18. #define OUTLOOK_BAR_NEWSONLY_VERSION 0X0001
  19. typedef struct tagBAR_PERSIST_INFO
  20. {
  21. DWORD dwVersion;
  22. DWORD cxWidth;
  23. BOOL fSmall;
  24. DWORD cItems;
  25. FILETIME ftSaved;
  26. FOLDERID rgFolders[1];
  27. } BAR_PERSIST_INFO;
  28. HRESULT OutlookBar_AddShortcut(FOLDERID idFolder);
  29. /////////////////////////////////////////////////////////////////////////////
  30. // class COutBar
  31. //
  32. class COutBar : public IDockingWindow,
  33. public IObjectWithSite,
  34. public IOleCommandTarget,
  35. public IDropTarget,
  36. public IDropSource,
  37. public IDatabaseNotify
  38. {
  39. public:
  40. /////////////////////////////////////////////////////////////////////////
  41. // Construction and Initialization
  42. //
  43. COutBar();
  44. ~COutBar();
  45. HRESULT HrInit(LPSHELLFOLDER psf, IAthenaBrowser *psb);
  46. /////////////////////////////////////////////////////////////////////////
  47. // IUnknown
  48. //
  49. STDMETHODIMP QueryInterface(REFIID riid, LPVOID * ppvObj);
  50. STDMETHODIMP_(ULONG) AddRef(void);
  51. STDMETHODIMP_(ULONG) Release(void);
  52. /////////////////////////////////////////////////////////////////////////
  53. // IOleWindow
  54. //
  55. STDMETHODIMP GetWindow(HWND * lphwnd);
  56. STDMETHODIMP ContextSensitiveHelp(BOOL fEnterMode);
  57. /////////////////////////////////////////////////////////////////////////
  58. // IDockingWindow
  59. //
  60. STDMETHODIMP ShowDW(BOOL fShow);
  61. STDMETHODIMP CloseDW(DWORD dwReserved);
  62. STDMETHODIMP ResizeBorderDW(LPCRECT prcBorder, IUnknown* punkToolbarSite,
  63. BOOL fReserved);
  64. /////////////////////////////////////////////////////////////////////////
  65. // IObjectWithSite
  66. //
  67. STDMETHODIMP SetSite(IUnknown* punkSite);
  68. STDMETHODIMP GetSite(REFIID riid, LPVOID * ppvSite);
  69. /////////////////////////////////////////////////////////////////////////
  70. // IOleCommandTarget
  71. //
  72. STDMETHODIMP QueryStatus(const GUID *pguidCmdGroup, ULONG cCmds, OLECMD prgCmds[],
  73. OLECMDTEXT *pCmdText);
  74. STDMETHODIMP Exec(const GUID *pguidCmdGroup, DWORD nCmdID, DWORD nCmdExecOpt,
  75. VARIANTARG *pvaIn, VARIANTARG *pvaOut);
  76. /////////////////////////////////////////////////////////////////////////
  77. // IDropTarget
  78. //
  79. STDMETHODIMP DragEnter(IDataObject* pDataObject, DWORD grfKeyState,
  80. POINTL pt, DWORD* pdwEffect);
  81. STDMETHODIMP DragOver(DWORD grfKeyState, POINTL pt, DWORD* pdwEffect);
  82. STDMETHODIMP DragLeave(void);
  83. STDMETHODIMP Drop(IDataObject* pDataObject, DWORD grfKeyState,
  84. POINTL pt, DWORD* pdwEffect);
  85. /////////////////////////////////////////////////////////////////////////
  86. // IDropSource
  87. //
  88. STDMETHODIMP QueryContinueDrag(BOOL fEscapePressed, DWORD grfKeyState);
  89. STDMETHODIMP GiveFeedback(DWORD dwEffect);
  90. /////////////////////////////////////////////////////////////////////////
  91. // IDatabaseNotify
  92. //
  93. STDMETHODIMP OnTransaction(HTRANSACTION hTransaction, DWORD_PTR dwCookie, IDatabase *pDB);
  94. //News only mode
  95. static LPCTSTR GetRegKey();
  96. static DWORD GetOutlookBarVersion();
  97. /////////////////////////////////////////////////////////////////////////
  98. // Window Procedure Goo
  99. //
  100. protected:
  101. static LRESULT CALLBACK OutBarWndProc(HWND hwnd, UINT msg, WPARAM wp, LPARAM lp);
  102. static LRESULT CALLBACK ExtFrameWndProc(HWND hwnd, UINT msg, WPARAM wp, LPARAM lp);
  103. LRESULT WndProc(HWND hwnd, UINT msg, WPARAM wp, LPARAM lp);
  104. LRESULT FrameWndProc(HWND hwnd, UINT msg, WPARAM wp, LPARAM lp);
  105. // Main window Handlers
  106. void OnDestroy(HWND hwnd);
  107. void OnLButtonDown(HWND hwnd, BOOL fDoubleClick, int x, int y, UINT keyFlags);
  108. void OnMouseMove(HWND hwnd, int x, int y, UINT keyFlags);
  109. void OnLButtonUp(HWND hwnd, int x, int y, UINT keyFlags);
  110. // Frame Window
  111. void Frame_OnNCDestroy(HWND hwnd);
  112. void Frame_OnSize(HWND hwnd, UINT state, int cx, int cy);
  113. void Frame_OnCommand(HWND hwnd, int id, HWND hwndCtl, UINT codeNotify);
  114. LRESULT Frame_OnNotify(HWND hwnd, int idFrom, NMHDR *pnmhdr);
  115. /////////////////////////////////////////////////////////////////////////
  116. // Utility Functions
  117. //
  118. HRESULT _CreateToolbar();
  119. void _FillToolbar();
  120. void _EmptyToolbar(BOOL fDelete);
  121. BOOL _FindButton(int *piBtn, LPITEMIDLIST pidl);
  122. BOOL _InsertButton(int iBtn, FOLDERINFO *pInfo);
  123. BOOL _InsertButton(int iBtn, FOLDERID id);
  124. BOOL _DeleteButton(int iBtn);
  125. BOOL _UpdateButton(int iBtn, LPITEMIDLIST pidl);
  126. void _OnFolderNotify(FOLDERNOTIFY *pnotify);
  127. void _OnContextMenu(int x, int y);
  128. HRESULT _CreateDefaultButtons(void);
  129. HRESULT _LoadSettings(void);
  130. HRESULT _SaveSettings(void);
  131. BOOL _SetButtonStyle(BOOL fSmall);
  132. HRESULT _AddShortcut(IDataObject *pObject);
  133. void _UpdateDragDropHilite(LPPOINT ppt);
  134. int _GetItemFromPoint(POINT pt);
  135. FOLDERID _FolderIdFromCmd(int idCmd);
  136. BOOL _IsTempNewsgroup(IDataObject *pDataObject);
  137. /////////////////////////////////////////////////////////////////////////
  138. // Member Variables
  139. //
  140. protected:
  141. ULONG m_cRef; // Reference Count
  142. // Groovy window handles
  143. HWND m_hwndParent; // Parent window handle
  144. HWND m_hwnd; // Main window handle
  145. HWND m_hwndFrame; // Inner window handle
  146. HWND m_hwndPager; // Pager window handle
  147. HWND m_hwndTools; // Toolbar window handle
  148. // Lovely interface pointers
  149. IAthenaBrowser *m_pBrowser; // Browser pointer
  150. IDockingWindowSite *m_ptbSite; // Site pointer
  151. INotify *m_pStNotify; // Notification interface
  152. INotify *m_pOutBarNotify; // Outlook Bar notification interface
  153. // State
  154. BOOL m_fShow; // TRUE if we're visible
  155. BOOL m_fLarge; // TRUE if we're showing large icons
  156. BOOL m_fResizing; // TRUE if we're in the process of resizing
  157. int m_idCommand; // Number of buttons on the button bar
  158. int m_idSel; // ID of the item that is selected when a context menu is visible.
  159. int m_cxWidth; // Width of our window
  160. BOOL m_fOnce; // TRUE until we call _LoadSettings the first time
  161. // Images
  162. HIMAGELIST m_himlLarge; // Large folder image list
  163. HIMAGELIST m_himlSmall; // Small folder image list
  164. // Drag Drop Stuff
  165. IDataObject *m_pDataObject; // What's being dragged over us
  166. DWORD m_grfKeyState; // Keyboard state last time we checked
  167. DWORD m_dwEffectCur; // Current drop effect
  168. DWORD m_idCur; // Currently selected button
  169. CDropTarget *m_pTargetCur; // Current drop target pointer
  170. DWORD m_idDropHilite; // Currently selected drop area
  171. TBINSERTMARK m_tbim;
  172. BOOL m_fInsertMark; // TRUE if we've drawn an insertion mark
  173. BOOL m_fDropShortcut; // TRUE if the data object over us contains CF_OEFOLDER
  174. };