My Project
|
Each GUI control is associated with a CGUIResource object for rendering. More...
#include <GUIResource.h>
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 } |
![]() | |
typedef ParaEngine::weak_ptr< IObject > | WeakPtr_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 IObject * | Clone () 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 |
GUIFontElement * | GetFontElement (int index=0) |
GUITextureElement * | GetTextureElement (int index=0) |
GUIFontElement * | GetFontElement (const char *fontname) |
GUITextureElement * | GetTextureElement (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) |
GUITextureElement * | AddElement (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) |
![]() | |
virtual const IType * | GetType () const |
virtual std::string | ToString () const |
WeakPtr_type & | GetWeakReference () |
get weak reference object. More... | |
virtual int | ProcessObjectEvent (const ObjectEvent &event) |
this function is only used to backward compatibility of ParaObject:AddEvent() function. More... | |
![]() | |
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 | |
CRefCounted * | AddToAutoReleasePool () |
addref and releases the ownership sometime soon automatically (usually at the end of the current frame). More... | |
Public Attributes | |
int | m_objType |
Protected Attributes | |
GUILAYER * | m_objBackground |
GUILAYER * | m_objArtwork |
GUILAYER * | m_objOverlay |
GUILAYER * | m_pActiveLayer |
GUIResourceState | m_CurrentState |
![]() | |
WeakPtr_type | m_weak_reference |
![]() | |
int | m_refcount |
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.
|
virtual |
updates all rectangles to screen coordinate with reference to the new control position
rcWindow | The control's rectangle. |
Reimplemented from ParaEngine::IObject.
|
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.
|
virtual |
Compare the object with another object.
Inheritance should implement this function
Reimplemented from ParaEngine::IObject.
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.
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.
nLayerID |
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.
nLayerID |
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
layer | name 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. |
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
nLayerID |
void CGUIResource::SetCurrentState | ( | const char * | statename = NULL | ) |
Set the current state for setting and getting resources;.
statename | The 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. |
void CGUIResource::SetFont | ( | const char * | fontname, |
int | index = 0 |
||
) |
Set a font for the current state in the active layer of the resource object;.
fontname | name of the font which has been previously loaded. |