• Main Page
  • Related Pages
  • Namespaces
  • Data Structures
  • Files
  • Examples
  • File List
  • Globals

MyGUI_SubWidgetBinding.h

Go to the documentation of this file.
00001 
00007 /*
00008     This file is part of MyGUI.
00009     
00010     MyGUI is free software: you can redistribute it and/or modify
00011     it under the terms of the GNU Lesser General Public License as published by
00012     the Free Software Foundation, either version 3 of the License, or
00013     (at your option) any later version.
00014     
00015     MyGUI is distributed in the hope that it will be useful,
00016     but WITHOUT ANY WARRANTY; without even the implied warranty of
00017     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00018     GNU Lesser General Public License for more details.
00019     
00020     You should have received a copy of the GNU Lesser General Public License
00021     along with MyGUI.  If not, see <http://www.gnu.org/licenses/>.
00022 */
00023 #ifndef __MYGUI_SUB_WIDGET_BINDING_H__
00024 #define __MYGUI_SUB_WIDGET_BINDING_H__
00025 
00026 #include "MyGUI_Prerequest.h"
00027 #include "MyGUI_Common.h"
00028 #include "MyGUI_ISubWidget.h"
00029 
00030 namespace MyGUI
00031 {
00032 
00033     // вспомогательный класс для инициализации сабскинов
00034     class MYGUI_EXPORT SubWidgetBinding
00035     {
00036         // для доступа к внутренним членам
00037         friend class ResourceSkin;
00038 
00039     public:
00040         SubWidgetBinding()
00041         {
00042             clear();
00043         }
00044 
00045         SubWidgetBinding(const IntCoord& _coord, Align _aligin, const std::string& _type)
00046         {
00047             create(_coord, _aligin, _type);
00048         }
00049 
00050         void create(const IntCoord& _coord, Align _aligin, const std::string& _type)
00051         {
00052             clear();
00053             mOffset = _coord;
00054             mAlign = _aligin;
00055             mType = _type;
00056         }
00057 
00058         void clear()
00059         {
00060             mType = "";
00061             mAlign = Align::Default;
00062             mStates.clear();
00063         }
00064 
00065         void add(const std::string& _name, IStateInfo* _data, const std::string& _skin)
00066         {
00067             // ищем такой же ключ
00068             MapStateInfo::const_iterator iter = mStates.find(_name);
00069             if (iter != mStates.end())
00070             {
00071                 delete _data;
00072                 MYGUI_LOG(Warning, "state with name '" << _name << "' already exist in skin '" << _skin << "'");
00073                 return;
00074             }
00075             // добавляем
00076             mStates[_name] = _data;
00077         }
00078 
00079     private:
00080         IntCoord mOffset;
00081         Align mAlign;
00082         std::string mType;
00083         MapStateInfo mStates;
00084     };
00085 
00086 } // namespace MyGUI
00087 
00088 
00089 #endif // __MYGUI_SUB_WIDGET_BINDING_H__

Generated on Sun Jan 30 2011 for MyGUI by  doxygen 1.7.1