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.

105 lines
3.8 KiB

  1. /*
  2. * ScrollViewer
  3. */
  4. #ifndef DUI_CONTROL_SCROLLVIEWER_H_INCLUDED
  5. #define DUI_CONTROL_SCROLLVIEWER_H_INCLUDED
  6. #pragma once
  7. #include "duiscrollbar.h"
  8. #include "duiviewer.h"
  9. namespace DirectUI
  10. {
  11. #define BV_AsNeeded 0
  12. #define BV_Never 1
  13. #define BV_Always 2
  14. // Auto-pinning support
  15. #define P_None 0
  16. #define P_Horz 1
  17. #define P_Vert 2
  18. ////////////////////////////////////////////////////////
  19. // ScrollViewer
  20. // Class definition
  21. class ScrollViewer : public Element, public IElementListener
  22. {
  23. public:
  24. static HRESULT Create(OUT Element** ppElement);
  25. // Generic events
  26. virtual void OnEvent(Event* pEvent);
  27. virtual void OnInput(InputEvent* pie);
  28. // System events
  29. virtual bool OnPropertyChanging(PropertyInfo* ppi, int iIndex, Value* pvOld, Value* pvNew);
  30. virtual void OnPropertyChanged(PropertyInfo* ppi, int iIndex, Value* pvOld, Value* pvNew);
  31. // Hierarchy
  32. virtual HRESULT Add(Element** ppe, UINT cCount);
  33. // Listener impl
  34. virtual void OnListenerAttach(Element* peFrom) { peFrom; }
  35. virtual void OnListenerDetach(Element* peFrom) { peFrom; }
  36. virtual bool OnListenedPropertyChanging(Element* peFrom, PropertyInfo* ppi, int iIndex, Value* pvOld, Value* pvNew) { peFrom; ppi; iIndex; pvOld; pvNew; return true; }
  37. virtual void OnListenedPropertyChanged(Element* peFrom, PropertyInfo* ppi, int iIndex, Value* pvOld, Value* pvNew);
  38. virtual void OnListenedInput(Element* peFrom, InputEvent* pInput) { peFrom; pInput; }
  39. virtual void OnListenedEvent(Element* peFrom, Event* pEvent) { peFrom; pEvent; }
  40. // Property definitions
  41. static PropertyInfo* XOffsetProp;
  42. static PropertyInfo* YOffsetProp;
  43. static PropertyInfo* XScrollableProp;
  44. static PropertyInfo* YScrollableProp;
  45. static PropertyInfo* XBarVisibilityProp;
  46. static PropertyInfo* YBarVisibilityProp;
  47. static PropertyInfo* PinningProp;
  48. // Quick property accessors
  49. ScrollBar* GetXScrollBar() { return _peHScroll; }
  50. ScrollBar* GetYScrollBar() { return _peVScroll; }
  51. int GetXOffset() DUIQuickGetter(int, GetInt(), XOffset, Specified)
  52. int GetYOffset() DUIQuickGetter(int, GetInt(), YOffset, Specified)
  53. bool GetXScrollable() DUIQuickGetter(bool, GetBool(), XScrollable, Specified)
  54. bool GetYScrollable() DUIQuickGetter(bool, GetBool(), YScrollable, Specified)
  55. int GetXBarVisibility() DUIQuickGetter(int, GetInt(), XBarVisibility, Specified)
  56. int GetYBarVisibility() DUIQuickGetter(int, GetInt(), YBarVisibility, Specified)
  57. int GetPinning() DUIQuickGetter(int, GetInt(), Pinning, Specified)
  58. HRESULT SetXOffset(int v) DUIQuickSetter(CreateInt(v), XOffset)
  59. HRESULT SetYOffset(int v) DUIQuickSetter(CreateInt(v), YOffset)
  60. HRESULT SetXScrollable(bool v) DUIQuickSetter(CreateBool(v), XScrollable)
  61. HRESULT SetYScrollable(bool v) DUIQuickSetter(CreateBool(v), YScrollable)
  62. HRESULT SetXBarVisibility(int v) DUIQuickSetter(CreateInt(v), XBarVisibility)
  63. HRESULT SetYBarVisibility(int v) DUIQuickSetter(CreateInt(v), YBarVisibility)
  64. HRESULT SetPinning(int v) DUIQuickSetter(CreateInt(v), Pinning)
  65. // ClassInfo accessors (static and virtual instance-based)
  66. static IClassInfo* Class;
  67. virtual IClassInfo* GetClassInfo() { return Class; }
  68. static HRESULT Register();
  69. ScrollViewer() { }
  70. HRESULT Initialize();
  71. virtual ~ScrollViewer() { }
  72. protected:
  73. ScrollBar* _peHScroll;
  74. ScrollBar* _peVScroll;
  75. Viewer* _peViewer;
  76. Element* _peContent;
  77. private:
  78. void CheckScroll(ScrollBar* psb, BOOL fScrollable, int iVisibility);
  79. };
  80. } // namespace DirectUI
  81. #endif // DUI_CONTROL_SCROLLVIEWER_H_INCLUDED