more updates
[synfig.git] / synfig-core / trunk / src / sinfg / proto / nodebase.px
1 /* === S I N F G =========================================================== */
2 /*!     \file nodebase.h
3 **      \brief Template Header
4 **
5 **      $Id: template.h,v 1.1.1.1 2005/01/04 01:23:09 darco Exp $
6 **
7 **      \legal
8 **      Copyright (c) 2002 Robert B. Quattlebaum Jr.
9 **
10 **      This software and associated documentation
11 **      are CONFIDENTIAL and PROPRIETARY property of
12 **      the above-mentioned copyright holder.
13 **
14 **      You may not copy, print, publish, or in any
15 **      other way distribute this software without
16 **      a prior written agreement with
17 **      the copyright holder.
18 **      \endlegal
19 */
20 /* ========================================================================= */
21
22 /* === S T A R T =========================================================== */
23
24 #ifndef __SINFG_NODEBASE_H
25 #define __SINFG_NODEBASE_H
26
27 /* === H E A D E R S ======================================================= */
28
29 #include "../protocol.h"
30 #include "../string.h"
31 #include "../guid.h"
32 #include <sigc++/slot.h>
33
34 /* === M A C R O S ========================================================= */
35
36 /*
37
38 #define DEFINE_SIMPLE_FUNC(func_name, ret_type) \
39         private: sigc::slot<ret_type> slot_##func_name; \
40         public: ret_type func_name() { return slot_##func_name(); }
41
42 #define DEFINE_SIMPLE_FUNC_CONST(func_name, ret_type) \
43         private: sigc::slot<ret_type> slotconst_##func_name; \
44         public: ret_type func_name()const { return slotconst_##func_name(); }
45
46 #define DECLARE_FUNC(func_name, ret_type, ...) \
47         private: sigc::slot<ret_type, __VA_ARGS__> slot_##func_name; 
48 //      public: ret_type func_name(__VA_ARGS__)
49
50 #define DECLARE_FUNC_CONST(func_name, ret_type, ...) \
51         private: sigc::slot<ret_type, __VA_ARGS__> slotconst_##func_name; 
52
53 //      public: ret_type func_name(__VA_ARGS__)const
54                 
55 #define DEFINE_FUNC(func_name, ret_type, arg_list, ...) \
56         public: ret_type func_name(__VA_ARGS__) { return slot_##func_name arg_list; }
57
58 #define DEFINE_FUNC_CONST(func_name, ret_type, arg_list, ...) \
59         public: ret_type func_name(__VA_ARGS__)const { return slotconst_##func_name arg_list; }
60
61 #define DEFINE_DATA(data_name, data_type) \
62         DEFINE_SIMPLE_FUNC_CONST(get_ ## data_name, data_type); \
63         DECLARE_FUNC(set_ ## data_name, void, data_type); \
64         DEFINE_FUNC(set_ ## data_name, void, (x), data_type x)
65 */
66
67 /* === T Y P E D E F S ===================================================== */
68
69 /* === C L A S S E S & S T R U C T S ======================================= */
70
71 namespace sinfg {
72 namespace Proto {
73
74 class NodeBase : public Protocol
75 {
76 public:
77
78         PX_DEFINE_DATA(guid, GUID)
79
80         PX_DEFINE_FUNC(func_test, float, int, int)
81
82         PX_DEFINE_DATA(id, String)
83
84         PX_DEFINE_DATA(root, NodeHandle)
85
86         PX_DEFINE_FUNC(signal_changed, sigc::signal<void>)
87         PX_DEFINE_FUNC(signal_deleted, sigc::signal<void>)
88                 
89         PX_DEFINE_FUNC_CONST(get_parents, const NodeList)
90         PX_DEFINE_FUNC_CONST(get_children, const NodeList)
91
92         PX_DEFINE_FUNC(query_children, NodeList, Query)
93
94 }; // END of class Proto::NodeBase
95
96 }; // END of namespace Proto
97 }; // END of namespace sinfg
98
99 /* === E N D =============================================================== */
100
101 #endif