Entire Class Index | Main Class Index | Cross Index | Global Index

# Class CL_InputBox

Inputbox component
Contained in: global
Derived from: CL_Component
Derived by: none
Group: GUI (Controls)

#include <ClanLib/gui.h>

### public function member index:
### Construction:
`` | `CL_InputBox` | `(`CL_Component`* `parent`, `CL_StyleManager`* `style` = NULL)`;
`` | `CL_InputBox` | `(`const` `std::string`& `text`, `CL_Component`* `parent`, `CL_StyleManager`* `style` = NULL)`;
`` | `CL_InputBox` | `(`const` `CL_Rect`& `pos`, `CL_Component`* `parent`, `CL_StyleManager`* `style` = NULL)`;
`` | `CL_InputBox` | `(`const` `CL_Rect`& `pos`, `const` `std::string`& `text`, `CL_Component`* `parent`, `CL_StyleManager`* `style` = NULL)`;
``virtual`` | `~CL_InputBox` | `()`;
### Attributes:
``const` `std::string`&` | `get_text` | `() `const``;
``int`` | `get_length` | `() `const``;
``const` `std::string`&` | `get_marked_text` | `() `const``;
``bool`` | `has_marked_text` | `() `const``;
``int`` | `get_selection_start` | `() `const``;
``int`` | `get_selection_length` | `() `const``;
``int`` | `get_max_length` | `() `const``;
``bool`` | `in_password_mode` | `() `const``;
``bool`` | `is_read_only` | `() `const``;
``int`` | `get_cursor_position` | `() `const``;
``bool`` | `is_edited` | `() `const``;
### Operations:
``void`` | `set_text` | `(`const` `std::string`& `text`)`;
``void`` | `set_text` | `(`int` `number`)`;
``void`` | `set_text` | `(`double` `number`)`;
``void`` | `set_max_length` | `(`int` `length`)`;
``void`` | `set_password_mode` | `(`bool` `enable` = true)`;
``void`` | `set_read_only` | `(`bool` `enable` = true)`;
``void`` | `select_all` | `()`;
``void`` | `deselect` | `()`;
``void`` | `set_selection` | `(`int` `start`, `int` `length`)`;
``void`` | `set_cursor_position` | `(`int` `pos`)`;
``void`` | `clear` | `()`;
``void`` | `backspace` | `()`;
``void`` | `del` | `()`;
``void`` | `cut` | `()`;
``void`` | `move_cursor` | `(`int` `delta`, `bool` `mark` = false)`;
``void`` | `move_cursor_word` | `(`int` `delta`, `bool` `mark` = false)`;
``void`` | `home` | `(`bool` `mark` = false)`;
``void`` | `end` | `(`bool` `mark` = false)`;
``void`` | `set_edited` | `(`bool` `on` = true)`;
### Signals:
``CL_Signal_v1`<`const` `std::string`& >&` | `sig_changed` | `()`;
``CL_Signal_v0`&` | `sig_return_pressed` | `()`;
``CL_Signal_v0`&` | `sig_activity` | `()`;
### private function member index:
### Implementation:
`` | `CL_InputBox` | `(`const` `CL_InputBox`& `copy`)`;

## Description:

## Function Member Descriptions:

CL_InputBox::CL_InputBox - InputBox Constructor
`` `CL_InputBox``(`CL_Component`* `parent`, `CL_StyleManager`* `style` = NULL)`;

CL_InputBox::CL_InputBox - InputBox Constructor
`` `CL_InputBox``(`const` `std::string`& `text`, `CL_Component`* `parent`, `CL_StyleManager`* `style` = NULL)`;

CL_InputBox::CL_InputBox - InputBox Constructor
`` `CL_InputBox``(`const` `CL_Rect`& `pos`, `CL_Component`* `parent`, `CL_StyleManager`* `style` = NULL)`;

CL_InputBox::CL_InputBox - InputBox Constructor
`` `CL_InputBox``(`const` `CL_Rect`& `pos`, `const` `std::string`& `text`, `CL_Component`* `parent`, `CL_StyleManager`* `style` = NULL)`;

CL_InputBox::backspace - Deletes the character to the left of the text cursor and moves the cursor one position to the left.
If a text has been marked, the cursor will be put at the beginning of the marked text
and the marked text will be removed.
``void`` `backspace``()`;

CL_InputBox::clear - Syntactic sugar for set_text("").
``void`` `clear``()`;

CL_InputBox::cut - Cut the selected text if any.
``void`` `cut``()`;

CL_InputBox::del - Deletes the character on the right side of the text cursor.
If a text has been marked, the cursor will be put at the beginning of the marked text and the marked
text will be removed.
``void`` `del``()`;

CL_InputBox::deselect - Deselects all text (i.e. removes marking) and leaves the cursor at the current position.
``void`` `deselect``()`;

CL_InputBox::end - Moves the text cursor to the right end of the line.
``void`` `end``(`bool` `mark` = false)`;

> If mark is true, text will be marked towards the last position
> If mark is false, any marked text will be unmarked if the cursor is moved.

CL_InputBox::get_cursor_position - Returns the current cursor position.
``int`` `get_cursor_position``() `const``;

CL_InputBox::get_length - Returns the length of the inputfield text.
``int`` `get_length``() `const``;

CL_InputBox::get_marked_text - Returns the marked text from the inputfield.
``const` `std::string`&` `get_marked_text``() `const``;

CL_InputBox::get_max_length - Returns the maximum permitted length of the text.
``int`` `get_max_length``() `const``;

CL_InputBox::get_selection_length - Returns the length of current selection.
``int`` `get_selection_length``() `const``;

CL_InputBox::get_selection_start - Returns the position where the selection starts.
``int`` `get_selection_start``() `const``;

CL_InputBox::get_text - Returns the inputfield text.
``const` `std::string`&` `get_text``() `const``;

CL_InputBox::has_marked_text - Returns true if part of the text has been marked by the user.
``bool`` `has_marked_text``() `const``;

CL_InputBox::home - Moves the text cursor to the left end of the line.
``void`` `home``(`bool` `mark` = false)`;

> If mark is true, text will be marked towards the first position
> If mark is false, any marked text will be unmarked if the cursor is moved.

CL_InputBox::in_password_mode - Returns true if password mode is enabled, false othewise.
``bool`` `in_password_mode``() `const``;

CL_InputBox::is_edited - Returns true if the contents has been edited.
``bool`` `is_edited``() `const``;

CL_InputBox::is_read_only - Returns whether the inputfield is read-only.
``bool`` `is_read_only``() `const``;

CL_InputBox::move_cursor - Moves the cursor position.
``void`` `move_cursor``(`int` `delta`, `bool` `mark` = false)`;

> If delta is positive, the cursor is moved forward.
> If delta is negative, the cursor is moved backward.
> If mark is true, the text is marked.

CL_InputBox::move_cursor_word - Moves the cursor by word.
``void`` `move_cursor_word``(`int` `delta`, `bool` `mark` = false)`;

> If delta is positive, the cursor is moved forward.
> If delta is negative, the cursor is moved backward.
> If mark is true, the text is marked.

CL_InputBox::select_all - Selects all text, and moves the cursor to the end.
``void`` `select_all``()`;

CL_InputBox::set_cursor_position - Sets the cursor position to pos.
``void`` `set_cursor_position``(`int` `pos`)`;

CL_InputBox::set_edited - Sets the edited flag to on.
The edited flag is changed to true whenever the user changes its contents.
``void`` `set_edited``(`bool` `on` = true)`;

CL_InputBox::set_max_length - Set the maximum length of the text in the editor.
``void`` `set_max_length``(`int` `length`)`;

CL_InputBox::set_password_mode - If enable is true, display asterisks instead of the characters actually entered.
``void`` `set_password_mode``(`bool` `enable` = true)`;

CL_InputBox::set_read_only - Enables or disables read-only mode.
``void`` `set_read_only``(`bool` `enable` = true)`;

CL_InputBox::set_selection - Sets the marked area at start and be length characters long.
``void`` `set_selection``(`int` `start`, `int` `length`)`;

CL_InputBox::set_text - Sets the line edit text to text, clears the selection and moves the cursor to the end of the line.
If necessary the text is truncated to get_max_length().
``void`` `set_text``(`const` `std::string`& `text`)`;

CL_InputBox::set_text - Sets the line edit contents to a plain text containing the printed value of num.
``void`` `set_text``(`int` `number`)`;

CL_InputBox::set_text - Sets the line edit contents to a plain text containing the printed value of num.
``void`` `set_text``(`double` `number`)`;

CL_InputBox::sig_activity - This signal is emitted whenever some character is changed/added/removed, cursor moved etc.
``CL_Signal_v0`&` `sig_activity``()`;

CL_InputBox::sig_changed - This signal is emitted whenever text is changed in the inputfield.
``CL_Signal_v1`<`const` `std::string`& >&` `sig_changed``()`;

> const std::string & - Contains the new string.

CL_InputBox::sig_return_pressed - This signal is emitted when enter is pressed in the inputfield.
``CL_Signal_v0`&` `sig_return_pressed``()`;

CL_InputBox::~CL_InputBox - InputBox Destructor
``virtual`` `~CL_InputBox``()`;

## Variable Member Descriptions: