Torque3D Documentation / _generateds / guiTextEditSliderCtrl.h

guiTextEditSliderCtrl.h

Engine/source/gui/controls/guiTextEditSliderCtrl.h

More...

Classes:

Detailed Description

 1
 2//-----------------------------------------------------------------------------
 3// Copyright (c) 2012 GarageGames, LLC
 4//
 5// Permission is hereby granted, free of charge, to any person obtaining a copy
 6// of this software and associated documentation files (the "Software"), to
 7// deal in the Software without restriction, including without limitation the
 8// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
 9// sell copies of the Software, and to permit persons to whom the Software is
10// furnished to do so, subject to the following conditions:
11//
12// The above copyright notice and this permission notice shall be included in
13// all copies or substantial portions of the Software.
14//
15// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
20// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
21// IN THE SOFTWARE.
22//-----------------------------------------------------------------------------
23
24#ifndef _GUITEXTEDITSLIDERCTRL_H_
25#define _GUITEXTEDITSLIDERCTRL_H_
26
27#ifndef _GUITYPES_H_
28#include "gui/core/guiTypes.h"
29#endif
30#ifndef _GUITEXTEDITCTRL_H_
31#include "gui/controls/guiTextEditCtrl.h"
32#endif
33
34class GuiTextEditSliderCtrl : public GuiTextEditCtrl
35{
36   typedef GuiTextEditCtrl Parent;
37
38public:
39
40   enum CtrlArea
41   {
42      None,
43      Slider,
44      ArrowUp,
45      ArrowDown
46   };
47
48   GuiTextEditSliderCtrl();
49   ~GuiTextEditSliderCtrl();
50
51   DECLARE_CONOBJECT(GuiTextEditSliderCtrl);
52   DECLARE_CATEGORY( "Gui Values" );
53   DECLARE_DESCRIPTION( "A text that shows a numeric value and up/down arrows to\n"
54      "increase/decrease the value." );
55
56   static void initPersistFields();
57
58   virtual void getText(char *dest);  // dest must be of size
59                                      // StructDes::MAX_STRING_LEN + 1
60
61   virtual void setText(const char *txt);
62
63   void setValue();
64   void checkRange();
65   void checkIncValue();
66   void timeInc(U32 elapseTime);
67
68   virtual bool onKeyDown(const GuiEvent &event);
69   virtual void onMouseDown(const GuiEvent &event);
70   virtual void onMouseDragged(const GuiEvent &event);
71   virtual void onMouseUp(const GuiEvent &event);
72   virtual bool onMouseWheelUp(const GuiEvent &event);
73   virtual bool onMouseWheelDown(const GuiEvent &event);
74
75   virtual void onPreRender();
76   virtual void onRender(Point2I offset, const RectI &updateRect);
77
78protected:
79
80   Point2F mRange;
81   F32 mIncAmount;
82   F32 mValue;
83   F32 mIncCounter;
84   F32 mMulInc;
85   StringTableEntry mFormat;
86   U32 mMouseDownTime;
87   bool mFocusOnMouseWheel;
88
89   CtrlArea mTextAreaHit;
90};
91
92#endif //_GUITEXTEDITSLIDERCTRL_H_
93