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