MyGUI  3.4.1
MyGUI_WidgetTranslate.h
Go to the documentation of this file.
1 /*
2  * This source file is part of MyGUI. For the latest info, see http://mygui.info/
3  * Distributed under the MIT License
4  * (See accompanying file COPYING.MIT or copy at http://opensource.org/licenses/MIT)
5  */
6 
7 #ifndef MYGUI_WIDGET_TRANSLATE_H_
8 #define MYGUI_WIDGET_TRANSLATE_H_
9 
10 #include "MyGUI_Prerequest.h"
11 #include "MyGUI_Types.h"
12 
13 namespace MyGUI
14 {
15 
16  inline int getWidgetWidth(Widget* _widget, bool _vert)
17  {
18  return _vert ? _widget->getWidth() : _widget->getHeight();
19  }
20 
21  inline int getWidgetHeight(Widget* _widget, bool _vert)
22  {
23  return _vert ? _widget->getHeight() : _widget->getWidth();
24  }
25 
26  inline int getWidgetLeft(Widget* _widget, bool _vert)
27  {
28  return _vert ? _widget->getLeft() : _widget->getTop();
29  }
30 
31  inline int getWidgetTop(Widget* _widget, bool _vert)
32  {
33  return _vert ? _widget->getTop() : _widget->getLeft();
34  }
35 
36  inline void setWidgetSize(Widget* _widget, int _width, int _height, bool _vert)
37  {
38  _vert ? _widget->setSize(_width, _height) : _widget->setSize(_height, _width);
39  }
40 
41  inline void setWidgetCoord(Widget* _widget, int _left, int _top, int _width, int _height, bool _vert)
42  {
43  _vert ? _widget->setCoord(_left, _top, _width, _height) : _widget->setCoord(_top, _left, _height, _width);
44  }
45 
46  inline void convertWidgetCoord(IntCoord& _coord, bool _vert)
47  {
48  if (!_vert)
49  {
50  std::swap(_coord.left, _coord.top);
51  std::swap(_coord.width, _coord.height);
52  }
53  }
54 
55 } // namespace MyGUI
56 
57 #endif // MYGUI_WIDGET_TRANSLATE_H_
widget description should be here.
Definition: MyGUI_Widget.h:37
void setCoord(const IntCoord &_value) override
void setSize(const IntSize &_value) override
int getWidgetLeft(Widget *_widget, bool _vert)
int getWidgetWidth(Widget *_widget, bool _vert)
void convertWidgetCoord(IntCoord &_coord, bool _vert)
void setWidgetSize(Widget *_widget, int _width, int _height, bool _vert)
int getWidgetHeight(Widget *_widget, bool _vert)
int getWidgetTop(Widget *_widget, bool _vert)
void setWidgetCoord(Widget *_widget, int _left, int _top, int _width, int _height, bool _vert)