CEGUIScrollablePane.h

00001 /************************************************************************
00002         filename:       CEGUIScrollablePane.h
00003         created:        1/3/2005
00004         author:         Paul D Turner
00005 *************************************************************************/
00006 /*************************************************************************
00007     Crazy Eddie's GUI System (http://www.cegui.org.uk)
00008     Copyright (C)2004 - 2005 Paul D Turner (paul@cegui.org.uk)
00009 
00010     This library is free software; you can redistribute it and/or
00011     modify it under the terms of the GNU Lesser General Public
00012     License as published by the Free Software Foundation; either
00013     version 2.1 of the License, or (at your option) any later version.
00014 
00015     This library is distributed in the hope that it will be useful,
00016     but WITHOUT ANY WARRANTY; without even the implied warranty of
00017     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00018     Lesser General Public License for more details.
00019 
00020     You should have received a copy of the GNU Lesser General Public
00021     License along with this library; if not, write to the Free Software
00022     Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
00023 *************************************************************************/
00024 #ifndef _CEGUIScrollablePane_h_
00025 #define _CEGUIScrollablePane_h_
00026 
00027 #include "CEGUIBase.h"
00028 #include "CEGUIWindow.h"
00029 #include "elements/CEGUIScrollablePaneProperties.h"
00030 
00031 #if defined(_MSC_VER)
00032 #       pragma warning(push)
00033 #       pragma warning(disable : 4251)
00034 #endif
00035 
00036 // Start of CEGUI namespace section
00037 namespace CEGUI
00038 {
00047     class CEGUIEXPORT ScrollablePane : public Window
00048     {
00049     public:
00050         /*************************************************************************
00051             Constants
00052         *************************************************************************/
00053         static const String EventNamespace;                 
00054         static const String EventContentPaneChanged;        
00055         static const String EventVertScrollbarModeChanged;      
00056         static const String EventHorzScrollbarModeChanged;      
00057         static const String EventAutoSizeSettingChanged;    
00058         static const String EventContentPaneScrolled;       
00059 
00060         /*************************************************************************
00061             Construction / Destruction
00062         *************************************************************************/
00067         ScrollablePane(const String& type, const String& name);
00068 
00073         ~ScrollablePane(void);
00074 
00075         /*************************************************************************
00076                 Public interface
00077         *************************************************************************/
00090         const ScrolledContainer* getContentPane(void) const;
00091 
00100         bool    isVertScrollbarAlwaysShown(void) const;
00112         void    setShowVertScrollbar(bool setting);
00113 
00122         bool    isHorzScrollbarAlwaysShown(void) const;
00123 
00135         void    setShowHorzScrollbar(bool setting);
00136 
00145         bool isContentPaneAutoSized(void) const;
00146 
00158         void setContentPaneAutoSized(bool setting);
00159 
00168         const Rect& getContentPaneArea(void) const;
00169 
00185         void setContentPaneArea(const Rect& area);
00186 
00196         float getHorizontalStepSize(void) const;
00197 
00210         void setHorizontalStepSize(float step);
00211 
00221         float getHorizontalOverlapSize(void) const;
00222 
00235         void setHorizontalOverlapSize(float overlap);
00236 
00245         float getHorizontalScrollPosition(void) const;
00246 
00258         void setHorizontalScrollPosition(float position);
00259 
00269         float getVerticalStepSize(void) const;
00270 
00283         void setVerticalStepSize(float step);
00284 
00294         float getVerticalOverlapSize(void) const;
00295 
00308         void setVerticalOverlapSize(float overlap);
00309 
00318         float getVerticalScrollPosition(void) const;
00319 
00331         void setVerticalScrollPosition(float position);
00332 
00333         /*************************************************************************
00334             Overridden from Window
00335         *************************************************************************/
00336         void initialise(void);
00337 
00338     protected:
00339         /*************************************************************************
00340                 Abstract interface
00341         *************************************************************************/
00352         virtual Scrollbar* createHorizontalScrollbar(const String& name) const = 0;
00353 
00364         virtual Scrollbar* createVerticalScrollbar(const String& name) const = 0;
00365 
00374         virtual Rect getViewableArea(void) const = 0;
00375 
00376         /*************************************************************************
00377                 Implementation Methods
00378         *************************************************************************/
00383         void addScrollablePaneEvents(void);
00384 
00390             void configureScrollbars(void);
00391 
00400         bool isVertScrollbarNeeded(void) const;
00401 
00410         bool isHorzScrollbarNeeded(void) const;
00411 
00417         void updateContainerPosition(void);
00418 
00419 
00430                 virtual bool    testClassName_impl(const String& class_name) const
00431                 {
00432                         if (class_name==(const utf8*)"ScrollablePane")  return true;
00433                         return Window::testClassName_impl(class_name);
00434                 }
00435 
00436 
00437         /*************************************************************************
00438                 Event triggers
00439         *************************************************************************/
00451         virtual void onContentPaneChanged(WindowEventArgs& e);
00452 
00464         virtual void onVertScrollbarModeChanged(WindowEventArgs& e);
00465 
00477         virtual void onHorzScrollbarModeChanged(WindowEventArgs& e);
00478 
00490         virtual void onAutoSizeSettingChanged(WindowEventArgs& e);
00491 
00503         virtual void onContentPaneScrolled(WindowEventArgs& e);
00504 
00505         /*************************************************************************
00506                 Event handler methods
00507         *************************************************************************/
00513         bool handleScrollChange(const EventArgs&  e);
00514 
00520         bool handleContentAreaChange(const EventArgs& e);
00521 
00527         bool handleAutoSizePaneChanged(const EventArgs& e);
00528 
00529         /*************************************************************************
00530                 Overridden from Window
00531         *************************************************************************/
00532         void addChild_impl(Window* wnd);
00533         void removeChild_impl(Window* wnd);
00534         void onSized(WindowEventArgs& e);
00535         void onMouseWheel(MouseEventArgs& e);
00536 
00537         /*************************************************************************
00538                 Data fields
00539         *************************************************************************/
00540         bool    d_forceVertScroll;              
00541         bool    d_forceHorzScroll;              
00542         Rect    d_contentRect;          
00543         float   d_vertStep;             
00544         float   d_vertOverlap;          
00545         float   d_horzStep;             
00546         float   d_horzOverlap;          
00547 
00548         // component widgets
00549         Scrollbar*  d_vertScrollbar;        
00550         Scrollbar*  d_horzScrollbar;        
00551         ScrolledContainer*  d_container;    
00552 
00553     private:
00554             /*************************************************************************
00555                     Static Properties for this class
00556             *************************************************************************/
00557         static ScrollablePaneProperties::ForceHorzScrollbar     d_horzScrollbarProperty;
00558         static ScrollablePaneProperties::ForceVertScrollbar     d_vertScrollbarProperty;
00559             static ScrollablePaneProperties::ContentPaneAutoSized       d_autoSizedProperty;
00560             static ScrollablePaneProperties::ContentArea            d_contentAreaProperty;
00561         static ScrollablePaneProperties::HorzStepSize           d_horzStepProperty;
00562         static ScrollablePaneProperties::HorzOverlapSize        d_horzOverlapProperty;
00563         static ScrollablePaneProperties::HorzScrollPosition     d_horzScrollPositionProperty;
00564         static ScrollablePaneProperties::VertStepSize           d_vertStepProperty;
00565         static ScrollablePaneProperties::VertOverlapSize        d_vertOverlapProperty;
00566         static ScrollablePaneProperties::VertScrollPosition     d_vertScrollPositionProperty;
00567 
00568             /*************************************************************************
00569                     Private methods
00570             *************************************************************************/
00571             void addScrollablePaneProperties(void);
00572     };
00573 
00574 } // End of  CEGUI namespace section
00575 
00576 
00577 #if defined(_MSC_VER)
00578 #       pragma warning(pop)
00579 #endif
00580 
00581 #endif  // end of guard _CEGUIScrollablePane_h_

Generated on Sat Nov 26 09:34:49 2005 for Crazy Eddies GUI System by  doxygen 1.4.5