Main Page | Class Hierarchy | Class List | File List | Class Members | Related Pages

CGUIButton Class Reference

Button Control. More...

#include <GUI.h>

Inheritance diagram for CGUIButton:

CGUIStatic CGUIElement CXMLResource CDoubleList< CGUIElement * > CResource CEntity CGUIDropList CGUIMenuEntry CGUIMenu List of all members.

Public Member Functions

virtual void Initialize ()
virtual int Create (CGUIElement *pParent, tRect WidgetRect, CCustomFont *pFont=NULL, CTexture *pTexture=NULL, CMaterial *pMaterial=NULL, bool bBorder=false)
virtual bool PropertyChanging (const void *pvProperty, void *pvNewValue)
virtual void GetProperties (EPropList &PropList)
virtual void Draw ()
virtual int LoadXML (TiXmlNode *pDataNode, CString strFilename)
virtual int SaveXML (TiXmlNode *pDataNode, CString strFilename)
virtual void Destroy ()
virtual int OnLMouseUp (UINT x, UINT y)
UINT GetState ()
void SetState (bool bLoopAnimation, UINT uiState)
 Sets button state.
virtual bool IsOfType (eEntityType eType)

Protected Member Functions

CTextureFrameAnimationGetEventAnimation (UINT uiEventIndex)
CTextureFrameAnimationGetCurrentAnimation ()
bool LoadButtonStates (TiXmlNode *pButtonXMLNode)
bool LoadStateEvents (tButtonState *uiState, TiXmlNode *pStateXMLNode)
int SaveButtonStates (TiXmlNode *pDataNode)
int SaveStateEvents (TiXmlNode *pDataNode, tButtonState *pState)

Detailed Description

Button Control.

This control has a possibility of being derived from CGUITextBox to be able to edit text, and at the same time maintain it's animations based on user mouse input.

See also:
tButtonAnimation

Definition at line 1165 of file GUI.h.


Member Function Documentation

int CGUIButton::Create CGUIElement pParent,
tRect  WidgetRect,
CCustomFont pFont = NULL,
CTexture pTexture = NULL,
CMaterial pMaterial = NULL,
bool  bBorder = false
[virtual]
 

Method details:

Parameters:
pParent - Pointer to parent widget
WidgetRect - Rectangle for this widget
pFont - Pointer to CCustomFont derived font for the widget to draw the text
pTexture - Pointer to texture
pMaterial - Pointer to material
bBorder - does this widget has a border?
Returns:
1 if sucessful, 0 if not

Reimplemented from CGUIStatic.

Reimplemented in CGUIMenuEntry, and CGUIMenu.

Definition at line 30 of file GUIButton.cpp.

References CGUIStatic::Create().

Referenced by CGUIScrollBar::Create(), CGUIMenuEntry::Create(), CGUIDropList::Create(), CGUIRadioGroup::InsertItem(), CGUIListBox::InsertItem(), and CGUIDropList::InsertItem().

void CGUIButton::Destroy  )  [virtual]
 

Method details: Destroys the widget - e.g Pre-destructor (resets variables)

Reimplemented from CGUIStatic.

Reimplemented in CGUIMenuEntry.

Definition at line 593 of file GUIButton.cpp.

References CGUIStatic::Destroy().

Referenced by PropertyChanging().

void CGUIButton::Draw  )  [virtual]
 

Method details: Draws the widget

Reimplemented from CGUIStatic.

Reimplemented in CGUIDropList, CGUIMenuEntry, and CGUIMenu.

Definition at line 115 of file GUIButton.cpp.

References CTextureFrameAnimation::Animate(), CGUIStatic::Draw(), GetCurrentAnimation(), CFrameAnimation< TAnimation >::GetCurrentFrame(), CTexture::GetHeight(), CTextureFrameAnimation::GetTexture(), CTexture::GetWidth(), CGUIElement::SetTexture(), tVERTEX2f::x, and tVERTEX2f::y.

Referenced by CGUIMenuEntry::Draw().

CTextureFrameAnimation * CGUIButton::GetCurrentAnimation  )  [protected]
 

Method details:

Returns:
Pointer to current animation frame (based off current mouse location/status)
Definition at line 172 of file GUIButton.cpp.

References GetEventAnimation(), CInputEngine::GetMouse(), CGUIElement::GetRect(), CSingleton< CInputEngine >::GetSingleton(), and CMouse::IsButtonDown().

Referenced by Draw().

CTextureFrameAnimation * CGUIButton::GetEventAnimation UINT  uiEventIndex  )  [protected]
 

Method details:

Parameters:
uiEventIndex Index for the event to fetch
Returns:
Pointer to the event specified by uiEventIndex value
Definition at line 144 of file GUIButton.cpp.

References GetState(), and tButtonState::m_iEventCount.

Referenced by GetCurrentAnimation(), and GetProperties().

void CGUIButton::GetProperties EPropList &  PropList  )  [virtual]
 

Method details:

Parameters:
PropList - Const. reference to the property list

Reimplemented from CGUIStatic.

Reimplemented in CGUIDropList, CGUIMenuEntry, and CGUIMenu.

Definition at line 467 of file GUIButton.cpp.

References CDoubleList< T >::at(), CEntity::GetEntityType(), GetEventAnimation(), CEntity::GetName(), CGUIStatic::GetProperties(), CSingleton< CAnimationManager >::GetSingleton(), tButtonState::m_iEventCount, tButtonState::m_pEventAnimations, and CDoubleList< T >::size().

Referenced by CGUIMenuEntry::GetProperties(), and CGUIDropList::GetProperties().

UINT CGUIButton::GetState  ) 
 

Method details:

Returns:
Current state index
See also:
m_iCurrentState
Definition at line 159 of file GUIButton.cpp.

Referenced by GetEventAnimation().

void CGUIButton::Initialize  )  [virtual]
 

Method details: Initializes Button Control' variables

Reimplemented from CGUIStatic.

Reimplemented in CGUIDropList, CGUIMenuEntry, and CGUIMenu.

Definition at line 17 of file GUIButton.cpp.

Referenced by PropertyChanging().

bool CGUIButton::IsOfType eEntityType  eType  )  [virtual]
 

Method details: This is an implementation of Custom RTTI

Reimplemented from CGUIStatic.

Reimplemented in CGUIDropList, CGUIMenuEntry, and CGUIMenu.

Definition at line 598 of file GUIButton.cpp.

References CGUIStatic::IsOfType().

Referenced by CGUIMenuEntry::IsOfType(), and CGUIDropList::IsOfType().

bool CGUIButton::LoadButtonStates TiXmlNode pButtonXMLNode  )  [protected]
 

Method details:

Parameters:
pButtonXMLNode Pointer to XML node containing data for Button State(s)
Returns:
True of all has been loaded succesfully, False otherwise
Definition at line 203 of file GUIButton.cpp.

References TiXmlNode::FirstChild(), CEntity::GetID(), CEntity::GetName(), CSingleton< CGlobalLogger >::GetSingleton(), TiXmlNode::IterateChildren(), LoadStateEvents(), TiXmlNode::pcValue(), and CLogger::Write().

Referenced by LoadXML().

bool CGUIButton::LoadStateEvents tButtonState uiState,
TiXmlNode pStateXMLNode
[protected]
 

Method details:

Parameters:
pStateXMLNode Pointer to XML node containing data for State Events
Returns:
True of all has been loaded succesfully, False otherwise
Definition at line 259 of file GUIButton.cpp.

References TiXmlNode::FirstChild(), CEntity::GetEntityType(), CSingleton< CAnimationManager >::GetSingleton(), TiXmlNode::IterateChildren(), CAnimationManager::LoadResource(), tButtonState::m_iEventCount, tButtonState::m_pEventAnimations, and TiXmlNode::pcValue().

Referenced by LoadButtonStates().

int CGUIButton::LoadXML TiXmlNode pDataNode,
CString  strFilename
[virtual]
 

Method details:

Parameters:
pDataNode - Pointer to XML Node that holds data for this widget
strFilename - String containing filename where the data for the widget is stored

Reimplemented from CGUIStatic.

Reimplemented in CGUIDropList, CGUIMenuEntry, and CGUIMenu.

Definition at line 35 of file GUIButton.cpp.

References LoadButtonStates(), and CGUIStatic::LoadXML().

Referenced by CGUIRadioGroup::InsertItem(), CGUIListBox::InsertItem(), CGUIDropList::InsertItem(), CGUIMenuEntry::LoadXML(), and CGUIDropList::LoadXML().

int CGUIButton::OnLMouseUp UINT  x,
UINT  y
[virtual]
 

Method details:

Parameters:
x - X Location of the mouse when Left button has been released
y - Y Location of the mouse when Left button has been released
Returns:
1 if it has been processed by widget (or it's children), 0 if not

Reimplemented from CGUIElement.

Definition at line 305 of file GUIButton.cpp.

References CDoubleList< CGUIElement * >::end(), CGUI::GetActiveElement(), CGUIElement::GetGUI(), CGUIElement::GetRect(), CGUIElement::GetType(), CGUIElement::OnLMouseUp(), CGUI::PostMessage(), CDoubleList< CGUIElement * >::prev(), CDoubleList< CGUIElement * >::set_ptr(), and CGUIElement::Visible().

bool CGUIButton::PropertyChanging const void *  pvProperty,
void *  pvNewValue
[virtual]
 

Method details:

Parameters:
pvProperty - Pointer to the property
pvNewValue - Pointer to the new value

Reimplemented from CGUIStatic.

Reimplemented in CGUIDropList, CGUIMenuEntry, and CGUIMenu.

Definition at line 348 of file GUIButton.cpp.

References Destroy(), CAnimationManager::GetResource(), CSingleton< CAnimationManager >::GetSingleton(), Initialize(), tButtonState::m_iEventCount, tButtonState::m_pEventAnimations, and CGUIStatic::PropertyChanging().

Referenced by CGUIMenuEntry::PropertyChanging(), and CGUIDropList::PropertyChanging().

int CGUIButton::SaveButtonStates TiXmlNode pDataNode  )  [protected]
 

Method details:

Parameters:
pDataNode Pointer to Button XML Node
Returns:
1 if all has been saved succesfully, 0 if not
Definition at line 81 of file GUIButton.cpp.

References TiXmlNode::InsertEndChild(), and SaveStateEvents().

Referenced by SaveXML().

int CGUIButton::SaveStateEvents TiXmlNode pDataNode,
tButtonState pState
[protected]
 

Method details:

Parameters:
pDataNode Pointer to Button State
Returns:
1 if all has been saved succesfully, 0 if not
Definition at line 97 of file GUIButton.cpp.

References CEntity::GetName(), TiXmlNode::InsertEndChild(), tButtonState::m_iEventCount, tButtonState::m_pEventAnimations, and TiXmlElement::SetAttribute().

Referenced by SaveButtonStates().

int CGUIButton::SaveXML TiXmlNode pDataNode,
CString  strFilename
[virtual]
 

Method details:

Parameters:
pDataNode - Pointer to XML Node that will be the parent hold the data for this element
strFilename - String containing filename where the data for the widget is stored

Reimplemented from CGUIStatic.

Reimplemented in CGUIDropList, CGUIMenuEntry, and CGUIMenu.

Definition at line 50 of file GUIButton.cpp.

References TiXmlNode::InsertEndChild(), SaveButtonStates(), TiXmlDocument::SaveFile(), CGUIStatic::SaveXML(), and TiXmlNode::ToElement().

Referenced by CGUIMenuEntry::SaveXML(), and CGUIDropList::SaveXML().


The documentation for this class was generated from the following files:
Generated on Sun Jul 17 21:34:29 2005 for OpenGL GUI by doxygen 1.3.8