Fix bugs in previous commit that caused FTBFS in synfig and ETL FTBFS with older...
[synfig.git] / synfig-studio / tags / synfigstudio_0_61_05 / synfig-studio / src / synfigapp / selectionmanager.h
1 /* === S Y N F I G ========================================================= */
2 /*!     \file template.h
3 **      \brief Template Header
4 **
5 **      $Id: selectionmanager.h,v 1.1.1.1 2005/01/07 03:34:37 darco Exp $
6 **
7 **      \legal
8 **      Copyright (c) 2002-2005 Robert B. Quattlebaum Jr., Adrian Bentley
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 /* === S T A R T =========================================================== */
24
25 #ifndef __SYNFIG_APP_SELECTIONMANAGER_H
26 #define __SYNFIG_APP_SELECTIONMANAGER_H
27
28 /* === H E A D E R S ======================================================= */
29
30 #include <list>
31 #include <set>
32 #include <ETL/handle>
33 #include <synfig/layer.h>
34 #include <synfig/valuenode.h>
35 #include "value_desc.h"
36
37 /* === M A C R O S ========================================================= */
38
39 /* === T Y P E D E F S ===================================================== */
40
41 /* === C L A S S E S & S T R U C T S ======================================= */
42
43 namespace synfigapp {
44
45 class SelectionManager : public etl::shared_object
46 {
47 public:
48         typedef std::pair<synfig::Layer::Handle,synfig::String> LayerParam;
49         typedef std::list<LayerParam> LayerParamList;
50
51         typedef std::list<synfig::Layer::Handle> LayerList;
52         typedef std::list<ValueDesc> ChildrenList;
53         //typedef std::list<synfig::ValueNode::Handle> ValueNodeList;
54
55         virtual ~SelectionManager() { }
56
57         //! Returns the number of layers selected.
58         virtual int get_selected_layer_count()const=0;
59
60         //! Returns a list of the currently selected layers.
61         virtual LayerList get_selected_layers()const=0;
62         
63         //! Returns the first layer selected or an empty handle if none are selected.
64         virtual synfig::Layer::Handle get_selected_layer()const=0;
65         
66         //! Sets which layers should be selected
67         virtual void set_selected_layers(const LayerList &layer_list)=0;
68
69         //! Sets which layer should be selected. Empty handle if none.
70         virtual void set_selected_layer(const synfig::Layer::Handle &layer)=0;
71
72         //! Clears the layer selection list
73         virtual void clear_selected_layers()=0;
74
75
76
77         //! Returns the number of childrens selected.
78         virtual int get_selected_children_count()const=0;
79
80         //! Returns a list of the currently selected childrens.
81         virtual ChildrenList get_selected_children()const=0;
82         
83         //! Returns the first children selected or an empty handle if none are selected.
84         virtual ChildrenList::value_type get_selected_child()const=0;
85         
86         //! Sets which childrens should be selected
87         virtual void set_selected_children(const ChildrenList &children_list)=0;
88
89         //! Sets which children should be selected. Empty handle if none.
90         virtual void set_selected_child(const ChildrenList::value_type &children)=0;
91
92         //! Clears the children selection list
93         virtual void clear_selected_children()=0;
94
95
96         //! Returns the number of layer parameters selected.
97         virtual int get_selected_layer_parameter_count()const=0;
98
99         //! Returns a list of the currently selected layer parameters.
100         virtual LayerParamList get_selected_layer_parameters()const=0;
101         
102         //! Returns the first layer parameter selected or an empty handle if none are selected.
103         virtual LayerParam get_selected_layer_parameter()const=0;
104         
105         //! Sets which layer parameters should be selected
106         virtual void set_selected_layer_parameters(const LayerParamList &layer_param_list)=0;
107
108         //! Sets which layer parameter should be selected. Empty handle if none.
109         virtual void set_selected_layer_param(const LayerParam &layer_param)=0;
110
111         //! Clears the layer parameter selection list
112         virtual void clear_selected_layer_parameters()=0;
113 }; // END of class SelectionManager
114
115 //! A place holding selection manager that does nothing
116 class NullSelectionManager : public SelectionManager
117 {
118 public:
119         int get_selected_layer_count()const { return 0; }
120         LayerList get_selected_layers()const { return LayerList(); }
121         synfig::Layer::Handle get_selected_layer()const { return 0; }
122         void set_selected_layers(const LayerList &layer_list) { return; }
123         void set_selected_layer(const synfig::Layer::Handle &layer) { return; }
124         void clear_selected_layers() { return; }
125
126
127         int get_selected_children_count()const { return 0; }
128         ChildrenList get_selected_children()const { return ChildrenList(); }
129         ChildrenList::value_type get_selected_child()const { return ChildrenList::value_type(); }
130         void set_selected_children(const ChildrenList &children_list) { return; }
131         void set_selected_child(const ChildrenList::value_type &child) { return; }
132         void clear_selected_children() { return; }
133
134         int get_selected_layer_parameter_count()const { return 0; }
135         LayerParamList get_selected_layer_parameters()const { return LayerParamList(); }
136         LayerParam get_selected_layer_parameter()const { return LayerParam(); }
137         void set_selected_layer_parameters(const LayerParamList &layer_param_list) { return; }
138         void set_selected_layer_param(const LayerParam &layer_param) { return; }
139         void clear_selected_layer_parameters() { return; }
140
141 }; // END of class NullSelectionManager
142
143 }; // END of namespace synfigapp
144
145 /* === E N D =============================================================== */
146
147 #endif