#include <Console.h>
Inheritance diagram for Teddy::PhysicalComponents::Console:
Public Methods | |
Console (const std::string &name, const int w, const int h) | |
Constructor; font, width (chars), height (chars). More... | |
Console & | setLine (const int l, const string &s) |
Set contents of given line - no scrolling. More... | |
Console & | operator<< (const string &s) |
Print string to buffer. More... | |
void | append (const char *str, int count) |
Append chars. More... | |
void | append (int c) |
Append single char. More... | |
void | cursorDown () |
void | newLine () |
void | insertLine (const int y) |
Insert new line. More... | |
void | killLine (const int y) |
Kill line. More... | |
void | killChar (const int x, const int y) |
Kill character. More... | |
void | scroll (int x1, int y1, int x2, int y2, int dx, int dy) |
Scroll area. More... | |
virtual void | drawSelf () |
Draw. More... | |
bool | focusActive (const Event &e) |
Received or lost keyboard focus. More... | |
bool | keyDown (const Event &e) |
bool | keyUp (const Event &e) |
Protected Methods | |
virtual void | setSize (const int width, const int height) |
Protected Attributes | |
vector< string * > | buffer_lines |
Buffer. More... | |
int | font_width |
For quick access.. FIX? Observer? More... | |
int | font_height |
For quick access.. FIX? Observer? More... | |
int | width_chars |
Number of visible chars per line. More... | |
int | height_chars |
Number of visible lines. More... | |
int | max_height_chars |
Number of lines in buffer. More... | |
int | topleft_x |
Current scroll x-position - first visible char. More... | |
int | topleft_y |
Current scroll y-position - first visible line. More... | |
int | cx |
Cursor X position. More... | |
int | cy |
Cursor Y position. More... | |
bool | cursor_visible |
Do we want visible cursor? More... | |
Color | text_color |
Text color. More... |
Support for variable width font
Console com7ponent can be used for standard input and output in simple text form.
At the moment MouseListener is used for window dragging, but that will change into selection later, and dragging will be put into Frame Label.
The basic input and output is working now, but there are still a number of cliches, so be aware.
Console may or may not be connected to a parser. Currently I have plugged in Kamin Scheme interpreter as parser. If you enable it, be sure not to try to parse lines that are not complete, legal scheme statements. At the moment it is only small subset of scheme, and you can only send one line at time to it.
Definition at line 65 of file Console.h.
|
Constructor; font, width (chars), height (chars).
Definition at line 49 of file Console.cpp. References Teddy::PhysicalComponents::EventListener::bind, buffer_lines, cursor_visible, cx, cy, Teddy::PhysicalComponents::Area::drawing_ordering, Teddy::PhysicalComponents::Area::fill_base_pixels, font_height, font_width, height_chars, Teddy::PhysicalComponents::Area::insert, max_height_chars, Teddy::PhysicalComponents::Area::post_self, Teddy::PhysicalComponents::Area::style, text_color, topleft_x, topleft_y, and width_chars. |
|
Append single char.
Definition at line 217 of file Console.cpp. References buffer_lines, cy, and newLine. |
|
Append chars.
Definition at line 230 of file Console.cpp. References buffer_lines, cy, and newLine. |
|
Definition at line 258 of file Console.cpp. References buffer_lines, cy, height_chars, and topleft_y. |
|
Draw.
Reimplemented from Teddy::PhysicalComponents::Area. Definition at line 163 of file Console.cpp. References buffer_lines, Teddy::Graphics::ViewClient::color, cursor_visible, cx, cy, Teddy::PhysicalComponents::Area::drawString, font_height, font_width, height_chars, Teddy::PhysicalComponents::Area::style, text_color, topleft_x, topleft_y, Teddy::Graphics::ViewClient::view, and width_chars. |
|
Received or lost keyboard focus.
Definition at line 198 of file Console.cpp. References text_color. |
|
Insert new line.
Definition at line 271 of file Console.cpp. References buffer_lines. |
|
Insert key
Definition at line 311 of file Console.cpp. References buffer_lines, cursorDown, cx, cy, insertLine, killChar, killLine, and topleft_y. |
|
|
|
Kill character.
Definition at line 283 of file Console.cpp. References buffer_lines. Referenced by keyDown. |
|
Kill line.
Definition at line 276 of file Console.cpp. References buffer_lines. Referenced by keyDown. |
|
Definition at line 80 of file Console.h. References cursorDown, cx, cy, and insertLine. Referenced by append. |
|
Print string to buffer.
Definition at line 209 of file Console.cpp. References buffer_lines, cx, and cy. |
|
Scroll area.
Definition at line 253 of file Console.cpp. |
|
Set contents of given line - no scrolling.
Definition at line 246 of file Console.cpp. References buffer_lines. |
|
|
|
Buffer.
Definition at line 96 of file Console.h. Referenced by append, Console, cursorDown, drawSelf, insertLine, keyDown, killChar, killLine, operator<<, and setLine. |
|
Do we want visible cursor?
|
|
Cursor X position.
Definition at line 104 of file Console.h. Referenced by Console, drawSelf, keyDown, newLine, and operator<<. |
|
Cursor Y position.
Definition at line 105 of file Console.h. Referenced by append, Console, cursorDown, drawSelf, keyDown, newLine, and operator<<. |
|
For quick access.. FIX? Observer?
|
|
For quick access.. FIX? Observer?
|
|
Number of visible lines.
Definition at line 100 of file Console.h. Referenced by Console, cursorDown, and drawSelf. |
|
Number of lines in buffer.
Definition at line 101 of file Console.h. Referenced by Console. |
|
Text color.
Definition at line 107 of file Console.h. Referenced by Console, drawSelf, and focusActive. |
|
Current scroll x-position - first visible char.
|
|
Current scroll y-position - first visible line.
Definition at line 103 of file Console.h. Referenced by Console, cursorDown, drawSelf, and keyDown. |
|
Number of visible chars per line.
|