aduiEdit.h 4.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142
  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 _aduiEdit_h
  11. #define _aduiEdit_h
  12. #pragma pack (push, 8)
  13. #pragma once
  14. #ifndef _ADESK_MAC_
  15. ////////////////////////////////////////////////////////////////////////////
  16. // CAdUiEdit window
  17. #pragma warning(push)
  18. #pragma warning(disable : 4275)
  19. class ADUI_PORT CAdUiEdit : public CEdit {
  20. DECLARE_DYNAMIC(CAdUiEdit)
  21. public:
  22. CAdUiEdit ();
  23. virtual ~CAdUiEdit ();
  24. // Misc.
  25. protected:
  26. CPoint m_lastMousePoint;
  27. CRect m_tipRect;
  28. public:
  29. virtual void GetContentExtent (LPCTSTR text, int& width, int& height);
  30. void GetTextExtent (LPCTSTR text, int& width, int& height);
  31. // Validation style
  32. public:
  33. DWORD m_styleMask; // style bits (application-defined)
  34. virtual void SetStyleMask (DWORD); // define behavior
  35. DWORD GetStyleMask (); // fetch the style
  36. BOOL IsStyleMaskSet (DWORD); // verify styles
  37. // AdUi message handlers
  38. protected:
  39. CWnd *m_aduiParent;
  40. virtual ADUI_REPLY DoAdUiMessage (
  41. ADUI_NOTIFY notifyCode, UINT controlId, LPARAM lParam
  42. );
  43. virtual void OnDrawTip (CDC& dc);
  44. virtual BOOL OnDrawTipText (CAdUiDrawTipText& dtt);
  45. virtual ADUI_REPLY OnGetTipSupport (CPoint& p);
  46. virtual BOOL OnGetTipRect (CRect& r);
  47. virtual BOOL OnGetTipText (CString& text);
  48. virtual BOOL OnHitTipRect (CPoint& p);
  49. public:
  50. CWnd *GetAdUiParent ();
  51. void SetAdUiParent (CWnd *w);
  52. // ClassWizard-controlled
  53. public:
  54. //{{AFX_VIRTUAL(CAdUiEdit)
  55. //}}AFX_VIRTUAL
  56. protected:
  57. //{{AFX_MSG(CAdUiEdit)
  58. afx_msg LRESULT OnAdUiMessage (WPARAM wParam, LPARAM lParam);
  59. afx_msg void OnMouseMove(UINT nFlags, CPoint point);
  60. //}}AFX_MSG
  61. DECLARE_MESSAGE_MAP()
  62. };
  63. class CAdUiSearchBoxEditor;
  64. class CAdUiSearchBoxSearchButton;
  65. class CAdUiSearchBoxClearButton;
  66. ////////////////////////////////////////////////////////////////////////////
  67. // CAdUiSearchBox window
  68. class ADUI_PORT CAdUiSearchBox : public CAdUiEdit{
  69. DECLARE_DYNAMIC(CAdUiSearchBox)
  70. public:
  71. CAdUiSearchBox ();
  72. virtual ~CAdUiSearchBox ();
  73. virtual BOOL Create(DWORD dwStyle, const RECT& rect, CWnd* pParentWnd, UINT nID);
  74. virtual void PreSubclassWindow();
  75. void SetDefaultText(LPCTSTR pszText);
  76. void SetNotification(LPCTSTR pszText);
  77. void ClearEditor();
  78. bool IsEditEmpty();
  79. void SetButtonBackgroundColorForThemeChange(COLORREF color, bool bThemeIsDark); // INTERNAL USE ONLY
  80. public: //Override methods
  81. virtual void EditChanged();
  82. virtual void ClearButtonClicked();
  83. virtual void SearchButtonClicked();
  84. protected:
  85. virtual LRESULT WindowProc(UINT message, WPARAM wParam, LPARAM lParam);
  86. //{{AFX_MSG(CAdUiComboBox)
  87. virtual BOOL OnNotify(WPARAM wParam, LPARAM lParam, LRESULT* pResult);
  88. afx_msg void OnClearButton();
  89. afx_msg void OnSearchButton();
  90. afx_msg void SetEditFocus();
  91. afx_msg void KillEditFocus();
  92. afx_msg void OnEditChange();
  93. afx_msg void OnSize(UINT nType, int cx, int cy);
  94. //}}AFX_MSG
  95. DECLARE_MESSAGE_MAP()
  96. private:
  97. BOOL CreateControls();
  98. BOOL DestroyControls();
  99. void UpdateSearchBox();
  100. void UpdateButton();
  101. void GetControlRect(CRect &editRect, CRect &buttonRect);
  102. private:
  103. bool m_bIsControlsCreated;
  104. CAdUiSearchBoxEditor* m_pEditor;
  105. CAdUiSearchBoxSearchButton* m_pBtnSearch;
  106. CAdUiSearchBoxClearButton* m_pBtnClear;
  107. CString m_strNotification;
  108. CString m_strDefaultText;
  109. };
  110. #pragma warning(pop)
  111. #endif //_ADESK_MAC_
  112. /////////////////////////////////////////////////////////////////////////////
  113. //{{AFX_INSERT_LOCATION}}
  114. // Microsoft Developer Studio will insert additional declarations immediately before the previous line.
  115. #pragma pack (pop)
  116. #endif
  117. /////////////////////////////////////////////////////////////////////////////