Crazy Eddies GUI System  0.7.1
CEGUIThumb.h
1 /***********************************************************************
2  filename: CEGUIThumb.h
3  created: 25/4/2004
4  author: Paul D Turner
5 
6  purpose: Interface for a 'Thumb' widget. Intended to be used as
7  part of other widgets such as scrollers and sliders.
8 *************************************************************************/
9 /***************************************************************************
10  * Copyright (C) 2004 - 2006 Paul D Turner & The CEGUI Development Team
11  *
12  * Permission is hereby granted, free of charge, to any person obtaining
13  * a copy of this software and associated documentation files (the
14  * "Software"), to deal in the Software without restriction, including
15  * without limitation the rights to use, copy, modify, merge, publish,
16  * distribute, sublicense, and/or sell copies of the Software, and to
17  * permit persons to whom the Software is furnished to do so, subject to
18  * the following conditions:
19  *
20  * The above copyright notice and this permission notice shall be
21  * included in all copies or substantial portions of the Software.
22  *
23  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
24  * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
25  * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
26  * IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR
27  * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
28  * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
29  * OTHER DEALINGS IN THE SOFTWARE.
30  ***************************************************************************/
31 #ifndef _CEGUIThumb_h_
32 #define _CEGUIThumb_h_
33 
34 #include "CEGUIPushButton.h"
35 #include "CEGUIThumbProperties.h"
36 #include <utility>
37 
38 
39 #if defined(_MSC_VER)
40 # pragma warning(push)
41 # pragma warning(disable : 4251)
42 #endif
43 
44 
45 // Start of CEGUI namespace section
46 namespace CEGUI
47 {
48 
56 class CEGUIEXPORT Thumb : public PushButton
57 {
58 public:
59  static const String EventNamespace;
60  static const String WidgetTypeName;
61 
62  /*************************************************************************
63  Event name constants
64  *************************************************************************/
65  // generated internally by Window
69 
70 
71  /*************************************************************************
72  Accessor Functions
73  *************************************************************************/
81  bool isHotTracked(void) const {return d_hotTrack;}
82 
91  bool isVertFree(void) const {return d_vertFree;}
92 
101  bool isHorzFree(void) const {return d_horzFree;}
102 
103 
112  std::pair<float, float> getVertRange(void) const;
113 
114 
123  std::pair<float, float> getHorzRange(void) const;
124 
125 
126  /*************************************************************************
127  Manipulator Functions
128  *************************************************************************/
139  void setHotTracked(bool setting) {d_hotTrack = setting;}
140 
141 
152  void setVertFree(bool setting) {d_vertFree = setting;}
153 
154 
165  void setHorzFree(bool setting) {d_horzFree = setting;}
166 
167 
184  void setVertRange(float min, float max);
185 
186 
203  void setHorzRange(float min, float max);
204 
205 
206  /*************************************************************************
207  Construction / Destruction
208  *************************************************************************/
213  Thumb(const String& type, const String& name);
214 
215 
220  virtual ~Thumb(void);
221 
222 
223 protected:
224  /*************************************************************************
225  Implementation Functions
226  *************************************************************************/
237  virtual bool testClassName_impl(const String& class_name) const
238  {
239  if (class_name=="Thumb") return true;
240  return PushButton::testClassName_impl(class_name);
241  }
242 
243 
244  /*************************************************************************
245  New Thumb Events
246  *************************************************************************/
251  virtual void onThumbPositionChanged(WindowEventArgs& e);
252 
253 
258  virtual void onThumbTrackStarted(WindowEventArgs& e);
259 
260 
265  virtual void onThumbTrackEnded(WindowEventArgs& e);
266 
267 
268 
269  /*************************************************************************
270  Overridden event handling routines
271  *************************************************************************/
272  virtual void onMouseMove(MouseEventArgs& e);
273  virtual void onMouseButtonDown(MouseEventArgs& e);
274  virtual void onCaptureLost(WindowEventArgs& e);
275 
276 
277  /*************************************************************************
278  Implementation Data
279  *************************************************************************/
280  // general settings
281  bool d_hotTrack;
282  bool d_vertFree;
283  bool d_horzFree;
284 
285  // operational limits
286  float d_vertMin, d_vertMax;
287  float d_horzMin, d_horzMax;
288 
289  // internal state
292 
293 
294 private:
295  /*************************************************************************
296  Static Properties for this class
297  *************************************************************************/
298  static ThumbProperties::HotTracked d_hotTrackedProperty;
299  static ThumbProperties::VertFree d_vertFreeProperty;
300  static ThumbProperties::HorzFree d_horzFreeProperty;
301  static ThumbProperties::VertRange d_vertRangeProperty;
302  static ThumbProperties::HorzRange d_horzRangeProperty;
303 
304 
305  /*************************************************************************
306  Private methods
307  *************************************************************************/
308  void addThumbProperties(void);
309 };
310 
311 } // End of CEGUI namespace section
312 
313 #if defined(_MSC_VER)
314 # pragma warning(pop)
315 #endif
316 
317 #endif // end of guard _CEGUIThumb_h_