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;
00077 static const String EventContentPaneChanged;
00079 static const String EventVertScrollbarModeChanged;
00081 static const String EventHorzScrollbarModeChanged;
00083 static const String EventAutoSizeSettingChanged;
00085 static const String EventContentPaneScrolled;
00087 static const String VertScrollbarNameSuffix;
00089 static const String HorzScrollbarNameSuffix;
00091 static const String ScrolledContainerNameSuffix;
00092
00094 ScrollablePane(const String& type, const String& name);
00095
00097 ~ScrollablePane(void);
00098
00111 const ScrolledContainer* getContentPane(void) const;
00112
00121 bool isVertScrollbarAlwaysShown(void) const;
00122
00136 void setShowVertScrollbar(bool setting);
00137
00146 bool isHorzScrollbarAlwaysShown(void) const;
00147
00161 void setShowHorzScrollbar(bool setting);
00162
00172 bool isContentPaneAutoSized(void) const;
00173
00186 void setContentPaneAutoSized(bool setting);
00187
00196 const Rect& getContentPaneArea(void) const;
00197
00213 void setContentPaneArea(const Rect& area);
00214
00224 float getHorizontalStepSize(void) const;
00225
00238 void setHorizontalStepSize(float step);
00239
00249 float getHorizontalOverlapSize(void) const;
00250
00263 void setHorizontalOverlapSize(float overlap);
00264
00273 float getHorizontalScrollPosition(void) const;
00274
00286 void setHorizontalScrollPosition(float position);
00287
00297 float getVerticalStepSize(void) const;
00298
00311 void setVerticalStepSize(float step);
00312
00322 float getVerticalOverlapSize(void) const;
00323
00336 void setVerticalOverlapSize(float overlap);
00337
00346 float getVerticalScrollPosition(void) const;
00347
00359 void setVerticalScrollPosition(float position);
00360
00369 Rect getViewableArea(void) const;
00370
00382 Scrollbar* getVertScrollbar() const;
00383
00395 Scrollbar* getHorzScrollbar() const;
00396
00397
00398 void initialiseComponents(void);
00399 void destroy(void);
00400
00401 protected:
00408 void configureScrollbars(void);
00409
00418 bool isVertScrollbarNeeded(void) const;
00419
00428 bool isHorzScrollbarNeeded(void) const;
00429
00435 void updateContainerPosition(void);
00436
00437
00449 virtual bool testClassName_impl(const String& class_name) const
00450 {
00451 if (class_name=="ScrollablePane")
00452 return true;
00453
00454 return Window::testClassName_impl(class_name);
00455 }
00456
00468 ScrolledContainer* getScrolledContainer() const;
00469
00470
00471 virtual bool validateWindowRenderer(const String& name) const
00472 {
00473 return (name == "ScrollablePane");
00474 }
00475
00476
00477
00478
00490 virtual void onContentPaneChanged(WindowEventArgs& e);
00491
00503 virtual void onVertScrollbarModeChanged(WindowEventArgs& e);
00504
00516 virtual void onHorzScrollbarModeChanged(WindowEventArgs& e);
00517
00529 virtual void onAutoSizeSettingChanged(WindowEventArgs& e);
00530
00542 virtual void onContentPaneScrolled(WindowEventArgs& e);
00543
00544
00545
00546
00552 bool handleScrollChange(const EventArgs& e);
00553
00559 bool handleContentAreaChange(const EventArgs& e);
00560
00566 bool handleAutoSizePaneChanged(const EventArgs& e);
00567
00568
00569 void addChild_impl(Window* wnd);
00570 void removeChild_impl(Window* wnd);
00571 void onSized(WindowEventArgs& e);
00572 void onMouseWheel(MouseEventArgs& e);
00573
00575 bool d_forceVertScroll;
00577 bool d_forceHorzScroll;
00579 Rect d_contentRect;
00581 float d_vertStep;
00583 float d_vertOverlap;
00585 float d_horzStep;
00587 float d_horzOverlap;
00589 Event::Connection d_contentChangedConn;
00591 Event::Connection d_autoSizeChangedConn;
00592
00593 private:
00594 static ScrollablePaneProperties::ForceHorzScrollbar d_horzScrollbarProperty;
00595 static ScrollablePaneProperties::ForceVertScrollbar d_vertScrollbarProperty;
00596 static ScrollablePaneProperties::ContentPaneAutoSized d_autoSizedProperty;
00597 static ScrollablePaneProperties::ContentArea d_contentAreaProperty;
00598 static ScrollablePaneProperties::HorzStepSize d_horzStepProperty;
00599 static ScrollablePaneProperties::HorzOverlapSize d_horzOverlapProperty;
00600 static ScrollablePaneProperties::HorzScrollPosition d_horzScrollPositionProperty;
00601 static ScrollablePaneProperties::VertStepSize d_vertStepProperty;
00602 static ScrollablePaneProperties::VertOverlapSize d_vertOverlapProperty;
00603 static ScrollablePaneProperties::VertScrollPosition d_vertScrollPositionProperty;
00604
00605 void addScrollablePaneProperties(void);
00606 };
00607
00608 }
00609
00610 #if defined(_MSC_VER)
00611 # pragma warning(pop)
00612 #endif
00613
00614 #endif // end of guard _CEGUIScrollablePane_h_