All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Defines
Public Member Functions | Protected Member Functions | Protected Attributes
GUI::Input Class Reference

A single-line text input. More...

#include <gui_tk.h>

Inheritance diagram for GUI::Input:
GUI::Window GUI::Timer_Callback GUI::ActionEventSource InputWithEnterKey

List of all members.

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 StringgetText ()
 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
int offset
 Horizontal scrolling offset.

Detailed Description

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).

Definition at line 1440 of file gui_tk.h.

The documentation for this class was generated from the following files: