2013-06-10 09:17:10 +00:00
|
|
|
/*
|
|
|
|
* Copyright (c) 2013 Red Hat, Inc.
|
|
|
|
*
|
|
|
|
* This program 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 of the License, or (at your
|
|
|
|
* option) any later version.
|
|
|
|
*
|
|
|
|
* This program 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 program; if not, write to the Free Software Foundation,
|
|
|
|
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
|
|
|
*
|
|
|
|
* Author: Alexander Larsson <alexl@redhat.com>
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef __GTK_LIST_BOX_H__
|
|
|
|
#define __GTK_LIST_BOX_H__
|
|
|
|
|
|
|
|
#if !defined (__GTK_H_INSIDE__) && !defined (GTK_COMPILATION)
|
|
|
|
#error "Only <gtk/gtk.h> can be included directly."
|
|
|
|
#endif
|
|
|
|
|
2020-05-08 12:48:00 +00:00
|
|
|
#include <gtk/gtkwidget.h>
|
2013-06-10 09:17:10 +00:00
|
|
|
|
|
|
|
G_BEGIN_DECLS
|
|
|
|
|
|
|
|
|
|
|
|
#define GTK_TYPE_LIST_BOX (gtk_list_box_get_type ())
|
|
|
|
#define GTK_LIST_BOX(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GTK_TYPE_LIST_BOX, GtkListBox))
|
|
|
|
#define GTK_IS_LIST_BOX(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GTK_TYPE_LIST_BOX))
|
|
|
|
|
2013-06-15 16:13:28 +00:00
|
|
|
typedef struct _GtkListBox GtkListBox;
|
|
|
|
typedef struct _GtkListBoxRow GtkListBoxRow;
|
|
|
|
typedef struct _GtkListBoxRowClass GtkListBoxRowClass;
|
2013-06-10 09:17:10 +00:00
|
|
|
|
2013-06-15 16:13:28 +00:00
|
|
|
#define GTK_TYPE_LIST_BOX_ROW (gtk_list_box_row_get_type ())
|
|
|
|
#define GTK_LIST_BOX_ROW(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GTK_TYPE_LIST_BOX_ROW, GtkListBoxRow))
|
|
|
|
#define GTK_LIST_BOX_ROW_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GTK_TYPE_LIST_BOX_ROW, GtkListBoxRowClass))
|
|
|
|
#define GTK_IS_LIST_BOX_ROW(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GTK_TYPE_LIST_BOX_ROW))
|
2013-06-10 09:17:10 +00:00
|
|
|
#define GTK_IS_LIST_BOX_ROW_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GTK_TYPE_LIST_BOX_ROW))
|
2013-06-15 16:13:28 +00:00
|
|
|
#define GTK_LIST_BOX_ROW_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GTK_TYPE_LIST_BOX_ROW, GtkListBoxRowClass))
|
2013-06-10 09:17:10 +00:00
|
|
|
|
|
|
|
struct _GtkListBoxRow
|
|
|
|
{
|
2020-05-03 04:09:18 +00:00
|
|
|
GtkWidget parent_instance;
|
2013-06-10 09:17:10 +00:00
|
|
|
};
|
|
|
|
|
2014-01-17 20:17:45 +00:00
|
|
|
/**
|
|
|
|
* GtkListBoxRowClass:
|
|
|
|
* @parent_class: The parent class.
|
2017-01-19 09:02:04 +00:00
|
|
|
* @activate:
|
2014-01-17 20:17:45 +00:00
|
|
|
*/
|
2013-06-10 09:17:10 +00:00
|
|
|
struct _GtkListBoxRowClass
|
|
|
|
{
|
2020-05-03 04:09:18 +00:00
|
|
|
GtkWidgetClass parent_class;
|
2013-06-10 09:17:10 +00:00
|
|
|
|
2014-01-17 20:17:45 +00:00
|
|
|
/*< public >*/
|
|
|
|
|
2013-09-10 12:12:07 +00:00
|
|
|
void (* activate) (GtkListBoxRow *row);
|
|
|
|
|
2014-01-17 20:17:45 +00:00
|
|
|
/*< private >*/
|
|
|
|
|
2019-05-29 00:00:40 +00:00
|
|
|
gpointer padding[8];
|
2013-06-10 09:17:10 +00:00
|
|
|
};
|
|
|
|
|
2013-06-11 10:59:32 +00:00
|
|
|
/**
|
|
|
|
* GtkListBoxFilterFunc:
|
2013-06-15 16:13:28 +00:00
|
|
|
* @row: the row that may be filtered
|
|
|
|
* @user_data: (closure): user data
|
2013-06-11 10:59:32 +00:00
|
|
|
*
|
|
|
|
* Will be called whenever the row changes or is added and lets you control
|
|
|
|
* if the row should be visible or not.
|
|
|
|
*
|
|
|
|
* Returns: %TRUE if the row should be visible, %FALSE otherwise
|
|
|
|
*/
|
2013-06-15 16:13:28 +00:00
|
|
|
typedef gboolean (*GtkListBoxFilterFunc) (GtkListBoxRow *row,
|
|
|
|
gpointer user_data);
|
|
|
|
|
2013-06-11 10:59:32 +00:00
|
|
|
/**
|
|
|
|
* GtkListBoxSortFunc:
|
2013-06-15 16:13:28 +00:00
|
|
|
* @row1: the first row
|
|
|
|
* @row2: the second row
|
|
|
|
* @user_data: (closure): user data
|
2013-06-11 10:59:32 +00:00
|
|
|
*
|
2013-09-21 00:16:00 +00:00
|
|
|
* Compare two rows to determine which should be first.
|
2013-06-11 10:59:32 +00:00
|
|
|
*
|
2013-06-15 16:13:28 +00:00
|
|
|
* Returns: < 0 if @row1 should be before @row2, 0 if they are
|
|
|
|
* equal and > 0 otherwise
|
2013-06-11 10:59:32 +00:00
|
|
|
*/
|
2020-07-24 13:54:49 +00:00
|
|
|
typedef int (*GtkListBoxSortFunc) (GtkListBoxRow *row1,
|
|
|
|
GtkListBoxRow *row2,
|
|
|
|
gpointer user_data);
|
2013-06-15 16:13:28 +00:00
|
|
|
|
2013-06-11 10:59:32 +00:00
|
|
|
/**
|
2013-06-11 12:09:19 +00:00
|
|
|
* GtkListBoxUpdateHeaderFunc:
|
2013-06-15 16:13:28 +00:00
|
|
|
* @row: the row to update
|
2013-09-16 18:08:35 +00:00
|
|
|
* @before: (allow-none): the row before @row, or %NULL if it is first
|
2013-06-15 16:13:28 +00:00
|
|
|
* @user_data: (closure): user data
|
2013-06-11 10:59:32 +00:00
|
|
|
*
|
2013-06-15 16:13:28 +00:00
|
|
|
* Whenever @row changes or which row is before @row changes this
|
2021-03-02 03:47:51 +00:00
|
|
|
* is called, which lets you update the header on @row.
|
|
|
|
*
|
|
|
|
* You may remove or set a new one via [method@Gtk.ListBoxRow.set_header]
|
|
|
|
* or just change the state of the current header widget.
|
2013-06-11 10:59:32 +00:00
|
|
|
*/
|
2013-06-11 12:09:19 +00:00
|
|
|
typedef void (*GtkListBoxUpdateHeaderFunc) (GtkListBoxRow *row,
|
|
|
|
GtkListBoxRow *before,
|
|
|
|
gpointer user_data);
|
2013-06-10 09:17:10 +00:00
|
|
|
|
2015-02-09 10:49:31 +00:00
|
|
|
/**
|
|
|
|
* GtkListBoxCreateWidgetFunc:
|
2015-04-05 12:13:24 +00:00
|
|
|
* @item: (type GObject): the item from the model for which to create a widget for
|
2015-02-18 10:57:05 +00:00
|
|
|
* @user_data: (closure): user data
|
2015-02-09 10:49:31 +00:00
|
|
|
*
|
2021-03-02 03:47:51 +00:00
|
|
|
* Called for list boxes that are bound to a `GListModel` with
|
2015-02-09 10:49:31 +00:00
|
|
|
* gtk_list_box_bind_model() for each item that gets added to the model.
|
|
|
|
*
|
2021-03-02 03:47:51 +00:00
|
|
|
* Returns: (transfer full): a `GtkWidget` that represents @item
|
2015-02-09 10:49:31 +00:00
|
|
|
*/
|
|
|
|
typedef GtkWidget * (*GtkListBoxCreateWidgetFunc) (gpointer item,
|
|
|
|
gpointer user_data);
|
|
|
|
|
2018-02-05 19:13:20 +00:00
|
|
|
GDK_AVAILABLE_IN_ALL
|
2013-06-10 09:17:10 +00:00
|
|
|
GType gtk_list_box_row_get_type (void) G_GNUC_CONST;
|
2018-02-05 19:13:20 +00:00
|
|
|
GDK_AVAILABLE_IN_ALL
|
2013-06-10 09:17:10 +00:00
|
|
|
GtkWidget* gtk_list_box_row_new (void);
|
2020-05-03 04:09:18 +00:00
|
|
|
|
|
|
|
GDK_AVAILABLE_IN_ALL
|
|
|
|
void gtk_list_box_row_set_child (GtkListBoxRow *row,
|
|
|
|
GtkWidget *child);
|
|
|
|
GDK_AVAILABLE_IN_ALL
|
|
|
|
GtkWidget *gtk_list_box_row_get_child (GtkListBoxRow *row);
|
|
|
|
|
2018-02-05 19:13:20 +00:00
|
|
|
GDK_AVAILABLE_IN_ALL
|
2013-06-11 12:09:19 +00:00
|
|
|
GtkWidget* gtk_list_box_row_get_header (GtkListBoxRow *row);
|
2018-02-05 19:13:20 +00:00
|
|
|
GDK_AVAILABLE_IN_ALL
|
2013-06-11 12:09:19 +00:00
|
|
|
void gtk_list_box_row_set_header (GtkListBoxRow *row,
|
|
|
|
GtkWidget *header);
|
2018-02-05 19:13:20 +00:00
|
|
|
GDK_AVAILABLE_IN_ALL
|
2020-07-24 13:54:49 +00:00
|
|
|
int gtk_list_box_row_get_index (GtkListBoxRow *row);
|
2018-02-05 19:13:20 +00:00
|
|
|
GDK_AVAILABLE_IN_ALL
|
2013-06-10 09:17:10 +00:00
|
|
|
void gtk_list_box_row_changed (GtkListBoxRow *row);
|
|
|
|
|
2018-02-05 19:13:20 +00:00
|
|
|
GDK_AVAILABLE_IN_ALL
|
2014-03-28 23:21:57 +00:00
|
|
|
gboolean gtk_list_box_row_is_selected (GtkListBoxRow *row);
|
2013-06-10 09:17:10 +00:00
|
|
|
|
2018-02-05 19:13:20 +00:00
|
|
|
GDK_AVAILABLE_IN_ALL
|
2014-07-16 03:10:51 +00:00
|
|
|
void gtk_list_box_row_set_selectable (GtkListBoxRow *row,
|
|
|
|
gboolean selectable);
|
2018-02-05 19:13:20 +00:00
|
|
|
GDK_AVAILABLE_IN_ALL
|
2014-07-16 03:10:51 +00:00
|
|
|
gboolean gtk_list_box_row_get_selectable (GtkListBoxRow *row);
|
|
|
|
|
|
|
|
|
2018-02-05 19:13:20 +00:00
|
|
|
GDK_AVAILABLE_IN_ALL
|
2014-07-13 00:37:41 +00:00
|
|
|
void gtk_list_box_row_set_activatable (GtkListBoxRow *row,
|
|
|
|
gboolean activatable);
|
2018-02-05 19:13:20 +00:00
|
|
|
GDK_AVAILABLE_IN_ALL
|
2014-07-13 00:37:41 +00:00
|
|
|
gboolean gtk_list_box_row_get_activatable (GtkListBoxRow *row);
|
|
|
|
|
2018-02-05 19:13:20 +00:00
|
|
|
GDK_AVAILABLE_IN_ALL
|
2013-06-10 09:17:10 +00:00
|
|
|
GType gtk_list_box_get_type (void) G_GNUC_CONST;
|
2018-02-05 19:13:20 +00:00
|
|
|
GDK_AVAILABLE_IN_ALL
|
2014-03-29 03:07:41 +00:00
|
|
|
void gtk_list_box_prepend (GtkListBox *box,
|
2013-08-06 12:57:22 +00:00
|
|
|
GtkWidget *child);
|
2018-02-05 19:13:20 +00:00
|
|
|
GDK_AVAILABLE_IN_ALL
|
2020-08-01 13:26:28 +00:00
|
|
|
void gtk_list_box_append (GtkListBox *box,
|
|
|
|
GtkWidget *child);
|
|
|
|
GDK_AVAILABLE_IN_ALL
|
2014-03-29 03:07:41 +00:00
|
|
|
void gtk_list_box_insert (GtkListBox *box,
|
2013-08-07 10:36:03 +00:00
|
|
|
GtkWidget *child,
|
2020-07-24 13:54:49 +00:00
|
|
|
int position);
|
2018-02-05 19:13:20 +00:00
|
|
|
GDK_AVAILABLE_IN_ALL
|
2020-05-08 05:50:37 +00:00
|
|
|
void gtk_list_box_remove (GtkListBox *box,
|
|
|
|
GtkWidget *child);
|
|
|
|
GDK_AVAILABLE_IN_ALL
|
2014-03-29 03:07:41 +00:00
|
|
|
GtkListBoxRow* gtk_list_box_get_selected_row (GtkListBox *box);
|
2018-02-05 19:13:20 +00:00
|
|
|
GDK_AVAILABLE_IN_ALL
|
2014-03-29 03:07:41 +00:00
|
|
|
GtkListBoxRow* gtk_list_box_get_row_at_index (GtkListBox *box,
|
2020-07-24 13:54:49 +00:00
|
|
|
int index_);
|
2018-02-05 19:13:20 +00:00
|
|
|
GDK_AVAILABLE_IN_ALL
|
2014-03-29 03:07:41 +00:00
|
|
|
GtkListBoxRow* gtk_list_box_get_row_at_y (GtkListBox *box,
|
2020-07-24 13:54:49 +00:00
|
|
|
int y);
|
2018-02-05 19:13:20 +00:00
|
|
|
GDK_AVAILABLE_IN_ALL
|
2014-03-29 03:07:41 +00:00
|
|
|
void gtk_list_box_select_row (GtkListBox *box,
|
2013-06-10 09:17:10 +00:00
|
|
|
GtkListBoxRow *row);
|
2018-02-05 19:13:20 +00:00
|
|
|
GDK_AVAILABLE_IN_ALL
|
2014-03-29 03:07:41 +00:00
|
|
|
void gtk_list_box_set_placeholder (GtkListBox *box,
|
2013-06-11 14:53:31 +00:00
|
|
|
GtkWidget *placeholder);
|
2018-02-05 19:13:20 +00:00
|
|
|
GDK_AVAILABLE_IN_ALL
|
2014-03-29 03:07:41 +00:00
|
|
|
void gtk_list_box_set_adjustment (GtkListBox *box,
|
2013-06-10 09:17:10 +00:00
|
|
|
GtkAdjustment *adjustment);
|
2018-02-05 19:13:20 +00:00
|
|
|
GDK_AVAILABLE_IN_ALL
|
2014-03-29 03:07:41 +00:00
|
|
|
GtkAdjustment *gtk_list_box_get_adjustment (GtkListBox *box);
|
2014-03-28 23:21:57 +00:00
|
|
|
|
|
|
|
typedef void (* GtkListBoxForeachFunc) (GtkListBox *box,
|
|
|
|
GtkListBoxRow *row,
|
|
|
|
gpointer user_data);
|
|
|
|
|
2018-02-05 19:13:20 +00:00
|
|
|
GDK_AVAILABLE_IN_ALL
|
2014-03-29 03:07:41 +00:00
|
|
|
void gtk_list_box_selected_foreach (GtkListBox *box,
|
2014-03-28 23:21:57 +00:00
|
|
|
GtkListBoxForeachFunc func,
|
|
|
|
gpointer data);
|
2018-02-05 19:13:20 +00:00
|
|
|
GDK_AVAILABLE_IN_ALL
|
2014-03-29 03:07:41 +00:00
|
|
|
GList *gtk_list_box_get_selected_rows (GtkListBox *box);
|
2018-02-05 19:13:20 +00:00
|
|
|
GDK_AVAILABLE_IN_ALL
|
2014-03-29 03:07:41 +00:00
|
|
|
void gtk_list_box_unselect_row (GtkListBox *box,
|
2014-03-28 23:21:57 +00:00
|
|
|
GtkListBoxRow *row);
|
2018-02-05 19:13:20 +00:00
|
|
|
GDK_AVAILABLE_IN_ALL
|
2014-03-29 03:07:41 +00:00
|
|
|
void gtk_list_box_select_all (GtkListBox *box);
|
2018-02-05 19:13:20 +00:00
|
|
|
GDK_AVAILABLE_IN_ALL
|
2014-03-29 03:07:41 +00:00
|
|
|
void gtk_list_box_unselect_all (GtkListBox *box);
|
2014-03-28 23:21:57 +00:00
|
|
|
|
2018-02-05 19:13:20 +00:00
|
|
|
GDK_AVAILABLE_IN_ALL
|
2014-03-29 03:07:41 +00:00
|
|
|
void gtk_list_box_set_selection_mode (GtkListBox *box,
|
2013-06-10 09:17:10 +00:00
|
|
|
GtkSelectionMode mode);
|
2018-02-05 19:13:20 +00:00
|
|
|
GDK_AVAILABLE_IN_ALL
|
2014-03-29 03:07:41 +00:00
|
|
|
GtkSelectionMode gtk_list_box_get_selection_mode (GtkListBox *box);
|
2018-02-05 19:13:20 +00:00
|
|
|
GDK_AVAILABLE_IN_ALL
|
2014-03-29 03:07:41 +00:00
|
|
|
void gtk_list_box_set_filter_func (GtkListBox *box,
|
2013-06-10 09:17:10 +00:00
|
|
|
GtkListBoxFilterFunc filter_func,
|
|
|
|
gpointer user_data,
|
|
|
|
GDestroyNotify destroy);
|
2018-02-05 19:13:20 +00:00
|
|
|
GDK_AVAILABLE_IN_ALL
|
2014-03-29 03:07:41 +00:00
|
|
|
void gtk_list_box_set_header_func (GtkListBox *box,
|
2013-06-11 12:09:19 +00:00
|
|
|
GtkListBoxUpdateHeaderFunc update_header,
|
2013-06-10 09:17:10 +00:00
|
|
|
gpointer user_data,
|
|
|
|
GDestroyNotify destroy);
|
2018-02-05 19:13:20 +00:00
|
|
|
GDK_AVAILABLE_IN_ALL
|
2014-03-29 03:07:41 +00:00
|
|
|
void gtk_list_box_invalidate_filter (GtkListBox *box);
|
2018-02-05 19:13:20 +00:00
|
|
|
GDK_AVAILABLE_IN_ALL
|
2014-03-29 03:07:41 +00:00
|
|
|
void gtk_list_box_invalidate_sort (GtkListBox *box);
|
2018-02-05 19:13:20 +00:00
|
|
|
GDK_AVAILABLE_IN_ALL
|
2014-03-29 03:07:41 +00:00
|
|
|
void gtk_list_box_invalidate_headers (GtkListBox *box);
|
2018-02-05 19:13:20 +00:00
|
|
|
GDK_AVAILABLE_IN_ALL
|
2014-03-29 03:07:41 +00:00
|
|
|
void gtk_list_box_set_sort_func (GtkListBox *box,
|
2013-06-10 09:17:10 +00:00
|
|
|
GtkListBoxSortFunc sort_func,
|
|
|
|
gpointer user_data,
|
|
|
|
GDestroyNotify destroy);
|
2018-02-05 19:13:20 +00:00
|
|
|
GDK_AVAILABLE_IN_ALL
|
2014-03-29 03:07:41 +00:00
|
|
|
void gtk_list_box_set_activate_on_single_click (GtkListBox *box,
|
2013-06-10 09:17:10 +00:00
|
|
|
gboolean single);
|
2018-02-05 19:13:20 +00:00
|
|
|
GDK_AVAILABLE_IN_ALL
|
2014-03-29 03:07:41 +00:00
|
|
|
gboolean gtk_list_box_get_activate_on_single_click (GtkListBox *box);
|
2018-02-05 19:13:20 +00:00
|
|
|
GDK_AVAILABLE_IN_ALL
|
2014-03-29 03:07:41 +00:00
|
|
|
void gtk_list_box_drag_unhighlight_row (GtkListBox *box);
|
2018-02-05 19:13:20 +00:00
|
|
|
GDK_AVAILABLE_IN_ALL
|
2014-03-29 03:07:41 +00:00
|
|
|
void gtk_list_box_drag_highlight_row (GtkListBox *box,
|
2013-06-10 09:17:10 +00:00
|
|
|
GtkListBoxRow *row);
|
2018-02-05 19:13:20 +00:00
|
|
|
GDK_AVAILABLE_IN_ALL
|
2013-06-10 09:17:10 +00:00
|
|
|
GtkWidget* gtk_list_box_new (void);
|
|
|
|
|
|
|
|
|
2018-02-05 19:13:20 +00:00
|
|
|
GDK_AVAILABLE_IN_ALL
|
2015-02-09 10:49:31 +00:00
|
|
|
void gtk_list_box_bind_model (GtkListBox *box,
|
|
|
|
GListModel *model,
|
|
|
|
GtkListBoxCreateWidgetFunc create_widget_func,
|
|
|
|
gpointer user_data,
|
|
|
|
GDestroyNotify user_data_free_func);
|
2014-03-28 23:21:57 +00:00
|
|
|
|
2019-04-13 00:24:40 +00:00
|
|
|
GDK_AVAILABLE_IN_ALL
|
|
|
|
void gtk_list_box_set_show_separators (GtkListBox *box,
|
|
|
|
gboolean show_separators);
|
|
|
|
GDK_AVAILABLE_IN_ALL
|
|
|
|
gboolean gtk_list_box_get_show_separators (GtkListBox *box);
|
|
|
|
|
2015-11-10 13:48:31 +00:00
|
|
|
G_DEFINE_AUTOPTR_CLEANUP_FUNC(GtkListBox, g_object_unref)
|
|
|
|
G_DEFINE_AUTOPTR_CLEANUP_FUNC(GtkListBoxRow, g_object_unref)
|
|
|
|
|
2013-06-10 09:17:10 +00:00
|
|
|
G_END_DECLS
|
|
|
|
|
|
|
|
#endif
|