A formatted text field which stores a value defined by a sf::ui::Format It can be a sf::Int64, a double, or even a class ... More...
#include <FormattedTextField.hpp>
Public Member Functions | |
| FormattedTextField (Format *format=0) | |
| Creates an empty text field without texture, font ... More... | |
| FormattedTextField (sf::Texture const &texture, sf::Texture const &textureFocused, Format *format=0, sf::String const &text="") | |
| Creates a text field without font Then do not forget to set the font before displaying it. More... | |
| FormattedTextField (sf::Texture const &texture, sf::Texture const &textureFocused, sf::Font const &font, Format *format=0, sf::String text="") | |
| Creates a text field. More... | |
| const Format * | getFormat () const |
| Format * | getFormat () |
| void | setFormat (Format *format) |
| Sets the new format of this field, and delete the old one. More... | |
| virtual void | updateEvent (sf::Event const &event) |
| Update the component each time an event has been polled. More... | |
| virtual void | updateFixed (sf::Time delta) |
| Update the component with the main loop's frequency Can be useful for animation, or time's needed stuff. More... | |
| const TextFieldModel * | getModel () const |
| void | setModel (TextFieldModel *model) |
| Sets the model of the text field. More... | |
| virtual const sf::String & | getText () const |
| virtual void | setText (sf::String const &text) |
| Sets the text's string of the component Don't forget to set the font. More... | |
| virtual const sf::Font * | getFont () const |
| virtual void | setFont (sf::Font const &font) |
| Sets the font of the component's text. More... | |
| virtual unsigned int | getFontSize () const |
| virtual void | setFontSize (unsigned int size) |
| Set the font's size of the component. More... | |
| virtual sf::Color | getFontColor () const |
| virtual void | setFontColor (sf::Color color) |
| Sets the color's font of the text. More... | |
| unsigned int | getCursor () const |
| void | setCursor (unsigned int cursor) |
| Sets the cursor's position. More... | |
| int | getMaxLength () const |
| void | setMaxLength (int maxLength) |
| Sets the max length that the string can have -1 means the string has no length limit. More... | |
| bool | canBeEmpty () const |
| void | setCanBeEmpty (bool canBeEmpty) |
| Sets if the string can be empty. More... | |
| bool | isFocused () const |
| void | setFocused (bool focused) |
| Set if the component is focused. More... | |
| const sf::Texture * | getTextureFocused () const |
| void | setTextureFocused (const sf::Texture &textureFocused) |
| Set the texture that is displayed when the component is displayed. More... | |
| void | updateSize () |
| 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. More... | |
| void | move (sf::Vector2f const &vector) |
| Move the component. More... | |
| void | move (float x, float y) |
| Move the component. More... | |
| const sf::Texture * | getTexture () const |
| void | setTexture (const sf::Texture &texture) |
| Set the texture of the component. More... | |
| const sf::Vector2f & | getPosition () const |
| void | setPosition (sf::Vector2f const &position) |
| Set the component's position. More... | |
| void | setPosition (float x, float y) |
| Set the component's position. More... | |
| virtual sf::Vector2f | getSize () const |
| void | addObserver (sf::ui::ComponentObserver *observer) |
| Add an observer. More... | |
| std::set < sf::ui::ComponentObserver * > ::const_iterator | getObserversBegin () const |
| std::set < sf::ui::ComponentObserver * > ::const_iterator | getObserversEnd () const |
| int | countObservers () |
| void | removeObserver (sf::ui::ComponentObserver *observer) |
| Remove the observer at the given index. More... | |
| void | removeAllObservers () |
| Remove all the observers. More... | |
Protected Member Functions | |
| virtual void | lostFocus () |
| Called when the component lost focus. More... | |
| virtual void | updateValue () |
| Update the value with the field's text. More... | |
| virtual void | draw (sf::RenderTarget &target, sf::RenderStates states) const |
| Draw the component to the render target. More... | |
| virtual void | updateCoord () |
| Called when the component need update its geometry Inherit when you need to update some sprite. More... | |
| virtual bool | insertText (sf::Uint32 text, unsigned int index) |
| Insert a char at the given index Trigger a TextEnteredEvent. More... | |
| virtual bool | deleteText (unsigned int index) |
| Delete the char at the given index Trigger a TextDeletedEvent. More... | |
| virtual bool | checkClickOn (int x, int y) const |
| virtual bool | isCoordOnComponent (int x, int y) const |
| virtual void | gainFocus () |
| Called when the component gain focus. More... | |
| void | triggerEvent (const sf::ui::ComponentEvent &event) |
| Triggers the event and notify all observers. More... | |
Protected Attributes | |
| Format * | m_format |
| sf::Text | m_text |
| TextFieldModel * | m_model |
| unsigned int | m_cursor |
| sf::RectangleShape | m_cursorShape |
| int | m_maxLength |
| bool | m_canBeEmpty |
| sf::Texture const * | m_textureFocused |
| bool | m_focused |
| sf::Sprite | m_sprite |
| sf::Texture const * | m_texture |
|
std::set < sf::ui::ComponentObserver * > | m_observers |
A formatted text field which stores a value defined by a sf::ui::Format It can be a sf::Int64, a double, or even a class ...
Definition at line 29 of file FormattedTextField.hpp.
| sf::ui::FormattedTextField::FormattedTextField | ( | Format * | format = 0 | ) |
Creates an empty text field without texture, font ...
Then do not forget to set its before displaying it
| format | the format of this formatted text field |
| sf::ui::FormattedTextField::FormattedTextField | ( | sf::Texture const & | texture, |
| sf::Texture const & | textureFocused, | ||
| Format * | format = 0, |
||
| sf::String const & | text = "" |
||
| ) |
Creates a text field without font Then do not forget to set the font before displaying it.
| texture | the texture of the text field |
| textureFocused | the texture when the text field is focused |
| format | the format of this formatted text field |
| text | the default text of the text field |
| sf::ui::FormattedTextField::FormattedTextField | ( | sf::Texture const & | texture, |
| sf::Texture const & | textureFocused, | ||
| sf::Font const & | font, | ||
| Format * | format = 0, |
||
| sf::String | text = "" |
||
| ) |
Creates a text field.
| texture | the texture of the text field |
| textureFocused | the texture when the text field is focused |
| font | the text's font |
| format | the format of this formatted text field |
| text | the default text of the text field |
|
inherited |
Add an observer.
|
inherited |
|
protectedvirtualinherited |
| button | - the mouse's button |
| x | - the x coord |
| y | - the y coord |
|
inherited |
|
protectedvirtualinherited |
Delete the char at the given index Trigger a TextDeletedEvent.
| index | the index of the char to delete |
Reimplemented in sf::ui::PasswordField.
|
protectedvirtualinherited |
Draw the component to the render target.
Reimplemented from sf::ui::Component.
|
protectedvirtualinherited |
Called when the component gain focus.
|
inherited |
|
virtualinherited |
Implements sf::ui::IText.
|
virtualinherited |
Implements sf::ui::IText.
|
virtualinherited |
Implements sf::ui::IText.
| const Format* sf::ui::FormattedTextField::getFormat | ( | ) | const |
| Format* sf::ui::FormattedTextField::getFormat | ( | ) |
|
inherited |
|
inherited |
|
inherited |
|
inherited |
|
inherited |
|
virtualinherited |
Reimplemented in sf::ui::Label, and sf::ui::CheckBox.
|
virtualinherited |
Implements sf::ui::IText.
|
inherited |
|
inherited |
|
protectedvirtualinherited |
Insert a char at the given index Trigger a TextEnteredEvent.
| text | the text to insert |
| index | the index of the insertion |
Reimplemented in sf::ui::PasswordField.
|
protectedvirtualinherited |
| x | - the x coord |
| y | - the y coord |
|
inherited |
|
protectedvirtual |
Called when the component lost focus.
Reimplemented from sf::ui::Focusable.
|
inherited |
Move the component.
| vector | the move's vector |
|
inherited |
Move the component.
| x | the x movement |
| y | the y movement |
|
inherited |
Remove all the observers.
|
inherited |
Remove the observer at the given index.
| observer | the observer to remove |
|
inherited |
Sets if the string can be empty.
|
inherited |
Sets the cursor's position.
| cursor | the cursor's position |
|
inherited |
Set if the component is focused.
| focused | - is focused |
|
virtualinherited |
Sets the font of the component's text.
Implements sf::ui::IText.
|
virtualinherited |
|
virtualinherited |
| void sf::ui::FormattedTextField::setFormat | ( | Format * | format | ) |
Sets the new format of this field, and delete the old one.
| format | the new format, automatically deleted by the field |
|
inherited |
Sets the max length that the string can have -1 means the string has no length limit.
|
inherited |
Sets the model of the text field.
| model | the object that defines which characters can be typed |
|
inherited |
Set the component's position.
| position | - the position vector |
|
inherited |
Set the component's position.
| x | - the x coordinate |
| y | - the y coordinate |
|
virtualinherited |
Sets the text's string of the component Don't forget to set the font.
| text | - the new string of the component |
Implements sf::ui::IText.
|
inherited |
Set the texture of the component.
|
inherited |
Set the texture that is displayed when the component is displayed.
| textureFocused | - the texture when the component is focused |
|
protectedinherited |
Triggers the event and notify all observers.
| event | - the event to push |
|
protectedvirtualinherited |
Called when the component need update its geometry Inherit when you need to update some sprite.
Reimplemented from sf::ui::Component.
|
virtualinherited |
Update the component each time an event has been polled.
| event | the window's event polled |
Implements sf::ui::Component.
|
virtualinherited |
Update the component with the main loop's frequency Can be useful for animation, or time's needed stuff.
| delta | the time between this update and the last |
Implements sf::ui::Component.
|
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:
|
protectedvirtual |
Update the value with the field's text.