supertux
src
gui
item_floatfield.hpp
1
// SuperTux
2
// Copyright (C) 2015 Hume2 <teratux.mail@gmail.com>
3
// 2022 Vankata453
4
//
5
// This program is free software: you can redistribute it and/or modify
6
// it under the terms of the GNU General Public License as published by
7
// the Free Software Foundation, either version 3 of the License, or
8
// (at your option) any later version.
9
//
10
// This program is distributed in the hope that it will be useful,
11
// but WITHOUT ANY WARRANTY; without even the implied warranty of
12
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13
// GNU General Public License for more details.
14
//
15
// You should have received a copy of the GNU General Public License
16
// along with this program. If not, see <http://www.gnu.org/licenses/>.
17
18
#ifndef HEADER_SUPERTUX_GUI_ITEM_FLOATFIELD_HPP
19
#define HEADER_SUPERTUX_GUI_ITEM_FLOATFIELD_HPP
20
21
#include "gui/item_textfield.hpp"
22
23
class
ItemFloatField
final :
public
ItemTextField
24
{
25
public
:
26
ItemFloatField
(
const
std::string& text_,
float
* input_,
int
id_ = -1,
bool
positive =
false
);
27
~
ItemFloatField
()
override
;
28
29
float
* number;
30
32
virtual
void
on_input_update
()
override
;
33
34
// Text manipulation and navigation functions
35
36
virtual
void
insert_text(
const
std::string& text,
const
int
left_offset_pos)
override
;
37
38
private
:
39
std::string m_input;
40
bool
m_has_comma;
41
const
bool
m_positive;
42
43
void
add_char(
char
c,
const
int
left_offset_pos);
44
45
private
:
46
ItemFloatField
(
const
ItemFloatField
&) =
delete
;
47
ItemFloatField
& operator=(
const
ItemFloatField
&) =
delete
;
48
};
49
50
#endif
51
52
/* EOF */
ItemFloatField::on_input_update
virtual void on_input_update() override
Calls when the input gets updated.
Definition:
item_floatfield.cpp:98
ItemFloatField
Definition:
item_floatfield.hpp:23
ItemTextField
Definition:
item_textfield.hpp:23
Generated by
1.8.13