Leaked source code of windows server 2003
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

76 lines
1.8 KiB

  1. /*
  2. * Button
  3. */
  4. #ifndef DUI_CONTROL_BUTTON_H_INCLUDED
  5. #define DUI_CONTROL_BUTTON_H_INCLUDED
  6. #pragma once
  7. namespace DirectUI
  8. {
  9. ////////////////////////////////////////////////////////
  10. // Button
  11. // ButtonClick event
  12. struct ButtonClickEvent : Event
  13. {
  14. UINT nCount;
  15. UINT uModifiers;
  16. POINT pt;
  17. };
  18. struct ButtonContextEvent : Event
  19. {
  20. UINT uModifiers;
  21. POINT pt;
  22. };
  23. // Class definition
  24. class Button : public Element
  25. {
  26. public:
  27. static HRESULT Create(OUT Element** ppElement) { return Create(AE_MouseAndKeyboard, ppElement); }
  28. static HRESULT Create(UINT nActive, OUT Element** ppElement);
  29. // System events
  30. virtual void OnInput(InputEvent* pie);
  31. // Event types
  32. static UID Click;
  33. static UID Context;
  34. // Property definitions
  35. static PropertyInfo* PressedProp;
  36. static PropertyInfo* CapturedProp;
  37. // Quick property accessors
  38. bool GetPressed() DUIQuickGetter(bool, GetBool(), Pressed, Specified)
  39. bool GetCaptured() DUIQuickGetter(bool, GetBool(), Captured, Specified)
  40. HRESULT SetPressed(bool v) DUIQuickSetter(CreateBool(v), Pressed)
  41. HRESULT SetCaptured(bool v) DUIQuickSetter(CreateBool(v), Captured)
  42. // ClassInfo accessors (static and virtual instance-based)
  43. static IClassInfo* Class;
  44. virtual IClassInfo* GetClassInfo() { return Class; }
  45. static HRESULT Register();
  46. // System events
  47. virtual void OnPropertyChanged(PropertyInfo* ppi, int iIndex, Value* pvOld, Value* pvNew);
  48. // override the DefaultAction() of Element.
  49. virtual HRESULT DefaultAction();
  50. Button() { }
  51. HRESULT Initialize(UINT nActive);
  52. virtual ~Button() { }
  53. private:
  54. BOOL _bRightPressed;
  55. };
  56. } // namespace DirectUI
  57. #endif // DUI_CONTROL_BUTTON_H_INCLUDED