UIHotKey.h 2.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687
  1. #ifndef __UIHOTKEY_H__
  2. #define __UIHOTKEY_H__
  3. #pragma once
  4. namespace DuiLib{
  5. class CHotKeyUI;
  6. class UILIB_API CHotKeyWnd : public CWindowWnd
  7. {
  8. public:
  9. CHotKeyWnd(void);
  10. public:
  11. void Init(CHotKeyUI * pOwner);
  12. RECT CalPos();
  13. LPCTSTR GetWindowClassName() const;
  14. void OnFinalMessage(HWND hWnd);
  15. LPCTSTR GetSuperClassName() const;
  16. LRESULT HandleMessage(UINT uMsg, WPARAM wParam, LPARAM lParam);
  17. LRESULT OnKillFocus(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled);
  18. LRESULT OnEditChanged(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled);
  19. public:
  20. void SetHotKey(WORD wVirtualKeyCode, WORD wModifiers);
  21. void GetHotKey(WORD &wVirtualKeyCode, WORD &wModifiers) const;
  22. DWORD GetHotKey(void) const;
  23. CDuiString GetHotKeyName();
  24. void SetRules(WORD wInvalidComb, WORD wModifiers);
  25. CDuiString GetKeyName(UINT vk, BOOL fExtended);
  26. protected:
  27. CHotKeyUI * m_pOwner;
  28. HBRUSH m_hBkBrush;
  29. bool m_bInit;
  30. };
  31. class UILIB_API CHotKeyUI : public CLabelUI
  32. {
  33. DECLARE_DUICONTROL(CHotKeyUI)
  34. friend CHotKeyWnd;
  35. public:
  36. CHotKeyUI();
  37. LPCTSTR GetClass() const;
  38. LPVOID GetInterface(LPCTSTR pstrName);
  39. UINT GetControlFlags() const;
  40. void SetEnabled(bool bEnable = true);
  41. void SetText(LPCTSTR pstrText);
  42. LPCTSTR GetNormalImage();
  43. void SetNormalImage(LPCTSTR pStrImage);
  44. LPCTSTR GetHotImage();
  45. void SetHotImage(LPCTSTR pStrImage);
  46. LPCTSTR GetFocusedImage();
  47. void SetFocusedImage(LPCTSTR pStrImage);
  48. LPCTSTR GetDisabledImage();
  49. void SetDisabledImage(LPCTSTR pStrImage);
  50. void SetNativeBkColor(DWORD dwBkColor);
  51. DWORD GetNativeBkColor() const;
  52. void SetPos(RECT rc);
  53. void SetVisible(bool bVisible = true);
  54. void SetInternVisible(bool bVisible = true);
  55. SIZE EstimateSize(SIZE szAvailable);
  56. void DoEvent(TEventUI& event);
  57. void SetAttribute(LPCTSTR pstrName, LPCTSTR pstrValue);
  58. void PaintStatusImage(HDC hDC);
  59. void PaintText(HDC hDC);
  60. public:
  61. void GetHotKey(WORD &wVirtualKeyCode, WORD &wModifiers) const;
  62. DWORD GetHotKey(void) const;
  63. void SetHotKey(WORD wVirtualKeyCode, WORD wModifiers);
  64. protected:
  65. CHotKeyWnd * m_pWindow;
  66. UINT m_uButtonState;
  67. CDuiString m_sNormalImage;
  68. CDuiString m_sHotImage;
  69. CDuiString m_sFocusedImage;
  70. CDuiString m_sDisabledImage;
  71. DWORD m_dwHotKeybkColor;
  72. protected:
  73. WORD m_wVirtualKeyCode;
  74. WORD m_wModifiers;
  75. };
  76. }
  77. #endif