19 #include "label_input.h"
28 label_input::~label_input()
30 if (input::is_text_input())
32 input::stop_text_input();
43 if (!editable_)
return false;
45 if (!input::is_text_input())
47 input::start_text_input();
52 if (my_font_ == NULL)
return false;
60 if (c[0] == SDLK_BACKSPACE || c[0] == SDLK_DELETE)
62 if (my_text_.empty () || my_cursor_.idx == 0)
return true;
65 if (my_cursor_.idx > 2 && (
u_int8) my_text_[my_cursor_.idx-3] == 0xEF) count = 3;
66 else if (my_cursor_.idx > 1 && (
u_int8) my_text_[my_cursor_.idx-2] == 0xC3) count = 2;
69 my_cursor_.idx -= count;
72 my_text_.erase (my_cursor_.idx, count);
75 my_old_cursor_ = my_cursor_;
78 fillrect (my_cursor_.pos_x, my_cursor_.pos_y,
79 (*my_font_) [glyph].length (),
84 else if (c[0] == SDLK_RETURN)
add_text (
"\n");
88 if (my_font_->in_table (ucd(c, idx)))
#define u_int8
8 bits long unsigned integer
void fillrect(s_int16 x, s_int16 y, u_int16 l, u_int16 h, u_int32 col, drawing_area *da_opt=NULL)
Fills an area of the surface with a given color.
s_int16 offset_x_
sub-pixel offset
bool input_update()
Update input label, you can move the cursor if the cursor is moveable.
static u_int32 trans_col()
Returns the translucent color in screen's depth format.
void build(const bool erase_all)
Build label.
#define u_int16
16 bits long unsigned integer
void set_cursor_moveable(const bool b)
Set if the cursor can be moved with arrow key.
void add_text(const string &text)
Add text.
void set_cursor_visible(const bool b)
Set visible cursor.