cleanup specfile for packaging
[profile/ivi/cogl.git] / cogl / cogl-node-private.h
1 /*
2  * Cogl
3  *
4  * An object oriented GL/GLES Abstraction/Utility Layer
5  *
6  * Copyright (C) 2008,2009,2010 Intel Corporation.
7  *
8  * This library is free software; you can redistribute it and/or
9  * modify it under the terms of the GNU Lesser General Public
10  * License as published by the Free Software Foundation; either
11  * version 2 of the License, or (at your option) any later version.
12  *
13  * This library is distributed in the hope that it will be useful,
14  * but WITHOUT ANY WARRANTY; without even the implied warranty of
15  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
16  * Lesser General Public License for more details.
17  *
18  * You should have received a copy of the GNU Lesser General Public
19  * License along with this library. If not, see
20  * <http://www.gnu.org/licenses/>.
21  *
22  *
23  *
24  * Authors:
25  *   Robert Bragg <robert@linux.intel.com>
26  */
27
28 #ifndef __COGL_NODE_PRIVATE_H
29 #define __COGL_NODE_PRIVATE_H
30
31 #include "cogl-object-private.h"
32 #include "cogl-queue.h"
33
34 typedef struct _CoglNode CoglNode;
35
36 COGL_LIST_HEAD (CoglNodeList, CoglNode);
37
38 /* Pipelines and layers represent their state in a tree structure where
39  * some of the state relating to a given pipeline or layer may actually
40  * be owned by one if is ancestors in the tree. We have a common data
41  * type to track the tree heirachy so we can share code... */
42 struct _CoglNode
43 {
44   /* the parent in terms of class hierarchy, so anything inheriting
45    * from CoglNode also inherits from CoglObject. */
46   CoglObject _parent;
47
48   /* The parent pipeline/layer */
49   CoglNode *parent;
50
51   /* The list entry here contains pointers to the node's siblings */
52   COGL_LIST_ENTRY (CoglNode) list_node;
53
54   /* List of children */
55   CoglNodeList children;
56
57   /* TRUE if the node took a strong reference on its parent. Weak
58    * pipelines for instance don't take a reference on their parent. */
59   gboolean has_parent_reference;
60 };
61
62 #define COGL_NODE(X) ((CoglNode *)(X))
63
64 void
65 _cogl_pipeline_node_init (CoglNode *node);
66
67 typedef void (*CoglNodeUnparentVFunc) (CoglNode *node);
68
69 void
70 _cogl_pipeline_node_set_parent_real (CoglNode *node,
71                                      CoglNode *parent,
72                                      CoglNodeUnparentVFunc unparent,
73                                      gboolean take_strong_reference);
74
75 void
76 _cogl_pipeline_node_unparent_real (CoglNode *node);
77
78 typedef gboolean (*CoglNodeChildCallback) (CoglNode *child, void *user_data);
79
80 void
81 _cogl_pipeline_node_foreach_child (CoglNode *node,
82                                    CoglNodeChildCallback callback,
83                                    void *user_data);
84
85 #endif /* __COGL_NODE_PRIVATE_H */