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