MyGUI  3.2.0
MyGUI_WidgetTranslate.h
Go to the documentation of this file.
00001 
00006 /*
00007     This file is part of MyGUI.
00008 
00009     MyGUI is free software: you can redistribute it and/or modify
00010     it under the terms of the GNU Lesser General Public License as published by
00011     the Free Software Foundation, either version 3 of the License, or
00012     (at your option) any later version.
00013 
00014     MyGUI is distributed in the hope that it will be useful,
00015     but WITHOUT ANY WARRANTY; without even the implied warranty of
00016     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00017     GNU Lesser General Public License for more details.
00018 
00019     You should have received a copy of the GNU Lesser General Public License
00020     along with MyGUI.  If not, see <http://www.gnu.org/licenses/>.
00021 */
00022 #ifndef __MYGUI_WIDGET_TRANSLATE_H__
00023 #define __MYGUI_WIDGET_TRANSLATE_H__
00024 
00025 #include "MyGUI_Prerequest.h"
00026 
00027 namespace MyGUI
00028 {
00029 
00030     inline int getWidgetWidth(Widget* _widget, bool _vert)
00031     {
00032         return _vert ? _widget->getWidth() : _widget->getHeight();
00033     }
00034 
00035     inline int getWidgetHeight(Widget* _widget, bool _vert)
00036     {
00037         return _vert ? _widget->getHeight() : _widget->getWidth();
00038     }
00039 
00040     inline int getWidgetLeft(Widget* _widget, bool _vert)
00041     {
00042         return _vert ? _widget->getLeft() : _widget->getTop();
00043     }
00044 
00045     inline int getWidgetTop(Widget* _widget, bool _vert)
00046     {
00047         return _vert ? _widget->getTop() : _widget->getLeft();
00048     }
00049 
00050     inline void setWidgetSize(Widget* _widget, int _width, int _height, bool _vert)
00051     {
00052         _vert ? _widget->setSize(_width, _height) : _widget->setSize(_height, _width);
00053     }
00054 
00055     inline void setWidgetCoord(Widget* _widget, int _left, int _top, int _width, int _height, bool _vert)
00056     {
00057         _vert ? _widget->setCoord(_left, _top, _width, _height) : _widget->setCoord(_top, _left, _height, _width);
00058     }
00059 
00060     inline void convertWidgetCoord(IntCoord& _coord, bool _vert)
00061     {
00062         if (!_vert)
00063         {
00064             std::swap(_coord.left, _coord.top);
00065             std::swap(_coord.width, _coord.height);
00066         }
00067     }
00068 
00069 } // namespace MyGUI
00070 
00071 #endif // __MYGUI_WIDGET_TRANSLATE_H__