/usr/include/CEGUI/elements/CEGUISlider.h is in libcegui-mk2-dev 0.7.5-8.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 | /***********************************************************************
filename: CEGUISlider.h
created: 13/4/2004
author: Paul D Turner
purpose: Interface to base class for Slider widget
*************************************************************************/
/***************************************************************************
* Copyright (C) 2004 - 2006 Paul D Turner & The CEGUI Development Team
*
* Permission is hereby granted, free of charge, to any person obtaining
* a copy of this software and associated documentation files (the
* "Software"), to deal in the Software without restriction, including
* without limitation the rights to use, copy, modify, merge, publish,
* distribute, sublicense, and/or sell copies of the Software, and to
* permit persons to whom the Software is furnished to do so, subject to
* the following conditions:
*
* The above copyright notice and this permission notice shall be
* included in all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
* IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR
* OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
* ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
* OTHER DEALINGS IN THE SOFTWARE.
***************************************************************************/
#ifndef _CEGUISlider_h_
#define _CEGUISlider_h_
#include "../CEGUIBase.h"
#include "../CEGUIWindow.h"
#include "CEGUISliderProperties.h"
#if defined(_MSC_VER)
# pragma warning(push)
# pragma warning(disable : 4251)
#endif
// Start of CEGUI namespace section
namespace CEGUI
{
/*!
\brief
Base class for ItemEntry window renderer objects.
*/
class CEGUIEXPORT SliderWindowRenderer : public WindowRenderer
{
public:
/*!
\brief
Constructor
*/
SliderWindowRenderer(const String& name);
/*!
\brief
update the size and location of the thumb to properly represent the current state of the slider
*/
virtual void updateThumb(void) = 0;
/*!
\brief
return value that best represents current slider value given the current location of the thumb.
\return
float value that, given the thumb widget position, best represents the current value for the slider.
*/
virtual float getValueFromThumb(void) const = 0;
/*!
\brief
Given window location \a pt, return a value indicating what change should be
made to the slider.
\param pt
Point object describing a pixel position in window space.
\return
- -1 to indicate slider should be moved to a lower setting.
- 0 to indicate slider should not be moved.
- +1 to indicate slider should be moved to a higher setting.
*/
virtual float getAdjustDirectionFromPoint(const Point& pt) const = 0;
};
/*!
\brief
Base class for Slider widgets.
The slider widget has a default range of 0.0f - 1.0f. This enables use of the slider value to scale
any value needed by way of a simple multiplication.
*/
class CEGUIEXPORT Slider : public Window
{
public:
static const String EventNamespace; //!< Namespace for global events
static const String WidgetTypeName; //!< Window factory name
/*************************************************************************
Event name constants
*************************************************************************/
/** Event fired when the slider value changes.
* Handlers are passed a const WindowEventArgs reference with
* WindowEventArgs::window set to the Slider whose value has changed.
*/
static const String EventValueChanged;
/** Event fired when the user begins dragging the thumb.
* Handlers are passed a const WindowEventArgs reference with
* WindowEventArgs::window set to the Slider whose thumb has started to
* be dragged.
*/
static const String EventThumbTrackStarted;
/** Event fired when the user releases the thumb.
* Handlers are passed a const WindowEventArgs reference with
* WindowEventArgs::window set to the Slider whose thumb has been released.
*/
static const String EventThumbTrackEnded;
/*************************************************************************
Child Widget name suffix constants
*************************************************************************/
static const String ThumbNameSuffix; //!< Widget name suffix for the thumb component.
/*************************************************************************
Accessors
*************************************************************************/
/*!
\brief
return the current slider value.
\return
float value equal to the sliders current value.
*/
float getCurrentValue(void) const {return d_value;}
/*!
\brief
return the maximum value set for this widget
\return
float value equal to the currently set maximum value for this slider.
*/
float getMaxValue(void) const {return d_maxValue;}
/*!
\brief
return the current click step setting for the slider.
The click step size is the amount the slider value will be adjusted when the widget
is clicked wither side of the slider thumb.
\return
float value representing the current click step setting.
*/
float getClickStep(void) const {return d_step;}
/*!
\brief
Return a pointer to the Thumb component widget for this Slider.
\return
Pointer to a Thumb object.
\exception UnknownObjectException
Thrown if the Thumb component does not exist.
*/
Thumb* getThumb() const;
/*************************************************************************
Manipulators
*************************************************************************/
/*!
\brief
Initialises the Window based object ready for use.
\note
This must be called for every window created. Normally this is handled automatically by the WindowFactory for each Window type.
\return
Nothing
*/
virtual void initialiseComponents(void);
/*!
\brief
set the maximum value for the slider. Note that the minimum value is fixed at 0.
\param maxVal
float value specifying the maximum value for this slider widget.
\return
Nothing.
*/
void setMaxValue(float maxVal);
/*!
\brief
set the current slider value.
\param value
float value specifying the new value for this slider widget.
\return
Nothing.
*/
void setCurrentValue(float value);
/*!
\brief
set the current click step setting for the slider.
The click step size is the amount the slider value will be adjusted when the widget
is clicked wither side of the slider thumb.
\param step
float value representing the click step setting to use.
\return
Nothing.
*/
void setClickStep(float step) {d_step = step;}
/*************************************************************************
Construction / Destruction
*************************************************************************/
/*!
\brief
Slider base class constructor
*/
Slider(const String& type, const String& name);
/*!
\brief
Slider base class destructor
*/
virtual ~Slider(void);
protected:
/*************************************************************************
Implementation Functions
*************************************************************************/
/*!
\brief
update the size and location of the thumb to properly represent the current state of the slider
*/
virtual void updateThumb(void);
/*!
\brief
return value that best represents current slider value given the current location of the thumb.
\return
float value that, given the thumb widget position, best represents the current value for the slider.
*/
virtual float getValueFromThumb(void) const;
/*!
\brief
Given window location \a pt, return a value indicating what change should be
made to the slider.
\param pt
Point object describing a pixel position in window space.
\return
- -1 to indicate slider should be moved to a lower setting.
- 0 to indicate slider should not be moved.
- +1 to indicate slider should be moved to a higher setting.
*/
virtual float getAdjustDirectionFromPoint(const Point& pt) const;
/*!
\brief
update the size and location of the thumb to properly represent the current state of the slider
*/
//virtual void updateThumb_impl(void) = 0;
/*!
\brief
return value that best represents current slider value given the current location of the thumb.
\return
float value that, given the thumb widget position, best represents the current value for the slider.
*/
//virtual float getValueFromThumb_impl(void) const = 0;
/*!
\brief
Given window location \a pt, return a value indicating what change should be
made to the slider.
\param pt
Point object describing a pixel position in window space.
\return
- -1 to indicate slider should be moved to a lower setting.
- 0 to indicate slider should not be moved.
- +1 to indicate slider should be moved to a higher setting.
*/
//virtual float getAdjustDirectionFromPoint_impl(const Point& pt) const = 0;
/*!
\brief
handler function for when thumb moves.
*/
bool handleThumbMoved(const EventArgs& e);
/*!
\brief
handler function for when thumb tracking begins
*/
bool handleThumbTrackStarted(const EventArgs& e);
/*!
\brief
handler function for when thumb tracking begins
*/
bool handleThumbTrackEnded(const EventArgs& e);
/*!
\brief
Return whether this window was inherited from the given class name at some point in the inheritance hierarchy.
\param class_name
The class name that is to be checked.
\return
true if this window was inherited from \a class_name. false if not.
*/
virtual bool testClassName_impl(const String& class_name) const
{
if (class_name=="Slider") return true;
return Window::testClassName_impl(class_name);
}
// validate window renderer
virtual bool validateWindowRenderer(const String& name) const
{
return (name == "Slider");
}
/*************************************************************************
New event handlers for slider widget
*************************************************************************/
/*!
\brief
Handler triggered when the slider value changes
*/
virtual void onValueChanged(WindowEventArgs& e);
/*!
\brief
Handler triggered when the user begins to drag the slider thumb.
*/
virtual void onThumbTrackStarted(WindowEventArgs& e);
/*!
\brief
Handler triggered when the slider thumb is released
*/
virtual void onThumbTrackEnded(WindowEventArgs& e);
/*************************************************************************
Overridden event handlers
*************************************************************************/
virtual void onMouseButtonDown(MouseEventArgs& e);
virtual void onMouseWheel(MouseEventArgs& e);
/*************************************************************************
Implementation Data
*************************************************************************/
float d_value; //!< current slider value
float d_maxValue; //!< slider maximum value (minimum is fixed at 0)
float d_step; //!< amount to adjust slider by when clicked (and not dragged).
private:
/*************************************************************************
Static Properties for this class
*************************************************************************/
static SliderProperties::CurrentValue d_currentValueProperty;
static SliderProperties::MaximumValue d_maximumValueProperty;
static SliderProperties::ClickStepSize d_clickStepSizeProperty;
/*************************************************************************
Private methods
*************************************************************************/
void addSliderProperties(void);
};
} // End of CEGUI namespace section
#if defined(_MSC_VER)
# pragma warning(pop)
#endif
#endif // end of guard _CEGUISlider_h_
|