3 #ifndef _GTKMM_TREEVIEW_H
4 #define _GTKMM_TREEVIEW_H
6 #include <gtkmmconfig.h>
9 #include <glibmm/ustring.h>
10 #include <sigc++/sigc++.h>
33 #include <glibmm/listhandle.h>
50 #ifndef DOXYGEN_SHOULD_SKIP_THIS
57 {
class TreeView_Class; }
79 #ifndef DOXYGEN_SHOULD_SKIP_THIS
87 static GType value_type() G_GNUC_CONST;
112 #ifndef DOXYGEN_SHOULD_SKIP_THIS
120 static GType value_type() G_GNUC_CONST;
131 #ifndef DOXYGEN_SHOULD_SKIP_THIS
135 namespace TreeView_Private
146 template <
class ColumnType>
inline
149 template<
class ColumnType>
inline
150 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);
152 template <
class ColumnType>
inline
153 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);
155 template <
class ColumnType>
inline
185 #ifndef DOXYGEN_SHOULD_SKIP_THIS
194 #ifndef DOXYGEN_SHOULD_SKIP_THIS
198 static CppClassType treeview_class_;
205 explicit TreeView(
const Glib::ConstructParams& construct_params);
211 #ifndef DOXYGEN_SHOULD_SKIP_THIS
212 static GType get_type() G_GNUC_CONST;
215 static GType get_base_type() G_GNUC_CONST;
268 explicit TreeView(
const Glib::RefPtr<TreeModel>& model);
444 template <
class ColumnType>
inline
456 template <
class ColumnType>
inline
473 template <
class ColumnType>
inline
487 template <
class ColumnType>
inline
534 template <
class ColumnType>
inline
549 template <
class ColumnType>
inline
669 typedef sigc::slot<bool, TreeView*, TreeViewColumn*, TreeViewColumn*, TreeViewColumn*>
SlotColumnDrop;
825 typedef sigc::slot<void, TreeView*, const TreeModel::Path&>
SlotMapping;
941 #ifndef GTKMM_DISABLE_DEPRECATED
998 #ifndef GTKMM_DISABLE_DEPRECATED
1036 #ifndef GTKMM_DISABLE_DEPRECATED
1072 #ifndef GTKMM_DISABLE_DEPRECATED
1099 #ifndef GTKMM_DISABLE_DEPRECATED
1120 #ifndef GTKMM_DISABLE_DEPRECATED
1139 #ifndef GTKMM_DISABLE_DEPRECATED
1160 #ifndef GTKMM_DISABLE_DEPRECATED
2026 #ifndef DOXYGEN_SHOULD_SKIP_THIS
2027 template<
class ColumnType>
friend
2028 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);
2030 template <
class ColumnType>
friend
2031 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);
2033 void _auto_store_on_cellrenderer_toggle_edited_with_model(
const Glib::ustring& path_string,
int model_column,
const Glib::RefPtr<Gtk::TreeModel>& model);
2038 void _auto_store_on_cellrenderer_toggle_edited(
const Glib::ustring& path_string,
int model_column);
2040 template<
class ColumnType>
friend
2049 template <
class ColumnType>
inline
2060 #define GTKMM_HAVE_SIGC_BIND 1
2062 #ifdef GTKMM_HAVE_SIGC_BIND
2064 template <
class ColumnType>
inline
2078 type_fptr fptr = TreeView_Private::_auto_cell_data_func<ColumnType>;
2083 sigc::bind<-1>( sigc::ptr_fun(fptr), format),
2084 model_column.
index()
2094 template <
class ColumnType>
inline
2104 TreeView_Private::_connect_auto_store_editable_signal_handler<ColumnType>(
this, cell, model_column);
2110 template <
class ColumnType>
inline
2121 TreeView_Private::_connect_auto_store_editable_signal_handler<ColumnType>(
this, pCellRender, model_column);
2126 template <
class ColumnType>
inline
2136 template <
class ColumnType>
inline
2145 TreeView_Private::_connect_auto_store_editable_signal_handler(
this, pCellRender, model_column);
2151 #ifndef DOXYGEN_SHOULD_SKIP_THIS
2152 namespace TreeView_Private
2158 #ifdef GTKMM_HAVE_SIGC_BIND
2172 sigc::slot<void, const Glib::ustring&, int> slot_temp =
2174 sigc::mem_fun(*this_p, &Gtk::TreeView::_auto_store_on_cellrenderer_toggle_edited_with_model),
2181 model_column.
index()
2200 typedef void (*type_fptr)(
const Glib::ustring& path_string,
const Glib::ustring& new_text,
int model_column,
const Glib::RefPtr<Gtk::TreeModel>& model);
2201 type_fptr fptr = _auto_store_on_cellrenderer_text_edited_numerical<int>;
2208 sigc::ptr_fun(fptr),
2210 model_column.index()
2228 typedef void (*type_fptr)(
const Glib::ustring& path_string,
const Glib::ustring& new_text,
int model_column,
const Glib::RefPtr<Gtk::TreeModel>& model);
2229 type_fptr fptr = _auto_store_on_cellrenderer_text_edited_numerical<unsigned int>;
2236 sigc::ptr_fun(fptr),
2238 model_column.index()
2256 typedef void (*type_fptr)(
const Glib::ustring& path_string,
const Glib::ustring& new_text,
int model_column,
const Glib::RefPtr<Gtk::TreeModel>& model);
2257 type_fptr fptr = _auto_store_on_cellrenderer_text_edited_numerical<long>;
2264 sigc::ptr_fun(fptr),
2266 model_column.index()
2284 typedef void (*type_fptr)(
const Glib::ustring& path_string,
const Glib::ustring& new_text,
int model_column,
const Glib::RefPtr<Gtk::TreeModel>& model);
2285 type_fptr fptr = _auto_store_on_cellrenderer_text_edited_numerical<unsigned long>;
2292 sigc::ptr_fun(fptr),
2294 model_column.index()
2312 typedef void (*type_fptr)(
const Glib::ustring& path_string,
const Glib::ustring& new_text,
int model_column,
const Glib::RefPtr<Gtk::TreeModel>& model);
2313 type_fptr fptr = _auto_store_on_cellrenderer_text_edited_numerical<float>;
2320 sigc::ptr_fun(fptr),
2322 model_column.index()
2339 typedef void (*type_fptr)(
const Glib::ustring& path_string,
const Glib::ustring& new_text,
int model_column,
const Glib::RefPtr<Gtk::TreeModel>& model);
2340 type_fptr fptr = _auto_store_on_cellrenderer_text_edited_numerical<double>;
2347 sigc::ptr_fun(fptr),
2349 model_column.index()
2361 #ifndef DOXYGEN_SHOULD_SKIP_THIS
2362 namespace TreeView_Private
2365 #ifdef GTKMM_HAVE_SIGC_BIND
2367 template <
class ColumnType>
inline
2385 typedef void (*type_func)(
const Glib::ustring&,
const Glib::ustring&, int,
const Glib::RefPtr<Gtk::TreeModel>&);
2386 type_func func = &(_auto_store_on_cellrenderer_text_edited_string<ColumnType>);
2387 sigc::slot<void, const Glib::ustring&, const Glib::ustring&, int, const Glib::RefPtr<Gtk::TreeModel>&> theslot =
2388 sigc::ptr_fun(func);
2394 model_column.
index()
2402 template <
class ColumnType>
inline
2403 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)
2415 row.
set_value(model_column, (ColumnType)new_text);
2420 template <
class ColumnType>
inline
2421 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)
2439 ColumnType new_value =
static_cast<ColumnType
>( strtod(new_text.c_str(), &pchEnd) );
2443 row.
set_value(model_column, (ColumnType)new_value);
2448 template <
class ColumnType>
inline
2454 g_warning(
"gtkmm: TextView: append_column_numeric() was used with a non-numeric type.");
2462 ColumnType value = ColumnType();
2467 int used = g_snprintf(buff,
sizeof(buff), format.c_str(), value);
Glib::PropertyProxy< Glib::ustring > property_text()
Glib::PropertyProxy< bool > property_editable()
Glib::SignalProxy2< void, const Glib::ustring &, const Glib::ustring & > signal_edited()
Glib::SignalProxy1< void, const Glib::ustring & > signal_toggled()
Glib::PropertyProxy< bool > property_activatable()
ColumnType get_value(const TreeModelColumn< ColumnType > &column) const
void set_value(const TreeModelColumn< ColumnType > &column, const ColumnType &data) const
void pack_start(CellRenderer &cell, bool expand=true)
sigc::slot< void, CellRenderer *, const Gtk::TreeModel::iterator & > SlotCellData
void set_cell_data_func(CellRenderer &cell_renderer, const SlotCellData &slot)
CellRenderer * get_first_cell()
void set_reorderable(bool reorderable=true)
void set_cursor(const TreeModel::Path &path, TreeViewColumn &focus_column, CellRenderer &focus_cell, bool start_editing=false)
bool get_hover_expand() const
Glib::PropertyProxy_ReadOnly< Glib::RefPtr< TreeModel > > property_model() const
Glib::PropertyProxy_ReadOnly< bool > property_reorderable() const
const TreeViewColumn * get_column(int n) const
Glib::SignalProxy2< void, const TreeModel::iterator &, const TreeModel::Path & > signal_row_expanded()
void get_background_area(const TreeModel::Path &path, TreeViewColumn &column, Gdk::Rectangle &rect)
Glib::PropertyProxy< bool > property_enable_grid_lines()
void scroll_to_column(TreeViewColumn &column)
virtual void on_set_scroll_adjustments(Adjustment *hadjustment, Adjustment *vadjustment)
This is a default handler for the signal signal_set_scroll_adjustments().
Glib::PropertyProxy< bool > property_headers_clickable()
Glib::SignalProxy2< void, Adjustment *, Adjustment * > signal_set_scroll_adjustments()
int append_column(TreeViewColumn &column)
void set_search_entry(Entry &entry)
void get_visible_rect(Gdk::Rectangle &visible_rect) const
void scroll_to_column(TreeViewColumn &column, float col_align)
Glib::PropertyProxy_ReadOnly< bool > property_rules_hint() const
Glib::PropertyProxy_ReadOnly< int > property_search_column() const
int insert_column_with_data_func(int position, const Glib::ustring &title, CellRenderer &cell, const SlotCellData &slot)
sigc::slot< bool, TreeView *, TreeViewColumn *, TreeViewColumn *, TreeViewColumn * > SlotColumnDrop
sigc::slot< bool, const Glib::RefPtr< TreeModel > &, const TreeModel::iterator & > SlotRowSeparator
bool get_rubber_banding() const
Glib::PropertyProxy_ReadOnly< bool > property_enable_grid_lines() const
int append_column_editable(const Glib::ustring &title, const TreeModelColumn< ColumnType > &model_column)
void set_column_drag_function(const SlotColumnDrop &slot)
int insert_column_editable(const Glib::ustring &title, const TreeModelColumn< ColumnType > &model_column, int position)
void enable_model_drag_source(Gdk::ModifierType start_button_mask=Gdk::MODIFIER_MASK, Gdk::DragAction actions=Gdk::ACTION_COPY|Gdk::ACTION_MOVE)
void set_search_position_func(const SlotSearchPosition &slot)
Glib::PropertyProxy< Glib::RefPtr< TreeModel > > property_model()
bool expand_row(const TreeModel::Path &path, bool open_all)
Glib::PropertyProxy_ReadOnly< bool > property_enable_search() const
void set_enable_tree_lines(bool enable=true)
bool get_rules_hint() const
void get_visible_rect(Gdk::Rectangle &visible_rect)
Glib::PropertyProxy< bool > property_fixed_height_mode()
void set_vadjustment(Adjustment &adjustment)
void set_model(const Glib::RefPtr< TreeModel > &model)
Glib::PropertyProxy_ReadOnly< bool > property_enable_tree_lines() const
sigc::slot< void, Gtk::Widget * > SlotSearchPosition
void on_search_position(Gtk::Widget* search_dialog)
int insert_column(TreeViewColumn &column, int position)
Glib::PropertyProxy< bool > property_hover_expand()
Adjustment * get_vadjustment()
Glib::PropertyProxy_ReadOnly< bool > property_show_expanders() const
Glib::PropertyProxy< bool > property_headers_visible()
bool get_tooltip_context_path(int &x, int &y, bool keyboard_tip, TreeModel::Path &path)
Glib::PropertyProxy< bool > property_enable_tree_lines()
bool get_show_expanders() const
void enable_model_drag_dest(Gdk::DragAction actions=Gdk::ACTION_COPY|Gdk::ACTION_MOVE)
void convert_tree_to_bin_window_coords(int tx, int ty, int &bx, int &by) const
bool get_path_at_pos(int x, int y, TreeModel::Path &path, TreeViewColumn *&column, int &cell_x, int &cell_y)
void set_search_column(int column)
const Adjustment * get_vadjustment() const
void expand_to_path(const TreeModel::Path &path)
TreeViewColumn * get_column(int n)
Glib::SignalProxy2< bool, const TreeModel::iterator &, const TreeModel::Path & > signal_test_collapse_row()
bool get_enable_search() const
void set_tooltip_column(int column)
void set_search_column(const TreeModelColumnBase &column)
void set_row_separator_func(const SlotRowSeparator &slot)
Glib::RefPtr< Gdk::Window > get_bin_window()
Glib::PropertyProxy_ReadOnly< bool > property_level_indentation() const
Glib::PropertyProxy< int > property_search_column()
bool get_path_at_pos(int x, int y, TreeModel::Path &path) const
TreeViewGridLines get_grid_lines() const
bool get_visible_range(TreeModel::Path &start_path, TreeModel::Path &end_path) const
void get_cursor(TreeModel::Path &path, TreeViewColumn *&focus_column)
int get_tooltip_column() const
void set_enable_search(bool enable_search=true)
void widget_to_tree_coords(int wx, int wy, int &tx, int &ty) const
void set_search_equal_func(const SlotSearchEqual &slot)
void scroll_to_cell(const TreeModel::Path &path, TreeViewColumn &column, float row_align, float col_align)
Glib::RefPtr< Gtk::TreeModel > _get_base_model()
Get the treeview's model, but actually get the child model if it's a TreeModelFilter.
bool get_hover_selection() const
sigc::slot< void, TreeView *, const TreeModel::Path & > SlotMapping
void set_cursor(const TreeModel::Path &path)
virtual void on_columns_changed()
This is a default handler for the signal signal_columns_changed().
bool get_path_at_pos(int x, int y, TreeModel::Path &path, TreeViewColumn *&column, int &cell_x, int &cell_y) const
Glib::RefPtr< const TreeSelection > get_selection() const
sigc::slot< bool, const Glib::RefPtr< TreeModel > &, int, const Glib::ustring &, const TreeModel::iterator & > SlotSearchEqual
void on_search_equal(const Glib::RefPtr<TreeModel>& model, int column, const Glib::ustring& key,...
Glib::PropertyProxy_ReadOnly< TreeViewColumn * > property_expander_column() const
bool get_fixed_height_mode() const
Glib::PropertyProxy< Adjustment * > property_vadjustment()
void widget_to_tree_coords(int wx, int wy, int &tx, int &ty)
Glib::PropertyProxy_ReadOnly< bool > property_headers_visible() const
void map_expanded_rows(const SlotMapping &slot)
void set_expander_column(TreeViewColumn &column)
bool collapse_row(const TreeModel::Path &path)
void convert_bin_window_to_tree_coords(int bx, int by, int &tx, int &ty) const
void move_column_to_start(TreeViewColumn &column)
Glib::PropertyProxy_ReadOnly< bool > property_hover_expand() const
void unset_rows_drag_source()
Entry * get_search_entry()
TreeViewColumn * get_expander_column()
void set_headers_visible(bool headers_visible=true)
Glib::PropertyProxy< bool > property_rubber_banding()
void convert_bin_window_to_widget_coords(int bx, int by, int &wx, int &wy) const
int append_column_numeric(const Glib::ustring &title, const TreeModelColumn< ColumnType > &model_column, const Glib::ustring &format)
void set_hadjustment(Adjustment &adjustment)
Glib::RefPtr< const TreeModel > get_model() const
Glib::PropertyProxy_ReadOnly< bool > property_hover_selection() const
Glib::PropertyProxy< bool > property_level_indentation()
void unset_column_drag_function()
const TreeViewColumn * get_expander_column() const
void get_background_area(const TreeModel::Path &path, TreeViewColumn &column, Gdk::Rectangle &rect) const
Glib::PropertyProxy< bool > property_hover_selection()
void set_rubber_banding(bool enable=true)
void remove_all_columns()
Removes all View columns.
Glib::ListHandle< const TreeViewColumn * > get_columns() const
void move_column_after(TreeViewColumn &column, TreeViewColumn &base_column)
virtual bool on_test_expand_row(const TreeModel::iterator &iter, const TreeModel::Path &path)
This is a default handler for the signal signal_test_expand_row().
GtkTreeView * gobj()
Provides access to the underlying C GtkObject.
void convert_tree_to_widget_coords(int tx, int ty, int &wx, int &wy) const
int remove_column(TreeViewColumn &column)
void set_grid_lines(TreeViewGridLines grid_lines)
void scroll_to_cell(const TreeModel::Path &path, TreeViewColumn &column)
void scroll_to_point(int tree_x, int tree_y)
bool get_headers_clickable() const
Glib::PropertyProxy_ReadOnly< bool > property_fixed_height_mode() const
const GtkTreeView * gobj() const
Provides access to the underlying C GtkObject.
int get_search_column() const
Glib::PropertyProxy_ReadOnly< bool > property_rubber_banding() const
const Entry * get_search_entry() const
int insert_column(const Glib::ustring &title, CellRenderer &cell, int position)
int append_column_numeric_editable(const Glib::ustring &title, const TreeModelColumn< ColumnType > &model_column, const Glib::ustring &format)
Glib::PropertyProxy_ReadOnly< Adjustment * > property_hadjustment() const
void enable_model_drag_source(const ArrayHandle_TargetEntry &targets, Gdk::ModifierType start_button_mask=Gdk::MODIFIER_MASK, Gdk::DragAction actions=Gdk::ACTION_COPY|Gdk::ACTION_MOVE)
const Adjustment * get_hadjustment() const
Glib::SignalProxy2< void, const TreeModel::Path &, TreeViewColumn * > signal_row_activated()
Glib::SignalProxy2< void, const TreeModel::iterator &, const TreeModel::Path & > signal_row_collapsed()
void tree_to_widget_coords(int tx, int ty, int &wx, int &wy) const
void set_show_expanders(bool enabled=true)
bool get_reorderable() const
Glib::PropertyProxy< bool > property_rules_hint()
bool get_enable_tree_lines() const
bool get_tooltip_context_iter(int &x, int &y, bool keyboard_tip, Gtk::TreeModel::iterator &iter)
Glib::PropertyProxy< int > property_tooltip_column()
CellRenderer * get_column_cell_renderer(int n)
void convert_widget_to_bin_window_coords(int wx, int wy, int &bx, int &by) const
void set_level_indentation(int indentation)
void set_hover_selection(bool hover=true)
Glib::SignalProxy2< bool, const TreeModel::iterator &, const TreeModel::Path & > signal_test_expand_row()
bool is_rubber_banding_active() const
void scroll_to_row(const TreeModel::Path &path, float row_align)
void get_cell_area(const TreeModel::Path &path, TreeViewColumn &column, Gdk::Rectangle &rect)
Glib::PropertyProxy_ReadOnly< int > property_tooltip_column() const
const CellRenderer * get_column_cell_renderer(int n) const
void set_drag_dest_row(const TreeModel::Path &path, TreeViewDropPosition pos)
Glib::PropertyProxy< bool > property_reorderable()
TreeView(const Glib::RefPtr< TreeModel > &model)
TreeViewColumn::SlotCellData SlotCellData
Glib::RefPtr< Gdk::Pixmap > create_row_drag_icon(const TreeModel::Path &path)
Glib::PropertyProxy< TreeViewColumn * > property_expander_column()
Glib::SignalProxy0< void > signal_columns_changed()
Glib::PropertyProxy< Adjustment * > property_hadjustment()
void get_drag_dest_row(TreeModel::Path &path, TreeViewDropPosition &pos) const
void enable_model_drag_dest(const ArrayHandle_TargetEntry &targets, Gdk::DragAction actions=Gdk::ACTION_COPY|Gdk::ACTION_MOVE)
Glib::PropertyProxy_ReadOnly< bool > property_headers_clickable() const
void convert_widget_to_tree_coords(int wx, int wy, int &tx, int &ty) const
virtual void on_row_activated(const TreeModel::Path &path, TreeViewColumn *column)
This is a default handler for the signal signal_row_activated().
void set_fixed_height_mode(bool enable=true)
virtual bool on_test_collapse_row(const TreeModel::iterator &iter, const TreeModel::Path &path)
This is a default handler for the signal signal_test_collapse_row().
Glib::RefPtr< const Gdk::Window > get_bin_window() const
Glib::RefPtr< TreeModel > get_model()
void scroll_to_row(const TreeModel::Path &path)
bool get_dest_row_at_pos(int drag_x, int drag_y, TreeModel::Path &path, TreeViewDropPosition &pos) const
Glib::SignalProxy0< void > signal_cursor_changed()
virtual void on_cursor_changed()
This is a default handler for the signal signal_cursor_changed().
Glib::PropertyProxy_ReadOnly< Adjustment * > property_vadjustment() const
void set_headers_clickable(bool setting=true)
void set_tooltip_row(const Glib::RefPtr< Tooltip > &tooltip, const TreePath &path)
virtual void on_row_expanded(const TreeModel::iterator &iter, const TreeModel::Path &path)
This is a default handler for the signal signal_row_expanded().
void row_activated(const TreeModel::Path &path, TreeViewColumn &column)
void tree_to_widget_coords(int tx, int ty, int &wx, int &wy)
Glib::ListHandle< TreeViewColumn * > get_columns()
void set_tooltip_cell(const Glib::RefPtr< Tooltip > &tooltip, const TreeModel::Path *path, TreeViewColumn *column, CellRenderer *cell)
Glib::RefPtr< TreeSelection > get_selection()
void set_cursor(const TreeModel::Path &path, TreeViewColumn &focus_column, bool start_editing=false)
void reset_expander_column()
int append_column(const Glib::ustring &title, CellRenderer &cell)
Creates a View column containing the CellRenderer, and appends it.
Glib::PropertyProxy< bool > property_show_expanders()
Adjustment * get_hadjustment()
Glib::PropertyProxy< bool > property_enable_search()
void set_hover_expand(bool expand=true)
virtual void on_row_collapsed(const TreeModel::iterator &iter, const TreeModel::Path &path)
This is a default handler for the signal signal_row_collapsed().
void get_cell_area(const TreeModel::Path &path, TreeViewColumn &column, Gdk::Rectangle &rect) const
bool get_headers_visible() const
bool row_expanded(const TreeModel::Path &path)
Gtk::TreeView * wrap(GtkTreeView *object, bool take_copy=false)
int get_level_indentation() const
void set_rules_hint(bool setting=true)
void unset_rows_drag_dest()
Glib::ArrayHandle< TargetEntry, TargetEntry_Traits > ArrayHandle_TargetEntry