Main Page | Class Hierarchy | Alphabetical List | Class List | File List | Class Members

Button Class Reference

#include <button.h>

Inheritance diagram for Button:

Inheritance graph
[legend]
Collaboration diagram for Button:

Collaboration graph
[legend]
List of all members.

Detailed Description

A clickable button with two states.

Author:
Mattias Jansson (mattias@realityrift.com)


Public Types

enum  STATE { UP = 0, DOWN = 1 }
 Button state identifiers. More...

enum  HITTESTRESULT { OUTSIDE, INSIDE, EDGE }
 Identifiers for hit test result. More...


Public Member Functions

 Button (Object *pkParent, Button *pkObject=0, bool bCreateAreas=true)
virtual ~Button ()
virtual const CoordSetSize (const Coord &rkSize)
virtual bool Render (NeoEngine::Frustum *pkFrustum=0, bool bForce=false)
virtual BorderAreaGetStateObject (STATE eState)
virtual unsigned int ProcessMsg (Msg *pkMsg)
virtual ObjectDuplicate (Object *pkParent=0, Object *pkObject=0)
virtual const CoordSetPosition (const Coord &rkPos)
const CoordGetPosition () const
const CoordGetWorldPosition ()
const CoordGetSize () const
virtual void SetName (const NeoEngine::HashString &rstrName)
virtual const NeoEngine::HashString & GetName () const
virtual void SetAttribute (const AttributeBase &rkAttribute)
unsigned int GetID () const
virtual ObjectGetParent ()
virtual ObjectGetRoot ()
virtual ObjectGetObject (const std::string &rstrName)
virtual const std::vector<
Object * > & 
GetChildObjects () const
virtual void AttachObject (Object *pkObject)
virtual void DetachObject (Object *pkObject)
virtual void AttachToObject (Object *pkParent)
virtual void AddHook (MsgHook *pkMsgHook)
virtual void RemoveHook (MsgHook *pkMsgHook)
virtual void Input (const NeoEngine::InputEvent *pkEvent)
HITTESTRESULT HitTest (const Coord &rkCoord)
virtual void Update (float fDeltaTime)

Protected Member Functions

void UpdateWorldCache (bool bRecurse=true)

Protected Attributes

BorderAream_pkState [2]
STATE m_eState
unsigned int m_uiID
Objectm_pkParent
std::vector< Object * > m_vpkChildren
Coord m_kPos
Coord m_kWorldPos
Coord m_kSize
NeoEngine::HashString m_strName
std::vector< MsgHook * > m_vpkMsgHook
HITTESTRESULT m_eLastMouse


Member Enumeration Documentation

enum STATE
 

Button state identifiers.

Enumeration values:
UP  Not pressed
DOWN  Pressed

enum HITTESTRESULT [inherited]
 

Identifiers for hit test result.

Enumeration values:
OUTSIDE  Coordinate was outside area
INSIDE  Coordinate was inside area
EDGE  Coordinate was on edge of area


Constructor & Destructor Documentation

Button Object pkParent,
Button pkObject = 0,
bool  bCreateAreas = true
 

Parameters:
pkParent Parent object
pkObject Reference object to copy values from
bCreateAreas Create child areas if true

virtual ~Button  )  [virtual]
 


Member Function Documentation

virtual const Coord& SetSize const Coord rkSize  )  [virtual]
 

Set size for both state children

Parameters:
rkSize Size
Returns:
New size

Reimplemented from Object.

virtual bool Render NeoEngine::Frustum *  pkFrustum = 0,
bool  bForce = false
[virtual]
 

Render object, recurses on children

Parameters:
pkFrustum Currently ignored
bForce Force rendering
Returns:
true if rendered, false if not

Reimplemented from Object.

virtual BorderArea* GetStateObject STATE  eState  )  [virtual]
 

Returns:
Borderarea object for state

virtual unsigned int ProcessMsg Msg pkMsg  )  [virtual]
 

Process message

Parameters:
pkMsg Message object
Returns:
Message specific return code, 0 indicates message was unprocessed

Reimplemented from Object.

virtual Object* Duplicate Object pkParent = 0,
Object pkObject = 0
[virtual]
 

Duplicate and/or copy this object

Parameters:
pkParent Parent object to attach to
pkObject Object to copy data into, if null will allocate new object
Returns:
New object that is duplicate of this object

Reimplemented from Object.

void UpdateWorldCache bool  bRecurse = true  )  [protected, inherited]
 

Update world cache position and recurse on children if flag set

Parameters:
bRecurse Recursion flag

virtual const Coord& SetPosition const Coord rkPos  )  [virtual, inherited]
 

Set position relative parent

Parameters:
rkPos Position
Returns:
New relative position

const Coord& GetPosition  )  const [inherited]
 

Returns:
Position relative parent

const Coord& GetWorldPosition  )  [inherited]
 

Returns:
World position

const Coord& GetSize  )  const [inherited]
 

Returns:
Size

virtual void SetName const NeoEngine::HashString &  rstrName  )  [virtual, inherited]
 

Parameters:
rstrName New name

virtual const NeoEngine::HashString& GetName  )  const [virtual, inherited]
 

Returns:
Name

virtual void SetAttribute const AttributeBase rkAttribute  )  [virtual, inherited]
 

Set an attribute

Parameters:
rkAttribute Attribute

Reimplemented in TextArea.

unsigned int GetID  )  const [inline, inherited]
 

Returns:
Object ID

virtual Object* GetParent  )  [virtual, inherited]
 

Returns:
Parent object

virtual Object* GetRoot  )  [virtual, inherited]
 

Returns:
Root object

virtual Object* GetObject const std::string &  rstrName  )  [virtual, inherited]
 

Search for a child object by name ("parent" for parent object, "root" for root object)

Parameters:
rstrName Name of object
Returns:
Matching child object, null if not found

virtual const std::vector< Object* >& GetChildObjects  )  const [virtual, inherited]
 

Get all child objects (no recursion)

Returns:
Vector with child objects

virtual void AttachObject Object pkObject  )  [virtual, inherited]
 

Attach window object

Parameters:
pkObject Object

virtual void DetachObject Object pkObject  )  [virtual, inherited]
 

Detach window object

Parameters:
pkObject Object

virtual void AttachToObject Object pkParent  )  [virtual, inherited]
 

Attach this object to new parent

Parameters:
pkParent Parent object

virtual void AddHook MsgHook pkMsgHook  )  [virtual, inherited]
 

Add a message hook object (hook object will be freed in dtor)

Parameters:
pkMsgHook Message hook object

virtual void RemoveHook MsgHook pkMsgHook  )  [virtual, inherited]
 

Remove a message hook object (you must now free the hook object yourself)

Parameters:
pkMsgHook Message hook object

virtual void Input const NeoEngine::InputEvent *  pkEvent  )  [virtual, inherited]
 

Process input

Parameters:
pkEvent Event

HITTESTRESULT HitTest const Coord rkCoord  )  [inherited]
 

Test if coordinate is inside, on edge or outside object area

Parameters:
rkCoord Coordinate to test
Returns:
Hit test identifier

virtual void Update float  fDeltaTime  )  [virtual, inherited]
 

Update object

Parameters:
fDeltaTime Deltatime passed since last update

Reimplemented in EditBox.


Member Data Documentation

BorderArea* m_pkState[2] [protected]
 

Button state objects

STATE m_eState [protected]
 

Current state

unsigned int m_uiID [protected, inherited]
 

Unique ID

Object* m_pkParent [protected, inherited]
 

Parent object

std::vector< Object* > m_vpkChildren [protected, inherited]
 

Children

Coord m_kPos [protected, inherited]
 

Position relative parent

Coord m_kWorldPos [protected, inherited]
 

World position

Coord m_kSize [protected, inherited]
 

Size

NeoEngine::HashString m_strName [protected, inherited]
 

Name

std::vector< MsgHook* > m_vpkMsgHook [protected, inherited]
 

Hooked message actions

HITTESTRESULT m_eLastMouse [protected, inherited]
 

Result of last mouse hit test


The documentation for this class was generated from the following file:
Generated on Wed Jan 21 14:21:20 2004 for NeoWTK by doxygen 1.3.5