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

- Main Page
- Classes
- Files

- File List

All Classes Functions Variables
CGTKBuilder.m
1 /*
2 * CGTKBuilder.m
3 * This file is part of CoreGTK
4 *
5 * Copyright (C) 2015 - 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, 2015. 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/CGTKBuilder.h"
33
34 @implementation CGTKBuilder
35
36 -(id)init
37 {
38 self = [super initWithGObject:(GObject *)gtk_builder_new()];
39
40 if(self)
41 {
42 //Do nothing
43 }
44
45 return self;
46 }
47
48 -(id)initFromFile:(NSString*) filename
49 {
50 self = [super initWithGObject:(GObject *)gtk_builder_new_from_file([filename UTF8String])];
51
52 if(self)
53 {
54 //Do nothing
55 }
56
57 return self;
58 }
59
60 -(id)initFromResource:(NSString*) resourcePath
61 {
62 self = [super initWithGObject:(GObject *)gtk_builder_new_from_resource([resourcePath UTF8String])];
63
64 if(self)
65 {
66 //Do nothing
67 }
68
69 return self;
70 }
71
72 -(id)initFromStringWithString:(NSString*) string andLength:(gssize) length
73 {
74 self = [super initWithGObject:(GObject *)gtk_builder_new_from_string([string UTF8String], length)];
75
76 if(self)
77 {
78 //Do nothing
79 }
80
81 return self;
82 }
83
84 -(GtkBuilder*)BUILDER
85 {
86 return GTK_BUILDER([self GOBJECT]);
87 }
88
89 -(void)addCallbackSymbolWithCallbackName:(NSString*) callbackName andCallbackSymbol:(GCallback) callbackSymbol
90 {
91 gtk_builder_add_callback_symbol(GTK_BUILDER([self GOBJECT]), [callbackName UTF8String], callbackSymbol);
92 }
93
94 -(guint)addFromFileWithFilename:(NSString*) filename andErr:(GError**) err
95 {
96 return gtk_builder_add_from_file(GTK_BUILDER([self GOBJECT]), [filename UTF8String], err);
97 }
98
99 -(guint)addFromResourceWithResourcePath:(NSString*) resourcePath andErr:(GError**) err
100 {
101 return gtk_builder_add_from_resource(GTK_BUILDER([self GOBJECT]), [resourcePath UTF8String], err);
102 }
103
104 -(guint)addFromStringWithBuffer:(NSString*) buffer andLength:(gsize) length andErr:(GError**) err
105 {
106 return gtk_builder_add_from_string(GTK_BUILDER([self GOBJECT]), [buffer UTF8String], length, err);
107 }
108
109 -(guint)addObjectsFromFileWithFilename:(NSString*) filename andObjectIds:(gchar**) objectIds andErr:(GError**) err
110 {
111 return gtk_builder_add_objects_from_file(GTK_BUILDER([self GOBJECT]), [filename UTF8String], objectIds, err);
112 }
113
114 -(guint)addObjectsFromResourceWithResourcePath:(NSString*) resourcePath andObjectIds:(gchar**) objectIds andErr:(GError**) err
115 {
116 return gtk_builder_add_objects_from_resource(GTK_BUILDER([self GOBJECT]), [resourcePath UTF8String], objectIds, err);
117 }
118
119 -(guint)addObjectsFromStringWithBuffer:(NSString*) buffer andLength:(gsize) length andObjectIds:(gchar**) objectIds andErr:(GError**) err
120 {
121 return gtk_builder_add_objects_from_string(GTK_BUILDER([self GOBJECT]), [buffer UTF8String], length, objectIds, err);
122 }
123
124 -(void)connectSignals:(gpointer) userData
125 {
126 gtk_builder_connect_signals(GTK_BUILDER([self GOBJECT]), userData);
127 }
128
129 -(void)connectSignalsFullWithFunc:(GtkBuilderConnectFunc) func andUserData:(gpointer) userData
130 {
131 gtk_builder_connect_signals_full(GTK_BUILDER([self GOBJECT]), func, userData);
132 }
133
134 -(void)exposeObjectWithName:(NSString*) name andObject:(GObject*) object
135 {
136 gtk_builder_expose_object(GTK_BUILDER([self GOBJECT]), [name UTF8String], object);
137 }
138
139 -(GObject*)getObject:(NSString*) name
140 {
141 return gtk_builder_get_object(GTK_BUILDER([self GOBJECT]), [name UTF8String]);
142 }
143
144 -(GSList*)getObjects
145 {
146 return gtk_builder_get_objects(GTK_BUILDER([self GOBJECT]));
147 }
148
149 -(NSString*)getTranslationDomain
150 {
151 return [NSString stringWithUTF8String:gtk_builder_get_translation_domain(GTK_BUILDER([self GOBJECT]))];
152 }
153
154 -(GType)getTypeFromName:(const char*) typeName
155 {
156 return gtk_builder_get_type_from_name(GTK_BUILDER([self GOBJECT]), typeName);
157 }
158
159 -(GCallback)lookupCallbackSymbol:(NSString*) callbackName
160 {
161 return gtk_builder_lookup_callback_symbol(GTK_BUILDER([self GOBJECT]), [callbackName UTF8String]);
162 }
163
164 -(void)setTranslationDomain:(NSString*) domain
165 {
166 gtk_builder_set_translation_domain(GTK_BUILDER([self GOBJECT]), [domain UTF8String]);
167 }
168
169 -(BOOL)valueFromStringWithPspec:(GParamSpec*) pspec andString:(NSString*) string andValue:(GValue*) value andErr:(GError**) err
170 {
171 return (gtk_builder_value_from_string(GTK_BUILDER([self GOBJECT]), pspec, [string UTF8String], value, err) ? YES : NO);
172 }
173
174 -(BOOL)valueFromStringTypeWithType:(GType) type andString:(NSString*) string andValue:(GValue*) value andErr:(GError**) err
175 {
176 return (gtk_builder_value_from_string_type(GTK_BUILDER([self GOBJECT]), type, [string UTF8String], value, err) ? YES : NO);
177 }
178
179
180 @end
-[CGTKBase GOBJECT]
GObject * GOBJECT()
Definition: CGTKBase.m:82
-[CGTKBuilder getTranslationDomain]
NSString * getTranslationDomain()
Definition: CGTKBuilder.m:149
-[CGTKBase initWithGObject:]
id initWithGObject:(GObject *obj)
Definition: CGTKBase.m:48
-[CGTKBuilder init]
id init()
Definition: CGTKBuilder.m:36
-[CGTKBuilder BUILDER]
GtkBuilder * BUILDER()
Definition: CGTKBuilder.m:84
-[CGTKBuilder getObjects]
GSList * getObjects()
Definition: CGTKBuilder.m:144
CGTKBuilder
Definition: CGTKBuilder.h:34