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_NODE_H__ 00024 #define __MYGUI_LAYER_NODE_H__ 00025 00026 #include "MyGUI_Prerequest.h" 00027 #include "MyGUI_Common.h" 00028 #include "MyGUI_ILayer.h" 00029 #include "MyGUI_ILayerNode.h" 00030 #include "MyGUI_RenderItem.h" 00031 00032 namespace MyGUI 00033 { 00034 00035 class LayerItem; 00036 typedef std::vector<RenderItem*> VectorRenderItem; 00037 typedef std::vector<ILayerItem*> VectorLayerItem; 00038 00039 class MYGUI_EXPORT LayerNode : public ILayerNode 00040 { 00041 MYGUI_RTTI_DERIVED( LayerNode ); 00042 00043 public: 00044 explicit LayerNode(ILayer* _layer, ILayerNode * _parent = nullptr); 00045 virtual ~LayerNode(); 00046 00047 // леер, которому мы принадлежим 00048 virtual ILayer* getLayer() { return mLayer; } 00049 00050 // возвращает отца или nullptr 00051 virtual ILayerNode* getParent() { return mParent; } 00052 00053 // создаем дочерний нод 00054 virtual ILayerNode* createChildItemNode(); 00055 // удаляем дочерний нод 00056 virtual void destroyChildItemNode(ILayerNode* _node); 00057 00058 // поднимаем дочерний нод 00059 virtual void upChildItemNode(ILayerNode* _node); 00060 00061 // список детей 00062 virtual EnumeratorILayerNode getEnumerator(); 00063 00064 00065 // добавляем айтем к ноду 00066 virtual void attachLayerItem(ILayerItem* _item); 00067 // удаляем айтем из нода 00068 virtual void detachLayerItem(ILayerItem* _item); 00069 00070 // добавляет саб айтем и возвращает рендер айтем 00071 virtual RenderItem* addToRenderItem(const std::string& _texture, ISubWidget* _item); 00072 // необходимо обновление нода 00073 virtual void outOfDate(RenderItem* _item); 00074 00075 // возвращает виджет по позиции 00076 virtual ILayerItem* getLayerItemByPoint(int _left, int _top); 00077 00078 // рисует леер 00079 virtual void renderToTarget(IRenderTarget* _target, bool _update); 00080 00081 protected: 00082 // список двух очередей отрисовки, для сабскинов и текста 00083 VectorRenderItem mFirstRenderItems; 00084 VectorRenderItem mSecondRenderItems; 00085 00086 // список всех рутовых виджетов 00087 // у перекрывающегося слоя здесь только один 00088 VectorLayerItem mLayerItems; 00089 00090 // список такиж как мы, для построения дерева 00091 VectorILayerNode mChildItems; 00092 00093 ILayerNode * mParent; 00094 ILayer* mLayer; 00095 }; 00096 00097 } // namespace MyGUI 00098 00099 #endif // __MYGUI_LAYER_NODE_H__