aduiComboBox.h 5.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179
  1. //////////////////////////////////////////////////////////////////////////////
  2. //
  3. // Copyright 2015 Autodesk, Inc. All rights reserved.
  4. //
  5. // Use of this software is subject to the terms of the Autodesk license
  6. // agreement provided at the time of installation or download, or which
  7. // otherwise accompanies this software in either electronic or hard copy form.
  8. //
  9. //////////////////////////////////////////////////////////////////////////////
  10. #ifndef _aduiComboBox_h
  11. #define _aduiComboBox_h
  12. #pragma pack (push, 8)
  13. #pragma once
  14. #ifndef _ADESK_MAC_
  15. /////////////////////////////////////////////////////////////////////////////
  16. // CAdUiComboBox window
  17. //
  18. // This is the main Combo Box itself
  19. #pragma warning(push)
  20. #pragma warning(disable : 4275)
  21. class CAdUiComboBoxDraw;
  22. class ADUI_PORT CAdUiComboBox : public CComboBox {
  23. DECLARE_DYNAMIC(CAdUiComboBox)
  24. public:
  25. CAdUiComboBox ();
  26. virtual ~CAdUiComboBox ();
  27. // Fixed MFC Routines
  28. public:
  29. // Use GetLBString() to circumvent GetLBText() errors.
  30. void GetLBString (int nIndex, CString& rString);
  31. // Misc.
  32. protected:
  33. CPoint m_lastMousePoint;
  34. CRect m_tipRect;
  35. CString m_sToolTipText;
  36. CAdUiComboBoxDraw* m_pDraw;
  37. CAdUiTheme* m_pTheme;
  38. public:
  39. static bool IsVistaTheme();
  40. static bool IsInEdit(UINT nItemState);
  41. virtual BOOL Create(DWORD dwStyle, const RECT& rect, CWnd* pParentWnd, UINT nID);
  42. virtual BOOL OnChildNotify(UINT, WPARAM, LPARAM, LRESULT*);
  43. virtual void DrawItem(LPDRAWITEMSTRUCT lpDrawItemStruct);
  44. virtual void MeasureItem(LPMEASUREITEMSTRUCT lpMeasureItemStruct);
  45. virtual void GetContentExtent (LPCTSTR text, int& width, int& height);
  46. void GetTextExtent (LPCTSTR text, int& width, int& height);
  47. BOOL IsOwnerDraw ();
  48. BOOL IsStatic ();
  49. /// <summary>
  50. /// Sets the CAdUiComboBoxDraw instance which is used to do owner draw
  51. /// </summary>
  52. /// <param name="pDraw">
  53. /// The pointer to the CAdUiComboBoxDraw instance
  54. /// </param>
  55. void SetDraw(CAdUiComboBoxDraw* pDraw);
  56. /// <summary>
  57. /// Gets if the combo box has a themed look
  58. /// </summary>
  59. /// <returns>
  60. /// True if the combo box has a themed look or false otherwise
  61. /// </returns>
  62. bool IsThemed() const;
  63. /// <summary>
  64. /// Sets if the combo box has a themed look
  65. /// </summary>
  66. /// <param name="bValue">
  67. /// True if the combo box has a themed look or false otherwise
  68. /// </param>
  69. void SetIsThemed(bool bValue);
  70. /// <summary>
  71. /// Gets the theme used by the combo box
  72. /// </summary>
  73. /// <returns>
  74. /// The pointer to the CAdUiTheme instance used by the combo box
  75. /// </returns>
  76. CAdUiTheme* GetTheme() const;
  77. /// <summary>
  78. /// Sets the theme to be used by the combo box
  79. /// </summary>
  80. /// <param name="pTheme">
  81. /// The pointer to the CAdUiTheme instance
  82. /// </param>
  83. void SetTheme(CAdUiTheme* pTheme);
  84. // AdUi message handlers
  85. protected:
  86. CWnd *m_aduiParent;
  87. virtual ADUI_REPLY DoAdUiMessage (
  88. ADUI_NOTIFY notifyCode, UINT controlId, LPARAM lParam
  89. );
  90. virtual void OnDrawTip (CDC& dc);
  91. virtual BOOL OnDrawTipText (CAdUiDrawTipText& dtt);
  92. virtual ADUI_REPLY OnGetTipSupport (CPoint& p);
  93. virtual BOOL OnGetTipRect (CRect& r);
  94. virtual BOOL OnGetTipText (CString& text);
  95. virtual BOOL OnHitTipRect (CPoint& p);
  96. public:
  97. CWnd *GetAdUiParent ();
  98. void SetAdUiParent (CWnd *w);
  99. CString GetToolTipText (void) const;
  100. BOOL SetToolTipText (const CString& sText);
  101. // Subclassed controls
  102. protected:
  103. BOOL m_bAutoDeleteEBox : 1; // set to automatically delete
  104. BOOL m_bAutoDeleteLBox : 1; // the edit or listbox controls
  105. BOOL m_bSubclassedControls : 1; // set when all children are found
  106. CAdUiEdit *m_pComboEBox; // the child edit control (if any)
  107. CAdUiListBox *m_pComboLBox; // the list box
  108. public:
  109. CAdUiEdit *GetEditBox ();
  110. void SetEditBox (CAdUiEdit *control, BOOL autoDelete);
  111. CAdUiListBox *GetListBox ();
  112. void SetListBox (CAdUiListBox *control, BOOL autoDelete);
  113. // Validation style for subclassed EditBox
  114. public:
  115. DWORD GetStyleMask ();
  116. BOOL IsStyleMaskSet (DWORD mask);
  117. void SetStyleMask (DWORD mask);
  118. // ClassWizard-controlled
  119. public:
  120. //{{AFX_VIRTUAL(CAdUiComboBox)
  121. //}}AFX_VIRTUAL
  122. protected:
  123. virtual LRESULT WindowProc(UINT message, WPARAM wParam, LPARAM lParam);
  124. //{{AFX_MSG(CAdUiComboBox)
  125. afx_msg void OnPaint();
  126. afx_msg LRESULT OnAdUiMessage (WPARAM wParam, LPARAM lParam);
  127. afx_msg HBRUSH OnCtlColor(CDC* pDC, CWnd* pWnd, UINT nCtlColor);
  128. afx_msg void OnMouseMove(UINT nFlags, CPoint point);
  129. //}}AFX_MSG
  130. afx_msg LRESULT OnGetToolTipText (WPARAM wParam, LPARAM lParam);
  131. DECLARE_MESSAGE_MAP()
  132. };
  133. inline void CAdUiComboBox::SetDraw(CAdUiComboBoxDraw* pDraw)
  134. {
  135. m_pDraw = pDraw;
  136. }
  137. inline CAdUiTheme* CAdUiComboBox::GetTheme() const
  138. {
  139. return m_pTheme;
  140. }
  141. #pragma warning(pop)
  142. #endif //_ADESK_MAC_
  143. /////////////////////////////////////////////////////////////////////////////
  144. //{{AFX_INSERT_LOCATION}}
  145. // Microsoft Developer Studio will insert additional declarations immediately before the previous line.
  146. #pragma pack (pop)
  147. #endif
  148. /////////////////////////////////////////////////////////////////////////////