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 "elements/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 {
00047 class CEGUIEXPORT ScrollablePaneWindowRenderer : public WindowRenderer
00048 {
00049 public:
00054 ScrollablePaneWindowRenderer(const String& name);
00055
00064 virtual Rect getViewableArea(void) const = 0;
00065 };
00066
00075 class CEGUIEXPORT ScrollablePane : public Window
00076 {
00077 public:
00078
00079
00080
00081 static const String WidgetTypeName;
00082 static const String EventNamespace;
00083 static const String EventContentPaneChanged;
00084 static const String EventVertScrollbarModeChanged;
00085 static const String EventHorzScrollbarModeChanged;
00086 static const String EventAutoSizeSettingChanged;
00087 static const String EventContentPaneScrolled;
00088
00089
00090
00091
00092 static const String VertScrollbarNameSuffix;
00093 static const String HorzScrollbarNameSuffix;
00094 static const String ScrolledContainerNameSuffix;
00095
00096
00097
00098
00103 ScrollablePane(const String& type, const String& name);
00104
00109 ~ScrollablePane(void);
00110
00111
00112
00113
00126 const ScrolledContainer* getContentPane(void) const;
00127
00136 bool isVertScrollbarAlwaysShown(void) const;
00148 void setShowVertScrollbar(bool setting);
00149
00158 bool isHorzScrollbarAlwaysShown(void) const;
00159
00171 void setShowHorzScrollbar(bool setting);
00172
00181 bool isContentPaneAutoSized(void) const;
00182
00194 void setContentPaneAutoSized(bool setting);
00195
00204 const Rect& getContentPaneArea(void) const;
00205
00221 void setContentPaneArea(const Rect& area);
00222
00232 float getHorizontalStepSize(void) const;
00233
00246 void setHorizontalStepSize(float step);
00247
00257 float getHorizontalOverlapSize(void) const;
00258
00271 void setHorizontalOverlapSize(float overlap);
00272
00281 float getHorizontalScrollPosition(void) const;
00282
00294 void setHorizontalScrollPosition(float position);
00295
00305 float getVerticalStepSize(void) const;
00306
00319 void setVerticalStepSize(float step);
00320
00330 float getVerticalOverlapSize(void) const;
00331
00344 void setVerticalOverlapSize(float overlap);
00345
00354 float getVerticalScrollPosition(void) const;
00355
00367 void setVerticalScrollPosition(float position);
00368
00377 Rect getViewableArea(void) const;
00378
00390 Scrollbar* getVertScrollbar() const;
00391
00403 Scrollbar* getHorzScrollbar() const;
00404
00405
00406
00407
00408 void initialiseComponents(void);
00409 void destroy(void);
00410
00411 protected:
00412
00413
00414
00423
00424
00425
00426
00427
00433 void configureScrollbars(void);
00434
00443 bool isVertScrollbarNeeded(void) const;
00444
00453 bool isHorzScrollbarNeeded(void) const;
00454
00460 void updateContainerPosition(void);
00461
00462
00473 virtual bool testClassName_impl(const String& class_name) const
00474 {
00475 if (class_name=="ScrollablePane") return true;
00476 return Window::testClassName_impl(class_name);
00477 }
00478
00490 ScrolledContainer* getScrolledContainer() const;
00491
00492
00493 virtual bool validateWindowRenderer(const String& name) const
00494 {
00495 return (name == "ScrollablePane");
00496 }
00497
00498
00499
00500
00512 virtual void onContentPaneChanged(WindowEventArgs& e);
00513
00525 virtual void onVertScrollbarModeChanged(WindowEventArgs& e);
00526
00538 virtual void onHorzScrollbarModeChanged(WindowEventArgs& e);
00539
00551 virtual void onAutoSizeSettingChanged(WindowEventArgs& e);
00552
00564 virtual void onContentPaneScrolled(WindowEventArgs& e);
00565
00566
00567
00568
00574 bool handleScrollChange(const EventArgs& e);
00575
00581 bool handleContentAreaChange(const EventArgs& e);
00582
00588 bool handleAutoSizePaneChanged(const EventArgs& e);
00589
00590
00591
00592
00593 void addChild_impl(Window* wnd);
00594 void removeChild_impl(Window* wnd);
00595 void onSized(WindowEventArgs& e);
00596 void onMouseWheel(MouseEventArgs& e);
00597
00598
00599
00600
00601 bool d_forceVertScroll;
00602 bool d_forceHorzScroll;
00603 Rect d_contentRect;
00604 float d_vertStep;
00605 float d_vertOverlap;
00606 float d_horzStep;
00607 float d_horzOverlap;
00608 Event::Connection d_contentChangedConn;
00609 Event::Connection d_autoSizeChangedConn;
00610
00611 private:
00612
00613
00614
00615 static ScrollablePaneProperties::ForceHorzScrollbar d_horzScrollbarProperty;
00616 static ScrollablePaneProperties::ForceVertScrollbar d_vertScrollbarProperty;
00617 static ScrollablePaneProperties::ContentPaneAutoSized d_autoSizedProperty;
00618 static ScrollablePaneProperties::ContentArea d_contentAreaProperty;
00619 static ScrollablePaneProperties::HorzStepSize d_horzStepProperty;
00620 static ScrollablePaneProperties::HorzOverlapSize d_horzOverlapProperty;
00621 static ScrollablePaneProperties::HorzScrollPosition d_horzScrollPositionProperty;
00622 static ScrollablePaneProperties::VertStepSize d_vertStepProperty;
00623 static ScrollablePaneProperties::VertOverlapSize d_vertOverlapProperty;
00624 static ScrollablePaneProperties::VertScrollPosition d_vertScrollPositionProperty;
00625
00626
00627
00628
00629 void addScrollablePaneProperties(void);
00630 };
00631
00632
00633 }
00634
00635
00636 #if defined(_MSC_VER)
00637 # pragma warning(pop)
00638 #endif
00639
00640 #endif // end of guard _CEGUIScrollablePane_h_