CoreGTK  3.18.0
CoreGTK is an Objective-C language binding for the GTK+ widget toolkit
CGTKComboBox.m
1 /*
2  * CGTKComboBox.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/CGTKComboBox.h"
33 
34 @implementation CGTKComboBox
35 
36 -(id)init
37 {
38  self = [super initWithGObject:(GObject *)gtk_combo_box_new()];
39 
40  if(self)
41  {
42  //Do nothing
43  }
44 
45  return self;
46 }
47 
48 -(id)initWithArea:(GtkCellArea*) area
49 {
50  self = [super initWithGObject:(GObject *)gtk_combo_box_new_with_area(area)];
51 
52  if(self)
53  {
54  //Do nothing
55  }
56 
57  return self;
58 }
59 
60 -(id)initWithAreaAndEntry:(GtkCellArea*) area
61 {
62  self = [super initWithGObject:(GObject *)gtk_combo_box_new_with_area_and_entry(area)];
63 
64  if(self)
65  {
66  //Do nothing
67  }
68 
69  return self;
70 }
71 
72 -(id)initWithEntry
73 {
74  self = [super initWithGObject:(GObject *)gtk_combo_box_new_with_entry()];
75 
76  if(self)
77  {
78  //Do nothing
79  }
80 
81  return self;
82 }
83 
84 -(id)initWithModel:(GtkTreeModel*) model
85 {
86  self = [super initWithGObject:(GObject *)gtk_combo_box_new_with_model(model)];
87 
88  if(self)
89  {
90  //Do nothing
91  }
92 
93  return self;
94 }
95 
96 -(id)initWithModelAndEntry:(GtkTreeModel*) model
97 {
98  self = [super initWithGObject:(GObject *)gtk_combo_box_new_with_model_and_entry(model)];
99 
100  if(self)
101  {
102  //Do nothing
103  }
104 
105  return self;
106 }
107 
108 -(GtkComboBox*)COMBOBOX
109 {
110  return GTK_COMBO_BOX([self GOBJECT]);
111 }
112 
113 -(gint)getActive
114 {
115  return gtk_combo_box_get_active(GTK_COMBO_BOX([self GOBJECT]));
116 }
117 
118 -(NSString*)getActiveId
119 {
120  return [NSString stringWithUTF8String:gtk_combo_box_get_active_id(GTK_COMBO_BOX([self GOBJECT]))];
121 }
122 
123 -(BOOL)getActiveIter:(GtkTreeIter*) iter
124 {
125  return (gtk_combo_box_get_active_iter(GTK_COMBO_BOX([self GOBJECT]), iter) ? YES : NO);
126 }
127 
129 {
130  return (gtk_combo_box_get_add_tearoffs(GTK_COMBO_BOX([self GOBJECT])) ? YES : NO);
131 }
132 
133 -(GtkSensitivityType)getButtonSensitivity
134 {
135  return gtk_combo_box_get_button_sensitivity(GTK_COMBO_BOX([self GOBJECT]));
136 }
137 
139 {
140  return gtk_combo_box_get_column_span_column(GTK_COMBO_BOX([self GOBJECT]));
141 }
142 
144 {
145  return gtk_combo_box_get_entry_text_column(GTK_COMBO_BOX([self GOBJECT]));
146 }
147 
149 {
150  return (gtk_combo_box_get_focus_on_click(GTK_COMBO_BOX([self GOBJECT])) ? YES : NO);
151 }
152 
154 {
155  return (gtk_combo_box_get_has_entry(GTK_COMBO_BOX([self GOBJECT])) ? YES : NO);
156 }
157 
159 {
160  return gtk_combo_box_get_id_column(GTK_COMBO_BOX([self GOBJECT]));
161 }
162 
163 -(GtkTreeModel*)getModel
164 {
165  return gtk_combo_box_get_model(GTK_COMBO_BOX([self GOBJECT]));
166 }
167 
168 -(AtkObject*)getPopupAccessible
169 {
170  return gtk_combo_box_get_popup_accessible(GTK_COMBO_BOX([self GOBJECT]));
171 }
172 
174 {
175  return (gtk_combo_box_get_popup_fixed_width(GTK_COMBO_BOX([self GOBJECT])) ? YES : NO);
176 }
177 
178 -(GtkTreeViewRowSeparatorFunc)getRowSeparatorFunc
179 {
180  return gtk_combo_box_get_row_separator_func(GTK_COMBO_BOX([self GOBJECT]));
181 }
182 
184 {
185  return gtk_combo_box_get_row_span_column(GTK_COMBO_BOX([self GOBJECT]));
186 }
187 
188 -(NSString*)getTitle
189 {
190  return [NSString stringWithUTF8String:gtk_combo_box_get_title(GTK_COMBO_BOX([self GOBJECT]))];
191 }
192 
194 {
195  return gtk_combo_box_get_wrap_width(GTK_COMBO_BOX([self GOBJECT]));
196 }
197 
198 -(void)popdown
199 {
200  gtk_combo_box_popdown(GTK_COMBO_BOX([self GOBJECT]));
201 }
202 
203 -(void)popup
204 {
205  gtk_combo_box_popup(GTK_COMBO_BOX([self GOBJECT]));
206 }
207 
208 -(void)popupForDevice:(GdkDevice*) device
209 {
210  gtk_combo_box_popup_for_device(GTK_COMBO_BOX([self GOBJECT]), device);
211 }
212 
213 -(void)setActive:(gint) index
214 {
215  gtk_combo_box_set_active(GTK_COMBO_BOX([self GOBJECT]), index);
216 }
217 
218 -(BOOL)setActiveId:(NSString*) activeId
219 {
220  return (gtk_combo_box_set_active_id(GTK_COMBO_BOX([self GOBJECT]), [activeId UTF8String]) ? YES : NO);
221 }
222 
223 -(void)setActiveIter:(GtkTreeIter*) iter
224 {
225  gtk_combo_box_set_active_iter(GTK_COMBO_BOX([self GOBJECT]), iter);
226 }
227 
228 -(void)setAddTearoffs:(BOOL) addTearoffs
229 {
230  gtk_combo_box_set_add_tearoffs(GTK_COMBO_BOX([self GOBJECT]), (addTearoffs ? TRUE : FALSE));
231 }
232 
233 -(void)setButtonSensitivity:(GtkSensitivityType) sensitivity
234 {
235  gtk_combo_box_set_button_sensitivity(GTK_COMBO_BOX([self GOBJECT]), sensitivity);
236 }
237 
238 -(void)setColumnSpanColumn:(gint) columnSpan
239 {
240  gtk_combo_box_set_column_span_column(GTK_COMBO_BOX([self GOBJECT]), columnSpan);
241 }
242 
243 -(void)setEntryTextColumn:(gint) textColumn
244 {
245  gtk_combo_box_set_entry_text_column(GTK_COMBO_BOX([self GOBJECT]), textColumn);
246 }
247 
248 -(void)setFocusOnClick:(BOOL) focusOnClick
249 {
250  gtk_combo_box_set_focus_on_click(GTK_COMBO_BOX([self GOBJECT]), (focusOnClick ? TRUE : FALSE));
251 }
252 
253 -(void)setIdColumn:(gint) idColumn
254 {
255  gtk_combo_box_set_id_column(GTK_COMBO_BOX([self GOBJECT]), idColumn);
256 }
257 
258 -(void)setModel:(GtkTreeModel*) model
259 {
260  gtk_combo_box_set_model(GTK_COMBO_BOX([self GOBJECT]), model);
261 }
262 
263 -(void)setPopupFixedWidth:(BOOL) fixed
264 {
265  gtk_combo_box_set_popup_fixed_width(GTK_COMBO_BOX([self GOBJECT]), (fixed ? TRUE : FALSE));
266 }
267 
268 -(void)setRowSeparatorFuncWithFunc:(GtkTreeViewRowSeparatorFunc) func andData:(gpointer) data andDestroy:(GDestroyNotify) destroy
269 {
270  gtk_combo_box_set_row_separator_func(GTK_COMBO_BOX([self GOBJECT]), func, data, destroy);
271 }
272 
273 -(void)setRowSpanColumn:(gint) rowSpan
274 {
275  gtk_combo_box_set_row_span_column(GTK_COMBO_BOX([self GOBJECT]), rowSpan);
276 }
277 
278 -(void)setTitle:(NSString*) title
279 {
280  gtk_combo_box_set_title(GTK_COMBO_BOX([self GOBJECT]), [title UTF8String]);
281 }
282 
283 -(void)setWrapWidth:(gint) width
284 {
285  gtk_combo_box_set_wrap_width(GTK_COMBO_BOX([self GOBJECT]), width);
286 }
287 
288 
289 @end
GObject * GOBJECT()
Definition: CGTKBase.m:82
BOOL getPopupFixedWidth()
Definition: CGTKComboBox.m:173
gint getEntryTextColumn()
Definition: CGTKComboBox.m:143
gint getWrapWidth()
Definition: CGTKComboBox.m:193
id initWithGObject:(GObject *obj)
Definition: CGTKBase.m:48
GtkTreeModel * getModel()
Definition: CGTKComboBox.m:163
NSString * getActiveId()
Definition: CGTKComboBox.m:118
BOOL getAddTearoffs()
Definition: CGTKComboBox.m:128
NSString * getTitle()
Definition: CGTKComboBox.m:188
AtkObject * getPopupAccessible()
Definition: CGTKComboBox.m:168
void destroy()
Definition: CGTKWidget.m:131
BOOL getHasEntry()
Definition: CGTKComboBox.m:153
GtkComboBox * COMBOBOX()
Definition: CGTKComboBox.m:108
GtkSensitivityType getButtonSensitivity()
Definition: CGTKComboBox.m:133
BOOL getFocusOnClick()
Definition: CGTKComboBox.m:148
gint getColumnSpanColumn()
Definition: CGTKComboBox.m:138
gint getRowSpanColumn()
Definition: CGTKComboBox.m:183
GtkTreeViewRowSeparatorFunc getRowSeparatorFunc()
Definition: CGTKComboBox.m:178
gint getIdColumn()
Definition: CGTKComboBox.m:158