FormattedTextField.hpp
1 /*
2  * Copyright © 2013 mathdu07
3  *
4  * This program is free software: you can redistribute it and/or modify
5  * it under the terms of the GNU Lesser General Public License as published by
6  * the Free Software Foundation, either version 3 of the License, or
7  * (at your option) any later version.
8  *
9  * This program is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12  * GNU Lesser General Public License for more details.
13  *
14  * You should have received a copy of the GNU Lesser General Public License
15  * along with this program. If not, see <http://www.gnu.org/licenses/>.
16  */
17 
18 #ifndef FORMATTED_TEXT_FIELD_H
19 #define FORMATTED_TEXT_FIELD_H
20 
21 #include <SFML/UI/TextField.hpp>
22 #include <SFML/UI/Format/Format.hpp>
23 
24 namespace sf
25 {
26 namespace ui
27 {
28 
30 {
31 public:
32  //CONSTRUCTORS/DESTRUCTORS -------------------------------------------
41  FormattedTextField(Format* format = 0);
42 
54  FormattedTextField(sf::Texture const &texture, sf::Texture const &textureFocused, Format* format = 0, sf::String const &text = "");
55 
67  FormattedTextField(sf::Texture const &texture, sf::Texture const &textureFocused, sf::Font const &font, Format* format = 0, sf::String text = "");
68 
69  virtual ~FormattedTextField();
70  //--------------------------------------------------------------------
71 
72  //METHODS ------------------------------------------------------------
73 protected:
79  virtual void lostFocus();
80 
86  virtual void updateValue();
87  //--------------------------------------------------------------------
88 
89  //GETTERS/SETTERS ----------------------------------------------------
90 public:
96  const Format* getFormat() const;
97 
103  Format* getFormat();
104 
112  void setFormat(Format *format);
113  //--------------------------------------------------------------------
114 
115  //FIELDS -------------------------------------------------------------
116 protected:
117  Format *m_format;
118  //--------------------------------------------------------------------
119 };
120 
121 }
122 }
123 #endif
124 
A formatted text field which stores a value defined by a sf::ui::Format It can be a sf::Int64...
void setFormat(Format *format)
Sets the new format of this field, and delete the old one.
A text field which stores a text.
Definition: TextField.hpp:30
virtual void lostFocus()
Called when the component lost focus.
virtual void updateValue()
Update the value with the field's text.
const Format * getFormat() const
FormattedTextField(Format *format=0)
Creates an empty text field without texture, font ...
The abstract class that defines format of various types, such as ints, double, objects ...
Definition: Format.hpp:28