23 #ifndef __MYGUI_GUI_H__
24 #define __MYGUI_GUI_H__
51 void initialise(const std::
string& _core = "core.xml", const std::
string& _logFileName =
MYGUI_LOG_FILENAME);
66 Widget* createWidgetT(const std::
string& _type, const std::
string& _skin, const
IntCoord& _coord,
Align _align, const std::
string& _layer, const std::
string& _name = "")
71 Widget* createWidgetT(
const std::string& _type,
const std::string& _skin,
int _left,
int _top,
int _width,
int _height,
Align _align,
const std::string& _layer,
const std::string& _name =
"")
73 return createWidgetT(_type, _skin,
IntCoord(_left, _top, _width, _height), _align, _layer, _name);
76 Widget* createWidgetRealT(
const std::string& _type,
const std::string& _skin,
const FloatCoord& _coord,
Align _align,
const std::string& _layer,
const std::string& _name =
"")
78 return createWidgetT(_type, _skin,
IntCoord((
int)(_coord.
left*mViewSize.width), (
int)(_coord.
top*mViewSize.height), (
int)(_coord.
width*mViewSize.width), (
int)(_coord.
height*mViewSize.height)), _align, _layer, _name);
81 Widget* createWidgetRealT(
const std::string& _type,
const std::string& _skin,
float _left,
float _top,
float _width,
float _height,
Align _align,
const std::string& _layer,
const std::string& _name =
"")
83 return createWidgetT(_type, _skin,
IntCoord((
int)(_left*mViewSize.width), (
int)(_top*mViewSize.height), (
int)(_width*mViewSize.width), (
int)(_height*mViewSize.height)), _align, _layer, _name);
89 T* createWidget(
const std::string& _skin,
const IntCoord& _coord,
Align _align,
const std::string& _layer,
const std::string& _name =
"")
91 return static_cast<T*
>(createWidgetT(T::getClassTypeName(), _skin, _coord, _align, _layer, _name));
95 T* createWidget(
const std::string& _skin,
int _left,
int _top,
int _width,
int _height,
Align _align,
const std::string& _layer,
const std::string& _name =
"")
97 return static_cast<T*
>(createWidgetT(T::getClassTypeName(), _skin,
IntCoord(_left, _top, _width, _height), _align, _layer, _name));
100 template <
typename T>
101 T* createWidgetReal(
const std::string& _skin,
const FloatCoord& _coord,
Align _align,
const std::string& _layer,
const std::string& _name =
"")
103 return static_cast<T*
>(createWidgetRealT(T::getClassTypeName(), _skin, _coord, _align, _layer, _name));
106 template <
typename T>
107 T* createWidgetReal(
const std::string& _skin,
float _left,
float _top,
float _width,
float _height,
Align _align,
const std::string& _layer,
const std::string& _name =
"")
109 return static_cast<T*
>(createWidgetRealT(T::getClassTypeName(), _skin, _left, _top, _width, _height, _align, _layer, _name));
122 bool injectMouseMove(
int _absx,
int _absy,
int _absz);
126 bool injectMousePress(
int _absx,
int _absy,
MouseButton _id);
130 bool injectMouseRelease(
int _absx,
int _absy,
MouseButton _id);
139 bool injectKeyRelease(
KeyCode _key);
142 void destroyWidget(
Widget* _widget);
153 Widget* findWidgetT(
const std::string& _name,
bool _throw =
true);
158 Widget* findWidgetT(
const std::string& _name,
const std::string& _prefix,
bool _throw =
true)
160 return findWidgetT(_prefix + _name, _throw);
167 template <
typename T>
168 T* findWidget(
const std::string& _name,
bool _throw =
true)
170 Widget* widget = findWidgetT(_name, _throw);
171 if (
nullptr == widget)
return nullptr;
178 template <
typename T>
179 T* findWidget(
const std::string& _name,
const std::string& _prefix,
bool _throw =
true)
181 return findWidget<T>(_prefix + _name, _throw);
186 void setVisiblePointer(
bool _visible);
188 bool isVisiblePointer();
193 bool load(
const std::string& _file);
195 void resizeWindow(
const IntSize& _size);
214 void _injectFrameEntered(
float _time);
224 #ifndef MYGUI_DONT_USE_OBSOLETE
226 MYGUI_OBSOLETE(
"use : void Gui::destroyWidgets(VectorWidgetPtr &_widgets)")
230 void hidePointer() { setVisiblePointer(
false); }
232 void showPointer() { setVisiblePointer(
true); }
234 bool isShowPointer() {
return isVisiblePointer(); }
236 void injectFrameEntered(
float _time) { }
238 #endif // MYGUI_DONT_USE_OBSOLETE
242 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);
245 void _destroyChildWidget(
Widget* _widget);
248 void _destroyAllChildWidget();
250 virtual void _unlinkWidget(
Widget* _widget);
253 virtual void _linkChildWidget(
Widget* _widget);
256 virtual void _unlinkChildWidget(
Widget* _widget);
287 #endif // __MYGUI_GUI_H__