GNE
0.75.0
|
Provides a text-based window view of a buffer of text, similar to a textbox object in a GUI. More...
#include <TextConsole.h>
Public Member Functions | |
TextConsole (int xoffset, int yoffset, int width, int height) | |
virtual void | erase () |
Tells the renderer for this ConsoleBuffer to completely erase the display. | |
![]() | |
void | setContIndent (const std::string &indent) |
Sets the continuation indent for the TextConsole. | |
void | setAutoRender (bool autoRender) |
Sets auto rendering mode on or off. | |
int | getXOffset () |
Returns the x offset. | |
int | getYOffset () |
Returns the y offset. | |
int | getWidth () const |
Returns the current buffer width. | |
int | getHeight () const |
Returns the current buffer height. | |
void | clear () |
Clears all the text from the console, leaving an empty buffer. | |
void | redraw () |
Redraws the console by rerendering all of it. | |
void | update () |
Updates the view of this console by having the renderer update the destination device. | |
template<class T > | |
ConsoleBuffer & | operator<< (const T &rhs) |
ConsoleBuffer & | operator<< (const Console::ConsoleMutex &rhs) |
ConsoleBuffer & | operator<< (CBFType f) |
![]() | |
void | acquire () |
Synchronizes on this object. | |
void | release () |
Releases the lock on this object. |
Protected Member Functions | |
virtual void | render (int x, int y, std::string text, int renderHints) |
Asks the renderer to render the data at the specified location. | |
![]() | |
ConsoleBuffer (int xoffset, int yoffset, int width, int height, int textHeight) | |
Readies a new TextConsole in the inclusive rectangle from (xoffset, yoffset) to (xoffset+width, yoffset+height). | |
virtual bool | scroll (int height) |
Tells the renderer that the console is scrolling by the specified height in units. | |
virtual int | stringWidth (const std::string &str) |
Returns the width of the text in width units. | |
void | setRequiredDelimiters (const std::string &delims) |
Sets a string of the set of required delimiter characters. | |
void | addRequiredDelimiters (const std::string &delims) |
Adds the delimiters in the string to the set of required delimiters. | |
std::string | getRequiredDelimiters () |
Returns the current set of required delimiter characters. |
Additional Inherited Members | |
![]() | |
typedef std::ostream &(* | CBFType )(std::ostream &) |
![]() | |
Mutex | lock |
![]() | |
static const int | REDRAW_HINT = 1 |
Provides a text-based window view of a buffer of text, similar to a textbox object in a GUI.
This allows one to provide a text-based console which would be useful in a dedicated server running in a console, or in a UNIX prompt environment.
The console needs a rectangle on the screen for which it can have exclusive access. Other threads may use located versions of text output (like Console::mlprintf) outside of the specified window area. The window provides word wrapping and software-based scrolling.
|
virtual |
Tells the renderer for this ConsoleBuffer to completely erase the display.
This is different from clear in the fact that erase will "hide" the console. The behavior of calling update, or adding text during auto render mode, before calling redraw or clear is defined by the renderer, but in general if you want to use the console again, you should call either clear or redraw before inserting text.
Implements GNE::ConsoleBuffer.
|
protectedvirtual |
Asks the renderer to render the data at the specified location.
There will not be newline characters in the text string. The renderHints parameter contains hints for the renderer. At this time the only hint is ConsoleBuffer::REDRAW_HINT, which is set when redrawing to a location. The renderHints field is a bit mask, so use the bitwise and operator to check for hints.
Implements GNE::ConsoleBuffer.