TGUI  v0.6.10
Public Types | Public Member Functions | List of all members
tgui::Slider2d Class Reference
Inheritance diagram for tgui::Slider2d:
tgui::ClickableWidget tgui::Widget tgui::Transformable tgui::CallbackManager

Public Types

- Public Types inherited from tgui::ClickableWidget
- Public Types inherited from tgui::Widget

Public Member Functions

 Slider2d ()
 Default constructor. More...
 
 Slider2d (const Slider2d &copy)
 Copy constructor. More...
 
virtual ~Slider2d ()
 Destructor. More...
 
Slider2doperator= (const Slider2d &right)
 Overload of assignment operator. More...
 
bool load (const std::string &configFileFilename, const std::string &sectionName="Slider2d")
 Loads the widget. More...
 
const std::string & getLoadedConfigFile () const
 Returns the filename of the config file that was used to load the widget. More...
 
void setSize (float width, float height)
 Changes the size of the slider. More...
 
void setMinimum (const sf::Vector2f &minimum)
 Sets a minimum value. More...
 
void setMaximum (const sf::Vector2f &maximum)
 Sets a maximum value. More...
 
void setValue (const sf::Vector2f &value)
 Changes the current value. More...
 
sf::Vector2f getMinimum () const
 Returns the minimum value. More...
 
sf::Vector2f getMaximum () const
 Returns the maximum value. More...
 
sf::Vector2f getValue () const
 Returns the current value. More...
 
void setFixedThumbSize (bool fixedSize)
 Change whether the thumb size changes when you change the size of the slider. More...
 
bool getFixedThumbSize () const
 Returns whether the thumb size changes when you change the size of the slider. More...
 
void enableThumbCenter (bool autoCenterThumb)
 Decide whether or not the thumb will jump back to the center when the mouse is released. More...
 
void centerThumb ()
 Places the thumb back in the center. More...
 
virtual void setTransparency (unsigned char transparency)
 Changes the transparency of the widget. More...
 
- Public Member Functions inherited from tgui::ClickableWidget
 ClickableWidget ()
 Default constructor. More...
 
 ClickableWidget (const ClickableWidget &copy)
 Copy constructor. More...
 
virtual ~ClickableWidget ()
 Destructor. More...
 
ClickableWidgetoperator= (const ClickableWidget &right)
 Overload of assignment operator. More...
 
virtual sf::Vector2f getSize () const
 Returns the size of the widget. More...
 
- Public Member Functions inherited from tgui::Widget
 Widget ()
 Default constructor. More...
 
 Widget (const Widget &copy)
 Copy constructor. More...
 
virtual ~Widget ()
 Destructor. More...
 
Widgetoperator= (const Widget &right)
 Overload of assignment operator. More...
 
virtual sf::Vector2f getAbsolutePosition () const
 Get the absolute position of the widget on the screen. More...
 
virtual void show ()
 Shows the widget. More...
 
virtual void hide ()
 Hides the widget. More...
 
bool isVisible () const
 Returns true when the widget is visible. More...
 
virtual void enable ()
 Enables the widget. More...
 
virtual void disable ()
 Disables the widget. More...
 
bool isEnabled () const
 Returns true when the widget is enabled. More...
 
bool isDisabled () const
 Returns true when the widget is disabled. More...
 
bool isLoaded () const
 Returns true when the widget is loaded successfully. More...
 
virtual void focus ()
 Focus the widget. More...
 
virtual void unfocus ()
 Unfocus the widget. More...
 
bool isFocused () const
 Returns true when the widget is focused and false otherwise. More...
 
WidgetTypes getWidgetType () const
 Returns the type of the widget. More...
 
ContainergetParent () const
 Returns a pointer to the parent widget. More...
 
unsigned char getTransparency () const
 Returns the transparency of the widget. More...
 
virtual void moveToFront ()
 Places the widget before all other widgets. More...
 
virtual void moveToBack ()
 Places the widget behind all other widgets. More...
 
void setCallbackId (unsigned int callbackId)
 Changes the callback id of the widget. More...
 
unsigned int getCallbackId ()
 Returns the callback id of the widget. More...
 
- Public Member Functions inherited from tgui::Transformable
 Transformable ()
 Default constructor. More...
 
virtual ~Transformable ()
 Destructor. More...
 
virtual void setPosition (float x, float y)
 Set the position of the widget. More...
 
void setPosition (const sf::Vector2f &position)
 set the position of the widget More...
 
const sf::Vector2f & getPosition () const
 get the position of the widget More...
 
void move (float offsetX, float offsetY)
 Move the widget by a given offset. More...
 
void move (const sf::Vector2f &offset)
 Move the widget by a given offset. More...
 
virtual sf::Vector2f getFullSize () const
 Returns the entire size that the widget is using. More...
 
void scale (float factorX, float factorY)
 Scale the widget. More...
 
void scale (const sf::Vector2f &factors)
 Scale the widget. More...
 
- Public Member Functions inherited from tgui::CallbackManager
void bindCallback (std::function< void()> func, unsigned int trigger)
 Bind a function to one or more specific callback trigger(s). More...
 
template<typename T >
void bindCallback (void(T::*func)(), T *const classPtr, unsigned int trigger)
 Bind a function to one or more specific callback trigger(s). More...
 
void bindCallbackEx (std::function< void(const Callback &)> func, unsigned int trigger)
 Bind a function to one or more specific callback trigger(s). More...
 
template<typename T >
void bindCallbackEx (void(T::*func)(const Callback &), T *const classPtr, unsigned int trigger)
 Bind a function to one or more specific callback trigger(s). More...
 
void bindCallback (unsigned int trigger)
 Bind one or more specific callback trigger(s) to the parent widget. More...
 
void unbindCallback (unsigned int trigger)
 Unbind all callback function bound to the given trigger. More...
 
void unbindAllCallback ()
 Unbind all callback functions bound to any callback. More...
 

Member Enumeration Documentation

Defines specific triggers to Slider2d.

Enumerator
ValueChanged 

Value changed (slider moved)

ThumbReturnedToCenter 

Thumb returned to center.

AllSlider2dCallbacks 

All triggers defined in Slider2d and its base classes.

Constructor & Destructor Documentation

tgui::Slider2d::Slider2d ( )

Default constructor.

tgui::Slider2d::Slider2d ( const Slider2d copy)

Copy constructor.

Parameters
copyInstance to copy
virtual tgui::Slider2d::~Slider2d ( )
virtual

Destructor.

Member Function Documentation

void tgui::Slider2d::centerThumb ( )

Places the thumb back in the center.

When enableThumbCenter(true) was called then this will happen automatically when the mouse is released.

void tgui::Slider2d::enableThumbCenter ( bool  autoCenterThumb)

Decide whether or not the thumb will jump back to the center when the mouse is released.

Parameters
autoCenterThumbPlace the thumb in the center on mouse release?

This behavior is disabled by default.

bool tgui::Slider2d::getFixedThumbSize ( ) const

Returns whether the thumb size changes when you change the size of the slider.

Returns
whether the thumb size changes when you change the size of the slider
See also
setFixedThumbSize
const std::string& tgui::Slider2d::getLoadedConfigFile ( ) const

Returns the filename of the config file that was used to load the widget.

Returns
Filename of loaded config file. Empty string when no config file was loaded yet.
sf::Vector2f tgui::Slider2d::getMaximum ( ) const

Returns the maximum value.

Returns
The current maximum value

The default maximum value (1, 1).

sf::Vector2f tgui::Slider2d::getMinimum ( ) const

Returns the minimum value.

Returns
The current minimum value

The default minimum value (-1, -1).

sf::Vector2f tgui::Slider2d::getValue ( ) const

Returns the current value.

Returns
The current value

The default value is (0, 0).

bool tgui::Slider2d::load ( const std::string &  configFileFilename,
const std::string &  sectionName = "Slider2d" 
)

Loads the widget.

Parameters
configFileFilenameFilename of the config file.
sectionNameName of the section in the file to load

The config file must contain a Slider2d section with the needed information.

Slider2d& tgui::Slider2d::operator= ( const Slider2d right)

Overload of assignment operator.

Parameters
rightInstance to assign
Returns
Reference to itself
void tgui::Slider2d::setFixedThumbSize ( bool  fixedSize)

Change whether the thumb size changes when you change the size of the slider.

Parameters
fixedSizeIf true then the size of the thumb doesn't change when calling setSize

When fixedSize is set to false then the thumb will change size together with the slider. So if the slider is two times bigger than the loaded image, the thumb will also be two times bigger as its image. When fixedSize is set to true then the size of the thumb will always stay the same as the loaded image.

void tgui::Slider2d::setMaximum ( const sf::Vector2f &  maximum)

Sets a maximum value.

Parameters
maximumThe new maximum value

When the value is too big then it will be changed to this maximum. The default maximum value is (1, 1).

void tgui::Slider2d::setMinimum ( const sf::Vector2f &  minimum)

Sets a minimum value.

Parameters
minimumThe new minimum value

When the value is too small then it will be changed to this minimum. The default minimum value is (-1, -1).

void tgui::Slider2d::setSize ( float  width,
float  height 
)
virtual

Changes the size of the slider.

Parameters
widthThe new width of the slider
heightThe new height of the slider

Reimplemented from tgui::ClickableWidget.

virtual void tgui::Slider2d::setTransparency ( unsigned char  transparency)
virtual

Changes the transparency of the widget.

Parameters
transparencyThe transparency of the widget. 0 is completely transparent, while 255 (default) means fully opaque.

Note that this will only change the transparency of the images. The parts of the widgets that use a color will not be changed. You must change them yourself by setting the alpha channel of the color.

Reimplemented from tgui::Widget.

void tgui::Slider2d::setValue ( const sf::Vector2f &  value)

Changes the current value.

Parameters
valueThe new value

The value can't be smaller than the minimum or bigger than the maximum.


The documentation for this class was generated from the following file: