UIEdit.h 2.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798
  1. #ifndef __UIEDIT_H__
  2. #define __UIEDIT_H__
  3. #pragma once
  4. namespace DuiLib
  5. {
  6. class CEditWnd;
  7. class UILIB_API CEditUI : public CLabelUI
  8. {
  9. DECLARE_DUICONTROL(CEditUI)
  10. friend class CEditWnd;
  11. public:
  12. CEditUI();
  13. LPCTSTR GetClass() const;
  14. LPVOID GetInterface(LPCTSTR pstrName);
  15. UINT GetControlFlags() const;
  16. void SetEnabled(bool bEnable = true);
  17. void SetText(LPCTSTR pstrText);
  18. void SetMaxChar(UINT uMax);
  19. UINT GetMaxChar();
  20. void SetReadOnly(bool bReadOnly);
  21. bool IsReadOnly() const;
  22. void SetPasswordMode(bool bPasswordMode);
  23. bool IsPasswordMode() const;
  24. void SetPasswordChar(TCHAR cPasswordChar);
  25. TCHAR GetPasswordChar() const;
  26. void SetNumberOnly(bool bNumberOnly);
  27. bool IsNumberOnly() const;
  28. int GetWindowStyls() const;
  29. LPCTSTR GetNormalImage();
  30. void SetNormalImage(LPCTSTR pStrImage);
  31. LPCTSTR GetHotImage();
  32. void SetHotImage(LPCTSTR pStrImage);
  33. LPCTSTR GetFocusedImage();
  34. void SetFocusedImage(LPCTSTR pStrImage);
  35. LPCTSTR GetDisabledImage();
  36. void SetDisabledImage(LPCTSTR pStrImage);
  37. void SetNativeEditBkColor(DWORD dwBkColor);
  38. DWORD GetNativeEditBkColor() const;
  39. void SetNativeEditTextColor( LPCTSTR pStrColor );
  40. DWORD GetNativeEditTextColor() const;
  41. bool IsAutoSelAll();
  42. void SetAutoSelAll(bool bAutoSelAll);
  43. void SetSel(long nStartChar, long nEndChar);
  44. void SetSelAll();
  45. void SetReplaceSel(LPCTSTR lpszReplace);
  46. void SetTipValue(LPCTSTR pStrTipValue);
  47. LPCTSTR GetTipValue();
  48. void SetTipValueColor(LPCTSTR pStrColor);
  49. DWORD GetTipValueColor();
  50. HWND GetHWND();
  51. // Layered mode only: realign this control's floating native edit window
  52. // (a top-level WS_POPUP, so it does NOT follow the host window's moves).
  53. // Called by CPaintManagerUI on WM_MOVE / WM_WINDOWPOSCHANGED.
  54. // See the full rationale (in Chinese) at the definition in UIEdit.cpp.
  55. void SyncNativeWindowPos();
  56. void SetPos(RECT rc, bool bNeedInvalidate = true);
  57. void Move(SIZE szOffset, bool bNeedInvalidate = true);
  58. void SetVisible(bool bVisible = true);
  59. void SetInternVisible(bool bVisible = true);
  60. SIZE EstimateSize(SIZE szAvailable);
  61. void DoEvent(TEventUI& event);
  62. void SetAttribute(LPCTSTR pstrName, LPCTSTR pstrValue);
  63. void PaintStatusImage(HDC hDC);
  64. void PaintText(HDC hDC);
  65. protected:
  66. CEditWnd* m_pWindow;
  67. UINT m_uMaxChar;
  68. bool m_bReadOnly;
  69. bool m_bPasswordMode;
  70. bool m_bAutoSelAll;
  71. TCHAR m_cPasswordChar;
  72. UINT m_uButtonState;
  73. CDuiString m_sNormalImage;
  74. CDuiString m_sHotImage;
  75. CDuiString m_sFocusedImage;
  76. CDuiString m_sDisabledImage;
  77. CDuiString m_sTipValue;
  78. DWORD m_dwTipValueColor;
  79. DWORD m_dwEditbkColor;
  80. DWORD m_dwEditTextColor;
  81. int m_iWindowStyls;
  82. };
  83. }
  84. #endif // __UIEDIT_H__