7 #ifndef __MYGUI_WIDGET_H__
8 #define __MYGUI_WIDGET_H__
53 Widget* createWidgetT(const std::
string& _type, const std::
string& _skin, const
IntCoord& _coord,
Align _align, const std::
string& _name = "");
56 Widget* createWidgetT(const std::
string& _type, const std::
string& _skin,
int _left,
int _top,
int _width,
int _height,
Align _align, const std::
string& _name = "");
59 Widget* createWidgetRealT(const std::
string& _type, const std::
string& _skin, const
FloatCoord& _coord,
Align _align, const std::
string& _name = "");
62 Widget* createWidgetRealT(const std::
string& _type, const std::
string& _skin,
float _left,
float _top,
float _width,
float _height,
Align _align, const std::
string& _name = "");
67 T* createWidget(const std::
string& _skin, const
IntCoord& _coord,
Align _align, const std::
string& _name = "")
69 return static_cast<T*
>(createWidgetT(T::getClassTypeName(), _skin, _coord, _align, _name));
74 T* createWidget(
const std::string& _skin,
int _left,
int _top,
int _width,
int _height,
Align _align,
const std::string& _name =
"")
76 return static_cast<T*
>(createWidgetT(T::getClassTypeName(), _skin,
IntCoord(_left, _top, _width, _height), _align, _name));
81 T* createWidgetReal(
const std::string& _skin,
const FloatCoord& _coord,
Align _align,
const std::string& _name =
"")
83 return static_cast<T*
>(createWidgetRealT(T::getClassTypeName(), _skin, _coord, _align, _name));
88 T* createWidgetReal(
const std::string& _skin,
float _left,
float _top,
float _width,
float _height,
Align _align,
const std::string& _name =
"")
90 return static_cast<T*
>(createWidgetRealT(T::getClassTypeName(), _skin, _left, _top, _width, _height, _align, _name));
102 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 =
"");
105 template <
typename T>
106 T* createWidget(
WidgetStyle _style,
const std::string& _skin,
const IntCoord& _coord,
Align _align,
const std::string& _layer =
"",
const std::string& _name =
"")
108 return static_cast<T*
>(createWidgetT(_style, T::getClassTypeName(), _skin, _coord, _align, _layer, _name));
112 virtual void setPosition(
const IntPoint& _value);
114 virtual void setSize(
const IntSize& _value);
116 virtual void setCoord(
const IntCoord& _value);
119 void setPosition(
int _left,
int _top);
121 void setSize(
int _width,
int _height);
123 void setCoord(
int _left,
int _top,
int _width,
int _height);
126 void setRealPosition(
const FloatPoint& _value);
128 void setRealSize(
const FloatSize& _value);
133 void setRealPosition(
float _left,
float _top);
135 void setRealSize(
float _width,
float _height);
137 void setRealCoord(
float _left,
float _top,
float _width,
float _height);
140 const std::string& getName()
const;
143 virtual void setVisible(
bool _value);
145 bool getVisible()
const;
151 void setDepth(
int _value);
153 int getDepth()
const;
156 bool getInheritedVisible()
const;
159 virtual void setAlign(
Align _value);
161 Align getAlign()
const;
164 void setAlpha(
float _value);
166 float getAlpha()
const;
178 void setInheritsAlpha(
bool _value);
180 bool getInheritsAlpha()
const;
182 void setColour(
const Colour& _value);
186 bool isRootWidget()
const;
189 Widget* getParent()
const;
197 size_t getChildCount();
200 Widget* getChildAt(
size_t _index);
206 Widget* findWidget(
const std::string& _name);
214 virtual void setEnabled(
bool _value);
216 void setEnabledSilent(
bool _value);
218 bool getEnabled()
const;
221 bool getInheritedEnabled()
const;
227 Widget* getClientWidget();
232 void detachFromWidget(
const std::string& _layer =
"");
242 void changeWidgetSkin(
const std::string& _skinName);
249 void setWidgetStyle(
WidgetStyle _style,
const std::string& _layer =
"");
257 void setProperty(
const std::string& _key,
const std::string& _value);
276 virtual size_t _getItemIndex(
Widget* _item);
279 void _forcePick(
Widget* _widget);
285 void _destroyChildWidget(
Widget* _widget);
287 void _setContainer(
Widget* _value);
291 bool _checkPoint(
int _left,
int _top)
const;
293 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 =
"");
296 virtual void _resetContainer(
bool _update);
298 bool _setWidgetState(
const std::string& _value);
301 void _updateChilds();
307 virtual void shutdownOverride();
308 virtual void initialiseOverride();
313 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);
316 void _destroyAllChildWidget();
319 virtual size_t _getContainerIndex(
const IntPoint& _point);
321 virtual void baseUpdateEnable();
324 virtual ILayerItem* getLayerItemByPoint(
int _left,
int _top)
const;
325 virtual const IntCoord& getLayerItemCoord()
const;
327 template <
typename T>
328 void assignWidget(T*& _widget,
const std::string& _name)
331 for (VectorWidgetPtr::iterator iter = mWidgetChildSkin.begin(); iter != mWidgetChildSkin.end(); ++iter)
344 void destroySkinWidget(
Widget* _widget);
346 virtual void onWidgetCreated(
Widget* _widget);
347 virtual void onWidgetDestroy(
Widget* _widget);
349 void setWidgetClient(
Widget* _widget);
351 virtual void setPropertyOverride(
const std::string& _key,
const std::string& _value);
354 void frameEntered(
float _frame);
357 void shutdownWidgetSkinBase();
360 void _updateAbsolutePoint();
363 void _updateVisible();
365 void _updateEnabled();
367 float _getRealAlpha()
const;
370 void _destroyChildSkinWidget();
373 void _checkInheristProperties();
375 void _linkChildWidget(
Widget* _widget);
376 void _unlinkChildWidget(
Widget* _widget);
380 virtual void resizeLayerItemView(
const IntSize& _oldView,
const IntSize& _newView);
382 void addWidget(
Widget* _widget);
398 bool mInheritsEnabled;
400 bool mInheritsVisible;
423 #endif // __MYGUI_WIDGET_H__