synfig-core  1.0.3
valuenode_staticlist.h
Go to the documentation of this file.
1 /* === S Y N F I G ========================================================= */
21 /* ========================================================================= */
22 
23 /* === S T A R T =========================================================== */
24 
25 #ifndef __SYNFIG_VALUENODE_STATICLIST_H
26 #define __SYNFIG_VALUENODE_STATICLIST_H
27 
28 /* === H E A D E R S ======================================================= */
29 
30 #include <vector>
31 #include <list>
32 
33 #include <synfig/valuenode.h>
34 #include <synfig/time.h>
35 #include <synfig/uniqueid.h>
36 
37 /* === M A C R O S ========================================================= */
38 
39 /* === C L A S S E S & S T R U C T S ======================================= */
40 
41 namespace synfig {
42 class ValueNode_BLine;
43 class Canvas;
44 
51 {
52 public:
53  typedef etl::handle<ValueNode_StaticList> Handle;
54  typedef etl::handle<const ValueNode_StaticList> ConstHandle;
57 
58 protected:
59  ValueNode_StaticList(Type &container_type=type_nil, etl::loose_handle<Canvas> canvas = 0);
60 
61  virtual ~ValueNode_StaticList();
62 
64 
65  bool loop_;
66 
67 public:
68  std::vector<ReplaceableListEntry> list;
69 
70 public:
71 
72  void add(const ValueNode::Handle &value_node, int index=-1);
73  void erase(const ListEntry &value_node);
74 // void reindex();
75 
76  virtual ValueNode::LooseHandle get_link_vfunc(int i)const;
77 
78  virtual int link_count()const;
79 
80  virtual String link_name(int i)const;
81 
82  virtual ValueBase operator()(Time t)const;
83 
84  virtual String link_local_name(int i)const;
85  virtual int get_link_index_from_name(const String &name)const;
86 
87  virtual String get_name()const;
88  virtual String get_local_name()const;
89 
90  bool get_loop()const { return loop_; }
91  void set_loop(bool x) { loop_=x; }
92 
93  void set_member_canvas(etl::loose_handle<Canvas>);
94 
95  Type& get_contained_type()const;
96 
97 
98  template <typename iterator> static Handle
99  create(iterator begin, iterator end)
100  {
101  Handle ret=create((*begin)->get_type());
102  for(;begin!=end;++begin)
103  ret->add(*begin);
104  return ret;
105  }
106 
107 // void insert_time(const Time& location, const Time& delta);
108  //void manipulate_time(const Time& old_begin,const Time& old_end,const Time& new_begin,const Time& new_end);
109 
110  virtual ValueNode::Handle clone(etl::loose_handle<Canvas> canvas, const GUID& deriv_guid=GUID())const;
111 
112  virtual ListEntry create_list_entry(int index, Time time=0, Real origin=0.5);
113 
114 protected:
115 
116  virtual bool set_link_vfunc(int i,ValueNode::Handle x);
118 
119 // virtual void get_times_vfunc(Node::time_set &set) const;
120 
121 public:
126  static Handle create(Type &type=type_nil, etl::loose_handle<Canvas> canvas = 0);
129  static bool check_type(Type &type);
131  virtual Vocab get_children_vocab_vfunc()const;
132 
133 #ifdef _DEBUG
134  virtual void ref()const;
135  virtual bool unref()const;
136 #endif
137 
138 }; // END of class ValueNode_StaticList
139 
140 }; // END of namespace synfig
141 
142 /* === E N D =============================================================== */
143 
144 #endif