MyGUI  3.2.0
Public Types | Public Member Functions | Static Public Member Functions | Data Fields | Protected Member Functions | Friends
MyGUI::Widget Class Reference

#include <MyGUI_Widget.h>

+ Inheritance diagram for MyGUI::Widget:

Public Types

typedef RTTIBase Base
typedef Widget RTTIBase

Public Member Functions

virtual const std::string & getTypeName () const
virtual bool isType (const std::type_info &_type) const
template<typename Type >
bool isType () const
 Widget ()
WidgetcreateWidgetT (const std::string &_type, const std::string &_skin, const IntCoord &_coord, Align _align, const std::string &_name="")
WidgetcreateWidgetT (const std::string &_type, const std::string &_skin, int _left, int _top, int _width, int _height, Align _align, const std::string &_name="")
WidgetcreateWidgetRealT (const std::string &_type, const std::string &_skin, const FloatCoord &_coord, Align _align, const std::string &_name="")
WidgetcreateWidgetRealT (const std::string &_type, const std::string &_skin, float _left, float _top, float _width, float _height, Align _align, const std::string &_name="")
template<typename T >
T * createWidget (const std::string &_skin, const IntCoord &_coord, Align _align, const std::string &_name="")
template<typename T >
T * createWidget (const std::string &_skin, int _left, int _top, int _width, int _height, Align _align, const std::string &_name="")
template<typename T >
T * createWidgetReal (const std::string &_skin, const FloatCoord &_coord, Align _align, const std::string &_name="")
template<typename T >
T * createWidgetReal (const std::string &_skin, float _left, float _top, float _width, float _height, Align _align, const std::string &_name="")
WidgetcreateWidgetT (WidgetStyle _style, const std::string &_type, const std::string &_skin, const IntCoord &_coord, Align _align, const std::string &_layer="", const std::string &_name="")
template<typename T >
T * createWidget (WidgetStyle _style, const std::string &_skin, const IntCoord &_coord, Align _align, const std::string &_layer="", const std::string &_name="")
virtual void setPosition (const IntPoint &_value)
virtual void setSize (const IntSize &_value)
virtual void setCoord (const IntCoord &_value)
void setPosition (int _left, int _top)
void setSize (int _width, int _height)
void setCoord (int _left, int _top, int _width, int _height)
void setRealPosition (const FloatPoint &_value)
void setRealSize (const FloatSize &_value)
void setRealCoord (const FloatCoord &_value)
void setRealPosition (float _left, float _top)
void setRealSize (float _width, float _height)
void setRealCoord (float _left, float _top, float _width, float _height)
const std::string & getName () const
 Get name of widget.
virtual void setVisible (bool _value)
bool getVisible () const
bool getInheritedVisible () const
virtual void setAlign (Align _value)
Align getAlign () const
void setAlpha (float _value)
float getAlpha () const
void setInheritsAlpha (bool _value)
bool getInheritsAlpha () const
void setColour (const Colour &_value)
bool isRootWidget () const
WidgetgetParent () const
IntSize getParentSize () const
EnumeratorWidgetPtr getEnumerator () const
size_t getChildCount ()
WidgetgetChildAt (size_t _index)
WidgetfindWidget (const std::string &_name)
void findWidgets (const std::string &_name, VectorWidgetPtr &_result)
virtual void setEnabled (bool _value)
void setEnabledSilent (bool _value)
bool getEnabled () const
bool getInheritedEnabled () const
IntCoord getClientCoord ()
WidgetgetClientWidget ()
void detachFromWidget (const std::string &_layer="")
void attachToWidget (Widget *_parent, WidgetStyle _style=WidgetStyle::Child, const std::string &_layer="")
void changeWidgetSkin (const std::string &_skinName)
void setWidgetStyle (WidgetStyle _style, const std::string &_layer="")
WidgetStyle getWidgetStyle () const
void setProperty (const std::string &_key, const std::string &_value)
virtual size_t _getItemIndex (Widget *_item)
void _forcePick (Widget *_widget)
void _initialise (WidgetStyle _style, const IntCoord &_coord, const std::string &_skinName, Widget *_parent, ICroppedRectangle *_croppedParent, const std::string &_name)
void _shutdown ()
void _destroyChildWidget (Widget *_widget)
void _setContainer (Widget *_value)
Widget_getContainer ()
void _setAlign (const IntSize &_oldsize, const IntSize &_newSize)
bool _checkPoint (int _left, int _top) const
Widget_createSkinWidget (WidgetStyle _style, const std::string &_type, const std::string &_skin, const IntCoord &_coord, Align _align, const std::string &_layer="", const std::string &_name="")
virtual void _resetContainer (bool _update)
bool _setWidgetState (const std::string &_value)

Static Public Member Functions

static const std::string & getClassTypeName ()

Data Fields

EventHandle_WidgetStringString eventChangeProperty

Protected Member Functions

virtual ~Widget ()
virtual void shutdownOverride ()
virtual void initialiseOverride ()
void _updateView ()
WidgetbaseCreateWidget (WidgetStyle _style, const std::string &_type, const std::string &_skin, const IntCoord &_coord, Align _align, const std::string &_layer, const std::string &_name, bool _template)
void _destroyAllChildWidget ()
virtual size_t _getContainerIndex (const IntPoint &_point)
virtual void baseUpdateEnable ()
virtual ILayerItemgetLayerItemByPoint (int _left, int _top) const
virtual const IntCoordgetLayerItemCoord () const
template<typename T >
void assignWidget (T *&_widget, const std::string &_name)
VectorWidgetPtr getSkinWidgetsByName (const std::string &_name)
void destroySkinWidget (Widget *_widget)
virtual void onWidgetCreated (Widget *_widget)
virtual void onWidgetDestroy (Widget *_widget)
void setWidgetClient (Widget *_widget)
virtual void setPropertyOverride (const std::string &_key, const std::string &_value)

Friends

class WidgetManager

Detailed Description

Definition at line 41 of file MyGUI_Widget.h.


Member Typedef Documentation


Constructor & Destructor Documentation

Definition at line 46 of file MyGUI_Widget.cpp.

MyGUI::Widget::~Widget ( ) [protected, virtual]

Definition at line 62 of file MyGUI_Widget.cpp.


Member Function Documentation

bool MyGUI::Widget::_checkPoint ( int  _left,
int  _top 
) const

Definition at line 1039 of file MyGUI_Widget.cpp.

Widget * MyGUI::Widget::_createSkinWidget ( WidgetStyle  _style,
const std::string &  _type,
const std::string &  _skin,
const IntCoord _coord,
Align  _align,
const std::string &  _layer = "",
const std::string &  _name = "" 
)

Definition at line 1137 of file MyGUI_Widget.cpp.

Definition at line 425 of file MyGUI_Widget.cpp.

Definition at line 394 of file MyGUI_Widget.cpp.

void MyGUI::Widget::_forcePick ( Widget _widget)

Definition at line 531 of file MyGUI_Widget.cpp.

Definition at line 1280 of file MyGUI_Widget.cpp.

size_t MyGUI::Widget::_getContainerIndex ( const IntPoint _point) [protected, virtual]

Reimplemented in MyGUI::ItemBox.

Definition at line 1285 of file MyGUI_Widget.cpp.

size_t MyGUI::Widget::_getItemIndex ( Widget _item) [virtual]

Reimplemented in MyGUI::ListBox, and MyGUI::ItemBox.

Definition at line 1270 of file MyGUI_Widget.cpp.

void MyGUI::Widget::_initialise ( WidgetStyle  _style,
const IntCoord _coord,
const std::string &  _skinName,
Widget _parent,
ICroppedRectangle _croppedParent,
const std::string &  _name 
)

Definition at line 66 of file MyGUI_Widget.cpp.

void MyGUI::Widget::_resetContainer ( bool  _update) [virtual]

Reimplemented in MyGUI::ListBox, MyGUI::ItemBox, and MyGUI::ComboBox.

Definition at line 1033 of file MyGUI_Widget.cpp.

void MyGUI::Widget::_setAlign ( const IntSize _oldsize,
const IntSize _newSize 
)

Definition at line 577 of file MyGUI_Widget.cpp.

Definition at line 1275 of file MyGUI_Widget.cpp.

bool MyGUI::Widget::_setWidgetState ( const std::string &  _value)

Definition at line 389 of file MyGUI_Widget.cpp.

Definition at line 141 of file MyGUI_Widget.cpp.

void MyGUI::Widget::_updateView ( ) [protected]

Definition at line 341 of file MyGUI_Widget.cpp.

template<typename T >
void MyGUI::Widget::assignWidget ( T *&  _widget,
const std::string &  _name 
) [inline, protected]

Definition at line 324 of file MyGUI_Widget.h.

void MyGUI::Widget::attachToWidget ( Widget _parent,
WidgetStyle  _style = WidgetStyle::Child,
const std::string &  _layer = "" 
)

Attach widget to parent

Parameters:
_parentNew parent
_styleNew widget style (see WidgetStyle::Enum)
_layerAttach to specified layer (if any)

Definition at line 801 of file MyGUI_Widget.cpp.

Widget * MyGUI::Widget::baseCreateWidget ( WidgetStyle  _style,
const std::string &  _type,
const std::string &  _skin,
const IntCoord _coord,
Align  _align,
const std::string &  _layer,
const std::string &  _name,
bool  _template 
) [protected]

Definition at line 301 of file MyGUI_Widget.cpp.

void MyGUI::Widget::baseUpdateEnable ( ) [protected, virtual]

Reimplemented in MyGUI::Button.

Definition at line 957 of file MyGUI_Widget.cpp.

void MyGUI::Widget::changeWidgetSkin ( const std::string &  _skinName)

Change widget skin

Definition at line 168 of file MyGUI_Widget.cpp.

template<typename T >
T* MyGUI::Widget::createWidget ( const std::string &  _skin,
const IntCoord _coord,
Align  _align,
const std::string &  _name = "" 
) [inline]

Same as Widget::createWidgetT but return T pointer instead of Widget*

Definition at line 79 of file MyGUI_Widget.h.

template<typename T >
T* MyGUI::Widget::createWidget ( const std::string &  _skin,
int  _left,
int  _top,
int  _width,
int  _height,
Align  _align,
const std::string &  _name = "" 
) [inline]

Same as Widget::createWidgetT but return T pointer instead of Widget*

Definition at line 86 of file MyGUI_Widget.h.

template<typename T >
T* MyGUI::Widget::createWidget ( WidgetStyle  _style,
const std::string &  _skin,
const IntCoord _coord,
Align  _align,
const std::string &  _layer = "",
const std::string &  _name = "" 
) [inline]

Same as Widget::createWidgetT but return T* instead of Widget*

Definition at line 118 of file MyGUI_Widget.h.

template<typename T >
T* MyGUI::Widget::createWidgetReal ( const std::string &  _skin,
const FloatCoord _coord,
Align  _align,
const std::string &  _name = "" 
) [inline]

Same as Widget::createWidgetRealT but return T* instead of Widget*

Definition at line 93 of file MyGUI_Widget.h.

template<typename T >
T* MyGUI::Widget::createWidgetReal ( const std::string &  _skin,
float  _left,
float  _top,
float  _width,
float  _height,
Align  _align,
const std::string &  _name = "" 
) [inline]

Same as Widget::createWidgetRealT but return T* instead of Widget*

Definition at line 100 of file MyGUI_Widget.h.

Widget * MyGUI::Widget::createWidgetRealT ( const std::string &  _type,
const std::string &  _skin,
const FloatCoord _coord,
Align  _align,
const std::string &  _name = "" 
)

Create widget using coordinates relative to parent. see Widget::createWidgetT(const std::string& _type, const std::string& _skin, const IntCoord& _coord, Align _align, const std::string& _name = "")

Definition at line 336 of file MyGUI_Widget.cpp.

Widget * MyGUI::Widget::createWidgetRealT ( const std::string &  _type,
const std::string &  _skin,
float  _left,
float  _top,
float  _width,
float  _height,
Align  _align,
const std::string &  _name = "" 
)

Create widget using coordinates relative to parent. see Widget::createWidgetT(const std::string& _type, const std::string& _skin, const IntCoord& _coord, Align _align, const std::string& _name = "")

Definition at line 922 of file MyGUI_Widget.cpp.

Widget * MyGUI::Widget::createWidgetT ( const std::string &  _type,
const std::string &  _skin,
const IntCoord _coord,
Align  _align,
const std::string &  _name = "" 
)

Create child widget

Parameters:
_typewidget type
_skinwidget skin
_coordint coordinates of widget (_left, _top, _width, _height)
_alignwidget align (possible values can be found in enum Align)
_nameif needed (you can use it for finding widget by name later)

Definition at line 912 of file MyGUI_Widget.cpp.

Widget * MyGUI::Widget::createWidgetT ( const std::string &  _type,
const std::string &  _skin,
int  _left,
int  _top,
int  _width,
int  _height,
Align  _align,
const std::string &  _name = "" 
)

See Widget::createWidgetT(const std::string& _type, const std::string& _skin, const IntCoord& _coord, Align _align, const std::string& _name = "")

Definition at line 917 of file MyGUI_Widget.cpp.

Widget * MyGUI::Widget::createWidgetT ( WidgetStyle  _style,
const std::string &  _type,
const std::string &  _skin,
const IntCoord _coord,
Align  _align,
const std::string &  _layer = "",
const std::string &  _name = "" 
)

Create child widget

Parameters:
_styleChild, Popup or Overlapped widget style
_typewidget type
_skinwidget skin
_coordint coordinates of widget (_left, _top, _width, _height)
_alignwidget align (possible values can be found in enum Align)
_layerlayer where widget will be created (all layers usually defined in core_layer.xml file).
_nameoptional widget name (you can use it for finding widget by name later)

Definition at line 927 of file MyGUI_Widget.cpp.

void MyGUI::Widget::destroySkinWidget ( Widget _widget) [protected]

Definition at line 1118 of file MyGUI_Widget.cpp.

void MyGUI::Widget::detachFromWidget ( const std::string &  _layer = "")

Detach widget from widgets hierarchy

Parameters:
_layerAttach to specified layer (if any)

Definition at line 739 of file MyGUI_Widget.cpp.

Widget * MyGUI::Widget::findWidget ( const std::string &  _name)

Find widget by name. Search recursively through all childs starting from this widget.

Returns:
Return first found widget with given name

Definition at line 545 of file MyGUI_Widget.cpp.

void MyGUI::Widget::findWidgets ( const std::string &  _name,
VectorWidgetPtr _result 
)

Find all widgets with given name and add them into _result. Search recursively through all childs starting from this widget.

Definition at line 1101 of file MyGUI_Widget.cpp.

Get align

Definition at line 1225 of file MyGUI_Widget.cpp.

float MyGUI::Widget::getAlpha ( ) const

Get widget opacity

Definition at line 1230 of file MyGUI_Widget.cpp.

Widget * MyGUI::Widget::getChildAt ( size_t  _index)

Get child by index (index from 0 to child_count - 1)

Definition at line 948 of file MyGUI_Widget.cpp.

Get child count

Definition at line 940 of file MyGUI_Widget.cpp.

static const std::string& MyGUI::Widget::getClassTypeName ( ) [inline, static]

Get rectangle where child widgets placed

Definition at line 442 of file MyGUI_Widget.cpp.

Get client area widget or nullptr if widget don't have client

Definition at line 1260 of file MyGUI_Widget.cpp.

bool MyGUI::Widget::getEnabled ( ) const

Is widget enabled

Definition at line 1255 of file MyGUI_Widget.cpp.

Get child widgets Enumerator

Definition at line 932 of file MyGUI_Widget.cpp.

Is widget enabled and all it's parents in hierarchy is enabled.

Definition at line 1300 of file MyGUI_Widget.cpp.

Return widget's visibility based on it's and parents visibility.

Definition at line 1305 of file MyGUI_Widget.cpp.

Get inherits alpha mode flag

Definition at line 1235 of file MyGUI_Widget.cpp.

ILayerItem * MyGUI::Widget::getLayerItemByPoint ( int  _left,
int  _top 
) const [protected, virtual]

Implements MyGUI::ILayerItem.

Definition at line 480 of file MyGUI_Widget.cpp.

const IntCoord & MyGUI::Widget::getLayerItemCoord ( ) const [protected, virtual]

Implements MyGUI::ILayerItem.

Definition at line 1290 of file MyGUI_Widget.cpp.

const std::string & MyGUI::Widget::getName ( void  ) const

Get name of widget.

Definition at line 1215 of file MyGUI_Widget.cpp.

Get parent widget or nullptr if no parent

Definition at line 1245 of file MyGUI_Widget.cpp.

Definition at line 1023 of file MyGUI_Widget.cpp.

VectorWidgetPtr MyGUI::Widget::getSkinWidgetsByName ( const std::string &  _name) [protected]

Definition at line 1091 of file MyGUI_Widget.cpp.

virtual const std::string& MyGUI::Widget::getTypeName ( ) const [inline, virtual]
bool MyGUI::Widget::getVisible ( ) const

Return true if visible

Definition at line 1220 of file MyGUI_Widget.cpp.

Get widget style

Definition at line 1265 of file MyGUI_Widget.cpp.

void MyGUI::Widget::initialiseOverride ( ) [protected, virtual]

Is this widget is root widget (root == without parents)

Definition at line 1240 of file MyGUI_Widget.cpp.

template<typename Type >
bool MyGUI::Widget::isType ( ) const [inline]
virtual bool MyGUI::Widget::isType ( const std::type_info &  _type) const [inline, virtual]
void MyGUI::Widget::onWidgetCreated ( Widget _widget) [protected, virtual]

Reimplemented in MyGUI::MultiListBox, MyGUI::MenuControl, MyGUI::TabControl, and MyGUI::MenuItem.

Definition at line 1124 of file MyGUI_Widget.cpp.

void MyGUI::Widget::onWidgetDestroy ( Widget _widget) [protected, virtual]

Reimplemented in MyGUI::MultiListBox.

Definition at line 1128 of file MyGUI_Widget.cpp.

void MyGUI::Widget::setAlign ( Align  _value) [virtual]

Set align

Definition at line 734 of file MyGUI_Widget.cpp.

void MyGUI::Widget::setAlpha ( float  _value)

Set widget opacity

Definition at line 450 of file MyGUI_Widget.cpp.

void MyGUI::Widget::setColour ( const Colour _value)

Definition at line 1015 of file MyGUI_Widget.cpp.

void MyGUI::Widget::setCoord ( const IntCoord _value) [virtual]
void MyGUI::Widget::setCoord ( int  _left,
int  _top,
int  _width,
int  _height 
)
void MyGUI::Widget::setEnabled ( bool  _value) [virtual]

Enable or disable widget

Definition at line 990 of file MyGUI_Widget.cpp.

void MyGUI::Widget::setEnabledSilent ( bool  _value)

Enable or disable widget without changing widget's state

Definition at line 1250 of file MyGUI_Widget.cpp.

void MyGUI::Widget::setInheritsAlpha ( bool  _value)

Enable or disable inherits alpha mode.
Inherits alpha mode: when enabled widget alpha is it's own alpha value multiplied by parent's real alpha (that depend on parent's parent and so on).
When disabled widget's alpha doesn't depend on parent's alpha. So this is used when you need things like semi-transparent window with non-transparent text on it and window's alpha changes.
Enabled (true) by default.

Definition at line 474 of file MyGUI_Widget.cpp.

void MyGUI::Widget::setPosition ( const IntPoint _value) [virtual]

Set widget position (position of left top corner)

Reimplemented from MyGUI::ICroppedRectangle.

Reimplemented in MyGUI::EditBox, MyGUI::ListBox, MyGUI::ItemBox, MyGUI::ScrollBar, MyGUI::Window, MyGUI::TabControl, MyGUI::ProgressBar, MyGUI::MultiListBox, and MyGUI::ScrollView.

Definition at line 641 of file MyGUI_Widget.cpp.

void MyGUI::Widget::setPosition ( int  _left,
int  _top 
)
void MyGUI::Widget::setProperty ( const std::string &  _key,
const std::string &  _value 
)

Set any widget property

Parameters:
_keyProperty name (for example Alpha or Enabled)
_valueValue converted to string

Definition at line 1073 of file MyGUI_Widget.cpp.

void MyGUI::Widget::setPropertyOverride ( const std::string &  _key,
const std::string &  _value 
) [protected, virtual]
Properties:
Position is Widget property with type IntPoint. Set widget position.
Properties:
Size is Widget property with type IntSize. Set widget size.
Properties:
Coord is Widget property with type IntCoord. Set widget coordinates (position and size).
Properties:
Visible is Widget property with type bool. Show or hide widget.

Reimplemented in MyGUI::MenuControl, MyGUI::EditBox, MyGUI::ListBox, MyGUI::TabControl, MyGUI::ItemBox, MyGUI::ImageBox, MyGUI::ComboBox, MyGUI::Window, MyGUI::DDContainer, MyGUI::ScrollBar, MyGUI::MenuItem, MyGUI::ScrollView, MyGUI::TextBox, MyGUI::ProgressBar, MyGUI::Button, MyGUI::MultiListItem, and MyGUI::TabItem.

Definition at line 1142 of file MyGUI_Widget.cpp.

void MyGUI::Widget::setRealCoord ( const FloatCoord _value)

Set widget position and size

Definition at line 572 of file MyGUI_Widget.cpp.

void MyGUI::Widget::setRealCoord ( float  _left,
float  _top,
float  _width,
float  _height 
)

See Widget::setRealPosition(const FloatCoord& _coord)

Definition at line 1210 of file MyGUI_Widget.cpp.

void MyGUI::Widget::setRealPosition ( const FloatPoint _value)

Set widget position (position of left top corner)

Definition at line 562 of file MyGUI_Widget.cpp.

void MyGUI::Widget::setRealPosition ( float  _left,
float  _top 
)
void MyGUI::Widget::setRealSize ( const FloatSize _value)

Set widget size

Definition at line 567 of file MyGUI_Widget.cpp.

void MyGUI::Widget::setRealSize ( float  _width,
float  _height 
)
void MyGUI::Widget::setSize ( const IntSize _value) [virtual]
void MyGUI::Widget::setSize ( int  _width,
int  _height 
)
void MyGUI::Widget::setVisible ( bool  _value) [virtual]

Hide or show widget

Reimplemented in MyGUI::MenuControl, and MyGUI::Window.

Definition at line 965 of file MyGUI_Widget.cpp.

void MyGUI::Widget::setWidgetClient ( Widget _widget) [protected]

Definition at line 1132 of file MyGUI_Widget.cpp.

void MyGUI::Widget::setWidgetStyle ( WidgetStyle  _style,
const std::string &  _layer = "" 
)

Set widget style.

Parameters:
_styleNew widget style (see WidgetStyle::Enum)
_layerAttach to specified layer (if any)
Note:
When choosing WidgetStyle::Popup style you also need attach widget to layer

Definition at line 898 of file MyGUI_Widget.cpp.

void MyGUI::Widget::shutdownOverride ( ) [protected, virtual]

Friends And Related Function Documentation

friend class WidgetManager [friend]

Definition at line 51 of file MyGUI_Widget.h.


Field Documentation

Event : Widget property changed through setProperty (in code, or from layout)
signature : void method(MyGUI::Widget* _sender, const std::string& _key, const std::string& _value);

Parameters:
_senderwidget that called this event
_key
_value

Definition at line 271 of file MyGUI_Widget.h.


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