TGUI  v0.5.2
 All Classes Namespaces Functions Variables Enumerations Enumerator Pages
Public Member Functions | List of all members
tgui::AnimatedButton Struct Reference
Inheritance diagram for tgui::AnimatedButton:
tgui::OBJECT tgui::OBJECT_ANIMATION

Public Member Functions

 AnimatedButton ()
 Default constructor. More...
 
 AnimatedButton (const AnimatedButton &copy)
 Copy constructor. More...
 
virtual ~AnimatedButton ()
 Destructor. More...
 
AnimatedButtonoperator= (const AnimatedButton &right)
 Overload of assignment operator. More...
 
virtual bool load (const std::string &pathname)
 Loads the button images and optionally a matching text color. More...
 
virtual void setSize (float width, float height)
 Changes the size of the button. More...
 
virtual Vector2u getSize () const
 Returns the size of the button, unaffected by scaling. More...
 
virtual Vector2f getScaledSize () const
 Returns the size of the button, after the scaling transformation. More...
 
virtual std::string getLoadedPathname () const
 Returns the pathname that was used to load the button. More...
 
virtual void setText (const sf::String &text)
 Changes the caption of the button. More...
 
virtual sf::String getText () const
 Returns the caption of the button. More...
 
virtual void setTextFont (const sf::Font &font)
 Changes the font of the text. More...
 
virtual const sf::Font * getTextFont ()
 Returns the font of the text. More...
 
virtual void setTextColor (const sf::Color &color)
 Changes the color of the text. More...
 
virtual const sf::Color & getTextColor () const
 Returns the color of the text. More...
 
virtual void setTextSize (unsigned int size)
 Changes the character size of the text. More...
 
virtual unsigned int getTextSize () const
 Returns the character size of the text. More...
 
virtual void setFrame (unsigned int frame)
 Sets the animation at a specific frame. More...
 
- Public Member Functions inherited from tgui::OBJECT
 OBJECT ()
 Default constructor. More...
 
 OBJECT (const OBJECT &copy)
 Copy constructor. More...
 
virtual ~OBJECT ()
 Destructor. More...
 
OBJECToperator= (const OBJECT &right)
 Overload of assignment operator. More...
 
virtual void show ()
 Shows the object. More...
 
virtual void hide ()
 Hides the object. More...
 
virtual bool isVisible () const
 Returns true when the object is visible. More...
 
virtual void enable ()
 Enables the object. More...
 
virtual void disable ()
 Disables the object. More...
 
virtual bool isEnabled () const
 Returns true when the object is enabled. More...
 
virtual bool isDisabled () const
 Returns true when the object is disabled. More...
 
virtual bool isLoaded () const
 Returns true when the object is loaded successfully. More...
 
void focus ()
 Focus the object. More...
 
void unfocus ()
 Unfocus the object. More...
 
void focusNextObject ()
 Focuses the next object. More...
 
virtual bool isFocused () const
 Returns true when the object is focused and false otherwise. More...
 
virtual ObjectTypes getObjectType () const
 Returns the type of the object. More...
 
virtual void moveToFront ()
 Places the object before all other objects. More...
 
virtual void moveToBack ()
 Places the object behind all other objects. More...
 

Constructor & Destructor Documentation

tgui::AnimatedButton::AnimatedButton ( )

Default constructor.

tgui::AnimatedButton::AnimatedButton ( const AnimatedButton copy)

Copy constructor.

virtual tgui::AnimatedButton::~AnimatedButton ( )
virtual

Destructor.

Member Function Documentation

virtual std::string tgui::AnimatedButton::getLoadedPathname ( ) const
virtual

Returns the pathname that was used to load the button.

When the button has not been loaded yet then this function will return an empty string.

virtual Vector2f tgui::AnimatedButton::getScaledSize ( ) const
virtual

Returns the size of the button, after the scaling transformation.

Implements tgui::OBJECT.

virtual Vector2u tgui::AnimatedButton::getSize ( ) const
virtual

Returns the size of the button, unaffected by scaling.

Implements tgui::OBJECT.

virtual sf::String tgui::AnimatedButton::getText ( ) const
virtual

Returns the caption of the button.

virtual const sf::Color& tgui::AnimatedButton::getTextColor ( ) const
virtual

Returns the color of the text.

virtual const sf::Font* tgui::AnimatedButton::getTextFont ( )
virtual

Returns the font of the text.

virtual unsigned int tgui::AnimatedButton::getTextSize ( ) const
virtual

Returns the character size of the text.

virtual bool tgui::AnimatedButton::load ( const std::string &  pathname)
virtual

Loads the button images and optionally a matching text color.

All images should have the same size. In calculations, the size of the first normal image is always used.

Parameters
pathnameThe path to the folder that contains the images. The folder must also contain an info.txt file, which will give more information about the button.
Returns
  • true on success
  • false when the pathname is empty
  • false when the info.txt file was not found
  • false when no normal image was loaded
  • false when the images couldn't be loaded
AnimatedButton& tgui::AnimatedButton::operator= ( const AnimatedButton right)

Overload of assignment operator.

virtual void tgui::AnimatedButton::setFrame ( unsigned int  frame)
virtual

Sets the animation at a specific frame.

When there are less frames than frame, the last frame will be displayed. Both 0 and 1 will set the first frame.

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

Changes the size of the button.

This function will undo all scaling, as it just calculates the correct scale factors for you. The scaling factors will be based on the size of the first normal image.

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

Implements tgui::OBJECT.

virtual void tgui::AnimatedButton::setText ( const sf::String &  text)
virtual

Changes the caption of the button.

virtual void tgui::AnimatedButton::setTextColor ( const sf::Color &  color)
virtual

Changes the color of the text.

virtual void tgui::AnimatedButton::setTextFont ( const sf::Font &  font)
virtual

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 by changing gloabalFont from the parent.

virtual void tgui::AnimatedButton::setTextSize ( unsigned int  size)
virtual

Changes the character size of the text.

If the size is 0 (default) then the text will be scaled to fit inside the button.


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