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