#include <ggui/gui_object.h>
Public Types | |
enum | teAlignment { eeAlignLeft = 0x0000, eeAlignHCenter = 0x0001, eeAlignRight = 0x0002, eeAlignHMask = 0x0003, eeAlignTop = 0x0000, eeAlignVCenter = 0x0010, eeAlignBottom = 0x0020, eeAlignVMask = 0x0030, eeAlignCenter = eeAlignHCenter|eeAlignVCenter, eeAlignTopLeft = eeAlignTop|eeAlignLeft } |
Public Member Functions | |
tcGuiObject (const char *name, tcBench *bench, int idd, uint32 type) | |
virtual | ~tcGuiObject () |
virtual bool | ParseXML (TiXmlElement *ahDom) |
const char * | name () |
const GSTRING * | gname () |
uint32 | type () |
int | idd () |
const char * | get_text () |
bool | is_visible () |
int | get_x_pos () |
int | get_y_pos () |
int | get_height () |
int | get_width () |
void | get_rect (tcRect &rect) |
int | get_type () |
virtual tcGuiObject * | get_parent_obj () |
virtual void | create () |
virtual void | show (bool show=true) |
virtual void | hide () |
virtual void | set_text (const char *text) |
virtual void | set_x_pos (int x) |
virtual void | set_y_pos (int y) |
virtual void | set_height (int h) |
virtual void | set_width (int w) |
void | set_image (tcGuiImage *image) |
virtual void | set_text_x_pos (int x) |
virtual void | set_text_y_pos (int y) |
void | set_text_font (tcDspFont *font) |
void | set_text_align (int align) |
void | set_text_color (tsRgb color) |
void | set_text_vertical (bool vert) |
void | set_text_wrap (bool wrap) |
void | set_fg_color (tsRgb color) |
void | set_bg_color (tsRgb color) |
void | set_user_id (int id) |
virtual void | set_animate (bool animate) |
void | set_user_ptr (void *ptr) |
int | get_user_id () |
tsRgb | get_fg_color () |
tsRgb | get_bg_color () |
tsRgb | get_text_color () |
virtual bool | is_point_in (int x, int y) |
virtual bool | is_rect_overlapped (tcRect &rect) |
virtual bool | lbutton_down (int x, int y) |
virtual void | lbutton_up (int x, int y) |
virtual void | mouse_move (int x, int y, int flags) |
virtual bool | does_l_mouse () |
virtual void | animate () |
virtual void | draw (tcGuiDspDisplay &pd) |
void | invalidate (tcRect *bckgrnd_redraw=NULL) |
Protected Member Functions | |
virtual void | calculate_text_rect (int alignment) |
virtual void | draw_text (tcGuiDspDisplay &pd, int alignment, int dip=0, float opacity=1.0F) |
Protected Attributes | |
bool | m_created |
true when XML file parsing is complete and object has been initialized | |
bool | m_visible |
true when object is potentially visible on the full screen | |
uint32 | m_type |
tcBench * | m_bench |
pointer to the tcGuiBench (widget manager) object | |
bool | m_animate |
true if this widget will perform animation | |
GSTRING | m_name |
name of the widget | |
int | m_idd |
unique ID number of the widget | |
int | m_x_pos |
screen x position of the widget | |
int | m_y_pos |
screen y position of the widget | |
int | m_height |
widget height | |
int | m_width |
widget widget | |
tcRect | m_obj_rect |
bounding rectangle of widget (screen coordinates) (may not include all text) | |
tcRect | m_text_rect |
bounding rectangle text for widget (screen coordinates) | |
int | m_lcapture_x |
int | m_lcapture_y |
int | m_rcapture_x |
int | m_rcapture_y |
tsRgb | m_fg_color |
foregroun color to use when rendering tcGuiObject | |
tsRgb | m_bg_color |
background color to use when rendering tcGuiObject | |
tsRgb | m_text_color |
color to use when rendering tcGuiObject text | |
tcDspFont * | m_font |
font to use when rendering tcGuiObject text | |
GSTRING | m_text |
base tcGuiObject class text data | |
int | m_text_x_pos |
reference screen x position of object text | |
int | m_text_y_pos |
reference screen y position of object text | |
int | m_text_align |
alignment flags used for text rendering | |
bool | m_text_vertical |
bool | m_text_wrap |
true if this text string should be wrapped to available space when drawn | |
int | m_user_id |
void * | m_user_ptr |
tcGuiImage * | m_image |
pointer to optional background image |
The tcGuiObject class is an abstract base class from which all ggui skinnable widgets should be derived.
This enumeration is used to describe how widget text should be drawn with respect to the text location point.
tcGuiObject::tcGuiObject | ( | const char * | name, | |
tcBench * | bench, | |||
int | idd, | |||
uint32 | type | |||
) |
Constructor
name | Object ID name from the XML file. | |
parent | Parent window (the GGUI main window). | |
idd | The windows control ID that we assigned to this control. | |
type | The object type. |
tcGuiObject::~tcGuiObject | ( | ) | [virtual] |
Destructor
bool tcGuiObject::ParseXML | ( | TiXmlElement * | apElement | ) | [virtual] |
Parse common XML elements from the DOM.
Reimplemented in MityDSP::tcGuiButton, MityDSP::tcGuiCheckBox, MityDSP::tcGuiDisplay, MityDSP::tcGuiGenericGraph, MityDSP::tcGuiImage, MityDSP::tcGuiKnob, MityDSP::tcGuiLabel, MityDSP::tcGuiLamp, MityDSP::tcGuiListbox, MityDSP::tcGuiSlider, MityDSP::tcGuiSpinBox, and MityDSP::tcGuiGraph.
const char* MityDSP::tcGuiObject::name | ( | ) | [inline] |
const GSTRING* MityDSP::tcGuiObject::gname | ( | ) | [inline] |
uint32 MityDSP::tcGuiObject::type | ( | ) | [inline] |
int MityDSP::tcGuiObject::idd | ( | ) | [inline] |
const char* MityDSP::tcGuiObject::get_text | ( | ) | [inline] |
bool MityDSP::tcGuiObject::is_visible | ( | ) | [inline] |
int MityDSP::tcGuiObject::get_x_pos | ( | ) | [inline] |
int MityDSP::tcGuiObject::get_y_pos | ( | ) | [inline] |
int MityDSP::tcGuiObject::get_height | ( | ) | [inline] |
int MityDSP::tcGuiObject::get_width | ( | ) | [inline] |
void tcGuiObject::get_rect | ( | tcRect & | rect | ) |
Get the bounding rectangle for the object.
rect | output bounding rectangle |
int MityDSP::tcGuiObject::get_type | ( | ) | [inline] |
virtual tcGuiObject* MityDSP::tcGuiObject::get_parent_obj | ( | ) | [inline, virtual] |
virtual void MityDSP::tcGuiObject::create | ( | ) | [inline, virtual] |
void tcGuiObject::show | ( | bool | show = true |
) | [virtual] |
This function un-hides the object. If hidden the object will not respond to mouse clicks or appear on the screen.
Reimplemented in MityDSP::tcGuiGraph.
void tcGuiObject::hide | ( | ) | [virtual] |
This function hides the object. If hidden the object will not respond to mouse clicks or appear on the screen.
Reimplemented in MityDSP::tcGuiGraph.
void tcGuiObject::set_text | ( | const char * | text | ) | [virtual] |
virtual void MityDSP::tcGuiObject::set_x_pos | ( | int | x | ) | [inline, virtual] |
virtual void MityDSP::tcGuiObject::set_y_pos | ( | int | y | ) | [inline, virtual] |
virtual void MityDSP::tcGuiObject::set_height | ( | int | h | ) | [inline, virtual] |
virtual void MityDSP::tcGuiObject::set_width | ( | int | w | ) | [inline, virtual] |
void MityDSP::tcGuiObject::set_image | ( | tcGuiImage * | image | ) | [inline] |
virtual void MityDSP::tcGuiObject::set_text_x_pos | ( | int | x | ) | [inline, virtual] |
Reimplemented in MityDSP::tcGuiButton, MityDSP::tcGuiListbox, and MityDSP::tcGuiSpinBox.
virtual void MityDSP::tcGuiObject::set_text_y_pos | ( | int | y | ) | [inline, virtual] |
Reimplemented in MityDSP::tcGuiButton, MityDSP::tcGuiListbox, and MityDSP::tcGuiSpinBox.
void MityDSP::tcGuiObject::set_text_font | ( | tcDspFont * | font | ) | [inline] |
void MityDSP::tcGuiObject::set_text_align | ( | int | align | ) | [inline] |
void MityDSP::tcGuiObject::set_text_color | ( | tsRgb | color | ) | [inline] |
void MityDSP::tcGuiObject::set_text_vertical | ( | bool | vert | ) | [inline] |
void MityDSP::tcGuiObject::set_text_wrap | ( | bool | wrap | ) | [inline] |
void MityDSP::tcGuiObject::set_fg_color | ( | tsRgb | color | ) | [inline] |
void MityDSP::tcGuiObject::set_bg_color | ( | tsRgb | color | ) | [inline] |
void MityDSP::tcGuiObject::set_user_id | ( | int | id | ) | [inline] |
virtual void MityDSP::tcGuiObject::set_animate | ( | bool | animate | ) | [inline, virtual] |
Reimplemented in MityDSP::tcGuiDisplay.
void MityDSP::tcGuiObject::set_user_ptr | ( | void * | ptr | ) | [inline] |
int MityDSP::tcGuiObject::get_user_id | ( | ) | [inline] |
tsRgb MityDSP::tcGuiObject::get_fg_color | ( | ) | [inline] |
tsRgb MityDSP::tcGuiObject::get_bg_color | ( | ) | [inline] |
tsRgb MityDSP::tcGuiObject::get_text_color | ( | ) | [inline] |
bool tcGuiObject::is_point_in | ( | int | x, | |
int | y | |||
) | [virtual] |
This function determines if the specified point is within the object rectangle.
x | The X position to test. | |
y | The Y position to test. |
bool tcGuiObject::is_rect_overlapped | ( | tcRect & | rect | ) | [virtual] |
This function determines if the specified rect overlaps the object rectangle.
rect | the rectangle to test |
virtual bool MityDSP::tcGuiObject::lbutton_down | ( | int | x, | |
int | y | |||
) | [inline, virtual] |
Reimplemented in MityDSP::tcGuiButton, MityDSP::tcGuiCheckBox, MityDSP::tcGuiKnob, MityDSP::tcGuiListbox, MityDSP::tcGuiSlider, and MityDSP::tcGuiSpinBox.
void tcGuiObject::lbutton_up | ( | int | x, | |
int | y | |||
) | [virtual] |
Empty method for handling left mouse button up events. Should be overridden by objects requiring left button up events.
x | x screen coordinate of up event | |
y | y screen coordinate of up event |
Reimplemented in MityDSP::tcGuiButton, MityDSP::tcGuiCheckBox, MityDSP::tcGuiKnob, MityDSP::tcGuiListbox, MityDSP::tcGuiSlider, and MityDSP::tcGuiSpinBox.
virtual void MityDSP::tcGuiObject::mouse_move | ( | int | x, | |
int | y, | |||
int | flags | |||
) | [inline, virtual] |
Reimplemented in MityDSP::tcGuiButton, MityDSP::tcGuiCheckBox, MityDSP::tcGuiKnob, MityDSP::tcGuiListbox, MityDSP::tcGuiSlider, and MityDSP::tcGuiSpinBox.
virtual bool MityDSP::tcGuiObject::does_l_mouse | ( | ) | [inline, virtual] |
Reimplemented in MityDSP::tcGuiDisplay, MityDSP::tcGuiImage, and MityDSP::tcGuiLabel.
virtual void MityDSP::tcGuiObject::animate | ( | ) | [inline, virtual] |
Reimplemented in MityDSP::tcGuiDisplay, MityDSP::tcGuiLamp, and MityDSP::tcGuiSpinBox.
virtual void MityDSP::tcGuiObject::draw | ( | tcGuiDspDisplay & | pd | ) | [inline, virtual] |
void tcGuiObject::invalidate | ( | tcRect * | bckgrnd_redraw = NULL |
) |
Force an object to invalidate the region of the screen it is situated in.
bckgrnd_redraw | not used, set to NULL |
void tcGuiObject::calculate_text_rect | ( | int | alignment | ) | [protected, virtual] |
Re-computes the bounding box of the associated object text set in set_text method. This method should be called whenever the text fields or positions have been changed.
alignment | text alignment flags |
void tcGuiObject::draw_text | ( | tcGuiDspDisplay & | pd, | |
int | alignment, | |||
int | dip = 0 , |
|||
float | opacity = 1.0F | |||
) | [protected, virtual] |
Draws the text set in set_text() method to the screen context supplied.
pd | reference to active screen display context. | |
alignment | text alignment bitmask | |
dip | +x and +y offset text will be drawn dip pixels lower and to the right of nominal text location. |
bool MityDSP::tcGuiObject::m_created [protected] |
true when XML file parsing is complete and object has been initialized
bool MityDSP::tcGuiObject::m_visible [protected] |
true when object is potentially visible on the full screen
uint32 MityDSP::tcGuiObject::m_type [protected] |
tcBench* MityDSP::tcGuiObject::m_bench [protected] |
pointer to the tcGuiBench (widget manager) object
bool MityDSP::tcGuiObject::m_animate [protected] |
true if this widget will perform animation
GSTRING MityDSP::tcGuiObject::m_name [protected] |
name of the widget
int MityDSP::tcGuiObject::m_idd [protected] |
unique ID number of the widget
int MityDSP::tcGuiObject::m_x_pos [protected] |
screen x position of the widget
int MityDSP::tcGuiObject::m_y_pos [protected] |
screen y position of the widget
int MityDSP::tcGuiObject::m_height [protected] |
widget height
int MityDSP::tcGuiObject::m_width [protected] |
widget widget
tcRect MityDSP::tcGuiObject::m_obj_rect [protected] |
bounding rectangle of widget (screen coordinates) (may not include all text)
tcRect MityDSP::tcGuiObject::m_text_rect [protected] |
bounding rectangle text for widget (screen coordinates)
int MityDSP::tcGuiObject::m_lcapture_x [protected] |
int MityDSP::tcGuiObject::m_lcapture_y [protected] |
int MityDSP::tcGuiObject::m_rcapture_x [protected] |
int MityDSP::tcGuiObject::m_rcapture_y [protected] |
tsRgb MityDSP::tcGuiObject::m_fg_color [protected] |
foregroun color to use when rendering tcGuiObject
tsRgb MityDSP::tcGuiObject::m_bg_color [protected] |
background color to use when rendering tcGuiObject
tsRgb MityDSP::tcGuiObject::m_text_color [protected] |
color to use when rendering tcGuiObject text
tcDspFont* MityDSP::tcGuiObject::m_font [protected] |
font to use when rendering tcGuiObject text
GSTRING MityDSP::tcGuiObject::m_text [protected] |
base tcGuiObject class text data
int MityDSP::tcGuiObject::m_text_x_pos [protected] |
reference screen x position of object text
int MityDSP::tcGuiObject::m_text_y_pos [protected] |
reference screen y position of object text
int MityDSP::tcGuiObject::m_text_align [protected] |
alignment flags used for text rendering
bool MityDSP::tcGuiObject::m_text_vertical [protected] |
bool MityDSP::tcGuiObject::m_text_wrap [protected] |
true if this text string should be wrapped to available space when drawn
int MityDSP::tcGuiObject::m_user_id [protected] |
void* MityDSP::tcGuiObject::m_user_ptr [protected] |
tcGuiImage* MityDSP::tcGuiObject::m_image [protected] |
pointer to optional background image