1 /* === S Y N F I G ========================================================= */
2 /*! \file layertreestore.h
3 ** \brief Template Header
5 ** $Id: layergrouptreestore.h,v 1.1.1.1 2005/01/07 03:34:36 darco Exp $
8 ** Copyright (c) 2002 Robert B. Quattlebaum Jr.
10 ** This software and associated documentation
11 ** are CONFIDENTIAL and PROPRIETARY property of
12 ** the above-mentioned copyright holder.
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.
20 /* ========================================================================= */
22 /* === S T A R T =========================================================== */
24 #ifndef __SYNFIG_STUDIO_LAYERGROUPTREESTORE_H
25 #define __SYNFIG_STUDIO_LAYERGROUPTREESTORE_H
27 /* === H E A D E R S ======================================================= */
29 #include <gtkmm/treestore.h>
30 #include <synfigapp/canvasinterface.h>
31 #include <synfig/value.h>
32 #include <synfig/valuenode.h>
33 #include <gtkmm/treeview.h>
35 /* === M A C R O S ========================================================= */
37 /* === T Y P E D E F S ===================================================== */
39 /* === C L A S S E S & S T R U C T S ======================================= */
43 class LayerGroupTreeStore : public Gtk::TreeStore
46 -- ** -- P U B L I C T Y P E S ---------------------------------------------
50 typedef std::list<synfig::Layer::Handle> LayerList;
52 class Model : public Gtk::TreeModel::ColumnRecord
55 Gtk::TreeModelColumn<Glib::RefPtr<Gdk::Pixbuf> > icon;
56 Gtk::TreeModelColumn<Glib::ustring> label;
57 Gtk::TreeModelColumn<Glib::ustring> tooltip;
59 Gtk::TreeModelColumn<Glib::ustring> group_name;
60 Gtk::TreeModelColumn<Glib::ustring> parent_group_name;
62 Gtk::TreeModelColumn<synfig::Canvas::Handle> canvas;
64 Gtk::TreeModelColumn<bool> active;
65 Gtk::TreeModelColumn<bool> is_layer;
66 Gtk::TreeModelColumn<bool> is_group;
67 Gtk::TreeModelColumn<synfig::Layer::Handle> layer;
69 Gtk::TreeModelColumn<LayerList> all_layers;
70 Gtk::TreeModelColumn<LayerList> child_layers;
77 add(parent_group_name);
90 -- ** -- P U B L I C D A T A ------------------------------------------------
95 //! TreeModel for the layers
101 -- ** -- P R I V A T E D A T A ---------------------------------------------
106 etl::loose_handle<synfigapp::CanvasInterface> canvas_interface_;
108 Glib::RefPtr<Gdk::Pixbuf> layer_icon;
109 Glib::RefPtr<Gdk::Pixbuf> group_icon;
112 -- ** -- P R I V A T E M E T H O D S ---------------------------------------
118 -- ** -- P R O T E C T E D M E T H O D S -----------------------------------
123 virtual void set_value_impl (const Gtk::TreeModel::iterator& row, int column, const Glib::ValueBase& value);
124 virtual void get_value_vfunc (const Gtk::TreeModel::iterator& iter, int column, Glib::ValueBase& value)const;
126 virtual bool row_draggable_vfunc (const TreeModel::Path& path)const;
127 virtual bool drag_data_get_vfunc (const TreeModel::Path& path, Gtk::SelectionData& selection_data)const;
128 virtual bool drag_data_delete_vfunc (const TreeModel::Path& path);
129 virtual bool drag_data_received_vfunc (const TreeModel::Path& dest, const Gtk::SelectionData& selection_data);
130 virtual bool row_drop_possible_vfunc (const TreeModel::Path& dest, const Gtk::SelectionData& selection_data)const;
133 void on_group_pair_added(synfig::String group, etl::handle<synfig::Layer> layer);
134 void on_group_pair_removed(synfig::String group, etl::handle<synfig::Layer> layer);
139 -- ** -- S I G N A L T E R M I N A L S -------------------------------------
144 bool on_layer_tree_event(GdkEvent *event);
146 void on_layer_new_description(synfig::Layer::Handle handle,synfig::String desc);
148 void on_layer_status_changed(synfig::Layer::Handle handle,bool);
150 bool find_layer_row_(const synfig::Layer::Handle &handle, synfig::Canvas::Handle canvas, Gtk::TreeModel::Children layers, Gtk::TreeModel::Children::iterator &iter, Gtk::TreeModel::Children::iterator &prev);
152 bool find_group_row_(const synfig::String &group, Gtk::TreeModel::Children layers, Gtk::TreeModel::Children::iterator &iter, Gtk::TreeModel::Children::iterator &prev);
154 bool on_group_removed(synfig::String group);
155 bool on_group_changed(synfig::String group);
158 -- ** -- P U B L I C M E T H O D S -----------------------------------------
163 LayerGroupTreeStore(etl::loose_handle<synfigapp::CanvasInterface> canvas_interface_);
164 ~LayerGroupTreeStore();
166 Gtk::TreeRow on_group_added(synfig::String group);
167 etl::loose_handle<synfigapp::CanvasInterface> canvas_interface() { return canvas_interface_; }
168 etl::loose_handle<const synfigapp::CanvasInterface> canvas_interface()const { return canvas_interface_; }
169 etl::loose_handle<synfigapp::CanvasInterface> get_canvas_interface()const { return canvas_interface_; }
171 bool find_layer_row(const synfig::Layer::Handle &handle, Gtk::TreeModel::Children::iterator &iter);
173 bool find_group_row(const synfig::String &group, Gtk::TreeModel::Children::iterator &iter);
175 bool find_prev_layer_row(const synfig::Layer::Handle &handle, Gtk::TreeModel::Children::iterator &iter);
181 void refresh_row(Gtk::TreeModel::Row &row);
183 void set_row_layer(Gtk::TreeRow &row,synfig::Layer::Handle &handle);
185 static bool search_func(const Glib::RefPtr<TreeModel>&,int,const Glib::ustring&,const TreeModel::iterator&);
188 -- ** -- S T A T I C P U B L I C M E T H O D S ---------------------------
193 static Glib::RefPtr<LayerGroupTreeStore> create(etl::loose_handle<synfigapp::CanvasInterface> canvas_interface_);
195 }; // END of class LayerGroupTreeStore
197 }; // END of namespace studio
199 /* === E N D =============================================================== */