00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028 #ifndef _CEGUIScrollablePane_h_
00029 #define _CEGUIScrollablePane_h_
00030
00031 #include "../CEGUIBase.h"
00032 #include "../CEGUIWindow.h"
00033 #include "CEGUIScrollablePaneProperties.h"
00034
00035 #if defined(_MSC_VER)
00036 # pragma warning(push)
00037 # pragma warning(disable : 4251)
00038 #endif
00039
00040
00041 namespace CEGUI
00042 {
00044 class CEGUIEXPORT ScrollablePaneWindowRenderer : public WindowRenderer
00045 {
00046 public:
00048 ScrollablePaneWindowRenderer(const String& name);
00049
00058 virtual Rect getViewableArea(void) const = 0;
00059 };
00060
00069 class CEGUIEXPORT ScrollablePane : public Window
00070 {
00071 public:
00073 static const String WidgetTypeName;
00075 static const String EventNamespace;
00081 static const String EventContentPaneChanged;
00087 static const String EventVertScrollbarModeChanged;
00093 static const String EventHorzScrollbarModeChanged;
00099 static const String EventAutoSizeSettingChanged;
00104 static const String EventContentPaneScrolled;
00106 static const String VertScrollbarNameSuffix;
00108 static const String HorzScrollbarNameSuffix;
00110 static const String ScrolledContainerNameSuffix;
00111
00113 ScrollablePane(const String& type, const String& name);
00114
00116 ~ScrollablePane(void);
00117
00130 const ScrolledContainer* getContentPane(void) const;
00131
00140 bool isVertScrollbarAlwaysShown(void) const;
00141
00155 void setShowVertScrollbar(bool setting);
00156
00165 bool isHorzScrollbarAlwaysShown(void) const;
00166
00180 void setShowHorzScrollbar(bool setting);
00181
00191 bool isContentPaneAutoSized(void) const;
00192
00205 void setContentPaneAutoSized(bool setting);
00206
00215 const Rect& getContentPaneArea(void) const;
00216
00232 void setContentPaneArea(const Rect& area);
00233
00243 float getHorizontalStepSize(void) const;
00244
00257 void setHorizontalStepSize(float step);
00258
00268 float getHorizontalOverlapSize(void) const;
00269
00282 void setHorizontalOverlapSize(float overlap);
00283
00292 float getHorizontalScrollPosition(void) const;
00293
00305 void setHorizontalScrollPosition(float position);
00306
00316 float getVerticalStepSize(void) const;
00317
00330 void setVerticalStepSize(float step);
00331
00341 float getVerticalOverlapSize(void) const;
00342
00355 void setVerticalOverlapSize(float overlap);
00356
00365 float getVerticalScrollPosition(void) const;
00366
00378 void setVerticalScrollPosition(float position);
00379
00388 Rect getViewableArea(void) const;
00389
00401 Scrollbar* getVertScrollbar() const;
00402
00414 Scrollbar* getHorzScrollbar() const;
00415
00416
00417 void initialiseComponents(void);
00418 void destroy(void);
00419
00420 protected:
00427 void configureScrollbars(void);
00428
00437 bool isVertScrollbarNeeded(void) const;
00438
00447 bool isHorzScrollbarNeeded(void) const;
00448
00454 void updateContainerPosition(void);
00455
00456
00468 virtual bool testClassName_impl(const String& class_name) const
00469 {
00470 if (class_name=="ScrollablePane")
00471 return true;
00472
00473 return Window::testClassName_impl(class_name);
00474 }
00475
00487 ScrolledContainer* getScrolledContainer() const;
00488
00489
00490 virtual bool validateWindowRenderer(const String& name) const
00491 {
00492 return (name == "ScrollablePane");
00493 }
00494
00495
00496
00497
00509 virtual void onContentPaneChanged(WindowEventArgs& e);
00510
00522 virtual void onVertScrollbarModeChanged(WindowEventArgs& e);
00523
00535 virtual void onHorzScrollbarModeChanged(WindowEventArgs& e);
00536
00548 virtual void onAutoSizeSettingChanged(WindowEventArgs& e);
00549
00561 virtual void onContentPaneScrolled(WindowEventArgs& e);
00562
00563
00564
00565
00571 bool handleScrollChange(const EventArgs& e);
00572
00578 bool handleContentAreaChange(const EventArgs& e);
00579
00585 bool handleAutoSizePaneChanged(const EventArgs& e);
00586
00587
00588 void addChild_impl(Window* wnd);
00589 void removeChild_impl(Window* wnd);
00590 void onSized(WindowEventArgs& e);
00591 void onMouseWheel(MouseEventArgs& e);
00592
00594 bool d_forceVertScroll;
00596 bool d_forceHorzScroll;
00598 Rect d_contentRect;
00600 float d_vertStep;
00602 float d_vertOverlap;
00604 float d_horzStep;
00606 float d_horzOverlap;
00608 Event::Connection d_contentChangedConn;
00610 Event::Connection d_autoSizeChangedConn;
00611
00612 private:
00613 static ScrollablePaneProperties::ForceHorzScrollbar d_horzScrollbarProperty;
00614 static ScrollablePaneProperties::ForceVertScrollbar d_vertScrollbarProperty;
00615 static ScrollablePaneProperties::ContentPaneAutoSized d_autoSizedProperty;
00616 static ScrollablePaneProperties::ContentArea d_contentAreaProperty;
00617 static ScrollablePaneProperties::HorzStepSize d_horzStepProperty;
00618 static ScrollablePaneProperties::HorzOverlapSize d_horzOverlapProperty;
00619 static ScrollablePaneProperties::HorzScrollPosition d_horzScrollPositionProperty;
00620 static ScrollablePaneProperties::VertStepSize d_vertStepProperty;
00621 static ScrollablePaneProperties::VertOverlapSize d_vertOverlapProperty;
00622 static ScrollablePaneProperties::VertScrollPosition d_vertScrollPositionProperty;
00623
00624 void addScrollablePaneProperties(void);
00625 };
00626
00627 }
00628
00629 #if defined(_MSC_VER)
00630 # pragma warning(pop)
00631 #endif
00632
00633 #endif // end of guard _CEGUIScrollablePane_h_