CoreGTK 3.18.0 CoreGTK is an Objective-C language binding for the GTK+ widget toolkit

- Main Page
- Classes
- Files

- File List

CGTKContainer.m
1 /*
2 * CGTKContainer.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/CGTKContainer.h"
33
34 @implementation CGTKContainer
35
36 -(void)addWidget:(CGTKWidget *)widget withProperties:(NSDictionary *)properties
37 {
38 CGTKTypeWrapper *wrapper;
39 for(NSString *propName in properties)
40 {
41 wrapper = [properties objectForKey:propName];
42
43 gtk_container_child_set_property([self CONTAINER], [widget WIDGET], [propName UTF8String], [wrapper asGValuePtr]);
44 }
45 }
46
47 -(GtkContainer*)CONTAINER
48 {
49 return GTK_CONTAINER([self GOBJECT]);
50 }
51
52 -(void)add:(CGTKWidget*) widget
53 {
54 gtk_container_add(GTK_CONTAINER([self GOBJECT]), [widget WIDGET]);
55 }
56
57 -(void)checkResize
58 {
59 gtk_container_check_resize(GTK_CONTAINER([self GOBJECT]));
60 }
61
62 -(void)childGetPropertyWithChild:(CGTKWidget*) child andPropertyName:(NSString*) propertyName andValue:(GValue*) value
63 {
64 gtk_container_child_get_property(GTK_CONTAINER([self GOBJECT]), [child WIDGET], [propertyName UTF8String], value);
65 }
66
67 -(void)childGetValistWithChild:(CGTKWidget*) child andFirstPropertyName:(NSString*) firstPropertyName andVarArgs:(va_list) varArgs
68 {
69 gtk_container_child_get_valist(GTK_CONTAINER([self GOBJECT]), [child WIDGET], [firstPropertyName UTF8String], varArgs);
70 }
71
72 -(void)childNotifyWithChild:(CGTKWidget*) child andChildProperty:(NSString*) childProperty
73 {
74 gtk_container_child_notify(GTK_CONTAINER([self GOBJECT]), [child WIDGET], [childProperty UTF8String]);
75 }
76
77 -(void)childNotifyByPspecWithChild:(CGTKWidget*) child andPspec:(GParamSpec*) pspec
78 {
79 gtk_container_child_notify_by_pspec(GTK_CONTAINER([self GOBJECT]), [child WIDGET], pspec);
80 }
81
82 -(void)childSetPropertyWithChild:(CGTKWidget*) child andPropertyName:(NSString*) propertyName andValue:(const GValue*) value
83 {
84 gtk_container_child_set_property(GTK_CONTAINER([self GOBJECT]), [child WIDGET], [propertyName UTF8String], value);
85 }
86
87 -(void)childSetValistWithChild:(CGTKWidget*) child andFirstPropertyName:(NSString*) firstPropertyName andVarArgs:(va_list) varArgs
88 {
89 gtk_container_child_set_valist(GTK_CONTAINER([self GOBJECT]), [child WIDGET], [firstPropertyName UTF8String], varArgs);
90 }
91
92 -(GType)childType
93 {
94 return gtk_container_child_type(GTK_CONTAINER([self GOBJECT]));
95 }
96
97 -(void)forallWithCallback:(GtkCallback) callback andCallbackData:(gpointer) callbackData
98 {
99 gtk_container_forall(GTK_CONTAINER([self GOBJECT]), callback, callbackData);
100 }
101
102 -(void)foreachWithCallback:(GtkCallback) callback andCallbackData:(gpointer) callbackData
103 {
104 gtk_container_foreach(GTK_CONTAINER([self GOBJECT]), callback, callbackData);
105 }
106
107 -(guint)getBorderWidth
108 {
109 return gtk_container_get_border_width(GTK_CONTAINER([self GOBJECT]));
110 }
111
112 -(GList*)getChildren
113 {
114 return gtk_container_get_children(GTK_CONTAINER([self GOBJECT]));
115 }
116
117 -(BOOL)getFocusChain:(GList**) focusableWidgets
118 {
119 return (gtk_container_get_focus_chain(GTK_CONTAINER([self GOBJECT]), focusableWidgets) ? YES : NO);
120 }
121
122 -(CGTKWidget*)getFocusChild
123 {
124 return [[CGTKWidget alloc] initWithGObject:(GObject *)gtk_container_get_focus_child(GTK_CONTAINER([self GOBJECT]))];
125 }
126
127 -(GtkAdjustment*)getFocusHadjustment
128 {
129 return gtk_container_get_focus_hadjustment(GTK_CONTAINER([self GOBJECT]));
130 }
131
132 -(GtkAdjustment*)getFocusVadjustment
133 {
134 return gtk_container_get_focus_vadjustment(GTK_CONTAINER([self GOBJECT]));
135 }
136
137 -(GtkWidgetPath*)getPathForChild:(CGTKWidget*) child
138 {
139 return gtk_container_get_path_for_child(GTK_CONTAINER([self GOBJECT]), [child WIDGET]);
140 }
141
142 -(GtkResizeMode)getResizeMode
143 {
144 return gtk_container_get_resize_mode(GTK_CONTAINER([self GOBJECT]));
145 }
146
147 -(void)propagateDrawWithChild:(CGTKWidget*) child andCr:(cairo_t*) cr
148 {
149 gtk_container_propagate_draw(GTK_CONTAINER([self GOBJECT]), [child WIDGET], cr);
150 }
151
152 -(void)remove:(CGTKWidget*) widget
153 {
154 gtk_container_remove(GTK_CONTAINER([self GOBJECT]), [widget WIDGET]);
155 }
156
157 -(void)resizeChildren
158 {
159 gtk_container_resize_children(GTK_CONTAINER([self GOBJECT]));
160 }
161
162 -(void)setBorderWidth:(guint) borderWidth
163 {
164 gtk_container_set_border_width(GTK_CONTAINER([self GOBJECT]), borderWidth);
165 }
166
167 -(void)setFocusChain:(GList*) focusableWidgets
168 {
169 gtk_container_set_focus_chain(GTK_CONTAINER([self GOBJECT]), focusableWidgets);
170 }
171
172 -(void)setFocusChild:(CGTKWidget*) child
173 {
174 gtk_container_set_focus_child(GTK_CONTAINER([self GOBJECT]), [child WIDGET]);
175 }
176
177 -(void)setFocusHadjustment:(GtkAdjustment*) adjustment
178 {
179 gtk_container_set_focus_hadjustment(GTK_CONTAINER([self GOBJECT]), adjustment);
180 }
181
182 -(void)setFocusVadjustment:(GtkAdjustment*) adjustment
183 {
184 gtk_container_set_focus_vadjustment(GTK_CONTAINER([self GOBJECT]), adjustment);
185 }
186
187 -(void)setReallocateRedraws:(BOOL) needsRedraws
188 {
189 gtk_container_set_reallocate_redraws(GTK_CONTAINER([self GOBJECT]), (needsRedraws ? TRUE : FALSE));
190 }
191
192 -(void)setResizeMode:(GtkResizeMode) resizeMode
193 {
194 gtk_container_set_resize_mode(GTK_CONTAINER([self GOBJECT]), resizeMode);
195 }
196
197 -(void)unsetFocusChain
198 {
199 gtk_container_unset_focus_chain(GTK_CONTAINER([self GOBJECT]));
200 }
201
202
203 @end
-[CGTKBase GOBJECT]
GObject * GOBJECT()
Definition: CGTKBase.m:82
-[CGTKContainer CONTAINER]
GtkContainer * CONTAINER()
Definition: CGTKContainer.m:47
-[CGTKContainer resizeChildren]
void resizeChildren()
Definition: CGTKContainer.m:157
CGTKTypeWrapper
Definition: CGTKTypeWrapper.h:38
-[CGTKContainer childType]
GType childType()
Definition: CGTKContainer.m:92
-[CGTKContainer getFocusHadjustment]
GtkAdjustment * getFocusHadjustment()
Definition: CGTKContainer.m:127
-[CGTKContainer unsetFocusChain]
void unsetFocusChain()
Definition: CGTKContainer.m:197
-[CGTKWidget WIDGET]
GtkWidget * WIDGET()
Definition: CGTKWidget.m:61
-[CGTKContainer getChildren]
GList * getChildren()
Definition: CGTKContainer.m:112
-[CGTKContainer getFocusVadjustment]
GtkAdjustment * getFocusVadjustment()
Definition: CGTKContainer.m:132
-[CGTKContainer getResizeMode]
GtkResizeMode getResizeMode()
Definition: CGTKContainer.m:142
CGTKContainer
Definition: CGTKContainer.h:34
-[CGTKContainer getBorderWidth]
guint getBorderWidth()
Definition: CGTKContainer.m:107
-[CGTKContainer getFocusChild]
CGTKWidget * getFocusChild()
Definition: CGTKContainer.m:122
CGTKWidget
Definition: CGTKWidget.h:34
-[CGTKContainer checkResize]
void checkResize()
Definition: CGTKContainer.m:57