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

Public Types

- Public Types inherited from tgui::Widget

Public Member Functions

 Knob ()
 Default constructor. More...
 
 Knob (const Knob &copy)
 Copy constructor. More...
 
virtual ~Knob ()
 Destructor. More...
 
Knoboperator= (const Knob &right)
 Overload of assignment operator. More...
 
bool load (const std::string &configFileFilename, const std::string &sectionName="Knob")
 Loads the widget. More...
 
const std::string & getLoadedConfigFile () const
 Returns the filename of the config file that was used to load the widget. More...
 
virtual void setPosition (float x, float y)
 Set the position of the knob. More...
 
virtual void setSize (float width, float height)
 Changes the size of the knob. More...
 
virtual sf::Vector2f getSize () const
 Returns the size of the widget. More...
 
void setStartRotation (float startRotation)
 Set the start rotation, which is the place where the value should be minimal. More...
 
void setEndRotation (float endRotation)
 Set the end rotation, which is the place where the value should be maximal. More...
 
virtual void setMinimum (int minimum)
 Sets the value for when the knob would be rotated in the direction of StartRotation. More...
 
virtual void setMaximum (int maximum)
 Sets the value for when the knob would be rotated in the direction of EndRotation. More...
 
virtual void setValue (int value)
 Changes the current value. More...
 
int getMinimum () const
 Returns the value when the knob would be rotated in the direction of StartRotation. More...
 
int getMaximum () const
 Returns the value when the knob would be rotated in the direction of EndRotation. More...
 
int getValue () const
 Returns the current value. More...
 
void setClockwiseTurning (bool clockwise)
 Should the value increase when turning the knob clockwise? More...
 
bool getClockwiseTurning ()
 Returns whether the value increases when turning the knob clockwise? More...
 
virtual void setTransparency (unsigned char transparency)
 Changes the transparency 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...
 
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 Knob.

Enumerator
ValueChanged 

Value changed (knob turned)

AllKnobCallbacks 

All triggers defined in Knob and its base classes.

Constructor & Destructor Documentation

tgui::Knob::Knob ( )

Default constructor.

tgui::Knob::Knob ( const Knob copy)

Copy constructor.

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

Destructor.

Member Function Documentation

bool tgui::Knob::getClockwiseTurning ( )

Returns whether the value increases when turning the knob clockwise?

Returns
Does the value increase when turning clockwise?
const std::string& tgui::Knob::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.
int tgui::Knob::getMaximum ( ) const

Returns the value when the knob would be rotated in the direction of EndRotation.

Returns
The current maximum value

The default maximum value is 360.

See also
getEndRotation
int tgui::Knob::getMinimum ( ) const

Returns the value when the knob would be rotated in the direction of StartRotation.

Returns
The current minimum value

The default minimum value is 0.

See also
getStartRotation
virtual sf::Vector2f tgui::Knob::getSize ( ) const
virtual

Returns the size of the widget.

Returns
Size of the widget

Implements tgui::Transformable.

int tgui::Knob::getValue ( ) const

Returns the current value.

Returns
The current value, determined by the Minimum, Maximum, StartRotation and EndRotation

The default value is 0.

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

Loads the widget.

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

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

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

Overload of assignment operator.

Parameters
rightInstance to assign
Returns
Reference to itself
void tgui::Knob::setClockwiseTurning ( bool  clockwise)

Should the value increase when turning the knob clockwise?

Parameters
clockwiseDoes the value increase when turning clockwise?
void tgui::Knob::setEndRotation ( float  endRotation)

Set the end rotation, which is the place where the value should be maximal.

Parameters
endRotationNew end rotation.

The rotation is a number in the interval [0,360[, for which 0 to to the right and the rotation goes counter-clockwise.

virtual void tgui::Knob::setMaximum ( int  maximum)
virtual

Sets the value for when the knob would be rotated in the direction of EndRotation.

Parameters
maximumThe new maximum value

The knob will be rotated to keep representing the value correctly.

When the value is too big then it will be changed to this maximum. When the minimum value is higher than the new maximum then it will be changed to this new maximum value. The default maximum value is 360.

See also
setEndRotation
virtual void tgui::Knob::setMinimum ( int  minimum)
virtual

Sets the value for when the knob would be rotated in the direction of StartRotation.

Parameters
minimumThe new minimum value

The knob will be rotated to keep representing the value correctly.

When the value is too small then it will be changed to this minimum. When the maximum value is lower than the new minimum then it will be changed to this new minimum value. The default minimum value is 0.

See also
setStartRotation
virtual void tgui::Knob::setPosition ( float  x,
float  y 
)
virtual

Set the position of the knob.

This function completely overwrites the previous position. See the move function to apply an offset based on the previous position instead. The default position of a transformable widget is (0, 0).

Parameters
xX coordinate of the new position
yY coordinate of the new position
See also
move, getPosition

Reimplemented from tgui::Transformable.

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

Changes the size of the knob.

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

Implements tgui::Transformable.

void tgui::Knob::setStartRotation ( float  startRotation)

Set the start rotation, which is the place where the value should be minimal.

Parameters
startRotationNew start rotation.

The rotation is a number in the interval [0,360[, for which 0 to to the right and the rotation goes counter-clockwise.

virtual void tgui::Knob::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.

virtual void tgui::Knob::setValue ( int  value)
virtual

Changes the current value.

Parameters
valueThe new value

The knob will be rotated to correctly represent this new value.

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


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