CEGUIThumb.h

00001 /***********************************************************************
00002         filename:       CEGUIThumb.h
00003         created:        25/4/2004
00004         author:         Paul D Turner
00005         
00006         purpose:        Interface for a 'Thumb' widget.  Intended to be used as
00007                                 part of other widgets such as scrollers and sliders.
00008 *************************************************************************/
00009 /***************************************************************************
00010  *   Copyright (C) 2004 - 2006 Paul D Turner & The CEGUI Development Team
00011  *
00012  *   Permission is hereby granted, free of charge, to any person obtaining
00013  *   a copy of this software and associated documentation files (the
00014  *   "Software"), to deal in the Software without restriction, including
00015  *   without limitation the rights to use, copy, modify, merge, publish,
00016  *   distribute, sublicense, and/or sell copies of the Software, and to
00017  *   permit persons to whom the Software is furnished to do so, subject to
00018  *   the following conditions:
00019  *
00020  *   The above copyright notice and this permission notice shall be
00021  *   included in all copies or substantial portions of the Software.
00022  *
00023  *   THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
00024  *   EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
00025  *   MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
00026  *   IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR
00027  *   OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
00028  *   ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
00029  *   OTHER DEALINGS IN THE SOFTWARE.
00030  ***************************************************************************/
00031 #ifndef _CEGUIThumb_h_
00032 #define _CEGUIThumb_h_
00033 
00034 #include "CEGUIPushButton.h"
00035 #include "elements/CEGUIThumbProperties.h"
00036 #include <utility>
00037 
00038 
00039 #if defined(_MSC_VER)
00040 #       pragma warning(push)
00041 #       pragma warning(disable : 4251)
00042 #endif
00043 
00044 
00045 // Start of CEGUI namespace section
00046 namespace CEGUI
00047 {
00048 
00056 class CEGUIEXPORT Thumb : public PushButton
00057 {
00058 public:
00059         static const String EventNamespace;                             
00060     static const String WidgetTypeName;             
00061 
00062         /*************************************************************************
00063                 Event name constants
00064         *************************************************************************/
00065         // generated internally by Window
00066         static const String EventThumbPositionChanged;          
00067         static const String EventThumbTrackStarted;                     
00068         static const String EventThumbTrackEnded;                               
00069 
00070 
00071         /*************************************************************************
00072                 Accessor Functions
00073         *************************************************************************/ 
00081         bool    isHotTracked(void) const                        {return d_hotTrack;}
00082 
00091         bool    isVertFree(void) const                          {return d_vertFree;}
00092 
00101         bool    isHorzFree(void) const                          {return d_horzFree;}
00102 
00103 
00112         std::pair<float, float> getVertRange(void) const;
00113 
00114 
00123         std::pair<float, float> getHorzRange(void) const;
00124 
00125 
00126         /*************************************************************************
00127                 Manipulator Functions
00128         *************************************************************************/
00139         void    setHotTracked(bool setting)                             {d_hotTrack = setting;}
00140 
00141 
00152         void    setVertFree(bool setting)                                               {d_vertFree = setting;}
00153 
00154 
00165         void    setHorzFree(bool setting)                                               {d_horzFree = setting;}
00166         
00167 
00184         void    setVertRange(float min, float max);
00185 
00186 
00203         void    setHorzRange(float min, float max);
00204 
00205 
00206         /*************************************************************************
00207                 Construction / Destruction
00208         *************************************************************************/
00213         Thumb(const String& type, const String& name);
00214 
00215 
00220         virtual ~Thumb(void);
00221 
00222 
00223 protected:
00224         /*************************************************************************
00225                 Implementation Functions
00226         *************************************************************************/
00237         virtual bool    testClassName_impl(const String& class_name) const
00238         {
00239                 if (class_name=="Thumb")        return true;
00240                 return PushButton::testClassName_impl(class_name);
00241         }
00242 
00243 
00244         /*************************************************************************
00245                 New Thumb Events
00246         *************************************************************************/
00251         virtual void    onThumbPositionChanged(WindowEventArgs& e);
00252 
00253 
00258         virtual void    onThumbTrackStarted(WindowEventArgs& e);
00259 
00260 
00265         virtual void    onThumbTrackEnded(WindowEventArgs& e);
00266 
00267 
00268 
00269         /*************************************************************************
00270                 Overridden event handling routines
00271         *************************************************************************/
00272         virtual void    onMouseMove(MouseEventArgs& e);
00273         virtual void    onMouseButtonDown(MouseEventArgs& e);
00274         virtual void    onCaptureLost(WindowEventArgs& e);
00275 
00276 
00277         /*************************************************************************
00278                 Implementation Data
00279         *************************************************************************/
00280         // general settings
00281         bool    d_hotTrack;                                     
00282         bool    d_vertFree;                                     
00283         bool    d_horzFree;                                     
00284 
00285         // operational limits
00286         float   d_vertMin, d_vertMax;           
00287         float   d_horzMin, d_horzMax;           
00288 
00289         // internal state
00290         bool    d_beingDragged;                         
00291         Point   d_dragPoint;                            
00292 
00293 
00294 private:
00295         /*************************************************************************
00296                 Static Properties for this class
00297         *************************************************************************/
00298         static ThumbProperties::HotTracked      d_hotTrackedProperty;
00299         static ThumbProperties::VertFree        d_vertFreeProperty;
00300         static ThumbProperties::HorzFree        d_horzFreeProperty;
00301         static ThumbProperties::VertRange       d_vertRangeProperty;
00302         static ThumbProperties::HorzRange       d_horzRangeProperty;
00303 
00304 
00305         /*************************************************************************
00306                 Private methods
00307         *************************************************************************/
00308         void    addThumbProperties(void);
00309 };
00310 
00311 } // End of  CEGUI namespace section
00312 
00313 #if defined(_MSC_VER)
00314 #       pragma warning(pop)
00315 #endif
00316 
00317 #endif  // end of guard _CEGUIThumb_h_

Generated on Sun Nov 5 14:35:28 2006 for Crazy Eddies GUI System by  doxygen 1.4.7