1 /* === S Y N F I G ========================================================= */
2 /*! \file selectionmanager.h
3 ** \brief Template Header
8 ** Copyright (c) 2002-2005 Robert B. Quattlebaum Jr., Adrian Bentley
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.
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.
21 /* ========================================================================= */
23 /* === S T A R T =========================================================== */
25 #ifndef __SYNFIG_APP_SELECTIONMANAGER_H
26 #define __SYNFIG_APP_SELECTIONMANAGER_H
28 /* === H E A D E R S ======================================================= */
33 #include <synfig/layer.h>
34 #include <synfig/valuenode.h>
35 #include "value_desc.h"
37 /* === M A C R O S ========================================================= */
39 /* === T Y P E D E F S ===================================================== */
41 /* === C L A S S E S & S T R U C T S ======================================= */
45 class SelectionManager : public etl::shared_object
48 typedef std::pair<synfig::Layer::Handle,synfig::String> LayerParam;
49 typedef std::list<LayerParam> LayerParamList;
51 typedef std::list<synfig::Layer::Handle> LayerList;
52 typedef std::list<ValueDesc> ChildrenList;
53 //typedef std::list<synfig::ValueNode::Handle> ValueNodeList;
55 virtual ~SelectionManager() { }
57 //! Returns the number of layers selected.
58 virtual int get_selected_layer_count()const=0;
60 //! Returns a list of the currently selected layers.
61 virtual LayerList get_selected_layers()const=0;
63 //! Returns the first layer selected or an empty handle if none are selected.
64 virtual synfig::Layer::Handle get_selected_layer()const=0;
66 //! Sets which layers should be selected
67 virtual void set_selected_layers(const LayerList &layer_list)=0;
69 //! Sets which layer should be selected. Empty handle if none.
70 virtual void set_selected_layer(const synfig::Layer::Handle &layer)=0;
72 //! Clears the layer selection list
73 virtual void clear_selected_layers()=0;
77 //! Returns the number of childrens selected.
78 virtual int get_selected_children_count()const=0;
80 //! Returns a list of the currently selected childrens.
81 virtual ChildrenList get_selected_children()const=0;
83 //! Returns the first children selected or an empty handle if none are selected.
84 virtual ChildrenList::value_type get_selected_child()const=0;
86 //! Sets which childrens should be selected
87 virtual void set_selected_children(const ChildrenList &children_list)=0;
89 //! Sets which children should be selected. Empty handle if none.
90 virtual void set_selected_child(const ChildrenList::value_type &children)=0;
92 //! Clears the children selection list
93 virtual void clear_selected_children()=0;
96 //! Returns the number of layer parameters selected.
97 virtual int get_selected_layer_parameter_count()const=0;
99 //! Returns a list of the currently selected layer parameters.
100 virtual LayerParamList get_selected_layer_parameters()const=0;
102 //! Returns the first layer parameter selected or an empty handle if none are selected.
103 virtual LayerParam get_selected_layer_parameter()const=0;
105 //! Sets which layer parameters should be selected
106 virtual void set_selected_layer_parameters(const LayerParamList &layer_param_list)=0;
108 //! Sets which layer parameter should be selected. Empty handle if none.
109 virtual void set_selected_layer_param(const LayerParam &layer_param)=0;
111 //! Clears the layer parameter selection list
112 virtual void clear_selected_layer_parameters()=0;
113 }; // END of class SelectionManager
115 //! A place holding selection manager that does nothing
116 class NullSelectionManager : public SelectionManager
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; }
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; }
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; }
141 }; // END of class NullSelectionManager
143 }; // END of namespace synfigapp
145 /* === E N D =============================================================== */