Main Page   Class Hierarchy   Compound List   File List   Compound Members  

KrConsole Class Reference

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

#include <console.h>

Inheritance diagram for KrConsole::

KrWidget KrImNode IKrWidgetListener List of all members.

Public Methods

 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. More...

void SetBackgroundColor (const KrRGBA &color)
 Set a background color Only works after the KrConsole has been added to the Tree.

virtual bool KeyEvent (const SDL_Event &key)
 Set a background box: same options and flags as KrBoxResource. More...

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 &, IKrWidgetListener *handler)
 Adds a command to the list of recognized (and auto-completed) commands. More...

KrImNodeToExtended (const std::string &name)
 A generic cast. More...

virtual bool HandleWidgetEvent (KrWidget *source, U32 event, U32 data, const SDL_Event *sdlEvent, const char *command, const char *arg)
 Handle SDL 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

void KrConsole::AddCommand const std::string &   ,
IKrWidgetListener   handler
 

Adds a command to the list of recognized (and auto-completed) commands.

This will add handler as a listerner if it is not already.

virtual bool KrConsole::KeyEvent const SDL_Event &    key [virtual]
 

Set a background box: same options and flags as KrBoxResource.

Only works after the KrConsole has been added to the Tree.

Reimplemented from KrWidget.

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 Mon Sep 15 12:01:11 2003 for Kyra by doxygen1.2.11.1 written by Dimitri van Heesch, © 1997-2001