The base class for all GUI elements. More...
#include <GUI/GUIPanel.h>
Inherited by GUIAboutMenu, GUIButton, GUIImage, GUIMainMenu, GUIMultiplierTimer, GUINameEntryScreen, GUIProgressBar, GUIScoreBoard, GUIText, GUITextEntry, and GUIViewport.
Public Member Functions | |
GUIPanel () | |
Constructor. | |
GUIPanel (GUIPanel *p) | |
Constructor. | |
virtual | ~GUIPanel () |
Deconstructor. | |
virtual void | OnMouseOver (const IMouse &m) |
Method called when the mouse moves over the panel. | |
virtual void | OnMouseLeave (const IMouse &m) |
Method called when the mouse moves out of the panel. | |
virtual void | OnMouseHover (const IMouse &m) |
Method called when the mouse is hovering over the panel. | |
virtual void | OnMouseClick (const IMouse &m) |
Method called when a mouse clicks a button on the panel. | |
virtual void | OnMouseRelease (const IMouse &m) |
Method called when a mouse releases a button over the panel. | |
virtual bool | InActiveArea (const Point2f &p) const |
Returns true if the point 'p' is inside this panel. | |
virtual void | OnFocusGained (const IKeyboard &kb) |
Called when the panel gains keyboard focus. | |
virtual void | OnFocusLost (const IKeyboard &kb) |
Called when the panel loses keyboard focus. | |
virtual void | OnActivation () |
Called when the panel is activated. | |
virtual void | OnDeactivation () |
Called when the panel is deactivated. | |
virtual void | KeyboardUpdate (const IKeyboard &kb) |
Called each frame when the panel has focus. | |
virtual const char * | GetPanelTypeName () const |
Gets the string type identifier for the GUI element. | |
virtual void | Update (float dt) |
Updates the panel and all of its active children. | |
void | Draw () |
Draws the GUI element and its children. | |
void | RequestFocus () |
Requests keyborad focus. | |
void | VisitChildren (const GUIPanelVisitor &visitor) |
Visits each child util the visistors Vist method returns false or all children are visited. | |
void | VisitChildrenFrontToBack (const GUIPanelVisitor &visitor) |
Visits each child util the visistors Vist method returns false or all children are visited. | |
void | AddChild (GUIPanel *p) |
Adds a child panel. | |
void | RemoveChild (GUIPanel *p) |
Removes a child panel. | |
void | RemoveChild (uint i) |
Removes a child panel. | |
uint | NumberOfChildren () const |
Returns the number of child panels. | |
GUIPanel * | Query (const Point2f &p) const |
Finds the first panel under the given point. | |
GUIPanel * | GetParent () const |
Returns the panels parent. | |
GUIPanel * | GetChild (uint i) const |
Returns the ith of child panel. | |
void | SetPosition (const Point2f &p) |
Sets the position of the top left corner of the GUI panel. | |
void | SetWidth (float w) |
Sets the width of the panels bounding area. | |
void | SetHeight (float h) |
Sets the height of the panels bounding area. | |
void | SetArea (const Rectf &r) |
Sets the panels area. | |
void | CenterInArea (const Rectf &r, const Point2f offset=Point2f(0.0f, 0.0f)) |
Positions the panel into the center of the given area. | |
Point2f | GetPosition () const |
Returns the positioin of the top-left corner of the panel. | |
AABB | GetBounds () const |
Returns the bounds of the panel as an AABB. | |
Rectf | GetArea () const |
Returns the area of the panel as an Rect. | |
float | GetWidth () const |
Gets the width of the bounding area for the panel. | |
float | GetHeight () const |
Gets the height of the bounding area for the panel. | |
void | MoveToFront () |
Moves the panel to the front of the z-order. | |
void | SetDepth (uint z) |
Sets the z-order of the panel. | |
uint | GetDepth () const |
Gets the z-order of the panel. | |
bool | IsActive () const |
Returns true if the panel is active. | |
void | Activate () |
Activates the panel. | |
void | Deactivate () |
Deactivates the panel. | |
bool | IsVisible () const |
Returns true if the panel is visable. | |
void | SetVisibility (bool vis) |
Sets if the panal is visable or not. | |
Protected Member Functions | |
virtual void | Paint () |
Does the actual rendering of the GUI element. | |
virtual void | RecomputeLayout () |
Recomputes the bounds and layout for the panel. Called by the Refit() method. | |
virtual void | OnUpdate (float dt) |
Call once a frame when the panel is active. | |
virtual void | InternalRequestFocus (GUIPanel *p) |
Moves up the tree until a panel that can grant focus is reached. |
The base class for all GUI elements.
NOTE: The GUIPanel class takes complete ownership of all of its children and assumes they were dynamically allocated with a call to new.
GUIPanel::GUIPanel | ( | GUIPanel * | p | ) |
Constructor.
[in] | p | the panels parent. |
void GUIPanel::AddChild | ( | GUIPanel * | p | ) |
Adds a child panel.
[in] | p | the panel. |
void GUIPanel::Draw | ( | ) |
Draws the GUI element and its children.
NOTE: Do not override.
uint GUIPanel::GetDepth | ( | ) | const [inline] |
Gets the z-order of the panel.
NOTE: Depth moves into the screen. 0 is the front of the screen.
float GUIPanel::GetHeight | ( | ) | const [inline] |
Gets the height of the bounding area for the panel.
virtual const char* GUIPanel::GetPanelTypeName | ( | ) | const [inline, virtual] |
Gets the string type identifier for the GUI element.
Reimplemented in GUIMainMenu, GUINameTextEntry, GUIText, and GUITextEntry.
float GUIPanel::GetWidth | ( | ) | const [inline] |
Gets the width of the bounding area for the panel.
virtual void GUIPanel::InternalRequestFocus | ( | GUIPanel * | p | ) | [inline, protected, virtual] |
Moves up the tree until a panel that can grant focus is reached.
NOTE: Do not override this method.
virtual void GUIPanel::OnUpdate | ( | float | dt | ) | [inline, protected, virtual] |
Call once a frame when the panel is active.
NOTE: Defaults to a no-op. Override in child class were applicable.
Reimplemented in GUINameTextEntry.
virtual void GUIPanel::Paint | ( | ) | [inline, protected, virtual] |
Does the actual rendering of the GUI element.
NOTE: Defaults to a no-op. Override in child class were applicable.
Reimplemented in GUINameTextEntry, GUINameEntryScreen, GUIScoreBoard, GUIProgressBar, GUIText, and GUITextEntry.
Finds the first panel under the given point.
[in] | p | the query point. |
virtual void GUIPanel::RecomputeLayout | ( | ) | [inline, protected, virtual] |
Recomputes the bounds and layout for the panel. Called by the Refit() method.
NOTE: Defaults to a no-op. Override in child class were applicable.
Reimplemented in GUINameTextEntry, GUIText, and GUITextEntry.
void GUIPanel::RemoveChild | ( | uint | i | ) |
Removes a child panel.
[in] | i | the index of the child to remove. |
void GUIPanel::RemoveChild | ( | GUIPanel * | p | ) |
Removes a child panel.
[in] | p | the panel to remove. |
void GUIPanel::SetDepth | ( | uint | z | ) |
Sets the z-order of the panel.
NOTE: Depth moves into the screen. 0 is the front of the screen.
void GUIPanel::SetHeight | ( | float | h | ) | [inline] |
Sets the height of the panels bounding area.
[in] | h | the height. |
void GUIPanel::SetPosition | ( | const Point2f & | p | ) |
Sets the position of the top left corner of the GUI panel.
[in] | p | the position. |
void GUIPanel::SetWidth | ( | float | w | ) | [inline] |
Sets the width of the panels bounding area.
[in] | w | the width. |
void GUIPanel::Update | ( | float | dt | ) | [virtual] |
Updates the panel and all of its active children.
NOTE: This controls the propagation of the OnUpdate calls down the tree.
Reimplemented in GUIScoreBoard.
void GUIPanel::VisitChildren | ( | const GUIPanelVisitor & | visitor | ) |
Visits each child util the visistors Vist method returns false or all children are visited.
NOTE: Visits children in back to front order.
void GUIPanel::VisitChildrenFrontToBack | ( | const GUIPanelVisitor & | visitor | ) |
Visits each child util the visistors Vist method returns false or all children are visited.
NOTE: Visits chidren front to back.