MyGUI  3.2.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 
12 namespace MyGUI
13 {
14 
15  inline int getWidgetWidth(Widget* _widget, bool _vert)
16  {
17  return _vert ? _widget->getWidth() : _widget->getHeight();
18  }
19 
20  inline int getWidgetHeight(Widget* _widget, bool _vert)
21  {
22  return _vert ? _widget->getHeight() : _widget->getWidth();
23  }
24 
25  inline int getWidgetLeft(Widget* _widget, bool _vert)
26  {
27  return _vert ? _widget->getLeft() : _widget->getTop();
28  }
29 
30  inline int getWidgetTop(Widget* _widget, bool _vert)
31  {
32  return _vert ? _widget->getTop() : _widget->getLeft();
33  }
34 
35  inline void setWidgetSize(Widget* _widget, int _width, int _height, bool _vert)
36  {
37  _vert ? _widget->setSize(_width, _height) : _widget->setSize(_height, _width);
38  }
39 
40  inline void setWidgetCoord(Widget* _widget, int _left, int _top, int _width, int _height, bool _vert)
41  {
42  _vert ? _widget->setCoord(_left, _top, _width, _height) : _widget->setCoord(_top, _left, _height, _width);
43  }
44 
45  inline void convertWidgetCoord(IntCoord& _coord, bool _vert)
46  {
47  if (!_vert)
48  {
49  std::swap(_coord.left, _coord.top);
50  std::swap(_coord.width, _coord.height);
51  }
52  }
53 
54 } // namespace MyGUI
55 
56 #endif // __MYGUI_WIDGET_TRANSLATE_H__