- Main Page
- Related Pages
- Namespaces
- Classes
- Files

# layergrouptreestore.h

Go to the documentation of this file.

    00001 /* === S Y N F I G ========================================================= */
    00021 /* ========================================================================= */
    00022
    00023 /* === S T A R T =========================================================== */
    00024
    00025 #ifndef __SYNFIG_STUDIO_LAYERGROUPTREESTORE_H
    00026 #define __SYNFIG_STUDIO_LAYERGROUPTREESTORE_H
    00027
    00028 /* === H E A D E R S ======================================================= */
    00029
    00030 #include <gtkmm/treestore.h>
    00031 #include <synfigapp/canvasinterface.h>
    00032 #include <synfig/value.h>
    00033 #include <synfig/valuenode.h>
    00034 #include <gtkmm/treeview.h>
    00035
    00036 /* === M A C R O S ========================================================= */
    00037
    00038 /* === T Y P E D E F S ===================================================== */
    00039
    00040 /* === C L A S S E S & S T R U C T S ======================================= */
    00041
    00042 namespace studio {
    00043
    00044 class LayerGroupTreeStore :  public Gtk::TreeStore
    00045 {
    00046     /*
    00047  -- ** -- P U B L I C   T Y P E S ---------------------------------------------
    00048     */
    00049
    00050 public:
    00051     typedef std::list<synfig::Layer::Handle> LayerList;
    00052
    00053     class Model : public Gtk::TreeModel::ColumnRecord
    00054     {
    00055     public:
    00056         Gtk::TreeModelColumn<Glib::RefPtr<Gdk::Pixbuf> > icon;
    00057         Gtk::TreeModelColumn<Glib::ustring> label;
    00058         Gtk::TreeModelColumn<Glib::ustring> tooltip;
    00059
    00060         Gtk::TreeModelColumn<Glib::ustring> group_name;
    00061         Gtk::TreeModelColumn<Glib::ustring> parent_group_name;
    00062
    00063         Gtk::TreeModelColumn<synfig::Canvas::Handle> canvas;
    00064
    00065         Gtk::TreeModelColumn<bool>                      active;
    00066         Gtk::TreeModelColumn<bool>                      is_layer;
    00067         Gtk::TreeModelColumn<bool>                      is_group;
    00068         Gtk::TreeModelColumn<synfig::Layer::Handle>     layer;
    00069
    00070         Gtk::TreeModelColumn<LayerList>     all_layers;
    00071         Gtk::TreeModelColumn<LayerList>     child_layers;
    00072
    00073         Model()
    00074         {
    00075             add(icon);
    00076             add(label);
    00077             add(group_name);
    00078             add(parent_group_name);
    00079             add(canvas);
    00080             add(tooltip);
    00081             add(active);
    00082             add(layer);
    00083             add(is_layer);
    00084             add(is_group);
    00085             add(all_layers);
    00086             add(child_layers);
    00087         }
    00088     };
    00089
    00090     /*
    00091  -- ** -- P U B L I C  D A T A ------------------------------------------------
    00092     */
    00093
    00094 public:
    00095
    00097     const Model model;
    00098
    00099     bool rebuilding;
    00100
    00101     /*
    00102  -- ** -- P R I V A T E   D A T A ---------------------------------------------
    00103     */
    00104
    00105 private:
    00106
    00107     etl::loose_handle<synfigapp::CanvasInterface> canvas_interface_;
    00108
    00109     Glib::RefPtr<Gdk::Pixbuf> layer_icon;
    00110     Glib::RefPtr<Gdk::Pixbuf> group_icon;
    00111
    00112     /*
    00113  -- ** -- P R I V A T E   M E T H O D S ---------------------------------------
    00114     */
    00115
    00116 private:
    00117
    00118     /*
    00119  -- ** -- P R O T E C T E D   M E T H O D S -----------------------------------
    00120     */
    00121
    00122 private:
    00123
    00124     virtual void set_value_impl (const Gtk::TreeModel::iterator& row, int column, const Glib::ValueBase& value);
    00125     virtual void  get_value_vfunc (const Gtk::TreeModel::iterator& iter, int column, Glib::ValueBase& value)const;
    00126
    00127     virtual bool  row_draggable_vfunc (const TreeModel::Path& path)const;
    00128     virtual bool  drag_data_get_vfunc (const TreeModel::Path& path, Gtk::SelectionData& selection_data)const;
    00129     virtual bool  drag_data_delete_vfunc (const TreeModel::Path& path);
    00130     virtual bool  drag_data_received_vfunc (const TreeModel::Path& dest, const Gtk::SelectionData& selection_data);
    00131     virtual bool  row_drop_possible_vfunc (const TreeModel::Path& dest, const Gtk::SelectionData& selection_data)const;
    00132
    00133
    00134     void on_group_pair_added(synfig::String group, etl::handle<synfig::Layer> layer);
    00135     void on_group_pair_removed(synfig::String group, etl::handle<synfig::Layer> layer);
    00136
    00137     void on_activity();
    00138
    00139     /*
    00140  -- ** -- S I G N A L   T E R M I N A L S -------------------------------------
    00141     */
    00142
    00143 private:
    00144
    00145     bool on_layer_tree_event(GdkEvent *event);
    00146
    00147     void on_layer_new_description(synfig::Layer::Handle handle,synfig::String desc);
    00148
    00149     void on_layer_status_changed(synfig::Layer::Handle handle,bool);
    00150
    00151     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);
    00152
    00153     bool find_group_row_(const synfig::String &group, Gtk::TreeModel::Children layers, Gtk::TreeModel::Children::iterator &iter, Gtk::TreeModel::Children::iterator &prev);
    00154
    00155     bool on_group_removed(synfig::String group);
    00156     bool on_group_changed(synfig::String group);
    00157
    00158     /*
    00159  -- ** -- P U B L I C   M E T H O D S -----------------------------------------
    00160     */
    00161
    00162 public:
    00163
    00164     LayerGroupTreeStore(etl::loose_handle<synfigapp::CanvasInterface> canvas_interface_);
    00165     ~LayerGroupTreeStore();
    00166
    00167     Gtk::TreeRow on_group_added(synfig::String group);
    00168     etl::loose_handle<synfigapp::CanvasInterface> canvas_interface() { return canvas_interface_; }
    00169     etl::loose_handle<const synfigapp::CanvasInterface> canvas_interface()const { return canvas_interface_; }
    00170     etl::loose_handle<synfigapp::CanvasInterface> get_canvas_interface()const { return canvas_interface_; }
    00171
    00172     bool find_layer_row(const synfig::Layer::Handle &handle, Gtk::TreeModel::Children::iterator &iter);
    00173
    00174     bool find_group_row(const synfig::String &group, Gtk::TreeModel::Children::iterator &iter);
    00175
    00176     bool find_prev_layer_row(const synfig::Layer::Handle &handle, Gtk::TreeModel::Children::iterator &iter);
    00177
    00178     void rebuild();
    00179
    00180     void refresh();
    00181
    00182     void refresh_row(Gtk::TreeModel::Row &row);
    00183
    00184     void set_row_layer(Gtk::TreeRow &row,synfig::Layer::Handle &handle);
    00185
    00186     static bool search_func(const Glib::RefPtr<TreeModel>&,int,const Glib::ustring&,const TreeModel::iterator&);
    00187
    00188     /*
    00189  -- ** -- S T A T I C   P U B L I C   M E T H O D S ---------------------------
    00190     */
    00191
    00192 public:
    00193
    00194     static Glib::RefPtr<LayerGroupTreeStore> create(etl::loose_handle<synfigapp::CanvasInterface> canvas_interface_);
    00195
    00196 }; // END of class LayerGroupTreeStore
    00197
    00198 }; // END of namespace studio
    00199
    00200 /* === E N D =============================================================== */
    00201
    00202 #endif