MyGUI_LayerNode.h
Go to the documentation of this file.
/*
* This source file is part of MyGUI. For the latest info, see http://mygui.info/
* Distributed under the MIT License
* (See accompanying file COPYING.MIT or copy at http://opensource.org/licenses/MIT)
*/
#ifndef MYGUI_LAYER_NODE_H_
#define MYGUI_LAYER_NODE_H_
#include "MyGUI_Prerequest.h"
#include "MyGUI_ILayer.h"
#include "MyGUI_ILayerNode.h"
#include "MyGUI_RenderItem.h"
namespace MyGUI
{
class LayerItem;
using VectorRenderItem = std::vector<RenderItem*>;
using VectorLayerItem = std::vector<ILayerItem*>;
class MYGUI_EXPORT LayerNode : public ILayerNode
{
MYGUI_RTTI_DERIVED(LayerNode)
public:
explicit LayerNode(ILayer* _layer, ILayerNode* _parent = nullptr);
~LayerNode() override;
// леер, которому мы принадлежим
ILayer* getLayer() const override;
// возвращает отца или nullptr
ILayerNode* getParent() const override;
ILayerNode* createChildItemNode() override;
void destroyChildItemNode(ILayerNode* _node) override;
// up child item (make it draw and pick above others)
void upChildItemNode(ILayerNode* _item) override;
// child items list
EnumeratorILayerNode getEnumerator() const override;
size_t getLayerNodeCount() const override;
ILayerNode* getLayerNodeAt(size_t _index) const override;
// добавляем айтем к ноду
void attachLayerItem(ILayerItem* _item) override;
// удаляем айтем из нода
void detachLayerItem(ILayerItem* _item) override;
// добавляет саб айтем и возвращает рендер айтем
RenderItem* addToRenderItem(ITexture* _texture, bool _firstQueue, bool _manualRender) override;
// необходимо обновление нода
void outOfDate(RenderItem* _item) override;
// возвращает виджет по позиции
ILayerItem* getLayerItemByPoint(int _left, int _top) const override;
// рисует леер
void renderToTarget(IRenderTarget* _target, bool _update) override;
void resizeView(const IntSize& _viewSize) override;
float getNodeDepth() const override;
bool isOutOfDate() const;
protected:
// push all empty buffers to the end of buffers list
void updateCompression();
RenderItem* addToRenderItemFirstQueue(ITexture* _texture, bool _manualRender);
RenderItem* addToRenderItemSecondQueue(ITexture* _texture, bool _manualRender);
protected:
// two render queues, for subskins and text
// first queue keep render order based on order of creation
// second queue ignore creation order and always merge render items with same texture
VectorRenderItem mFirstRenderItems;
VectorRenderItem mSecondRenderItems;
size_t mLastNotEmptyItem{0};
// root widgets list
// overlapping layers have only one item here
VectorLayerItem mLayerItems;
VectorILayerNode mChildItems;
ILayerNode* mParent;
ILayer* mLayer;
bool mOutOfDate{false};
bool mOutOfDateCompression{false};
float mDepth{0.0f};
};
} // namespace MyGUI
#endif // MYGUI_LAYER_NODE_H_
MyGUI_ILayer.h
MyGUI_ILayerNode.h
MYGUI_EXPORT
#define MYGUI_EXPORT
Definition MyGUI_Platform.h:77
MyGUI_Prerequest.h
MYGUI_RTTI_DERIVED
#define MYGUI_RTTI_DERIVED(DerivedType)
Definition MyGUI_RTTI.h:69
MyGUI_RenderItem.h
MyGUI::ILayer
Definition MyGUI_ILayer.h:22
MyGUI::ILayerItem
Definition MyGUI_ILayerItem.h:20
MyGUI::ILayerNode
Definition MyGUI_ILayerNode.h:29
MyGUI::IRenderTarget
Definition MyGUI_IRenderTarget.h:21
MyGUI::ITexture
Definition MyGUI_ITexture.h:28
MyGUI::LayerItem
Definition MyGUI_LayerItem.h:21
MyGUI::LayerNode::mLayer
ILayer * mLayer
Definition MyGUI_LayerNode.h:93
MyGUI::LayerNode::getNodeDepth
float getNodeDepth() const override
Definition MyGUI_LayerNode.cpp:340
MyGUI::LayerNode::isOutOfDate
bool isOutOfDate() const
Definition MyGUI_LayerNode.cpp:317
MyGUI::LayerNode::mOutOfDate
bool mOutOfDate
Definition MyGUI_LayerNode.h:94
MyGUI::LayerNode::getParent
ILayerNode * getParent() const override
Definition MyGUI_LayerNode.cpp:312
MyGUI::LayerNode::mSecondRenderItems
VectorRenderItem mSecondRenderItems
Definition MyGUI_LayerNode.h:82
MyGUI::LayerNode::createChildItemNode
ILayerNode * createChildItemNode() override
Definition MyGUI_LayerNode.cpp:38
MyGUI::LayerNode::mLayerItems
VectorLayerItem mLayerItems
Definition MyGUI_LayerNode.h:88
MyGUI::LayerNode::getLayer
ILayer * getLayer() const override
Definition MyGUI_LayerNode.cpp:307
MyGUI::LayerNode::getLayerNodeCount
size_t getLayerNodeCount() const override
Definition MyGUI_LayerNode.cpp:255
MyGUI::LayerNode::attachLayerItem
void attachLayerItem(ILayerItem *_item) override
Definition MyGUI_LayerNode.cpp:219
MyGUI::LayerNode::detachLayerItem
void detachLayerItem(ILayerItem *_item) override
Definition MyGUI_LayerNode.cpp:227
MyGUI::LayerNode::upChildItemNode
void upChildItemNode(ILayerNode *_item) override
Definition MyGUI_LayerNode.cpp:65
MyGUI::LayerNode::destroyChildItemNode
void destroyChildItemNode(ILayerNode *_node) override
Definition MyGUI_LayerNode.cpp:48
MyGUI::LayerNode::mLastNotEmptyItem
size_t mLastNotEmptyItem
Definition MyGUI_LayerNode.h:84
MyGUI::LayerNode::mFirstRenderItems
VectorRenderItem mFirstRenderItems
Definition MyGUI_LayerNode.h:81
MyGUI::LayerNode::mParent
ILayerNode * mParent
Definition MyGUI_LayerNode.h:92
MyGUI::LayerNode::mDepth
float mDepth
Definition MyGUI_LayerNode.h:96
MyGUI::LayerNode::updateCompression
void updateCompression()
Definition MyGUI_LayerNode.cpp:267
MyGUI::LayerNode::getEnumerator
EnumeratorILayerNode getEnumerator() const override
Definition MyGUI_LayerNode.cpp:250
MyGUI::LayerNode::renderToTarget
void renderToTarget(IRenderTarget *_target, bool _update) override
Definition MyGUI_LayerNode.cpp:82
MyGUI::LayerNode::resizeView
void resizeView(const IntSize &_viewSize) override
Definition MyGUI_LayerNode.cpp:106
MyGUI::LayerNode::addToRenderItem
RenderItem * addToRenderItem(ITexture *_texture, bool _firstQueue, bool _manualRender) override
Definition MyGUI_LayerNode.cpp:134
MyGUI::LayerNode::mChildItems
VectorILayerNode mChildItems
Definition MyGUI_LayerNode.h:90
MyGUI::LayerNode::getLayerItemByPoint
ILayerItem * getLayerItemByPoint(int _left, int _top) const override
Definition MyGUI_LayerNode.cpp:114
MyGUI::LayerNode::outOfDate
void outOfDate(RenderItem *_item) override
Definition MyGUI_LayerNode.cpp:243
MyGUI::LayerNode::addToRenderItemFirstQueue
RenderItem * addToRenderItemFirstQueue(ITexture *_texture, bool _manualRender)
Definition MyGUI_LayerNode.cpp:146
MyGUI::LayerNode::LayerNode
LayerNode(ILayer *_layer, ILayerNode *_parent=nullptr)
Definition MyGUI_LayerNode.cpp:17
MyGUI::LayerNode::addToRenderItemSecondQueue
RenderItem * addToRenderItemSecondQueue(ITexture *_texture, bool _manualRender)
Definition MyGUI_LayerNode.cpp:192
MyGUI::LayerNode::getLayerNodeAt
ILayerNode * getLayerNodeAt(size_t _index) const override
Definition MyGUI_LayerNode.cpp:260
MyGUI::LayerNode::mOutOfDateCompression
bool mOutOfDateCompression
Definition MyGUI_LayerNode.h:95
MyGUI::RenderItem
Definition MyGUI_RenderItem.h:23
MyGUI
Definition MyGUI_ActionController.h:15
MyGUI::EnumeratorILayerNode
Enumerator< VectorILayerNode > EnumeratorILayerNode
Definition MyGUI_ILayerNode.h:26
MyGUI::VectorLayerItem
std::vector< ILayerItem * > VectorLayerItem
Definition MyGUI_LayerNode.h:20
MyGUI::VectorRenderItem
std::vector< RenderItem * > VectorRenderItem
Definition MyGUI_LayerNode.h:19
MyGUI::VectorILayerNode
std::vector< ILayerNode * > VectorILayerNode
Definition MyGUI_ILayerNode.h:25
MyGUI::IntSize
types::TSize< int > IntSize
Definition MyGUI_Types.h:30