Pyrogenesis
13997
|
Appends button behaviours to the IGUIObject. More...
#include <IGUIButtonBehavior.h>
Public Member Functions | |
IGUIButtonBehavior () | |
virtual | ~IGUIButtonBehavior () |
virtual void | HandleMessage (SGUIMessage &Message) |
void | DrawButton (const CRect &rect, const float &z, CGUISpriteInstance &sprite, CGUISpriteInstance &sprite_over, CGUISpriteInstance &sprite_pressed, CGUISpriteInstance &sprite_disabled, int cell_id) |
This is a function that lets a button being drawn, it regards if it's over, disabled, pressed and such. More... | |
CColor | ChooseColor () |
Choosing which color of the following according to object enabled/hovered/pressed status: textcolor_disabled – disabled textcolor_pressed – pressed textcolor_over – hovered. More... | |
![]() | |
IGUIObject () | |
virtual | ~IGUIObject () |
virtual bool | MouseOver () |
Checks if mouse is hovering this object. More... | |
virtual bool | MouseOverIcon () |
Test if mouse position is over an icon. More... | |
const CStr & | GetName () const |
Get object name, name is unique. More... | |
void | SetName (const CStr &Name) |
Get object name. More... | |
CStr | GetPresentableName () const |
void | AddToPointersMap (map_pObjects &ObjectMap) |
Adds object and its children to the map, it's name being the first part, and the second being itself. More... | |
void | AddChild (IGUIObject *pChild) |
Notice nothing will be returned or thrown if the child hasn't been inputted into the GUI yet. More... | |
vector_pObjects::iterator | ChildrenItBegin () |
vector_pObjects::iterator | ChildrenItEnd () |
bool | SettingExists (const CStr &Setting) const |
Checks if settings exists, only available for derived classes that has this set up, that's why the base class just returns false. More... | |
virtual void | UpdateCachedSize () |
All sizes are relative to resolution, and the calculation is not wanted in real time, therefore it is cached, update the cached size with this function. More... | |
PSRETURN | SetSetting (const CStr &Setting, const CStrW &Value, const bool &SkipMessage=false) |
Set a setting by string, regardless of what type it is. More... | |
PSRETURN | GetSettingType (const CStr &Setting, EGUISettingType &Type) const |
Retrieves the type of a named setting. More... | |
void | RegisterScriptHandler (const CStr &Action, const CStr &Code, CGUI *pGUI) |
Set the script handler for a particular object-specific action. More... | |
JSObject * | GetJSObject () |
Retrieves the JSObject representing this GUI object. More... | |
CGUI * | GetGUI () |
const CGUI * | GetGUI () const |
void | SetFocus () |
Take focus! More... | |
Protected Member Functions | |
virtual void | ResetStates () |
![]() | |
void | AddSetting (const EGUISettingType &Type, const CStr &Name) |
Add a setting to m_Settings. More... | |
virtual void | Destroy () |
Calls Destroy on all children, and deallocates all memory. More... | |
virtual void | Draw ()=0 |
Draws the object. More... | |
virtual InReaction | ManuallyHandleEvent (const SDL_Event_ *ev) |
Some objects need to handle the SDL_Event_ manually. More... | |
void | LoadStyle (CGUI &GUIinstance, const CStr &StyleName) |
Loads a style. More... | |
void | LoadStyle (const SGUIStyle &Style) |
Loads a style. More... | |
virtual float | GetBufferedZ () const |
Returns not the Z value, but the actual buffered Z value, i.e. More... | |
void | SetGUI (CGUI *const &pGUI) |
void | SetParent (IGUIObject *pParent) |
Set parent of this object. More... | |
bool | IsFocused () const |
Check if object is focused. More... | |
IGUIObject * | GetParent () const |
NOTE! This will not just return m_pParent, when that is need use it! There is one exception to it, when the parent is the top-node (the object that isn't a real object), this will return NULL, so that the top-node's children are seemingly parentless. More... | |
CPos | GetMousePos () const |
Get Mouse from CGUI. More... | |
virtual bool | HandleAdditionalChildren (const XMBElement &child, CXeromyces *pFile) |
Handle additional children to the <object>-tag. More... | |
InReaction | SendEvent (EGUIMessageType type, const CStr &EventName) |
Send event to this GUI object (HandleMessage and ScriptEvent) More... | |
void | ScriptEvent (const CStr &Action) |
Execute the script for a particular action. More... | |
void | ScriptEvent (const CStr &Action, const CScriptValRooted &Argument) |
Execute the script for a particular action. More... | |
void | SetScriptHandler (const CStr &Action, JSObject *Function) |
void | UpdateMouseOver (IGUIObject *const &pMouseOver) |
Inputes the object that is currently hovered, this function updates this object accordingly (i.e. More... | |
Protected Attributes | |
bool | m_Pressed |
Everybody knows how a button works, you don't simply press it, you have to first press the button, and then release it... More... | |
bool | m_PressedRight |
![]() | |
CRect | m_CachedActualSize |
Cached size, real size m_Size is actually dependent on resolution and can have different real outcomes, this is the real outcome cached to avoid slow calculations in real time. More... | |
CStr | m_Name |
vector_pObjects | m_Children |
IGUIObject * | m_pParent |
double | m_LastClickTime [6] |
bool | m_MouseHovering |
This is an array of true or false, each element is associated with a string representing a setting. More... | |
Appends button behaviours to the IGUIObject.
Can be used with multiple inheritance alongside IGUISettingsObject and such.
Definition at line 64 of file IGUIButtonBehavior.h.
IGUIButtonBehavior::IGUIButtonBehavior | ( | ) |
Definition at line 31 of file IGUIButtonBehavior.cpp.
|
virtual |
Definition at line 35 of file IGUIButtonBehavior.cpp.
CColor IGUIButtonBehavior::ChooseColor | ( | ) |
Choosing which color of the following according to object enabled/hovered/pressed status: textcolor_disabled – disabled textcolor_pressed – pressed textcolor_over – hovered.
Definition at line 185 of file IGUIButtonBehavior.cpp.
void IGUIButtonBehavior::DrawButton | ( | const CRect & | rect, |
const float & | z, | ||
CGUISpriteInstance & | sprite, | ||
CGUISpriteInstance & | sprite_over, | ||
CGUISpriteInstance & | sprite_pressed, | ||
CGUISpriteInstance & | sprite_disabled, | ||
int | cell_id | ||
) |
This is a function that lets a button being drawn, it regards if it's over, disabled, pressed and such.
You input sprite names and area and it'll output it accordingly.
This class is meant to be used manually in Draw()
rect | Rectangle in which the sprite should be drawn |
z | Z-value |
sprite | Sprite drawn when not pressed, hovered or disabled |
sprite_over | Sprite drawn when m_MouseHovering is true |
sprite_pressed | Sprite drawn when m_Pressed is true |
sprite_disabled | Sprite drawn when "enabled" is false |
cell_id | Identifies the icon to be used (if the sprite contains cell-using images) |
Definition at line 217 of file IGUIButtonBehavior.cpp.
|
virtual |
Reimplemented from IGUIObject.
Reimplemented in CCheckBox, CButton, and CRadioButton.
Definition at line 39 of file IGUIButtonBehavior.cpp.
|
inlineprotectedvirtual |
Reimplemented from IGUIObject.
Reimplemented in CCheckBox, and CButton.
Definition at line 113 of file IGUIButtonBehavior.h.
|
protected |
Everybody knows how a button works, you don't simply press it, you have to first press the button, and then release it...
in between those two steps you can actually leave the button area, as long as you release it within the button area... Anyway this lets us know we are done with step one (clicking).
Definition at line 128 of file IGUIButtonBehavior.h.
|
protected |
Definition at line 129 of file IGUIButtonBehavior.h.