CEGUIScrollablePane.h

00001 /***********************************************************************
00002         filename:       CEGUIScrollablePane.h
00003         created:        1/3/2005
00004         author:         Paul D Turner
00005 *************************************************************************/
00006 /***************************************************************************
00007  *   Copyright (C) 2004 - 2006 Paul D Turner & The CEGUI Development Team
00008  *
00009  *   Permission is hereby granted, free of charge, to any person obtaining
00010  *   a copy of this software and associated documentation files (the
00011  *   "Software"), to deal in the Software without restriction, including
00012  *   without limitation the rights to use, copy, modify, merge, publish,
00013  *   distribute, sublicense, and/or sell copies of the Software, and to
00014  *   permit persons to whom the Software is furnished to do so, subject to
00015  *   the following conditions:
00016  *
00017  *   The above copyright notice and this permission notice shall be
00018  *   included in all copies or substantial portions of the Software.
00019  *
00020  *   THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
00021  *   EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
00022  *   MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
00023  *   IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR
00024  *   OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
00025  *   ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
00026  *   OTHER DEALINGS IN THE SOFTWARE.
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 // Start of CEGUI namespace section
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             Constants
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             Child Widget name suffix constants
00091         *************************************************************************/
00092         static const String VertScrollbarNameSuffix;        
00093         static const String HorzScrollbarNameSuffix;        
00094         static const String ScrolledContainerNameSuffix;    
00095 
00096         /*************************************************************************
00097             Construction / Destruction
00098         *************************************************************************/
00103         ScrollablePane(const String& type, const String& name);
00104 
00109         ~ScrollablePane(void);
00110 
00111         /*************************************************************************
00112                 Public interface
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             Overridden from Window
00407         *************************************************************************/
00408         void initialiseComponents(void);
00409         void destroy(void);
00410 
00411     protected:
00412         /*************************************************************************
00413                 Abstract interface
00414         *************************************************************************/
00423         //virtual Rect getViewableArea_impl(void) const = 0;
00424 
00425         /*************************************************************************
00426                 Implementation Methods
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         // validate window renderer
00493         virtual bool validateWindowRenderer(const String& name) const
00494         {
00495             return (name == "ScrollablePane");
00496         }
00497 
00498         /*************************************************************************
00499                 Event triggers
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                 Event handler methods
00568         *************************************************************************/
00574         bool handleScrollChange(const EventArgs&  e);
00575 
00581         bool handleContentAreaChange(const EventArgs& e);
00582 
00588         bool handleAutoSizePaneChanged(const EventArgs& e);
00589 
00590         /*************************************************************************
00591                 Overridden from Window
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                 Data fields
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                     Static Properties for this class
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                     Private methods
00628             *************************************************************************/
00629             void addScrollablePaneProperties(void);
00630     };
00631 
00632 
00633 } // End of  CEGUI namespace section
00634 
00635 
00636 #if defined(_MSC_VER)
00637 #       pragma warning(pop)
00638 #endif
00639 
00640 #endif  // end of guard _CEGUIScrollablePane_h_

Generated on Sat Jun 28 14:35:44 2008 for Crazy Eddies GUI System by  doxygen 1.5.4