MyGUI  3.0.3
MyGUI_LayerItem.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_LAYER_ITEM_H__
00024 #define __MYGUI_LAYER_ITEM_H__
00025 
00026 #include "MyGUI_Prerequest.h"
00027 #include "MyGUI_LayerManager.h"
00028 #include "MyGUI_ILayer.h"
00029 #include "MyGUI_ILayerNode.h"
00030 #include "MyGUI_ILayerItem.h"
00031 #include "MyGUI_ISubWidget.h"
00032 
00033 namespace MyGUI
00034 {
00035 
00036     class MYGUI_EXPORT LayerItem : public ILayerItem
00037     {
00038     public:
00039         LayerItem();
00040         virtual ~LayerItem() { }
00041 
00042     public:
00043         ILayer* getLayer() { return mLayer; }
00044 
00045         virtual void attachItemToNode(ILayer* _layer, ILayerNode* _node);
00046         virtual void detachFromLayer();
00047         virtual void upLayerItem();
00048 
00049         void setRenderItemTexture(ITexture* _texture);
00050 
00051         void addChildItem(LayerItem* _item);
00052         void removeChildItem(LayerItem* _item);
00053 
00054         void addChildNode(LayerItem* _item);
00055         void removeChildNode(LayerItem* _item);
00056 
00057         void addRenderItem(ISubWidget* _item);
00058         void removeAllRenderItems();
00059 
00060         void saveLayerItem();
00061         void restoreLayerItem();
00062 
00063     protected:
00064         void attachToLayerItemNode(ILayerNode* _node, bool _deep);
00065         void detachFromLayerItemNode(bool _deep);
00066 
00067     private:
00068         // актуально для рутового виджета
00069         ILayer* mLayer;
00070         // конкретный айтем находящийся в слое
00071         ILayerNode * mLayerNode;
00072         ILayerNode * mSaveLayerNode;
00073 
00074         typedef std::vector<LayerItem*> VectorLayerItem;
00075         // список наших детей айтемов
00076         VectorLayerItem mLayerItems;
00077         // список наших узлов
00078         VectorLayerItem mLayerNodes;
00079 
00080         // вектор всех детей сабскинов
00081         VectorSubWidget mDrawItems;
00082 
00083         ITexture* mTexture;
00084     };
00085 
00086 } // namespace MyGUI
00087 
00088 #endif // __MYGUI_LAYER_ITEM_H__