My Project
Public Types | Public Member Functions | Public Attributes | Protected Attributes | List of all members
ParaEngine::CGUIResource Class Reference

Each GUI control is associated with a CGUIResource object for rendering. More...

#include <GUIResource.h>

Inheritance diagram for ParaEngine::CGUIResource:
ParaEngine::IObject ParaEngine::CRefCounted

Public Types

enum  GUI_RESOURCE_TYPE {
  NONE =0, BUTTON, CONTAINER, TEXT,
  EDITBOX, IMEEDITBOX, SCROLLBAR
}
 
enum  GUI_RESOURCE_LAYER_ENUM { LAYER_ARTWORK =0, LAYER_OVERLAY, LAYER_BACKGROUND }
 
- Public Types inherited from ParaEngine::IObject
typedef ParaEngine::weak_ptr< IObjectWeakPtr_type
 

Public Member Functions

void SetActiveLayer (const char *layer)
 Set the active layer for setting and getting resource. More...
 
void SetActiveLayer (GUI_RESOURCE_LAYER_ENUM nLayerID=LAYER_ARTWORK)
 Set the active layer for setting and getting resource. More...
 
GUI_RESOURCE_LAYER_ENUM GetActiveLayer ()
 set the current layer type
 
bool HasLayer (const char *layer)
 return whether a given layer exist in the resource. More...
 
bool HasLayer (GUI_RESOURCE_LAYER_ENUM nLayerID=LAYER_ARTWORK)
 return whether a given layer exist in the resource. More...
 
GUI_RESOURCE_LAYER_ENUM GetLayerIDByName (const char *layer=NULL)
 get the layer id by name w e have three layers "artwork", "background" and "overlay" "artwork" layer is the primary layer. More...
 
void SetLayerType (int etype)
 set the current layer type
 
void SetFont (const char *fontname, int index=0)
 Set a font for the current state in the active layer of the resource object;. More...
 
void SetFontColor (DWORD color, int index=0)
 
void SetFontFormat (DWORD dwFormat, int index=0)
 
void SetFontTransparency (DWORD transparency, int index=0)
 
void SetTexture (const char *fontname, int index=0)
 
void SetTextureColor (DWORD color, int index=0)
 
void SetTextureTransparency (DWORD transparency, int index=0)
 
virtual void Clone (IObject *pobj) const
 updates all rectangles to screen coordinate with reference to the new control position More...
 
virtual IObjectClone () const
 Clone the object's contains and return a pointer to the newly created object. More...
 
virtual int Release ()
 
virtual bool Equals (const IObject *obj) const
 Compare the object with another object. More...
 
void SetDrawingRects (RECT *rcDest, int index=0)
 
RECT GetDrawingRects (int index=0) const
 
GUIFontElementGetFontElement (int index=0)
 
GUITextureElementGetTextureElement (int index=0)
 
GUIFontElementGetFontElement (const char *fontname)
 
GUITextureElementGetTextureElement (const char *texturename)
 
void SetElement (GUITextureElement *pElement, int index=0)
 
void SetElement (GUIFontElement *pElement, int index=0)
 
void CloneState (const char *statename)
 
int GetLayerType ()
 
void AddElement (const GUIFontElement *pElement, const char *name=NULL)
 
GUITextureElementAddElement (const GUITextureElement *pElement, const char *name=NULL)
 
void SetCurrentState (const char *statename=NULL)
 Set the current state for setting and getting resources;. More...
 
void SetCurrentState (GUIResourceState state)
 
GUIResourceState GetCurrentState ()
 
size_t TextureSize ()
 
size_t FontSize ()
 
void Clear ()
 
string ToScript (int option=0)
 
- Public Member Functions inherited from ParaEngine::IObject
virtual const ITypeGetType () const
 
virtual std::string ToString () const
 
WeakPtr_typeGetWeakReference ()
 get weak reference object. More...
 
virtual int ProcessObjectEvent (const ObjectEvent &event)
 this function is only used to backward compatibility of ParaObject:AddEvent() function. More...
 
- Public Member Functions inherited from ParaEngine::CRefCounted
void addref () const
 add reference count of the object. More...
 
bool delref () const
 decrease reference count of the object. More...
 
int GetRefCount () const
 get the reference count
 
CRefCountedAddToAutoReleasePool ()
 addref and releases the ownership sometime soon automatically (usually at the end of the current frame). More...
 

Public Attributes

int m_objType
 

Protected Attributes

GUILAYERm_objBackground
 
GUILAYERm_objArtwork
 
GUILAYERm_objOverlay
 
GUILAYERm_pActiveLayer
 
GUIResourceState m_CurrentState
 
- Protected Attributes inherited from ParaEngine::IObject
WeakPtr_type m_weak_reference
 
- Protected Attributes inherited from ParaEngine::CRefCounted
int m_refcount
 

Detailed Description

Each GUI control is associated with a CGUIResource object for rendering.

each CGUIResource contains three layers, which are "artwork", "background" and "overlay". "artwork" layer is the primary layer. By default, we render a control using this layer "overlay" layer is a layer on top of the "artwork" layer. "background" layer is on the bottom of the "artwork" layer. All layers are optional and created on demand. Typically, a CGUIResource has only the "artwork" layer.

Member Function Documentation

§ Clone() [1/2]

void CGUIResource::Clone ( IObject pobj) const
virtual

updates all rectangles to screen coordinate with reference to the new control position

Parameters
rcWindowThe control's rectangle.

Reimplemented from ParaEngine::IObject.

§ Clone() [2/2]

IObject * CGUIResource::Clone ( ) const
virtual

Clone the object's contains and return a pointer to the newly created object.

The caller should free the memory of the return object. Inheritance should implement this function void Clone(IObject*) and IObject* Clone() should have the same behavior

Reimplemented from ParaEngine::IObject.

§ Equals()

bool CGUIResource::Equals ( const IObject obj) const
virtual

Compare the object with another object.

Inheritance should implement this function

Reimplemented from ParaEngine::IObject.

§ GetLayerIDByName()

CGUIResource::GUI_RESOURCE_LAYER_ENUM CGUIResource::GetLayerIDByName ( const char *  layer = NULL)

get the layer id by name w e have three layers "artwork", "background" and "overlay" "artwork" layer is the primary layer.

By default, we render a control using this layer "overlay" layer is a layer on top of the "artwork" layer. "background" layer is on the bottom of the "artwork" layer. All three layers have the same property.

§ HasLayer() [1/2]

bool CGUIResource::HasLayer ( const char *  layer)

return whether a given layer exist in the resource.

One needs to call SetActiveLayer() in order to create a layer.

Parameters
nLayerID

§ HasLayer() [2/2]

bool CGUIResource::HasLayer ( GUI_RESOURCE_LAYER_ENUM  nLayerID = LAYER_ARTWORK)

return whether a given layer exist in the resource.

One needs to call SetActiveLayer() in order to create a layer.

Parameters
nLayerID

§ SetActiveLayer() [1/2]

void CGUIResource::SetActiveLayer ( const char *  layer)

Set the active layer for setting and getting resource.

it will create the layer if it does not exist

Parameters
layername of the layer We have three layers "artwork", "background" and "overlay" "artwork" layer is the primary layer. By default, we render a control using this layer "overlay" layer is a layer on top of the "artwork" layer. "background" layer is on the bottom of the "artwork" layer. All three layers have the same property. If not implicitly set, the default active layer is the "artwork" layer. We advice users always sets the active layer before changing any resource.

§ SetActiveLayer() [2/2]

void ParaEngine::CGUIResource::SetActiveLayer ( GUI_RESOURCE_LAYER_ENUM  nLayerID = LAYER_ARTWORK)

Set the active layer for setting and getting resource.

it will create the layer if it does not exist

Parameters
nLayerID

§ SetCurrentState()

void CGUIResource::SetCurrentState ( const char *  statename = NULL)

Set the current state for setting and getting resources;.

Parameters
statenameThe given state name; We have four states "normal", "highlight", "pressed" and "disabled" "normal" state is the normal appearance. By default, we render a control using this state "highlight" state is the appearance when mouse is over or the control is highlighted. "pressed" state is the appearance when the control is pressed. "disabled" state is the appearance when the control is disabled. All four layers have the same property. If it's NULL or "", we will set the font of the "normal" state; We advice users always sets the current state before changing any resource.

§ SetFont()

void CGUIResource::SetFont ( const char *  fontname,
int  index = 0 
)

Set a font for the current state in the active layer of the resource object;.

Parameters
fontnamename of the font which has been previously loaded.

The documentation for this class was generated from the following files: