[dali_2.3.23] Merge branch 'devel/master'
[platform/core/uifw/dali-core.git] / dali / internal / update / nodes / node-declarations.h
1 #ifndef DALI_INTERNAL_SCENE_GRAPH_NODE_DECLARATIONS_H
2 #define DALI_INTERNAL_SCENE_GRAPH_NODE_DECLARATIONS_H
3
4 /*
5  * Copyright (c) 2023 Samsung Electronics Co., Ltd.
6  *
7  * Licensed under the Apache License, Version 2.0 (the "License");
8  * you may not use this file except in compliance with the License.
9  * You may obtain a copy of the License at
10  *
11  * http://www.apache.org/licenses/LICENSE-2.0
12  *
13  * Unless required by applicable law or agreed to in writing, software
14  * distributed under the License is distributed on an "AS IS" BASIS,
15  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16  * See the License for the specific language governing permissions and
17  * limitations under the License.
18  *
19  */
20
21 // INTERNAL INCLUDES
22 #include <dali/devel-api/common/bitwise-enum.h>
23 #include <dali/devel-api/common/owner-container.h>
24 #include <dali/internal/common/owner-pointer.h>
25 #include <dali/public-api/common/dali-vector.h>
26 #include <dali/public-api/common/vector-wrapper.h>
27
28 namespace Dali
29 {
30 namespace Internal
31 {
32 namespace SceneGraph
33 {
34 class Node;
35
36 using NodeContainer = Dali::Vector<Node*>;
37 using NodeIter      = NodeContainer::Iterator;
38 using NodeConstIter = NodeContainer::ConstIterator;
39
40 /**
41  * Flag whether property has changed, during the Update phase.
42  */
43 enum class NodePropertyFlags : uint8_t
44 // 8 bits is enough for 6 flags (compiler will check it)
45 {
46   NOTHING                      = 0x000,
47   TRANSFORM                    = 0x001,
48   VISIBLE                      = 0x002,
49   COLOR                        = 0x004,
50   CHILD_DELETED                = 0x008,
51   CHILDREN_REORDER             = 0x010,
52   DESCENDENT_HIERARCHY_CHANGED = 0x020,
53   ALL                          = (DESCENDENT_HIERARCHY_CHANGED << 1) - 1 // all the flags
54 };
55
56 struct NodeDepthPair
57 {
58   Node*    node;
59   uint32_t sortedDepth;
60   NodeDepthPair(Node* node, uint32_t sortedDepth)
61   : node(node),
62     sortedDepth(sortedDepth)
63   {
64   }
65 };
66
67 struct NodeDepths
68 {
69   NodeDepths() = default;
70
71   void Add(Node* node, uint32_t sortedDepth)
72   {
73     nodeDepths.push_back(NodeDepthPair(node, sortedDepth));
74   }
75
76   std::vector<NodeDepthPair> nodeDepths;
77 };
78
79 } // namespace SceneGraph
80
81 } // namespace Internal
82
83 // specialization has to be done in the same namespace
84 template<>
85 struct EnableBitMaskOperators<Internal::SceneGraph::NodePropertyFlags>
86 {
87   static const bool ENABLE = true;
88 };
89
90 } // namespace Dali
91
92 #endif // DALI_INTERNAL_SCENE_GRAPH_NODE_DECLARATIONS_H