Main Page | Namespace List | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Namespace Members | Class Members | File Members

CEGUIScrollbar.h

Go to the documentation of this file.
00001 /************************************************************************
00002         filename:       CEGUIScrollbar.h
00003         created:        13/4/2004
00004         author:         Paul D Turner
00005         
00006         purpose:        Interface to base class for Scrollbar widget
00007 *************************************************************************/
00008 /*************************************************************************
00009     Crazy Eddie's GUI System (http://www.cegui.org.uk)
00010     Copyright (C)2004 - 2005 Paul D Turner (paul@cegui.org.uk)
00011 
00012     This library is free software; you can redistribute it and/or
00013     modify it under the terms of the GNU Lesser General Public
00014     License as published by the Free Software Foundation; either
00015     version 2.1 of the License, or (at your option) any later version.
00016 
00017     This library is distributed in the hope that it will be useful,
00018     but WITHOUT ANY WARRANTY; without even the implied warranty of
00019     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00020     Lesser General Public License for more details.
00021 
00022     You should have received a copy of the GNU Lesser General Public
00023     License along with this library; if not, write to the Free Software
00024     Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
00025 *************************************************************************/
00026 #ifndef _CEGUIScrollbar_h_
00027 #define _CEGUIScrollbar_h_
00028 
00029 #include "CEGUIBase.h"
00030 #include "CEGUIWindow.h"
00031 #include "elements/CEGUIScrollbarProperties.h"
00032 
00033 
00034 #if defined(_MSC_VER)
00035 #       pragma warning(push)
00036 #       pragma warning(disable : 4251)
00037 #endif
00038 
00039 
00040 // Start of CEGUI namespace section
00041 namespace CEGUI
00042 {
00051 class CEGUIBASE_API Scrollbar : public Window
00052 {
00053 public:
00054         static const String EventNamespace;                             
00055 
00056 
00057         /*************************************************************************
00058                 Event name constants
00059         *************************************************************************/
00060         static const String EventScrollPositionChanged;         
00061         static const String EventThumbTrackStarted;                     
00062         static const String EventThumbTrackEnded;                               
00063         static const String EventScrollConfigChanged;                   
00064 
00065 
00066         /*************************************************************************
00067                 Accessor functions
00068         *************************************************************************/
00084         float   getDocumentSize(void) const                     {return d_documentSize;}
00085 
00086 
00104         float   getPageSize(void) const                         {return d_pageSize;}
00105 
00106 
00123         float   getStepSize(void) const                         {return d_stepSize;}
00124 
00125 
00143         float   getOverlapSize(void) const                      {return d_overlapSize;}
00144 
00145 
00162         float   getScrollPosition(void) const           {return d_position;}
00163 
00164 
00165         /*************************************************************************
00166                 Manipulator Commands
00167         *************************************************************************/
00178         virtual void    initialise(void);
00179 
00180 
00199         void    setDocumentSize(float document_size);
00200 
00201 
00222         void    setPageSize(float page_size);
00223 
00224 
00244         void    setStepSize(float step_size);
00245 
00246 
00267         void    setOverlapSize(float overlap_size);
00268 
00269 
00291         void    setScrollPosition(float position);
00292 
00293 
00294         /*************************************************************************
00295                 Construction / Destruction
00296         *************************************************************************/
00301         Scrollbar(const String& type, const String& name);
00302 
00303 
00308         virtual ~Scrollbar(void);
00309 
00310 
00311 protected:
00312         /*************************************************************************
00313                 Implementation Methods
00314         *************************************************************************/
00319         void    addScrollbarEvents(void);
00320 
00321 
00326         virtual PushButton*     createIncreaseButton(void) const                = 0;
00327 
00328 
00333         virtual PushButton*     createDecreaseButton(void) const                = 0;
00334 
00335 
00340         virtual Thumb*  createThumb(void) const         = 0;
00341 
00342 
00347         virtual void    layoutComponentWidgets(void)    = 0;
00348 
00349 
00354         virtual void    updateThumb(void)       = 0;
00355 
00356 
00364         virtual float   getValueFromThumb(void) const   = 0;
00365 
00366 
00380         virtual float   getAdjustDirectionFromPoint(const Point& pt) const      = 0;
00381 
00382 
00387         bool    handleThumbMoved(const EventArgs& e);
00388 
00389 
00394         bool    handleIncreaseClicked(const EventArgs& e);
00395 
00396 
00401         bool    handleDecreaseClicked(const EventArgs& e);
00402 
00403 
00408         bool    handleThumbTrackStarted(const EventArgs& e);
00409 
00410 
00415         bool    handleThumbTrackEnded(const EventArgs& e);
00416 
00417 
00418         /*************************************************************************
00419                 New event handlers for slider widget
00420         *************************************************************************/
00425         virtual void    onScrollPositionChanged(WindowEventArgs& e);
00426 
00427 
00432         virtual void    onThumbTrackStarted(WindowEventArgs& e);
00433 
00434 
00439         virtual void    onThumbTrackEnded(WindowEventArgs& e);
00440 
00441 
00446         virtual void    onScrollConfigChanged(WindowEventArgs& e);
00447 
00448 
00449         /*************************************************************************
00450                 Overridden event handlers
00451         *************************************************************************/
00452         virtual void    onMouseButtonDown(MouseEventArgs& e);
00453         virtual void    onSized(WindowEventArgs& e);
00454         virtual void    onMouseWheel(MouseEventArgs& e);
00455 
00456 
00457         /*************************************************************************
00458                 Implementation Data
00459         *************************************************************************/
00460         float   d_documentSize;         
00461         float   d_pageSize;                     
00462         float   d_stepSize;                     
00463         float   d_overlapSize;          
00464         float   d_position;                     
00465 
00466         // Pointers to the controls that make up the scroll bar
00467         Thumb*          d_thumb;                
00468         PushButton*     d_increase;             
00469         PushButton*     d_decrease;             
00470 
00471 
00472 private:
00473         /*************************************************************************
00474                 Static Properties for this class
00475         *************************************************************************/
00476         static ScrollbarProperties::DocumentSize        d_documentSizeProperty;
00477         static ScrollbarProperties::PageSize            d_pageSizeProperty;
00478         static ScrollbarProperties::StepSize            d_stepSizeProperty;
00479         static ScrollbarProperties::OverlapSize         d_overlapSizeProperty;
00480         static ScrollbarProperties::ScrollPosition      d_scrollPositionProperty;
00481 
00482 
00483         /*************************************************************************
00484                 Private methods
00485         *************************************************************************/
00486         void    addScrollbarProperties(void);
00487 };
00488 
00489 
00490 } // End of  CEGUI namespace section
00491 
00492 #if defined(_MSC_VER)
00493 #       pragma warning(pop)
00494 #endif
00495 
00496 #endif  // end of guard _CEGUIScrollbar_h_

Generated on Wed Feb 16 12:41:07 2005 for Crazy Eddies GUI System by  doxygen 1.3.9.1