hoa_video::private_video::GUIElement Class Reference

An abstract base class for all GUI elements (windows + controls). This class contains basic functions such as Draw(), Update(), etc. More...

#include <gui.h>

Inheritance diagram for hoa_video::private_video::GUIElement:

Inheritance graph
[legend]
Collaboration diagram for hoa_video::private_video::GUIElement:

Collaboration graph
[legend]
List of all members.

Public Member Functions

virtual void CalculateAlignedRect (float &left, float &right, float &bottom, float &top)
 Calculates and returns the four edges for an aligned rectangle.
virtual void Draw ()=0
 Draws the GUI element to the screen.
void GetAlignment (int32 &xalign, int32 &yalign) const
 Gets the x and y alignment of the element.
void GetPosition (float &x, float &y) const
 Gets the position of the object.
 GUIElement ()
virtual bool IsInitialized (std::string &errors)=0
 Does a self-check on all its members to see if all its members have been set to valid values.
void SetAlignment (int32 xalign, int32 yalign)
 Sets the alignment of the element.
void SetPosition (float x, float y)
 Sets the position of the object.
virtual void Update (uint32 frame_time)=0
 Updates the state of the element.
virtual ~GUIElement ()
 
Note:
The destructor must be re-implemented in all children of this class.


Protected Attributes

std::string _initialization_errors
 Contains the errors that need to be resolved if the object is in an invalid state (not ready for rendering).
bool _initialized
 Used to determine if the object is in a valid state.
float _x_position
 The x and y position of the gui element.
int32 _xalign
 Members for determining the element's draw alignment.
float _y_position
int32 _yalign

Detailed Description

An abstract base class for all GUI elements (windows + controls). This class contains basic functions such as Draw(), Update(), etc.

****************************************************************************

Definition at line 47 of file gui.h.


Constructor & Destructor Documentation

hoa_video::private_video::GUIElement::GUIElement (  ) 

Definition at line 29 of file gui.cpp.

virtual hoa_video::private_video::GUIElement::~GUIElement (  )  [inline, virtual]

Note:
The destructor must be re-implemented in all children of this class.

Definition at line 52 of file gui.h.


Member Function Documentation

void hoa_video::private_video::GUIElement::CalculateAlignedRect ( float &  left,
float &  right,
float &  bottom,
float &  top 
) [virtual]

Calculates and returns the four edges for an aligned rectangle.

Parameters:
left A reference where to store the coordinates of the rectangle's left edge.
right A reference where to store the coordinates of the rectangle's right edge.
bottom A reference where to store the coordinates of the rectangle's bttom edge.
top A reference where to store the coordinates of the rectangle's top edge.
Given a rectangle specified in VIDEO_X_LEFT and VIDEO_Y_BOTTOM orientation, this function transforms the rectangle based on the video engine's alignment flags.

Reimplemented in hoa_video::private_video::GUIControl.

Definition at line 58 of file gui.cpp.

References hoa_video::GameVideo::_coord_sys, hoa_video::GameVideo::_x_align, _x_position, hoa_video::GameVideo::_y_align, _y_position, hoa_video::CoordSys::GetHorizontalDirection(), hoa_video::CoordSys::GetVerticalDirection(), and hoa_video::VideoManager.

Referenced by hoa_video::private_video::GUIControl::CalculateAlignedRect(), and hoa_video::MenuWindow::Update().

Here is the call graph for this function:

virtual void hoa_video::private_video::GUIElement::Draw (  )  [pure virtual]

Draws the GUI element to the screen.

Implemented in hoa_video::MenuWindow, hoa_video::OptionBox, hoa_video::TextBox, hoa_battle::private_battle::ActionWindow, hoa_battle::private_battle::FinishWindow, hoa_map::private_map::DialogueManager, hoa_menu::private_menu::CharacterWindow, hoa_menu::private_menu::InventoryWindow, hoa_menu::private_menu::StatusWindow, hoa_menu::private_menu::SkillsWindow, hoa_menu::private_menu::EquipWindow, hoa_menu::private_menu::FormationWindow, hoa_shop::private_shop::ShopActionWindow, hoa_shop::private_shop::ObjectListWindow, hoa_shop::private_shop::ObjectSellListWindow, hoa_shop::private_shop::ObjectInfoWindow, and hoa_shop::private_shop::ConfirmWindow.

void hoa_video::private_video::GUIElement::GetAlignment ( int32 xalign,
int32 yalign 
) const [inline]

Gets the x and y alignment of the element.

Parameters:
xalign - x alignment of the object
yalign - y alignment of the object

Definition at line 97 of file gui.h.

References _xalign, and _yalign.

Referenced by hoa_video::private_video::GUIControl::CalculateAlignedRect().

void hoa_video::private_video::GUIElement::GetPosition ( float &  x,
float &  y 
) const [inline]

Gets the position of the object.

Parameters:
x A reference to store the x coordinate of the object.
y A reference to store the y coordinate of the object.
Note:
X and y are in terms of a 1024x768 coordinate system

Definition at line 90 of file gui.h.

References _x_position, and _y_position.

Referenced by hoa_menu::private_menu::CharacterWindow::Draw().

virtual bool hoa_video::private_video::GUIElement::IsInitialized ( std::string &  errors  )  [pure virtual]

Does a self-check on all its members to see if all its members have been set to valid values.

Parameters:
errors - A reference to a string to be filled with error messages if any errors are found.
Returns:
True if everything is initialized correctly, false otherwise. This is used internally to make sure we have a valid object before doing any complicated operations. If it detects any problems, it generates a list of errors and returns it by reference so they can be displayed.

Implemented in hoa_video::MenuWindow, hoa_video::OptionBox, and hoa_video::TextBox.

void hoa_video::private_video::GUIElement::SetAlignment ( int32  xalign,
int32  yalign 
)

Sets the alignment of the element.

Parameters:
xalign Valid values include VIDEO_X_LEFT, VIDEO_X_CENTER, or VIDEO_X_RIGHT.
yalign Valid values include VIDEO_Y_TOP, VIDEO_Y_CENTER, or VIDEO_Y_BOTTOM.

Definition at line 39 of file gui.cpp.

References _xalign, _yalign, hoa_video::VIDEO_DEBUG, hoa_video::VIDEO_X_CENTER, hoa_video::VIDEO_X_LEFT, hoa_video::VIDEO_X_RIGHT, hoa_video::VIDEO_Y_BOTTOM, hoa_video::VIDEO_Y_CENTER, and hoa_video::VIDEO_Y_TOP.

Referenced by hoa_menu::MenuMode::_SetupOptionBoxCommonSettings(), hoa_battle::private_battle::ActionWindow::ActionWindow(), hoa_map::private_map::DialogueManager::DialogueManager(), hoa_battle::private_battle::FinishWindow::FinishWindow(), hoa_quit::QuitMode::QuitMode(), and hoa_boot::BootMenu::SetWindowed().

void hoa_video::private_video::GUIElement::SetPosition ( float  x,
float  y 
) [inline]

Sets the position of the object.

Parameters:
x A reference to store the x coordinate of the object.
y A reference to store the y coordinate of the object.
Note:
X and y are in terms of a 1024x768 coordinate system

Definition at line 76 of file gui.h.

References _x_position, and _y_position.

Referenced by hoa_menu::private_menu::InventoryWindow::_InitCategory(), hoa_menu::private_menu::EquipWindow::_InitCharSelect(), hoa_menu::private_menu::SkillsWindow::_InitCharSelect(), hoa_menu::private_menu::StatusWindow::_InitCharSelect(), hoa_menu::private_menu::InventoryWindow::_InitCharSelect(), hoa_menu::private_menu::EquipWindow::_InitEquipmentList(), hoa_menu::private_menu::EquipWindow::_InitEquipmentSelect(), hoa_menu::private_menu::InventoryWindow::_InitInventoryItems(), hoa_menu::private_menu::SkillsWindow::_InitSkillsCategories(), hoa_menu::private_menu::SkillsWindow::_InitSkillsList(), hoa_boot::BootMenu::_InitWindow(), hoa_menu::MenuMode::_SetupOptionBoxCommonSettings(), hoa_battle::private_battle::ActionWindow::ActionWindow(), hoa_shop::private_shop::ConfirmWindow::ConfirmWindow(), hoa_boot::CreditsScreen::CreditsScreen(), hoa_map::private_map::DialogueManager::DialogueManager(), hoa_battle::private_battle::FinishWindow::FinishWindow(), hoa_menu::private_menu::InventoryWindow::InventoryWindow(), hoa_shop::private_shop::ObjectInfoWindow::ObjectInfoWindow(), hoa_shop::private_shop::ObjectListWindow::ObjectListWindow(), hoa_shop::private_shop::ObjectSellListWindow::ObjectSellListWindow(), hoa_quit::QuitMode::QuitMode(), hoa_boot::BootMenu::SetWindowed(), hoa_shop::private_shop::ShopActionWindow::ShopActionWindow(), hoa_menu::private_menu::SkillsWindow::SkillsWindow(), hoa_video::TextBox::TextBox(), and hoa_boot::WelcomeScreen::WelcomeScreen().

virtual void hoa_video::private_video::GUIElement::Update ( uint32  frame_time  )  [pure virtual]

Updates the state of the element.

Parameters:
frame_time The time that has elapsed since the last frame was drawn, in milliseconds

Implemented in hoa_video::MenuWindow, hoa_video::OptionBox, and hoa_video::TextBox.


Member Data Documentation

std::string hoa_video::private_video::GUIElement::_initialization_errors [protected]

Contains the errors that need to be resolved if the object is in an invalid state (not ready for rendering).

Definition at line 123 of file gui.h.

Referenced by hoa_video::MenuWindow::Create(), hoa_video::TextBox::Draw(), hoa_video::MenuWindow::Draw(), hoa_video::MenuWindow::Hide(), hoa_video::MenuWindow::MenuWindow(), hoa_video::OptionBox::OptionBox(), hoa_video::OptionBox::SetCellSize(), hoa_video::MenuWindow::SetDisplayMode(), hoa_video::TextBox::SetDisplayText(), hoa_video::OptionBox::SetFont(), hoa_video::OptionBox::SetOptionAlignment(), hoa_video::OptionBox::SetSelectMode(), hoa_video::OptionBox::SetSize(), and hoa_video::MenuWindow::Show().

bool hoa_video::private_video::GUIElement::_initialized [protected]

Used to determine if the object is in a valid state.

Note:
This member is set after every change to any of the object's settings.

Reimplemented in hoa_video::OptionBox.

Definition at line 120 of file gui.h.

Referenced by hoa_video::MenuWindow::Create(), hoa_video::TextBox::Draw(), hoa_video::MenuWindow::Draw(), hoa_video::MenuWindow::Hide(), hoa_video::MenuWindow::MenuWindow(), hoa_video::MenuWindow::SetDisplayMode(), hoa_video::TextBox::SetDisplayText(), hoa_video::MenuWindow::Show(), and hoa_video::TextBox::TextBox().

float hoa_video::private_video::GUIElement::_x_position [protected]

The x and y position of the gui element.

Definition at line 116 of file gui.h.

Referenced by CalculateAlignedRect(), hoa_video::MenuWindow::Draw(), GetPosition(), and SetPosition().

int32 hoa_video::private_video::GUIElement::_xalign [protected]

Members for determining the element's draw alignment.

Definition at line 113 of file gui.h.

Referenced by hoa_video::TextBox::Draw(), hoa_video::OptionBox::Draw(), hoa_video::MenuWindow::Draw(), GetAlignment(), SetAlignment(), and hoa_video::MenuWindow::Update().

float hoa_video::private_video::GUIElement::_y_position [protected]

Definition at line 116 of file gui.h.

Referenced by CalculateAlignedRect(), hoa_video::MenuWindow::Draw(), GetPosition(), and SetPosition().

int32 hoa_video::private_video::GUIElement::_yalign [protected]

Definition at line 113 of file gui.h.

Referenced by hoa_video::TextBox::Draw(), hoa_video::OptionBox::Draw(), hoa_video::MenuWindow::Draw(), GetAlignment(), SetAlignment(), and hoa_video::MenuWindow::Update().


The documentation for this class was generated from the following files:
Generated on Fri Jul 6 23:16:46 2007 for Hero of Allacrost by  doxygen 1.5.1