MyGUI  3.2.1
MyGUI_LayerNode.h
Go to the documentation of this file.
00001 /*
00002  * This source file is part of MyGUI. For the latest info, see http://mygui.info/
00003  * Distributed under the MIT License
00004  * (See accompanying file COPYING.MIT or copy at http://opensource.org/licenses/MIT)
00005  */
00006 
00007 #ifndef __MYGUI_LAYER_NODE_H__
00008 #define __MYGUI_LAYER_NODE_H__
00009 
00010 #include "MyGUI_Prerequest.h"
00011 #include "MyGUI_ILayer.h"
00012 #include "MyGUI_ILayerNode.h"
00013 #include "MyGUI_RenderItem.h"
00014 
00015 namespace MyGUI
00016 {
00017 
00018     class LayerItem;
00019     typedef std::vector<RenderItem*> VectorRenderItem;
00020     typedef std::vector<ILayerItem*> VectorLayerItem;
00021 
00022     class MYGUI_EXPORT LayerNode :
00023         public ILayerNode
00024     {
00025         MYGUI_RTTI_DERIVED( LayerNode )
00026 
00027     public:
00028         explicit LayerNode(ILayer* _layer, ILayerNode* _parent = nullptr);
00029         virtual ~LayerNode();
00030 
00031         // леер, которому мы принадлежим
00032         virtual ILayer* getLayer() const;
00033 
00034         // возвращает отца или nullptr
00035         virtual ILayerNode* getParent() const;
00036 
00037         // создаем дочерний нод
00038         virtual ILayerNode* createChildItemNode();
00039         // удаляем дочерний нод
00040         virtual void destroyChildItemNode(ILayerNode* _node);
00041 
00042         // поднимаем дочерний нод
00043         virtual void upChildItemNode(ILayerNode* _node);
00044 
00045         // список детей
00046         virtual EnumeratorILayerNode getEnumerator() const;
00047 
00048         virtual size_t getLayerNodeCount() const;
00049 
00050         virtual ILayerNode* getLayerNodeAt(size_t _index) const;
00051 
00052         // добавляем айтем к ноду
00053         virtual void attachLayerItem(ILayerItem* _item);
00054         // удаляем айтем из нода
00055         virtual void detachLayerItem(ILayerItem* _item);
00056 
00057         // добавляет саб айтем и возвращает рендер айтем
00058         virtual RenderItem* addToRenderItem(ITexture* _texture, bool _firstQueue, bool _manualRender);
00059         // необходимо обновление нода
00060         virtual void outOfDate(RenderItem* _item);
00061 
00062         // возвращает виджет по позиции
00063         virtual ILayerItem* getLayerItemByPoint(int _left, int _top) const;
00064 
00065         // рисует леер
00066         virtual void renderToTarget(IRenderTarget* _target, bool _update);
00067 
00068         virtual void resizeView(const IntSize& _viewSize);
00069 
00070         virtual float getNodeDepth();
00071 
00072         bool isOutOfDate() const;
00073 
00074     protected:
00075         void updateCompression();
00076         RenderItem* addToRenderItemFirstQueue(ITexture* _texture, bool _manualRender);
00077         RenderItem* addToRenderItemSecondQueue(ITexture* _texture, bool _manualRender);
00078     protected:
00079         // two render queues, for subskins and text
00080         // first queue keep render order based on order of creation
00081         // second queue ignore creation order and always merge render items with same texture
00082         VectorRenderItem mFirstRenderItems;
00083         VectorRenderItem mSecondRenderItems;
00084 
00085         // список всех рутовых виджетов
00086         // у перекрывающегося слоя здесь только один
00087         VectorLayerItem mLayerItems;
00088 
00089         // список такиж как мы, для построения дерева
00090         VectorILayerNode mChildItems;
00091 
00092         ILayerNode* mParent;
00093         ILayer* mLayer;
00094         bool mOutOfDate;
00095         float mDepth;
00096     };
00097 
00098 } // namespace MyGUI
00099 
00100 #endif // __MYGUI_LAYER_NODE_H__