0. Reference Documentation

1. Enumerations
enum LineReaderSetting = {
     LR_SET_TRIM_LINES
     LR_SET_WHITESPACE
     LR_SET_CASE_SENSITIVE
     LR_ADD_EOL_CONTINUE
     LR_ADD_BNL_CONTINUE
     LR_ADD_COMMENT_START
     LR_ADD_COMMENT_EXCEPTION
     LR_ADD_PARTIAL_COMMENT
};
enum Font = {
     HELVETICA
     TIMES
     COURIER
};
enum FontStyle = {
     NORMAL
     BOLD
     ITALIC
     BOLD_ITALIC
};
enum DrawMode = {
     STANDARD
     INVERT
     XOR
};
enum LineStyle = {
     SOLID
     DASHED
     DOTTED
     DASHDOTTED
};
enum KeyCode = {
     KEY_ESCAPE
     KEY_BACKSPACE
     KEY_TAB
     KEY_ENTER
     KEY_PRINT
     KEY_SCROLL_LOCK
     KEY_PAUSE
     KEY_INSERT
     KEY_HOME
     KEY_PAGE_UP
     KEY_DELETE
     KEY_END
     KEY_PAGE_DOWN
     KEY_LEFT
     KEY_UP
     KEY_RIGHT
     KEY_DOWN
     KEY_SHIFT_L
     KEY_SHIFT_R
     KEY_CONTROL_L
     KEY_CONTROL_R
     KEY_CAPS_LOCK
     KEY_ALT_L
     KEY_ALT_R
     KEY_META_L
     KEY_META_R
     KEY_NUM_LOCK
     KEY_KP_ENTER
     KEY_F1
     KEY_F2
     KEY_F3
     KEY_F4
     KEY_F5
     KEY_F6
     KEY_F7
     KEY_F8
     KEY_F9
     KEY_F10
     KEY_F11
     KEY_F12
};
enum KeyModifier = {
     MOD_NONE
     MOD_CTRL
     MOD_ALT
     MOD_SHIFT
};
enum PlotStyle = {
     CONTINUOUS
     PLUSES
     BOXES
     CIRCLES
     POINTS
     CROSSES
};
enum GraphAxis = {
     XAXIS
     YAXIS
     BOTHAXES
};
enum MessageInfo = {
     YES
     NO
     CANCEL
     YES_NO
     YES_NO_CANCEL
     INFORMATION
     ALERT
};

2. Global Variables
const unsigned int [] N_primes : A list of increasing prime numbers.
const unsigned int N_num_primes : The number of primes in the N_primes array.
PlotId INVALID_PLOT : An invalid plot identifier.
PlotId NEW_PLOT : Indicates to use the next available plot identifier.
PlotId MAX_PLOTS : The maximum number of plots
CursorId MAX_CURSORS : The maximum number of cursors.

3. Macros
#define MAX(a, b) : Returns the maximum of the two numbers.
#define MIN(a, b) : Returns the smaller of the two numbers.

4. Typedefs
typedef void* Ptr
typedef const void* CPtr
typedef int CursorId
typedef int PlotId

5. Functions
unsigned int GetLargerPrime(unsigned int x);

Returns a prime number equal or greater than the parameter.

unsigned int x : The minimum value.

void EndApp();

Attempts to quit the application. Calls the user-defined AppQuit() function, and exits if AppQuit returns true.


void SetAppHelpFile(const String& path);

Sets the application's help file. This should be the path to an HTML help file.

const String& path : The file path.

void ShowAppHelp();

Displays a help dialog with the specified help file.


void HideAppHelp();

Hides the application's help viewer dialog.


void SetAppHelpTopline(int n);

Sets the top line in the help viewer to the numbered line

int n : The line to show.

void SetAppHelpTopline(const String& str);

Sets the top line in the help viewer to the named line

const String& str : The line to show.

void Message(const char* pMsg, ... .);

Displays a simple message dialog with an OK button and the given message.

const char* pMsg : The format string for the message. This function works just like the standard printf(...) function.
... . : The variable length argument list for the format string.

void Alert(const char* pMsg, ... .);

Displays an alert message dialog with an OK button and the given message.

const char* pMsg : The format string for the message. This function works just like the standard printf(...) function.
... . : The variable length argument list for the format string.

int Question(int pType, const char* pMsg, ... .);

Displays a simple question dialog box. The button configuration can be customized. Returns one of YES, NO, or CANCEL, depending on which button was pressed.

int pType : The button format. Possible values are YES_NO and YES_NO_CANCEL.
const char* pMsg : The format string for the message. This function works just like the standard printf(...) function.
... . : The variable length argument list for the format string.

bool InputBox(String& pLabel, const char* fmt, ... .);

Shows a dialog displaying some text, allows the user to edit it, and returns the new string. Returns true if the Ok button was pressed.

String& pLabel : The initial default text to display, and the string referenced is assigned to the new string if Ok is pressed.
const char* fmt : The format string for the dialog's message label.
... . : The variable length argument list for the format string.

bool ShowFileChooser(const String& title, const String& patterns, const String& path, String& file);

Shows a file selection dialog box. For example,
   String fn;
   bool success = ShowFileChooser("Open", "*", "", fn);
Returns whether the user actually selected a file or canceled the dialog.

const String& title : The title of the selection dialog.
const String& patterns : The file matching patterns to filter.
const String& path : The initial path to display. An empty "" string uses the current path.
String& file : A reference to a string where to place the chosen file name.

bool ShowDirChooser(const String& title, String& dir, bool relative);

Shows a directory selection dialog box. For example,
   String dir;
   bool success = ShowDirChooser("Choose Dir", dir, true);
Returns whether the user actually selected a file or canceled the dialog.

const String& title : The title of the selection dialog.
String& dir : The initial directory, as well as the where the chosen directory is placed if the user clicks ok.
bool relative : Whether the filename should be relative (true) or absolute (false).

bool ShowColorChooser(const String& pTitle, Color& pColor);

Shows a color selection dialog box. The pColor parameter specifies the inital color, and is changed to the color that the user selects. Returns true if the user clicks Ok and updates the color.

const String& pTitle : The title of the color selection dialog.
Color& pColor : The color.


6. Classes
_________________________________________________________________
LineReader

A highly configurable line-based reader. It can read directly from a FILE* pointer or a String. It is capable of automatically trimming whitespace, handling line continuation characters, comments, partial comments, and comment exceptions. The reader is configured with the configure(..) method, and the following commands and options:
   LR_SET_TRIM_LINES: (int: 1 or 0)
   LR_SET_WHITESPACE: (char* : string of whitespace delimiters)
   LR_SET_CASE_SENSITIVE: (int: 1 or 0)
   LR_ADD_EOL_CONTINUE: (char* : pattern string)
   LR_ADD_BNL_CONTINUE: (char* : pattern string)
   LR_ADD_COMMENT_START: (char* : string)
   LR_ADD_COMMENT_EXCEPTION: (char* : string)
   LR_ADD_PARTIAL_COMMENT: (int: 1 or 0)
Pattern strings are simply normal strings where a '|' character stands for 0 or more characters of whitespace. Thus, the pattern "*extractelement|+" would match all of the following strings:
   '*extractelement +'
   '*extractelement+'
   '*extractelement      +'
The same pattern format is used for 'beginning-of-next-line' continuations (BNL_CONTINUE) and 'end-of-line' continuations (EOL_CONTINUE).

Comments extend from the beginning of a line to the end of it. By setting the ALLOW_PARTIAL_COMMENTS to true (1), then a comment starting in the middle of a line extending to the end of it will be remove from the input. Otherwise, comments starting in the middle of a line will remain in the return line. If a comment start is also a EOL continuation, and partial line comments are allowed, the characters after the comment start are stripped, but the line will be continued as expected.

Sample code to configure a reader for Cadence Spectre Netlists:

   LineReader reader(file, 2048);

   reader.configure(LR_SET_TRIM_LINES, LR_ARG(1));
   reader.configure(LR_SET_WHITESPACE, LR_ARG(" \t\r"));
   reader.configure(LR_SET_CASE_SENSITIVE, LR_ARG(0));
   reader.configure(LR_ADD_PARTIAL_COMMENT, LR_ARG("//"));
   reader.configure(LR_ADD_COMMENT_START, LR_ARG("//"));
   reader.configure(LR_ADD_COMMENT_START, LR_ARG("*"));
   reader.configure(LR_ADD_COMMENT_EXCEPTION, LR_ARG("*extractelement"));
   reader.configure(LR_ADD_EOL_CONTINUE, LR_ARG("\\"));
   reader.configure(LR_ADD_BNL_CONTINUE, LR_ARG("*extractelement|+"));

   String line;
   while(reader.getLine(line)) {
      ....
   }
   ....


LineReader::LineReader(FILE* finput, int max_line_length);

Constructs a new LineReader object for a FILE.

FILE* finput : The file to read from.
int max_line_length : The maximum length of a line in the file.

LineReader::LineReader(const String& cinput, int max_line_length);

Constructs a new LineReader object for a String.

const String& cinput : The string to read from.
int max_line_length : The maximum length of a line in the file.

void LineReader::configure(LineReaderSetting type, void* pat);

Configure the reading options of the line reader. See the class description above for greater detail and examples.

LineReaderSetting type : The configuration command.
void* pat : The configuration parameter. For integer (1/0) values, use the macro LR_ARG(0) or LR_ARG(1).

bool LineReader::getLine(String& line);

Read one line from the reader. Returns false if the end of the file was reached, otherwise true.

String& line : The line is assigned to this parameter.

int LineReader::linesRead();

Returns the number of lines read so far.


_________________________________________________________________
StringArray

This class implements a simple interface for working with arrays of strings. It is nothing more than a vector of strings (i.e. Vector‹ String ›), except that a few convenience functions are provided. Traversing the elements in a string array involves a simple for loop:
   StringArray args;
   ...
   for (int i=0;i ‹ args.length();i++)
     printf("%s\n", args[i].cStr());


StringArray::StringArray(int (=0) size);

Constructs a new string array optionally of the specified size.

int (=0) size : The initial capacity of the string array. Defaults to 0.

StringArray& StringArray::operator=(const StringArray& array);

Assigns one string array to another.

const StringArray& array : The StringArray to assign.

String StringArray::operator[](int i);

Indexing operator to return strings in the array.
   String str = args[2];

int i : Specifies which string to return.

String& StringArray::operator[](int i);

Indexing operator to allow for assignment into the array.
   args[2] = "Hello!";

int i : Specifies which string to return a reference to.

void StringArray::prepend(const String& s);

Prepends the specified string to the beginning of the array, shifting the other elements down.

const String& s : The string to prepend.

void StringArray::append(const String& s);

Appends the specified string to the end of the array, increasing the capacity of the array if necessary.

const String& s : The string to append.

void StringArray::insert(const String& s, int index);

Inserts a string to a specified location in the array, increasing the capacity of the array if necessary.

const String& s : The string to insert.
int index : The insertion index.

int StringArray::find(const String& s);

Searches the array for a string. Returns the index of the first occurence if found, otherwise returns -1.

const String& s : The string to search for.

void StringArray::remove(const String& s);

Removes the first occurrence of the specified string, if it is found.

const String& s : The string to find and remove.

void StringArray::remove(int index);

Removes the string at the given index.

int index : The index of the string to remove.

void StringArray::clear();

Empties the string array.


void StringArray::preAlloc(int size);

Increases the capacity of the string array to the given size.

int size : The new capacity of the array.

int StringArray::length();

Returns the number of strings in the array.


int StringArray::capacity();

Returns the capacity of the array. Note that this not necessarily the same as length() .


StringArray StringArray::make(int n, ... .);

A static function that creates a string array from a var-arg list of c-strings.

int n : The number of strings in the list.
... . : A variable-length list of char* arguments.

_________________________________________________________________
String

The string class provides a flexible alternative to standard C-style strings. It is fully operator overloaded to simplify programming, and is used throughout the runtime library. It provides a convenient printf(...) method to generate nicely formatted text using the standard stdio printf syntax. The class also has searching capabilities, as well as the standard substring manipulationg methods. The internal storage is simply a standard C-style character array, and can be accessed directly with the cStr() and getBuffer() methods. However, direct manipulation of the underlying storage is not recommended, as it may leave the string class in a volatile state. If a large C-style buffer must be pre-allocated and filled externally, use the getWriteBuffer() and ungetWriteBuffer() methods.

The following operators are also overridden for strings:
   ==, !=, ‹, ‹=, ›, ›=, +


String::String();

Creates an empty string.


String::String(const char* s);

Creates a copy of the supplied string.

const char* s : The NULL-terminated string to copy.

String::String(const String& s);

Creates a copy of the supplied string.

const String& s : The string to copy.

const String& String::operator=(const String& s);

The standard string assignment operator. Note that this copies the string memory.

const String& s : The string to assign.

const String& String::operator=(const char* s);

The standard string assignment operator. Note that this copies the string memory.

const char* s : The string to assign.

const String& String::operator=(char ch);

The standard character assignment operator.

char ch : The character to assign.

const char* String::cStr();

Returns a const pointer to the internal buffer. Use when calling printf(...) and other functions that require C-strings.


int String::length();

Returns the length of the string.


char String::operator[](int i);

Indexing operator to return characters in the string.
   char ch = str[2];

int i : Specifies which character to return.

String& String::operator[](int i);

Indexing operator to allow for assignment into the string.
   str[2] = 'c';

int i : Specifies the index of the character to return a reference to.

const String& String::operator+=(const String& s);

The string concatenation operator.

const String& s : The string to concatenate.

const String& String::operator+=(char ch);

The character concatenation operator.

char ch : The character to concatenate.

bool String::printf(const char* format, ... .);

A convenient string formatting function. It provides the functionality of sprintf. Note that the maximum buffer length is 2048.

const char* format : The standard printf formatting string.
... . : The variable argument list.

char* String::getBuffer();

Returns the internal buffer directly.


char* String::getWriteBuffer();

Allocates a new buffer and returns it. Note that any preexisting string is lost.


void String::ungetWriteBuffer();

Restores the string class after a getWriteBuffer operation.


double String::toDouble(bool* (=NULL) success);

Attempts to convert the string to a double value.

bool* (=NULL) success : If not NULL, this parameter indicates whether or not the conversion was successful.

long String::toLong(bool* (=NULL) success, int (=10) base);

Attempts to convert the string to a long integer value.

bool* (=NULL) success : If not NULL, this parameter indicates whether or not the conversion was successful.
int (=10) base : The base of the conversion. Defaults to 10.

int String::toInt(bool* (=NULL) success);

Attempts to convert the string to a normal base 10 integer value.

bool* (=NULL) success : If not NULL, this parameter indicates whether or not the conversion was successful.

unsigned int String::toUnsignedInt(bool* (=NULL) success);

Attempts to convert the string to a normal base 10 unsigned integer value.

bool* (=NULL) success : If not NULL, this parameter indicates whether or not the conversion was successful.

void String::toUpper();

Converts the string to all uppercase characters.


void String::toLower();

Converts the string to all lowercase characters.


int String::find(const String& s);

Searches for the first occurrence of the given string. Returns the starting position of the found string, or -1 for failure.

const String& s : The string to search for.

int String::find(char ch);

Searches for the first occurrence of a character. Returns the position of the first occurrence, or -1 for failure.

char ch : The character to search for.

String String::subStr(int pos, int len);

Returns a substring.

int pos : The starting position.
int len : The length of the substring. A length less than 0 returns the rest of the string.

String String::left(int n);

Returns the first n characters of the string.

int n : The number of characters.

String String::right(int n);

Returns the last n characters of the string.

int n : The number of characters.

void String::truncate(int len);

Truncates the string to the specified length.

int len : The length of the string.

_________________________________________________________________
List

A templated linked list collection class. The list is singly-linked, and can be traversed using the first() / next() methods. The list can only store pointers to objects. Therefore, the declaration
   List‹ SomeClass › my_list;
declares a list of pointers of type SomeClass. Then, a list traversal is of the following form:
   SomeClass *ptr = my_list.first();
   while (ptr) {
     ...
     ptr = my_list.next();
   }


List::List();

Creates a new list class.


void List::setAutoDelete(bool b);

or when the the list itself is deleted.

bool b : Enable or disable auto-deletion.

void List::clear();

Empties the list of all objects, deleting them if auto-deletion is enabled.


int List::length();

Returns the length of the list.


type* List::first();

Returns the first object in the collection.


type* List::next();

Returns the next object in the collection.


void List::prepend(type* data);

Prepends an object to the beginning of the list.

type* data : A pointer to an instance of the appropriate object type.

void List::append(type* data);

Appends an object to the end of the list.

type* data : A pointer to an instance of the appropriate object type.

void List::insert(type* data, int index);

Inserts an object into the list at the specified position.

type* data : A pointer to an instance of the appropriate object type.
int index : The insertion position.

type* List::find(type* data);

Searchs the list for the specified object. NULL is returned if the object is not found, but otherwise a pointer to the object.

type* data : The object to search for.

type* List::unlink(type* data);

Unlinks an object from the list and returns a pointer to it. This is unaffected by auto-deletion.

type* data : The object to unlink.

bool List::remove(type* data);

Removes an object from the list. If auto-deletion is enabled, the object will be delete also. Returns true if the removal succeeded.

type* data : The object to remove.

_________________________________________________________________
Queue

A templated queue collection class. The queue is implemented as singly-linked list, and can be traversed from the front to the rear using the first() / next() methods. The queue can only store pointers to objects. Therefore, the declaration
   Queue‹ SomeClass › my_queue;
declares a list of pointers of type SomeClass. Then, a traversal is of the following form:
   SomeClass *ptr = my_queue.first();
   while (ptr) {
     ...
     ptr = my_queue.next();
   }

Elements are added and removed from the queue using the standard enqueue() and dequeue() methods.


Queue::Queue();

Creates a new queue class.


void Queue::setAutoDelete(bool b);

or when the the list itself is deleted.

bool b : Enable or disable auto-deletion.

void Queue::clear();

Empties the queue, deleting any objects if auto-deletion is enabled.


int Queue::length();

Returns the length of the queue. This is equivalent to itemCount().


int Queue::itemCount();

Returns the length of the queue. This is equivalent to length() .


type* Queue::first();

Returns the first object in the queue.


type* Queue::next();

Returns the next object in the queue.


void Queue::enqueue(type* data);

Enqueues an object to the end of the queue.

type* data : A pointer to an instance of the appropriate object type.

type* Queue::dequeue();

Removes the first item on the queue and returns it. If the queue is empty, NULL is returned.


void Queue::pushBack(type* data);

Pushes an element back into the queue, but at the front. This essentially undoes the dequeue() operation.

type* data : A pointer to an instance of the appropriate object type.

type* Queue::peek();

Returns the first object on the queue without removing it. NULL is returned if the queue is empty.


bool Queue::isEmpty();

Determines whether the queue has items in it.


_________________________________________________________________
Stack

A templated stack collection class. The stack is implemented as singly-linked list, and can be traversed from the top to the bottom using the first() / next() methods. The stack can only store pointers to objects. Therefore, the declaration
   Stack‹ SomeClass › my_stack;
declares a stack of pointers of type SomeClass. Then, a stack traversal is of the following form:
   SomeClass *ptr = my_stack.first();
   while (ptr) {
     ...
     ptr = my_stack.next();
   }

Elements are added and removed from the stack using the standard push() and pop() routines.


Stack::Stack();

Creates a new stack class.


void Stack::setAutoDelete(bool b);

or when the the list itself is deleted.

bool b : Enable or disable auto-deletion.

void Stack::clear();

Empties the stack, deleting any objects if auto-deletion is enabled.


int Stack::length();

Returns the length of the stack. This is equivalent to itemCount().


int Stack::itemCount();

Returns the length of the stack. This is equivalent to length() .


type* Stack::first();

Returns the top object in the stack.


type* Stack::next();

Returns the next object in the stack.


void Stack::push(type* data);

Pushes an object to the top of the stack.

type* data : A pointer to an instance of the appropriate object type.

type* Stack::pop();

Removes the top item on the stack and returns it. If the stack is empty, NULL is returned.


type* Stack::peek();

Returns the top object on the stack without removing it. NULL is returned if the stack is empty.


bool Stack::isEmpty();

Determines whether the stack has items in it.


_________________________________________________________________
StrHash

A templated string-key hash table collection class. The hash table is implemented with a chaining algorithm, and can be traversed using the first(..) / next(..) methods. The hash can only store pointers to objects. Therefore, the declaration
   StrHash‹ SomeClass › my_hash;
declares a string hash of pointers of type SomeClass. To traverse the elements in the table:
   String key = "";    SomeClass *ptr = my_hash.first( key );
   while (ptr) {
     ...
     ptr = my_hash.next( key );
   }


StrHash::StrHash(int size);

Construct a new string key hash table of a specified table size.

int size : The size of the table. Note that collisions are resolved with chaining.

void StrHash::setAutoDelete(bool b);

or when the the hash itself is deleted.

bool b : Enable or disable auto-deletion.

void StrHash::clear();

Empties the hash of all objects, deleting them if auto-deletion is enabled.


int StrHash::length();

Returns the number of items in the hash.


int StrHash::itemCount();

Returns the number of items in the hash.


void StrHash::resize(int new_size);

Resizes the hash table to the specified size. Note that this involves rehashing all the elements.

int new_size : The new size of the table.

void StrHash::insert(const String& key, type* data);

Insert a key-data pair into the table.

const String& key : The identifier key.
type* data : A pointer to the object identified by the key.

type* StrHash::remove(const String& key);

Remove a key-data pair from the table. If auto-deletion is off, a pointer to the object is returned.

const String& key : The identifier key.

type* StrHash::lookup(const String& key);

Search the table for a key-data pair. A pointer to the object is returned if is found, otherwise NULL.

const String& key : The identifier key.

type* StrHash::first(String& key);

Returns the first object in the table along with its key. Note that there is no rule imposed on what order objects are returned

String& key : This will be assigned the key of the object returned.

type* StrHash::next(String& key);

Returns the next object in the table along with its key. Note that there is no rule imposed on what order objects are returned

String& key : This will be assigned the key of the object returned.

_________________________________________________________________
PtrHash

A templated pointer-key hash table collection class. The hash table is implemented with a chaining algorithm, and can be traversed using the first(..) / next(..) methods. The hash can only store pointers to objects. Therefore, the declaration
   PtrHash‹ SomeClass › my_hash;
declares a pointer-key hash of pointers of type SomeClass. To traverse the elements in the table:
   Ptr key = NULL;    SomeClass *ptr = my_hash.first( key );
   while (ptr) {
     ...
     ptr = my_hash.next( key );
   }


PtrHash::PtrHash(int size);

Construct a new pointer key hash table of a specified table size.

int size : The size of the table. Note that collisions are resolved with chaining.

void PtrHash::setAutoDelete(bool b);

or when the the hash itself is deleted.

bool b : Enable or disable auto-deletion.

void PtrHash::clear();

Empties the hash of all objects, deleting them if auto-deletion is enabled.


int PtrHash::length();

Returns the number of items in the hash.


int PtrHash::itemCount();

Returns the number of items in the hash.


void PtrHash::resize(int new_size);

Resizes the hash table to the specified size. Note that this involves rehashing all the elements.

int new_size : The new size of the table.

void PtrHash::insert(CPtr key, type* data);

Insert a key-data pair into the table.

CPtr key : The identifier key.
type* data : A pointer to the object identified by the key.

type* PtrHash::remove(CPtr key);

Remove a key-data pair from the table. If auto-deletion is off, a pointer to the object is returned.

CPtr key : The identifier key.

type* PtrHash::lookup(CPtr key);

Search the table for a key-data pair. A pointer to the object is returned if is found, otherwise NULL.

CPtr key : The identifier key.

type* PtrHash::first(Ptr& key);

Returns the first object in the table along with its key. Note that there is no rule imposed on what order objects are returned

Ptr& key : This will be assigned the key of the object returned.

type* PtrHash::next(Ptr& key);

Returns the next object in the table along with its key. Note that there is no rule imposed on what order objects are returned

Ptr& key : This will be assigned the key of the object returned.

_________________________________________________________________
LinearHash

A templated string-key hash table collection class. The hash table is implemented with linear collision resolution, and can be traversed using the first(..) / next(..) methods. The hash can only store pointers to objects. Therefore, the declaration
   LinearHash‹ SomeClass › my_hash;
declares a string hash of pointers of type SomeClass. To traverse the elements in the table:
   String key = "";
   SomeClass *ptr = my_hash.first( key );
   while (ptr) {
     ...
     ptr = my_hash.next( key );
   }


LinearHash::LinearHash();

Construct a new linear string key hash table.


void LinearHash::setAutoDelete(bool b);

or when the the hash itself is deleted.

bool b : Enable or disable auto-deletion.

void LinearHash::clear();

Empties the hash of all objects, deleting them if auto-deletion is enabled.


int LinearHash::length();

Returns the number of items in the hash.


int LinearHash::itemCount();

Returns the number of items in the hash.


void LinearHash::grow();

Increases the table size of the hash. Note that this involves rehashing all the elements. The table is automatically grown when the load factor passes a threshold.


void LinearHash::insert(const String& key, type* data);

Insert a key-data pair into the table.

const String& key : The identifier key.
type* data : A pointer to the object identified by the key.

type* LinearHash::remove(const String& key);

Remove a key-data pair from the table. If auto-deletion is off, a pointer to the object is returned.

const String& key : The identifier key.

type* LinearHash::lookup(const String& key);

Search the table for a key-data pair. A pointer to the object is returned if is found, otherwise NULL.

const String& key : The identifier key.

type* LinearHash::first(String& key);

Returns the first object in the table along with its key. Note that there is no rule imposed on what order objects are returned

String& key : This will be assigned the key of the object returned.

type* LinearHash::next(String& key);

Returns the next object in the table along with its key. Note that there is no rule imposed on what order objects are returned

String& key : This will be assigned the key of the object returned.

_________________________________________________________________
Vector

This is a templated vector class. Unlike the Stack, *Hash, List, and Queue classes, the Vector stores objects directly, not pointers to them. That is, the declaration
   Vector‹ int › my_vec;
creates a vector of integers, and can be used just like an normal C-style array with the [] operators. Note that if a vector of objects is declared, for example
   Vector‹ SomeClass › my_obj_vec;
then the SomeClass class should make sure to properly override the '=' operator, and it must also have a default constructor. The vector class performs bounds checking, and aborts the application if an index is out of bounds.


Vector::Vector();

Constructs a new empty vector.


Vector::Vector(int size);

Constructs a new vector of the specified size.

int size : The initial size of the vector;

Vector::Vector(int size, const type& fill);

Constructs a new vector of the specified size and fills with a default element.

int size : The size of the vector.
const type& fill : The item to fill the vector with.

Vector::Vector(const Vector& vec);

Constructs a copy of an existing vector.

const Vector& vec : The vector to copy.

const Vector& Vector::operator=(const Vector& vec);

Assigns one vector to another.

const Vector& vec : The vector to assign.

type& Vector::operator[](int i);

Indexing operator to allow for assignment into the vector.
   my_vec[2] = 2.4;

int i : Specifies which item to return a reference to.

const type& Vector::operator[](int i);

Indexing operator to return elements in the vector.
   double val = my_vec[2];

int i : Specifies which element to return.

type& Vector::at(int i);

Indexing operator to allow for assignment into the vector. Equivalent to the [] operator.

int i : Specifies which index to return a reference to.

const type& Vector::at(int i);

Indexing operator to return elements in the vector. Equivalent to the [] operator.

int i : Specifies which element to return.

bool Vector::resize(int new_size, bool (=true) copy);

Resizes the vector and copies the old elements over. Returns whether the resize succeeded.

int new_size : The new size of the vector. If this is shorter than the current size, the vector is truncated which may result in data loss.
bool (=true) copy : Whether the copy the old elements. Defaults to true.

int Vector::length();

Returns the length of the array.


int Vector::size();

Returns the length of the array.


type* Vector::data();

Returns a pointer to the internal C-style array. Use of this function is strongly discouraged.


_________________________________________________________________
Tokenizer

The Tokenizer class provides a simple way to split delimited strings into tokens. The tokenizer can be configured to recognize any set of single characters as delimiters. A tokenizer can be used either with the hasTokens() and next() methods, or with the more flexible get() and unget() methods. When get(..) is called, it returns the next token in a queue of tokens. If the token is not ready to be accepted, it can be returned to the queue in the correct order with the unget() method, which can be called as many times as required. This way, the list of tokenized items can be traversed back and forth if necessary.


Tokenizer::Tokenizer();

Creates an empty space-delimited tokenizer.


Tokenizer::Tokenizer(const String& s);

Creates a new space-delimited tokenizer with the given input string.

const String& s : The string to tokenize.

Tokenizer::Tokenizer(const String& s, const String& dlms);

Creates a new tokenizer on the given input string with custom delimiters.

const String& s : The string to tokenize.
const String& dlms : A string of delimiter characters.

String Tokenizer::next();

Returns the next token in the input. Use in conjunction with hasTokens().


bool Tokenizer::isEmpty();

Determines whether the token queue is empty.


bool Tokenizer::get(String& pTok);

Gets the next token in the queue. Returns false if the queue was empty.

String& pTok : The string to assign the next token to.

bool Tokenizer::unget();

Ungets one token and puts it back on the front of the token queue. Returns false if a token could not be put back on the queue.


void Tokenizer::clearQueue();

Clears the token queue.


bool Tokenizer::hasTokens();

Returns whether tokens remain on the input string. Use with next().


int Tokenizer::getLastTokenEndPos();

Returns the ending position of the most recently processed token in the input string.


int Tokenizer::getCurrentPos();

Returns the current position of the tokenizer in the input string.


String Tokenizer::getRestOfInput();

Returns the rest of the unprocessed input string.


void Tokenizer::reset(const String& s);

Resets the tokenizer to a new input string. Note that this does not clear the token queue.

const String& s : The new input string.

void Tokenizer::setDelimiters(const String& dlms);

Changes the character delimiters.

const String& dlms : A string of single character delimiters.

String Tokenizer::getDelimiters();

Returns the current delimiters.


_________________________________________________________________
Button (extends Widget)

A simple command button widget. The Button is generally considered to be the most commonly used user-interface component. It allows the user to initiate some action when it is pressed.


Object Events
   Clicked The event generated when the button is pressed.

Button::Button();

Constructs a new command button.


void Button::activate();

Causes the button to generate a Click event just as if the user had clicked on the button.


void Button::setLabel(const String& pLabel);

Sets the text displayed on the button.

const String& pLabel : The new button label.

String Button::getLabel();

Returns the button's label.


_________________________________________________________________
Canvas (extends Widget)

A drawing area widget. This class provides general purpose drawing functions and generates events for low-level windowing system events. It also provides functions to draw and measure text in various fonts. The top-left origin coordinate is (0, 0).

Important note: Drawing functions can only be called from within the Paint() event handler! Calling drawing functions from outside this method will result in undefined behavior. Furthermore, changing the font, color, or line style outside of the Paint method may work in some contexts, but not others. To force the Canvas to generated a paint event, call the redraw() method.


Object Events
   Paint The canvas needs to be repainted.
   Resize The canvas was resized.
   MouseMove The mouse moved without a button being pressed.
   MouseDrag The mouse moved while a button was being held down.
   MousePress A mouse button was pressed.
   MouseRelease A mouse button was released.
   KeyDown A key was pressed.
   KeyUp A key was released.
   MouseEnter The mouse cursor entered the canvas area.
   MouseLeave The mouse cursor left the canvas area.
   GotFocus The canvas received the input focus.
   LostFocus The canvas lost the input focus.

Canvas::Canvas();

Creates a new drawing canvas.


void Canvas::setState(int pState);

Sets a internal flag to indicate what should be redrawn. For example, a mouse drag might set the state to '1', and call redraw(). Then the redraw method queries the state, and if it is '1', only draws what is necessary to respond to the mouse drag event. Any integer values can be used. The Canvas class itself does not query this value.

int pState : A value representing a drawing state.

int Canvas::getState();

Returns the internal state variable. See setState() for more information.


void Canvas::setColor(const Color& pColor);

Changes the current drawing color.

const Color& pColor : The new color.

void Canvas::setColor(const String& pName);

Changes the current drawing color.

const String& pName : A string-identified color. Set the Color class documentation for a list of recognized color names.

void Canvas::setColor(unsigned char r, unsigned char g, unsigned char b);

Changes the current drawing color.

unsigned char r : The red value.
unsigned char g : The green value.
unsigned char b : The blue value.

void Canvas::setFont(Font pFont, FontStyle pStyle, int pSize);

Changes the current text drawing font.

Font pFont : The new font. Recognized typefaces are TIMES, HELVETICA, and COURIER.
FontStyle pStyle : The font style. Possible styles are NORMAL, BOLD, ITALIC, and BOLD_ITALIC.
int pSize : The font size in pixels.

void Canvas::setDrawMode(DrawMode pMode);

Changes the way pixels are copied to the screen. STANDARD mode will simply copy the new pixel value over the existing one, while INVERT and XOR identify a logical function indicated how the new pixel value will be combined with the old one.

DrawMode pMode : The drawing mode. Accepted values are STANDARD, INVERT, and XOR.

void Canvas::setLineStyle(LineStyle pStyle, int (=0) pWidget);

Changes the current line style.

LineStyle pStyle : The new line style. Possible values are SOLID, DASHED, DOTTED, and DASHDOTTED.
int (=0) pWidget : The line width. Defaults to 0, which is a nice thin line.

void Canvas::pushClip(int pX, int pY, int pWidth, int pHeight);

Sets the current clipping region. This limits all drawing to the specified region. Anything drawn outside the region will not actually be drawn. Every call to pushClip() must be accompanied by a call to popClip(), or undefined behavior will result.

int pX : The X-coordinate.
int pY : The Y-coordinate.
int pWidth : The width of the clip region.
int pHeight : The height of the clip region.

void Canvas::popClip();

Restores the previous clipping region state.


void Canvas::drawPoint(int pX, int pY);

Draws a 1 pixel by 1 pixel point on the canvas with the current color.

int pX : The X-coordinate.
int pY : The Y-coordinate.

void Canvas::drawLine(int pX1, int pY1, int pX2, int pY2);

Draws a line in the current style and color between the two points indicated.

int pX1 : The starting X-coordinate.
int pY1 : The starting Y-coordinate.
int pX2 : The ending X-coordinate.
int pY2 : The ending Y-coordinate.

void Canvas::drawRect(int pX, int pY, int pWidth, int pHeight);

Draws a 1-pixel wide rectangle within the given bounding box.

int pX : The X-coordinate.
int pY : The Y-coordinate.
int pWidth : The width of the rectangle.
int pHeight : The height of the rectangle.

void Canvas::fillRect(int pX, int pY, int pWidth, int pHeight);

Fills the specified rectangular region with the current color.

int pX : The X-coordinate.
int pY : The Y-coordinate.
int pWidth : The width of the rectangle.
int pHeight : The height of the rectangle.

void Canvas::drawArc(int pX, int pY, int pWidth, int pHeight, double pAngle1, double pAngle2);

Draw an elliptical outline within the specified bounding box.

int pX : The X-coordinate.
int pY : The Y-coordinate.
int pWidth : The width of the bounding box.
int pHeight : The height of the bounding box.
double pAngle1 : The starting angle, measured in degrees, counterclockwise. 0 degrees is at 3 o'clock.
double pAngle2 : The ending angle, measured in degrees, counterclockwise. This must be greater than the starting angle.

void Canvas::fillArc(int pX, int pY, int pWidth, int pHeight, double pAngle1, double pAngle2);

Fill an elliptical area specified by bounding box with the current color.

int pX : The X-coordinate.
int pY : The Y-coordinate.
int pWidth : The width of the bounding box.
int pHeight : The height of the bounding box.
double pAngle1 : The starting angle, measured in degrees, counterclockwise. 0 degrees is at 3 o'clock.
double pAngle2 : The ending angle, measured in degrees, counterclockwise. This must be greater than the starting angle.

bool Canvas::drawXpm(char** pData, int pX, int pY);

Draws XPM image data with the top-left corner at the given position. The image is dithered on 8-bit displays. The current canvas color is used for transparent colors. Returns false if there was an error decoding the XPM data. Otherwise, returns true.

char** pData : The XPM pixmap data.
int pX : The top-left X coordinate.
int pY : The top-left Y coordinate.

Size Canvas::getXpmSize(char** pData);

Returns the size of an XPM image. Returns a size of (-1,-1) if there were errors decoding the image.

char** pData : The XPM pixmap data.

void Canvas::drawImage(unsigned char* pData, int pX, int pY, int pWidth, int pHeight, int(=3) pDepth);

Draws a 8-bit per color RGB image directly onto the canvas. Color data must be in RGB order. X, Y are where to put the top-left pixel.

unsigned char* pData : The image data.
int pX : The left-most pixel coordinate.
int pY : The top-most pixel coordinate.
int pWidth : The width of the image.
int pHeight : The height of the image.
int(=3) pDepth : The depth of the image in bytes per pixel. Defaults to 3.

void Canvas::drawMonoImage(unsigned char* pData, int pX, int pY, int pWidth, int pHeight);

Draws a 8-bit grayscale image directly onto the canvas. X, Y are where to put the top-left pixel.

unsigned char* pData : The grayscale image data.
int pX : The left-most pixel coordinate.
int pY : The top-most pixel coordinate.
int pWidth : The width of the image.
int pHeight : The height of the image.

void Canvas::drawString(int pX, int pY, const String& pStr);

Draws text on the canvas in the current font and style.

int pX : The X-coordinate, aligned to the left of the text.
int pY : The Y-coordinate, aligned to the baseline of the text in the current font.
const String& pStr : The string to draw.

void Canvas::drawText(int pX, int pY, const char* pStr, int pLen);

Draws text on the canvas in the current font and style.

int pX : The X-coordinate, aligned to the left of the text.
int pY : The Y-coordinate, aligned to the baseline of the text in the current font.
const char* pStr : The text to draw.
int pLen : The length of the text.

void Canvas::getTextExtent(int& pWidth, int& pHeight);

Measure the size of some text in the current font.

int& pWidth : The width will be assigned to this parameter.
int& pHeight : The height will be assigned to this parameter.

int Canvas::getStringWidth(const String& pStr);

Returns the width of the string in the current font.

const String& pStr : The string to measure.

int Canvas::getTextWidth(const char* pStr, int pLen);

Returns the width of the text in the current font.

const char* pStr : The string to measure.
int pLen : The length of the string.

int Canvas::getFontHeight();

Returns the height of the current font from the baseline.


int Canvas::getFontDescent();

Returns the number of pixels the font descends below the baseline.


_________________________________________________________________
CheckBox (extends Widget)

A simple toggleable check box widget.


Object Events
   Toggled The event generated when the checkbox changes state.

CheckBox::CheckBox();

Constructs a new checkbox.


void CheckBox::setLabel(const String& pLabel);

Sets the text displayed on the checkbox.

const String& pLabel : The new checkbox label.

String CheckBox::getLabel();

Returns the checkbox's label.


void CheckBox::setState(bool pState);

Changes the state of the checkbox. Note that this does not generate a Toggle event.

bool pState : The new state.

bool CheckBox::getState();

Returns the current state of the checkbox.


void CheckBox::toggle();

Changes to the opposite state. This generates a Toggled event.


_________________________________________________________________
Choice (extends Widget)

The Choice widget provides a drop-down selection box that allows the user to choose from a list of choices. The widget displays the current string item, and presents a popup list when the widget is clicked on. A selection event is generated when the user changes the current selection. The drop-down menu of the Choice widget can display a multi-level submenu. Text of the form "Foo/Bar/Sap" will result in a toplevel item named "foo", a submenu "bar", and an item "sap" under the "bar" submenu. Appending "Foo/Bar/Maple" will append an item named "maple" under the "bar" submenu. The menu structure is:
   Foo
   +-    Bar
         +-    Sap
         +-    Maple


Object Events
   Selected The user changed the current selection.

Choice::Choice();

Constructs a new Choice widget.


void Choice::setChoices(const StringArray& pChoices);

Sets the choices available in the drop-down list.

const StringArray& pChoices : The array of strings to display.

StringArray Choice::getChoices();

Returns a StringArray with the currently available choices.


void Choice::clear();

Removes all the choices from the list.


void Choice::append(const String& The);

Appends an item to the end of the list of choices.

const String& The : new choice.

int Choice::find(const String& pItem);

Determines whether a given string is one of the choices. Returns the index of the choice, or -1 if doesn't exit.

const String& pItem : The item to search for.

int Choice::getSelection();

Returns the index of the currently selected item.


String Choice::getSelectionString();

Returns the text of the currently selected item.


void Choice::setSelection(int pIndex);

Changes the current selection.

int pIndex : The index of the new selection. If the index is out of the range, nothing happens.

void Choice::setSelection(const String& pStr);

Changes the current selection.

const String& pStr : The string to make the current selection. Nothing happens if the string is not a choice.

void Choice::setString(int pIndex, const String& pStr);

Changes the text of one of the choices.

int pIndex : The index of the item to change.
const String& pStr : The new text for the choice.

String Choice::getString(int pIndex);

Returns the text of the item at the specified index.

int pIndex : The index of the item whose text to return.

int Choice::getLength();

Returns the number of items in the choice.


_________________________________________________________________
Container

A generic container widget that can hold other widgets. An instance of a Container cannot be created directly, but its descendent classes Window and FrameBox are frequently used.


void Container::addChild(Widget* pWidget);

Adds a child to the collection.

Widget* pWidget : The widget to add.

void Container::removeChild(Widget* pWidget);

Removes a child widget from the collection.

Widget* pWidget : The widget to remove.

bool Container::isChild(Widget* pWidget);

Checks if a widget is a child of this container.

Widget* pWidget : The widget to check for.

void Container::showAll();

Makes all the children visible.


void Container::hideAll();

Makes all the children not visible.


void Container::forEach(void (*cb)(Widget *child, void *data) pCallback, void* pData);

Calls the given callback function for each child widget.

void (*cb)(Widget *child, void *data) pCallback : The callback function to call.
void* pData : The data to pass to each callback function.

_________________________________________________________________
Counter (extends Valuator)

This class provides a numeric input mechanism. Most methods generally used with a slider are handled by the parent class Valuator.


Counter::Counter();

Constructs a new Counter widget.


_________________________________________________________________
Event

The event class describes the circumstances under which an event occured. Not all the values possibly stored in the Event class are filled in by each different type of event. Refer to each class's object event documentation to see which values are set by that type of event.


Event::Event();

Constructs a new event object with the default values.


bool Event::getState();

Returns the boolean state of the event. For example, a Toggle widget sets this to its state.


Size& Event::getSize();

Returns the size. Generally used by Resize events.


Point& Event::getPoint();

Returns the point location of the event. Generally used by Canvas mouse events.


String& Event::getString();

Returns the string of the event. Choice selections and Canvas key events are some events that set this field.


int Event::getButton();

Returns the button of the event. Canvas mouse events use this field, for example.


bool Event::getCtrl();

Returns whether the Control key was pressed when the event happened. Canvas mouse and keyboard events use this field.


bool Event::getShift();

Returns whether the Shift key was pressed when the event happened. Canvas mouse and keyboard events use this field.


bool Event::getAlt();

Returns whether the Alt/Meta key was pressed when the event happened. Canvas mouse and keyboard events use this field.


int Event::getIndex();

Returns any index that may be associated with the event. A Choice selection event fills this field, for example.


int Event::getId();

Returns any identification number that might be associated with this event. Timer events supply the id, for example.


int Event::getKey();

Returns the unshifted ASCII code corresponding to the key press. This may also be a KEY_* constant for non-printing characters. Canvas key events use this field.


void Event::accept();

Indicates that the event handler accepted the event. This is used mostly for window close events. For detail on how the window closing mechanism works, see the Window class documentation.


void Event::decline();

Indicates that the event handler declined the event. This is used mostly for window close events. For detail on how the window closing mechanism works, see the Window class documentation.


_________________________________________________________________
FrameBox (extends Container)

A decorative container that holds other widgets while drawing a nice engraved border around them. A FrameBox is generally used to group widgets with related functionality together.


FrameBox::FrameBox();

Constructs a new FrameBox.


_________________________________________________________________
Graph (extends Canvas)

A 2-D plotting widget that draws plots. It provides zooming and auto-scaling capabilites, and can also automatically calculate appropriate grid line and tick mark spacings. It also provides two X-Y cursors. They can be locked to a specified plot.
Note: Modifying a plot's rendering properties, or other graphing widget properties may require calling the redraw() method to realize the changes on the screen.


Object Events
   CursorMoved An event indicating the movement of a cursor.
   RangeChanged An event generated when the domain or codomain of the graph change.

Graph::Graph();

Constructs a new graphing widget.


PlotId Graph::plotData(PlotId id, PointF* points, int count);

Plots the given data points using the specified styling, and returns the plot identifier.

PlotId id : The plot identifier. Can be NEW_PLOT to create a new plot the next available identifier.
PointF* points : The data points in x-y coordinates.
int count : The number of data points.

PlotId Graph::plotData(PlotId id, double* xvals, double* yvals, int count);

Plots the given data points using the specified styling, and returns the plot identifier.

PlotId id : The plot identifier. Can be NEW_PLOT to create a new plot the next available identifier.
double* xvals : An array of X coordinates.
double* yvals : An array of Y coordinates.
int count : The number of data points.

PlotId Graph::plotData(PlotId id, const Vector& points, const Vector& points, int count);

Plots the given data points using the specified styling, and returns the plot identifier.

PlotId id : The plot identifier. Can be NEW_PLOT to create a new plot the next available identifier.
const Vector& points : The vector of X coordinates.
const Vector& points : The vector of Y coordinates.
int count : The number of data points.

PlotId Graph::plotData(PlotId id, const Vector& points, int count);

Plots the given data points using the specified styling, and returns the plot identifier.

PlotId id : The plot identifier. Can be NEW_PLOT to create a new plot the next available identifier.
const Vector& points : The vector of X-Y coordinates.
int count : The number of data points.

Color Graph::disable(PlotId id);

Disables the specified plot.

PlotId id : The plot identifier.

Color Graph::getPlotColor(PlotId id);

Returns the rendering color of the plot.

PlotId id : The plot identifier.

void Graph::setPlotColor(PlotId id, const Color& pColor);

Sets the rendering color of the plot.

PlotId id : The plot identifier.
const Color& pColor : The color.

int Graph::getThickness(PlotId id);

Returns the current thickness with which the plot is rendered.

PlotId id : The plot identifier.

void Graph::setThickness(PlotId id, int pPixels);

Sets the line thickness of the plot.

PlotId id : The plot identifier.
int pPixels : The thickness in pixels.

void Graph::setStyle(PlotId id, PlotStyle pStyle);

Changes the way the plot is rendered.

PlotId id : The plot identifier.
PlotStyle pStyle : The new rendering style.

PlotStyle Graph::getStyle(PlotId id);

Returns the current plot rendering style.

PlotId id : The plot identifier.

bool Graph::isVisible(PlotId id);

Returns whether the plot is visible or not.

PlotId id : The plot identifier.

void Graph::setVisible(PlotId id, bool pShow);

Changes whether the specified plot is drawn on the graph or not.

PlotId id : The plot identifier.
bool pShow : Whether the show the plot or not.

String Graph::getFileName(PlotId id);

Returns the file name of the plot. Returns an empty string if the plot has not been saved.

PlotId id : The plot identifier.

bool Graph::save(PlotId id);

Saves the specified plot to the current file name. If the plot has not been saved yet, the saveAs() method must be called first to set the file name.

PlotId id : The plot identifier.

bool Graph::saveAs(PlotId id, const String& fn);

Saves the specified plot to the specified file name, and updates the plot's file name.

PlotId id : The plot identifier.
const String& fn : The file name.

bool Graph::load(PlotId id, const String& fn);

Loads plot data from the given file into the specified plot. Upon success it updates the file name.

PlotId id : The plot identifier.
const String& fn : The file name.

void Graph::setX(PlotId id, int i, double x);

Set the X-coordinate of the i-th point in the specified plot.

PlotId id : The plot identifier.
int i : The index of the point.
double x : The X-coordinate.

void Graph::setY(PlotId id, int i, double y);

Set the Y-coordinate of the i-th point in the specified plot.

PlotId id : The plot identifier.
int i : The index of the point.
double y : The Y-coordinate.

PointF Graph::get(PlotId id, int i);

Returns the i-th point of the specified plot.

PlotId id : The plot identifier.
int i : The index of the point.

void Graph::set(PlotId id, int i, double x, double y);

Sets the X and Y coordinates of the i-th point on the specified plot.

PlotId id : The plot identifier.
int i : The index of the point.
double x : The X-coordinate value.
double y : The Y-coordinate value.

void Graph::set(PlotId id, int i, const PointF& p);

Sets the X and Y coordinates of the i-th point on the specified plot.

PlotId id : The plot identifier.
int i : The index of the point.
const PointF& p : The new point.

int Graph::getCount(PlotId id);

Returns the number of points in the specified plot.

PlotId id : The plot identifier.

void Graph::autoScale();

Automatically computes the X and Y ranges so that all the graphs are visible simultaneously. It may be necessary to call the redraw() method to ensure that the changes are reflected on the screen.


void Graph::autoScaleToPlot(PlotId id, ScalingType (=BOTH) scaling);

Automatically scales the graph to the given plot. The scaling may be along only one axis or both, specified by XAXIS, YAXIS, or BOTH.

PlotId id : The plot to scale the graph to.
ScalingType (=BOTH) scaling : Specifies the scaling axis.

void Graph::zoomIn();

Zooms in on the graph.


void Graph::zoomOut();

Zooms out on the graph.


bool Graph::setXRange(double min, double max);

Changes the X-axis range to the specifed minimal and maximal values. This method returns false if the range was invalid, but otherwise generates a RangeChanged event and returns true.

double min : The minimum X value.
double max : The maximum X value.

bool Graph::setYRange(double min, double max);

Changes the Y-axis range to the specifed minimal and maximal values. This method returns false if the range was invalid, but otherwise generates a RangeChanged event and returns true.

double min : The minimum Y value.
double max : The maximum Y value.

void Graph::setCursorVisible(CursorId cid, bool v);

Changes the visiblity of the specified cursor. If the visibility of the cursor changes, a CursorVisibility is generated with the cursor id available from the Event::getId() method. There are four possible cursor ids: X1, Y1, X2, Y2.

CursorId cid : Specifies which cursor. (i.e. Graph::X1, or Graph::Y2)
bool v : Whether to show the cursor or not.

bool Graph::isCursorVisible(int c);

Returns the visibility state of a cursor.

int c : The cursor id.

PointF Graph::getCursorPos(int c);

Returns the current position of a cursor.

int c : The cursor id.

void Graph::lockCursor(CursorId id, PlotId id, bool interpolate);

Locks the specified cursor to the given plot.

CursorId id : The cursor id.
PlotId id : The plot id.
bool interpolate : Whether to interpolate between points.

void Graph::unlockCursor(CursorId id);

Unlocks the specified cursor from any plot that it may be locked to.

CursorId id : The cursor id.

double Graph::getXMin();

Returns the minimum X-value of the x-axis range.


double Graph::getXMax();

Returns the maximum X-value of the x-axis range.


double Graph::getYMin();

Returns the minimum Y-value of the y-axis range.


double Graph::getXMax();

Returns the maximum Y-value of the y-axis range.


void Graph::setXLabel(const String& s);

Changes the X-axis text label.

const String& s : The new label.

void Graph::setYLabel(const String& s);

Changes the Y-axis text label.

const String& s : The new label.

void Graph::drawTicksAsDottedLines(bool b);

Changes whether tick marks are draw as full dotted lines or simply ticks along the axes.

bool b : Whether to draw ticks as dotted lines or not.

void Graph::setAutoCalculateGrid(bool b);

Sets whether the grid and tick spacing is calculated automatically.

bool b : To enable grid auto-calculation or not.

void Graph::setTicksPerDivX(int i);

Sets how many tick marks there are between each grid line in the X direction.

int i : The number of divisions.

void Graph::setTicksPerDivY(int i);

Sets how many tick marks there are between each grid line in the Y direction.

int i : The number of divisions.

void Graph::setGridSpacingX(double i);

Sets the interval at which grid lines are drawn in the X direction.

double i : The grid spacing.

void Graph::setGridSpacingY(double i);

Sets the interval at which grid lines are drawn in the Y direction.

double i : The grid spacing.

_________________________________________________________________
Label (extends Widget)

This widget displays a static piece of text on the screen. The label can be modified with the appropriate functions.


Label::Label();

Constructs a new label widget.


void Label::setLabel(const String& pLabel);

Sets the text displayed.

const String& pLabel : The new label.

String Label::getLabel();

Returns the currently displayed text.


_________________________________________________________________
ListBox (extends Widget)

The ListBox widget displays a scrolling list of text lines. A user can select one line at a time, and the text list can be manipulated with the standard addition and removal functions.


Object Events
   Selected An event generated when the user selects an item. The event's getIndex() returns the index of the selection.

ListBox::ListBox();

Constructs a new ListBox widget.


void ListBox::append(const String& s);

Appends the specified string to the end of the list.

const String& s : The string to append.

void ListBox::prepend(const String& s);

Prepends the specified string to the beginning of the list.

const String& s : The string to prepend.

void ListBox::insert(const String& s, int index);

Inserts a string to a specified location in the list.

const String& s : The string to insert.
int index : The insertion index.

void ListBox::remove(int index);

Removes the string at the given index. If the index is out of range, nothing happens.

int index : The index of the string to remove.

int ListBox::find(const String& s);

Searches the list for a string. Returns the index of the first occurence if found, otherwise returns -1.

const String& s : The string to search for.

void ListBox::clear();

Empties the list box.


int ListBox::getLength();

Returns the number of items in the list.


String ListBox::getText(int i);

Returns the text at the specified index.

int i : Specifies which string to return.

void ListBox::setText(int index, const String& pStr);

Changes the text displayed at the given index.

int index : The index of the item to change.
const String& pStr : The new text.

void ListBox::setData(const StringArray& pStrs);

Clears the list and inserts the items in the string array.

const StringArray& pStrs : The strings.

int ListBox::getSelection();

Returns the index of the currently selected item, or -1 if no item is selected.


void ListBox::setSelection(int pIndex);

Changes the current selection.

int pIndex : The index of the new selection. If the index is out of the range, nothing happens.

void ListBox::deselect();

Unselects any selected items in the list.


bool ListBox::isLineVisible();

Returns whether the ith line visible.


void ListBox::setTopLine(int i);

Scrolls the list box to set the ith element as the top line.

int i : The line index.

int ListBox::getTopLine();

Returns the index of the current top line visible.


void ListBox::setMiddleLine(int i);

Scrolls the list box to make the ith line the middle line in the view.

int i : The item's index.

void ListBox::setBottomLine(int i);

Scrolls the list box to make the ith line the bottom line in the view.

int i : The item's index.

int ListBox::getScrollPos();

Returns the current scroll position as an integer value.


int ListBox::setScrollPos();

Sets the current scroll position.


_________________________________________________________________
MenuBar (extends Widget)

The MenuBar widget provides a hierarchical menu widget. The items can be standard menu items, or check items. Accelerator shortcuts can be assigned to menu items also. Each menu item has a unique string path that identifies it in the hierarchy. For example, "File/New" would identify the New item in the File menu. For deeper menus, simply extend the hierarchy: "Edit/Preferences/General Preferences/Set Color...". The following sample creates a minimal menubar for a text editor.
   MenuBar *mbar = new MenuBar;
   mbar->append("File/New", false, true, 'n', MOD_CTRL);
   mbar->append("File/Open", false, false, 'o', MOD_CTRL);
   mbar->append("File/Save", false, false, 's', MOD_CTRL);
   mbar->append("File/Save As", false, true);
   mbar->append("File/Quit");
   mbar->append("Edit/Cut", false, false, 'x', MOD_CTRL);
   mbar->append("Edit/Copy", false, false, 'c', MOD_CTRL);
   mbar->append("Edit/Paste", false, false, 'v', MOD_CTRL);
   mbar->append("Help/About", false, false, 'a', MOD_ALT);

To handle menu events, simply check the event's string in the MenuBar's Activated event handler.
   void SomeWindow::OnMenuBar1Activated( Event &pEvt ) {
     if (pEvt.getString() == "File/New") {
       // code to create a new file
     } else if (pEvt.getString() == "File/Open") {
       // code to open a file
     }
   }


Object Events
   Activated An event generated when a menu item is activated. The getString() method of the event returns the full path of the menu item that was clicked (i.e. "File/Open")

MenuBar::MenuBar();

Creates a new menu bar widget.


void MenuBar::setItems(const StringArray& pItems);

Adds all the items in the array into the menu. The items default to a standard menu item, with no separators, and no accelerators.

const StringArray& pItems : The hierarchical menu item paths.

void MenuBar::append(const String& pMenuPath, bool (=false) pCheckable, bool (=false) pWithSep, char (=0) pAccel, KeyModifier (=MOD_NONE) pMod, enabled (=true) pEnabled);

Appends a menu item onto the menu bar.

const String& pMenuPath : The hierarchical menu path identifying the item.
bool (=false) pCheckable : Whether the item is a check item or a normal one. Defaults to false (a normal item).
bool (=false) pWithSep : Whether the menu item is followed by a separator.
char (=0) pAccel : The character of the shortcut. Defaults to 0, which stands for no shortcut.
KeyModifier (=MOD_NONE) pMod : The modifier for the shortcut.
enabled (=true) pEnabled : Whether the menu item is enabled. If it is disabled, the item is grayed out.

void MenuBar::remove(const String& pPath);

Removes the specified menu item.

const String& pPath : The path to the menu item.

void MenuBar::check(const String& pPath, bool pState);

Changes the state of a checkable menu item.

const String& pPath : The path to the check item.
bool pState : The new state of the check item.

bool MenuBar::isChecked(const String& pPath);

Returns the state of a check item.

const String& pPath : The path to the check item.

void MenuBar::enable(const String& pPath, bool pState);

Enables or disables a menu item. Disabled items are grayed out and cannot be selected.

const String& pPath : The path to the menu item.
bool pState : The enabled state of the menu item.

bool MenuBar::isEnabled(const String& pPath);

Returns whether a menu item is enabled or disabled.

const String& pPath : The path to the menu item.

_________________________________________________________________
PasswordEntry (extends TextInput)

This class provides a password entry widget that masks the input characters with a symbol on the screen. The underlying text can be worked with using the methods of the TextInput base class.


PasswordEntry::PasswordEntry();

Constructs a new password widget.


_________________________________________________________________
RadioButton (extends Widget)

A simple toggleable radio button widget.


Object Events
   Toggled The event generated when the radio button changes state.

RadioButton::RadioButton();

Constructs a new radio button.


void RadioButton::setLabel(const String& pLabel);

Sets the text displayed on the radio button.

const String& pLabel : The new radio button label.

String RadioButton::getLabel();

Returns the radio button's label.


void RadioButton::setState(bool pState);

Changes the state of the radio button. Note that this does not generate a Toggle event.

bool pState : The new state.

bool RadioButton::getState();

Returns the current state of the radio button.


void RadioButton::toggle();

Changes to the opposite state. This generates a Toggled event.


_________________________________________________________________
Scrollbar (extends Valuator)

This class provides a horizontal or vertical scrollbar to provide scrolling capabilities, or a numeric input mechanism. Most methods generally used with a scrollbar are handled by the parent class Valuator.


Scrollbar::Scrollbar();

Constructs a new Scrollbar widget.


void Scrollbar::setVertical(bool b);

Sets the orientation for the scrollbar. The default is horizontal.

bool b : True for a vertical scrollbar.

void Scrollbar::setSliderSize(float f);

Sets the dimension of the moving part of the slider. This is the fraction of the size of the whole widget. The default is 0.08.

float f : The percent of the size of the widget to make the sliding part.

float Scrollbar::getSliderSize();

Returns the size of the slider as a precentage of the size of the whole widget.


int Scrollbar::getIntValue();

Returns the integer value of the slider. To get the floating point value, use Valuator::getValue().


int Scrollbar::setScrollValue(int position, int size, int top, int total);

Sets the range, value, and slider size of the scrollbar to make a variable sized one. This method should be called from the callback, including when the data changes size, the window is resized, or the scroll position changes.

int position : The current position.
int size : The size of the data unit.
int top : The topmost visible unit of the data.
int total : The number of data units.

void Scrollbar::setLineSize(int i);

Controls how big the steps are that the arrow keys make. The default is 16.

int i : The number of steps to take for an arrow key press.

int Scrollbar::getLineSize();

Returns the number of steps take for an arrow key press.


_________________________________________________________________
TextEditor (extends Widget)

A heavy-duty multi-line text editor that can display large text files. The editor provides its own scrollbars in both the horizontal and vertical directions. The widget also provides methods for saving and loading text files, as well as for searching for text strings. The text is rendered in a fixed monospace typeface.


Object Events
   Changed An event generated when the text changes. The number of characters inserted is stored in pEvt.getPoint().x, the number of characters deleted in pEvt.getPoint().y, the text that was deleted in pEvt.getString(), and the current insertion position in pEvt.getIndex().

TextEditor::TextEditor();

Constructs a new text editor widget.


void TextEditor::setText(const String& pText);

Sets the text in the editor.

const String& pText : The text string.

String TextEditor::getText();

Returns the entire text in the editor.


String TextEditor::getText(int pStart, int pEnd);

Returns the text between the specified start and end positions.

int pStart : The starting position.
int pEnd : The ending position.

char TextEditor::getCharAt(int pPos);

Returns the character at the specified position.

int pPos : The position.

void TextEditor::clear();

Removes all the text from the editor.


void TextEditor::insert(const String& pText);

Inserts text at the current insertion position.

const String& pText : The text to insert.

void TextEditor::insert(int pStart, const String& pText);

Inserts text at the given insertion position.

int pStart : The insertion position.
const String& pText : The text to insert.

void TextEditor::remove(int pStart, int pEnd);

Removes a range of text between the given positions.

int pStart : The starting position.
int pEnd : The ending position.

void TextEditor::replace(int pStart, int pEnd, const String& pText);

Replaces the range of text between the given positions with new text.

int pStart : The starting position.
int pEnd : The ending position.
const String& pText : The new text.

void TextEditor::replaceSelection(const String& pText);

Replaces the current selection with new text.

const String& pText : The new text.

void TextEditor::append(const String& pText);

Appends some text to the end of the buffer.

const String& pText : The text to append.

int TextEditor::getLength();

Returns the length of the text stored in the editor.


bool TextEditor::loadFile(const String& pFileName);

Attempts to load the text file specified, returning true on success.

const String& pFileName : The file name.

bool TextEditor::saveFile(const String& pFileName);

Attempts to save the text to the file specified, returning true on success.

const String& pFileName : The file name.

void TextEditor::setCursorPos(int pPos);

Changes the current insertion position.

int pPos : The new position.

int TextEditor::getCursorPos();

Returns the current insertion position.


void TextEditor::cut();

Cuts the selected text to the clipboard.


void TextEditor::copy();

Copies the selected text to the clipboard.


void TextEditor::paste();

Pastes any text on the system clipboard into the editor, replacing any selection.


int TextEditor::getLineStartPos(int pPos);

Returns the position of the start of the line containing the specified position.

int pPos : The position.

int TextEditor::getLineEndPos(int pPos);

Returns the position of the end of the line containing the specified position.

int pPos : The position.

void TextEditor::select(int pStart, int pEnd);

Selects the text in the specified range.

int pStart : The starting position.
int pEnd : The ending position.

void TextEditor::selectAll();

Selects all of the text in the editor.


void TextEditor::unselect();

Unselects the current selection.


bool TextEditor::searchForward(int pStart, const String& pStr, int* pPos, bool (=false) pMatchCase);

Searches for text starting from the given position forward. Returns whether the text was found or not.

int pStart : The starting position for the search.
const String& pStr : The text to search for.
int* pPos : An integer to assign the starting position of the found text, if the text was found.
bool (=false) pMatchCase : Whether to match case or not. Defaults to false.

bool TextEditor::searchBackward(int pStart, const String& pStr, int* pPos, bool (=false) pMatchCase);

Searches for text starting from the given position backwards. Returns whether the text was found or not.

int pStart : The starting position for the search.
const String& pStr : The text to search for.
int* pPos : An integer to assign the starting position of the found text, if the text was found.
bool (=false) pMatchCase : Whether to match case or not. Defaults to false.

void TextEditor::showInsertPos();

Ensures that the insertion position is visible.


int TextEditor::getTabWidth();

Returns the current tab width.


void TextEditor::setTabWidth(int pWidth);

Sets the display width of tabs.

int pWidth : The tab width.

_________________________________________________________________
TextEntry (extends TextInput)

This class provides a simple single line text entry widget. The underlying text can be worked with using the methods of the TextInput base class.


TextEntry::TextEntry();

Constructs a new text field widget.


_________________________________________________________________
TextInput (extends Widget)

The TextInput class provides a base class for single line text manipulation widgets. It cannot be instantiated on its own, but its direct descendants TextEntry and PasswordEntry are frequently used in graphical applications.


Object Events
   Changed An event generated when the text changes.
   Activated An event generated when the Enter key is pressed in the entry.

void TextInput::setText(const String& pText);

Sets the text in the entry.

const String& pText : The text string.

String TextInput::getText();

Returns the text in the entry.


void TextInput::clear();

Removes all the text.


int TextInput::getLength();

Returns the length of the text stored in the entry.


void TextInput::setCursorPos(int pPos);

Changes the current insertion position.

int pPos : The new position.

int TextInput::getCursorPos();

Returns the current insertion position.


void TextInput::setMaxLength(int l);

Changes the maximum length of an accepted string in the entry.

int l : The new maximum length.

int TextInput::getMaxLength();

Returns the maximum length of strings accepted.


void TextInput::select(int pStart, int pEnd);

Selects the text in the specified range.

int pStart : The starting position.
int pEnd : The ending position.

void TextInput::selectAll();

Selects all of the text in the editor.


void TextInput::setEditable(bool pEditable);

Changes whether the text in the entry is editable.

bool pEditable : To enable editing or not.

bool TextInput::isEditable();

Returns whether the entry is user-editable.


void TextInput::setValue(int v);

Sets the text to the integer numeric value.

int v : The value.

void TextInput::setValue(double v, int d);

Sets the text to the double numeric value.

double v : The value.
int d : Number of decimal places. Defaults to 3

int TextInput::getIntValue();();

Gets the integer value of the text.


double TextInput::getFloatValue();();

Gets the double value of the text.


_________________________________________________________________
Timer

A timer class that provides evenly spaced timeout events to an application. The timeout period is specified in seconds using a floating point value for fractional parts of seconds. A timer can be a one-time timeout or can timeout repeatedly.


Object Events
   Timeout An event generated when the timeout happens.

Timer::Timer();

Constructs a new timer.


void Timer::setOnlyOnce(bool once);

Sets whether the timeout happens once or repeatedly, and starts the timer.

bool once : True for single timeout, false for repeated ones.

void Timer::setTimeout(double pSecs);

Sets the timeout period and starts the timer.

double pSecs : The timeout in seconds.

bool Timer::getOnlyOnce();

Returns whether the timer is a single-shot type or not.


double Timer::getTimeout();

Returns whether the timeout value in seconds


void Timer::start(double secs, bool once);

Starts the timer with the specified values.

double secs : The timeout in seconds.
bool once : Whether to cause a single timeout or repeated ones.

void Timer::stop();

Stops the timer.


bool Timer::isRunning();

Returns whether the timer is currently running.


_________________________________________________________________
Toggle (extends Widget)

The Toggle widget provides a boolean input control. The widget can display different text for the on and off states, and the current state is reflected by a yellow indicator light.


Object Events
   Toggled An event generated when the toggle changes state.

Toggle::Toggle();

Constructs a new toggle widget.


void Toggle::setOnLabel(const String& pText);

Changes the text displayed when the toggle is on.

const String& pText : The text label.

void Toggle::setOffLabel(const String& pText);

Changes the text displayed when the toggle is off.

const String& pText : The text label.

String Toggle::getOnLabel();

Returns the text displayed when the toggle is on.


String Toggle::getOffLabel();

Returns the text displayed when the toggle is off.


void Toggle::setState(bool pState);

Changes the state of the toggle. Note that this does not generate a Toggle event.

bool pState : The new state.

bool Toggle::getState();

Returns the current state of the toggle.


void Toggle::toggle();

Changes to the opposite state. This generates a Toggled event.


_________________________________________________________________
Size

This class stores a width and a height.


Size::Size();

Constructs a new Size object with 0 width and 0 height.


Size::Size(int pWidth, int pHeight);

Constructs a new Size object with the given width and height.

int pWidth : The width.
int pHeight : The height.

int Size::getWidth();

Returns the width.


int Size::getHeight();

Returns the height.


void Size::set(int pWidth, int pHeight);

Sets the size.

int pWidth : The width.
int pHeight : The height.

_________________________________________________________________
Point

A storage unit for integral x and y coordinates. The x and y coordinates can be accessed directly. For example:
   Point pt;
   pt.x = 1;
   pt.y = 2;


Point::Point();

Constructs a new point.


Point::Point(int x, int y);

Constructs a new point with the specified x and y values.

int x : The X-value.
int y : The Y-value.

void Point::set(int x, int y);

Sets the x and y values.

int x : The X-value.
int y : The Y-value.

double Point::distance(const Point& p1, const Point& p2);

Calculates the distance between the two points. Note that this is a static function.

const Point& p1 : The first point.
const Point& p2 : The second point.

_________________________________________________________________
PointF

A storage unit for floating point x and y coordinates. The x and y coordinates can be accessed directly. For example:
   PointF pt;
   pt.x = 1.98;
   pt.y = 2.23;


PointF::PointF();

Constructs a new point with double precision coordinates.


PointF::PointF(double x, double y);

Constructs a new PointF with the specified x and y values.

double x : The X-value.
double y : The Y-value.

void PointF::set(double x, double y);

Sets the x and y values.

double x : The X-value.
double y : The Y-value.

double PointF::distance(const PointF& p1, const PointF& p2);

Calculates the distance between the two points. Note that this is a static function.

const PointF& p1 : The first point.
const PointF& p2 : The second point.

double PointF::distanceTo(const PointF& p1);

Calculates the distance to the given point.

const PointF& p1 : The point.

_________________________________________________________________
Color

This class holds color information for drawing. A database of string-identified predefined colors is maintained for convenience. A partial list is given here:
   "red"
   "green"
   "blue"
   "gray"
   "light gray"
   "black"
   "white"
   "yellow"
   "violet"
The R-G-B color data is stored as three unsigned char member variables. These can be modified directly, as shown below:
   Color my_color;
   my_color.red = 0xE2;
   my_color.green = 0xA7;
   my_color.blue = 0x09;


Color::Color();

Constructs a new Color object, defaulting to black.


Color::Color(const String& pName);

Constructs a new Color object with the specified string identifier.

const String& pName : The color's database name.

Color::Color(unsigned char r, unsigned char g, unsigned char b);

Constructs a new Color object with the specified R-G-B values.

unsigned char r : The red value.
unsigned char g : The green value.
unsigned char b : The blue value.

const Color& Color::operator=(const String& pName);

Changes the color to the one specified by the name.

const String& pName : The database color name.

void Color::set(const String& pName);

Sets the color.

const String& pName : The color's database name.

Color::set(unsigned char r, unsigned char g, unsigned char b);

Sets the color.

unsigned char r : The red value.
unsigned char g : The green value.
unsigned char b : The blue value.

_________________________________________________________________
Valuator (extends Widget)

The Valuator class provides a base class for numeric input widgets. It cannot be instantiated on its own, but its direct descendants Scrollbar, Counter, Slider, ValueSlider, ValueInput, and ValueOutput are frequently used widgets.


Object Events
   Changed An event generated when the value changes. No information is stored in the event structure, so use the Valuator methods to obtain the value.

double Valuator::clamp(double value);

Clamps the given value to the range of the slider and returns the clamped value.

double value : The value to clamp.

double Valuator::round(double value);

Rounds the given value to the nearest step increment and returns the rounded value.

double value : The value to round.

double Valuator::getMax();

Returns the valuator's maximum value.


void Valuator::setMax(double max);

Sets the valuator's maximum value.

double max : The maximum value.

double Valuator::getMin();

Returns the valuator's minimum value.


void Valuator::setMin(double min);

Sets the valuator's minimum value.

double min : The minimum value.

void Valuator::setPrecision(int ndigits);

Sets the step value to 1/10^ndigits.

int ndigits : The precision value.

void Valuator::setRange(double min, double max);

Sets the minimum and maximum values of the valuator.

double min : The minimum value.
double max : The maximum value.

void Valuator::setStep(double step);

Sets the step/increment value.

double step : The increment value

void Valuator::setStep(int n, int d);

Sets the step/increment value as a ratio of two integers.

int n : The numerator of the ratio.
int d : The denominator of the ratio.

double Valuator::getStep();

Returns the step/increment value.


void Valuator::setValue(double val);

Sets the value of the valuator. This does not clamp or round the value. Call those functions before setting the value.

double val : The new value.

void Valuator::getValue();

Returns the value of the valuator.


_________________________________________________________________
ValueSlider (extends Valuator)

This class provides a horizontal or vertical slider to provide a numeric input mechanism. Most methods generally used with a slider are handled by the parent class Valuator.


ValueSlider::ValueSlider();

Constructs a new ValueSlider widget.


void ValueSlider::setVertical(bool b);

Sets the orientation for the slider. The default is horizontal.

bool b : True for a vertical slider.

_________________________________________________________________
Widget

This is the base class for all graphical user interface components. It provides the basic geometry management functions, as well as functions for changing visibility, focus, and parent widgets. A widget cannot be created directly.


void Widget::destroy();

Calling this method causes the widget to destroy itself. This deletes the object.


void Widget::setParent(Container* pParent);

Changes the widget's parent container.

Container* pParent : The new parent container.

Container* Widget::getParent();

Returns the parent container.


void Widget::show();

Causes the widget to be visible on the screen.


void Widget::hide();

Causes the widget to be hidden from view.


void Widget::setForeground(const Color& c);

Sets the foreground color of the widget. Usually this is the text label.

const Color& c : The color.

void Widget::setBackground(const Color& c);

Sets the background color of the widget.

const Color& c : The color.

void Widget::setEnabled(bool pEnable);

Changes whether the widget is sensitive to user interactions.

bool pEnable : Whether to enable or diable the widget.

void Widget::grabFocus();

Attempts to acquire the input focus.


void Widget::setPosition(int pX, int pY);

Changes the widget's upper-left x,y coordinates relative to its parent container.

int pX : The X coordinate.
int pY : The Y coordinate.

void Widget::setSize(int pWidth, int pHeight);

Changes the widget's size.

int pWidth : The new width.
int pHeight : The new height.

void Widget::setGeometry(int pX, int pY, int pWidth, int pHeight);

Changes the widget's position and size.

int pX : The X coordinate.
int pY : The Y coordinate.
int pWidth : The new width.
int pHeight : The new height.

int Widget::getWidth();

Returns the widget's width in pixels.


int Widget::getHeight();

Returns the widget's height in pixels.


void Widget::getPosition(int& pX, int& pY);

Gets the widget's x-y position.

int& pX : The integer to assign the X-coordinate to.
int& pY : The integer to assign the Y-coordinate to.

void Widget::getGeometry(int& pX, int& pY, int& pWidth, int& pHeight);

Gets the widget's position and size.

int& pX : The integer to assign the X-coordinate to.
int& pY : The integer to assign the Y-coordinate to.
int& pWidth : The integer to assign the width to.
int& pHeight : The integer to assign the height to.

void Widget::setTooltip(const String& str);

Sets the tooltip shown for the widget when the mouse hovers above it.

const String& str : The string to display. An empty string clears the tooltip.

void Widget::redraw();

Causes the widget to redraw itself on the screen. Note that this can be used to force a Paint event for a Canvas widget.


_________________________________________________________________
Window (extends Container)

This class provides a toplevel window on the screen. It is a descendant of the container class, and thus can hold other widgets directly. It generates events when it is loaded (or created), unloaded (or destroyed), for user close requests, and when it is resized.

Note that handling Close events may not seem very straightforward. By default, a window will ignore close events from the system (i.e. clicking on the X close button on the window's border) and remain on the screen. To accept a close event, the event sent to a OnClose( ) handler must be accepted by calling the Event::accept() method.
   void MyWindow::OnClose( Event &pEvt ) {
     pEvt.accept();
   }
This close mechanism may seem overly complicated, but it allows for a general way to ensure that a user's data can be saved before a window is unloaded without writing the code to check for window closability multiple places.


Object Events
   Load An event generated when the window is loaded.
   Unload An event generated when the window is unloaded.
   Close An event generated when the window receives a close request.
   Resize An event generated when the window is resized.

Window::Window();

Constructs a new toplevel window.


void Window::setModal(bool pModal);

Causes the window to be modal. That means that other windows in the application will be blocked until this one is unloaded. Note that once a window is made modal, it cannot be made unmodal.

bool pModal : Enable window modality or not.

void Window::setResizable(bool pResizable);

Enables window resizing. Once a window is made resizable, it cannot be made to require a fixed size any longer.

bool pResizable : Enable resizing or not.

void Window::setCentered(bool pCentered);

Centers the window on the screen.

bool pCentered : If true, the window will be centered on the screen.

void Window::setTitle(const String& pTitle);

Changes the window's title on its border.

const String& pTitle : The new window title.

void Window::setBorder(bool pBorder);

Changes whether the window has a system-supplied border around it.

bool pBorder : Enable the system border or not.

bool Window::close();

Causes a Close event to be generated on the window. Returns whether the close event was accepted or rejected.