Crazy Eddies GUI System: CEGUIScrollbar.h Source File

- Main Page
- Namespaces
- Classes
- Files
- Directories
- Related Pages

# CEGUIScrollbar.h

    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 CEGUIEXPORT Scrollbar : public Window
    00052 {
    00053 public:
    00054         static const String EventNamespace;
    00055
    00056         /*************************************************************************
    00057                 Event name constants
    00058         *************************************************************************/
    00059         static const String EventScrollPositionChanged;
    00060         static const String EventThumbTrackStarted;
    00061         static const String EventThumbTrackEnded;
    00062         static const String EventScrollConfigChanged;
    00063
    00064
    00065         /*************************************************************************
    00066                 Accessor functions
    00067         *************************************************************************/
    00083         float   getDocumentSize(void) const                     {return d_documentSize;}
    00084
    00085
    00103         float   getPageSize(void) const                         {return d_pageSize;}
    00104
    00105
    00122         float   getStepSize(void) const                         {return d_stepSize;}
    00123
    00124
    00142         float   getOverlapSize(void) const                      {return d_overlapSize;}
    00143
    00144
    00161         float   getScrollPosition(void) const           {return d_position;}
    00162
    00163
    00164         /*************************************************************************
    00165                 Manipulator Commands
    00166         *************************************************************************/
    00177         virtual void    initialise(void);
    00178
    00179
    00198         void    setDocumentSize(float document_size);
    00199
    00200
    00221         void    setPageSize(float page_size);
    00222
    00223
    00243         void    setStepSize(float step_size);
    00244
    00245
    00266         void    setOverlapSize(float overlap_size);
    00267
    00268
    00290         void    setScrollPosition(float position);
    00291
    00292
    00293         /*************************************************************************
    00294                 Construction / Destruction
    00295         *************************************************************************/
    00300         Scrollbar(const String& type, const String& name);
    00301
    00302
    00307         virtual ~Scrollbar(void);
    00308
    00309
    00310 protected:
    00311         /*************************************************************************
    00312                 Implementation Methods
    00313         *************************************************************************/
    00318         void    addScrollbarEvents(void);
    00319
    00320
    00328         virtual PushButton*     createIncreaseButton(const String& name) const          = 0;
    00329
    00330
    00338         virtual PushButton*     createDecreaseButton(const String& name) const          = 0;
    00339
    00340
    00348         virtual Thumb*  createThumb(const String& name) const           = 0;
    00349
    00350
    00355         virtual void    updateThumb(void)       = 0;
    00356
    00357
    00365         virtual float   getValueFromThumb(void) const   = 0;
    00366
    00367
    00381         virtual float   getAdjustDirectionFromPoint(const Point& pt) const      = 0;
    00382
    00383
    00388         bool    handleThumbMoved(const EventArgs& e);
    00389
    00390
    00395         bool    handleIncreaseClicked(const EventArgs& e);
    00396
    00397
    00402         bool    handleDecreaseClicked(const EventArgs& e);
    00403
    00404
    00409         bool    handleThumbTrackStarted(const EventArgs& e);
    00410
    00411
    00416         bool    handleThumbTrackEnded(const EventArgs& e);
    00417
    00418
    00429         virtual bool    testClassName_impl(const String& class_name) const
    00430         {
    00431                 if (class_name==(const utf8*)"Scrollbar")       return true;
    00432                 return Window::testClassName_impl(class_name);
    00433         }
    00434
    00435
    00436         /*************************************************************************
    00437                 New event handlers for slider widget
    00438         *************************************************************************/
    00443         virtual void    onScrollPositionChanged(WindowEventArgs& e);
    00444
    00445
    00450         virtual void    onThumbTrackStarted(WindowEventArgs& e);
    00451
    00452
    00457         virtual void    onThumbTrackEnded(WindowEventArgs& e);
    00458
    00459
    00464         virtual void    onScrollConfigChanged(WindowEventArgs& e);
    00465
    00466
    00467         /*************************************************************************
    00468                 Overridden event handlers
    00469         *************************************************************************/
    00470         virtual void    onMouseButtonDown(MouseEventArgs& e);
    00471         virtual void    onMouseWheel(MouseEventArgs& e);
    00472
    00473
    00474         /*************************************************************************
    00475                 Implementation Data
    00476         *************************************************************************/
    00477         float   d_documentSize;
    00478         float   d_pageSize;
    00479         float   d_stepSize;
    00480         float   d_overlapSize;
    00481         float   d_position;
    00482
    00483         // Pointers to the controls that make up the scroll bar
    00484         Thumb*          d_thumb;
    00485         PushButton*     d_increase;
    00486         PushButton*     d_decrease;
    00487
    00488
    00489 private:
    00490         /*************************************************************************
    00491                 Static Properties for this class
    00492         *************************************************************************/
    00493         static ScrollbarProperties::DocumentSize        d_documentSizeProperty;
    00494         static ScrollbarProperties::PageSize            d_pageSizeProperty;
    00495         static ScrollbarProperties::StepSize            d_stepSizeProperty;
    00496         static ScrollbarProperties::OverlapSize         d_overlapSizeProperty;
    00497         static ScrollbarProperties::ScrollPosition      d_scrollPositionProperty;
    00498
    00499
    00500         /*************************************************************************
    00501                 Private methods
    00502         *************************************************************************/
    00503         void    addScrollbarProperties(void);
    00504 };
    00505
    00506
    00507 } // End of  CEGUI namespace section
    00508
    00509 #if defined(_MSC_VER)
    00510 #       pragma warning(pop)
    00511 #endif
    00512
    00513 #endif  // end of guard _CEGUIScrollbar_h_