Return to Index

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.


Method Summary:
void Widget::destroy();
void Widget::setParent(Container* pParent);
Container* Widget::getParent();
void Widget::show();
void Widget::hide();
void Widget::setForeground(const Color& c);
void Widget::setBackground(const Color& c);
void Widget::setEnabled(bool pEnable);
void Widget::grabFocus();
void Widget::setPosition(int pX, int pY);
void Widget::setSize(int pWidth, int pHeight);
void Widget::setGeometry(int pX, int pY, int pWidth, int pHeight);
int Widget::getWidth();
int Widget::getHeight();
void Widget::getPosition(int& pX, int& pY);
void Widget::getGeometry(int& pX, int& pY, int& pWidth, int& pHeight);
void Widget::setTooltip(const String& str);
void Widget::redraw();



void Widget::destroy
void Widget::destroy();

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

void Widget::setParent
void Widget::setParent(Container* pParent);

Changes the widget's parent container.
Parameters:
Container* pParentThe new parent container.

Container* Widget::getParent
Container* Widget::getParent();

Returns the parent container.

void Widget::show
void Widget::show();

Causes the widget to be visible on the screen.

void Widget::hide
void Widget::hide();

Causes the widget to be hidden from view.

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

Sets the foreground color of the widget. Usually this is the text label.
Parameters:
const Color& cThe color.

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

Sets the background color of the widget.
Parameters:
const Color& cThe color.

void Widget::setEnabled
void Widget::setEnabled(bool pEnable);

Changes whether the widget is sensitive to user interactions.
Parameters:
bool pEnableWhether to enable or diable the widget.

void Widget::grabFocus
void Widget::grabFocus();

Attempts to acquire the input focus.

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

Changes the widget's upper-left x,y coordinates relative to its parent container.
Parameters:
int pXThe X coordinate.
int pYThe Y coordinate.

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

Changes the widget's size.
Parameters:
int pWidthThe new width.
int pHeightThe new height.

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

Changes the widget's position and size.
Parameters:
int pXThe X coordinate.
int pYThe Y coordinate.
int pWidthThe new width.
int pHeightThe new height.

int Widget::getWidth
int Widget::getWidth();

Returns the widget's width in pixels.

int Widget::getHeight
int Widget::getHeight();

Returns the widget's height in pixels.

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

Gets the widget's x-y position.
Parameters:
int& pXThe integer to assign the X-coordinate to.
int& pYThe integer to assign the Y-coordinate to.

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

Gets the widget's position and size.
Parameters:
int& pXThe integer to assign the X-coordinate to.
int& pYThe integer to assign the Y-coordinate to.
int& pWidthThe integer to assign the width to.
int& pHeightThe integer to assign the height to.

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

Sets the tooltip shown for the widget when the mouse hovers above it.
Parameters:
const String& strThe string to display. An empty string clears the tooltip.

void Widget::redraw
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.


Generated automatically by docgen 0.0.1
© 2003 Aron Dobos