Use link_count from children vocabulary and return the stored vocabulary if already...
[synfig.git] / synfig-core / src / synfig / valuenode_greyed.cpp
1 /* === S Y N F I G ========================================================= */
2 /*!     \file valuenode_greyed.cpp
3 **      \brief Implementation of the "Greyed" valuenode conversion.
4 **
5 **      $Id$
6 **
7 **      \legal
8 **      Copyright (c) 2008 Chris Moore
9 **
10 **      This package is free software; you can redistribute it and/or
11 **      modify it under the terms of the GNU General Public License as
12 **      published by the Free Software Foundation; either version 2 of
13 **      the License, or (at your option) any later version.
14 **
15 **      This package is distributed in the hope that it will be useful,
16 **      but WITHOUT ANY WARRANTY; without even the implied warranty of
17 **      MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
18 **      General Public License for more details.
19 **      \endlegal
20 */
21 /* ========================================================================= */
22
23 /* === H E A D E R S ======================================================= */
24
25 #ifdef USING_PCH
26 #       include "pch.h"
27 #else
28 #ifdef HAVE_CONFIG_H
29 #       include <config.h>
30 #endif
31
32 #include "valuenode_greyed.h"
33 #include "valuenode_const.h"
34
35 #endif
36
37 /* === U S I N G =========================================================== */
38
39 using namespace synfig;
40
41 /* === M A C R O S ========================================================= */
42
43 /* === G L O B A L S ======================================================= */
44
45 /* === P R O C E D U R E S ================================================= */
46
47 /* === M E T H O D S ======================================================= */
48
49 ValueNode_Greyed::ValueNode_Greyed(const ValueBase::Type &x):
50         ValueNode_Reference(x)
51 {
52 }
53
54 ValueNode_Greyed::ValueNode_Greyed(const ValueNode::Handle &x):
55         ValueNode_Reference(x->get_type())
56 {
57         Vocab ret(get_children_vocab());
58         set_children_vocab(ret);
59         set_link("link",x);
60 }
61
62 ValueNode_Greyed*
63 ValueNode_Greyed::create(const ValueBase &x)
64 {
65         return new ValueNode_Greyed(ValueNode_Const::create(x));
66 }
67
68 LinkableValueNode*
69 ValueNode_Greyed::create_new()const
70 {
71         return new ValueNode_Greyed(get_type());
72 }
73
74 String
75 ValueNode_Greyed::get_name()const
76 {
77         return "greyed";
78 }
79
80 String
81 ValueNode_Greyed::get_local_name()const
82 {
83         return _("Greyed");
84 }
85
86 LinkableValueNode::Vocab
87 ValueNode_Greyed::get_children_vocab_vfunc()const
88 {
89         if(children_vocab.size())
90                 return children_vocab;
91
92         LinkableValueNode::Vocab ret;
93
94         ret.push_back(ParamDesc(ValueBase(),"link")
95                 .set_local_name(_("Link"))
96                 .set_description(_("The greyed value"))
97         );
98
99         return ret;
100 }