CoreGTK  3.18.0
CoreGTK is an Objective-C language binding for the GTK+ widget toolkit
CGTKListBox.m
1 /*
2  * CGTKListBox.m
3  * This file is part of CoreGTK
4  *
5  * Copyright (C) 2016 - Tyler Burton
6  *
7  * This library is free software; you can redistribute it and/or
8  * modify it under the terms of the GNU Lesser General Public
9  * License as published by the Free Software Foundation; either
10  * version 2.1 of the License, or (at your option) any later version.
11  *
12  * This library is distributed in the hope that it will be useful,
13  * but WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15  * Lesser General Public License for more details.
16  *
17  * You should have received a copy of the GNU Lesser General Public
18  * License along with this library; if not, write to the Free Software
19  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
20  */
21 
22 /*
23  * Modified by the CoreGTK Team, 2016. See the AUTHORS file for a
24  * list of people on the CoreGTK Team.
25  * See the ChangeLog files for a list of changes.
26  *
27  */
28 
29 /*
30  * Objective-C imports
31  */
32 #import "CoreGTK/CGTKListBox.h"
33 
34 @implementation CGTKListBox
35 
36 -(id)init
37 {
38  self = [super initWithGObject:(GObject *)gtk_list_box_new()];
39 
40  if(self)
41  {
42  //Do nothing
43  }
44 
45  return self;
46 }
47 
48 -(GtkListBox*)LISTBOX
49 {
50  return GTK_LIST_BOX([self GOBJECT]);
51 }
52 
53 -(void)bindModelWithModel:(GListModel*) model andCreateWidgetFunc:(GtkListBoxCreateWidgetFunc) createWidgetFunc andUserData:(gpointer) userData andUserDataFreeFunc:(GDestroyNotify) userDataFreeFunc
54 {
55  gtk_list_box_bind_model(GTK_LIST_BOX([self GOBJECT]), model, createWidgetFunc, userData, userDataFreeFunc);
56 }
57 
58 -(void)dragHighlightRow:(GtkListBoxRow*) row
59 {
60  gtk_list_box_drag_highlight_row(GTK_LIST_BOX([self GOBJECT]), row);
61 }
62 
64 {
65  gtk_list_box_drag_unhighlight_row(GTK_LIST_BOX([self GOBJECT]));
66 }
67 
69 {
70  return (gtk_list_box_get_activate_on_single_click(GTK_LIST_BOX([self GOBJECT])) ? YES : NO);
71 }
72 
73 -(GtkAdjustment*)getAdjustment
74 {
75  return gtk_list_box_get_adjustment(GTK_LIST_BOX([self GOBJECT]));
76 }
77 
78 -(GtkListBoxRow*)getRowAtIndex:(gint) index
79 {
80  return gtk_list_box_get_row_at_index(GTK_LIST_BOX([self GOBJECT]), index);
81 }
82 
83 -(GtkListBoxRow*)getRowAtY:(gint) y
84 {
85  return gtk_list_box_get_row_at_y(GTK_LIST_BOX([self GOBJECT]), y);
86 }
87 
88 -(GtkListBoxRow*)getSelectedRow
89 {
90  return gtk_list_box_get_selected_row(GTK_LIST_BOX([self GOBJECT]));
91 }
92 
94 {
95  return gtk_list_box_get_selected_rows(GTK_LIST_BOX([self GOBJECT]));
96 }
97 
98 -(GtkSelectionMode)getSelectionMode
99 {
100  return gtk_list_box_get_selection_mode(GTK_LIST_BOX([self GOBJECT]));
101 }
102 
103 -(void)insertWithChild:(CGTKWidget*) child andPosition:(gint) position
104 {
105  gtk_list_box_insert(GTK_LIST_BOX([self GOBJECT]), [child WIDGET], position);
106 }
107 
109 {
110  gtk_list_box_invalidate_filter(GTK_LIST_BOX([self GOBJECT]));
111 }
112 
114 {
115  gtk_list_box_invalidate_headers(GTK_LIST_BOX([self GOBJECT]));
116 }
117 
119 {
120  gtk_list_box_invalidate_sort(GTK_LIST_BOX([self GOBJECT]));
121 }
122 
123 -(void)prepend:(CGTKWidget*) child
124 {
125  gtk_list_box_prepend(GTK_LIST_BOX([self GOBJECT]), [child WIDGET]);
126 }
127 
128 -(void)selectAll
129 {
130  gtk_list_box_select_all(GTK_LIST_BOX([self GOBJECT]));
131 }
132 
133 -(void)selectRow:(GtkListBoxRow*) row
134 {
135  gtk_list_box_select_row(GTK_LIST_BOX([self GOBJECT]), row);
136 }
137 
138 -(void)selectedForeachWithFunc:(GtkListBoxForeachFunc) func andData:(gpointer) data
139 {
140  gtk_list_box_selected_foreach(GTK_LIST_BOX([self GOBJECT]), func, data);
141 }
142 
143 -(void)setActivateOnSingleClick:(BOOL) single
144 {
145  gtk_list_box_set_activate_on_single_click(GTK_LIST_BOX([self GOBJECT]), (single ? TRUE : FALSE));
146 }
147 
148 -(void)setAdjustment:(GtkAdjustment*) adjustment
149 {
150  gtk_list_box_set_adjustment(GTK_LIST_BOX([self GOBJECT]), adjustment);
151 }
152 
153 -(void)setFilterFuncWithFilterFunc:(GtkListBoxFilterFunc) filterFunc andUserData:(gpointer) userData andDestroy:(GDestroyNotify) destroy
154 {
155  gtk_list_box_set_filter_func(GTK_LIST_BOX([self GOBJECT]), filterFunc, userData, destroy);
156 }
157 
158 -(void)setHeaderFuncWithUpdateHeader:(GtkListBoxUpdateHeaderFunc) updateHeader andUserData:(gpointer) userData andDestroy:(GDestroyNotify) destroy
159 {
160  gtk_list_box_set_header_func(GTK_LIST_BOX([self GOBJECT]), updateHeader, userData, destroy);
161 }
162 
163 -(void)setPlaceholder:(CGTKWidget*) placeholder
164 {
165  gtk_list_box_set_placeholder(GTK_LIST_BOX([self GOBJECT]), [placeholder WIDGET]);
166 }
167 
168 -(void)setSelectionMode:(GtkSelectionMode) mode
169 {
170  gtk_list_box_set_selection_mode(GTK_LIST_BOX([self GOBJECT]), mode);
171 }
172 
173 -(void)setSortFuncWithSortFunc:(GtkListBoxSortFunc) sortFunc andUserData:(gpointer) userData andDestroy:(GDestroyNotify) destroy
174 {
175  gtk_list_box_set_sort_func(GTK_LIST_BOX([self GOBJECT]), sortFunc, userData, destroy);
176 }
177 
179 {
180  gtk_list_box_unselect_all(GTK_LIST_BOX([self GOBJECT]));
181 }
182 
183 -(void)unselectRow:(GtkListBoxRow*) row
184 {
185  gtk_list_box_unselect_row(GTK_LIST_BOX([self GOBJECT]), row);
186 }
187 
188 
189 @end
void invalidateSort()
Definition: CGTKListBox.m:118
void invalidateHeaders()
Definition: CGTKListBox.m:113
GObject * GOBJECT()
Definition: CGTKBase.m:82
BOOL getActivateOnSingleClick()
Definition: CGTKListBox.m:68
id initWithGObject:(GObject *obj)
Definition: CGTKBase.m:48
void dragUnhighlightRow()
Definition: CGTKListBox.m:63
void destroy()
Definition: CGTKWidget.m:131
GList * getSelectedRows()
Definition: CGTKListBox.m:93
GtkWidget * WIDGET()
Definition: CGTKWidget.m:61
GtkSelectionMode getSelectionMode()
Definition: CGTKListBox.m:98
void invalidateFilter()
Definition: CGTKListBox.m:108
GtkAdjustment * getAdjustment()
Definition: CGTKListBox.m:73
void selectAll()
Definition: CGTKListBox.m:128
GtkListBox * LISTBOX()
Definition: CGTKListBox.m:48
void unselectAll()
Definition: CGTKListBox.m:178
GtkListBoxRow * getSelectedRow()
Definition: CGTKListBox.m:88