A single-line text input. More...
#include <gui_tk.h>
Public Member Functions | |
Input (Window *parent, int x, int y, int w, int h=0) | |
Create an input with given position and width. If not set, height is calculated from the font and input is single-line. | |
virtual void | paint (Drawable &d) const |
Paint input. | |
void | clearSelection () |
Clear selected area. | |
void | copySelection () |
Copy selection to clipboard. | |
void | cutSelection () |
Cut selection to clipboard. | |
void | pasteSelection () |
Paste from clipboard. | |
Size | findPos (int x, int y) |
get character position corresponding to coordinates | |
template<typename STR > | |
void | setText (const STR text) |
Set text to be edited. | |
const String & | getText () |
Get the entered text. If you need it longer, copy it immediately. | |
virtual bool | keyDown (const Key &key) |
Handle text input. | |
virtual bool | mouseDown (int x, int y, MouseButton button) |
Handle mouse input. | |
virtual bool | mouseDragged (int x, int y, MouseButton button) |
Handle mouse input. | |
virtual Ticks | timerExpired (Ticks time) |
Timer callback function. | |
virtual void | posToEnd (void) |
Move the cursor to the end of the text field. | |
Protected Member Functions | |
void | checkOffset () |
Ensure that pos is visible. | |
Protected Attributes | |
String | text |
The text entered. | |
Size | pos |
Current position in text. | |
Size | lastpos |
Last updated position in text. | |
int | posx |
Coordinates according to pos. | |
int | posy |
Size | start_sel |
Selection in text. | |
Size | end_sel |
bool | blink |
Is cursor visible at the moment? | |
bool | insert |
Insert mode? | |
bool | multi |
Multiline? | |
int | offset |
Horizontal scrolling offset. | |
bool | enable_tab_input |
Allow user to type Tab into multiline. |
A single-line text input.
It uses Font::getFont("input") to display content. It supports selection, the clipboard and all well-known key bindings (except undo).