Crazy Eddies GUI System  0.7.2
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
83 
84 
85  /*************************************************************************
86  Accessor Functions
87  *************************************************************************/
95  bool isHotTracked(void) const {return d_hotTrack;}
96 
105  bool isVertFree(void) const {return d_vertFree;}
106 
115  bool isHorzFree(void) const {return d_horzFree;}
116 
117 
126  std::pair<float, float> getVertRange(void) const;
127 
128 
137  std::pair<float, float> getHorzRange(void) const;
138 
139 
140  /*************************************************************************
141  Manipulator Functions
142  *************************************************************************/
153  void setHotTracked(bool setting) {d_hotTrack = setting;}
154 
155 
166  void setVertFree(bool setting) {d_vertFree = setting;}
167 
168 
179  void setHorzFree(bool setting) {d_horzFree = setting;}
180 
181 
198  void setVertRange(float min, float max);
199 
200 
217  void setHorzRange(float min, float max);
218 
219 
220  /*************************************************************************
221  Construction / Destruction
222  *************************************************************************/
227  Thumb(const String& type, const String& name);
228 
229 
234  virtual ~Thumb(void);
235 
236 
237 protected:
238  /*************************************************************************
239  Implementation Functions
240  *************************************************************************/
251  virtual bool testClassName_impl(const String& class_name) const
252  {
253  if (class_name=="Thumb") return true;
254  return PushButton::testClassName_impl(class_name);
255  }
256 
257 
258  /*************************************************************************
259  New Thumb Events
260  *************************************************************************/
265  virtual void onThumbPositionChanged(WindowEventArgs& e);
266 
267 
272  virtual void onThumbTrackStarted(WindowEventArgs& e);
273 
274 
279  virtual void onThumbTrackEnded(WindowEventArgs& e);
280 
281 
282 
283  /*************************************************************************
284  Overridden event handling routines
285  *************************************************************************/
286  virtual void onMouseMove(MouseEventArgs& e);
287  virtual void onMouseButtonDown(MouseEventArgs& e);
288  virtual void onCaptureLost(WindowEventArgs& e);
289 
290 
291  /*************************************************************************
292  Implementation Data
293  *************************************************************************/
294  // general settings
295  bool d_hotTrack;
296  bool d_vertFree;
297  bool d_horzFree;
298 
299  // operational limits
300  float d_vertMin, d_vertMax;
301  float d_horzMin, d_horzMax;
302 
303  // internal state
306 
307 
308 private:
309  /*************************************************************************
310  Static Properties for this class
311  *************************************************************************/
312  static ThumbProperties::HotTracked d_hotTrackedProperty;
313  static ThumbProperties::VertFree d_vertFreeProperty;
314  static ThumbProperties::HorzFree d_horzFreeProperty;
315  static ThumbProperties::VertRange d_vertRangeProperty;
316  static ThumbProperties::HorzRange d_horzRangeProperty;
317 
318 
319  /*************************************************************************
320  Private methods
321  *************************************************************************/
322  void addThumbProperties(void);
323 };
324 
325 } // End of CEGUI namespace section
326 
327 #if defined(_MSC_VER)
328 # pragma warning(pop)
329 #endif
330 
331 #endif // end of guard _CEGUIThumb_h_