KrConsole Class Reference

A GUI Widget to display a (basic) console window. More...

#include <console.h>

Inheritance diagram for KrConsole:

KrWidget KrImNode IKrWidgetListener grinliz::Listener< IKrWidgetListener > List of all members.

Public Member Functions

 KrConsole (int width, int height, int lineSpacing, const KrScheme &scheme)
 The font resource to use is passed in, as well as the size of the console box.
void SetBackgroundColor (const KrRGBA &color)
 Set a background color Only works after the KrConsole has been added to the Tree.
void PushText (const char *text)
 Prints out a null termintated text string.
void Print (const char *format,...)
 Prints using "printf" format. Will handle newlines.
void GetEntryTextChar (std::string *buffer)
 Get the current text in the command line.
void AddCommand (const std::string &)
 Adds a command to the list of recognized (and auto-completed) commands.
KrImNodeToExtended (const std::string &name)
 A generic cast.
virtual bool HandleWidgetEvent (KrWidget *source, const KrWidgetEvent &event)
 Handle widget events, return true if handled, false if not ours.

Detailed Description

A GUI Widget to display a (basic) console window.

Emulates a simple command console, with one line text editing, history buffer, and command completion.

Needs SDL_EnableUNICODE( true ) to function correctly.

Events Sent


Constructor & Destructor Documentation

KrConsole::KrConsole ( int  width,
int  height,
int  lineSpacing,
const KrScheme scheme 
)

The font resource to use is passed in, as well as the size of the console box.

The lineSpacing can be used to give additional space between lines. The normal behavior is zero.

WARNING: The font is in the scheme, and must be set.


Member Function Documentation

KrImNode* KrConsole::ToExtended ( const std::string &  name  )  [inline, virtual]

A generic cast.

The Kyra library is not as extensible as it could be; this implements a "cheap RTTI" if you add your own sub-classes. Arbitrary casting to any type in the string. For example,

			MyClassType* myType = (MyClassType*) node->ToExtended( "MyClassType" );
		
Somewhat inelegant, but a very useful hook. The build in classes will not respond to this. (That is, ToExtended( "Sprite" ) does not work.)

Reimplemented from KrImNode.


The documentation for this class was generated from the following file:
Generated on Thu Jul 20 20:45:32 2006 for Kyra by  doxygen 1.4.7