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