Abstract class for all component that are button-like
.
More...
#include <AbstractButton.hpp>
|
sf::Texture const * | m_textureFocused |
|
bool | m_focused |
|
sf::Sprite | m_sprite |
|
sf::Texture const * | m_texture |
|
std::set
< sf::ui::ComponentObserver * > | m_observers |
|
Abstract class for all component that are button-like
.
Definition at line 28 of file AbstractButton.hpp.
sf::ui::AbstractButton::AbstractButton |
( |
| ) |
|
Creates an empty abstract button that is implemented by buttons, check box ...
sf::ui::AbstractButton::AbstractButton |
( |
sf::Texture const & |
texture, |
|
|
sf::Texture const & |
textureFocused |
|
) |
| |
Creates an abstract button that is implemented by buttons, check box ...
- Parameters
-
texture | the basic texture of this abstract button |
textureFocused | the texture when the abstract button is focused |
virtual bool sf::ui::Focusable::checkClickOn |
( |
int |
x, |
|
|
int |
y |
|
) |
| const |
|
protectedvirtualinherited |
- Returns
- whether the click should focus the component or not
- Parameters
-
button | - the mouse's button |
x | - the x coord |
y | - the y coord |
int sf::ui::ComponentObservable::countObservers |
( |
| ) |
|
|
inherited |
- Returns
- the number of observers
virtual void sf::ui::Component::draw |
( |
sf::RenderTarget & |
target, |
|
|
sf::RenderStates |
states |
|
) |
| const |
|
protectedvirtualinherited |
virtual void sf::ui::Focusable::gainFocus |
( |
| ) |
|
|
protectedvirtualinherited |
Called when the component gain focus.
- Returns
- the begin of the observers' iterator
- Returns
- the end of the observers' iterator
const sf::Vector2f& sf::ui::Component::getPosition |
( |
| ) |
const |
|
inherited |
- Returns
- the position of the component
virtual sf::Vector2f sf::ui::Component::getSize |
( |
| ) |
const |
|
virtualinherited |
const sf::Texture* sf::ui::Component::getTexture |
( |
| ) |
const |
|
inherited |
- Returns
- the texture of the component
const sf::Texture* sf::ui::Focusable::getTextureFocused |
( |
| ) |
const |
|
inherited |
- Returns
- the texture when the component is focused
virtual bool sf::ui::Focusable::isCoordOnComponent |
( |
int |
x, |
|
|
int |
y |
|
) |
| const |
|
protectedvirtualinherited |
- Returns
- whether the given coordinate is on the component or out
- Parameters
-
x | - the x coord |
y | - the y coord |
bool sf::ui::Focusable::isFocused |
( |
| ) |
const |
|
inherited |
- Returns
- whether the component is focused or not
virtual void sf::ui::Focusable::lostFocus |
( |
| ) |
|
|
protectedvirtualinherited |
void sf::ui::Component::move |
( |
sf::Vector2f const & |
vector | ) |
|
|
inherited |
Move the component.
- Parameters
-
void sf::ui::Component::move |
( |
float |
x, |
|
|
float |
y |
|
) |
| |
|
inherited |
Move the component.
- Parameters
-
x | the x movement |
y | the y movement |
virtual void sf::ui::AbstractButton::onClick |
( |
| ) |
|
|
protectedpure virtual |
void sf::ui::ComponentObservable::removeAllObservers |
( |
| ) |
|
|
inherited |
Remove all the observers.
Remove the observer at the given index.
- Parameters
-
observer | the observer to remove |
void sf::ui::Focusable::setFocused |
( |
bool |
focused | ) |
|
|
inherited |
Set if the component is focused.
- Parameters
-
void sf::ui::Component::setPosition |
( |
sf::Vector2f const & |
position | ) |
|
|
inherited |
Set the component's position.
- Parameters
-
position | - the position vector |
void sf::ui::Component::setPosition |
( |
float |
x, |
|
|
float |
y |
|
) |
| |
|
inherited |
Set the component's position.
- Parameters
-
x | - the x coordinate |
y | - the y coordinate |
void sf::ui::Component::setTexture |
( |
const sf::Texture & |
texture | ) |
|
|
inherited |
Set the texture of the component.
void sf::ui::Focusable::setTextureFocused |
( |
const sf::Texture & |
textureFocused | ) |
|
|
inherited |
Set the texture that is displayed when the component is displayed.
- Parameters
-
textureFocused | - the texture when the component is focused |
Triggers the event and notify all observers.
- Parameters
-
virtual void sf::ui::Component::updateCoord |
( |
| ) |
|
|
protectedvirtualinherited |
virtual void sf::ui::AbstractButton::updateEvent |
( |
sf::Event const & |
event | ) |
|
|
virtual |
Update the component each time an event has been polled.
- Parameters
-
event | the window's event polled |
Implements sf::ui::Component.
Reimplemented in sf::ui::Button.
virtual void sf::ui::Component::updateFixed |
( |
sf::Time |
delta | ) |
|
|
pure virtualinherited |
void sf::ui::Component::updateSize |
( |
| ) |
|
|
inherited |
Update the size of the component Call it when you update your texture after it was set, to recalculate the component's size with new texture loaded.
Example:
sf::Texture texture;
sf::Label label(texture);
texture.loadFromFile("texture.png");
label.updateSize();
The documentation for this class was generated from the following file: