SPPropertyGridInplaceEdit.h 5.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140
  1. /********************************************
  2. ** 工作室:S&P工作室
  3. ** 作者 :张东斌
  4. ** 日期 :2007年6月
  5. *********************************************/
  6. #if !defined(__SPPROPERTYGRIDINPLACEEDIT_H__)
  7. #define __SPPROPERTYGRIDINPLACEEDIT_H__
  8. //}}AFX_CODEJOCK_PRIVATE
  9. #if _MSC_VER > 1000
  10. #pragma once
  11. #endif // _MSC_VER > 1000
  12. // class forwards.
  13. #include "SPMaskEditT.h"
  14. class CSPPropertyGridView;
  15. class CSPPropertyGridItem;
  16. //===========================================================================
  17. // Summary:
  18. // CSPPropertyGridInplaceEdit is a CEdit derived class.
  19. // It is an internal class used by Property Grid control.
  20. //===========================================================================
  21. class CSPPropertyGridInplaceEdit : public CXTMaskEditT< CEdit >
  22. {
  23. DECLARE_DYNAMIC( CSPPropertyGridInplaceEdit )
  24. public:
  25. //-----------------------------------------------------------------------
  26. // Summary:
  27. // Constructs a CSPPropertyGridInplaceEdit object
  28. //-----------------------------------------------------------------------
  29. CSPPropertyGridInplaceEdit();
  30. //-----------------------------------------------------------------------
  31. // Summary:
  32. // Destroys a CSPPropertyGridInplaceEdit object, handles cleanup
  33. // and deallocation.
  34. //-----------------------------------------------------------------------
  35. virtual ~CSPPropertyGridInplaceEdit();
  36. //-----------------------------------------------------------------------
  37. // Summary:
  38. // Call this method to set edit text value.
  39. // Parameters:
  40. // strValue - String value.
  41. //-----------------------------------------------------------------------
  42. virtual void SetValue( CString strValue );
  43. //-----------------------------------------------------------------------
  44. // Summary:
  45. // Call this method to hide in-place edit control.
  46. //-----------------------------------------------------------------------
  47. virtual void HideWindow();
  48. //-----------------------------------------------------------------------
  49. // Summary:
  50. // Call this method to create in-place edit control.
  51. // Parameters:
  52. // pItem - Points to a CSPPropertyGridItem object
  53. // rect - Specifies the size and position of the item.
  54. //-----------------------------------------------------------------------
  55. virtual void Create( CSPPropertyGridItem * pItem , CRect rect );
  56. //-----------------------------------------------------------------------
  57. // Summary:
  58. // This method is called when a parent item is destroyed.
  59. //-----------------------------------------------------------------------
  60. virtual void DestroyItem();
  61. //-----------------------------------------------------------------------
  62. // Summary:
  63. // This member function retrieves a child property grid item
  64. // Returns:
  65. // A pointer to a CSPPropertyGridItem object
  66. //-----------------------------------------------------------------------
  67. CSPPropertyGridItem * GetItem();
  68. //-----------------------------------------------------------------------
  69. // Summary:
  70. // Call this method to select a constraint in child item constraint list.
  71. // Parameters:
  72. // nDirection - Direction of constraint search.
  73. // bCircle - TRUE to find by cycle.
  74. //-----------------------------------------------------------------------
  75. virtual BOOL SelectConstraint( int nDirection , BOOL bCircle );
  76. private:
  77. CString m_strValue;
  78. CBrush m_brBack;
  79. COLORREF m_clrBack;
  80. CWnd * m_pGrid;
  81. CSPPropertyGridItem * m_pItem;
  82. protected:
  83. //{{AFX_CODEJOCK_PRIVATE
  84. //{{AFX_VIRTUAL(CSPPropertyGridInplaceEdit)
  85. virtual BOOL PreTranslateMessage(MSG* pMsg);
  86. //}}AFX_VIRTUAL
  87. //{{AFX_MSG(CSPPropertyGridInplaceEdit)
  88. afx_msg HBRUSH CtlColor(CDC* pDC, UINT nCtlColor);
  89. afx_msg void OnEnKillfocus();
  90. afx_msg void OnEnSetfocus();
  91. afx_msg void OnEnChange();
  92. afx_msg void OnLButtonDblClk(UINT nFlags, CPoint point);
  93. afx_msg void OnKeyDown(UINT nChar, UINT nRepCnt, UINT nFlags);
  94. afx_msg UINT OnGetDlgCode();
  95. afx_msg void OnChar(UINT nChar, UINT nRepCnt, UINT nFlags);
  96. afx_msg void OnSysKeyDown(UINT nChar, UINT nRepCnt, UINT nFlags);
  97. //}}AFX_MSG
  98. //}}AFX_CODEJOCK_PRIVATE
  99. private:
  100. BOOL Create( LPCTSTR lpszClassName , LPCTSTR lpszWindowName , DWORD dwStyle , const RECT & rect , CWnd * pParentWnd , UINT nID , CCreateContext * pContext = NULL );
  101. BOOL Create( DWORD dwStyle , const RECT & rect , CWnd * pParentWnd , UINT nID );
  102. DECLARE_MESSAGE_MAP()
  103. friend class CSPPropertyGridItem;
  104. };
  105. AFX_INLINE CSPPropertyGridItem * CSPPropertyGridInplaceEdit::GetItem()
  106. {
  107. return m_pItem;
  108. }
  109. AFX_INLINE BOOL CSPPropertyGridInplaceEdit::Create( LPCTSTR lpszClassName , LPCTSTR lpszWindowName , DWORD dwStyle , const RECT & rect , CWnd * pParentWnd , UINT nID , CCreateContext * pContext )
  110. {
  111. return CWnd::Create( lpszClassName,lpszWindowName,dwStyle,rect,pParentWnd,nID,pContext );
  112. }
  113. AFX_INLINE BOOL CSPPropertyGridInplaceEdit::Create( DWORD dwStyle , const RECT & rect , CWnd * pParentWnd , UINT nID )
  114. {
  115. return CEdit::Create( dwStyle,rect,pParentWnd,nID );
  116. }
  117. #endif // #if !defined(__SPPROPERTYGRIDINPLACEEDIT_H__)