duncan
Mom and Dad were wrong!
|
#include <inputline.h>
Public Member Functions | |
InputLine (size_t mlen=16, size_t bwidth=16) | |
bool | new_char (unsigned int) |
void | reset (size_t mlen=0, size_t bwidth=0) |
void | set_input (const std::string &) |
size_t | cursorpos () |
std::string & | input () |
std::string & | print () |
Store and update a line of text input, and handle special characters (such as backspace and enter) when they are typed.
see LICENSE
InputLine::InputLine | ( | size_t | mlen = 16 , |
size_t | bwidth = 16 |
||
) |
Initialise members.
mlen | maximum length of input string |
bwidth | width of box into which text is being entered |
size_t InputLine::cursorpos | ( | ) |
Get the position of the cursor.
std::string & InputLine::input | ( | ) |
Get the full input string.
bool InputLine::new_char | ( | unsigned int | ch | ) |
Insert a new 'character' (possibly backspace, enter, left, right, etc..) into the string
ch | character to be inserted |
std::string & InputLine::print | ( | ) |
Get the substring visible in the text box.
void InputLine::reset | ( | size_t | mlen = 0 , |
size_t | bwidth = 0 |
||
) |
Reset the line of input, changing the maximum length and box size if necessary.
mlen | maximum length of input string |
bwidth | width of box into which text is entered |
void InputLine::set_input | ( | const std::string & | str | ) |
Set the initial string.
str | initial string |