TrueColorToolBar.h 3.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122
  1. /***=========================================================================
  2. ==== ====
  3. ==== D C U t i l i t y ====
  4. ==== ====
  5. =============================================================================
  6. ==== ====
  7. ==== File name : TrueColorToolBar.h ====
  8. ==== Project name : Tester ====
  9. ==== Project number : --- ====
  10. ==== Creation date : 13/1/2003 ====
  11. ==== Author(s) : Dany Cantin ====
  12. ==== ====
  13. ==== Copyright ?DCUtility 2003 ====
  14. ==== ====
  15. =============================================================================
  16. ===========================================================================
  17. usage :
  18. ///////////////////////////////////////////////////////////////////////
  19. if (!m_wndToolBar.CreateEx(this, TBSTYLE_FLAT, WS_CHILD | WS_VISIBLE | CBRS_TOP
  20. | CBRS_GRIPPER | CBRS_TOOLTIPS | CBRS_FLYBY | CBRS_SIZE_DYNAMIC) ||
  21. !m_wndToolBar.LoadToolBar(IDR_MAINFRAME))
  22. {
  23. TRACE0("Failed to create toolbar\n");
  24. return -1; // fail to create
  25. }
  26. m_wndToolBar.LoadTrueColorToolBar( 32, IDB_NORMAL, IDB_NORMAL, IDB_NORMAL);*/
  27. #ifndef TRUECOLORTOOLBAR_H_
  28. #define TRUECOLORTOOLBAR_H_
  29. #if _MSC_VER > 1000
  30. #pragma once
  31. #endif // _MSC_VER > 1000
  32. #include <afxtempl.h>
  33. /////////////////////////////////////////////////////////////////////////////
  34. // CTrueColorToolBar
  35. class CTrueColorToolBar : public CToolBar
  36. {
  37. // Construction
  38. public:
  39. CTrueColorToolBar();
  40. // Attributes
  41. private:
  42. BOOL m_bDropDown;
  43. struct stDropDownInfo {
  44. public:
  45. UINT uButtonID;
  46. UINT uMenuID;
  47. CWnd* pParent;
  48. };
  49. CArray <stDropDownInfo, stDropDownInfo&> m_lstDropDownButton;
  50. // Operations
  51. public:
  52. BOOL LoadTrueColorToolBar(int nBtnWidth,
  53. UINT uToolBar,
  54. UINT uToolBarHot = 0,
  55. UINT uToolBarDisabled = 0);
  56. void AddDropDownButton(CWnd* pParent, UINT uButtonID, UINT uMenuID);
  57. private:
  58. BOOL SetTrueColorToolBar(UINT uToolBarType,
  59. UINT uToolBar,
  60. int nBtnWidth);
  61. // Overrides
  62. // ClassWizard generated virtual function overrides
  63. //{{AFX_VIRTUAL(CTrueColorToolBar)
  64. //}}AFX_VIRTUAL
  65. // Implementation
  66. public:
  67. virtual ~CTrueColorToolBar();
  68. // Generated message map functions
  69. protected:
  70. //{{AFX_MSG(CTrueColorToolBar)
  71. #ifdef VC60
  72. afx_msg void OnToolbarDropDown(NMTOOLBAR* pnmh, LRESULT* plRes);
  73. #else
  74. afx_msg void OnToolbarDropDown(NMHDR *pNMHDR, LRESULT *pResult);
  75. #endif
  76. afx_msg BOOL OnEraseBkgnd(CDC* pDC);
  77. //}}AFX_MSG
  78. DECLARE_MESSAGE_MAP()
  79. };
  80. /////////////////////////////////////////////////////////////////////////////
  81. //{{AFX_INSERT_LOCATION}}
  82. // Microsoft Visual C++ will insert additional declarations immediately before the previous line.
  83. #endif // TRUECOLORTOOLBAR_H_