1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287
|
/*
* 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>
*
*/
#pragma once
#if !defined (__GTK_H_INSIDE__) && !defined (GTK_COMPILATION)
#error "Only <gtk/gtk.h> can be included directly."
#endif
#include <gtk/gtkwidget.h>
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))
typedef struct _GtkListBox GtkListBox;
typedef struct _GtkListBoxRow GtkListBoxRow;
typedef struct _GtkListBoxRowClass GtkListBoxRowClass;
#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))
#define GTK_IS_LIST_BOX_ROW_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GTK_TYPE_LIST_BOX_ROW))
#define GTK_LIST_BOX_ROW_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GTK_TYPE_LIST_BOX_ROW, GtkListBoxRowClass))
struct _GtkListBoxRow
{
GtkWidget parent_instance;
};
/**
* GtkListBoxRowClass:
* @parent_class: The parent class.
* @activate:
*/
struct _GtkListBoxRowClass
{
GtkWidgetClass parent_class;
/*< public >*/
void (* activate) (GtkListBoxRow *row);
/*< private >*/
gpointer padding[8];
};
/**
* GtkListBoxFilterFunc:
* @row: the row that may be filtered
* @user_data: (closure): user data
*
* 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
*/
typedef gboolean (*GtkListBoxFilterFunc) (GtkListBoxRow *row,
gpointer user_data);
/**
* GtkListBoxSortFunc:
* @row1: the first row
* @row2: the second row
* @user_data: (closure): user data
*
* Compare two rows to determine which should be first.
*
* Returns: < 0 if @row1 should be before @row2, 0 if they are
* equal and > 0 otherwise
*/
typedef int (*GtkListBoxSortFunc) (GtkListBoxRow *row1,
GtkListBoxRow *row2,
gpointer user_data);
/**
* GtkListBoxUpdateHeaderFunc:
* @row: the row to update
* @before: (nullable): the row before @row, or %NULL if it is first
* @user_data: (closure): user data
*
* Whenever @row changes or which row is before @row changes this
* 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.
*/
typedef void (*GtkListBoxUpdateHeaderFunc) (GtkListBoxRow *row,
GtkListBoxRow *before,
gpointer user_data);
/**
* GtkListBoxCreateWidgetFunc:
* @item: (type GObject): the item from the model for which to create a widget for
* @user_data: (closure): user data
*
* Called for list boxes that are bound to a `GListModel` with
* gtk_list_box_bind_model() for each item that gets added to the model.
*
* If the widget returned is not a #GtkListBoxRow widget, then the widget
* will be inserted as the child of an intermediate #GtkListBoxRow.
*
* Returns: (transfer full): a `GtkWidget` that represents @item
*/
typedef GtkWidget * (*GtkListBoxCreateWidgetFunc) (gpointer item,
gpointer user_data);
GDK_AVAILABLE_IN_ALL
GType gtk_list_box_row_get_type (void) G_GNUC_CONST;
GDK_AVAILABLE_IN_ALL
GtkWidget* gtk_list_box_row_new (void);
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);
GDK_AVAILABLE_IN_ALL
GtkWidget* gtk_list_box_row_get_header (GtkListBoxRow *row);
GDK_AVAILABLE_IN_ALL
void gtk_list_box_row_set_header (GtkListBoxRow *row,
GtkWidget *header);
GDK_AVAILABLE_IN_ALL
int gtk_list_box_row_get_index (GtkListBoxRow *row);
GDK_AVAILABLE_IN_ALL
void gtk_list_box_row_changed (GtkListBoxRow *row);
GDK_AVAILABLE_IN_ALL
gboolean gtk_list_box_row_is_selected (GtkListBoxRow *row);
GDK_AVAILABLE_IN_ALL
void gtk_list_box_row_set_selectable (GtkListBoxRow *row,
gboolean selectable);
GDK_AVAILABLE_IN_ALL
gboolean gtk_list_box_row_get_selectable (GtkListBoxRow *row);
GDK_AVAILABLE_IN_ALL
void gtk_list_box_row_set_activatable (GtkListBoxRow *row,
gboolean activatable);
GDK_AVAILABLE_IN_ALL
gboolean gtk_list_box_row_get_activatable (GtkListBoxRow *row);
GDK_AVAILABLE_IN_ALL
GType gtk_list_box_get_type (void) G_GNUC_CONST;
GDK_AVAILABLE_IN_ALL
void gtk_list_box_prepend (GtkListBox *box,
GtkWidget *child);
GDK_AVAILABLE_IN_ALL
void gtk_list_box_append (GtkListBox *box,
GtkWidget *child);
GDK_AVAILABLE_IN_ALL
void gtk_list_box_insert (GtkListBox *box,
GtkWidget *child,
int position);
GDK_AVAILABLE_IN_ALL
void gtk_list_box_remove (GtkListBox *box,
GtkWidget *child);
GDK_AVAILABLE_IN_4_12
void gtk_list_box_remove_all (GtkListBox *box);
GDK_AVAILABLE_IN_ALL
GtkListBoxRow* gtk_list_box_get_selected_row (GtkListBox *box);
GDK_AVAILABLE_IN_ALL
GtkListBoxRow* gtk_list_box_get_row_at_index (GtkListBox *box,
int index_);
GDK_AVAILABLE_IN_ALL
GtkListBoxRow* gtk_list_box_get_row_at_y (GtkListBox *box,
int y);
GDK_AVAILABLE_IN_ALL
void gtk_list_box_select_row (GtkListBox *box,
GtkListBoxRow *row);
GDK_AVAILABLE_IN_ALL
void gtk_list_box_set_placeholder (GtkListBox *box,
GtkWidget *placeholder);
GDK_AVAILABLE_IN_ALL
void gtk_list_box_set_adjustment (GtkListBox *box,
GtkAdjustment *adjustment);
GDK_AVAILABLE_IN_ALL
GtkAdjustment *gtk_list_box_get_adjustment (GtkListBox *box);
typedef void (* GtkListBoxForeachFunc) (GtkListBox *box,
GtkListBoxRow *row,
gpointer user_data);
GDK_AVAILABLE_IN_ALL
void gtk_list_box_selected_foreach (GtkListBox *box,
GtkListBoxForeachFunc func,
gpointer data);
GDK_AVAILABLE_IN_ALL
GList *gtk_list_box_get_selected_rows (GtkListBox *box);
GDK_AVAILABLE_IN_ALL
void gtk_list_box_unselect_row (GtkListBox *box,
GtkListBoxRow *row);
GDK_AVAILABLE_IN_ALL
void gtk_list_box_select_all (GtkListBox *box);
GDK_AVAILABLE_IN_ALL
void gtk_list_box_unselect_all (GtkListBox *box);
GDK_AVAILABLE_IN_ALL
void gtk_list_box_set_selection_mode (GtkListBox *box,
GtkSelectionMode mode);
GDK_AVAILABLE_IN_ALL
GtkSelectionMode gtk_list_box_get_selection_mode (GtkListBox *box);
GDK_AVAILABLE_IN_ALL
void gtk_list_box_set_filter_func (GtkListBox *box,
GtkListBoxFilterFunc filter_func,
gpointer user_data,
GDestroyNotify destroy);
GDK_AVAILABLE_IN_ALL
void gtk_list_box_set_header_func (GtkListBox *box,
GtkListBoxUpdateHeaderFunc update_header,
gpointer user_data,
GDestroyNotify destroy);
GDK_AVAILABLE_IN_ALL
void gtk_list_box_invalidate_filter (GtkListBox *box);
GDK_AVAILABLE_IN_ALL
void gtk_list_box_invalidate_sort (GtkListBox *box);
GDK_AVAILABLE_IN_ALL
void gtk_list_box_invalidate_headers (GtkListBox *box);
GDK_AVAILABLE_IN_ALL
void gtk_list_box_set_sort_func (GtkListBox *box,
GtkListBoxSortFunc sort_func,
gpointer user_data,
GDestroyNotify destroy);
GDK_AVAILABLE_IN_ALL
void gtk_list_box_set_activate_on_single_click (GtkListBox *box,
gboolean single);
GDK_AVAILABLE_IN_ALL
gboolean gtk_list_box_get_activate_on_single_click (GtkListBox *box);
GDK_AVAILABLE_IN_ALL
void gtk_list_box_drag_unhighlight_row (GtkListBox *box);
GDK_AVAILABLE_IN_ALL
void gtk_list_box_drag_highlight_row (GtkListBox *box,
GtkListBoxRow *row);
GDK_AVAILABLE_IN_ALL
GtkWidget* gtk_list_box_new (void);
GDK_AVAILABLE_IN_ALL
void gtk_list_box_bind_model (GtkListBox *box,
GListModel *model,
GtkListBoxCreateWidgetFunc create_widget_func,
gpointer user_data,
GDestroyNotify user_data_free_func);
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);
GDK_AVAILABLE_IN_4_18
void gtk_list_box_set_tab_behavior (GtkListBox *box,
GtkListTabBehavior behavior);
GDK_AVAILABLE_IN_4_18
GtkListTabBehavior gtk_list_box_get_tab_behavior (GtkListBox *box);
G_DEFINE_AUTOPTR_CLEANUP_FUNC(GtkListBox, g_object_unref)
G_DEFINE_AUTOPTR_CLEANUP_FUNC(GtkListBoxRow, g_object_unref)
G_END_DECLS
|