MyGUI: MyGUI_LayerNode.h Source File

MyGUI 3.4.3

MyGUI_LayerNode.h
Go to the documentation of this file.
1/*
2 * This source file is part of MyGUI. For the latest info, see http://mygui.info/
3 * Distributed under the MIT License
4 * (See accompanying file COPYING.MIT or copy at http://opensource.org/licenses/MIT)
5 */
6
7#ifndef MYGUI_LAYER_NODE_H_
8#define MYGUI_LAYER_NODE_H_
9
10#include "MyGUI_Prerequest.h"
11#include "MyGUI_ILayer.h"
12#include "MyGUI_ILayerNode.h"
13#include "MyGUI_RenderItem.h"
14
15namespace MyGUI
16{
17
18 class LayerItem;
19 using VectorRenderItem = std::vector<RenderItem*>;
20 using VectorLayerItem = std::vector<ILayerItem*>;
21
22 class MYGUI_EXPORT LayerNode : public ILayerNode
23 {
24 MYGUI_RTTI_DERIVED(LayerNode)
25
26 public:
27 explicit LayerNode(ILayer* _layer, ILayerNode* _parent = nullptr);
28 ~LayerNode() override;
29
30 // леер, которому мы принадлежим
31 ILayer* getLayer() const override;
32
33 // возвращает отца или nullptr
34 ILayerNode* getParent() const override;
35
36 ILayerNode* createChildItemNode() override;
37 void destroyChildItemNode(ILayerNode* _node) override;
38
39 // up child item (make it draw and pick above others)
40 void upChildItemNode(ILayerNode* _item) override;
41
42 // child items list
43 EnumeratorILayerNode getEnumerator() const override;
44
45 size_t getLayerNodeCount() const override;
46
47 ILayerNode* getLayerNodeAt(size_t _index) const override;
48
49 // добавляем айтем к ноду
50 void attachLayerItem(ILayerItem* _item) override;
51 // удаляем айтем из нода
52 void detachLayerItem(ILayerItem* _item) override;
53
54 // добавляет саб айтем и возвращает рендер айтем
55 RenderItem* addToRenderItem(ITexture* _texture, bool _firstQueue, bool _manualRender) override;
56 // необходимо обновление нода
57 void outOfDate(RenderItem* _item) override;
58
59 // возвращает виджет по позиции
60 ILayerItem* getLayerItemByPoint(int _left, int _top) const override;
61
62 // рисует леер
63 void renderToTarget(IRenderTarget* _target, bool _update) override;
64
65 void resizeView(const IntSize& _viewSize) override;
66
67 float getNodeDepth() const override;
68
69 bool isOutOfDate() const;
70
71 protected:
72 // push all empty buffers to the end of buffers list
73 void updateCompression();
74 RenderItem* addToRenderItemFirstQueue(ITexture* _texture, bool _manualRender);
75 RenderItem* addToRenderItemSecondQueue(ITexture* _texture, bool _manualRender);
76
77 protected:
78 // two render queues, for subskins and text
79 // first queue keep render order based on order of creation
80 // second queue ignore creation order and always merge render items with same texture
81 VectorRenderItem mFirstRenderItems;
82 VectorRenderItem mSecondRenderItems;
83
84 size_t mLastNotEmptyItem{0};
85
86 // root widgets list
87 // overlapping layers have only one item here
88 VectorLayerItem mLayerItems;
89
90 VectorILayerNode mChildItems;
91
92 ILayerNode* mParent;
93 ILayer* mLayer;
94 bool mOutOfDate{false};
95 bool mOutOfDateCompression{false};
96 float mDepth{0.0f};
97 };
98
99} // namespace MyGUI
100
101#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