MyGUI  3.2.1
MyGUI_WidgetTranslate.h
Go to the documentation of this file.
00001 /*
00002  * This source file is part of MyGUI. For the latest info, see http://mygui.info/
00003  * Distributed under the MIT License
00004  * (See accompanying file COPYING.MIT or copy at http://opensource.org/licenses/MIT)
00005  */
00006 
00007 #ifndef __MYGUI_WIDGET_TRANSLATE_H__
00008 #define __MYGUI_WIDGET_TRANSLATE_H__
00009 
00010 #include "MyGUI_Prerequest.h"
00011 
00012 namespace MyGUI
00013 {
00014 
00015     inline int getWidgetWidth(Widget* _widget, bool _vert)
00016     {
00017         return _vert ? _widget->getWidth() : _widget->getHeight();
00018     }
00019 
00020     inline int getWidgetHeight(Widget* _widget, bool _vert)
00021     {
00022         return _vert ? _widget->getHeight() : _widget->getWidth();
00023     }
00024 
00025     inline int getWidgetLeft(Widget* _widget, bool _vert)
00026     {
00027         return _vert ? _widget->getLeft() : _widget->getTop();
00028     }
00029 
00030     inline int getWidgetTop(Widget* _widget, bool _vert)
00031     {
00032         return _vert ? _widget->getTop() : _widget->getLeft();
00033     }
00034 
00035     inline void setWidgetSize(Widget* _widget, int _width, int _height, bool _vert)
00036     {
00037         _vert ? _widget->setSize(_width, _height) : _widget->setSize(_height, _width);
00038     }
00039 
00040     inline void setWidgetCoord(Widget* _widget, int _left, int _top, int _width, int _height, bool _vert)
00041     {
00042         _vert ? _widget->setCoord(_left, _top, _width, _height) : _widget->setCoord(_top, _left, _height, _width);
00043     }
00044 
00045     inline void convertWidgetCoord(IntCoord& _coord, bool _vert)
00046     {
00047         if (!_vert)
00048         {
00049             std::swap(_coord.left, _coord.top);
00050             std::swap(_coord.width, _coord.height);
00051         }
00052     }
00053 
00054 } // namespace MyGUI
00055 
00056 #endif // __MYGUI_WIDGET_TRANSLATE_H__