2 // Generated by gtkmmproc -- DO NOT MODIFY!
3 #ifndef _GTKMM_TREEVIEW_H
4 #define _GTKMM_TREEVIEW_H
6 #include <gtkmmconfig.h>
13 /* Copyright(C) 2002 The gtkmm Development Team
15 * This library is free software; you can redistribute it and/or
16 * modify it under the terms of the GNU Library General Public
17 * License as published by the Free Software Foundation; either
18 * version 2 of the License, or(at your option) any later version.
20 * This library is distributed in the hope that it will be useful,
21 * but WITHOUT ANY WARRANTY; without even the implied warranty of
22 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
23 * Library General Public License for more details.
25 * You should have received a copy of the GNU Library General Public
26 * License along with this library; if not, write to the Free
27 * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
30 // This is for including the config header before any code (such as
31 // the #ifndef GTKMM_DISABLE_DEPRECATED in deprecated classes) is generated:
34 #include <glibmm/listhandle.h>
35 #include <gtkmm/container.h>
36 #include <gtkmm/adjustment.h>
37 #include <gdkmm/pixmap.h>
38 #include <gtkmm/treeviewcolumn.h>
39 #include <gtkmm/treeselection.h>
40 #include <gtkmm/treemodelcolumn.h>
41 #include <gtkmm/cellrenderer.h>
42 #include <gtkmm/targetentry.h>
43 #include <gtkmm/entry.h>
44 #include <gtkmm/tooltip.h>
47 #ifndef DOXYGEN_SHOULD_SKIP_THIS
48 typedef struct _GtkTreeView GtkTreeView;
49 typedef struct _GtkTreeViewClass GtkTreeViewClass;
50 #endif /* DOXYGEN_SHOULD_SKIP_THIS */
54 { class TreeView_Class; } // namespace Gtk
59 /** @addtogroup gtkmmEnums Enums and Flags */
64 enum TreeViewDropPosition
66 TREE_VIEW_DROP_BEFORE,
68 TREE_VIEW_DROP_INTO_OR_BEFORE,
69 TREE_VIEW_DROP_INTO_OR_AFTER
75 #ifndef DOXYGEN_SHOULD_SKIP_THIS
80 class Value<Gtk::TreeViewDropPosition> : public Glib::Value_Enum<Gtk::TreeViewDropPosition>
83 static GType value_type() G_GNUC_CONST;
87 #endif /* DOXYGEN_SHOULD_SKIP_THIS */
96 enum TreeViewGridLines
98 TREE_VIEW_GRID_LINES_NONE,
99 TREE_VIEW_GRID_LINES_HORIZONTAL,
100 TREE_VIEW_GRID_LINES_VERTICAL,
101 TREE_VIEW_GRID_LINES_BOTH
107 #ifndef DOXYGEN_SHOULD_SKIP_THIS
112 class Value<Gtk::TreeViewGridLines> : public Glib::Value_Enum<Gtk::TreeViewGridLines>
115 static GType value_type() G_GNUC_CONST;
119 #endif /* DOXYGEN_SHOULD_SKIP_THIS */
126 #ifndef DOXYGEN_SHOULD_SKIP_THIS
130 namespace TreeView_Private
132 /* This helper function is not a member of TreeView just for the reason that
133 * there are compilers that have problems compiling it otherwise. E.g. in gcc
134 * 2.95.3 a compiler bug prevents member functions from refering to specialized
135 * member function templates and that's what we do here: In function
136 * _connect_auto_store_editable_signal_handler we build a slot from
137 * TreeView::_auto_store_on_cellrenderer_*_edited. (The latter must be member
138 * functions of TreeView since we connect them to signals and we want the
139 * connections to vanish when the TreeView dies, of course.)
141 template <class ColumnType> inline
142 void _connect_auto_store_editable_signal_handler(Gtk::TreeView* this_p, Gtk::CellRenderer* pCellRenderer, const Gtk::TreeModelColumn<ColumnType>& model_column);
144 template<class ColumnType> inline
145 void _auto_store_on_cellrenderer_text_edited_string(const Glib::ustring& path_string, const Glib::ustring& new_text, int model_column, const Glib::RefPtr<Gtk::TreeModel>& model);
147 template <class ColumnType> inline
148 void _auto_store_on_cellrenderer_text_edited_numerical(const Glib::ustring& path_string, const Glib::ustring& new_text, int model_column, const Glib::RefPtr<Gtk::TreeModel>& model);
150 template <class ColumnType> inline
151 void _auto_cell_data_func(Gtk::CellRenderer* cell, const Gtk::TreeModel::iterator& iter, int model_column, const Glib::ustring& format);
154 #endif //DOXYGEN_SHOULD_SKIP_THIS
157 //class TreeViewColumn;
160 /** @defgroup TreeView TreeView Classes
161 * These classes are used with the Gtk::TreeView widget.
164 /** The TreeView widget displays the model (Gtk::TreeModel) data and allows the user to interact with it.
165 * The View can show all of the model's columns, or just some, and it can show them in various ways.
166 * You must provide the TreeModel in the constructor, or with set_model().
168 * Add View columns with append_column(), append_column_editable(), insert_column(), or insert_column_editable().
170 * You can manipulate the selection by obtaining the @link Gtk::TreeSelection Gtk::TreeView::Selection@endlink from get_selection().
173 * @ingroup Containers
177 class TreeView : public Container
180 #ifndef DOXYGEN_SHOULD_SKIP_THIS
181 typedef TreeView CppObjectType;
182 typedef TreeView_Class CppClassType;
183 typedef GtkTreeView BaseObjectType;
184 typedef GtkTreeViewClass BaseClassType;
185 #endif /* DOXYGEN_SHOULD_SKIP_THIS */
189 #ifndef DOXYGEN_SHOULD_SKIP_THIS
192 friend class TreeView_Class;
193 static CppClassType treeview_class_;
196 TreeView(const TreeView&);
197 TreeView& operator=(const TreeView&);
200 explicit TreeView(const Glib::ConstructParams& construct_params);
201 explicit TreeView(GtkTreeView* castitem);
203 #endif /* DOXYGEN_SHOULD_SKIP_THIS */
206 #ifndef DOXYGEN_SHOULD_SKIP_THIS
207 static GType get_type() G_GNUC_CONST;
208 static GType get_base_type() G_GNUC_CONST;
211 ///Provides access to the underlying C GtkObject.
212 GtkTreeView* gobj() { return reinterpret_cast<GtkTreeView*>(gobject_); }
214 ///Provides access to the underlying C GtkObject.
215 const GtkTreeView* gobj() const { return reinterpret_cast<GtkTreeView*>(gobject_); }
219 //C++ methods used to invoke GTK+ virtual functions:
220 #ifdef GLIBMM_VFUNCS_ENABLED
221 #endif //GLIBMM_VFUNCS_ENABLED
224 //GTK+ Virtual Functions (override these to change behaviour):
225 #ifdef GLIBMM_VFUNCS_ENABLED
226 #endif //GLIBMM_VFUNCS_ENABLED
228 //Default Signal Handlers::
229 #ifdef GLIBMM_DEFAULT_SIGNAL_HANDLERS_ENABLED
230 virtual void on_set_scroll_adjustments(Adjustment* hadjustment, Adjustment* vadjustment);
231 virtual void on_row_activated(const TreeModel::Path& path, TreeViewColumn* column);
232 virtual bool on_test_expand_row(const TreeModel::iterator& iter, const TreeModel::Path& path);
233 virtual bool on_test_collapse_row(const TreeModel::iterator& iter, const TreeModel::Path& path);
234 virtual void on_row_expanded(const TreeModel::iterator& iter, const TreeModel::Path& path);
235 virtual void on_row_collapsed(const TreeModel::iterator& iter, const TreeModel::Path& path);
236 virtual void on_cursor_changed();
237 virtual void on_columns_changed();
238 #endif //GLIBMM_DEFAULT_SIGNAL_HANDLERS_ENABLED
245 /** A visible column in a Gtk::TreeView widget.
247 typedef TreeViewColumn Column;
249 /** A selection object for Gtk::TreeView.
251 typedef TreeSelection Selection;
257 Constructor that binds to a TreeModel
259 explicit TreeView(const Glib::RefPtr<TreeModel>& model);
262 /** Return value: A Gtk::TreeModel, or <tt>0</tt> if none is currently being used.
263 * @return A Gtk::TreeModel, or <tt>0</tt> if none is currently being used.
265 Glib::RefPtr<TreeModel> get_model();
267 /** Return value: A Gtk::TreeModel, or <tt>0</tt> if none is currently being used.
268 * @return A Gtk::TreeModel, or <tt>0</tt> if none is currently being used.
270 Glib::RefPtr<const TreeModel> get_model() const;
272 /** Sets the model for a Gtk::TreeView. If the @a tree_view already has a model
273 * set, it will remove it before setting the new model. If @a model is <tt>0</tt>,
274 * then it will unset the old model.
275 * @param model The model.
277 void set_model(const Glib::RefPtr<TreeModel>& model);
279 /** Remove the model from the TreeView.
284 /** Gets the Gtk::TreeSelection associated with @a tree_view .
285 * @return A Gtk::TreeSelection object.
287 Glib::RefPtr<TreeSelection> get_selection();
289 /** Gets the Gtk::TreeSelection associated with @a tree_view .
290 * @return A Gtk::TreeSelection object.
292 Glib::RefPtr<const TreeSelection> get_selection() const;
294 /** Gets the Gtk::Adjustment currently being used for the horizontal aspect.
295 * @return A Gtk::Adjustment object, or <tt>0</tt> if none is currently being
298 Adjustment* get_hadjustment();
300 /** Gets the Gtk::Adjustment currently being used for the horizontal aspect.
301 * @return A Gtk::Adjustment object, or <tt>0</tt> if none is currently being
304 const Adjustment* get_hadjustment() const;
306 /** Sets the Gtk::Adjustment for the current horizontal aspect. See also unset_hadjustment().
307 * @param adjustment The Gtk::Adjustment to set.
309 void set_hadjustment(Adjustment& adjustment);
311 /** This method removes the hadjustment.
312 * @see set_hadjustment().
314 void unset_hadjustment();
317 /** Gets the Gtk::Adjustment currently being used for the vertical aspect.
318 * @return A Gtk::Adjustment object, or <tt>0</tt> if none is currently being
321 Adjustment* get_vadjustment();
323 /** Gets the Gtk::Adjustment currently being used for the vertical aspect.
324 * @return A Gtk::Adjustment object, or <tt>0</tt> if none is currently being
327 const Adjustment* get_vadjustment() const;
329 /** Sets the Gtk::Adjustment for the current vertical aspect. See also unset_vadjustment().
330 * @param adjustment The Gtk::Adjustment to set.
332 void set_vadjustment(Adjustment& adjustment);
334 /** This method removes the vadjustment.
335 * @see set_vadjustment().
337 void unset_vadjustment();
340 /** Return value: Whether the headers are visible or not.
341 * @return Whether the headers are visible or not.
343 bool get_headers_visible() const;
345 /** Sets the visibility state of the headers.
346 * @param headers_visible <tt>true</tt> if the headers are visible.
348 void set_headers_visible(bool headers_visible);
350 /** Resizes all columns to their optimal width. Only works after the
351 * treeview has been realized.
353 void columns_autosize();
355 /** Return value: <tt>true</tt> if all header columns are clickable, otherwise <tt>false</tt>
356 * @return <tt>true</tt> if all header columns are clickable, otherwise <tt>false</tt>
360 bool get_headers_clickable() const;
362 /** Allow the column title buttons to be clicked.
363 * @param setting <tt>true</tt> if the columns are clickable.
365 void set_headers_clickable(bool setting = true);
367 /** This function tells GTK+ that the user interface for your
368 * application requires users to read across tree rows and associate
369 * cells with one another. By default, GTK+ will then render the tree
370 * with alternating row colors. Do <em>not</em> use it
371 * just because you prefer the appearance of the ruled tree; that's a
372 * question for the theme. Some themes will draw tree rows in
373 * alternating colors even when rules are turned off, and users who
374 * prefer that appearance all the time can choose those themes. You
375 * should call this function only as a <em>semantic</em>
376 * hint to the theme engine that your tree makes alternating colors
377 * useful from a functional standpoint (since it has lots of columns,
379 * @param setting <tt>true</tt> if the tree requires reading across rows.
381 void set_rules_hint(bool setting = true);
383 /** Gets the setting set by set_rules_hint().
384 * @return <tt>true</tt> if rules are useful for the user of this tree.
386 bool get_rules_hint() const;
389 /** Appends @a column to the list of columns. If @a tree_view has "fixed_height"
390 * mode enabled, then @a column must have its "sizing" property set to be
391 * GTK_TREE_VIEW_COLUMN_FIXED.
392 * @param column The Gtk::TreeViewColumn to add.
393 * @return The number of columns in @a tree_view after appending.
395 int append_column(TreeViewColumn& column);
397 /** Appends a View column with the appropriate CellRenderer for the Model column.
399 * The CellRenderer can only be created automatically for some basic
400 * column types, such as Glib::ustring, int, double, bool, and Gdk::Pixbuf.
401 * If the type is not supported then the following warning will be shown:
402 * GLib-GObject-WARNING **: unable to set property `text' of type
403 * `gchararray' from value of type `glibmm__CustomBoxed_t'.
405 * If the default formatting is not sufficient, or the numeric type is
406 * not supported, then you could use append_column_numeric(). Or you
407 * could create the TreeView::Column and/or CellRenderer
408 * manually and use TreeViewColumn::set_cell_data_func() to provide a callback
409 * that converts the model value into a string representation with .
411 * @param title The text to be used in the title header of this column.
412 * @param model_column The column in the TreeModel that will be rendered by this View column.
413 * @result The number of columns in the View after appending.
415 template <class ColumnType> inline
416 int append_column(const Glib::ustring& title, const TreeModelColumn<ColumnType>& model_column);
418 /** Like append_column(), but only for numeric types, which will be displayed in the specified format.
419 * This convenience template uses TreeView::Column::set_cell_data_func(), so the numeric formatting will
420 * be deactivated if you specify your own cell_data callback by calling set_cell_data_func() again.
422 * @param title The text to be used in the title header of this column.
423 * @param model_column The column in the TreeModel that will be rendered by this View column.
424 * @param format A printf-style format, such as "%d", used to create a text representation of the number.
425 * @result The number of columns in the View after appending.
427 template <class ColumnType> inline
428 int append_column_numeric(const Glib::ustring& title, const TreeModelColumn<ColumnType>& model_column, const Glib::ustring& format);
430 //TODO: danielk suggested use of Glib::Value to simplify/improve this.
431 /** Appends a View column with the appropriate CellRenderer for the Model
432 * column. The compiler will attempt to instantiate appropriate template
433 * code to automatically store user changes in the model. To intercept the
434 * user's change and implement non-default logic, or if the compiler can't
435 * instantiate appropriate code for your model type, you could use
436 * append_column() and connect a signal handler to the CellRenderer.
438 * @see append_column_numeric_editable().
440 * @param title The text to be used in the title header of this column.
441 * @param model_column The column in the TreeModel that will be rendered by this View column.
442 * @result The number of columns in the View after appending.
444 template <class ColumnType> inline
445 int append_column_editable(const Glib::ustring& title, const TreeModelColumn<ColumnType>& model_column);
447 /** Like append_column_editable(), but only for numeric types, which will be displayed in the specified format.
448 * This convenience template uses TreeView::Column::set_cell_data_func(), so the numeric formatting will
449 * be deactivated if you specify your own cell_data callback by calling set_cell_data_func() again.
451 * Note that the user's input will be interpreted as decimal (base 10), regardless of the @a format.
453 * @param title The text to be used in the title header of this column.
454 * @param model_column The column in the TreeModel that will be rendered by this View column.
455 * @param format A printf-style format, such as "%d", used to create a text representation of the number.
456 * @result The number of columns in the View after appending.
458 template <class ColumnType> inline
459 int append_column_numeric_editable(const Glib::ustring& title, const TreeModelColumn<ColumnType>& model_column, const Glib::ustring& format);
462 /// Creates a View column containing the CellRenderer, and appends it.
463 int append_column(const Glib::ustring& title, CellRenderer& cell);
466 /** Removes @a column from @a tree_view .
467 * @param column The Gtk::TreeViewColumn to remove.
468 * @return The number of columns in @a tree_view after removing.
470 int remove_column(TreeViewColumn& column);
472 /// Removes all View columns.
473 void remove_all_columns();
476 /** This inserts the @a column into the @a tree_view at @a position . If @a position is
477 * -1, then the column is inserted at the end. If @a tree_view has
478 * "fixed_height" mode enabled, then @a column must have its "sizing" property
479 * set to be GTK_TREE_VIEW_COLUMN_FIXED.
480 * @param column The Gtk::TreeViewColumn to be inserted.
481 * @param position The position to insert @a column in.
482 * @return The number of columns in @a tree_view after insertion.
484 int insert_column(TreeViewColumn& column, int position);
486 /** Creates a View column containing the CellRenderer, and inserts it.
488 * @param title The text to be used in the title header of this column.
489 * @param cell The CellRenderer.
490 * @param position The position at which the CellRenderer should be inserted.
491 * @result The number of columns in the View after inserting.
493 int insert_column(const Glib::ustring& title, CellRenderer& cell, int position);
496 /** Inserts a View column with the appropriate CellRenderer for the Model column.
498 * @param title The text to be used in the title header of this column.
499 * @param model_column The column in the TreeModel that will be rendered by this View column.
500 * @param position The position at which the CellRenderer should be inserted.
501 * @result The number of columns in the View after inserting.
503 template <class ColumnType> inline
504 int insert_column(const Glib::ustring& title, const TreeModelColumn<ColumnType>& model_column, int position);
506 /** Inserts a View column with the appropriate CellRenderer for the Model
507 * column. The compiler will attempt to instantiate appropriate template
508 * code to automatically store user changes in the model. To intercept the
509 * user's change and implement non-default logic, or if the compiler can't
510 * instantiate appropriate code for your model type, you should use
511 * append_column() and connect a signal handler to the CellRenderer.
513 * @param title The text to be used in the title header of this column.
514 * @param model_column The column in the TreeModel that will be rendered by this View column.
515 * @param position The position at which the CellRenderer should be inserted.
516 * @result The number of columns in the View after inserting.
518 template <class ColumnType> inline
519 int insert_column_editable(const Glib::ustring& title, const TreeModelColumn<ColumnType>& model_column, int position);
521 typedef TreeViewColumn::SlotCellData SlotCellData;
524 * Inserts a new column into the TreeView with the given cell
525 * renderer and a SlotCellData to set cell renderer attributes
526 * (normally using data from the model).
528 * @param position Position to insert, -1 for append
529 * @param title column title
530 * @param cell cell renderer for column
531 * @param slot function to set attributes of cell renderer
532 * @return number of columns in the TreeView after the insert
534 int insert_column_with_data_func(int position, const Glib::ustring& title, CellRenderer& cell, const SlotCellData& slot);
537 /** Gets the Gtk::TreeViewColumn at the given position in the #tree_view.
538 * @param n The position of the column, counting from 0.
539 * @return The Gtk::TreeViewColumn, or <tt>0</tt> if the position is outside the
542 TreeViewColumn* get_column(int n);
544 /** Gets the Gtk::TreeViewColumn at the given position in the #tree_view.
545 * @param n The position of the column, counting from 0.
546 * @return The Gtk::TreeViewColumn, or <tt>0</tt> if the position is outside the
549 const TreeViewColumn* get_column(int n) const;
551 //The column index is of the view, not the model, so we do not need TreeViewColumn* get_column(TreeViewColumn& base_column).
553 /** Gets the CellRenderer for that column.
554 * You should dynamic_cast<> to the expected derived CellRenderer type.
555 * This assumes that the TreeViewColumn contains only one CellRenderer.
557 * @param n The position of the view column.
558 * @result The CellRenderer.
560 CellRenderer* get_column_cell_renderer(int n);
562 //TODO: Add TreeViewColumn* get_column_cell_renderer(TreeViewColumn& base_column); and a const one.
565 /** Gets the CellRenderer for that column.
566 * You should dynamic_cast<> to the expected derived CellRenderer type.
567 * This assumes that the TreeViewColumn contains only one CellRenderer.
569 * @param n The position of the view column.
570 * @result The CellRenderer.
572 const CellRenderer* get_column_cell_renderer(int n) const;
575 /** Returns a list of all the Gtk::TreeViewColumn s currently in @a tree_view .
576 * @return A list of Gtk::TreeViewColumn s.
578 Glib::ListHandle<TreeViewColumn*> get_columns();
580 /** Returns a list of all the Gtk::TreeViewColumn s currently in @a tree_view .
581 * @return A list of Gtk::TreeViewColumn s.
583 Glib::ListHandle<const TreeViewColumn*> get_columns() const;
586 /** Moves @a column to be after to @a base_column . See also move_column_to_start().
587 * @param column The Gtk::TreeViewColumn to be moved.
588 * @param base_column The Gtk::TreeViewColumn to be moved relative to.
590 void move_column_after(TreeViewColumn& column, TreeViewColumn& base_column);
592 /** This method moves column to the first position in the view.
594 * @param column The view column that will be moved
596 void move_column_to_start(TreeViewColumn& column);
599 /** Sets the column to draw the expander arrow at. It must be in the TreeView. See also reset_expander_column().
600 * @param column The column to draw the expander arrow at.
602 void set_expander_column(TreeViewColumn& column);
604 /** This method resets the expander arrow to the default - the first visible column.
605 * @see set_expander_column().
607 void reset_expander_column();
610 /** Return value: The expander column.
611 * @return The expander column.
613 TreeViewColumn* get_expander_column();
615 /** Return value: The expander column.
616 * @return The expander column.
618 const TreeViewColumn* get_expander_column() const;
621 * bool on_column_drop(TreeView*, tree_view, TreeViewColumn* column, TreeViewColumn* prev_column, TreeViewColumn* next_column)
623 * This function is called on every column pair in turn at the beginning of a column drag to determine where a
624 * drop can take place. The arguments passed to the function are: the tree_view, the view Column being dragged,
625 * and the two view Columns determining the drop spot. If either of the view Column arguments for the drop spot
626 * are 0, then they indicate an edge.
628 typedef sigc::slot<bool, TreeView*, TreeViewColumn*, TreeViewColumn*, TreeViewColumn*> SlotColumnDrop;
630 /** Sets a callback slot for determining where a column may be dropped when dragged.
631 * This function is called on every column pair in turn at the beginning of a column drag to determine where a
632 * drop can take place. The arguments passed to the function are: the tree_view, the view Column being dragged,
633 * and the two view Columns determining the drop spot. If either of the view Column arguments for the drop spot
634 * are 0, then they indicate an edge.
636 * See unset_column_drag_function().
638 * @param slot A callback function to determine which columns are reorderable.
640 void set_column_drag_function(const SlotColumnDrop& slot);
643 /** See set_column_drag_function(). After this method has been called, the TreeView reverts to the default behavior of
644 * allowing all columns to be dropped everywhere.
646 void unset_column_drag_function();
649 /** Scrolls the tree view such that the top-left corner of the visible
650 * area is @a tree_x , @a tree_y , where @a tree_x and @a tree_y are specified
651 * in tree coordinates. The @a tree_view must be realized before
652 * this function is called. If it isn't, you probably want to be
653 * using scroll_to_cell().
655 * If either @a tree_x or @a tree_y are -1, then that direction isn't scrolled.
656 * @param tree_x X coordinate of new top-left pixel of visible area, or -1.
657 * @param tree_y Y coordinate of new top-left pixel of visible area, or -1.
659 void scroll_to_point(int tree_x, int tree_y);
661 /** Moves the alignments of tree view to the position specified by @a column and @a path.
662 * @a row_align determines where the row is placed, and @a col_align determines where
663 * column is placed. Both are expected to be between 0.0 and 1.0. 0.0 means left/top
664 * alignment, 1.0 means right/bottom alignment, 0.5 means center.
666 * This function only works if the model is set, and @a path is a valid row on the model.
667 * If the model changes before the tree view is realized, the centered path will be
668 * modified to reflect this change.
670 * @param path The path of the row to move to.
671 * @param column The Gtk::TreeViewColumn to move horizontally to.
672 * @param row_align The vertical alignment of the row specified by @a path.
673 * @param col_align The horizontal alignment of the column specified by @a column.
675 void scroll_to_cell(const TreeModel::Path& path, TreeViewColumn& column, float row_align, float col_align);
678 /** Moves the alignments of tree view to the position specified by @a column and @a path.
679 * The tree does the minimum amount of work to scroll the cell onto the screen. This means
680 * that the cell will be scrolled to the edge closest to it's current position. If the cell
681 * is currently visible on the screen, nothing is done.
683 * This function only works if the model is set, and @a path is a valid row on the model.
684 * If the model changes before the tree_view is realized, the centered path will be modified
685 * to reflect this change.
687 * @param path The path of the row to move to.
688 * @param column The Gtk::TreeViewColumn to move horizontally to.
690 void scroll_to_cell(const TreeModel::Path& path, TreeViewColumn& column);
692 /** Moves the alignments of tree view to the position specified by @a path.
693 * @a row_align determines where the row is placed, and is expected to be between 0.0
694 * and 1.0. 0.0 means top alignment, 1.0 means bottom alignment, 0.5 means center.
696 * This function only works if the model is set, and @a path is a valid row on the model.
697 * If the model changes before the tree view is realized, the centered path will be
698 * modified to reflect this change.
700 * @param path The path of the row to move to.
701 * @param row_align The vertical alignment of the row specified by @a path.
703 void scroll_to_row(const TreeModel::Path& path, float row_align);
705 /** Moves the alignments of tree view to the position specified by @a path.
706 * The tree does the minimum amount of work to scroll the row onto the screen. This means
707 * that the row will be scrolled to the edge closest to it's current position. If the row
708 * is currently visible on the screen, nothing is done.
710 * This function only works if the model is set, and @a path is a valid row on the model.
711 * If the model changes before the tree view is realized, the centered path will be
712 * modified to reflect this change.
714 * @param path The path of the row to move to.
716 void scroll_to_row(const TreeModel::Path& path);
718 /** Moves the alignments of tree view to the position specified by @a column.
719 * @a col_align determines where the column is placed, and is expected to be between 0.0
720 * and 1.0. 0.0 means left alignment, 1.0 means right alignment, 0.5 means center.
722 * This function only works if the model is set. If the model changes before the tree
723 * view is realized, the centered path will be modified to reflect this change.
725 * @param column The Gtk::TreeViewColumn to move horizontally to.
726 * @param col_align The horizontal alignment of the column specified by @a column.
728 void scroll_to_column(TreeViewColumn& column, float col_align);
730 /** Moves the alignments of tree view to the position specified by @a column.
731 * The tree does the minimum amount of work to scroll the column onto the screen. This means
732 * that the column will be scrolled to the edge closest to it's current position. If the column
733 * is currently visible on the screen, nothing is done.
735 * This function only works if the model is set. If the model changes before the
736 * tree view is realized, the centered path will be modified to reflect this change.
738 * @param column The Gtk::TreeViewColumn to move horizontally to.
740 void scroll_to_column(TreeViewColumn& column);
743 /** Activates the cell determined by @a path and @a column .
744 * @param path The Gtk::TreePath to be activated.
745 * @param column The Gtk::TreeViewColumn to be activated.
747 void row_activated(const TreeModel::Path& path,TreeViewColumn& column);
749 /** Recursively expands all nodes in the @a tree_view .
753 /** Recursively collapses all visible, expanded nodes in @a tree_view .
757 /** Expands the row at @a path . This will also expand all parent rows of
758 * @a path as necessary.
761 * @param path Path to a row.
763 void expand_to_path(const TreeModel::Path& path);
765 /** Opens the row so its children are visible.
766 * @param path Path to a row.
767 * @param open_all Whether to recursively expand, or just expand immediate children.
768 * @return <tt>true</tt> if the row existed and had children.
770 bool expand_row(const TreeModel::Path& path, bool open_all);
772 /** Collapses a row (hides its child rows, if they exist).
773 * @param path Path to a row in the @a tree_view .
774 * @return <tt>true</tt> if the row was collapsed.
776 bool collapse_row(const TreeModel::Path& path);
779 * void on_map_expanded_rows(TreeView* tree_view, const TreeModel::Path& path);
781 typedef sigc::slot<void, TreeView*, const TreeModel::Path&> SlotMapping;
783 /** Calls the callback slot on all expanded rows.
784 * @param slot A callback function to be called.
786 void map_expanded_rows(const SlotMapping& slot);
789 /** Return value: <tt>true</tt> if #path is expanded.
790 * @param path A Gtk::TreePath to test expansion state.
791 * @return <tt>true</tt> if #path is expanded.
793 bool row_expanded(const TreeModel::Path& path);
795 /** This function is a convenience function to allow you to reorder models that
796 * support the Gtk::DragSourceIface and the Gtk::DragDestIface. Both
797 * Gtk::TreeStore and Gtk::ListStore support these. If @a reorderable is <tt>true</tt>, then
798 * the user can reorder the model by dragging and dropping rows. The
799 * developer can listen to these changes by connecting to the model's
800 * row_inserted and row_deleted signals.
802 * This function does not give you any degree of control over the order -- any
803 * reordering is allowed. If more control is needed, you should probably
804 * handle drag and drop manually.
805 * @param reorderable <tt>true</tt>, if the tree can be reordered.
807 void set_reorderable(bool reorderable = true);
809 /** Retrieves whether the user can reorder the tree via drag-and-drop. See
811 * @return <tt>true</tt> if the tree can be reordered.
813 bool get_reorderable() const;
815 //TODO: Add set_cursor(path, ModelColumnBase&, start_editing)?
817 /** Sets the current keyboard focus to be at @a path , and selects it. This is
818 * useful when you want to focus the user's attention on a particular row. Focus is given to the column specified.
819 * Additionally, if @a start_editing is
820 * <tt>true</tt>, then editing should be started in the specified cell.
821 * This function is often followed by Gtk::Widget::grab_focus( @a tree_view )
822 * in order to give keyboard focus to the widget. Please note that editing
823 * can only happen when the widget is realized.
824 * @param path A Gtk::TreePath.
825 * @param focus_column A Gtk::TreeViewColumn.
826 * @param start_editing <tt>true</tt> if the specified cell should start being edited.
828 void set_cursor(const TreeModel::Path& path, TreeViewColumn& focus_column, bool start_editing = false);
831 /** Sets the current keyboard focus to be at @a path , and selects it. This is
832 * useful when you want to focus the user's attention on a particular row. If
833 * @a focus_column is not <tt>0</tt>, then focus is given to the column specified by
834 * it. If @a focus_column and @a focus_cell are not <tt>0</tt>, and @a focus_column
835 * contains 2 or more editable or activatable cells, then focus is given to
836 * the cell specified by @a focus_cell . Additionally, if @a focus_column is
837 * specified, and @a start_editing is <tt>true</tt>, then editing should be started in
838 * the specified cell. This function is often followed by
839 * @a gtk_widget_grab_focus ( @a tree_view ) in order to give keyboard focus to the
840 * widget. Please note that editing can only happen when the widget is
844 * @param path A Gtk::TreePath.
845 * @param focus_column A Gtk::TreeViewColumn, or <tt>0</tt>.
846 * @param focus_cell A Gtk::CellRenderer, or <tt>0</tt>.
847 * @param start_editing <tt>true</tt> if the specified cell should start being edited.
849 void set_cursor(const TreeModel::Path& path, TreeViewColumn& focus_column, CellRenderer& focus_cell, bool start_editing = false);
852 /** Sets the current keyboard focus to be at path , and selects it.
853 * This is useful when you want to focus the user's attention on a particular row.
854 * This function is often followed by Gtk::widget::grab_focus(tree_view)
855 * in order to give keyboard focus to the widget.
857 * @param path A reference to cursor path.
859 void set_cursor(const TreeModel::Path& path);
861 /** Fills in path and focus_column with the current path and focus column.
863 * @param path A reference to be filled with the current cursor path
864 * @param focus_column A reference to be filled with the current focus column
866 void get_cursor(TreeModel::Path& path, TreeViewColumn*& focus_column);
868 /* Layout information */
870 /** Return value: A Gdk::Window, or <tt>0</tt> when @a tree_view hasn't been realized yet
871 * @return A Gdk::Window, or <tt>0</tt> when @a tree_view hasn't been realized yet.
873 Glib::RefPtr<Gdk::Window> get_bin_window();
875 /** Return value: A Gdk::Window, or <tt>0</tt> when @a tree_view hasn't been realized yet
876 * @return A Gdk::Window, or <tt>0</tt> when @a tree_view hasn't been realized yet.
878 Glib::RefPtr<const Gdk::Window> get_bin_window() const;
880 #ifndef GTKMM_DISABLE_DEPRECATED
882 /** @deprecated Use the const version.
884 bool get_path_at_pos(int x, int y, TreeModel::Path& path, TreeViewColumn*& column, int& cell_x, int& cell_y);
885 #endif // GTKMM_DISABLE_DEPRECATED
888 /** Finds the path at the point (x, y), relative to widget
889 * coordinates. It is primarily for things like popup menus.
891 * @param x The x position to be identified
892 * @param y The y position to be identified
893 * @param path A reference to a TreeModel::Path to be filled in
894 * @param column A reference to a TreeViewColumn pointer to be filled in
895 * @param cell_x A reference where the X coordinate relative to the cell
897 * @param cell_y A reference where the Y coordinate relative to the cell
899 * @return true if a row exists at that coordinate.
901 bool get_path_at_pos(int x, int y, TreeModel::Path& path, TreeViewColumn*& column, int& cell_x, int& cell_y) const;
904 #ifndef GTKMM_DISABLE_DEPRECATED
906 /** Fills the bounding rectangle in tree window coordinates for the cell at the
907 * row specified by @a path and the column specified by @a column . If @a path points to a path not currently displayed, the @a y and @a height fields
908 * of the rectangle will be filled with 0. The sum of all cell rects does not cover the
909 * entire tree; there are extra pixels in between rows, for example. The
910 * returned rectangle is equivalent to the @a cell_area passed to
911 * Gtk::CellRenderer::render(). This function is only valid if #tree_view is
913 * @deprecated Use the const version
914 * @param path A Gtk::TreePath for the row.
915 * @param column A Gtk::TreeViewColumn for the column.
916 * @param rect Rectangle to fill with cell rect.
918 void get_cell_area(const TreeModel::Path& path, TreeViewColumn& column, Gdk::Rectangle& rect);
919 #endif // GTKMM_DISABLE_DEPRECATED
922 //We ignore the fact that one of the arguments can be 0 - it does not seem useful.
925 /** Fills the bounding rectangle in tree window coordinates for the cell at the
926 * row specified by @a path and the column specified by @a column . If @a path points to a path not currently displayed, the @a y and @a height fields
927 * of the rectangle will be filled with 0. The sum of all cell rects does not cover the
928 * entire tree; there are extra pixels in between rows, for example. The
929 * returned rectangle is equivalent to the @a cell_area passed to
930 * Gtk::CellRenderer::render(). This function is only valid if #tree_view is
932 * @param path A Gtk::TreePath for the row.
933 * @param column A Gtk::TreeViewColumn for the column.
934 * @param rect Rectangle to fill with cell rect.
936 void get_cell_area(const TreeModel::Path& path, TreeViewColumn& column, Gdk::Rectangle& rect) const;
939 #ifndef GTKMM_DISABLE_DEPRECATED
941 /** Fills the bounding rectangle in tree window coordinates for the cell at the
942 * row specified by @a path and the column specified by @a column . The returned rectangle is equivalent to the
943 * @a background_area passed to Gtk::CellRenderer::render(). These background
944 * areas tile to cover the entire tree window (except for the area used for
945 * header buttons). Contrast with the @a cell_area , returned by
946 * get_cell_area(), which returns only the cell itself, excluding
947 * surrounding borders and the tree expander area.
948 * @deprecated Use the const version.
949 * @param path A Gtk::TreePath for the row.
950 * @param column A Gtk::TreeViewColumn for the column.
951 * @param rect Rectangle to fill with cell background rect.
953 void get_background_area(const TreeModel::Path& path, TreeViewColumn& column, Gdk::Rectangle& rect);
954 #endif // GTKMM_DISABLE_DEPRECATED
957 /** Fills the bounding rectangle in tree window coordinates for the cell at the
958 * row specified by @a path and the column specified by @a column . The returned rectangle is equivalent to the
959 * @a background_area passed to Gtk::CellRenderer::render(). These background
960 * areas tile to cover the entire tree window (except for the area used for
961 * header buttons). Contrast with the @a cell_area , returned by
962 * get_cell_area(), which returns only the cell itself, excluding
963 * surrounding borders and the tree expander area.
964 * @param path A Gtk::TreePath for the row.
965 * @param column A Gtk::TreeViewColumn for the column.
966 * @param rect Rectangle to fill with cell background rect.
968 void get_background_area(const TreeModel::Path& path, TreeViewColumn& column, Gdk::Rectangle& rect) const;
969 //We ignore the fact that one of the arguments can be 0 - it does not seem useful.
972 #ifndef GTKMM_DISABLE_DEPRECATED
974 /** Fills @a visible_rect with the currently-visible region of the
975 * buffer, in tree coordinates. Convert to bin_window coordinates with
976 * convert_tree_to_bin_window_coords().
977 * Tree coordinates start at 0,0 for row 0 of the tree, and cover the entire
978 * scrollable area of the tree.
979 * @deprecated Use the const version.
980 * @param visible_rect Rectangle to fill.
982 void get_visible_rect(Gdk::Rectangle& visible_rect);
983 #endif // GTKMM_DISABLE_DEPRECATED
986 /** Fills @a visible_rect with the currently-visible region of the
987 * buffer, in tree coordinates. Convert to bin_window coordinates with
988 * convert_tree_to_bin_window_coords().
989 * Tree coordinates start at 0,0 for row 0 of the tree, and cover the entire
990 * scrollable area of the tree.
991 * @param visible_rect Rectangle to fill.
993 void get_visible_rect(Gdk::Rectangle& visible_rect) const;
996 #ifndef GTKMM_DISABLE_DEPRECATED
998 /** Converts bin_window coordinates to coordinates for the
999 * tree (the full scrollable area of the tree).
1001 * Deprecated: 2.12: Due to historial reasons the name of this function is
1002 * incorrect. For converting coordinates relative to the widget to
1003 * bin_window coordinates, please see
1004 * convert_widget_to_bin_window_coords().
1005 * @deprecated Use the const version
1006 * @param wx X coordinate relative to bin_window.
1007 * @param wy Y coordinate relative to bin_window.
1008 * @param tx Return location for tree X coordinate.
1009 * @param ty Return location for tree Y coordinate.
1011 void widget_to_tree_coords(int wx, int wy, int& tx, int& ty);
1012 #endif // GTKMM_DISABLE_DEPRECATED
1015 /** Converts bin_window coordinates to coordinates for the
1016 * tree (the full scrollable area of the tree).
1018 * Deprecated: 2.12: Due to historial reasons the name of this function is
1019 * incorrect. For converting coordinates relative to the widget to
1020 * bin_window coordinates, please see
1021 * convert_widget_to_bin_window_coords().
1022 * @param wx X coordinate relative to bin_window.
1023 * @param wy Y coordinate relative to bin_window.
1024 * @param tx Return location for tree X coordinate.
1025 * @param ty Return location for tree Y coordinate.
1027 void widget_to_tree_coords(int wx, int wy, int& tx, int& ty) const;
1030 #ifndef GTKMM_DISABLE_DEPRECATED
1032 /** Converts tree coordinates (coordinates in full scrollable area of the tree)
1033 * to bin_window coordinates.
1035 * Deprecated: 2.12: Due to historial reasons the name of this function is
1036 * incorrect. For converting bin_window coordinates to coordinates relative
1037 * to bin_window, please see
1038 * convert_bin_window_to_widget_coords().
1039 * @deprecated Use the const version.
1040 * @param tx Tree X coordinate.
1041 * @param ty Tree Y coordinate.
1042 * @param wx Return location for X coordinate relative to bin_window.
1043 * @param wy Return location for Y coordinate relative to bin_window.
1045 void tree_to_widget_coords(int tx, int ty, int& wx, int& wy);
1046 #endif // GTKMM_DISABLE_DEPRECATED
1049 /** Converts tree coordinates (coordinates in full scrollable area of the tree)
1050 * to bin_window coordinates.
1052 * Deprecated: 2.12: Due to historial reasons the name of this function is
1053 * incorrect. For converting bin_window coordinates to coordinates relative
1054 * to bin_window, please see
1055 * convert_bin_window_to_widget_coords().
1056 * @param tx Tree X coordinate.
1057 * @param ty Tree Y coordinate.
1058 * @param wx Return location for X coordinate relative to bin_window.
1059 * @param wy Return location for Y coordinate relative to bin_window.
1061 void tree_to_widget_coords(int tx, int ty, int& wx, int& wy) const;
1063 bool get_visible_range(TreeModel::Path& start_path, TreeModel::Path& end_path) const;
1066 /* Drag-and-Drop support */
1070 * Turns the TreeView into a drag source for automatic DND.
1072 * @param targets Standard container of targets that the drag will support.
1073 * @param start_button_mask Mask of allowed buttons to start drag.
1074 * @param actions The bitmask of possible actions for a drag from this widget.
1076 void enable_model_drag_source(const ArrayHandle_TargetEntry& targets,
1077 Gdk::ModifierType start_button_mask = Gdk::MODIFIER_MASK,
1078 Gdk::DragAction actions = Gdk::ACTION_COPY | Gdk::ACTION_MOVE);
1080 // Uses the default "GTK_TREE_MODEL_ROW" target, which the TreeView can handle automatically.
1082 /** Turns the TreeView into a drag source for automatic DND.
1084 * @param start_button_mask Mask of allowed buttons to start drag.
1085 * @param actions The bitmask of possible actions for a drag from this widget.
1087 void enable_model_drag_source(Gdk::ModifierType start_button_mask = Gdk::MODIFIER_MASK,
1088 Gdk::DragAction actions = Gdk::ACTION_COPY | Gdk::ACTION_MOVE);
1091 /** Turns the TreeView into a drop destination for automatic DND.
1093 * @param targets The table of targets that the drag will support.
1094 * @param actions The bitmask of possible actions for a drag from this widget.
1096 void enable_model_drag_dest(const ArrayHandle_TargetEntry& targets, Gdk::DragAction actions = Gdk::ACTION_COPY | Gdk::ACTION_MOVE);
1098 /** Turns the TreeView into a drop destination for automatic DND. This uses the default
1099 * "GTK_TREE_MODEL_ROW" target, which the TreeView can handle automatically.
1101 * @param actions The bitmask of possible actions for a drag from this widget.
1103 void enable_model_drag_dest(Gdk::DragAction actions = Gdk::ACTION_COPY | Gdk::ACTION_MOVE);
1105 /** Undoes the effect of enable_model_drag_source()
1108 /** Undoes the effect of enable_model_drag_source().
1110 void unset_rows_drag_source();
1112 /** Undoes the effect of enable_model_drag_source()
1115 /** Undoes the effect of enable_model_drag_dest().
1117 void unset_rows_drag_dest();
1120 /* These are useful to implement your own custom stuff. */
1122 /** Sets the row that is highlighted for feedback.
1124 * @param path The path of the row to highlight
1125 * @param pos Specifies whether to drop before, after or into the row
1128 /** Sets the row that is highlighted for feedback.
1129 * @param path The path of the row to highlight, or <tt>0</tt>.
1130 * @param pos Specifies whether to drop before, after or into the row.
1132 void set_drag_dest_row(const TreeModel::Path& path, TreeViewDropPosition pos);
1134 /** Gets information about the row that is highlighted for feedback.
1136 * @param path Return location for the path of the highlighted row
1137 * @param pos Return location for the drop position
1139 void get_drag_dest_row(TreeModel::Path& path, TreeViewDropPosition& pos) const;
1141 /** Determines the destination row for a given position.
1143 * @param drag_x The x position to determine the destination row for
1144 * @param drag_y The y position to determine the destination row for
1145 * @param path Return location for the path of the highlighted row
1146 * @param pos Return location for the drop position
1148 bool get_dest_row_at_pos(int drag_x, int drag_y, TreeModel::Path& path, TreeViewDropPosition& pos) const;
1151 /** Creates a Gdk::Pixmap representation of the row at @a path .
1152 * This image is used for a drag icon.
1153 * @param path A Gtk::TreePath in @a tree_view .
1154 * @return A newly-allocated pixmap of the drag icon.
1156 Glib::RefPtr<Gdk::Pixmap> create_row_drag_icon(const TreeModel::Path& path);
1158 /* Interactive search */
1160 /** If @a enable_search is set, then the user can type in text to search through
1161 * the tree interactively (this is sometimes called "typeahead find").
1163 * Note that even if this is <tt>false</tt>, the user can still initiate a search
1164 * using the "start-interactive-search" key binding.
1165 * @param enable_search <tt>true</tt>, if the user can search interactively.
1167 void set_enable_search(bool enable_search = true);
1169 /** Return value: whether or not to let the user search interactively
1170 * @return Whether or not to let the user search interactively.
1172 bool get_enable_search() const;
1174 /** Gets the column searched on by the interactive search code.
1175 * @return The column the interactive search code searches in.
1177 int get_search_column() const;
1179 /** Sets @a column as the column where the interactive search code should
1182 * If the sort column is set, users can use the "start-interactive-search"
1183 * key binding to bring up search popup. The enable-search property controls
1184 * whether simply typing text will also start an interactive search.
1186 * Note that @a column refers to a column of the model.
1187 * @param column The column of the model to search in, or -1 to disable searching.
1189 void set_search_column(const TreeModelColumnBase& column);
1191 /** Sets @a column as the column where the interactive search code should
1194 * If the sort column is set, users can use the "start-interactive-search"
1195 * key binding to bring up search popup. The enable-search property controls
1196 * whether simply typing text will also start an interactive search.
1198 * Note that @a column refers to a column of the model.
1199 * @param column The column of the model to search in, or -1 to disable searching.
1201 void set_search_column(int column);
1203 ///void on_search_equal(const Glib::RefPtr<TreeModel>& model, int column, const Glib::ustring& key, const TreeModel::iterator& iter)
1204 typedef sigc::slot<bool, const Glib::RefPtr<TreeModel>&, int, const Glib::ustring&, const TreeModel::iterator&> SlotSearchEqual;
1205 //SlotSearchEqual get_search_equal_func();
1208 /** Sets the compare function for the interactive search capabilities.
1210 * @param slot The compare function to use during the search
1212 void set_search_equal_func(const SlotSearchEqual& slot);
1215 /** Return value: the entry currently in use as search entry.
1216 * @return The entry currently in use as search entry.
1220 Entry* get_search_entry();
1222 /** Return value: the entry currently in use as search entry.
1223 * @return The entry currently in use as search entry.
1227 const Entry* get_search_entry() const;
1229 /** Sets the entry which the interactive search code will use for this
1230 * @a tree_view . This is useful when you want to provide a search entry
1231 * in our interface at all time at a fixed position. Passing <tt>0</tt> for
1232 * @a entry will make the interactive search code use the built-in popup
1236 * @param entry The entry the interactive search code of @a tree_view should use or <tt>0</tt>.
1238 void set_search_entry(Entry& entry);
1240 ///void on_search_position(Gtk::Widget* search_dialog)
1241 typedef sigc::slot<void, Gtk::Widget* /* search_dialog */> SlotSearchPosition;
1242 void set_search_position_func(const SlotSearchPosition& slot);
1245 /** Converts widget coordinates to coordinates for the
1246 * tree (the full scrollable area of the tree).
1249 * @param wx X coordinate relative to the widget.
1250 * @param wy Y coordinate relative to the widget.
1251 * @param tx Return location for tree X coordinate.
1252 * @param ty Return location for tree Y coordinate.
1254 void convert_widget_to_tree_coords(int wx, int wy, int& tx, int& ty) const;
1256 /** Converts tree coordinates (coordinates in full scrollable area of the tree)
1257 * to widget coordinates.
1260 * @param tx X coordinate relative to the tree.
1261 * @param ty Y coordinate relative to the tree.
1262 * @param wx Return location for widget X coordinate.
1263 * @param wy Return location for widget Y coordinate.
1265 void convert_tree_to_widget_coords(int tx, int ty, int& wx, int& wy) const;
1267 /** Converts widget coordinates to coordinates for the bin_window
1268 * (see get_bin_window()).
1271 * @param wx X coordinate relative to the widget.
1272 * @param wy Y coordinate relative to the widget.
1273 * @param bx Return location for bin_window X coordinate.
1274 * @param by Return location for bin_window Y coordinate.
1276 void convert_widget_to_bin_window_coords(int wx, int wy, int& bx, int& by) const;
1278 /** Converts bin_window coordinates (see get_bin_window())
1279 * to widget relative coordinates.
1282 * @param bx Bin_window X coordinate.
1283 * @param by Bin_window Y coordinate.
1284 * @param wx Return location for widget X coordinate.
1285 * @param wy Return location for widget Y coordinate.
1287 void convert_bin_window_to_widget_coords(int bx, int by, int& wx, int& wy) const;
1289 /** Converts tree coordinates (coordinates in full scrollable area of the tree)
1290 * to bin_window coordinates.
1293 * @param tx Tree X coordinate.
1294 * @param ty Tree Y coordinate.
1295 * @param bx Return location for X coordinate relative to bin_window.
1296 * @param by Return location for Y coordinate relative to bin_window.
1298 void convert_tree_to_bin_window_coords(int tx, int ty, int& bx, int& by) const;
1300 /** Converts bin_window coordinates to coordinates for the
1301 * tree (the full scrollable area of the tree).
1304 * @param bx X coordinate relative to bin_window.
1305 * @param by Y coordinate relative to bin_window.
1306 * @param tx Return location for tree X coordinate.
1307 * @param ty Return location for tree Y coordinate.
1309 void convert_bin_window_to_tree_coords(int bx, int by, int& tx, int& ty) const;
1312 /** Enables or disables the fixed height mode of @a tree_view .
1313 * Fixed height mode speeds up Gtk::TreeView by assuming that all
1314 * rows have the same height.
1315 * Only enable this option if all rows are the same height and all
1316 * columns are of type Gtk::TREE_VIEW_COLUMN_FIXED.
1319 * @param enable <tt>true</tt> to enable fixed height mode.
1321 void set_fixed_height_mode(bool enable = true);
1323 /** Return value: <tt>true</tt> if @a tree_view is in fixed height mode
1324 * @return <tt>true</tt> if @a tree_view is in fixed height mode
1328 bool get_fixed_height_mode() const;
1330 /** Enables of disables the hover selection mode of @a tree_view .
1331 * Hover selection makes the selected row follow the pointer.
1332 * Currently, this works only for the selection modes
1333 * Gtk::SELECTION_SINGLE and Gtk::SELECTION_BROWSE.
1336 * @param hover <tt>true</tt> to enable hover selection mode.
1338 void set_hover_selection(bool hover = true);
1340 /** Return value: <tt>true</tt> if @a tree_view is in hover selection mode
1341 * @return <tt>true</tt> if @a tree_view is in hover selection mode
1345 bool get_hover_selection() const;
1347 /** Enables of disables the hover expansion mode of @a tree_view .
1348 * Hover expansion makes rows expand or collaps if the pointer
1352 * @param expand <tt>true</tt> to enable hover selection mode.
1354 void set_hover_expand(bool expand = true);
1356 /** Return value: <tt>true</tt> if @a tree_view is in hover expansion mode
1357 * @return <tt>true</tt> if @a tree_view is in hover expansion mode
1361 bool get_hover_expand() const;
1363 /** Enables or disables rubber banding in @a tree_view . If the selection mode
1364 * is Gtk::SELECTION_MULTIPLE, rubber banding will allow the user to select
1365 * multiple rows by dragging the mouse.
1368 * @param enable <tt>true</tt> to enable rubber banding.
1370 void set_rubber_banding(bool enable = true);
1372 /** Return value: <tt>true</tt> if rubber banding in @a tree_view is enabled.
1373 * @return <tt>true</tt> if rubber banding in @a tree_view is enabled.
1377 bool get_rubber_banding() const;
1379 //TODO: Rename to get_is?
1381 /** Return value: <tt>true</tt> if a rubber banding operation is currently being
1382 * @return <tt>true</tt> if a rubber banding operation is currently being
1383 * done in @a tree_view .
1387 bool is_rubber_banding_active() const;
1390 * void on_row_separator(const Gtk::TreeModel& model, const Gtk::TreeModel::iterator& iter);
1392 typedef sigc::slot<bool, const Glib::RefPtr<TreeModel>&, const TreeModel::iterator&> SlotRowSeparator;
1394 void set_row_separator_func(const SlotRowSeparator& slot);
1397 /** Sets which grid lines to draw in @a tree_view .
1400 * @param grid_lines A Gtk::TreeViewGridLines value indicating which grid lines to
1403 void set_grid_lines(TreeViewGridLines grid_lines);
1405 /** Return value: a Gtk::TreeViewGridLines value indicating which grid lines
1406 * @return A Gtk::TreeViewGridLines value indicating which grid lines
1411 TreeViewGridLines get_grid_lines() const;
1414 /** Sets whether to draw lines interconnecting the expanders in @a tree_view .
1415 * This does not have any visible effects for lists.
1418 * @param enabled <tt>true</tt> to enable tree line drawing, <tt>false</tt> otherwise.
1420 void set_enable_tree_lines(bool enable = true);
1422 /** Return value: <tt>true</tt> if tree lines are drawn in @a tree_view , <tt>false</tt>
1423 * @return <tt>true</tt> if tree lines are drawn in @a tree_view , <tt>false</tt>
1428 bool get_enable_tree_lines() const;
1431 /** Sets whether to draw and enable expanders and indent child rows in
1432 * @a tree_view . When disabled there will be no expanders visible in trees
1433 * and there will be no way to expand and collapse rows by default. Also
1434 * note that hiding the expanders will disable the default indentation. You
1435 * can set a custom indentation in this case using
1436 * set_level_indentation().
1437 * This does not have any visible effects for lists.
1440 * @param enabled <tt>true</tt> to enable expander drawing, <tt>false</tt> otherwise.
1442 void set_show_expanders(bool enabled = true);
1444 /** Return value: <tt>true</tt> if expanders are drawn in @a tree_view , <tt>false</tt>
1445 * @return <tt>true</tt> if expanders are drawn in @a tree_view , <tt>false</tt>
1450 bool get_show_expanders() const;
1452 /** Sets the amount of extra indentation for child levels to use in @a tree_view
1453 * in addition to the default indentation. The value should be specified in
1454 * pixels, a value of 0 disables this feature and in this case only the default
1455 * indentation will be used.
1456 * This does not have any visible effects for lists.
1459 * @param indentation The amount, in pixels, of extra indentation in @a tree_view .
1461 void set_level_indentation(int indentation);
1463 /** Return value: the amount of extra indentation for child levels in
1464 * @return The amount of extra indentation for child levels in
1465 * @a tree_view . A return value of 0 means that this feature is disabled.
1469 int get_level_indentation() const;
1472 /** Sets the tip area of @a tooltip to be the area covered by the row at @a path .
1473 * See also gtk_tooltip_set_tip_area().
1476 * @param tooltip A Gtk::Tooltip.
1477 * @param path A Gtk::TreePath.
1479 void set_tooltip_row(const Glib::RefPtr<Tooltip>& tooltip, const TreePath& path);
1481 //Note that we use pointers instead of references because any one of the 3 arguments may be NULL, and we don't want that many method overloads:
1484 /** Sets the tip area of @a tooltip to the area @a path , @a column and @a cell have
1485 * in common. For example if @a path is <tt>0</tt> and @a column is set, the tip
1486 * area will be set to the full area covered by @a column . See also
1487 * gtk_tooltip_set_tip_area().
1490 * @param tooltip A Gtk::Tooltip.
1491 * @param path A Gtk::TreePath or <tt>0</tt>.
1492 * @param column A Gtk::TreeViewColumn or <tt>0</tt>.
1493 * @param cell A Gtk::CellRendererText or <tt>0</tt>.
1495 void set_tooltip_cell(const Glib::RefPtr<Tooltip>& tooltip, const TreeModel::Path* path, TreeViewColumn* column, CellRenderer* cell);
1499 * @param x: the x coordinate (relative to widget coordinates)
1500 * @param y: the y coordinate (relative to widget coordinates)
1501 * @param keyboard_tip: whether this is a keyboard tooltip or not
1502 * @param path: a reference to receive a Gtk::TreePath
1504 * This function is supposed to be used in a Gtk::Widget::query-tooltip
1505 * signal handler for Gtk::TreeView. The x, y and keyboard_tip values
1506 * which are received in the signal handler, should be passed to this
1507 * function without modification.
1509 * The return value indicates whether there is an tree view row at the given
1510 * coordinates (true) or not (false) for mouse tooltips. For keyboard
1511 * tooltips the row returned will be the cursor item. When true, then the
1512 * path which has been provided will be set to point to
1513 * that row and the corresponding model. x and y will always be converted
1514 * to be relative to Gtk::TreeView's bin_window if keyboard_tooltip is false.
1516 * Return value: whether or not the given tooltip context points to a row.
1520 bool get_tooltip_context_path(int& x, int& y,
1522 TreeModel::Path& path);
1525 * @param x: the x coordinate (relative to widget coordinates)
1526 * @param y: the y coordinate (relative to widget coordinates)
1527 * @param keyboard_tip: whether this is a keyboard tooltip or not
1528 * @param iter: a pointer to receive a Gtk::TreeIter
1530 * This function is supposed to be used in a Gtk::Widget::query-tooltip
1531 * signal handler for Gtk::TreeView. The x, y and keyboard_tip values
1532 * which are received in the signal handler, should be passed to this
1533 * function without modification.
1535 * The return value indicates whether there is an tree view row at the given
1536 * coordinates (true) or not (false) for mouse tooltips. For keyboard
1537 * tooltips the row returned will be the cursor item. When true, then the
1538 * iter which has been provided will be set to point to
1539 * that row and the corresponding model. x and y will always be converted
1540 * to be relative to Gtk::TreeView's bin_window if keyboard_tooltip is false.
1542 * Return value: whether or not the given tooltip context points to a row.
1546 bool get_tooltip_context_iter(int& x, int& y,
1548 Gtk::TreeModel::iterator& iter);
1551 void set_tooltip_column(int column);
1553 int get_tooltip_column() const;
1558 * <tt>void on_my_%set_scroll_adjustments(Adjustment* hadjustment, Adjustment* vadjustment)</tt>
1561 Glib::SignalProxy2< void,Adjustment*,Adjustment* > signal_set_scroll_adjustments();
1566 * <tt>void on_my_%row_activated(const TreeModel::Path& path, TreeViewColumn* column)</tt>
1569 Glib::SignalProxy2< void,const TreeModel::Path&,TreeViewColumn* > signal_row_activated();
1574 * <tt>bool on_my_%test_expand_row(const TreeModel::iterator& iter, const TreeModel::Path& path)</tt>
1577 Glib::SignalProxy2< bool,const TreeModel::iterator&,const TreeModel::Path& > signal_test_expand_row();
1582 * <tt>bool on_my_%test_collapse_row(const TreeModel::iterator& iter, const TreeModel::Path& path)</tt>
1585 Glib::SignalProxy2< bool,const TreeModel::iterator&,const TreeModel::Path& > signal_test_collapse_row();
1590 * <tt>void on_my_%row_expanded(const TreeModel::iterator& iter, const TreeModel::Path& path)</tt>
1593 Glib::SignalProxy2< void,const TreeModel::iterator&,const TreeModel::Path& > signal_row_expanded();
1598 * <tt>void on_my_%row_collapsed(const TreeModel::iterator& iter, const TreeModel::Path& path)</tt>
1601 Glib::SignalProxy2< void,const TreeModel::iterator&,const TreeModel::Path& > signal_row_collapsed();
1606 * <tt>void on_my_%cursor_changed()</tt>
1609 Glib::SignalProxy0< void > signal_cursor_changed();
1614 * <tt>void on_my_%columns_changed()</tt>
1617 Glib::SignalProxy0< void > signal_columns_changed();
1620 //Don't wrap these. They are keybinding signals, and their API broke for GTK+ 2.2.
1623 #ifdef GLIBMM_PROPERTIES_ENABLED
1624 /** The model for the tree view.
1626 * You rarely need to use properties because there are get_ and set_ methods for almost all of them.
1627 * @return A PropertyProxy that allows you to get or set the property of the value, or receive notification when
1628 * the value of the property changes.
1630 Glib::PropertyProxy< Glib::RefPtr<TreeModel> > property_model() ;
1631 #endif //#GLIBMM_PROPERTIES_ENABLED
1633 #ifdef GLIBMM_PROPERTIES_ENABLED
1634 /** The model for the tree view.
1636 * You rarely need to use properties because there are get_ and set_ methods for almost all of them.
1637 * @return A PropertyProxy that allows you to get or set the property of the value, or receive notification when
1638 * the value of the property changes.
1640 Glib::PropertyProxy_ReadOnly< Glib::RefPtr<TreeModel> > property_model() const;
1641 #endif //#GLIBMM_PROPERTIES_ENABLED
1643 #ifdef GLIBMM_PROPERTIES_ENABLED
1644 /** Horizontal Adjustment for the widget.
1646 * You rarely need to use properties because there are get_ and set_ methods for almost all of them.
1647 * @return A PropertyProxy that allows you to get or set the property of the value, or receive notification when
1648 * the value of the property changes.
1650 Glib::PropertyProxy<Adjustment*> property_hadjustment() ;
1651 #endif //#GLIBMM_PROPERTIES_ENABLED
1653 #ifdef GLIBMM_PROPERTIES_ENABLED
1654 /** Horizontal Adjustment for the widget.
1656 * You rarely need to use properties because there are get_ and set_ methods for almost all of them.
1657 * @return A PropertyProxy that allows you to get or set the property of the value, or receive notification when
1658 * the value of the property changes.
1660 Glib::PropertyProxy_ReadOnly<Adjustment*> property_hadjustment() const;
1661 #endif //#GLIBMM_PROPERTIES_ENABLED
1663 #ifdef GLIBMM_PROPERTIES_ENABLED
1664 /** Vertical Adjustment for the widget.
1666 * You rarely need to use properties because there are get_ and set_ methods for almost all of them.
1667 * @return A PropertyProxy that allows you to get or set the property of the value, or receive notification when
1668 * the value of the property changes.
1670 Glib::PropertyProxy<Adjustment*> property_vadjustment() ;
1671 #endif //#GLIBMM_PROPERTIES_ENABLED
1673 #ifdef GLIBMM_PROPERTIES_ENABLED
1674 /** Vertical Adjustment for the widget.
1676 * You rarely need to use properties because there are get_ and set_ methods for almost all of them.
1677 * @return A PropertyProxy that allows you to get or set the property of the value, or receive notification when
1678 * the value of the property changes.
1680 Glib::PropertyProxy_ReadOnly<Adjustment*> property_vadjustment() const;
1681 #endif //#GLIBMM_PROPERTIES_ENABLED
1683 #ifdef GLIBMM_PROPERTIES_ENABLED
1684 /** Show the column header buttons.
1686 * You rarely need to use properties because there are get_ and set_ methods for almost all of them.
1687 * @return A PropertyProxy that allows you to get or set the property of the value, or receive notification when
1688 * the value of the property changes.
1690 Glib::PropertyProxy<bool> property_headers_visible() ;
1691 #endif //#GLIBMM_PROPERTIES_ENABLED
1693 #ifdef GLIBMM_PROPERTIES_ENABLED
1694 /** Show the column header buttons.
1696 * You rarely need to use properties because there are get_ and set_ methods for almost all of them.
1697 * @return A PropertyProxy that allows you to get or set the property of the value, or receive notification when
1698 * the value of the property changes.
1700 Glib::PropertyProxy_ReadOnly<bool> property_headers_visible() const;
1701 #endif //#GLIBMM_PROPERTIES_ENABLED
1703 #ifdef GLIBMM_PROPERTIES_ENABLED
1704 /** Column headers respond to click events.
1706 * You rarely need to use properties because there are get_ and set_ methods for almost all of them.
1707 * @return A PropertyProxy that allows you to get or set the property of the value, or receive notification when
1708 * the value of the property changes.
1710 Glib::PropertyProxy<bool> property_headers_clickable() ;
1711 #endif //#GLIBMM_PROPERTIES_ENABLED
1713 #ifdef GLIBMM_PROPERTIES_ENABLED
1714 /** Column headers respond to click events.
1716 * You rarely need to use properties because there are get_ and set_ methods for almost all of them.
1717 * @return A PropertyProxy that allows you to get or set the property of the value, or receive notification when
1718 * the value of the property changes.
1720 Glib::PropertyProxy_ReadOnly<bool> property_headers_clickable() const;
1721 #endif //#GLIBMM_PROPERTIES_ENABLED
1723 #ifdef GLIBMM_PROPERTIES_ENABLED
1724 /** Set the column for the expander column.
1726 * You rarely need to use properties because there are get_ and set_ methods for almost all of them.
1727 * @return A PropertyProxy that allows you to get or set the property of the value, or receive notification when
1728 * the value of the property changes.
1730 Glib::PropertyProxy<TreeViewColumn*> property_expander_column() ;
1731 #endif //#GLIBMM_PROPERTIES_ENABLED
1733 #ifdef GLIBMM_PROPERTIES_ENABLED
1734 /** Set the column for the expander column.
1736 * You rarely need to use properties because there are get_ and set_ methods for almost all of them.
1737 * @return A PropertyProxy that allows you to get or set the property of the value, or receive notification when
1738 * the value of the property changes.
1740 Glib::PropertyProxy_ReadOnly<TreeViewColumn*> property_expander_column() const;
1741 #endif //#GLIBMM_PROPERTIES_ENABLED
1743 #ifdef GLIBMM_PROPERTIES_ENABLED
1744 /** View is reorderable.
1746 * You rarely need to use properties because there are get_ and set_ methods for almost all of them.
1747 * @return A PropertyProxy that allows you to get or set the property of the value, or receive notification when
1748 * the value of the property changes.
1750 Glib::PropertyProxy<bool> property_reorderable() ;
1751 #endif //#GLIBMM_PROPERTIES_ENABLED
1753 #ifdef GLIBMM_PROPERTIES_ENABLED
1754 /** View is reorderable.
1756 * You rarely need to use properties because there are get_ and set_ methods for almost all of them.
1757 * @return A PropertyProxy that allows you to get or set the property of the value, or receive notification when
1758 * the value of the property changes.
1760 Glib::PropertyProxy_ReadOnly<bool> property_reorderable() const;
1761 #endif //#GLIBMM_PROPERTIES_ENABLED
1763 #ifdef GLIBMM_PROPERTIES_ENABLED
1764 /** Set a hint to the theme engine to draw rows in alternating colors.
1766 * You rarely need to use properties because there are get_ and set_ methods for almost all of them.
1767 * @return A PropertyProxy that allows you to get or set the property of the value, or receive notification when
1768 * the value of the property changes.
1770 Glib::PropertyProxy<bool> property_rules_hint() ;
1771 #endif //#GLIBMM_PROPERTIES_ENABLED
1773 #ifdef GLIBMM_PROPERTIES_ENABLED
1774 /** Set a hint to the theme engine to draw rows in alternating colors.
1776 * You rarely need to use properties because there are get_ and set_ methods for almost all of them.
1777 * @return A PropertyProxy that allows you to get or set the property of the value, or receive notification when
1778 * the value of the property changes.
1780 Glib::PropertyProxy_ReadOnly<bool> property_rules_hint() const;
1781 #endif //#GLIBMM_PROPERTIES_ENABLED
1783 #ifdef GLIBMM_PROPERTIES_ENABLED
1784 /** View allows user to search through columns interactively.
1786 * You rarely need to use properties because there are get_ and set_ methods for almost all of them.
1787 * @return A PropertyProxy that allows you to get or set the property of the value, or receive notification when
1788 * the value of the property changes.
1790 Glib::PropertyProxy<bool> property_enable_search() ;
1791 #endif //#GLIBMM_PROPERTIES_ENABLED
1793 #ifdef GLIBMM_PROPERTIES_ENABLED
1794 /** View allows user to search through columns interactively.
1796 * You rarely need to use properties because there are get_ and set_ methods for almost all of them.
1797 * @return A PropertyProxy that allows you to get or set the property of the value, or receive notification when
1798 * the value of the property changes.
1800 Glib::PropertyProxy_ReadOnly<bool> property_enable_search() const;
1801 #endif //#GLIBMM_PROPERTIES_ENABLED
1803 #ifdef GLIBMM_PROPERTIES_ENABLED
1804 /** Model column to search through when searching through code.
1806 * You rarely need to use properties because there are get_ and set_ methods for almost all of them.
1807 * @return A PropertyProxy that allows you to get or set the property of the value, or receive notification when
1808 * the value of the property changes.
1810 Glib::PropertyProxy<int> property_search_column() ;
1811 #endif //#GLIBMM_PROPERTIES_ENABLED
1813 #ifdef GLIBMM_PROPERTIES_ENABLED
1814 /** Model column to search through when searching through code.
1816 * You rarely need to use properties because there are get_ and set_ methods for almost all of them.
1817 * @return A PropertyProxy that allows you to get or set the property of the value, or receive notification when
1818 * the value of the property changes.
1820 Glib::PropertyProxy_ReadOnly<int> property_search_column() const;
1821 #endif //#GLIBMM_PROPERTIES_ENABLED
1823 #ifdef GLIBMM_PROPERTIES_ENABLED
1824 /** Speeds up GtkTreeView by assuming that all rows have the same height.
1826 * You rarely need to use properties because there are get_ and set_ methods for almost all of them.
1827 * @return A PropertyProxy that allows you to get or set the property of the value, or receive notification when
1828 * the value of the property changes.
1830 Glib::PropertyProxy<bool> property_fixed_height_mode() ;
1831 #endif //#GLIBMM_PROPERTIES_ENABLED
1833 #ifdef GLIBMM_PROPERTIES_ENABLED
1834 /** Speeds up GtkTreeView by assuming that all rows have the same height.
1836 * You rarely need to use properties because there are get_ and set_ methods for almost all of them.
1837 * @return A PropertyProxy that allows you to get or set the property of the value, or receive notification when
1838 * the value of the property changes.
1840 Glib::PropertyProxy_ReadOnly<bool> property_fixed_height_mode() const;
1841 #endif //#GLIBMM_PROPERTIES_ENABLED
1843 #ifdef GLIBMM_PROPERTIES_ENABLED
1844 /** Whether the selection should follow the pointer.
1846 * You rarely need to use properties because there are get_ and set_ methods for almost all of them.
1847 * @return A PropertyProxy that allows you to get or set the property of the value, or receive notification when
1848 * the value of the property changes.
1850 Glib::PropertyProxy<bool> property_hover_selection() ;
1851 #endif //#GLIBMM_PROPERTIES_ENABLED
1853 #ifdef GLIBMM_PROPERTIES_ENABLED
1854 /** Whether the selection should follow the pointer.
1856 * You rarely need to use properties because there are get_ and set_ methods for almost all of them.
1857 * @return A PropertyProxy that allows you to get or set the property of the value, or receive notification when
1858 * the value of the property changes.
1860 Glib::PropertyProxy_ReadOnly<bool> property_hover_selection() const;
1861 #endif //#GLIBMM_PROPERTIES_ENABLED
1863 #ifdef GLIBMM_PROPERTIES_ENABLED
1864 /** Whether rows should be expanded/collapsed when the pointer moves over them.
1866 * You rarely need to use properties because there are get_ and set_ methods for almost all of them.
1867 * @return A PropertyProxy that allows you to get or set the property of the value, or receive notification when
1868 * the value of the property changes.
1870 Glib::PropertyProxy<bool> property_hover_expand() ;
1871 #endif //#GLIBMM_PROPERTIES_ENABLED
1873 #ifdef GLIBMM_PROPERTIES_ENABLED
1874 /** Whether rows should be expanded/collapsed when the pointer moves over them.
1876 * You rarely need to use properties because there are get_ and set_ methods for almost all of them.
1877 * @return A PropertyProxy that allows you to get or set the property of the value, or receive notification when
1878 * the value of the property changes.
1880 Glib::PropertyProxy_ReadOnly<bool> property_hover_expand() const;
1881 #endif //#GLIBMM_PROPERTIES_ENABLED
1883 #ifdef GLIBMM_PROPERTIES_ENABLED
1884 /** View has expanders.
1886 * You rarely need to use properties because there are get_ and set_ methods for almost all of them.
1887 * @return A PropertyProxy that allows you to get or set the property of the value, or receive notification when
1888 * the value of the property changes.
1890 Glib::PropertyProxy<bool> property_show_expanders() ;
1891 #endif //#GLIBMM_PROPERTIES_ENABLED
1893 #ifdef GLIBMM_PROPERTIES_ENABLED
1894 /** View has expanders.
1896 * You rarely need to use properties because there are get_ and set_ methods for almost all of them.
1897 * @return A PropertyProxy that allows you to get or set the property of the value, or receive notification when
1898 * the value of the property changes.
1900 Glib::PropertyProxy_ReadOnly<bool> property_show_expanders() const;
1901 #endif //#GLIBMM_PROPERTIES_ENABLED
1903 #ifdef GLIBMM_PROPERTIES_ENABLED
1904 /** Extra indentation for each level.
1906 * You rarely need to use properties because there are get_ and set_ methods for almost all of them.
1907 * @return A PropertyProxy that allows you to get or set the property of the value, or receive notification when
1908 * the value of the property changes.
1910 Glib::PropertyProxy<bool> property_level_indentation() ;
1911 #endif //#GLIBMM_PROPERTIES_ENABLED
1913 #ifdef GLIBMM_PROPERTIES_ENABLED
1914 /** Extra indentation for each level.
1916 * You rarely need to use properties because there are get_ and set_ methods for almost all of them.
1917 * @return A PropertyProxy that allows you to get or set the property of the value, or receive notification when
1918 * the value of the property changes.
1920 Glib::PropertyProxy_ReadOnly<bool> property_level_indentation() const;
1921 #endif //#GLIBMM_PROPERTIES_ENABLED
1923 #ifdef GLIBMM_PROPERTIES_ENABLED
1924 /** Whether to enable selection of multiple items by dragging the mouse pointer.
1926 * You rarely need to use properties because there are get_ and set_ methods for almost all of them.
1927 * @return A PropertyProxy that allows you to get or set the property of the value, or receive notification when
1928 * the value of the property changes.
1930 Glib::PropertyProxy<bool> property_rubber_banding() ;
1931 #endif //#GLIBMM_PROPERTIES_ENABLED
1933 #ifdef GLIBMM_PROPERTIES_ENABLED
1934 /** Whether to enable selection of multiple items by dragging the mouse pointer.
1936 * You rarely need to use properties because there are get_ and set_ methods for almost all of them.
1937 * @return A PropertyProxy that allows you to get or set the property of the value, or receive notification when
1938 * the value of the property changes.
1940 Glib::PropertyProxy_ReadOnly<bool> property_rubber_banding() const;
1941 #endif //#GLIBMM_PROPERTIES_ENABLED
1943 #ifdef GLIBMM_PROPERTIES_ENABLED
1944 /** Whether grid lines should be drawn in the tree view.
1946 * You rarely need to use properties because there are get_ and set_ methods for almost all of them.
1947 * @return A PropertyProxy that allows you to get or set the property of the value, or receive notification when
1948 * the value of the property changes.
1950 Glib::PropertyProxy<bool> property_enable_grid_lines() ;
1951 #endif //#GLIBMM_PROPERTIES_ENABLED
1953 #ifdef GLIBMM_PROPERTIES_ENABLED
1954 /** Whether grid lines should be drawn in the tree view.
1956 * You rarely need to use properties because there are get_ and set_ methods for almost all of them.
1957 * @return A PropertyProxy that allows you to get or set the property of the value, or receive notification when
1958 * the value of the property changes.
1960 Glib::PropertyProxy_ReadOnly<bool> property_enable_grid_lines() const;
1961 #endif //#GLIBMM_PROPERTIES_ENABLED
1963 #ifdef GLIBMM_PROPERTIES_ENABLED
1964 /** Whether tree lines should be drawn in the tree view.
1966 * You rarely need to use properties because there are get_ and set_ methods for almost all of them.
1967 * @return A PropertyProxy that allows you to get or set the property of the value, or receive notification when
1968 * the value of the property changes.
1970 Glib::PropertyProxy<bool> property_enable_tree_lines() ;
1971 #endif //#GLIBMM_PROPERTIES_ENABLED
1973 #ifdef GLIBMM_PROPERTIES_ENABLED
1974 /** Whether tree lines should be drawn in the tree view.
1976 * You rarely need to use properties because there are get_ and set_ methods for almost all of them.
1977 * @return A PropertyProxy that allows you to get or set the property of the value, or receive notification when
1978 * the value of the property changes.
1980 Glib::PropertyProxy_ReadOnly<bool> property_enable_tree_lines() const;
1981 #endif //#GLIBMM_PROPERTIES_ENABLED
1984 /// Get the treeview's model, but actually get the child model if it's a TreeModelFilter.
1985 Glib::RefPtr<Gtk::TreeModel> _get_base_model();
1989 #ifndef DOXYGEN_SHOULD_SKIP_THIS
1990 template<class ColumnType> friend
1991 void _auto_store_on_cellrenderer_text_edited_string(const Glib::ustring& path_string, const Glib::ustring& new_text, int model_column, const Glib::RefPtr<Gtk::TreeModel>& model);
1993 template <class ColumnType> friend
1994 void _auto_store_on_cellrenderer_text_edited_numerical(const Glib::ustring& path_string, const Glib::ustring& new_text, int model_column, const Glib::RefPtr<Gtk::TreeModel>& model);
1996 void _auto_store_on_cellrenderer_toggle_edited_with_model(const Glib::ustring& path_string, int model_column, const Glib::RefPtr<Gtk::TreeModel>& model);
1998 // This is no longer used, but we must keep it to prevent linker errors with already-compiled applications,
1999 // For instance, applications that were compiled with the older versions of the templates that did use this method.
2000 // TODO: Remove this when we can break API.
2001 void _auto_store_on_cellrenderer_toggle_edited(const Glib::ustring& path_string, int model_column);
2003 template<class ColumnType> friend
2004 void TreeView_Private::_connect_auto_store_editable_signal_handler(TreeView*, CellRenderer*, const TreeModelColumn<ColumnType>&);
2006 #endif //DOXYGEN_SHOULD_SKIP_THIS
2012 template <class ColumnType> inline
2013 int TreeView::append_column(const Glib::ustring& title, const TreeModelColumn<ColumnType>& model_column)
2015 // compilation will fail if there is no appropriate TreeViewColumn
2016 // constructor for this model column type.
2017 TreeViewColumn *const pViewColumn = Gtk::manage( new TreeViewColumn(title, model_column) );
2019 return append_column(*pViewColumn);
2022 //This is here because sigc::bind once did not work on all platforms, but now it does..
2023 #define GTKMM_HAVE_SIGC_BIND 1
2025 #ifdef GTKMM_HAVE_SIGC_BIND
2027 template <class ColumnType> inline
2028 int TreeView::append_column_numeric(const Glib::ustring& title, const TreeModelColumn<ColumnType>& model_column, const Glib::ustring& format)
2030 TreeViewColumn* const pViewColumn = Gtk::manage( new TreeViewColumn(title) );
2032 //Use a CellRendererText:
2033 //We don't use TreeView::Column::append_column(model_column) to generate an appropriate CellRenderer,
2034 //because that uses set_renderer(), which renders the model value using the automatic glib "transformations" (number-string conversions). As well as being unnecessary here, those automatic conversions can't handle all numeric types.
2035 CellRenderer* pCellRenderer = manage( new CellRendererText() );
2036 pViewColumn->pack_start(*pCellRenderer);
2039 //Some compilers don't like us to give the pointer to a template function directly to sigc::ptr_fun():
2040 typedef void (*type_fptr)(Gtk::CellRenderer* cell, const Gtk::TreeModel::iterator& iter, int model_column, const Glib::ustring& format);
2041 type_fptr fptr = TreeView_Private::_auto_cell_data_func<ColumnType>;
2043 //Connect a cell_data callback, to show the number's text representation in the specified format:
2044 //We use sigc::bind<-1> twice here, instead of sigc::bind() once, because some compilers need the extra hint.
2045 Gtk::TreeViewColumn::SlotCellData slot = sigc::bind<-1>(
2046 sigc::bind<-1>( sigc::ptr_fun(fptr), format),
2047 model_column.index()
2050 pViewColumn->set_cell_data_func(*pCellRenderer, slot);
2052 return append_column(*pViewColumn);
2055 #endif //GTKMM_HAVE_SIGC_BIND
2057 template <class ColumnType> inline
2058 int TreeView::append_column_numeric_editable(const Glib::ustring& title, const TreeModelColumn<ColumnType>& model_column, const Glib::ustring& format)
2060 int cols_count = append_column_numeric(title, model_column, format);
2062 //connect signal handlers for auto-storing of edited cell data
2063 //Note: This will only work for base-10 (decimal) formatted numbers:
2064 CellRenderer *const cell = get_column_cell_renderer(cols_count - 1);
2067 TreeView_Private::_connect_auto_store_editable_signal_handler<ColumnType>(this, cell, model_column);
2073 template <class ColumnType> inline
2074 int TreeView::append_column_editable(const Glib::ustring& title, const TreeModelColumn<ColumnType>& model_column)
2076 //Don't use this in a header, because it gives warnings when disabled: g_assert(model_column.type() != 0);
2078 // compilation will fail if there is no appropriate TreeViewColumn
2079 // constructor for this model column type.
2080 TreeViewColumn *const pViewColumn = Gtk::manage( new TreeViewColumn(title, model_column) );
2082 //connect signal handlers for auto-storing of edited cell data
2083 CellRenderer* pCellRender = pViewColumn->get_first_cell_renderer();
2084 TreeView_Private::_connect_auto_store_editable_signal_handler<ColumnType>(this, pCellRender, model_column);
2086 return append_column(*pViewColumn);
2089 template <class ColumnType> inline
2090 int TreeView::insert_column(const Glib::ustring& title, const TreeModelColumn<ColumnType>& model_column, int position)
2092 // compilation will fail if there is no appropriate TreeViewColumn
2093 // constructor for this model column type.
2094 TreeViewColumn *const pViewColumn = Gtk::manage( new TreeViewColumn(title, model_column) );
2096 return insert_column(*pViewColumn, position);
2099 template <class ColumnType> inline
2100 int TreeView::insert_column_editable(const Glib::ustring& title, const TreeModelColumn<ColumnType>& model_column, int position)
2102 // compilation will fail if there is no appropriate TreeViewColumn
2103 // constructor for this model column type.
2104 TreeViewColumn *const pViewColumn = Gtk::manage( new TreeViewColumn(title, model_column) );
2106 //connect signal handlers for auto-storing of edited cell data
2107 CellRenderer* pCellRender = pViewColumn->get_first_cell_renderer();
2108 TreeView_Private::_connect_auto_store_editable_signal_handler(this, pCellRender, model_column);
2110 return insert_column(*pViewColumn, position);
2114 #ifndef DOXYGEN_SHOULD_SKIP_THIS
2115 namespace TreeView_Private
2118 //Template specializations, for different model column types:
2119 //TODO: Move these specializations into the .ccg file - I tried, but the int specialization was not used by the compiler. murrayc.
2121 #ifdef GTKMM_HAVE_SIGC_BIND
2123 //bool specialization:
2125 void _connect_auto_store_editable_signal_handler(Gtk::TreeView* this_p, Gtk::CellRenderer* pCellRenderer, const Gtk::TreeModelColumn<bool>& model_column)
2127 Gtk::CellRendererToggle* pCellToggle = dynamic_cast<Gtk::CellRendererToggle*>(pCellRenderer);
2130 //Set the appropriate property,
2131 #ifdef GLIBMM_PROPERTIES_ENABLED
2132 pCellToggle->property_activatable() = true;
2134 pCellToggle->set_property("activatable", true);
2137 //Connect to the appropriate signal, sending the model_column too
2139 sigc::slot<void, const Glib::ustring&, int> slot_temp =
2141 sigc::mem_fun(*this_p, &Gtk::TreeView::_auto_store_on_cellrenderer_toggle_edited_with_model),
2142 this_p->_get_base_model()
2145 pCellToggle->signal_toggled().connect(
2148 model_column.index()
2152 //We use bind<1> instead of bind because some compilers need the extra hint.
2156 //int specialization:
2158 void _connect_auto_store_editable_signal_handler(Gtk::TreeView* this_p, Gtk::CellRenderer* pCellRenderer, const Gtk::TreeModelColumn<int>& model_column)
2160 Gtk::CellRendererText* pCellText = dynamic_cast<Gtk::CellRendererText*>(pCellRenderer);
2163 //Set the appropriate property,
2164 #ifdef GLIBMM_PROPERTIES_ENABLED
2165 pCellText->property_editable() = true;
2167 pCellText->set_property("editable", true);
2170 //Some compilers don't like us to give the pointer to a template function directly to sigc::ptr_fun():
2171 typedef void (*type_fptr)(const Glib::ustring& path_string, const Glib::ustring& new_text, int model_column, const Glib::RefPtr<Gtk::TreeModel>& model);
2172 type_fptr fptr = _auto_store_on_cellrenderer_text_edited_numerical<int>;
2174 //Connect to the appropriate signal, sending the model_column too,
2175 //We use bind<-1> twice here, instead of using bind() once, because some compilers need the extra hint.
2176 pCellText->signal_edited().connect(
2179 sigc::ptr_fun(fptr),
2180 this_p->_get_base_model() ),
2181 model_column.index()
2188 //unsigned int specialization:
2190 void _connect_auto_store_editable_signal_handler(Gtk::TreeView* this_p, Gtk::CellRenderer* pCellRenderer, const Gtk::TreeModelColumn<unsigned int>& model_column)
2192 Gtk::CellRendererText* pCellText = dynamic_cast<Gtk::CellRendererText*>(pCellRenderer);
2195 //Set the appropriate property,
2196 #ifdef GLIBMM_PROPERTIES_ENABLED
2197 pCellText->property_editable() = true;
2199 pCellText->set_property("editable", true);
2202 //Some compilers don't like us to give the pointer to a template function directly to sigc::ptr_fun():
2203 typedef void (*type_fptr)(const Glib::ustring& path_string, const Glib::ustring& new_text, int model_column, const Glib::RefPtr<Gtk::TreeModel>& model);
2204 type_fptr fptr = _auto_store_on_cellrenderer_text_edited_numerical<unsigned int>;
2206 //Connect to the appropriate signal, sending the model_column too,
2207 //We use bind<-1> twice here, instead of using bind() once, because some compilers need the extra hint.
2208 pCellText->signal_edited().connect(
2211 sigc::ptr_fun(fptr),
2212 this_p->_get_base_model() ),
2213 model_column.index()
2220 //long specialization:
2222 void _connect_auto_store_editable_signal_handler(Gtk::TreeView* this_p, Gtk::CellRenderer* pCellRenderer, const Gtk::TreeModelColumn<long>& model_column)
2224 Gtk::CellRendererText* pCellText = dynamic_cast<Gtk::CellRendererText*>(pCellRenderer);
2227 //Set the appropriate property,
2228 #ifdef GLIBMM_PROPERTIES_ENABLED
2229 pCellText->property_editable() = true;
2231 pCellText->set_property("editable", true);
2234 //Some compilers don't like us to give the pointer to a template function directly to sigc::ptr_fun():
2235 typedef void (*type_fptr)(const Glib::ustring& path_string, const Glib::ustring& new_text, int model_column, const Glib::RefPtr<Gtk::TreeModel>& model);
2236 type_fptr fptr = _auto_store_on_cellrenderer_text_edited_numerical<long>;
2238 //Connect to the appropriate signal, sending the model_column too,
2239 //We use bind<-1> twice here, instead of using bind() once, because some compilers need the extra hint.
2240 pCellText->signal_edited().connect(
2243 sigc::ptr_fun(fptr),
2244 this_p->_get_base_model() ),
2245 model_column.index()
2252 //unsigned long specialization:
2254 void _connect_auto_store_editable_signal_handler(Gtk::TreeView* this_p, Gtk::CellRenderer* pCellRenderer, const Gtk::TreeModelColumn<unsigned long>& model_column)
2256 Gtk::CellRendererText* pCellText = dynamic_cast<Gtk::CellRendererText*>(pCellRenderer);
2259 //Set the appropriate property,
2260 #ifdef GLIBMM_PROPERTIES_ENABLED
2261 pCellText->property_editable() = true;
2263 pCellText->set_property("editable", true);
2266 //Some compilers don't like us to give the pointer to a template function directly to sigc::ptr_fun():
2267 typedef void (*type_fptr)(const Glib::ustring& path_string, const Glib::ustring& new_text, int model_column, const Glib::RefPtr<Gtk::TreeModel>& model);
2268 type_fptr fptr = _auto_store_on_cellrenderer_text_edited_numerical<unsigned long>;
2270 //Connect to the appropriate signal, sending the model_column too,
2271 //We use bind<-1> twice here, instead of using bind() once, because some compilers need the extra hint.
2272 pCellText->signal_edited().connect(
2275 sigc::ptr_fun(fptr),
2276 this_p->_get_base_model() ),
2277 model_column.index()
2284 //float specialization:
2286 void _connect_auto_store_editable_signal_handler(Gtk::TreeView* this_p, Gtk::CellRenderer* pCellRenderer, const Gtk::TreeModelColumn<float>& model_column)
2288 Gtk::CellRendererText* pCellText = dynamic_cast<Gtk::CellRendererText*>(pCellRenderer);
2291 //Set the appropriate property,
2292 #ifdef GLIBMM_PROPERTIES_ENABLED
2293 pCellText->property_editable() = true;
2295 pCellText->set_property("editable", true);
2298 //Some compilers don't like us to give the pointer to a template function directly to sigc::ptr_fun():
2299 typedef void (*type_fptr)(const Glib::ustring& path_string, const Glib::ustring& new_text, int model_column, const Glib::RefPtr<Gtk::TreeModel>& model);
2300 type_fptr fptr = _auto_store_on_cellrenderer_text_edited_numerical<float>;
2302 //Connect to the appropriate signal, sending the model_column too,
2303 //We use bind<-1> twice here, instead of using bind() once, because some compilers need the extra hint.
2304 pCellText->signal_edited().connect(
2307 sigc::ptr_fun(fptr),
2308 this_p->_get_base_model() ),
2309 model_column.index()
2315 //double specialization:
2317 void _connect_auto_store_editable_signal_handler(Gtk::TreeView* this_p, Gtk::CellRenderer* pCellRenderer, const Gtk::TreeModelColumn<double>& model_column)
2319 Gtk::CellRendererText* pCellText = dynamic_cast<Gtk::CellRendererText*>(pCellRenderer);
2322 //Set the appropriate property,
2323 #ifdef GLIBMM_PROPERTIES_ENABLED
2324 pCellText->property_editable() = true;
2326 pCellText->set_property("editable", true);
2329 //Some compilers don't like us to give the pointer to a template function directly to sigc::ptr_fun():
2330 typedef void (*type_fptr)(const Glib::ustring& path_string, const Glib::ustring& new_text, int model_column, const Glib::RefPtr<Gtk::TreeModel>& model);
2331 type_fptr fptr = _auto_store_on_cellrenderer_text_edited_numerical<double>;
2333 //Connect to the appropriate signal, sending the model_column too,
2334 //We use bind<-1> twice here, instead of using bind() once, because some compilers need the extra hint.
2335 pCellText->signal_edited().connect(
2338 sigc::ptr_fun(fptr),
2339 this_p->_get_base_model() ),
2340 model_column.index()
2346 #endif //GTKMM_HAVE_SIGC_BIND
2348 } // namespace TreeView_Private
2349 #endif //DOXYGEN_SHOULD_SKIP_THIS
2352 #ifndef DOXYGEN_SHOULD_SKIP_THIS
2353 namespace TreeView_Private
2356 #ifdef GTKMM_HAVE_SIGC_BIND
2358 template <class ColumnType> inline
2359 void _connect_auto_store_editable_signal_handler(Gtk::TreeView* this_p, Gtk::CellRenderer* pCellRenderer, const Gtk::TreeModelColumn<ColumnType>& model_column)
2361 //Don't use this in a header, because it gives warnings when disabled: g_assert(model_column.type() != 0);
2363 //The different CellRenderers have different "edited" signals,
2364 //and numerical values need to convert the text value to a number,
2365 //so there are specializations for this tempate.
2367 Gtk::CellRendererText* pCellText = dynamic_cast<Gtk::CellRendererText*>(pCellRenderer);
2369 //Set the appropriate property,
2370 //and connect to the appropriate signal, sending the model_column too,
2373 #ifdef GLIBMM_PROPERTIES_ENABLED
2374 pCellText->property_editable() = true;
2376 pCellText->set_property("editable", true);
2379 //Some compilers (IRIX MipsPro) don't like us to give the pointer to a template function directly to sigc::ptr_fun():
2380 typedef void (*type_func)(const Glib::ustring&, const Glib::ustring&, int, const Glib::RefPtr<Gtk::TreeModel>&);
2381 type_func func = &(_auto_store_on_cellrenderer_text_edited_string<ColumnType>);
2382 sigc::slot<void, const Glib::ustring&, const Glib::ustring&, int, const Glib::RefPtr<Gtk::TreeModel>&> theslot =
2383 sigc::ptr_fun(func);
2385 //We use bind<-1> twice here, instead of using bind() once, because some compilers need the extra hint.
2386 pCellText->signal_edited().connect(
2388 sigc::bind<-1>( theslot, this_p->_get_base_model()),
2389 model_column.index()
2397 #endif //GTKMM_HAVE_SIGC_BIND
2399 template <class ColumnType> inline
2400 void _auto_store_on_cellrenderer_text_edited_string(const Glib::ustring& path_string, const Glib::ustring& new_text, int model_column, const Glib::RefPtr<Gtk::TreeModel>& model)
2402 Gtk::TreePath path(path_string);
2404 //Get the row from the path:
2407 Gtk::TreeModel::iterator iter = model->get_iter(path);
2410 //Store the user's new text in the model:
2411 Gtk::TreeRow row = *iter;
2412 row.set_value(model_column, (ColumnType)new_text);
2417 template <class ColumnType> inline
2418 void _auto_store_on_cellrenderer_text_edited_numerical(const Glib::ustring& path_string, const Glib::ustring& new_text, int model_column, const Glib::RefPtr<Gtk::TreeModel>& model)
2420 //This is used on numerical model columns:
2422 Gtk::TreePath path(path_string);
2424 //Get the row from the path:
2427 Gtk::TreeModel::iterator iter = model->get_iter(path);
2430 //std::istringstream astream(new_text); //Put it in a stream.
2431 //ColumnType new_value = ColumnType();
2432 //new_value << astream; //Get it out of the stream as the numerical type.
2434 //Convert the text to a number, using the same logic used by GtkCellRendererText when it stores numbers.
2436 ColumnType new_value = static_cast<ColumnType>( strtod(new_text.c_str(), &pchEnd) );
2438 //Store the user's new text in the model:
2439 Gtk::TreeRow row = *iter;
2440 row.set_value(model_column, (ColumnType)new_value);
2445 template <class ColumnType> inline
2446 void _auto_cell_data_func(Gtk::CellRenderer* cell, const Gtk::TreeModel::iterator& iter, int model_column, const Glib::ustring& format)
2448 Gtk::CellRendererText* pTextRenderer = dynamic_cast<Gtk::CellRendererText*>(cell);
2451 g_warning("gtkmm: TextView: append_column_numeric() was used with a non-numeric type.");
2457 //Get the value from the model.
2458 Gtk::TreeModel::Row row = *iter;
2459 ColumnType value = ColumnType();
2460 row.get_value(model_column, value);
2462 //Convert it to a string representation:
2464 int used = g_snprintf(buff, sizeof(buff), format.c_str(), value); //value must be a numeric type.
2467 //Show the text representation in the view:
2468 #ifdef GLIBMM_PROPERTIES_ENABLED
2469 pTextRenderer->property_text() = buff;
2471 pTextRenderer->set_property("text", (void*)buff);
2478 } // namespace TreeView_Private
2479 #endif //DOXYGEN_SHOULD_SKIP_THIS
2487 /** A Glib::wrap() method for this object.
2489 * @param object The C instance.
2490 * @param take_copy False if the result should take ownership of the C instance. True if it should take a new copy or ref.
2491 * @result A C++ instance that wraps this C instance.
2493 * @relates Gtk::TreeView
2495 Gtk::TreeView* wrap(GtkTreeView* object, bool take_copy = false);
2499 #endif /* _GTKMM_TREEVIEW_H */