My Project
|
it represents a GUI object. More...
#include <ParaScriptingGUI.h>
Public Member Functions | |
ParaUIObject (CGUIBase *obj) | |
bool | IsValid () const |
check if the object is valid More... | |
void | AddChild (ParaUIObject pChild) |
Attach a child GUI object to this object This function is only for container objects;. More... | |
ParaAttributeObject | GetAttributeObject () |
get the attribute object associated with an object. More... | |
void | GetAttributeObject_ (ParaAttributeObject &output) |
for API exportation | |
void | AddTextItem (const char *text) |
Add a text item for listbox. More... | |
void | AttachToRoot () |
Attach this object to the root of the screen GUI. | |
void | SetName (const char *szName) |
string | GetName () const |
Get the name of this object. | |
ParaUIObject | GetChild (const char *name) |
get child by name | |
ParaUIObject | GetChildAt (int index) |
get child by index.Index start from 0. More... | |
int | GetChildCount () |
get the total number of child UI objects. More... | |
int | GetID () const |
get id of this object. More... | |
void | SetID (int nID) |
this function is used internally. More... | |
ParaUIObject | GetChildByID (int nChildID) |
get a child node by its id More... | |
ParaUIObject | GetChildByName (const char *name) |
get the first child node whose name is name. More... | |
void | SetEnabled (bool bEnabled) |
Set if a control is enabled. More... | |
bool | GetEnabled () const |
void | SetUseTextShadow (bool bUseTextShadow) |
Set/Get whether the use text shadow. | |
bool | GetUseTextShadow () const |
void | SetTextScale (float fScale) |
set the text scale the text scale, default to 1.f. More... | |
float | GetTextScale () |
get the text scale the text scale, default to 1.f. More... | |
void | SetHighlightStyle (const char *style) |
const char * | GetHighlightStyle () const |
string | GetColor () const |
Get the UI control color for the current state. More... | |
void | SetColor (const char *strColor) |
set the UI control color for the current state. More... | |
void | SetZDepth (float fDepth) |
set z depth in the range [0,1], where 0 is closest to screen. More... | |
float | GetZDepth () |
get z depth | |
void | SetAutoSize (bool bAutosize) |
Set if a control is auto resize. More... | |
bool | GetAutoSize () const |
void | GetTextLineSize (int *width, int *height) |
get the text line size in pixels, supposing the current font and text will be rendered in a single line. More... | |
void | SetVisible (bool bVisible) |
Set if a control is visible. More... | |
bool | GetVisible () const |
bool | GetScrollable () const |
string | GetType () const |
void | SetReceiveDrag (bool bReceiveDrag) |
Get the resource of this control. | |
bool | GetReceiveDrag () const |
ParaUIObject | GetParent () const |
void | SetParent (ParaUIObject parent) |
object | GetField (const char *sFieldname, const object &output) |
get field by name. | |
void | SetField (const char *sFieldname, const object &input) |
set field by name More... | |
void | CallField (const char *sFieldname) |
call field by name. More... | |
void | SetDefault (bool bDefaultButton) |
set as the default button of the container. More... | |
void | SetLifeTime (int nSeconds) |
Set a count down timer in frames. More... | |
int | GetLifeTime () const |
Get a count down timer in frames. More... | |
string | GetText () const |
Get text of a control;. | |
void | SetText3 (const char *strText, const char *strColor, const char *strFontAssetName) |
Show text in the window. More... | |
void | SetText1 (const object &strText) |
void | SetText (const char *strText) |
void | SetTextAutoTranslate (const char *strText, const char *sConverter) |
basically this is the same as the SetText method, except that it will automatically translate the text from one language to another. More... | |
void | SetPasswordChar (string PasswordChar) |
this function is only supported in the "editbox" control, not the "text" or "IMEEditbox" The PasswordChar property specifies the character displayed in the edit box. More... | |
string | GetPasswordChar () const |
get password char | |
void | SetTopLevel (bool value) |
Set a container to be a top-level control or set a top-level control back to normal container. | |
void | SetBGImage1 (const object &szBackground) |
set the background image of the control. More... | |
void | SetBGImageStr (const char *szBackground) |
szBackground can be filename[; left top width height][:left top toright to bottom], such as "texture/whitedot.png", "texture/whitedot.png;0 0 64 64", "texture/whitedot.png:10 10 10 10", "texture/whitedot.png;0 0 64 64;10 10 10 10" [:left top toright to bottom] is used to specify the inner rect of the center tile in a nine texture element UI object | |
void | SetBGImage5 (const char *TextFilename, int left, int top, int width, int height) |
void | SetBGImage (ParaAssetObject pTextureEntity) |
void | SetBGImageAndRect (ParaAssetObject pTextureEntity, int left, int top, int width, int height) |
void | SetBGImage_ (TextureEntity *pTextureEntity, RECT *rect) |
void | SetBGImage2 (const char *TextFilename, RECT *rect) |
string | GetBGImage () const |
void | SetBtnImage2 (const char *TextFilename, RECT *rect) |
void | SetBtnImage1 (const object &szButton) |
string | GetBtnImage () const |
void | SetNineElementBG (const char *TextFilename, int left, int top, int toRight, int toBottom) |
drawing the background using nine element. More... | |
int | GetFirstVisibleCharIndex () |
this method is only valid if the control is edit box or imeedit box if the text is longer than the edit box, the returned value is the index of the first visible character in the edit box Normally, this is 0 if the text can be fully contained in the edit box. | |
int | GetCaretPosition () |
return Caret position in characters | |
void | SetCaretPosition (int nCharacterPos) |
Set Caret position in characters. More... | |
int | GetTextSize () |
return the text size in Unicode character count. | |
void | GetPriorWordPos (int nCP, int PriorIn, int &Prior) |
get the prior word position | |
void | GetNextWordPos (int nCP, int NextIn, int &Next) |
get the next word position | |
void | CPtoXY (int nCP, bool bTrail, int XIn, int YIn, int &X, int &Y) |
Character position to X,Y in pixel. | |
void | XYtoCP (int nX, int nY, int CPIn, int nTrailIn, int &CP, int &nTrail) |
X,Y in pixel to character position. | |
void | SetPageSize (int pagesize) |
Get the page size of the scroll bar Page size is the size of how many items a page contains. More... | |
void | SetStep (int nDelta) |
how many pixels to scroll each step | |
int | GetStep () |
how many pixels to scroll each step | |
void | SetTrackRange (int nBegin, int nEnd) |
set the page size of a container or a scroll bar More... | |
void | GetTrackRange (int &nBegin, int &nEnd) |
int | GetAnimationStyle () const |
get the animation style of this object. More... | |
void | SetAnimationStyle (int nStyle) |
set the animation style of this object. More... | |
void | SetScrollable (bool bScrollable) |
Set if a container is scrollable. More... | |
void | GetAbsPosition (float &x, float &y, float &width, float &height, float &z) const |
get the absolute position of the control in screen coordinate e.g. More... | |
void | SetPosition (const char *pos) |
set rect position of the control. More... | |
string | GetPosition () const |
get rect position of the control | |
void | Reposition (const char *alignment, int left, int top, int width, int height) |
reposition the control using the same parameter definition used when control is created. More... | |
int | GetValue () const |
Gets and Sets the value of a control Controls that have value are CGUIScrollBar, CGUISlider. | |
void | SetValue (int value) |
void | OnClick (const object &strScriptName) |
When the user clicked on the window, the script file or function will be activated. More... | |
string | GetOnClick () const |
void | OnSize (const object &strScriptName) |
called when the size of the window is changed. More... | |
string | GetOnSize () const |
void | OnDestroy (const object &strScriptName) |
called when the window is destroyed. More... | |
string | GetOnDestroy () const |
void | OnActivate (const object &strScriptName) |
The framework calls this member function when a window is being activated or deactivated. More... | |
string | GetOnActivate () const |
void | OnDoubleClick (const object &strScriptName) |
The following parameters are passed as global variables. More... | |
string | GetOnDoubleClick () const |
void | OnKeyDown (const object &strScriptName) |
When the user pressed a key while the mouse cursor is inside the window, a script file or function will be activated. More... | |
string | GetOnKeyDown () const |
void | OnKeyUp (const object &strScriptName) |
string | GetOnKeyUp () const |
void | OnDragBegin (const object &strScriptName) |
string | GetOnDragBegin () const |
void | OnDragEnd (const object &strScriptName) |
string | GetOnDragEnd () const |
void | OnDragOver (const object &strScriptName) |
string | GetOnDragOver () const |
void | OnMouseMove (const object &strScriptName) |
string | GetOnMouseMove () const |
void | OnMouseHover (const object &strScriptName) |
string | GetOnMouseHover () const |
void | OnMouseEnter (const object &strScriptName) |
string | GetOnMouseEnter () const |
void | OnMouseLeave (const object &strScriptName) |
string | GetOnMouseLeave () const |
void | OnMouseDown (const object &strScriptName) |
string | GetOnMouseDown () const |
void | OnMouseUp (const object &strScriptName) |
string | GetOnMouseUp () const |
void | OnMouseWheel (const object &strScriptName) |
string | GetOnMouseWheel () const |
void | OnFrameMove (const object &strScriptName) |
string | GetOnFrameMove () const |
void | OnTouch (const object &strScriptName) |
string | GetOnTouch () const |
void | OnDraw (const object &strScriptName) |
string | GetOnDraw () const |
void | OnInputMethod (const object &strScriptName) |
string | GetOnInputMethod () const |
void | SetCursor (const object &szCursorFile) |
Set/Get cursor file when mouse is over it. More... | |
std::string | GetCursor () const |
void | SetCursorEx (const char *szCursorFile, int nHotSpotX, int nHotSpotY) |
Set cursor by file and hot spot. | |
void | OnChange (const object &strScriptName) |
usually the editbox will call this handle, "virtual_key" contains the last key stroke. More... | |
string | GetOnChange () const |
void | OnSelect (const object &strScriptName) |
string | GetOnSelect () const |
void | OnModify (const object &strScriptName) |
string | GetOnModify () const |
void | SetCanDrag (bool bCanDrag) |
bool | GetCanDrag () const |
void | SetFontString (const char *font) |
void | SetFontString1 (const object &font) |
void | SetFontString3 (const char *fontname, DWORD fontsize, bool isbold) |
string | ToScript () const |
string | GetFontString () const |
void | Focus () |
void | LostFocus () |
bool | GetReadOnly () const |
void | SetReadOnly (bool readonly) |
int | GetX () const |
int | GetY () const |
float | GetDepth () const |
void | SetDepth (float depth) |
void | SetX (int x) |
void | SetY (int y) |
void | SetWidth (int width) |
void | SetHeight (int height) |
int | Width () const |
int | Height () const |
void | SetSize (int width, int height) |
void | SetRotation (float fRot) |
set the rotation of the control around the center of the UI plus rotation origin offset. More... | |
float | GetRotation () const |
Get the rotation of the control around the center of the UI plus rotation origin offset. More... | |
void | SetRotOriginOffset (float x, float y) |
rotation origin offset from the center of the UI object. More... | |
void | GetRotOriginOffset (float *x, float *y) const |
rotation origin offset from the center of the UI object. More... | |
void | SetScaling (float x, float y) |
set the scaling of the control around the center of the UI plus rotation origin offset. More... | |
void | GetScaling (float *x, float *y) const |
Get the scaling of the control around the center of the UI plus rotation origin offset. More... | |
void | SetScalingX (float x) |
float | GetScalingX () const |
void | SetScalingY (float y) |
float | GetScalingY () const |
void | SetTranslation (float x, float y) |
set the translation of the control around the center of the UI plus rotation origin offset. More... | |
void | GetTranslation (float *x, float *y) const |
Get the translation of the control around the center of the UI plus rotation origin offset. More... | |
void | SetTranslationX (float x) |
float | GetTranslationX () const |
void | SetTranslationY (float y) |
float | GetTranslationY () const |
void | SetColorMask (const char *strColor) |
color mask, no matter what state the control is in. More... | |
string | GetColorMask () const |
void | ApplyAnim () |
automatically animate the child nodes according to this object's rotation, scaling, translation and color mask values. | |
void | SetSpacing (int nSpacing) |
Spacing between the text and the edge of border. | |
int | GetSpacing () const |
Spacing between the text and the edge of border. | |
int | GetScrollbarWidth () const |
void | SetScrollbarWidth (int width) |
bool | GetFixedThumb () const |
void | SetFixedThumb (bool bFixed) |
int | GetThumbSize () const |
void | SetThumbSize (int size) |
void | SetBindingObj (ParaUIObject obj) |
void | SetFastRender (bool fastrender) |
bool | GetFastRender () const |
bool | GetWordbreak () const |
void | SetWordbreak (bool wordbreak) |
int | GetItemHeight () const |
void | SetItemHeight (int itemheight) |
bool | GetMultipleSelect () const |
void | SetMultipleSelect (bool multiple) |
void | AttachTo3D (const ParaObject obj) |
Attach the control to the 3D object. More... | |
void | AttachTo3D_ (const char *s3DObjectName) |
save as AttachTo3D, except that the 3D object's name is specified. More... | |
string | GetToolTip () const |
void | SetToolTip (const object &tooltip) |
void | RemoveAll () |
void | RemoveItem (int index) |
void | SetPopUp (int popup) |
int | GetPopUp () const |
ParaUIFont | CreateFont (const char *name, const char *fontname) |
ParaUITexture | CreateTexture (const char *name, const char *texturename) |
ParaUIFont | GetFont (const char *name) |
get font by name. More... | |
ParaUIFont | GetFont_ (int nIndex) |
get font by index | |
void | DoAutoSize () |
try to automatically adjust the size of this object to contain all its content. More... | |
ParaUITexture | GetTexture (const object &name) |
Get the texture object associated with the current control A control may be associated with multiple textures. More... | |
void | BringToFront () |
bring to front among the same z order | |
void | BringToBack () |
bring to back among the same z order | |
int | GetZOrder () const |
z order affect the order of rendering. More... | |
void | SetZOrder (int nOrder) |
z order affect the order of rendering. More... | |
bool | IsModified () const |
void | SetActiveLayer (const char *layer) |
Set the active layer for setting resource;. More... | |
bool | HasLayer (const char *layer) |
return whether a given layer exist in the resource. More... | |
void | SetCurrentState (const char *statename) |
Set the current state for setting resource: More... | |
void | CloneState (const char *statename) |
Clones a state to the current state. More... | |
void | ActivateScript (const char *scripttype) |
void | InvalidateRect () |
the window's client(child) area that must be recalculated and redrawn this function is obsoleted, call UpdateRect() instead | |
void | UpdateRect () |
recalculated the window's client rect | |
Public Attributes | |
CGUIBase::WeakPtr_type | m_pObj |
Protected Member Functions | |
string | GenGetImage (int index) const |
string | GenGetFont (int index) const |
it represents a GUI object.
void ParaScripting::ParaUIObject::AddChild | ( | ParaUIObject | pChild | ) |
Attach a child GUI object to this object This function is only for container objects;.
pChild | the child object to be attached |
void ParaScripting::ParaUIObject::AddTextItem | ( | const char * | text | ) |
Add a text item for listbox.
text | the text string to be added. |
void ParaScripting::ParaUIObject::AttachTo3D | ( | const ParaObject | obj | ) |
Attach the control to the 3D object.
This function will internally call AttachToRoot() if it has not been called previously One can call this function multiple times move the attached GUI object from one 3D object to another.
obj | this must be a global object |
void ParaScripting::ParaUIObject::AttachTo3D_ | ( | const char * | s3DObjectName | ) |
save as AttachTo3D, except that the 3D object's name is specified.
s3DObjectName | this must be the name of a global object. |
void ParaScripting::ParaUIObject::CallField | ( | const char * | sFieldname | ) |
call field by name.
This function is only valid when The field type is void. It simply calls the function associated with the field name.
void ParaScripting::ParaUIObject::CloneState | ( | const char * | statename | ) |
Clones a state to the current state.
statename | name of the state We have four states "normal", "highlight", "pressed", "disabled" "normal" state is the default state. "highlight" state is the highlighted state. Some controls will change their state to "highlight" automatically when mouse enters them. "pressed" state is when a button or something else is pressed. "disabled" state is when a control is disabled. |
void ParaScripting::ParaUIObject::DoAutoSize | ( | ) |
try to automatically adjust the size of this object to contain all its content.
void ParaScripting::ParaUIObject::GetAbsPosition | ( | float & | x, |
float & | y, | ||
float & | width, | ||
float & | height, | ||
float & | z | ||
) | const |
get the absolute position of the control in screen coordinate e.g.
local x,y = obj:GetAbsPosition();
&x | screen x |
&y | screen y |
&width | width |
&height | height |
&z | depth, usually not used |
int ParaScripting::ParaUIObject::GetAnimationStyle | ( | ) | const |
get the animation style of this object.
Different GUI object may have different style definitions. for "button" object: 1 is gradually enlarge 5% when getting focus.2 is 10%, 3 is 15%, 4 is 20%, 5 is 25%
ParaAttributeObject ParaScripting::ParaUIObject::GetAttributeObject | ( | ) |
get the attribute object associated with an object.
ParaUIObject ParaScripting::ParaUIObject::GetChildAt | ( | int | index | ) |
get child by index.Index start from 0.
Use GetChildCount() for total child count.
ParaScripting::ParaUIObject ParaScripting::ParaUIObject::GetChildByID | ( | int | nChildID | ) |
get a child node by its id
nChildID | child ID usually obtained by GetID() method. |
ParaScripting::ParaUIObject ParaScripting::ParaUIObject::GetChildByName | ( | const char * | name | ) |
get the first child node whose name is name.
Since a name may not be unique among its sibling children. One is advised to use GetChildByID() instead.
name | child name usually obtained by GetName() method. |
int ParaScripting::ParaUIObject::GetChildCount | ( | ) |
get the total number of child UI objects.
string ParaScripting::ParaUIObject::GetColor | ( | ) | const |
Get the UI control color for the current state.
ParaUIFont ParaScripting::ParaUIObject::GetFont | ( | const char * | name | ) |
get font by name.
The prefered way is to get by index.
name | this is usually "text". |
int ParaScripting::ParaUIObject::GetID | ( | ) | const |
get id of this object.
please note that this is a child id, not a globally unique id. the id is only available when this object is attached to a parent. And the ID will change if this object changes its parent. In all other circumstances, the id uniquely identify this object in its parent. One can call GetChildByID() from its parent control to get this object. Note: ID is assigned by its parent when this control is attached to a parent control (or parent changes) it ensures that ChildID is unique among all sibling children of the parent control during the lifetime of the parent.
int ParaScripting::ParaUIObject::GetLifeTime | ( | ) | const |
Get a count down timer in frames.
when it is zero, the object will be automatically deleted If LifeTime is negative, the object will be permanent.
float ParaScripting::ParaUIObject::GetRotation | ( | ) | const |
Get the rotation of the control around the center of the UI plus rotation origin offset.
it only affects the drawing rect but not the mouse sensor rect. it is usually used for visual effect, so there is no need to update or calculate client rect.
void ParaScripting::ParaUIObject::GetRotOriginOffset | ( | float * | x, |
float * | y | ||
) | const |
rotation origin offset from the center of the UI object.
void ParaScripting::ParaUIObject::GetScaling | ( | float * | x, |
float * | y | ||
) | const |
Get the scaling of the control around the center of the UI plus rotation origin offset.
it only affects the drawing rect but not the mouse sensor rect. it is usually used for visual effect, so there is no need to update or calculate client rect.
void ParaScripting::ParaUIObject::GetTextLineSize | ( | int * | width, |
int * | height | ||
) |
get the text line size in pixels, supposing the current font and text will be rendered in a single line.
float ParaScripting::ParaUIObject::GetTextScale | ( | ) |
get the text scale the text scale, default to 1.f.
if we have text scale between 1.1-1.5 and shadow to true, the text will have an alpha border. This is great for rendering text in 3d scene with a boarder using just normal system font.
ParaUITexture ParaScripting::ParaUIObject::GetTexture | ( | const object & | name | ) |
Get the texture object associated with the current control A control may be associated with multiple textures.
name | different controls have set of textures. it can be one of the following predefined string.
|
void ParaScripting::ParaUIObject::GetTranslation | ( | float * | x, |
float * | y | ||
) | const |
Get the translation of the control around the center of the UI plus rotation origin offset.
it only affects the drawing rect but not the mouse sensor rect. it is usually used for visual effect, so there is no need to update or calculate client rect.
int ParaScripting::ParaUIObject::GetZOrder | ( | ) | const |
z order affect the order of rendering.
The parent control sort and render child control from small z value to larger z value. default value is 0.
bool ParaScripting::ParaUIObject::HasLayer | ( | const char * | layer | ) |
return whether a given layer exist in the resource.
One needs to call SetActiveLayer() in order to create a layer.
layer | it can be one of the three layers "artwork", "background" and "overlay". Typically, all controls contains the "artwork" layer. |
bool ParaScripting::ParaUIObject::IsValid | ( | ) | const |
check if the object is valid
void ParaScripting::ParaUIObject::OnActivate | ( | const object & | strScriptName | ) |
The framework calls this member function when a window is being activated or deactivated.
id = int; – the id of the triggering GUI window param1: Specifies whether the window is being activated or deactivated. It can be one of the following values:
void ParaScripting::ParaUIObject::OnChange | ( | const object & | strScriptName | ) |
usually the editbox will call this handle, "virtual_key" contains the last key stroke.
Usually application may check if it is an enter key for special actions.
void ParaScripting::ParaUIObject::OnClick | ( | const object & | strScriptName | ) |
When the user clicked on the window, the script file or function will be activated.
The following parameters are passed as global variables. id = int; – the id of the triggering GUI window mouse_button = ["left"|"right"|"middle"]; mouse_x = number; mouse_y = number;
strScriptName | the NPL script file to activate. |
void ParaScripting::ParaUIObject::OnDestroy | ( | const object & | strScriptName | ) |
called when the window is destroyed.
Please note that GetUIObject() will return invalid object.
void ParaScripting::ParaUIObject::OnDoubleClick | ( | const object & | strScriptName | ) |
The following parameters are passed as global variables.
id = int; – the id of the triggering GUI window mouse_button = ["left"|"right"|"middle"]; mouse_x = number; mouse_y = number;
strScriptName |
void ParaScripting::ParaUIObject::OnKeyDown | ( | const object & | strScriptName | ) |
When the user pressed a key while the mouse cursor is inside the window, a script file or function will be activated.
The following parameters are passed as global variables. id = int; – the id of the triggering GUI window keystring = string;–it is filled with the key character. e.g. "\r", "a", etc. It may contain multiple characters, if the user is typing fast or Multi-byte such as Chinese Character is entered.
strScriptName | the NPL script file to activate. |
void ParaScripting::ParaUIObject::OnSize | ( | const object & | strScriptName | ) |
called when the size of the window is changed.
id = int; – the id of the triggering GUI window
void ParaScripting::ParaUIObject::Reposition | ( | const char * | alignment, |
int | left, | ||
int | top, | ||
int | width, | ||
int | height | ||
) |
reposition the control using the same parameter definition used when control is created.
see ParaUI::CreateUIObject() for parameter definition.
void ParaScripting::ParaUIObject::SetActiveLayer | ( | const char * | layer | ) |
Set the active layer for setting resource;.
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 are the same. If not implicitly set, the default active layer is the "artwork" layer. But when a user wants to set something, remember to call this function to ensure that the active layer is correct. |
void ParaScripting::ParaUIObject::SetAnimationStyle | ( | int | nStyle | ) |
set the animation style of this object.
Different GUI object may have different style definitions. for "button" object: 1 is gradually enlarge 5% when getting focus.2 is 10%, 3 is 15%, 4 is 20%, 5 is 25%
nStyle | 0 always means no animation. 1 is gradually enlarge 5% when getting focus.2 is 10%, 3 is 15%, 4 is 20%, 5 is 25% 11-15 means the same as 1-5, except that the normal state alpha is the same as the highlighted state. 21-25 means the same as 11-15, except that the button animation will not stop in the highlighted state. 31-39 is clock-wise rotation, the larger the faster 41-49 is counter-clock-wise rotation, the larger the faster |
void ParaScripting::ParaUIObject::SetAutoSize | ( | bool | bAutosize | ) |
Set if a control is auto resize.
bAutosize | the new value |
void ParaScripting::ParaUIObject::SetBGImage1 | ( | const object & | szBackground | ) |
set the background image of the control.
szBackground | the texture asset file name with the rectangle information the format of szBackground is filename[; left top width height][:left top toright to bottom]. if it is "" or width or height is zero, the texture is not drawn or is fully transparent. e.g. "texture/whitedot.png", "texture/whitedot.png;0 0 64 64", "texture/whitedot.png:10 10 10 10", "texture/whitedot.png;0 0 64 64;10 10 10 10" [:left top toright to bottom] is used to specify the inner rect of the center tile in a nine texture element UI object |
void ParaScripting::ParaUIObject::SetCaretPosition | ( | int | nCharacterPos | ) |
Set Caret position in characters.
nCharacterPos | in characters |
void ParaScripting::ParaUIObject::SetColor | ( | const char * | strColor | ) |
set the UI control color for the current state.
strColor:"255 | 0 0" or "255 0 0 128" |
void ParaScripting::ParaUIObject::SetColorMask | ( | const char * | strColor | ) |
color mask, no matter what state the control is in.
"r g b a", such as "255 255 255 255"
void ParaScripting::ParaUIObject::SetCurrentState | ( | const char * | statename | ) |
Set the current state for setting resource:
statename | name of the state We have four states "normal", "highlight", "pressed", "disabled" "normal" state is the default state. "highlight" state is the highlighted state. Some controls will change their state to "highlight" automatically when mouse enters them. "pressed" state is when a button or something else is pressed. "disabled" state is when a control is disabled. If not implicitly set, the default state is the "normal" state. But when a user wants to set something, remember to call this function to ensure that the current state is correct. |
void ParaScripting::ParaUIObject::SetCursor | ( | const object & | szCursorFile | ) |
Set/Get cursor file when mouse is over it.
If empty, the parent cursor file is used.
void ParaScripting::ParaUIObject::SetDefault | ( | bool | bDefaultButton | ) |
set as the default button of the container.
please note each container can only have one default button. so as one set a default button, it will automatically unset old default button in the parent container. when enter key is pressed in an edit box, the default button will be clicked.
void ParaScripting::ParaUIObject::SetEnabled | ( | bool | bEnabled | ) |
Set if a control is enabled.
bEnabled | the new value |
void ParaScripting::ParaUIObject::SetField | ( | const char * | sFieldname, |
const object & | input | ||
) |
set field by name
sFieldname | field name |
input | input value. if field type is vectorN, input is a table with N items. |
void ParaScripting::ParaUIObject::SetID | ( | int | nID | ) |
this function is used internally.
never call this unless you known why.
void ParaScripting::ParaUIObject::SetLifeTime | ( | int | nSeconds | ) |
Set a count down timer in frames.
when it is zero, the object will be automatically deleted If LifeTime is negative, the object will be permanent.
nSeconds | how many seconds the window left to be alive. |
void ParaScripting::ParaUIObject::SetNineElementBG | ( | const char * | TextFilename, |
int | left, | ||
int | top, | ||
int | toRight, | ||
int | toBottom | ||
) |
drawing the background using nine element.
TextFilename | the background texture to use. it will be divided into 3x3 tiles when drawing the control |
left,top,toRight,toBottom | the inner tile position relative to the dimension of TextFilename texture. If all are 0, it will be set back to one element background |
void ParaScripting::ParaUIObject::SetPageSize | ( | int | pagesize | ) |
Get the page size of the scroll bar Page size is the size of how many items a page contains.
The control will scroll a page size if we click on the empty space of the track of the scroll bar
void ParaScripting::ParaUIObject::SetPasswordChar | ( | string | PasswordChar | ) |
this function is only supported in the "editbox" control, not the "text" or "IMEEditbox" The PasswordChar property specifies the character displayed in the edit box.
For example, if you want asterisks displayed in the password box, specify * for the PasswordChar property in the Properties window. Then, regardless of what character a user types in the text box, an asterisk is displayed.
PasswordChar | such as '*' |
void ParaScripting::ParaUIObject::SetPosition | ( | const char * | pos | ) |
set rect position of the control.
pos | in format "x y width height" |
void ParaScripting::ParaUIObject::SetRotation | ( | float | fRot | ) |
set the rotation of the control around the center of the UI plus rotation origin offset.
it only affects the drawing rect but not the mouse sensor rect. it is usually used for visual effect, so there is no need to update or calculate client rect.
void ParaScripting::ParaUIObject::SetRotOriginOffset | ( | float | x, |
float | y | ||
) |
rotation origin offset from the center of the UI object.
void ParaScripting::ParaUIObject::SetScaling | ( | float | x, |
float | y | ||
) |
set the scaling of the control around the center of the UI plus rotation origin offset.
it only affects the drawing rect but not the mouse sensor rect. it is usually used for visual effect, so there is no need to update or calculate client rect.
void ParaScripting::ParaUIObject::SetScrollable | ( | bool | bScrollable | ) |
Set if a container is scrollable.
bScrollable | the new scrollable value |
void ParaScripting::ParaUIObject::SetText3 | ( | const char * | strText, |
const char * | strColor, | ||
const char * | strFontAssetName | ||
) |
Show text in the window.
The text will fill the entire window. If one want to position text in a window, it must create another window to contain the text, then use the window to position the text.
strText | text to display (must be in utf8) |
strColor | color of the object. such as "255 255 255". |
strFontAssetName | the font asset name, it can be "", in which case the default font will be used. |
void ParaScripting::ParaUIObject::SetTextAutoTranslate | ( | const char * | strText, |
const char * | sConverter | ||
) |
basically this is the same as the SetText method, except that it will automatically translate the text from one language to another.
please note that this method does not solve all localization problems, but it allows for quick machine translation .
strText | utf8 encoded text |
sConverter | it should be one of the supported converter name. a most common usage is "c_S2T" where simplified Chinese character is translated to traditional Chinese. The asset file "locale/c_simpl_to_trad.txt" is used. |
void ParaScripting::ParaUIObject::SetTextScale | ( | float | fScale | ) |
set the text scale the text scale, default to 1.f.
if we have text scale between 1.1-1.5 and shadow to true, the text will have an alpha border. This is great for rendering text in 3d scene with a boarder using just normal system font.
void ParaScripting::ParaUIObject::SetTrackRange | ( | int | nBegin, |
int | nEnd | ||
) |
set the page size of a container or a scroll bar
nBegin | the start value of the range |
nEnd | the end value of the range |
void ParaScripting::ParaUIObject::SetTranslation | ( | float | x, |
float | y | ||
) |
set the translation of the control around the center of the UI plus rotation origin offset.
it only affects the drawing rect but not the mouse sensor rect. it is usually used for visual effect, so there is no need to update or calculate client rect.
void ParaScripting::ParaUIObject::SetVisible | ( | bool | bVisible | ) |
Set if a control is visible.
bVisible | the new value |
void ParaScripting::ParaUIObject::SetZDepth | ( | float | fDepth | ) |
set z depth in the range [0,1], where 0 is closest to screen.
if this is -1(default), zdepth is automatically determined. Otherwise it will force the z depth.
void ParaScripting::ParaUIObject::SetZOrder | ( | int | nOrder | ) |
z order affect the order of rendering.
The parent control sort and render child control from small z value to larger z value. default value is 0. if this control has a parent it will cause the parent to sort all children again.