ScummVM API documentation
gui_text_input.h
1/* ScummVM - Graphic Adventure Engine
2 *
3 * ScummVM is the legal property of its developers, whose names
4 * are too numerous to list here. Please refer to the COPYRIGHT
5 * file distributed with this source distribution.
6 *
7 * This program is free software: you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation, either version 3 of the License, or
10 * (at your option) any later version.
11 *
12 * This program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
16 *
17 * You should have received a copy of the GNU General Public License
18 * along with this program. If not, see <http://www.gnu.org/licenses/>.
19 *
20 */
21
22#ifndef NUVIE_GUI_GUI_TEXT_INPUT_H
23#define NUVIE_GUI_GUI_TEXT_INPUT_H
24
25#include "ultima/nuvie/gui/gui_text.h"
26
27namespace Ultima {
28namespace Nuvie {
29
30class GUI_Font;
31
32
33#define TEXTINPUT_CB_TEXT_READY 0x1
34
35class GUI_TextInput : public GUI_Text {
36protected:
37 uint16 max_height;
38 uint16 pos;
39 uint16 length;
40
41 GUI_CallBack *callback_object;
42
43 uint32 cursor_color;
44 uint32 selected_bgcolor;
45
46public:
47
48 GUI_TextInput(int x, int y, uint8 r, uint8 g, uint8 b,
49 const char *str, GUI_Font *gui_font, uint16 width, uint16 height, GUI_CallBack *callback);
50 ~GUI_TextInput() override;
51
52 void release_focus() override;
53
54 GUI_status MouseUp(int x, int y, Events::MouseButton button) override;
55 GUI_status KeyDown(const Common::KeyState &key) override;
56
57 void add_char(char c);
58 void remove_char();
59 void set_text(const char *new_text);
60 const char *get_text() {
61 return text;
62 }
63 void SetDisplay(Screen *s) override;
64 void display_cursor();
65
66 /* Show the widget */
67 void Display(bool full_redraw) override;
68
69};
70
71} // End of namespace Nuvie
72} // End of namespace Ultima
73
74#endif
Definition: gui_callback.h:31
Definition: gui_font.h:36
Definition: gui_text.h:32
Definition: gui_text_input.h:35
Definition: screen.h:41
Definition: keyboard.h:294