MyGUI  3.2.0
MyGUI_WidgetTranslate.h
Go to the documentation of this file.
1 
6 /*
7  This file is part of MyGUI.
8 
9  MyGUI is free software: you can redistribute it and/or modify
10  it under the terms of the GNU Lesser General Public License as published by
11  the Free Software Foundation, either version 3 of the License, or
12  (at your option) any later version.
13 
14  MyGUI is distributed in the hope that it will be useful,
15  but WITHOUT ANY WARRANTY; without even the implied warranty of
16  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17  GNU Lesser General Public License for more details.
18 
19  You should have received a copy of the GNU Lesser General Public License
20  along with MyGUI. If not, see <http://www.gnu.org/licenses/>.
21 */
22 #ifndef __MYGUI_WIDGET_TRANSLATE_H__
23 #define __MYGUI_WIDGET_TRANSLATE_H__
24 
25 #include "MyGUI_Prerequest.h"
26 
27 namespace MyGUI
28 {
29 
30  inline int getWidgetWidth(Widget* _widget, bool _vert)
31  {
32  return _vert ? _widget->getWidth() : _widget->getHeight();
33  }
34 
35  inline int getWidgetHeight(Widget* _widget, bool _vert)
36  {
37  return _vert ? _widget->getHeight() : _widget->getWidth();
38  }
39 
40  inline int getWidgetLeft(Widget* _widget, bool _vert)
41  {
42  return _vert ? _widget->getLeft() : _widget->getTop();
43  }
44 
45  inline int getWidgetTop(Widget* _widget, bool _vert)
46  {
47  return _vert ? _widget->getTop() : _widget->getLeft();
48  }
49 
50  inline void setWidgetSize(Widget* _widget, int _width, int _height, bool _vert)
51  {
52  _vert ? _widget->setSize(_width, _height) : _widget->setSize(_height, _width);
53  }
54 
55  inline void setWidgetCoord(Widget* _widget, int _left, int _top, int _width, int _height, bool _vert)
56  {
57  _vert ? _widget->setCoord(_left, _top, _width, _height) : _widget->setCoord(_top, _left, _height, _width);
58  }
59 
60  inline void convertWidgetCoord(IntCoord& _coord, bool _vert)
61  {
62  if (!_vert)
63  {
64  std::swap(_coord.left, _coord.top);
65  std::swap(_coord.width, _coord.height);
66  }
67  }
68 
69 } // namespace MyGUI
70 
71 #endif // __MYGUI_WIDGET_TRANSLATE_H__
int getWidgetHeight(Widget *_widget, bool _vert)
virtual void setCoord(const IntCoord &_value)
virtual void setSize(const IntSize &_value)
int getWidgetTop(Widget *_widget, bool _vert)
int getWidgetLeft(Widget *_widget, bool _vert)
void setWidgetSize(Widget *_widget, int _width, int _height, bool _vert)
void setWidgetCoord(Widget *_widget, int _left, int _top, int _width, int _height, bool _vert)
int getWidgetWidth(Widget *_widget, bool _vert)
void convertWidgetCoord(IntCoord &_coord, bool _vert)