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

Public Types

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

Public Member Functions

 RadioButton ()
 Default constructor. More...
 
 RadioButton (const RadioButton &copy)
 Copy constructor. More...
 
virtual ~RadioButton ()
 Destructor. More...
 
RadioButtonoperator= (const RadioButton &right)
 Overload of assignment operator. More...
 
virtual bool load (const std::string &configFileFilename, const std::string &sectionName="RadioButton")
 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 widget. More...
 
virtual void setSize (float width, float height)
 Changes the size of the radio button. More...
 
virtual sf::Vector2f getSize () const
 Returns the size of the radio button. More...
 
virtual sf::Vector2f getFullSize () const
 Returns the full size of the radio button. More...
 
virtual void check ()
 Checks the radio button. More...
 
virtual void uncheck ()
 Unchecks the radio button. More...
 
bool isChecked () const
 Returns whether the radio button is checked or not. More...
 
void setText (const sf::String &text)
 Changes the text of the radio button. More...
 
sf::String getText () const
 Returns the text of the radio button. More...
 
void setTextFont (const sf::Font &font)
 Changes the font of the text. More...
 
const sf::Font * getTextFont () const
 Returns the font of the text. More...
 
void setTextColor (const sf::Color &color)
 Changes the color of the text. More...
 
const sf::Color & getTextColor () const
 Returns the color of the text. More...
 
void setTextSize (unsigned int size)
 Changes the character size of the text. More...
 
unsigned int getTextSize () const
 Returns the character size of the text. More...
 
void allowTextClick (bool acceptTextClick=true)
 Allow (or disallow) the radio button to be checked/unchecked by clicking on the text next to the radio button. 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...
 
- 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...
 
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 RadioButton.

Enumerator
Checked 

RadioButton was checked.

Unchecked 

RadioButton was unchecked.

SpaceKeyPressed 

Space key was pressed.

ReturnKeyPressed 

Return key was pressed.

AllRadioButtonCallbacks 

All trigger defined in RadioButton and its base classes.

Constructor & Destructor Documentation

tgui::RadioButton::RadioButton ( )

Default constructor.

tgui::RadioButton::RadioButton ( const RadioButton copy)

Copy constructor.

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

Destructor.

Member Function Documentation

void tgui::RadioButton::allowTextClick ( bool  acceptTextClick = true)

Allow (or disallow) the radio button to be checked/unchecked by clicking on the text next to the radio button.

Parameters
acceptTextClickWill clicking on the text trigger a checked/unchecked event?
virtual void tgui::RadioButton::check ( )
virtual

Checks the radio button.

It will tell its parent to uncheck all the other radio buttons.

Reimplemented in tgui::Checkbox.

virtual sf::Vector2f tgui::RadioButton::getFullSize ( ) const
virtual

Returns the full size of the radio button.

Returns
Full size of the radio button

The returned size includes the text next to the radio button.

Reimplemented from tgui::Transformable.

const std::string& tgui::RadioButton::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.
virtual sf::Vector2f tgui::RadioButton::getSize ( ) const
virtual

Returns the size of the radio button.

Returns
Size of the radio button

The returned size is just the size of the image, the text is not included in the size.

Reimplemented from tgui::ClickableWidget.

sf::String tgui::RadioButton::getText ( ) const

Returns the text of the radio button.

Returns
The text that is drawn next to the radio button.
const sf::Color& tgui::RadioButton::getTextColor ( ) const

Returns the color of the text.

Returns
The current text color
const sf::Font* tgui::RadioButton::getTextFont ( ) const

Returns the font of the text.

Returns
Pointer to the font that is currently being used.
unsigned int tgui::RadioButton::getTextSize ( ) const

Returns the character size of the text.

Returns
Character size of the text
bool tgui::RadioButton::isChecked ( ) const

Returns whether the radio button is checked or not.

Returns
Is the radio button checked?
virtual bool tgui::RadioButton::load ( const std::string &  configFileFilename,
const std::string &  sectionName = "RadioButton" 
)
virtual

Loads the widget.

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

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

Reimplemented in tgui::Checkbox.

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

Overload of assignment operator.

Parameters
rightInstance to assign
Returns
Reference to itself
virtual void tgui::RadioButton::setPosition ( float  x,
float  y 
)
virtual

Set the position of the widget.

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::RadioButton::setSize ( float  width,
float  height 
)
virtual

Changes the size of the radio button.

Parameters
widthThe new width of the radio button
heightThe new height of the radio button

Reimplemented from tgui::ClickableWidget.

void tgui::RadioButton::setText ( const sf::String &  text)

Changes the text of the radio button.

Parameters
textThe new text to draw next to the radio button.
void tgui::RadioButton::setTextColor ( const sf::Color &  color)

Changes the color of the text.

Parameters
colorNew text color
void tgui::RadioButton::setTextFont ( const sf::Font &  font)

Changes the font of the text.

When you don't call this function then the global font will be use. This global font can be changed with the setGlobalFont function from the parent.

Parameters
fontThe new font
void tgui::RadioButton::setTextSize ( unsigned int  size)

Changes the character size of the text.

Parameters
sizeThe new text size. When the size is set to 0 then the text is auto-sized.
virtual void tgui::RadioButton::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::RadioButton::uncheck ( )
virtual

Unchecks the radio button.

Reimplemented in tgui::Checkbox.


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