XTOutBarCtrl.h 29 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824
  1. // Ignore
  2. // XTOutBarCtrl.h interface for the YLGL class.
  3. //
  4. // This file is a part of the Xtreme Toolkit for MFC.
  5. // 1998-2002 Codejock Software, All Rights Reserved.
  6. //
  7. // This source code can only be used under the terms and conditions
  8. // outlined in the accompanying license agreement.
  9. //
  10. // support@codejock.com
  11. // http://www.codejock.com
  12. //
  13. //////////////////////////////////////////////////////////////////////
  14. //:End Ignore
  15. #if !defined(__XTOUTBARCTRL_H__)
  16. #define __XTOUTBARCTRL_H__
  17. //:Ignore
  18. #if _MSC_VER >= 1000
  19. #pragma once
  20. #endif // _MSC_VER >= 1000
  21. //:End Ignore
  22. #include <afxtempl.h>
  23. #include "JPEG.h"
  24. class CXTBarItem;
  25. class CXTBarFolder;
  26. ////////////////////////////////////////////
  27. const UINT XTWM_OUTBAR_NOTIFY = (WM_USER+1018);
  28. #define XT_IDC_LARGEICON 52778
  29. #define XT_IDC_SMALLICON 52779
  30. #define XT_IDC_REMOVEGROUP 52784
  31. #define XT_IDC_RENAMEGROUP 52785
  32. #define XT_IDC_REMOVEITEM 52780
  33. #define XT_IDC_RENAMEITEM 52780
  34. const UINT OBN_XT_ITEMCLICK = 1;
  35. const UINT OBN_XT_ONLABELENDEDIT = 2;
  36. const UINT OBN_XT_ONGROUPENDEDIT = 3;
  37. const UINT OBN_XT_DRAGITEM = 4;
  38. const UINT OBN_XT_FOLDERCHANGE = 5;
  39. const UINT OBN_XT_ITEMHOVER = 6;
  40. const UINT OBN_XT_DELETEITEM = 7;
  41. const UINT OBN_XT_DELETEFOLDER = 8;
  42. const UINT OBN_XT_BEGINDRAG = 9;
  43. const UINT OBN_XT_ITEMRCLICK = 10;
  44. const UINT OBS_XT_SMALLICON = 0x0001; // Sets small icon mode
  45. const UINT OBS_XT_LARGEICON = 0x0002; // Sets large icon mode
  46. const UINT OBS_XT_EDITGROUPS = 0x0004; // Enables folder local editing (renaming)
  47. const UINT OBS_XT_EDITITEMS = 0x0008; // Enables item local editing (renaming)
  48. const UINT OBS_XT_REMOVEGROUPS = 0x0010; // Enables the "Remove" command for folders in context menu
  49. const UINT OBS_XT_REMOVEITEMS = 0x0020; // Enables the "Remove" command for items in context menu
  50. const UINT OBS_XT_ADDGROUPS = 0x0040; // Enables folder insertion
  51. const UINT OBS_XT_DRAGITEMS = 0x0080; // Enables item dragging to rearrange position
  52. const UINT OBS_XT_ANIMATION = 0x0100; // Enables animation while changing folder selection
  53. const UINT OBS_XT_SELHIGHLIGHT = 0x0200; // Enables dimmed highlight of last pressed item
  54. const UINT OBS_XT_DEFAULT = 0x00FC; // Same as OBS_XT_DRAGITEMS | OBS_XT_EDITGROUPS | OBS_XT_EDITITEMS | OBS_XT_REMOVEGROUPS | OBS_XT_REMOVEITEMS | OBS_XT_ADDGROUPS
  55. ///////////////////////////////////////////////////////////////
  56. struct XT_OUTBAR_INFO
  57. {
  58. int nIndex; // Index of item.
  59. int nDragFrom; // Starting drag index.
  60. int nDragTo; // Ending drag index.
  61. LPCTSTR lpszText; // Item text.
  62. bool bFolder; // true if the item is a folder
  63. };
  64. /////////////////////////////////////////////////////////////////////////////
  65. // YLGL window
  66. class YLGL : public CWnd
  67. {
  68. DECLARE_DYNCREATE(YLGL)
  69. Image *m_pic;
  70. Image *m_pic2;
  71. Image *m_piconimg;
  72. Image *m_pic3;
  73. Image *m_pic4;
  74. public:
  75. // Constructs a YLGL object.
  76. YLGL();
  77. // Destroys a YLGL object, handles cleanup and de-allocation.
  78. virtual ~YLGL();
  79. protected:
  80. //:Ignore
  81. int m_nFolderHeight; // used internally
  82. int m_nSelFolder; // used internally
  83. int m_nFolderHilighted; // used internally
  84. int m_nItemHilighted; // used internally
  85. int m_nLastFolderSelected; // used internally
  86. int m_nLastItemSelected; // used internally
  87. int m_nFirstItem; // used internally
  88. int m_nIconSpacingLarge; // used internally
  89. int m_nIconSpacingSmall; // used internally
  90. int m_nHitInternal1; // used internally
  91. int m_nHitInternal2; // used internally
  92. int m_nLastDragItemDraw; // used internally
  93. int m_nLastDragItemDrawType; // used internally
  94. int m_nSelAnimCount; // used internally
  95. int m_nSelAnimTiming; // used internally
  96. int m_nAnimationTickCount; // used internally
  97. BOOL m_bUpArrow; // used internally
  98. BOOL m_bDownArrow; // used internally
  99. BOOL m_bUpPressed; // used internally
  100. BOOL m_bDownPressed; // used internally
  101. BOOL m_bIconPressed; // used internally
  102. BOOL m_bLooping; // used internally
  103. BOOL m_bPressedHighlight; // used internally
  104. CFont m_font; // used internally
  105. CPen m_penBlack; // used internally
  106. CImageList* m_pLargeImageList; // used internally
  107. CImageList* m_pSmallImageList; // used internally
  108. DWORD m_dwFlags; // used internally
  109. CRect m_rcUpArrow; // used internally
  110. CRect m_rcDownArrow; // used internally
  111. CSize m_sizeOffset; // used internally
  112. CSize m_sizeMargin; // used internally
  113. CPtrArray m_arFolder; // used internally
  114. COLORREF m_clrBack; // used internally
  115. COLORREF m_clrText; // used internally
  116. BOOL m_bUserClrBack; // used internally
  117. BOOL m_bUserClrText; // used internally
  118. //:End Ignore
  119. //:Ignore
  120. typedef enum { F_NORMAL, F_SELECT, F_HILIGHT } FOLDER_HILIGHT; // used internally
  121. //:End Ignore
  122. public:
  123. void GetX(CString title, int &x, int &y);
  124. // Call this member function to set an animation effect for the currently selected item. Not to be used
  125. // with OBS_XT_SELHIGHLIGHT flag.
  126. virtual void SetAnimSelHighlight(
  127. // Specifies the time in milliseconds that the selected item will animate.
  128. const int iTime);
  129. // Call this member function to retreive the item data that was set for the specified
  130. // folder.
  131. virtual DWORD GetFolderData(
  132. // The index of the folder to retrieve item data for. If -1 the currently selected
  133. // folder item data is returned.
  134. int iFolder = -1);
  135. // Retrieve, if any, the CWnd object of the iFolder object; if iFolder is -1, the child of
  136. // the currently selected folder is returned. If no CWnd object is linked with the folder,
  137. // NULL is returned.
  138. // Call this member function to return the CWnd object that has been set for the specified folder. If
  139. // no object has been set for the folder the return value is NULL.
  140. virtual CWnd* GetFolderChild(
  141. // Index of the folder to retrieve the CWnd object for, if -1 the currently selected
  142. // folder CWnd object is used.
  143. int iFolder = -1);
  144. // Call this member function to add a folder with a CWnd child nested inside of it. You can insert a
  145. // folder with any CWnd object such as a tree control (see the OutlookBar sample).
  146. virtual int AddFolderBar(
  147. // Name of the folder to add
  148. LPCTSTR lpszFolderName,
  149. // Points to a valid CWnd object, the object must be created before inserting.
  150. CWnd* pWndChild,
  151. // Item data (lParam) for folder.
  152. const DWORD dwData = 0);
  153. // Call this member function to return the text of the specified item
  154. // for the currently selected folder.
  155. virtual CString GetItemText(
  156. // Index of the item to retreive text for.
  157. const int iIndex);
  158. // Set the tickcount (in milliseconds) between every animation frame in folder scrolling; if you
  159. // set a value of -1 or minor no animation will be played. Animation also required the
  160. // OBS_XT_ANIMATION flag.
  161. // Call this member function to set the tickcount in milliseconds between each animation frame in
  162. // folder scrolling. Animation requries the OBS_XT_ANIMATION flag to be set.
  163. virtual void SetAnimationTickCount(
  164. // Specifies the time in milliseconds between animation, a value of -1 will disable animation playback.
  165. const long lValue);
  166. // Call this member function to return the current animation tick count.
  167. virtual int GetAnimationTickCount();
  168. // Set the image index in the imagelist for the "iIndex" item of the currently selected folder.
  169. // Call this member function to set the image index in the image list for
  170. // the currently selected folder.
  171. virtual void SetItemImage(
  172. // Index of the item in the currently selected folder.
  173. const int iIndex,
  174. // Index of the image in the image list to use for the specified item.
  175. const int iImage);
  176. // Call this member function to set the item data (lParam) for the specified item in the
  177. // currently selected folder.
  178. virtual void SetItemData(
  179. // Index of the item to set item data for.
  180. const int iIndex,
  181. // Item data (lParam) to set.
  182. const DWORD dwData);
  183. // Call this member function to retrieve the index of the image associated with
  184. // the specified item in the currently selected folder.
  185. virtual int GetItemImage(
  186. // Index of the item to retrieve the image index for.
  187. const int iIndex) const;
  188. // Call this member function to get the item data (lParam) for the specified item
  189. // in the currently selected folder.
  190. virtual DWORD GetItemData(
  191. // Index of the item to retrieve item data for.
  192. const int iIndex) const;
  193. // Call this member function to remove the specifed item from the currently selected
  194. // folder
  195. virtual void RemoveItem(
  196. // Index of the item to remove.
  197. const int iIndex);
  198. // Call this member function to set the text for the specified item in the
  199. // currently selected folder.
  200. virtual void SetItemText(
  201. // Index of the item to set the text for.
  202. const int iIndex,
  203. // Points to a NULL terminated string.
  204. LPCTSTR lpszItemName);
  205. // Call this member function to begin local editing of the specified item in the
  206. // currently selected folder.
  207. virtual void StartItemEdit(
  208. // Index of the item to begin editing for.
  209. const int iIndex);
  210. // Call this member function to set the text label for the specified folder.
  211. virtual void SetFolderText(
  212. // Index of the folder to set the text label for.
  213. const int iIndex,
  214. // Points to a NULL terminated string.
  215. LPCTSTR lpszFolderName);
  216. // Call this member function to begin editing of the specified folder item's label.
  217. virtual void StartGroupEdit(
  218. // Index of the folder to begin editing.
  219. const int iIndex);
  220. // Call this member function to return a pointer to the imagelist for the specified folder.
  221. virtual CImageList* GetFolderImageList(
  222. // Index of the folder to retrieve the imagelist for.
  223. const int iIndex,
  224. // TRUE to return the small image list, FALSE to return the large image list.
  225. const BOOL bSmall) const;
  226. // Call this member function to return the global image list for the OutlookBar control.
  227. virtual CImageList* GetImageList(
  228. // If OBS_XT_SMALLICON the small image list is retured, if OBS_XT_LARGEICON the large
  229. // image list is returned.
  230. DWORD dwImageList);
  231. // Call this member function to set the image list for the specified folder. Returns a pointer
  232. // to the previously set image list, or NULL if no previouse image list exists.
  233. virtual CImageList* SetFolderImageList(
  234. // Index of the folder to set the image list for.
  235. const int iFolder,
  236. // Points to the new image list.
  237. CImageList* pImageList,
  238. // If OBS_XT_SMALLICON the small image list is set, if OBS_XT_LARGEICON the large
  239. // image list is set.
  240. DWORD dwImageList);
  241. // This member function will set the main imagelist; you can link different imagelists to the folders
  242. // using the SetFolderImageList function. If a folder has been linked to an imagelist with the
  243. // SetFolderImageList function, it will own the linked imagelist; otherwise, it will use the use
  244. // setted with this function. Returns a pointer to the previously set image list, or NULL if no
  245. // previouse image list exists.
  246. virtual CImageList* SetImageList(
  247. // Points to the new image list.
  248. CImageList* pImageList,
  249. // If OBS_XT_SMALLICON the small image list is set, if OBS_XT_LARGEICON the large
  250. // image list is set.
  251. DWORD dwImageList);
  252. // Call this member function to remove the specified folder and its items.
  253. virtual void RemoveFolder(
  254. // Index of the folder to remove.
  255. const int iIndex);
  256. // This member function will return the index of the currently selected folder.
  257. virtual int GetSelFolder() const;
  258. // This member function will return the total number of folders found it the Outlook Bar.
  259. virtual int GetFolderCount() const;
  260. // This member function will set the selected folder for the Outlook Bar.
  261. virtual void SetSelFolder(
  262. // Index of the new selected folder.
  263. const int iIndex);
  264. // This member function returns the number of items found int the currently selected folder.
  265. virtual int GetItemCount() const;
  266. // Call this member function to insert an item into the specified folder. Returns the index of the
  267. // newly inserted item.
  268. virtual int InsertItem(
  269. // Index of the folder to insert the item into.
  270. const int iFolder,
  271. // Index or position of the item to insert into the folder.
  272. const int iIndex,
  273. // A NULL terminated string that represents the item label, this value cannot be set to NULL.
  274. LPCTSTR lpszItemName,
  275. // Index into the folder's image list.
  276. const int iImage = -1,
  277. // User defined item data that you can assign to the item, use GetItemData and SetItemData to
  278. // access and change this data.
  279. const DWORD dwData = 0);
  280. // Call this member function to add a folder to the Outlook Bar control. Returns the index of the
  281. // newly inserted folder.
  282. virtual int AddFolder(
  283. // A NULL terminated string that represents the folders label.
  284. LPCTSTR lpszFolderName,
  285. // User defined item data for the folder.
  286. const DWORD dwData);
  287. // Call this member function to modify a outlook bar style. Styles to
  288. // be added or removed can be combined by using the bitwise OR (|)
  289. // operator.
  290. //
  291. // The desired styles for the outlook bar can be one or more of the
  292. // following:
  293. //[pre]
  294. // OBS_XT_EDITGROUPS - Enables folder local editing (renaming)
  295. // OBS_XT_EDITITEMS - Enables item local editing (renaming)
  296. // OBS_XT_REMOVEGROUPS - Enables the "Remove" command for folders in context menu
  297. // OBS_XT_REMOVEITEMS - Enables the "Remove" command for items in context menu
  298. // OBS_XT_ADDGROUPS - Enables folder insertion
  299. // OBS_XT_DRAGITEMS - Enables item dragging to rearrange position
  300. // OBS_XT_ANIMATION - Enables animation while changing folder selection
  301. // OBS_XT_SELHIGHLIGHT - Enables dimmed highlight of last pressed item
  302. // OBS_XT_DEFAULT - Same as OBS_XT_DRAGITEMS | OBS_XT_EDITGROUPS | OBS_XT_EDITITEMS | OBS_XT_REMOVEGROUPS | OBS_XT_REMOVEITEMS | OBS_XT_ADDGROUPS
  303. //[/pre]
  304. //
  305. virtual void ModifyFlag(
  306. // Specifies OBS_XT_ styles to be removed during style
  307. // modification.
  308. const DWORD& dwRemove,
  309. // Specifies OBS_XT_ styles to be added during style
  310. // modification.
  311. const DWORD& dwAdd,
  312. // TRUE to redraw the outlook bar.
  313. const UINT nRedraw = 0);
  314. // Call this member function to get the current style set for the outlook bar.
  315. virtual DWORD GetFlag() const;
  316. // Call this member function to set the size of the icons displayed in the
  317. // Outlook bar control for the specified folder.
  318. virtual void SetSmallIconView(
  319. // TRUE to display small icons, or FALSE to display large icons.
  320. const BOOL bSet,
  321. // Index of the folder to set the icon size for. If -1 all folder icons
  322. // are set.
  323. const int iFolder=-1);
  324. // Call this member function to return the current state of the icon display
  325. // for the outlook bar control. Returns TRUE if small icons are displayed, and
  326. // FALSE if large icons are displayed.
  327. virtual BOOL IsSmallIconView(
  328. // Index of the folder to check; if -1 the currently selected folder is checked.
  329. const int iFolder=-1) const;
  330. // Call this member function to create the outlook bar control. Returns TRUE if successful,
  331. // otherwise returns FALSE.
  332. virtual BOOL Create(
  333. // Style for the outlook bar, usually includes the WS_CHILD|WS_VISIBLE flags.
  334. DWORD dwStyle,
  335. // Size of the outlook bar.
  336. const RECT& rect,
  337. // Parent of the control.
  338. CWnd* pParentWnd,
  339. // Identifier of the outlook bar control.
  340. UINT nID,
  341. // Specifies the style flags for the control, see ModifyFlag for a list
  342. // of availiable styles.
  343. const DWORD dwFlag = OBS_XT_DEFAULT);
  344. // Call this member function to create the outlook bar control. Returns TRUE if successful,
  345. // otherwise returns FALSE.
  346. virtual BOOL CreateEx(
  347. // Extended style for the outlook bar such as WS_EX_STATICEDGE, can be NULL.
  348. DWORD dwExStyle,
  349. // Style for the outlook bar, usually includes the WS_CHILD|WS_VISIBLE flags.
  350. DWORD dwStyle,
  351. // Size of the outlook bar.
  352. const RECT& rect,
  353. // Parent of the control.
  354. CWnd* pParentWnd,
  355. // Identifier of the outlook bar control.
  356. UINT nID,
  357. // Specifies the style flags for the control, see ModifyFlag for a list
  358. // of availiable styles.
  359. const DWORD dwFlag = OBS_XT_DEFAULT);
  360. // Call this member function to set the font used by the outlook bar control.
  361. virtual void SetFontX(
  362. // Points to the font to be used by the outlook bar.
  363. CFont* pFont);
  364. // Call this member function to retrieve the font used by the outlook bar control.
  365. // Returns a pointer to a CFont object.
  366. virtual CFont* GetFontX();
  367. // Call this member function to return a pointer to the CXTBarFolder data that
  368. // is associated with the specified folder. Returns a pointer to a CXTBarFolder
  369. // object.
  370. virtual CXTBarFolder* GetBarFolder(
  371. // Index of the folder to retrieve.
  372. const int iFolder);
  373. // Call this member function to return a pointer to the CXTBarItem data that is
  374. // associated with the specified folder and item. Returns a pointer to a
  375. // CXTBarItem object.
  376. virtual CXTBarItem* GetBarFolderItem(
  377. // Index of the folder to retrieve.
  378. const int iFolder,
  379. // Index of the item to retrieve.
  380. const int iIndex);
  381. // Call this member function to set the background color for the outlook bar control.
  382. virtual void SetBackColor(
  383. // A RGB value that represents the background color.
  384. COLORREF clrBack);
  385. // Call this member function to set the text color for items in the outlook bar
  386. // control.
  387. virtual void SetTextColor(
  388. // A RGB value that represents the text item color.
  389. COLORREF clrText);
  390. // Call this member function to retrieve the size of the label for the specified
  391. // item.
  392. virtual void GetLabelRect(
  393. // Index of the folder where the item is located.
  394. const int iFolder,
  395. // Index of the item.
  396. const int iIndex,
  397. // Address of a CRect object that will receive the label size.
  398. CRect& rect);
  399. // Call this member function to retrieve the size of the icon for the specified
  400. // item.
  401. virtual void GetIconRect(
  402. // Index of the folder where the item is located.
  403. const int iFolder,
  404. // Index of the item.
  405. const int iIndex,
  406. // Address of a CRect object that will receive the icon size.
  407. CRect& rect);
  408. // Call this member function to retrieve the size of the client area for the
  409. // outlook bar. This is the inside area that contains the folders.
  410. virtual void GetInsideRect(
  411. // Address of a CRect object that will receive the size.
  412. CRect& rect) const;
  413. // Call this member function to retrieve the size of the specified item. The
  414. // size includes the area occupied by the items label and icon.
  415. virtual void GetItemRect(
  416. // Index of the folder where the item is located.
  417. const int iFolder,
  418. // Index of the item.
  419. const int iIndex,
  420. // Address of a CRect object that will receive the item size.
  421. CRect& rect);
  422. // Call this member function to retrieve the size of the specified folder.
  423. virtual BOOL GetFolderRect(
  424. // Index of the folder item.
  425. const int iIndex,
  426. // Address of a CRect object that will receive the folder size.
  427. CRect& rect) const;
  428. // This member function will return the index of the currently selected item
  429. // for the currently selected folder.
  430. //
  431. inline int GetCurSel()
  432. {
  433. return m_nItemHilighted;
  434. }
  435. // This member function will set the current selected item for the currently selected
  436. // folder.
  437. inline void SetCurSel(
  438. // Index of the item to select.
  439. int iItem,
  440. // true if the item is to be pressed when selected.
  441. const BOOL bPressed=false)
  442. {
  443. HighlightItem(iItem, bPressed);
  444. }
  445. protected:
  446. //:Ignore
  447. virtual void DrawItem(CDC* pDC, const int iFolder, CRect rc, const int iIndex, const BOOL bOnlyImage = false);
  448. virtual void DrawDragArrow(CDC* pDC, const int iFrom, const int iTo);
  449. virtual void DrawAnimItem(const int iOffsetX, const int iOffsetY, const int iIndex);
  450. virtual void DrawFolder(CDC* pDC, const int iIndex, CRect rect, const FOLDER_HILIGHT eHilight);
  451. virtual void DrawIcon(CDC* pDC, int iIcon, int iFolder, bool bHilight);
  452. virtual void PaintItems(CDC* pDC, const int iFolder, CRect rc);
  453. virtual void GetVisibleRange(const int iFolder, int& iFirst, int& iLast);
  454. virtual int GetDragItemRect(const int iIndex, CRect& rect);
  455. virtual CSize GetItemSize(const int iFolder, const int iIndex, const int iType);
  456. virtual void AnimateFolderScroll(const int iFrom, const int iTo);
  457. virtual void HighlightItem(const int iIndex, const BOOL bPressed = false);
  458. virtual void HighlightFolder(const int iIndex);
  459. virtual int HitTestEx(const CPoint& point, int& iIndex);
  460. virtual BOOL IsValidItem(const int iIndex) const;
  461. //:End Ignore
  462. //:Ignore
  463. //{{AFX_VIRTUAL(YLGL)
  464. //}}AFX_VIRTUAL
  465. //:End Ignore
  466. //:Ignore
  467. //{{AFX_MSG(YLGL)
  468. afx_msg void OnTimer(UINT nIDEvent);
  469. afx_msg void OnPaint();
  470. afx_msg BOOL OnEraseBkgnd(CDC* pDC);
  471. afx_msg void OnMouseMove(UINT nFlags, CPoint point);
  472. afx_msg void OnLButtonDown(UINT nFlags, CPoint point);
  473. afx_msg BOOL OnSetCursor(CWnd* pWnd, UINT nHitTest, UINT message);
  474. afx_msg void OnSize(UINT nType, int cx, int cy);
  475. afx_msg void OnLargeIcon();
  476. afx_msg void OnUpdateLargeIcon(CCmdUI* pCmdUI);
  477. afx_msg void OnSmallIcon();
  478. afx_msg void OnUpdateSmallIcon(CCmdUI* pCmdUI);
  479. afx_msg void OnRemoveItem();
  480. afx_msg void OnUpdateRemoveItem(CCmdUI* pCmdUI);
  481. afx_msg void OnRenameItem();
  482. afx_msg void OnUpdateRenameItem(CCmdUI* pCmdUI);
  483. afx_msg void OnRButtonUp(UINT nFlags, CPoint point);
  484. afx_msg void OnDestroy();
  485. //}}AFX_MSG
  486. afx_msg long OnEndLabelEdit(WPARAM wParam, LPARAM lParam);
  487. //:End Ignore
  488. DECLARE_MESSAGE_MAP()
  489. };
  490. /////////////////////////////////////////////////////////////////////////////
  491. // CXTBarItem is a helper class used by the YLGL to maintain information
  492. // about each folder item specified in the outlook bar control.
  493. class CXTBarItem
  494. {
  495. public:
  496. // Constructs a CXTBarItem object.
  497. CXTBarItem(
  498. // A NULL terminated string that represents the item name.
  499. LPCTSTR lpszName,
  500. // An index into the folders image list.
  501. const int nImageIndex,
  502. // User item data (lParam).
  503. DWORD dwData);
  504. // Destroys a CXTBarItem object, handles cleanup and de-allocation.
  505. virtual ~CXTBarItem();
  506. // Call this member function to return the zero based index of the
  507. // folder item.
  508. int GetIndex();
  509. // Call this member function to set the zero index of the folder
  510. // item.
  511. void SetIndex(
  512. // New index of the folder item.
  513. int iIndex);
  514. // Call this member function to return the user specified item data (lParam)
  515. // for the folder item. Returns a DWORD value that represents the user data.
  516. DWORD GetData();
  517. // Call this member function to set user data (lParam) value for the
  518. // folder item.
  519. void SetData(
  520. // Specifies the user data (lparam) value to be associated with the folder item.
  521. DWORD dwData);
  522. // Call this member function to return the label of the folder item. Returns a
  523. // CString value.
  524. CString GetName();
  525. // Call this member function to set the label of the folder item.
  526. void SetName(
  527. // A NULL terminated string that represents the item label.
  528. CString strName);
  529. protected:
  530. //:Ignore
  531. int m_nIndex; // used internally
  532. DWORD m_dwData; // used internally
  533. CString m_strName; // used internally
  534. //:End Ignore
  535. friend class YLGL;
  536. };
  537. /////////////////////////////////////////////////////////////////////////////
  538. // CXTBarFolder s a helper class used by the YLGL to maintain information
  539. // about each folder specified in the outlook bar control.
  540. class CXTBarFolder
  541. {
  542. public:
  543. // Constructs a CXTBarFolder object.
  544. CXTBarFolder(
  545. // A NULL terminated string that represents the item name.
  546. LPCTSTR lpszName,
  547. // User item data (lParam).
  548. DWORD dwData);
  549. // Destroys a CXTBarFolder object, handles cleanup and de-allocation.
  550. virtual ~CXTBarFolder();
  551. // Call this member function to return the number of folders found
  552. // in the outlook bar.
  553. int GetItemCount();
  554. // Call this member function to insert an item into the outlook bar
  555. // folder.
  556. int InsertItem(
  557. // Index of the item
  558. int iIndex,
  559. // A NULL terminated string that represents the label of the item
  560. LPCTSTR lpszName,
  561. // Index into the folders image list.
  562. const int nImage,
  563. // User item data (lParam)
  564. const DWORD dwData);
  565. // Call this member function to retrieve the specified item. Returns a
  566. // pointer to a CXTBarItem object.
  567. CXTBarItem* GetItemAt(
  568. // Index of the item to retrieve.
  569. int iIndex);
  570. // Call this member function to insert a folder item into the location
  571. // specified by iIndex.
  572. void InsertItemAt(
  573. // Zero based index of where to insert the new item.
  574. int iIndex,
  575. // Points to a valid CXTBarItem object.
  576. CXTBarItem* pBarItem);
  577. // Call this member fuction to remove the specified item from the folder.
  578. // Returns a pointer to the removed item.
  579. CXTBarItem* RemoveItemAt(
  580. // Index of the item to remove.
  581. int iIndex);
  582. // Call this member function to return the label of the folder item. Returns
  583. // a CString object.
  584. CString GetName();
  585. // Call this member function to set the label for the folder item.
  586. void SetName(
  587. // A NULL terminated string that represents the folders new label.
  588. CString strName);
  589. // Call this member function to return the user item data (lParam) for the folder.
  590. // Returns a DWORD value that represents the item data.
  591. DWORD GetData();
  592. // Call this member function to set the user item data (lParam) for the folder.
  593. void SetData(
  594. // User item data (lParam)
  595. DWORD dwData);
  596. // Call this member fuction to return a pointer to the large image list for
  597. // the folder. Returns a CImageList object if successful, otherwise NULL.
  598. CImageList* GetLargeImageList();
  599. // Call this member function to set the large image list for the folder.
  600. void SetLargeImageList(
  601. // Points to a CImageList object.
  602. CImageList* pLargeList);
  603. // Call this member fuction to return a pointer to the small image list for
  604. // the folder. Returns a CImageList object if successful, otherwise NULL.
  605. CImageList* GetSmallImageList();
  606. // Call this member function to set the small image list for the folder.
  607. void SetSmallImageList(
  608. // Points to a CImageList object.
  609. CImageList* pSmallList);
  610. // Call this member function to return a CWnd pointer to the child object
  611. // that is associated with this folder item. Returns NULL if no objects was
  612. // found.
  613. CWnd* GetChild();
  614. // Call this member function to set the CWnd child to be associated with this
  615. // folder item.
  616. void SetChild(
  617. // Points to a valid CWnd object.
  618. CWnd* pChild);
  619. protected:
  620. //:Ignore
  621. CString m_strName; // used internally
  622. DWORD m_dwData; // used internally
  623. CImageList* m_pLargeList; // used internally
  624. CImageList* m_pSmallList; // used internally
  625. CWnd* m_pChild; // used internally
  626. BOOL m_bSmallIcons; // used internally
  627. CList<CXTBarItem*, CXTBarItem*> m_barItems; // used internally
  628. //:End Ignore
  629. friend class YLGL;
  630. };
  631. //////////////////////////////////////////////////////////////////////////////
  632. AFX_INLINE void YLGL::SetFontX(CFont* pFont) {
  633. ASSERT_VALID(pFont); LOGFONT lf; pFont->GetLogFont(&lf); m_font.DeleteObject(); m_font.CreateFontIndirect(&lf);
  634. }
  635. AFX_INLINE CFont* YLGL::GetFontX() {
  636. return &m_font;
  637. }
  638. AFX_INLINE void YLGL::SetAnimationTickCount(const long lValue) {
  639. m_nAnimationTickCount = lValue;
  640. }
  641. AFX_INLINE int YLGL::GetAnimationTickCount() {
  642. return m_nAnimationTickCount;
  643. }
  644. AFX_INLINE CXTBarFolder* YLGL::GetBarFolder(const int iFolder) {
  645. return (CXTBarFolder*)m_arFolder.GetAt(iFolder);
  646. }
  647. AFX_INLINE CXTBarItem* YLGL::GetBarFolderItem(const int iFolder, const int iIndex) {
  648. return GetBarFolder(iFolder)->GetItemAt(iIndex);
  649. }
  650. AFX_INLINE void YLGL::SetBackColor(COLORREF clrBack) {
  651. m_bUserClrBack = TRUE;
  652. m_clrBack = clrBack;
  653. }
  654. AFX_INLINE void YLGL::SetTextColor(COLORREF clrText) {
  655. m_bUserClrText = TRUE;
  656. m_clrText = clrText;
  657. }
  658. /////////////////////////////////////////////////////////////////////////////
  659. AFX_INLINE int CXTBarItem::GetIndex() {
  660. return m_nIndex;
  661. }
  662. AFX_INLINE void CXTBarItem::SetIndex(int iIndex) {
  663. m_nIndex = iIndex;
  664. }
  665. AFX_INLINE DWORD CXTBarItem::GetData() {
  666. return m_dwData;
  667. }
  668. AFX_INLINE void CXTBarItem::SetData(DWORD dwData) {
  669. m_dwData = dwData;
  670. }
  671. AFX_INLINE CString CXTBarItem::GetName() {
  672. return m_strName;
  673. }
  674. AFX_INLINE void CXTBarItem::SetName(CString strName) {
  675. m_strName = strName;
  676. }
  677. /////////////////////////////////////////////////////////////////////////////
  678. AFX_INLINE int CXTBarFolder::GetItemCount() {
  679. return (int)m_barItems.GetCount();
  680. }
  681. AFX_INLINE CString CXTBarFolder::GetName() {
  682. return m_strName;
  683. }
  684. AFX_INLINE void CXTBarFolder::SetName(CString strName) {
  685. m_strName = strName;
  686. }
  687. AFX_INLINE DWORD CXTBarFolder::GetData() {
  688. return m_dwData;
  689. }
  690. AFX_INLINE void CXTBarFolder::SetData(DWORD dwData) {
  691. m_dwData = dwData;
  692. }
  693. AFX_INLINE CImageList* CXTBarFolder::GetLargeImageList() {
  694. return m_pLargeList;
  695. }
  696. AFX_INLINE void CXTBarFolder::SetLargeImageList(CImageList* pLargeList) {
  697. m_pLargeList = pLargeList;
  698. }
  699. AFX_INLINE CImageList* CXTBarFolder::GetSmallImageList() {
  700. return m_pSmallList;
  701. }
  702. AFX_INLINE void CXTBarFolder::SetSmallImageList(CImageList* pSmallList) {
  703. m_pSmallList = pSmallList;
  704. }
  705. AFX_INLINE CWnd* CXTBarFolder::GetChild() {
  706. return m_pChild;
  707. }
  708. AFX_INLINE void CXTBarFolder::SetChild(CWnd* pChild) {
  709. m_pChild = pChild;
  710. }
  711. /////////////////////////////////////////////////////////////////////////////
  712. //{{AFX_INSERT_LOCATION}}
  713. // Microsoft Developer Studio will insert additional declarations immediately before the previous line.
  714. #endif // #if !defined(__XTOUTBARCTRL_H__)