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
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
/*
 * 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 __CTK_LIST_BOX_H__
#define __CTK_LIST_BOX_H__

#if !defined (__CTK_H_INSIDE__) && !defined (CTK_COMPILATION)
#error "Only <ctk/ctk.h> can be included directly."
#endif

#include <ctk/ctkbin.h>

G_BEGIN_DECLS


#define CTK_TYPE_LIST_BOX (ctk_list_box_get_type ())
#define CTK_LIST_BOX(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), CTK_TYPE_LIST_BOX, CtkListBox))
#define CTK_LIST_BOX_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), CTK_TYPE_LIST_BOX, CtkListBoxClass))
#define CTK_IS_LIST_BOX(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), CTK_TYPE_LIST_BOX))
#define CTK_IS_LIST_BOX_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), CTK_TYPE_LIST_BOX))
#define CTK_LIST_BOX_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), CTK_TYPE_LIST_BOX, CtkListBoxClass))

typedef struct _CtkListBox        CtkListBox;
typedef struct _CtkListBoxClass   CtkListBoxClass;

typedef struct _CtkListBoxRow        CtkListBoxRow;
typedef struct _CtkListBoxRowClass   CtkListBoxRowClass;

struct _CtkListBox
{
  CtkContainer parent_instance;
};

/**
 * CtkListBoxClass:
 * @parent_class: The parent class.
 * @row_selected: Class handler for the #CtkListBox::row-selected signal
 * @row_activated: Class handler for the #CtkListBox::row-activated signal
 * @activate_cursor_row: Class handler for the #CtkListBox::activate-cursor-row signal
 * @toggle_cursor_row: Class handler for the #CtkListBox::toggle-cursor-row signal
 * @move_cursor: Class handler for the #CtkListBox::move-cursor signal
 * @selected_rows_changed: Class handler for the #CtkListBox::selected-rows-changed signal
 * @select_all: Class handler for the #CtkListBox::select-all signal
 * @unselect_all: Class handler for the #CtkListBox::unselect-all signal
 */
struct _CtkListBoxClass
{
  CtkContainerClass parent_class;

  /*< public >*/

  void (*row_selected)        (CtkListBox      *box,
                               CtkListBoxRow   *row);
  void (*row_activated)       (CtkListBox      *box,
                               CtkListBoxRow   *row);
  void (*activate_cursor_row) (CtkListBox      *box);
  void (*toggle_cursor_row)   (CtkListBox      *box);
  void (*move_cursor)         (CtkListBox      *box,
                               CtkMovementStep  step,
                               gint             count);
  void (*selected_rows_changed) (CtkListBox    *box);
  void (*select_all)            (CtkListBox    *box);
  void (*unselect_all)          (CtkListBox    *box);

  /*< private >*/

  /* Padding for future expansion */
  void (*_ctk_reserved1) (void);
  void (*_ctk_reserved2) (void);
  void (*_ctk_reserved3) (void);
};

#define CTK_TYPE_LIST_BOX_ROW            (ctk_list_box_row_get_type ())
#define CTK_LIST_BOX_ROW(obj)            (G_TYPE_CHECK_INSTANCE_CAST ((obj), CTK_TYPE_LIST_BOX_ROW, CtkListBoxRow))
#define CTK_LIST_BOX_ROW_CLASS(klass)    (G_TYPE_CHECK_CLASS_CAST ((klass), CTK_TYPE_LIST_BOX_ROW, CtkListBoxRowClass))
#define CTK_IS_LIST_BOX_ROW(obj)         (G_TYPE_CHECK_INSTANCE_TYPE ((obj), CTK_TYPE_LIST_BOX_ROW))
#define CTK_IS_LIST_BOX_ROW_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), CTK_TYPE_LIST_BOX_ROW))
#define CTK_LIST_BOX_ROW_GET_CLASS(obj)  (G_TYPE_INSTANCE_GET_CLASS ((obj), CTK_TYPE_LIST_BOX_ROW, CtkListBoxRowClass))

struct _CtkListBoxRow
{
  CtkBin parent_instance;
};

/**
 * CtkListBoxRowClass:
 * @parent_class: The parent class.
 * @activate: 
 */
struct _CtkListBoxRowClass
{
  CtkBinClass parent_class;

  /*< public >*/

  void (* activate) (CtkListBoxRow *row);

  /*< private >*/

  /* Padding for future expansion */
  void (*_ctk_reserved1) (void);
  void (*_ctk_reserved2) (void);
};

/**
 * CtkListBoxFilterFunc:
 * @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
 *
 * Since: 3.10
 */
typedef gboolean (*CtkListBoxFilterFunc) (CtkListBoxRow *row,
                                          gpointer       user_data);

/**
 * CtkListBoxSortFunc:
 * @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
 *
 * Since: 3.10
 */
typedef gint (*CtkListBoxSortFunc) (CtkListBoxRow *row1,
                                    CtkListBoxRow *row2,
                                    gpointer       user_data);

/**
 * CtkListBoxUpdateHeaderFunc:
 * @row: the row to update
 * @before: (allow-none): 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 ctk_list_box_row_set_header() or
 * just change the state of the current header widget.
 *
 * Since: 3.10
 */
typedef void (*CtkListBoxUpdateHeaderFunc) (CtkListBoxRow *row,
                                            CtkListBoxRow *before,
                                            gpointer       user_data);

/**
 * CtkListBoxCreateWidgetFunc:
 * @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
 * ctk_list_box_bind_model() for each item that gets added to the model.
 *
 * Versions of CTK+ prior to 3.18 called ctk_widget_show_all() on the rows
 * created by the CtkListBoxCreateWidgetFunc, but this forced all widgets
 * inside the row to be shown, and is no longer the case. Applications should
 * be updated to show the desired row widgets.
 *
 * Returns: (transfer full): a #CtkWidget that represents @item
 *
 * Since: 3.16
 */
typedef CtkWidget * (*CtkListBoxCreateWidgetFunc) (gpointer item,
                                                   gpointer user_data);

CDK_AVAILABLE_IN_3_10
GType      ctk_list_box_row_get_type      (void) G_GNUC_CONST;
CDK_AVAILABLE_IN_3_10
CtkWidget* ctk_list_box_row_new           (void);
CDK_AVAILABLE_IN_3_10
CtkWidget* ctk_list_box_row_get_header    (CtkListBoxRow *row);
CDK_AVAILABLE_IN_3_10
void       ctk_list_box_row_set_header    (CtkListBoxRow *row,
                                           CtkWidget     *header);
CDK_AVAILABLE_IN_3_10
gint       ctk_list_box_row_get_index     (CtkListBoxRow *row);
CDK_AVAILABLE_IN_3_10
void       ctk_list_box_row_changed       (CtkListBoxRow *row);

CDK_AVAILABLE_IN_3_14
gboolean   ctk_list_box_row_is_selected   (CtkListBoxRow *row);

CDK_AVAILABLE_IN_3_14
void       ctk_list_box_row_set_selectable (CtkListBoxRow *row,
                                            gboolean       selectable);
CDK_AVAILABLE_IN_3_14
gboolean   ctk_list_box_row_get_selectable (CtkListBoxRow *row);


CDK_AVAILABLE_IN_3_14
void       ctk_list_box_row_set_activatable (CtkListBoxRow *row,
                                             gboolean       activatable);
CDK_AVAILABLE_IN_3_14
gboolean   ctk_list_box_row_get_activatable (CtkListBoxRow *row);

CDK_AVAILABLE_IN_3_10
GType          ctk_list_box_get_type                     (void) G_GNUC_CONST;
CDK_AVAILABLE_IN_3_10
void           ctk_list_box_prepend                      (CtkListBox                    *box,
                                                          CtkWidget                     *child);
CDK_AVAILABLE_IN_3_10
void           ctk_list_box_insert                       (CtkListBox                    *box,
                                                          CtkWidget                     *child,
                                                          gint                           position);
CDK_AVAILABLE_IN_3_10
CtkListBoxRow* ctk_list_box_get_selected_row             (CtkListBox                    *box);
CDK_AVAILABLE_IN_3_10
CtkListBoxRow* ctk_list_box_get_row_at_index             (CtkListBox                    *box,
                                                          gint                           index_);
CDK_AVAILABLE_IN_3_10
CtkListBoxRow* ctk_list_box_get_row_at_y                 (CtkListBox                    *box,
                                                          gint                           y);
CDK_AVAILABLE_IN_3_10
void           ctk_list_box_select_row                   (CtkListBox                    *box,
                                                          CtkListBoxRow                 *row);
CDK_AVAILABLE_IN_3_10
void           ctk_list_box_set_placeholder              (CtkListBox                    *box,
                                                          CtkWidget                     *placeholder);
CDK_AVAILABLE_IN_3_10
void           ctk_list_box_set_adjustment               (CtkListBox                    *box,
                                                          CtkAdjustment                 *adjustment);
CDK_AVAILABLE_IN_3_10
CtkAdjustment *ctk_list_box_get_adjustment               (CtkListBox                    *box);

typedef void (* CtkListBoxForeachFunc) (CtkListBox      *box,
                                        CtkListBoxRow   *row,
                                        gpointer         user_data);

CDK_AVAILABLE_IN_3_14
void           ctk_list_box_selected_foreach             (CtkListBox                    *box,
                                                          CtkListBoxForeachFunc          func,
                                                          gpointer                       data);
CDK_AVAILABLE_IN_3_14
GList         *ctk_list_box_get_selected_rows            (CtkListBox                    *box);
CDK_AVAILABLE_IN_3_14
void           ctk_list_box_unselect_row                 (CtkListBox                    *box,
                                                          CtkListBoxRow                 *row);
CDK_AVAILABLE_IN_3_14
void           ctk_list_box_select_all                   (CtkListBox                    *box);
CDK_AVAILABLE_IN_3_14
void           ctk_list_box_unselect_all                 (CtkListBox                    *box);

CDK_AVAILABLE_IN_3_10
void           ctk_list_box_set_selection_mode           (CtkListBox                    *box,
                                                          CtkSelectionMode               mode);
CDK_AVAILABLE_IN_3_10
CtkSelectionMode ctk_list_box_get_selection_mode         (CtkListBox                    *box);
CDK_AVAILABLE_IN_3_10
void           ctk_list_box_set_filter_func              (CtkListBox                    *box,
                                                          CtkListBoxFilterFunc           filter_func,
                                                          gpointer                       user_data,
                                                          GDestroyNotify                 destroy);
CDK_AVAILABLE_IN_3_10
void           ctk_list_box_set_header_func              (CtkListBox                    *box,
                                                          CtkListBoxUpdateHeaderFunc     update_header,
                                                          gpointer                       user_data,
                                                          GDestroyNotify                 destroy);
CDK_AVAILABLE_IN_3_10
void           ctk_list_box_invalidate_filter            (CtkListBox                    *box);
CDK_AVAILABLE_IN_3_10
void           ctk_list_box_invalidate_sort              (CtkListBox                    *box);
CDK_AVAILABLE_IN_3_10
void           ctk_list_box_invalidate_headers           (CtkListBox                    *box);
CDK_AVAILABLE_IN_3_10
void           ctk_list_box_set_sort_func                (CtkListBox                    *box,
                                                          CtkListBoxSortFunc             sort_func,
                                                          gpointer                       user_data,
                                                          GDestroyNotify                 destroy);
CDK_AVAILABLE_IN_3_10
void           ctk_list_box_set_activate_on_single_click (CtkListBox                    *box,
                                                          gboolean                       single);
CDK_AVAILABLE_IN_3_10
gboolean       ctk_list_box_get_activate_on_single_click (CtkListBox                    *box);
CDK_AVAILABLE_IN_3_10
void           ctk_list_box_drag_unhighlight_row         (CtkListBox                    *box);
CDK_AVAILABLE_IN_3_10
void           ctk_list_box_drag_highlight_row           (CtkListBox                    *box,
                                                          CtkListBoxRow                 *row);
CDK_AVAILABLE_IN_3_10
CtkWidget*     ctk_list_box_new                          (void);


CDK_AVAILABLE_IN_3_16
void           ctk_list_box_bind_model                   (CtkListBox                   *box,
                                                          GListModel                   *model,
                                                          CtkListBoxCreateWidgetFunc    create_widget_func,
                                                          gpointer                      user_data,
                                                          GDestroyNotify                user_data_free_func);

G_DEFINE_AUTOPTR_CLEANUP_FUNC(CtkListBox, g_object_unref)<--- There is an unknown macro here somewhere. Configuration is required. If G_DEFINE_AUTOPTR_CLEANUP_FUNC is a macro then please configure it.
G_DEFINE_AUTOPTR_CLEANUP_FUNC(CtkListBoxRow, g_object_unref)

G_END_DECLS

#endif