Crazy Eddies GUI System: CEGUIThumb.h Source File

Crazy Eddies GUI System 0.7.6

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

- File List

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 "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
    00071         static const String EventThumbPositionChanged;
    00077         static const String EventThumbTrackStarted;
    00082         static const String EventThumbTrackEnded;
    00083
    00084
    00085         /*************************************************************************
    00086                 Accessor Functions
    00087         *************************************************************************/
    00095         bool    isHotTracked(void) const                        {return d_hotTrack;}
    00096
    00105         bool    isVertFree(void) const                          {return d_vertFree;}
    00106
    00115         bool    isHorzFree(void) const                          {return d_horzFree;}
    00116
    00117
    00126         std::pair<float, float> getVertRange(void) const;
    00127
    00128
    00137         std::pair<float, float> getHorzRange(void) const;
    00138
    00139
    00140         /*************************************************************************
    00141                 Manipulator Functions
    00142         *************************************************************************/
    00153         void    setHotTracked(bool setting)                             {d_hotTrack = setting;}
    00154
    00155
    00166         void    setVertFree(bool setting)                                               {d_vertFree = setting;}
    00167
    00168
    00179         void    setHorzFree(bool setting)                                               {d_horzFree = setting;}
    00180
    00181
    00198         void    setVertRange(float min, float max);
    00199
    00200
    00217         void    setHorzRange(float min, float max);
    00218
    00219
    00220         /*************************************************************************
    00221                 Construction / Destruction
    00222         *************************************************************************/
    00227         Thumb(const String& type, const String& name);
    00228
    00229
    00234         virtual ~Thumb(void);
    00235
    00236
    00237 protected:
    00238         /*************************************************************************
    00239                 Implementation Functions
    00240         *************************************************************************/
    00251         virtual bool    testClassName_impl(const String& class_name) const
    00252         {
    00253                 if (class_name=="Thumb")        return true;
    00254                 return PushButton::testClassName_impl(class_name);
    00255         }
    00256
    00257
    00258         /*************************************************************************
    00259                 New Thumb Events
    00260         *************************************************************************/
    00265         virtual void    onThumbPositionChanged(WindowEventArgs& e);
    00266
    00267
    00272         virtual void    onThumbTrackStarted(WindowEventArgs& e);
    00273
    00274
    00279         virtual void    onThumbTrackEnded(WindowEventArgs& e);
    00280
    00281
    00282
    00283         /*************************************************************************
    00284                 Overridden event handling routines
    00285         *************************************************************************/
    00286         virtual void    onMouseMove(MouseEventArgs& e);
    00287         virtual void    onMouseButtonDown(MouseEventArgs& e);
    00288         virtual void    onCaptureLost(WindowEventArgs& e);
    00289
    00290
    00291         /*************************************************************************
    00292                 Implementation Data
    00293         *************************************************************************/
    00294         // general settings
    00295         bool    d_hotTrack;
    00296         bool    d_vertFree;
    00297         bool    d_horzFree;
    00298
    00299         // operational limits
    00300         float   d_vertMin, d_vertMax;
    00301         float   d_horzMin, d_horzMax;
    00302
    00303         // internal state
    00304         bool    d_beingDragged;
    00305         Point   d_dragPoint;
    00306
    00307
    00308 private:
    00309         /*************************************************************************
    00310                 Static Properties for this class
    00311         *************************************************************************/
    00312         static ThumbProperties::HotTracked      d_hotTrackedProperty;
    00313         static ThumbProperties::VertFree        d_vertFreeProperty;
    00314         static ThumbProperties::HorzFree        d_horzFreeProperty;
    00315         static ThumbProperties::VertRange       d_vertRangeProperty;
    00316         static ThumbProperties::HorzRange       d_horzRangeProperty;
    00317
    00318
    00319         /*************************************************************************
    00320                 Private methods
    00321         *************************************************************************/
    00322         void    addThumbProperties(void);
    00323 };
    00324
    00325 } // End of  CEGUI namespace section
    00326
    00327 #if defined(_MSC_VER)
    00328 #       pragma warning(pop)
    00329 #endif
    00330
    00331 #endif  // end of guard _CEGUIThumb_h_