CoreGTK  3.18.0
CoreGTK is an Objective-C language binding for the GTK+ widget toolkit
CGTKFlowBox.m
1 /*
2  * CGTKFlowBox.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/CGTKFlowBox.h"
33 
34 @implementation CGTKFlowBox
35 
36 -(id)init
37 {
38  self = [super initWithGObject:(GObject *)gtk_flow_box_new()];
39 
40  if(self)
41  {
42  //Do nothing
43  }
44 
45  return self;
46 }
47 
48 -(GtkFlowBox*)FLOWBOX
49 {
50  return GTK_FLOW_BOX([self GOBJECT]);
51 }
52 
53 -(void)bindModelWithModel:(GListModel*) model andCreateWidgetFunc:(GtkFlowBoxCreateWidgetFunc) createWidgetFunc andUserData:(gpointer) userData andUserDataFreeFunc:(GDestroyNotify) userDataFreeFunc
54 {
55  gtk_flow_box_bind_model(GTK_FLOW_BOX([self GOBJECT]), model, createWidgetFunc, userData, userDataFreeFunc);
56 }
57 
59 {
60  return (gtk_flow_box_get_activate_on_single_click(GTK_FLOW_BOX([self GOBJECT])) ? YES : NO);
61 }
62 
63 -(GtkFlowBoxChild*)getChildAtIndex:(gint) idx
64 {
65  return gtk_flow_box_get_child_at_index(GTK_FLOW_BOX([self GOBJECT]), idx);
66 }
67 
69 {
70  return gtk_flow_box_get_column_spacing(GTK_FLOW_BOX([self GOBJECT]));
71 }
72 
74 {
75  return (gtk_flow_box_get_homogeneous(GTK_FLOW_BOX([self GOBJECT])) ? YES : NO);
76 }
77 
79 {
80  return gtk_flow_box_get_max_children_per_line(GTK_FLOW_BOX([self GOBJECT]));
81 }
82 
84 {
85  return gtk_flow_box_get_min_children_per_line(GTK_FLOW_BOX([self GOBJECT]));
86 }
87 
89 {
90  return gtk_flow_box_get_row_spacing(GTK_FLOW_BOX([self GOBJECT]));
91 }
92 
94 {
95  return gtk_flow_box_get_selected_children(GTK_FLOW_BOX([self GOBJECT]));
96 }
97 
98 -(GtkSelectionMode)getSelectionMode
99 {
100  return gtk_flow_box_get_selection_mode(GTK_FLOW_BOX([self GOBJECT]));
101 }
102 
103 -(void)insertWithWidget:(CGTKWidget*) widget andPosition:(gint) position
104 {
105  gtk_flow_box_insert(GTK_FLOW_BOX([self GOBJECT]), [widget WIDGET], position);
106 }
107 
109 {
110  gtk_flow_box_invalidate_filter(GTK_FLOW_BOX([self GOBJECT]));
111 }
112 
114 {
115  gtk_flow_box_invalidate_sort(GTK_FLOW_BOX([self GOBJECT]));
116 }
117 
118 -(void)selectAll
119 {
120  gtk_flow_box_select_all(GTK_FLOW_BOX([self GOBJECT]));
121 }
122 
123 -(void)selectChild:(GtkFlowBoxChild*) child
124 {
125  gtk_flow_box_select_child(GTK_FLOW_BOX([self GOBJECT]), child);
126 }
127 
128 -(void)selectedForeachWithFunc:(GtkFlowBoxForeachFunc) func andData:(gpointer) data
129 {
130  gtk_flow_box_selected_foreach(GTK_FLOW_BOX([self GOBJECT]), func, data);
131 }
132 
133 -(void)setActivateOnSingleClick:(BOOL) single
134 {
135  gtk_flow_box_set_activate_on_single_click(GTK_FLOW_BOX([self GOBJECT]), (single ? TRUE : FALSE));
136 }
137 
138 -(void)setColumnSpacing:(guint) spacing
139 {
140  gtk_flow_box_set_column_spacing(GTK_FLOW_BOX([self GOBJECT]), spacing);
141 }
142 
143 -(void)setFilterFuncWithFilterFunc:(GtkFlowBoxFilterFunc) filterFunc andUserData:(gpointer) userData andDestroy:(GDestroyNotify) destroy
144 {
145  gtk_flow_box_set_filter_func(GTK_FLOW_BOX([self GOBJECT]), filterFunc, userData, destroy);
146 }
147 
148 -(void)setHadjustment:(GtkAdjustment*) adjustment
149 {
150  gtk_flow_box_set_hadjustment(GTK_FLOW_BOX([self GOBJECT]), adjustment);
151 }
152 
153 -(void)setHomogeneous:(BOOL) homogeneous
154 {
155  gtk_flow_box_set_homogeneous(GTK_FLOW_BOX([self GOBJECT]), (homogeneous ? TRUE : FALSE));
156 }
157 
158 -(void)setMaxChildrenPerLine:(guint) nchildren
159 {
160  gtk_flow_box_set_max_children_per_line(GTK_FLOW_BOX([self GOBJECT]), nchildren);
161 }
162 
163 -(void)setMinChildrenPerLine:(guint) nchildren
164 {
165  gtk_flow_box_set_min_children_per_line(GTK_FLOW_BOX([self GOBJECT]), nchildren);
166 }
167 
168 -(void)setRowSpacing:(guint) spacing
169 {
170  gtk_flow_box_set_row_spacing(GTK_FLOW_BOX([self GOBJECT]), spacing);
171 }
172 
173 -(void)setSelectionMode:(GtkSelectionMode) mode
174 {
175  gtk_flow_box_set_selection_mode(GTK_FLOW_BOX([self GOBJECT]), mode);
176 }
177 
178 -(void)setSortFuncWithSortFunc:(GtkFlowBoxSortFunc) sortFunc andUserData:(gpointer) userData andDestroy:(GDestroyNotify) destroy
179 {
180  gtk_flow_box_set_sort_func(GTK_FLOW_BOX([self GOBJECT]), sortFunc, userData, destroy);
181 }
182 
183 -(void)setVadjustment:(GtkAdjustment*) adjustment
184 {
185  gtk_flow_box_set_vadjustment(GTK_FLOW_BOX([self GOBJECT]), adjustment);
186 }
187 
189 {
190  gtk_flow_box_unselect_all(GTK_FLOW_BOX([self GOBJECT]));
191 }
192 
193 -(void)unselectChild:(GtkFlowBoxChild*) child
194 {
195  gtk_flow_box_unselect_child(GTK_FLOW_BOX([self GOBJECT]), child);
196 }
197 
198 
199 @end
GObject * GOBJECT()
Definition: CGTKBase.m:82
guint getRowSpacing()
Definition: CGTKFlowBox.m:88
void invalidateSort()
Definition: CGTKFlowBox.m:113
guint getMinChildrenPerLine()
Definition: CGTKFlowBox.m:83
id initWithGObject:(GObject *obj)
Definition: CGTKBase.m:48
BOOL getActivateOnSingleClick()
Definition: CGTKFlowBox.m:58
GtkFlowBox * FLOWBOX()
Definition: CGTKFlowBox.m:48
void selectAll()
Definition: CGTKFlowBox.m:118
GtkSelectionMode getSelectionMode()
Definition: CGTKFlowBox.m:98
GList * getSelectedChildren()
Definition: CGTKFlowBox.m:93
guint getMaxChildrenPerLine()
Definition: CGTKFlowBox.m:78
void destroy()
Definition: CGTKWidget.m:131
void invalidateFilter()
Definition: CGTKFlowBox.m:108
GtkWidget * WIDGET()
Definition: CGTKWidget.m:61
guint getColumnSpacing()
Definition: CGTKFlowBox.m:68
void unselectAll()
Definition: CGTKFlowBox.m:188
BOOL getHomogeneous()
Definition: CGTKFlowBox.m:73