2018-06-12 01:56:21 +00:00
|
|
|
/*
|
|
|
|
* Copyright © 2018 Benjamin Otte
|
|
|
|
*
|
|
|
|
* This library is free software; you can redistribute it and/or
|
|
|
|
* modify it under the terms of the GNU Lesser General Public
|
|
|
|
* License as published by the Free Software Foundation; either
|
|
|
|
* version 2.1 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
|
|
|
|
* Lesser General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU Lesser General Public
|
|
|
|
* License along with this library. If not, see <http://www.gnu.org/licenses/>.
|
|
|
|
*
|
|
|
|
* Authors: Benjamin Otte <otte@gnome.org>
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef __GTK_TREE_LIST_MODEL_H__
|
|
|
|
#define __GTK_TREE_LIST_MODEL_H__
|
|
|
|
|
|
|
|
|
|
|
|
#if !defined (__GTK_H_INSIDE__) && !defined (GTK_COMPILATION)
|
|
|
|
#error "Only <gtk/gtk.h> can be included directly."
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#include <gio/gio.h>
|
|
|
|
#include <gtk/gtkwidget.h>
|
|
|
|
|
|
|
|
|
|
|
|
G_BEGIN_DECLS
|
|
|
|
|
|
|
|
#define GTK_TYPE_TREE_LIST_MODEL (gtk_tree_list_model_get_type ())
|
2018-09-01 02:59:06 +00:00
|
|
|
#define GTK_TYPE_TREE_LIST_ROW (gtk_tree_list_row_get_type ())
|
2018-06-12 01:56:21 +00:00
|
|
|
|
|
|
|
GDK_AVAILABLE_IN_ALL
|
|
|
|
G_DECLARE_FINAL_TYPE (GtkTreeListModel, gtk_tree_list_model, GTK, TREE_LIST_MODEL, GObject)
|
2018-09-01 02:59:06 +00:00
|
|
|
GDK_AVAILABLE_IN_ALL
|
|
|
|
G_DECLARE_FINAL_TYPE (GtkTreeListRow, gtk_tree_list_row, GTK, TREE_LIST_ROW, GObject)
|
2018-06-12 01:56:21 +00:00
|
|
|
|
2018-09-16 17:38:25 +00:00
|
|
|
/**
|
|
|
|
* GtkTreeListModelCreateModelFunc:
|
2018-09-18 05:27:48 +00:00
|
|
|
* @item: (type GObject): The item that is being expanded
|
2018-09-17 11:00:36 +00:00
|
|
|
* @user_data: User data passed when registering the function
|
2018-09-16 17:38:25 +00:00
|
|
|
*
|
|
|
|
* Prototype of the function called to create new child models when
|
|
|
|
* gtk_tree_list_row_set_expanded() is called.
|
2018-09-18 05:27:48 +00:00
|
|
|
*
|
|
|
|
* This function can return %NULL to indicate that @item is guaranteed to be
|
2020-06-05 21:08:29 +00:00
|
|
|
* a leaf node and will never have children.
|
2018-09-18 05:27:48 +00:00
|
|
|
* If it does not have children but may get children later, it should return
|
|
|
|
* an empty model that is filled once children arrive.
|
|
|
|
*
|
2019-12-08 03:39:35 +00:00
|
|
|
* Returns: (nullable) (transfer full): The model tracking the children of @item or %NULL if
|
2018-09-18 05:27:48 +00:00
|
|
|
* @item can never have children
|
2018-09-16 17:38:25 +00:00
|
|
|
*/
|
2018-09-17 11:00:36 +00:00
|
|
|
typedef GListModel * (* GtkTreeListModelCreateModelFunc) (gpointer item, gpointer user_data);
|
2018-06-12 01:56:21 +00:00
|
|
|
|
|
|
|
GDK_AVAILABLE_IN_ALL
|
2018-09-01 02:59:06 +00:00
|
|
|
GtkTreeListModel * gtk_tree_list_model_new (gboolean passthrough,
|
|
|
|
GListModel *root,
|
2018-06-12 01:56:21 +00:00
|
|
|
gboolean autoexpand,
|
|
|
|
GtkTreeListModelCreateModelFunc create_func,
|
2018-09-17 11:00:36 +00:00
|
|
|
gpointer user_data,
|
|
|
|
GDestroyNotify user_destroy);
|
2018-06-12 01:56:21 +00:00
|
|
|
|
2018-09-01 16:48:38 +00:00
|
|
|
GDK_AVAILABLE_IN_ALL
|
|
|
|
GListModel * gtk_tree_list_model_get_model (GtkTreeListModel *self);
|
2018-09-01 02:59:06 +00:00
|
|
|
GDK_AVAILABLE_IN_ALL
|
|
|
|
gboolean gtk_tree_list_model_get_passthrough (GtkTreeListModel *self);
|
2018-06-12 01:56:21 +00:00
|
|
|
GDK_AVAILABLE_IN_ALL
|
|
|
|
void gtk_tree_list_model_set_autoexpand (GtkTreeListModel *self,
|
|
|
|
gboolean autoexpand);
|
|
|
|
GDK_AVAILABLE_IN_ALL
|
|
|
|
gboolean gtk_tree_list_model_get_autoexpand (GtkTreeListModel *self);
|
|
|
|
|
2018-09-01 16:48:38 +00:00
|
|
|
GDK_AVAILABLE_IN_ALL
|
2018-09-18 05:50:33 +00:00
|
|
|
GtkTreeListRow * gtk_tree_list_model_get_child_row (GtkTreeListModel *self,
|
2018-09-01 16:48:38 +00:00
|
|
|
guint position);
|
2018-06-12 01:56:21 +00:00
|
|
|
GDK_AVAILABLE_IN_ALL
|
2018-09-01 02:59:06 +00:00
|
|
|
GtkTreeListRow * gtk_tree_list_model_get_row (GtkTreeListModel *self,
|
2018-06-12 01:56:21 +00:00
|
|
|
guint position);
|
2018-09-01 02:59:06 +00:00
|
|
|
|
|
|
|
GDK_AVAILABLE_IN_ALL
|
|
|
|
gpointer gtk_tree_list_row_get_item (GtkTreeListRow *self);
|
2018-06-12 01:56:21 +00:00
|
|
|
GDK_AVAILABLE_IN_ALL
|
2018-09-01 02:59:06 +00:00
|
|
|
void gtk_tree_list_row_set_expanded (GtkTreeListRow *self,
|
2018-06-12 01:56:21 +00:00
|
|
|
gboolean expanded);
|
|
|
|
GDK_AVAILABLE_IN_ALL
|
2018-09-01 02:59:06 +00:00
|
|
|
gboolean gtk_tree_list_row_get_expanded (GtkTreeListRow *self);
|
2018-06-12 01:56:21 +00:00
|
|
|
GDK_AVAILABLE_IN_ALL
|
2018-09-01 02:59:06 +00:00
|
|
|
gboolean gtk_tree_list_row_is_expandable (GtkTreeListRow *self);
|
2018-09-01 16:48:38 +00:00
|
|
|
GDK_AVAILABLE_IN_ALL
|
|
|
|
guint gtk_tree_list_row_get_position (GtkTreeListRow *self);
|
|
|
|
GDK_AVAILABLE_IN_ALL
|
|
|
|
guint gtk_tree_list_row_get_depth (GtkTreeListRow *self);
|
|
|
|
GDK_AVAILABLE_IN_ALL
|
|
|
|
GListModel * gtk_tree_list_row_get_children (GtkTreeListRow *self);
|
|
|
|
GDK_AVAILABLE_IN_ALL
|
|
|
|
GtkTreeListRow * gtk_tree_list_row_get_parent (GtkTreeListRow *self);
|
|
|
|
GDK_AVAILABLE_IN_ALL
|
2018-09-18 05:50:33 +00:00
|
|
|
GtkTreeListRow * gtk_tree_list_row_get_child_row (GtkTreeListRow *self,
|
2018-09-17 11:00:36 +00:00
|
|
|
guint position);
|
2018-06-12 01:56:21 +00:00
|
|
|
|
|
|
|
|
|
|
|
G_END_DECLS
|
|
|
|
|
|
|
|
#endif /* __GTK_TREE_LIST_MODEL_H__ */
|