1 /* === S I N F G =========================================================== */
2 /*! \file keyframetreestore.h
3 ** \brief Template Header
5 ** $Id: keyframetreestore.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 __SINFG_STUDIO_KEYFRAMETREESTORE_H
25 #define __SINFG_STUDIO_KEYFRAMETREESTORE_H
27 /* === H E A D E R S ======================================================= */
29 #include <gtkmm/liststore.h>
30 #include <sinfgapp/canvasinterface.h>
31 #include <gdkmm/pixbuf.h>
32 #include <sinfg/keyframe.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 ======================================= */
41 //class TreeRowReferenceHack;
42 //#define TreeRowReferenceHack Gtk::TreeRowReference
46 class KeyframeTreeStore_Class;
48 class KeyframeTreeStore :
50 public Gtk::TreeModel,
51 public Gtk::TreeDragSource,
52 public Gtk::TreeDragDest
55 -- ** -- P U B L I C T Y P E S ---------------------------------------------
60 class Model : public Gtk::TreeModel::ColumnRecord
63 Gtk::TreeModelColumn<sinfg::Time> time;
64 Gtk::TreeModelColumn<Glib::ustring> description;
65 Gtk::TreeModelColumn<sinfg::Keyframe> keyframe;
66 Gtk::TreeModelColumn<sinfg::Time> time_delta;
78 -- ** -- P U B L I C D A T A ------------------------------------------------
86 -- ** -- P R I V A T E D A T A ---------------------------------------------
91 etl::loose_handle<sinfgapp::CanvasInterface> canvas_interface_;
93 //! Unique stamp for this TreeModel.
96 static KeyframeTreeStore_Class keyframe_tree_store_class_;
98 //std::map<sinfg::Keyframe,TreeRowReferenceHack> path_table_;
100 sinfg::KeyframeList old_keyframe_list;
103 -- ** -- P R I V A T E M E T H O D S ---------------------------------------
108 void add_keyframe(sinfg::Keyframe);
110 void remove_keyframe(sinfg::Keyframe);
112 void change_keyframe(sinfg::Keyframe);
114 static int sorter(const Gtk::TreeModel::iterator &,const Gtk::TreeModel::iterator &);
116 bool iterator_sane(const GtkTreeIter* iter)const;
118 bool iterator_sane(const Gtk::TreeModel::iterator& iter)const;
120 void dump_iterator(const GtkTreeIter* iter, const Glib::ustring &name)const;
122 void dump_iterator(const Gtk::TreeModel::iterator& iter, const Glib::ustring &name)const;
124 //! Resets the iterator stamp for this model.
125 /*! This should be called whenever the class is
126 ** constructed or when large numbers of
127 ** iterators become invalid. */
130 //void reset_path_table();
133 -- ** -- V I R T U A L F U N C T I O N S -----------------------------------
138 virtual void set_value_impl (const Gtk::TreeModel::iterator& row, int column, const Glib::ValueBase& value);
139 virtual Gtk::TreeModelFlags get_flags_vfunc ();
140 virtual int get_n_columns_vfunc ();
141 virtual GType get_column_type_vfunc (int index);
142 virtual bool iter_next_vfunc (const iterator& iter, iterator& iter_next) const;
143 virtual bool get_iter_vfunc (const Gtk::TreeModel::Path& path, iterator& iter_next)const;
144 virtual bool iter_nth_root_child_vfunc (int n, iterator& iter)const;
145 virtual Gtk::TreeModel::Path get_path_vfunc (const iterator& iter)const;
146 virtual void ref_node_vfunc (iterator& iter)const;
147 virtual void unref_node_vfunc (iterator& iter)const;
148 virtual void get_value_vfunc (const Gtk::TreeModel::iterator& iter, int column, Glib::ValueBase& value)const;
149 virtual bool iter_is_valid (const iterator& iter) const;
150 virtual int iter_n_root_children_vfunc () const;
152 //virtual bool iter_nth_child_vfunc (GtkTreeIter* iter, const GtkTreeIter* parent, int n);
153 //virtual bool iter_children_vfunc (GtkTreeIter* iter, const GtkTreeIter* parent);
154 //virtual bool iter_has_child_vfunc (const GtkTreeIter* iter);
155 //virtual int iter_n_children_vfunc (const GtkTreeIter* iter);
156 //virtual bool iter_parent_vfunc (GtkTreeIter* iter, const GtkTreeIter* child);
159 virtual bool get_sort_column_id_vfunc (int* sort_column_id, Gtk::SortType* order);
160 virtual void set_sort_column_id_vfunc (int sort_column_id, Gtk::SortType order);
161 virtual void set_sort_func_vfunc (int sort_column_id, GtkTreeIterCompareFunc func, void* data, GtkDestroyNotify destroy);
162 virtual void set_default_sort_func_vfunc (GtkTreeIterCompareFunc func, void* data, GtkDestroyNotify destroy);
163 virtual bool has_default_sort_func_vfunc ();
167 -- ** -- S I G N A L T E R M I N A L S -------------------------------------
173 -- ** -- P U B L I C M E T H O D S -----------------------------------------
178 KeyframeTreeStore(etl::loose_handle<sinfgapp::CanvasInterface> canvas_interface_);
179 ~KeyframeTreeStore();
181 etl::loose_handle<sinfgapp::CanvasInterface> canvas_interface() { return canvas_interface_; }
182 etl::loose_handle<const sinfgapp::CanvasInterface> canvas_interface()const { return canvas_interface_; }
184 sinfg::Canvas::Handle get_canvas() { return canvas_interface()->get_canvas(); }
185 sinfg::Canvas::Handle get_canvas()const { return canvas_interface()->get_canvas(); }
187 Gtk::TreeModel::Row find_row(const sinfg::Keyframe &keyframe);
190 -- ** -- S T A T I C M E T H O D S ------------------------------------------
195 static Glib::RefPtr<KeyframeTreeStore> create(etl::loose_handle<sinfgapp::CanvasInterface> canvas_interface_);
197 static int time_sorter(const Gtk::TreeModel::iterator &rhs,const Gtk::TreeModel::iterator &lhs);
199 }; // END of class KeyframeTreeStore
202 class KeyframeTreeStore_Class : public Glib::Class
205 struct KeyframeTreeStoreClass
207 GObjectClass parent_class;
210 friend class KeyframeTreeStore;
212 const Glib::Class& init();
214 static void class_init_function(gpointer g_blass, gpointer class_data);
215 }; // END of CustomTreeStore_Class
217 }; // END of namespace studio
219 /* === E N D =============================================================== */