23 #ifndef __MYGUI_WIDGET_H__
24 #define __MYGUI_WIDGET_H__
65 Widget* createWidgetT(const std::
string& _type, const std::
string& _skin, const
IntCoord& _coord,
Align _align, const std::
string& _name = "");
68 Widget* createWidgetT(const std::
string& _type, const std::
string& _skin,
int _left,
int _top,
int _width,
int _height,
Align _align, const std::
string& _name = "");
71 Widget* createWidgetRealT(const std::
string& _type, const std::
string& _skin, const
FloatCoord& _coord,
Align _align, const std::
string& _name = "");
74 Widget* createWidgetRealT(const std::
string& _type, const std::
string& _skin,
float _left,
float _top,
float _width,
float _height,
Align _align, const std::
string& _name = "");
79 T* createWidget(const std::
string& _skin, const
IntCoord& _coord,
Align _align, const std::
string& _name = "")
81 return static_cast<T*
>(createWidgetT(T::getClassTypeName(), _skin, _coord, _align, _name));
86 T* createWidget(
const std::string& _skin,
int _left,
int _top,
int _width,
int _height,
Align _align,
const std::string& _name =
"")
88 return static_cast<T*
>(createWidgetT(T::getClassTypeName(), _skin,
IntCoord(_left, _top, _width, _height), _align, _name));
93 T* createWidgetReal(
const std::string& _skin,
const FloatCoord& _coord,
Align _align,
const std::string& _name =
"")
95 return static_cast<T*
>(createWidgetRealT(T::getClassTypeName(), _skin, _coord, _align, _name));
100 T* createWidgetReal(
const std::string& _skin,
float _left,
float _top,
float _width,
float _height,
Align _align,
const std::string& _name =
"")
102 return static_cast<T*
>(createWidgetRealT(T::getClassTypeName(), _skin, _left, _top, _width, _height, _align, _name));
113 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 =
"");
116 template <
typename T>
117 T* createWidget(
WidgetStyle _style,
const std::string& _skin,
const IntCoord& _coord,
Align _align,
const std::string& _layer =
"",
const std::string& _name =
"")
119 return static_cast<T*
>(createWidgetT(_style, T::getClassTypeName(), _skin, _coord, _align, _layer, _name));
123 const std::string&
getName()
const {
return mName; }
127 virtual void setPosition(
const IntPoint& _value);
129 virtual void setSize(
const IntSize& _value);
131 virtual void setCoord(
const IntCoord& _value);
141 void setRealPosition(
const FloatPoint& _value);
143 void setRealSize(
const FloatSize& _value);
155 virtual void setVisible(
bool _value);
158 virtual void setAlign(
Align _value);
161 virtual void setCaption(
const UString& _value);
163 virtual const UString& getCaption();
166 void setAlpha(
float _value);
171 void setInheritsAlpha(
bool _value);
176 bool setState(
const std::string& _value);
178 void setColour(
const Colour& _value);
191 size_t getChildCount();
194 Widget* getChildAt(
size_t _index);
197 Widget* findWidget(
const std::string& _name);
225 void setMaskPick(
const std::string& _filename);
228 virtual void setEnabled(
bool _value);
235 void setPointer(
const std::string& _value) { mPointer = _value; }
237 const std::string& getPointer();
240 const std::string& getLayerName();
254 void setNeedToolTip(
bool _value);
259 void setEnableToolTip(
bool _value);
266 void detachFromWidget(
const std::string& _layer =
"");
277 void changeWidgetSkin(
const std::string& _skinname);
284 void setWidgetStyle(
WidgetStyle _style,
const std::string& _layer =
"");
292 virtual void setProperty(
const std::string& _key,
const std::string& _value);
297 virtual void _getContainer(
Widget*& _container,
size_t& _index);
300 void _forcePeek(
Widget* _widget);
304 virtual void _setTextureName(
const std::string& _texture);
305 virtual const std::string& _getTextureName();
311 void _setFontName(
const std::string& _font);
312 const std::string& _getFontName();
313 void _setFontHeight(
int _height);
314 int _getFontHeight();
315 void _setTextAlign(
Align _align);
316 Align _getTextAlign();
317 void _setTextColour(
const Colour& _colour);
318 const Colour& _getTextColour();
321 void setCaptionWithNewLine(
const std::string& _value);
326 #ifndef MYGUI_DONT_USE_OBSOLETE
328 MYGUI_OBSOLETE(
"use : void Widget::setCoord(const IntCoord& _coord)")
329 void setPosition(const
IntCoord& _coord) { setCoord(_coord); }
330 MYGUI_OBSOLETE(
"use : void Widget::setCoord(int _left, int _top, int _width, int _height)")
331 void setPosition(
int _left,
int _top,
int _width,
int _height) { setCoord(_left, _top, _width, _height); }
334 void enableToolTip(
bool _enable) { setEnableToolTip(_enable); }
337 void setInheritsPeek(
bool _inherits) { setInheritsPick(_inherits); }
339 bool isInheritsPeek() {
return isInheritsPick(); }
341 MYGUI_OBSOLETE(
"use : void setMaskPick(const std::string& _filename)")
342 void setMaskPeek(const std::
string& _filename) { setMaskPick(_filename); }
344 MYGUI_OBSOLETE(
"use : const IntCoord& StaticText::getTextRegion()")
345 IntCoord getTextCoord() {
return _getTextRegion(); }
347 IntSize getTextSize() {
return _getTextSize(); }
349 MYGUI_OBSOLETE(
"use : void StaticText::setFontName(const std::string& _font)")
350 void setFontName(const std::
string& _font) { _setFontName(_font); }
351 MYGUI_OBSOLETE(
"use : const std::string& StaticText::getFontName()")
352 const std::
string& getFontName() {
return _getFontName(); }
354 MYGUI_OBSOLETE(
"use : void StaticText::setFontHeight(int _height)")
355 void setFontHeight(
int _height) { _setFontHeight(_height); }
357 int getFontHeight() {
return _getFontHeight(); }
359 MYGUI_OBSOLETE(
"use : void StaticText::setTextAlign(Align _align)")
360 void setTextAlign(
Align _align) { _setTextAlign(_align); }
362 Align getTextAlign() {
return _getTextAlign(); }
364 MYGUI_OBSOLETE(
"use : void StaticText::setTextColour(const Colour& _colour)")
365 void setTextColour(const
Colour& _colour) { _setTextColour(_colour); }
367 const
Colour& getTextColour() {
return _getTextColour(); }
369 #endif // MYGUI_DONT_USE_OBSOLETE
380 void _setAlign(
const IntSize& _oldsize,
bool _update);
381 void _setAlign(
const IntCoord& _oldcoord,
bool _update);
384 virtual 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);
387 virtual void _destroyChildWidget(
Widget* _widget);
390 virtual void _destroyAllChildWidget();
396 virtual void _resetContainer(
bool _update);
398 virtual void baseUpdateEnable();
401 virtual ILayerItem * getLayerItemByPoint(
int _left,
int _top);
406 void frameEntered(
float _frame);
409 void shutdownWidgetSkin(
bool _deep =
false);
412 void _updateAbsolutePoint();
415 void _setInheritsVisible(
bool _value);
416 bool _isInheritsVisible() {
return mInheritsVisible; }
418 void _setInheritsEnable(
bool _value);
419 bool _isInheritsEnable() {
return mInheritsEnabled; }
422 void _setSubSkinVisible(
bool _visible);
424 float _getRealAlpha() {
return mRealAlpha; }
427 virtual void _linkChildWidget(Widget* _widget);
429 virtual void _unlinkChildWidget(Widget* _widget);
503 #endif // __MYGUI_WIDGET_H__