gtk2/gtk/gtktreemodel.h

414 lines
16 KiB
C
Raw Normal View History

/* gtktreemodel.h
* Copyright (C) 2000 Red Hat, Inc., Jonathan Blandford <jrb@redhat.com>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public
2012-02-27 13:01:10 +00:00
* License along with this library. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef __GTK_TREE_MODEL_H__
#define __GTK_TREE_MODEL_H__
#if !defined (__GTK_H_INSIDE__) && !defined (GTK_COMPILATION)
#error "Only <gtk/gtk.h> can be included directly."
#endif
#include <glib-object.h>
#include <gdk/gdk.h>
G_BEGIN_DECLS
#define GTK_TYPE_TREE_MODEL (gtk_tree_model_get_type ())
#define GTK_TREE_MODEL(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GTK_TYPE_TREE_MODEL, GtkTreeModel))
#define GTK_IS_TREE_MODEL(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GTK_TYPE_TREE_MODEL))
#define GTK_TREE_MODEL_GET_IFACE(obj) (G_TYPE_INSTANCE_GET_INTERFACE ((obj), GTK_TYPE_TREE_MODEL, GtkTreeModelIface))
#define GTK_TYPE_TREE_ITER (gtk_tree_iter_get_type ())
#define GTK_TYPE_TREE_PATH (gtk_tree_path_get_type ())
#define GTK_TYPE_TREE_ROW_REFERENCE (gtk_tree_row_reference_get_type ())
typedef struct _GtkTreeIter GtkTreeIter;
typedef struct _GtkTreePath GtkTreePath;
typedef struct _GtkTreeRowReference GtkTreeRowReference;
typedef struct _GtkTreeModel GtkTreeModel; /* Dummy typedef */
typedef struct _GtkTreeModelIface GtkTreeModelIface;
2011-01-12 23:48:20 +00:00
/**
* GtkTreeModelForeachFunc:
* @model: the `GtkTreeModel` being iterated
* @path: the current `GtkTreePath`
* @iter: the current `GtkTreeIter`
* @data: (closure): The user data passed to gtk_tree_model_foreach()
2011-01-12 23:48:20 +00:00
*
* Type of the callback passed to gtk_tree_model_foreach() to
* iterate over the rows in a tree model.
*
* Returns: %TRUE to stop iterating, %FALSE to continue
2011-01-12 23:48:20 +00:00
*
*/
typedef gboolean (* GtkTreeModelForeachFunc) (GtkTreeModel *model, GtkTreePath *path, GtkTreeIter *iter, gpointer data);
2011-01-12 23:48:20 +00:00
/**
* GtkTreeModelFlags:
* @GTK_TREE_MODEL_ITERS_PERSIST: iterators survive all signals
* emitted by the tree
2011-01-12 23:48:20 +00:00
* @GTK_TREE_MODEL_LIST_ONLY: the model is a list only, and never
* has children
2011-01-12 23:48:20 +00:00
*
* These flags indicate various properties of a `GtkTreeModel`.
2011-01-12 23:48:20 +00:00
*
* They are returned by [method@Gtk.TreeModel.get_flags], and must be
2011-01-12 23:48:20 +00:00
* static for the lifetime of the object. A more complete description
* of %GTK_TREE_MODEL_ITERS_PERSIST can be found in the overview of
2011-01-12 23:48:20 +00:00
* this section.
*/
typedef enum
{
GTK_TREE_MODEL_ITERS_PERSIST = 1 << 0,
GTK_TREE_MODEL_LIST_ONLY = 1 << 1
} GtkTreeModelFlags;
2011-01-12 23:48:20 +00:00
/**
* GtkTreeIter:
* @stamp: a unique stamp to catch invalid iterators
* @user_data: model-specific data
* @user_data2: model-specific data
* @user_data3: model-specific data
*
* The `GtkTreeIter` is the primary structure
* for accessing a `GtkTreeModel`. Models are expected to put a unique
2014-01-27 22:13:43 +00:00
* integer in the @stamp member, and put
* model-specific data in the three @user_data
2011-01-12 23:48:20 +00:00
* members.
*/
struct _GtkTreeIter
{
2020-07-24 13:54:49 +00:00
int stamp;
gpointer user_data;
gpointer user_data2;
gpointer user_data3;
};
2014-01-21 04:08:34 +00:00
/**
* GtkTreeModelIface:
* @row_changed: Signal emitted when a row in the model has changed.
* @row_inserted: Signal emitted when a new row has been inserted in
* the model.
* @row_has_child_toggled: Signal emitted when a row has gotten the
* first child row or lost its last child row.
* @row_deleted: Signal emitted when a row has been deleted.
* @rows_reordered: Signal emitted when the children of a node in the
* GtkTreeModel have been reordered.
* @get_flags: Get `GtkTreeModelFlags` supported by this interface.
2014-01-21 04:08:34 +00:00
* @get_n_columns: Get the number of columns supported by the model.
* @get_column_type: Get the type of the column.
* @get_iter: Sets iter to a valid iterator pointing to path.
* @get_path: Gets a newly-created `GtkTreePath` referenced by iter.
2014-01-21 04:08:34 +00:00
* @get_value: Initializes and sets value to that at column.
* @iter_next: Sets iter to point to the node following it at the
* current level.
* @iter_previous: Sets iter to point to the previous node at the
* current level.
* @iter_children: Sets iter to point to the first child of parent.
* @iter_has_child: %TRUE if iter has children, %FALSE otherwise.
* @iter_n_children: Gets the number of children that iter has.
* @iter_nth_child: Sets iter to be the child of parent, using the
* given index.
* @iter_parent: Sets iter to be the parent of child.
* @ref_node: Lets the tree ref the node.
* @unref_node: Lets the tree unref the node.
*/
struct _GtkTreeModelIface
{
2014-01-21 04:08:34 +00:00
/*< private >*/
GTypeInterface g_iface;
2014-01-21 04:08:34 +00:00
/*< public >*/
/* Signals */
void (* row_changed) (GtkTreeModel *tree_model,
GtkTreePath *path,
GtkTreeIter *iter);
void (* row_inserted) (GtkTreeModel *tree_model,
GtkTreePath *path,
GtkTreeIter *iter);
void (* row_has_child_toggled) (GtkTreeModel *tree_model,
GtkTreePath *path,
GtkTreeIter *iter);
void (* row_deleted) (GtkTreeModel *tree_model,
GtkTreePath *path);
void (* rows_reordered) (GtkTreeModel *tree_model,
GtkTreePath *path,
GtkTreeIter *iter,
2020-07-24 13:54:49 +00:00
int *new_order);
/* Virtual Table */
GtkTreeModelFlags (* get_flags) (GtkTreeModel *tree_model);
Adapt to GtkTreeSelection changes 2001-01-01 Havoc Pennington <hp@redhat.com> * gtk/gtktreeview.c: Adapt to GtkTreeSelection changes * gtk/gtktreeselection.c (_gtk_tree_selection_set_tree_view): don't fill in tree_view->priv->selection, kind of an unexpected side effect * gtk/gtkcellrenderertext.c: Remove definition of _ and include gtkintl.h * gtk/gtkcellrenderer.c: Remove definition of _ and include gtkintl.h (gtk_cell_renderer_get_property): remove calls to g_value_init * gtk/gtkcellrendererpixbuf.c: Remove definition of _ and include gtkintl.h * gtk/gtkcellrenderertextpixbuf.c: Remove definition of _ macro and include gtkintl.h (gtk_cell_renderer_text_pixbuf_class_init): remove spaces from property names * gtk/gtktreeselection.c (_gtk_tree_selection_new): rename, return GtkTreeSelection (_gtk_tree_selection_new_from_with_view): rename, return GtkTreeSelection (_gtk_tree_selection_set_tree_view): rename with uscore (gtk_tree_selection_get_selected): fill in the "model" out param first, so it gets filled in even if we return at the top of the function (gtk_tree_selection_real_select_all): add a comment and an else{} to clarify this a bit (gtk_tree_selection_real_unselect_all): add the same else{} * gtk/gtktreeselection.h: Rename new, new_with_tree_view, and set_tree_view to have underscore prefixes, move them to the private header, fix return type of new_with_tree_view (struct _GtkTreeSelection): mark struct fields private * gtk/gtktreemodel.c (gtk_tree_model_get_flags): return GtkTreeModelFlags, not a guint (gtk_tree_path_prev): return gboolean not gint (gtk_tree_path_up): return gboolean not gint * gtk/gtktreemodel.h (struct _GtkTreeModelIface): make get_flags return GtkTreeModelFlags, not a guint * gtk/gtktreemodelsort.c (gtk_tree_model_sort_finalize): check that child model is non-null before unrefing it (g_value_int_compare_func): make this a qsort compare func, not a boolean predicate * gtk/gtktreemodelsort.h: rename gtk_tree_model_set_sort_column, (add -umn to the end), and mark it unimplemented (gtk_tree_model_sort_resort): remove, this wasn't implemented, and I don't see what it's for - doesn't the model always sort itself? (gtk_tree_model_sort_set_compare): this had the wrong signature * gtk/gtktreeviewcolumn.c (gtk_tree_view_column_set_attributes): Fix the docs to say that it destructively replaces existing attributes (previously said that it added attributes). (gtk_tree_view_column_set_visible): canonicalize bool before equality testing. Also, check for realization before hiding/showing the tree_column->window; if this window could exist before realization, then it's busted and needs fixing, we can't create GDK resources pre-realization. Also, remove superfluous queue_resize(), since set_size() does that for us. (gtk_tree_view_column_set_col_type): check realization before using tree_column->window * gtk/gtktreedatalist.c: fix filename in copyright notice
2001-01-01 19:01:54 +00:00
2020-07-24 13:54:49 +00:00
int (* get_n_columns) (GtkTreeModel *tree_model);
GType (* get_column_type) (GtkTreeModel *tree_model,
2020-07-24 13:54:49 +00:00
int index_);
gboolean (* get_iter) (GtkTreeModel *tree_model,
GtkTreeIter *iter,
GtkTreePath *path);
GtkTreePath *(* get_path) (GtkTreeModel *tree_model,
GtkTreeIter *iter);
void (* get_value) (GtkTreeModel *tree_model,
GtkTreeIter *iter,
2020-07-24 13:54:49 +00:00
int column,
GValue *value);
gboolean (* iter_next) (GtkTreeModel *tree_model,
GtkTreeIter *iter);
gboolean (* iter_previous) (GtkTreeModel *tree_model,
GtkTreeIter *iter);
gboolean (* iter_children) (GtkTreeModel *tree_model,
GtkTreeIter *iter,
GtkTreeIter *parent);
gboolean (* iter_has_child) (GtkTreeModel *tree_model,
GtkTreeIter *iter);
2020-07-24 13:54:49 +00:00
int (* iter_n_children) (GtkTreeModel *tree_model,
GtkTreeIter *iter);
gboolean (* iter_nth_child) (GtkTreeModel *tree_model,
GtkTreeIter *iter,
GtkTreeIter *parent,
2020-07-24 13:54:49 +00:00
int n);
gboolean (* iter_parent) (GtkTreeModel *tree_model,
GtkTreeIter *iter,
GtkTreeIter *child);
void (* ref_node) (GtkTreeModel *tree_model,
GtkTreeIter *iter);
void (* unref_node) (GtkTreeModel *tree_model,
GtkTreeIter *iter);
};
/* GtkTreePath operations */
GDK_AVAILABLE_IN_ALL
GtkTreePath *gtk_tree_path_new (void);
GDK_AVAILABLE_IN_ALL
2020-07-24 18:40:36 +00:00
GtkTreePath *gtk_tree_path_new_from_string (const char *path);
GDK_AVAILABLE_IN_ALL
2020-07-24 13:54:49 +00:00
GtkTreePath *gtk_tree_path_new_from_indices (int first_index,
API additions: _move, _reorder and _swap for stores, path constructor. Fri Jul 26 22:53:37 2002 Kristian Rietveld <kris@gtk.org> API additions: _move, _reorder and _swap for stores, path constructor. * gtk/gtktreemodel.[ch] (gtk_tree_path_new_from_indices): new function. * gtk/gtkliststore.[ch]: added gtk_list_store_reorder_func (private), gtk_list_store_reorder, gtk_list_store_swap, gtk_list_store_move. * gtk/gtktreestore.[ch]: added gtk_tree_store_reorder_func (private), gtk_tree_store_reorder, gtk_tree_store_swap, gtk_tree_store_move. Fri Jul 26 22:32:57 2002 Kristian Rietveld <kris@gtk.org> Merge from stable: * gtk/gtktreestore.c (node_free): return FALSE, (gtk_tree_store_finalize): use g_node_traverse instead of g_node_children_foreach, so the whole tree will be freed (#88854, patch from Emmanuel Briot). Fri Jul 26 22:32:24 2002 Kristian Rietveld <kris@gtk.org> Merge from stable: * gtk/gtktreeview.c (gtk_tree_view_button_press): fix some memleaks, (#84426, patch from Matthias Clasen). Fri Jul 26 22:31:25 2002 Kristian Rietveld <kris@gtk.org> Merge from stable: * gtk/gtktreeview.c (gtk_tree_view_unref_tree_helper): _iter_children check shouldn't be in g_return_return_val_if_fail (pointed out by Josh Green, #88997), (gtk_tree_view_set_model): call _gtk_tree_view_column_unset_model for each column when we unset the model (part of #82484), (gtk_tree_view_get_cell_area): return if we ran out of tree or if we got an invalid path (#82376). * gtk/gtktreeprivate.h: add _gtk_tree_view_column_unset_model. * gtk/gtktreeviewcolumn.c: implement _gtk_tree_view_column_unset_model which disconnects the sort_column_changed_signal (part of #82484). * gtk/gtkliststore.c (gtk_list_store_insert): append row if the given postion is off the end of the tree (#85813). * gtk/gtkentry.c (gtk_cell_editable_key_press_event): let's use 2-space indent, commit changes if up/down keys has been pressed, this overrides the focus key foo so the user won't be surprised (#84665).
2002-07-26 20:51:13 +00:00
...);
GDK_AVAILABLE_IN_ALL
2020-07-24 13:54:49 +00:00
GtkTreePath *gtk_tree_path_new_from_indicesv (int *indices,
gsize length);
GDK_AVAILABLE_IN_ALL
2020-07-24 18:40:36 +00:00
char *gtk_tree_path_to_string (GtkTreePath *path);
GDK_AVAILABLE_IN_ALL
GtkTreePath *gtk_tree_path_new_first (void);
GDK_AVAILABLE_IN_ALL
void gtk_tree_path_append_index (GtkTreePath *path,
2020-07-24 13:54:49 +00:00
int index_);
GDK_AVAILABLE_IN_ALL
void gtk_tree_path_prepend_index (GtkTreePath *path,
2020-07-24 13:54:49 +00:00
int index_);
GDK_AVAILABLE_IN_ALL
2020-07-24 13:54:49 +00:00
int gtk_tree_path_get_depth (GtkTreePath *path);
GDK_AVAILABLE_IN_ALL
2020-07-24 13:54:49 +00:00
int *gtk_tree_path_get_indices (GtkTreePath *path);
GDK_AVAILABLE_IN_ALL
2020-07-24 13:54:49 +00:00
int *gtk_tree_path_get_indices_with_depth (GtkTreePath *path,
int *depth);
GDK_AVAILABLE_IN_ALL
void gtk_tree_path_free (GtkTreePath *path);
GDK_AVAILABLE_IN_ALL
GtkTreePath *gtk_tree_path_copy (const GtkTreePath *path);
GDK_AVAILABLE_IN_ALL
Mark as const. 2004-11-23 Matthias Clasen <mclasen@redhat.com> * gtk/gtkuimanager.h (gtk_ui_manager_get_type): * gtk/gtktreeview.h (gtk_tree_view_get_type): * gtk/gtktreeviewcolumn.h (gtk_tree_view_column_get_type): * gtk/gtktreestore.h (gtk_tree_store_get_type): * gtk/gtktreeselection.h (gtk_tree_selection_get_type): * gtk/gtktreemodelfilter.h (gtk_tree_model_filter_get_type): * gtk/gtktreemodel.h (gtk_tree_iter_get_type): (gtk_tree_path_get_type): (gtk_tree_row_reference_get_type): * gtk/gtktoolitem.h (gtk_tool_item_get_type): * gtk/gtktoolbutton.h (gtk_tool_button_get_type): * gtk/gtktoggleaction.h (gtk_toggle_action_get_type): * gtk/gtkthemes.h (gtk_theme_engine_get_type): * gtk/gtktextiter.h (gtk_text_iter_get_type): * gtk/gtksettings.h (gtk_settings_get_type): * gtk/gtkselection.h (gtk_selection_data_get_type): * gtk/gtkradioaction.h (gtk_radio_action_get_type): * gtk/gtkmenutoolbutton.h (gtk_menu_tool_button_get_type): * gtk/gtkliststore.h (gtk_list_store_get_type): * gtk/gtkiconview.h (gtk_icon_view_get_type): * gtk/gtkicontheme.h (gtk_icon_info_get_type): * gtk/gtkiconfactory.h (gtk_icon_factory_get_type): (gtk_icon_set_get_type): (gtk_icon_source_get_type): * gtk/gtkfilesystemwin32.h (gtk_file_system_win32_get_type): * gtk/gtkfilesystemunix.h (gtk_file_system_unix_get_type): * gtk/gtkfilesystem.h (gtk_file_folder_get_type): (gtk_file_info_get_type, gtk_file_path_get_type): (gtk_file_system_get_type): * gtk/gtkfilefilter.h (gtk_file_filter_get_type): * gtk/gtkfilechooserwidget.h (gtk_file_chooser_widget_get_type): * gtk/gtkfilechooser.h (gtk_file_chooser_get_type): * gtk/gtkfilechooserdialog.h (gtk_file_chooser_dialog_get_type): * gtk/gtkexpander.h (gtk_expander_get_type): * gtk/gtkentrycompletion.h (gtk_entry_completion_get_type): * gtk/gtkcombobox.h (gtk_combo_box_get_type): * gtk/gtkcomboboxentry.h (gtk_combo_box_entry_get_type): * gtk/gtkclipboard.h (gtk_clipboard_get_type): * gtk/gtkcellview.h (gtk_cell_view_get_type): * gtk/gtkcellrenderertoggle.h (gtk_cell_renderer_toggle_get_type): * gtk/gtkcellrenderertext.h (gtk_cell_renderer_text_get_type): * gtk/gtkcellrendererprogress.h (gtk_cell_renderer_progress_get_type): * gtk/gtkcellrendererpixbuf.h (gtk_cell_renderer_pixbuf_get_type): * gtk/gtkcellrenderercombo.h (gtk_cell_renderer_combo_get_type): * gtk/gtkcelllayout.h (gtk_cell_layout_get_type): * gtk/gtkactiongroup.h (gtk_action_group_get_type): * gtk/gtkaction.h (gtk_action_get_type): * gtk/gtkaccessible.h (gtk_accessible_get_type): * gtk/gtkaccelmap.h (gtk_accel_map_get_type): * gtk/gtkaccelgroup.h (gtk_accel_group_get_type): * gtk/gtkmessagedialog.h (gtk_message_dialog_get_type): Mark as const. * gtk/gtkicontheme.h: Don't mark gtk_icon_theme_error_quark() as const, to be consistent with all the other error_quark functions. (technically they are const, but since these are called only in error paths, giving the compiler better optimization opportunities doesn't matter much) * gtk/gtk.symbols: * gdk/gdk.symbols: Add attribute annotations. * gtk/makegtkalias.pl: * gdk/makegdkalias.pl: Keep attribute annotations, but strip PRIVATE. * gtk/Makefile.am (gtk.def): * gdk/Makefile.am (gdk.def): Strip attribute annotations, but keep PRIVATE.
2004-11-23 20:02:15 +00:00
GType gtk_tree_path_get_type (void) G_GNUC_CONST;
GDK_AVAILABLE_IN_ALL
2020-07-24 13:54:49 +00:00
int gtk_tree_path_compare (const GtkTreePath *a,
const GtkTreePath *b);
GDK_AVAILABLE_IN_ALL
void gtk_tree_path_next (GtkTreePath *path);
GDK_AVAILABLE_IN_ALL
gboolean gtk_tree_path_prev (GtkTreePath *path);
GDK_AVAILABLE_IN_ALL
gboolean gtk_tree_path_up (GtkTreePath *path);
GDK_AVAILABLE_IN_ALL
void gtk_tree_path_down (GtkTreePath *path);
GDK_AVAILABLE_IN_ALL
fix bug in here where prev pointer was set to the wrong thing 2001-01-30 Havoc Pennington <hp@redhat.com> * gtk/gtkliststore.c (gtk_list_store_insert_before): fix bug in here where prev pointer was set to the wrong thing * gtk/gtktreemodel.c (gtk_tree_path_is_ancestor): new function (gtk_tree_path_is_descendant): new function * gtk/gtkliststore.c (gtk_list_store_iter_n_children): return cached length (gtk_list_store_get_iter): don't modify iter if we can't get the path. * gtk/gtkliststore.h (struct _GtkListStore): cache the length * gtk/gtktreednd.h: add virtual function row_drop_possible() to GtkTreeDragDest * gtk/gtktreestore.c (copy_node_data): fix varargs type error that was causing segfault * gtk/gtktreedatalist.c (_gtk_tree_data_list_node_copy): set next pointer to NULL * gtk/gtktreestore.c (gtk_tree_store_append): fix memleak * gtk/gtkliststore.c (gtk_list_store_iter_next): don't modify iter on returning FALSE (gtk_list_store_iter_children): ditto (gtk_list_store_iter_nth_child): ditto (gtk_list_store_iter_nth_child): ditto (gtk_list_store_iter_parent): ditto * gtk/gtktreestore.c (gtk_tree_store_get_path): g_return_if_fail on iter->user_data != NULL instead of silently accepting it. (gtk_tree_store_iter_next): ditto. Also, don't modify iter unless we are returning TRUE. (gtk_tree_store_iter_children): ditto (gtk_tree_store_iter_nth_child): ditto (gtk_tree_store_iter_parent): ditto (gtk_tree_store_insert): remove handling of parent->user_data == NULL, replace with parent == NULL * gtk/gtktreemodel.c (inserted_callback): put some fixes in here, and a comment explaining things * gtk/gtktreestore.c: add GtkTreeDragSource/GtkTreeDragDest interface support to GtkTreeStore. * gtk/gtktreemodel.c (gtk_tree_path_prev): didn't properly return FALSE if no prev, fix * gtk/gtktreeview.c (set_source_row): use a row reference (set_dest_row): use a row reference
2001-01-31 00:57:49 +00:00
gboolean gtk_tree_path_is_ancestor (GtkTreePath *path,
GtkTreePath *descendant);
GDK_AVAILABLE_IN_ALL
fix bug in here where prev pointer was set to the wrong thing 2001-01-30 Havoc Pennington <hp@redhat.com> * gtk/gtkliststore.c (gtk_list_store_insert_before): fix bug in here where prev pointer was set to the wrong thing * gtk/gtktreemodel.c (gtk_tree_path_is_ancestor): new function (gtk_tree_path_is_descendant): new function * gtk/gtkliststore.c (gtk_list_store_iter_n_children): return cached length (gtk_list_store_get_iter): don't modify iter if we can't get the path. * gtk/gtkliststore.h (struct _GtkListStore): cache the length * gtk/gtktreednd.h: add virtual function row_drop_possible() to GtkTreeDragDest * gtk/gtktreestore.c (copy_node_data): fix varargs type error that was causing segfault * gtk/gtktreedatalist.c (_gtk_tree_data_list_node_copy): set next pointer to NULL * gtk/gtktreestore.c (gtk_tree_store_append): fix memleak * gtk/gtkliststore.c (gtk_list_store_iter_next): don't modify iter on returning FALSE (gtk_list_store_iter_children): ditto (gtk_list_store_iter_nth_child): ditto (gtk_list_store_iter_nth_child): ditto (gtk_list_store_iter_parent): ditto * gtk/gtktreestore.c (gtk_tree_store_get_path): g_return_if_fail on iter->user_data != NULL instead of silently accepting it. (gtk_tree_store_iter_next): ditto. Also, don't modify iter unless we are returning TRUE. (gtk_tree_store_iter_children): ditto (gtk_tree_store_iter_nth_child): ditto (gtk_tree_store_iter_parent): ditto (gtk_tree_store_insert): remove handling of parent->user_data == NULL, replace with parent == NULL * gtk/gtktreemodel.c (inserted_callback): put some fixes in here, and a comment explaining things * gtk/gtktreestore.c: add GtkTreeDragSource/GtkTreeDragDest interface support to GtkTreeStore. * gtk/gtktreemodel.c (gtk_tree_path_prev): didn't properly return FALSE if no prev, fix * gtk/gtktreeview.c (set_source_row): use a row reference (set_dest_row): use a row reference
2001-01-31 00:57:49 +00:00
gboolean gtk_tree_path_is_descendant (GtkTreePath *path,
GtkTreePath *ancestor);
/**
* GtkTreeRowReference:
*
* A GtkTreeRowReference tracks model changes so that it always refers to the
* same row (a `GtkTreePath` refers to a position, not a fixed row). Create a
* new GtkTreeRowReference with gtk_tree_row_reference_new().
*/
GDK_AVAILABLE_IN_ALL
Mark as const. 2004-11-23 Matthias Clasen <mclasen@redhat.com> * gtk/gtkuimanager.h (gtk_ui_manager_get_type): * gtk/gtktreeview.h (gtk_tree_view_get_type): * gtk/gtktreeviewcolumn.h (gtk_tree_view_column_get_type): * gtk/gtktreestore.h (gtk_tree_store_get_type): * gtk/gtktreeselection.h (gtk_tree_selection_get_type): * gtk/gtktreemodelfilter.h (gtk_tree_model_filter_get_type): * gtk/gtktreemodel.h (gtk_tree_iter_get_type): (gtk_tree_path_get_type): (gtk_tree_row_reference_get_type): * gtk/gtktoolitem.h (gtk_tool_item_get_type): * gtk/gtktoolbutton.h (gtk_tool_button_get_type): * gtk/gtktoggleaction.h (gtk_toggle_action_get_type): * gtk/gtkthemes.h (gtk_theme_engine_get_type): * gtk/gtktextiter.h (gtk_text_iter_get_type): * gtk/gtksettings.h (gtk_settings_get_type): * gtk/gtkselection.h (gtk_selection_data_get_type): * gtk/gtkradioaction.h (gtk_radio_action_get_type): * gtk/gtkmenutoolbutton.h (gtk_menu_tool_button_get_type): * gtk/gtkliststore.h (gtk_list_store_get_type): * gtk/gtkiconview.h (gtk_icon_view_get_type): * gtk/gtkicontheme.h (gtk_icon_info_get_type): * gtk/gtkiconfactory.h (gtk_icon_factory_get_type): (gtk_icon_set_get_type): (gtk_icon_source_get_type): * gtk/gtkfilesystemwin32.h (gtk_file_system_win32_get_type): * gtk/gtkfilesystemunix.h (gtk_file_system_unix_get_type): * gtk/gtkfilesystem.h (gtk_file_folder_get_type): (gtk_file_info_get_type, gtk_file_path_get_type): (gtk_file_system_get_type): * gtk/gtkfilefilter.h (gtk_file_filter_get_type): * gtk/gtkfilechooserwidget.h (gtk_file_chooser_widget_get_type): * gtk/gtkfilechooser.h (gtk_file_chooser_get_type): * gtk/gtkfilechooserdialog.h (gtk_file_chooser_dialog_get_type): * gtk/gtkexpander.h (gtk_expander_get_type): * gtk/gtkentrycompletion.h (gtk_entry_completion_get_type): * gtk/gtkcombobox.h (gtk_combo_box_get_type): * gtk/gtkcomboboxentry.h (gtk_combo_box_entry_get_type): * gtk/gtkclipboard.h (gtk_clipboard_get_type): * gtk/gtkcellview.h (gtk_cell_view_get_type): * gtk/gtkcellrenderertoggle.h (gtk_cell_renderer_toggle_get_type): * gtk/gtkcellrenderertext.h (gtk_cell_renderer_text_get_type): * gtk/gtkcellrendererprogress.h (gtk_cell_renderer_progress_get_type): * gtk/gtkcellrendererpixbuf.h (gtk_cell_renderer_pixbuf_get_type): * gtk/gtkcellrenderercombo.h (gtk_cell_renderer_combo_get_type): * gtk/gtkcelllayout.h (gtk_cell_layout_get_type): * gtk/gtkactiongroup.h (gtk_action_group_get_type): * gtk/gtkaction.h (gtk_action_get_type): * gtk/gtkaccessible.h (gtk_accessible_get_type): * gtk/gtkaccelmap.h (gtk_accel_map_get_type): * gtk/gtkaccelgroup.h (gtk_accel_group_get_type): * gtk/gtkmessagedialog.h (gtk_message_dialog_get_type): Mark as const. * gtk/gtkicontheme.h: Don't mark gtk_icon_theme_error_quark() as const, to be consistent with all the other error_quark functions. (technically they are const, but since these are called only in error paths, giving the compiler better optimization opportunities doesn't matter much) * gtk/gtk.symbols: * gdk/gdk.symbols: Add attribute annotations. * gtk/makegtkalias.pl: * gdk/makegdkalias.pl: Keep attribute annotations, but strip PRIVATE. * gtk/Makefile.am (gtk.def): * gdk/Makefile.am (gdk.def): Strip attribute annotations, but keep PRIVATE.
2004-11-23 20:02:15 +00:00
GType gtk_tree_row_reference_get_type (void) G_GNUC_CONST;
GDK_AVAILABLE_IN_ALL
GtkTreeRowReference *gtk_tree_row_reference_new (GtkTreeModel *model,
GtkTreePath *path);
GDK_AVAILABLE_IN_ALL
GtkTreeRowReference *gtk_tree_row_reference_new_proxy (GObject *proxy,
GtkTreeModel *model,
GtkTreePath *path);
GDK_AVAILABLE_IN_ALL
GtkTreePath *gtk_tree_row_reference_get_path (GtkTreeRowReference *reference);
GDK_AVAILABLE_IN_ALL
GtkTreeModel *gtk_tree_row_reference_get_model (GtkTreeRowReference *reference);
GDK_AVAILABLE_IN_ALL
gboolean gtk_tree_row_reference_valid (GtkTreeRowReference *reference);
GDK_AVAILABLE_IN_ALL
GtkTreeRowReference *gtk_tree_row_reference_copy (GtkTreeRowReference *reference);
GDK_AVAILABLE_IN_ALL
void gtk_tree_row_reference_free (GtkTreeRowReference *reference);
/* These two functions are only needed if you created the row reference with a
* proxy object */
GDK_AVAILABLE_IN_ALL
void gtk_tree_row_reference_inserted (GObject *proxy,
GtkTreePath *path);
GDK_AVAILABLE_IN_ALL
void gtk_tree_row_reference_deleted (GObject *proxy,
GtkTreePath *path);
GDK_AVAILABLE_IN_ALL
void gtk_tree_row_reference_reordered (GObject *proxy,
GtkTreePath *path,
GtkTreeIter *iter,
2020-07-24 13:54:49 +00:00
int *new_order);
/* GtkTreeIter operations */
GDK_AVAILABLE_IN_ALL
GtkTreeIter * gtk_tree_iter_copy (GtkTreeIter *iter);
GDK_AVAILABLE_IN_ALL
void gtk_tree_iter_free (GtkTreeIter *iter);
GDK_AVAILABLE_IN_ALL
Mark as const. 2004-11-23 Matthias Clasen <mclasen@redhat.com> * gtk/gtkuimanager.h (gtk_ui_manager_get_type): * gtk/gtktreeview.h (gtk_tree_view_get_type): * gtk/gtktreeviewcolumn.h (gtk_tree_view_column_get_type): * gtk/gtktreestore.h (gtk_tree_store_get_type): * gtk/gtktreeselection.h (gtk_tree_selection_get_type): * gtk/gtktreemodelfilter.h (gtk_tree_model_filter_get_type): * gtk/gtktreemodel.h (gtk_tree_iter_get_type): (gtk_tree_path_get_type): (gtk_tree_row_reference_get_type): * gtk/gtktoolitem.h (gtk_tool_item_get_type): * gtk/gtktoolbutton.h (gtk_tool_button_get_type): * gtk/gtktoggleaction.h (gtk_toggle_action_get_type): * gtk/gtkthemes.h (gtk_theme_engine_get_type): * gtk/gtktextiter.h (gtk_text_iter_get_type): * gtk/gtksettings.h (gtk_settings_get_type): * gtk/gtkselection.h (gtk_selection_data_get_type): * gtk/gtkradioaction.h (gtk_radio_action_get_type): * gtk/gtkmenutoolbutton.h (gtk_menu_tool_button_get_type): * gtk/gtkliststore.h (gtk_list_store_get_type): * gtk/gtkiconview.h (gtk_icon_view_get_type): * gtk/gtkicontheme.h (gtk_icon_info_get_type): * gtk/gtkiconfactory.h (gtk_icon_factory_get_type): (gtk_icon_set_get_type): (gtk_icon_source_get_type): * gtk/gtkfilesystemwin32.h (gtk_file_system_win32_get_type): * gtk/gtkfilesystemunix.h (gtk_file_system_unix_get_type): * gtk/gtkfilesystem.h (gtk_file_folder_get_type): (gtk_file_info_get_type, gtk_file_path_get_type): (gtk_file_system_get_type): * gtk/gtkfilefilter.h (gtk_file_filter_get_type): * gtk/gtkfilechooserwidget.h (gtk_file_chooser_widget_get_type): * gtk/gtkfilechooser.h (gtk_file_chooser_get_type): * gtk/gtkfilechooserdialog.h (gtk_file_chooser_dialog_get_type): * gtk/gtkexpander.h (gtk_expander_get_type): * gtk/gtkentrycompletion.h (gtk_entry_completion_get_type): * gtk/gtkcombobox.h (gtk_combo_box_get_type): * gtk/gtkcomboboxentry.h (gtk_combo_box_entry_get_type): * gtk/gtkclipboard.h (gtk_clipboard_get_type): * gtk/gtkcellview.h (gtk_cell_view_get_type): * gtk/gtkcellrenderertoggle.h (gtk_cell_renderer_toggle_get_type): * gtk/gtkcellrenderertext.h (gtk_cell_renderer_text_get_type): * gtk/gtkcellrendererprogress.h (gtk_cell_renderer_progress_get_type): * gtk/gtkcellrendererpixbuf.h (gtk_cell_renderer_pixbuf_get_type): * gtk/gtkcellrenderercombo.h (gtk_cell_renderer_combo_get_type): * gtk/gtkcelllayout.h (gtk_cell_layout_get_type): * gtk/gtkactiongroup.h (gtk_action_group_get_type): * gtk/gtkaction.h (gtk_action_get_type): * gtk/gtkaccessible.h (gtk_accessible_get_type): * gtk/gtkaccelmap.h (gtk_accel_map_get_type): * gtk/gtkaccelgroup.h (gtk_accel_group_get_type): * gtk/gtkmessagedialog.h (gtk_message_dialog_get_type): Mark as const. * gtk/gtkicontheme.h: Don't mark gtk_icon_theme_error_quark() as const, to be consistent with all the other error_quark functions. (technically they are const, but since these are called only in error paths, giving the compiler better optimization opportunities doesn't matter much) * gtk/gtk.symbols: * gdk/gdk.symbols: Add attribute annotations. * gtk/makegtkalias.pl: * gdk/makegdkalias.pl: Keep attribute annotations, but strip PRIVATE. * gtk/Makefile.am (gtk.def): * gdk/Makefile.am (gdk.def): Strip attribute annotations, but keep PRIVATE.
2004-11-23 20:02:15 +00:00
GType gtk_tree_iter_get_type (void) G_GNUC_CONST;
GDK_AVAILABLE_IN_ALL
GType gtk_tree_model_get_type (void) G_GNUC_CONST;
GDK_AVAILABLE_IN_ALL
GtkTreeModelFlags gtk_tree_model_get_flags (GtkTreeModel *tree_model);
GDK_AVAILABLE_IN_ALL
2020-07-24 13:54:49 +00:00
int gtk_tree_model_get_n_columns (GtkTreeModel *tree_model);
GDK_AVAILABLE_IN_ALL
GType gtk_tree_model_get_column_type (GtkTreeModel *tree_model,
2020-07-24 13:54:49 +00:00
int index_);
/* Iterator movement */
GDK_AVAILABLE_IN_ALL
gboolean gtk_tree_model_get_iter (GtkTreeModel *tree_model,
GtkTreeIter *iter,
GtkTreePath *path);
GDK_AVAILABLE_IN_ALL
gboolean gtk_tree_model_get_iter_from_string (GtkTreeModel *tree_model,
GtkTreeIter *iter,
2020-07-24 18:40:36 +00:00
const char *path_string);
GDK_AVAILABLE_IN_ALL
2020-07-24 18:40:36 +00:00
char * gtk_tree_model_get_string_from_iter (GtkTreeModel *tree_model,
GtkTreeIter *iter);
GDK_AVAILABLE_IN_ALL
gboolean gtk_tree_model_get_iter_first (GtkTreeModel *tree_model,
GtkTreeIter *iter);
GDK_AVAILABLE_IN_ALL
GtkTreePath * gtk_tree_model_get_path (GtkTreeModel *tree_model,
GtkTreeIter *iter);
GDK_AVAILABLE_IN_ALL
void gtk_tree_model_get_value (GtkTreeModel *tree_model,
GtkTreeIter *iter,
2020-07-24 13:54:49 +00:00
int column,
GValue *value);
GDK_AVAILABLE_IN_ALL
gboolean gtk_tree_model_iter_previous (GtkTreeModel *tree_model,
GtkTreeIter *iter);
GDK_AVAILABLE_IN_ALL
gboolean gtk_tree_model_iter_next (GtkTreeModel *tree_model,
GtkTreeIter *iter);
GDK_AVAILABLE_IN_ALL
gboolean gtk_tree_model_iter_children (GtkTreeModel *tree_model,
GtkTreeIter *iter,
GtkTreeIter *parent);
GDK_AVAILABLE_IN_ALL
gboolean gtk_tree_model_iter_has_child (GtkTreeModel *tree_model,
GtkTreeIter *iter);
GDK_AVAILABLE_IN_ALL
2020-07-24 13:54:49 +00:00
int gtk_tree_model_iter_n_children (GtkTreeModel *tree_model,
GtkTreeIter *iter);
GDK_AVAILABLE_IN_ALL
gboolean gtk_tree_model_iter_nth_child (GtkTreeModel *tree_model,
GtkTreeIter *iter,
GtkTreeIter *parent,
2020-07-24 13:54:49 +00:00
int n);
GDK_AVAILABLE_IN_ALL
gboolean gtk_tree_model_iter_parent (GtkTreeModel *tree_model,
GtkTreeIter *iter,
GtkTreeIter *child);
GDK_AVAILABLE_IN_ALL
void gtk_tree_model_ref_node (GtkTreeModel *tree_model,
GtkTreeIter *iter);
GDK_AVAILABLE_IN_ALL
void gtk_tree_model_unref_node (GtkTreeModel *tree_model,
GtkTreeIter *iter);
GDK_AVAILABLE_IN_ALL
void gtk_tree_model_get (GtkTreeModel *tree_model,
GtkTreeIter *iter,
...);
GDK_AVAILABLE_IN_ALL
void gtk_tree_model_get_valist (GtkTreeModel *tree_model,
GtkTreeIter *iter,
va_list var_args);
GDK_AVAILABLE_IN_ALL
void gtk_tree_model_foreach (GtkTreeModel *model,
GtkTreeModelForeachFunc func,
gpointer user_data);
/* Signals */
GDK_AVAILABLE_IN_ALL
void gtk_tree_model_row_changed (GtkTreeModel *tree_model,
GtkTreePath *path,
GtkTreeIter *iter);
GDK_AVAILABLE_IN_ALL
void gtk_tree_model_row_inserted (GtkTreeModel *tree_model,
GtkTreePath *path,
GtkTreeIter *iter);
GDK_AVAILABLE_IN_ALL
void gtk_tree_model_row_has_child_toggled (GtkTreeModel *tree_model,
GtkTreePath *path,
GtkTreeIter *iter);
GDK_AVAILABLE_IN_ALL
void gtk_tree_model_row_deleted (GtkTreeModel *tree_model,
GtkTreePath *path);
GDK_AVAILABLE_IN_ALL
void gtk_tree_model_rows_reordered (GtkTreeModel *tree_model,
GtkTreePath *path,
GtkTreeIter *iter,
2020-07-24 13:54:49 +00:00
int *new_order);
GDK_AVAILABLE_IN_ALL
void gtk_tree_model_rows_reordered_with_length (GtkTreeModel *tree_model,
GtkTreePath *path,
GtkTreeIter *iter,
2020-07-24 13:54:49 +00:00
int *new_order,
int length);
G_DEFINE_AUTOPTR_CLEANUP_FUNC(GtkTreeModel, g_object_unref)
G_DEFINE_AUTOPTR_CLEANUP_FUNC(GtkTreeIter, gtk_tree_iter_free)
G_DEFINE_AUTOPTR_CLEANUP_FUNC(GtkTreePath, gtk_tree_path_free)
G_DEFINE_AUTOPTR_CLEANUP_FUNC(GtkTreeRowReference, gtk_tree_row_reference_free)
G_END_DECLS
#endif /* __GTK_TREE_MODEL_H__ */