CoreGTK  2.24.0
CoreGTK is an Objective-C language binding for the GTK+ widget toolkit
 All Classes Functions Variables
Instance Methods | Class Methods | Protected Attributes | List of all members
CGTKBuilder Class Reference

#import <CGTKBuilder.h>

Inheritance diagram for CGTKBuilder:

Instance Methods

(GtkBuilder *) - BUILDER
 
(NSNumber *) - addFromFileWithFilename:andError:
 
(BOOL) - addFromFile:
 
(NSNumber *) - addFromStringWithBuffer:andLength:andError:
 
(BOOL) - addFromStringWithBuffer:andLength:
 
(GObject *) - getObject:
 
(GSList *) - getObjects
 
(CGTKWidget *) - getWidgetWithName:
 
(void) - connectSignals:
 
(void) - connectSignalsFullWithFunc:andUserData:
 
(void) - connectSignalsToObjects:
 
(void) - setTranslationDomain:
 
(NSString *) - getTranslationDomain
 
(GType) - getTypeFromName:
 
(BOOL) - valueFromStringWithPspec:andString:andValue:andError:
 
(BOOL) - valueFromStringTypeWithType:andString:andValue:andError:
 

Class Methods

(void) + setDebug:
 

Protected Attributes

GtkBuilder * _builder
 

Detailed Description

CGTKBuilder wraps GtkBuilder

Method Documentation

- (BOOL) addFromFile: (NSString *)  filename

The same as addFromFileWithFilename:andError: but rather than returning an error and error value this simply returns YES or NO

Parameters
filenamethe name of the file to parse
Returns
YES on success, NO otherwise
See Also
- addFromFileWithFilename:andError:
- (NSNumber *) addFromFileWithFilename: (NSString *)  filename
andError: (GError **)  error 

Parses a file containing a GtkBuilder UI definition and merges it with the current contents of builder.

Upon errors 0 will be returned and error will be assigned a GError from the GTK_BUILDER_ERROR, G_MARKUP_ERROR or G_FILE_ERROR domain.

Parameters
filenamethe name of the file to parse
errorreturn location for an error, or NULL. [allow-none]
Returns
A positive value on success, 0 if an error occurred
- (BOOL) addFromStringWithBuffer: (NSString *)  buffer
andLength: (gsize)  length 

The same as addFromStringWithBuffer:andLength:andError: but rather than returning an error and error value this simply returns YES or NO

Parameters
bufferthe string to parse
lengththe length of buffer (may be -1 if buffer is nul-terminated)
Returns
YES on success, NO otherwise
See Also
- addFromStringWithBuffer:andLength:andError:
- (NSNumber *) addFromStringWithBuffer: (NSString *)  buffer
andLength: (gsize)  length
andError: (GError **)  error 

Parses a string containing a GtkBuilder UI definition and merges it with the current contents of builder.

Upon errors 0 will be returned and error will be assigned a GError from the GTK_BUILDER_ERROR or G_MARKUP_ERROR domain.

Parameters
bufferthe string to parse
lengththe length of buffer (may be -1 if buffer is nul-terminated)
errorreturn location for an error, or NULL. [allow-none]
Returns
A positive value on success, 0 if an error occurred
- (GtkBuilder *) BUILDER

Gets the internal GtkBuilder

Returns
the internal GtkBuilder or NULL
- (void) connectSignals: (gpointer)  userData

This method is a simpler variation of connectSignalsFullWithFunc:andUserData:. It uses GModule's introspective features (by opening the module NULL) to look at the application's symbol table. From here it tries to match the signal handler names given in the interface description with symbols in the application and connects the signals.

Note that this function will not work correctly if GModule is not supported on the platform.

When compiling applications for Windows, you must declare signal callbacks with G_MODULE_EXPORT, or they will not be put in the symbol table. On Linux and Unices, this is not necessary; applications should instead be compiled with the -Wl,–export-dynamic CFLAGS, and linked against gmodule-export-2.0.

Parameters
userDataa pointer to a structure sent in as user data to all signals
See Also
- connectSignalsFullWithFunc:andUserData:
- (void) connectSignalsFullWithFunc: (GtkBuilderConnectFunc)  func
andUserData: (gpointer)  userData 

This function can be thought of the interpreted language binding version of connectSignals:, except that it does not require GModule to function correctly.

Parameters
functhe function used to connect the signals. [scope call]
userDataarbitrary data that will be passed to the connection function
See Also
- connectSignals:
- (void) connectSignalsToObjects: (NSDictionary *)  objectSignalDictionary

Similar to the other connect signals functions, this takes a dictionary key'd on CallbackData objects (configured with class/selectors) and their associated signals as values and connects them accordingly.

Example usage: NSDictionary *dict = [[NSDictionary alloc] initWithObjectsAndKeys: [CallbackData withObject:[CGTK class] andSEL:(endMainLoop)], "mainQuit", [CallbackData withObject:button andSEL:(clicked)], "on_button1_activate", [CallbackData withObject:button andSEL:(clicked)], "on_button2_clicked", nil];

[builder connectSignalsToObjects:dict];

Parameters
objectSignalDictionaryA dictionary mapping CallbackData objects to NSString signal names
- (GObject *) getObject: (NSString *)  name

Gets the object named name. Note that this function does not increment the reference count of the returned object.

Parameters
namename of object to get
Returns
the object named name or NULL if it could not be found in the object tree. [transfer none]
- (GSList *) getObjects

Gets all objects that have been constructed by builder. Note that this function does not increment the reference counts of the returned objects.

Returns
a newly-allocated GSList containing all the objects constructed by the GtkBuilder instance. It should be freed by g_slist_free(). [element-type GObject][transfer container]
- (NSString *) getTranslationDomain

Gets the translation domain of builder.

Returns
the translation domain. This string is owned by the builder object and must not be modified or freed.
- (GType) getTypeFromName: (NSString *)  typeName

Looks up a type by name, using the virtual function that GtkBuilder has for that purpose. This is mainly used when implementing the GtkBuildable interface on a type.

Parameters
typeNametype name to lookup
Returns
the GType found for type_name or G_TYPE_INVALID if no type was found
- (CGTKWidget *) getWidgetWithName: (NSString *)  name

Attempts to get the object witht he name returning it as a CGTKWidget. If the object is not found or not compatible with CGTKWidget this will return nil.

Parameters
namethe name of the object to return
Returns
the CGTKWidget or nil
+ (void) setDebug: (BOOL)  debugEnabled

When enabled this builder will print out signal connection debug info

- (void) setTranslationDomain: (NSString *)  domain

Sets the translation domain of builder. See "translation-domain".

Parameters
domainthe translation domain or NULL. [allow-none]
- (BOOL) valueFromStringTypeWithType: (GType)  type
andString: (NSString *)  string
andValue: (GValue *)  value
andError: (GError **)  error 

Like valueFromStringWithPspec:andString:andValue:andError:, this function demarshals a value from a string, but takes a GType instead of GParamSpec. This function calls g_value_init() on the value argument, so it need not be initialised beforehand.

This function can handle char, uchar, boolean, int, uint, long, ulong, enum, flags, float, double, string, GdkColor and GtkAdjustment type values. Support for GtkWidget type values is still to come.

Upon errors NO will be returned and error will be assigned a GError from the GTK_BUILDER_ERROR domain.

Parameters
typethe GType of the value
stringthe string representation of the value
valuethe GValue to store the result in. [out]
errorreturn location for an errorgtk_builder_value_from_string , or NULL. [allow-none]
Returns
YES on success
See Also
- valueFromStringWithPspec:andString:andValue:andError:
- (BOOL) valueFromStringWithPspec: (GParamSpec *)  pspec
andString: (NSString *)  string
andValue: (GValue *)  value
andError: (GError **)  error 

This function demarshals a value from a string. This function calls g_value_init() on the value argument, so it need not be initialised beforehand.

This function can handle char, uchar, boolean, int, uint, long, ulong, enum, flags, float, double, string, GdkColor and GtkAdjustment type values. Support for GtkWidget type values is still to come.

Upon errors NO will be returned and error will be assigned a GError from the GTK_BUILDER_ERROR domain.

Parameters
pspecthe GParamSpec for the property
stringthe string representation of the value
valuethe GValue to store the result in. [out]
errorreturn location for an errorgtk_builder_value_from_string , or NULL. [allow-none]
Returns
YES on success

The documentation for this class was generated from the following file: