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

#import <CGTK.h>

Inheritance diagram for CGTK:

Instance Methods

(void) - keySnooperRemove:
 

Class Methods

(NSString *) + coreGtkVersion
 
(void) + disableSetlocal
 
(PangoLanguage *) + getDefaultLanguage
 
(BOOL) + parseArgsWithArgc:andArgv:
 
(void) + initWithArgc:andArgv:
 
(int) + autoInitWithArgc:andArgv:
 
(BOOL) + initCheckWithArgc:andArgv:
 
(BOOL) + initWithArgsWithArgc:andArgv:andParameterString:andEntries:andTranslationDomain:andError:
 
(GOptionGroup *) + getOptionGroup:
 
(BOOL) + eventsPending
 
(void) + main
 
(NSNumber *) + mainLevel
 
(void) + mainQuit
 
(BOOL) + mainIteration
 
(BOOL) + mainIterationDoWithBlocking:
 
(void) + mainDoEvent:
 
(NSNumber *) + keySnooperInstallWithSnooper:andFuncData:
 
(GdkEvent *) + getCurrentEvent
 
(NSNumber *) + getCurrentEventTime
 
(BOOL) + getCurrentEventState:
 
(gboolean) + getGboolean:
 
(BOOL) + getBOOL:
 

Detailed Description

CGTK abstracts all of the common high-level GTK commands

Method Documentation

+ (int) autoInitWithArgc: (int)  argc
andArgv: (char *[])  argv 

Same as initWithArgc:andArgv: but does the type conversion automatically.

Parameters
argcAddress of the argc parameter of your main function (or 0 if argv is NULL). This will be changed if any arguments were handled. [inout]
argvAddress of the argv parameter of main, or NULL. Any options understood by GTK+ are stripped before return. [array length=argc][inout][allow-none]
Returns
modified argc value
See Also
+ initWithArgc:andArgv:
+ (NSString *) coreGtkVersion

Returns the CoreGTK version string

Returns
the version string
+ (void) disableSetlocal

Prevents initWithArgc:andArgv:, initCheckWithArgc:andArgv: and parseArgsWithArgc:andArgv: from automatically calling setlocale (LC_ALL, ""). You would want to use this function if you wanted to set the locale for your program to something other than the user's locale, or if you wanted to set different values for different locale categories.

See Also
+ initWithArgc:andArgv:
+ initCheckWithArgc:andArgv:
+ parseArgsWithArgc:andArgv:
+ (BOOL) eventsPending

Checks if any events are pending.

This can be used to update the UI and invoke timeouts etc. while doing some time intensive computation.

Returns
YES if any events are pending, NO otherwise
+ (BOOL) getBOOL: (gboolean)  b

Converts a gboolean to a BOOL

Parameters
ba gboolean
Returns
a BOOL
+ (GdkEvent *) getCurrentEvent

Obtains a copy of the event currently being processed by GTK+.

For example, if you are handling a "clicked" signal, the current event will be the GdkEventButton that triggered the ::clicked signal.

Returns
a copy of the current event, or NULL if there is no current event. The returned event must be freed with gdk_event_free(). [transfer full]
+ (BOOL) getCurrentEventState: (GdkModifierType *)  state

If there is a current event and it has a state field, place that state field in state and return YES, otherwise return NO.

Parameters
statea location to store the state of the current event. [out]
Returns
YES if there was a current event and it had a state field
+ (NSNumber *) getCurrentEventTime

If there is a current event and it has a timestamp, return that timestamp, otherwise return GDK_CURRENT_TIME.

Returns
the timestamp from the current event, or GDK_CURRENT_TIME
+ (PangoLanguage *) getDefaultLanguage

Returns the PangoLanguage for the default language currently in effect. (Note that this can change over the life of an application.) The default language is derived from the current locale. It determines, for example, whether GTK+ uses the right-to-left or left-to-right text direction.

Returns
the default language as a PangoLanguage, must not be freed
+ (gboolean) getGboolean: (BOOL)  b

Converts a BOOL to a gboolean

Parameters
ba BOOL
Returns
a gboolean
+ (GOptionGroup *) getOptionGroup: (BOOL)  openDefaultDisplay

Returns a GOptionGroup for the commandline arguments recognized by GTK+ and GDK.

You should add this group to your GOptionContext with g_option_context_add_group(), if you are using g_option_context_parse() to parse your commandline arguments.

Parameters
openDefaultDisplaywhether to open the default display when parsing the commandline arguments
Returns
a GOptionGroup for the commandline arguments recognized by GTK+
+ (BOOL) initCheckWithArgc: (int *)  argc
andArgv: (char ***)  argv 

This function does the same work as initWithArgc:andArgv: with only a single change: It does not terminate the program if the windowing system can't be initialized. Instead it returns FALSE on failure.

This way the application can fall back to some other means of communication with the user - for example a curses or command line interface.

Parameters
argcAddress of the argc parameter of your main function (or 0 if argv is NULL). This will be changed if any arguments were handled. [inout]
argvAddress of the argv parameter of main, or NULL. Any options understood by GTK+ are stripped before return. [array length=argc][inout][allow-none]
Returns
YES if the windowing system has been successfully initialized, NO otherwise
See Also
+ initWithArgc:andArgv:
+ (void) initWithArgc: (int *)  argc
andArgv: (char ***)  argv 

Call this function before using any other GTK+ functions in your GUI applications. It will initialize everything needed to operate the toolkit and parses some standard command line options.

Although you are expected to pass the argc, argv parameters from main to this function, it is possible to pass NULL if argv is not available or commandline handling is not required.

argc and argv are adjusted accordingly so your own code will never see those standard arguments.

Parameters
argcAddress of the argc parameter of your main function (or 0 if argv is NULL). This will be changed if any arguments were handled. [inout]
argvAddress of the argv parameter of main, or NULL. Any options understood by GTK+ are stripped before return. [array length=argc][inout][allow-none]
+ (BOOL) initWithArgsWithArgc: (int *)  argc
andArgv: (char ***)  argv
andParameterString: (NSString *)  parameterString
andEntries: (GOptionEntry *)  entries
andTranslationDomain: (NSString *)  translationDomain
andError: (GError **)  error 

This function does the same work as initCheckWithArgc:andArgv:. Additionally, it allows you to add your own commandline options, and it automatically generates nicely formatted –help output. Note that your program will be terminated after writing out the help output.

Parameters
argca pointer to the number of command line arguments.
argva pointer to the array of command line arguments. [inout][array length=argc]
parameterStringa string which is displayed in the first line of –help output, after programname [OPTION...]
entriesa NULL-terminated array of GOptionEntrys describing the options of your program. [array zero-terminated=1]
translationDomaina translation domain to use for translating the –help output for the options in entries with gettext(), or NULL
errora return location for errors
Returns
YES if the GUI has been successfully initialized, NO otherwise.
See Also
+ initCheckWithArgc:andArgv:
+ (NSNumber *) keySnooperInstallWithSnooper: (GtkKeySnoopFunc)  snooper
andFuncData: (gpointer)  funcData 

Installs a key snooper function, which will get called on all key events before delivering them normally.

Parameters
snoopera GtkKeySnoopFunc.
funcDatadata to pass to snooper.
Returns
a unique id for this key snooper for use with keySnooperRemove:.
See Also
- keySnooperRemove:
- (void) keySnooperRemove: (NSNumber *)  snooperHandlerId

Removes the key snooper function with the given id.

Parameters
snooperHandlerIdIdentifies the key snooper to remove.
+ (void) main

Runs the main loop until mainQuit is called. You can nest calls to main. In that case mainQuit will make the innermost invocation of the main loop return.

See Also
+ mainQuit
+ (void) mainDoEvent: (GdkEvent *)  event

Processes a single GDK event.

Parameters
eventAn event to process (normally passed by GDK)
+ (BOOL) mainIteration

Runs a single iteration of the mainloop.

If no events are waiting to be processed GTK+ will block until the next event is noticed. If you don't want to block look at mainIterationDoWithBlocking or check if any events are pending with eventsPending first.

See Also
mainIterationDoWithBlocking
+ eventsPending
+ (BOOL) mainIterationDoWithBlocking: (BOOL)  blocking

Runs a single iteration of the mainloop. If no events are available either return or block depending on the value of blocking.

Parameters
blockingYES if you want GTK+ to block if no events are pending
Returns
YES if mainQuit has been called for the innermost mainloop
See Also
+ mainQuit
+ (NSNumber *) mainLevel

Asks for the current nesting level of the main loop.

Returns
the nesting level of the current invocation of the main loop
+ (void) mainQuit

Makes the innermost invocation of the main loop return when it regains control.

+ (BOOL) parseArgsWithArgc: (int *)  argc
andArgv: (char ***)  argv 

Parses command line arguments, and initializes global attributes of GTK+, but does not actually open a connection to a display. (See gdk_display_open(), gdk_get_display_arg_name())

Any arguments used by GTK+ or GDK are removed from the array and argc and argv are updated accordingly.

There is no need to call this function explicitely if you are using init, or initCheck.

Parameters
argca pointer to the number of command line arguments. [inout]
argva pointer to the array of command line arguments. [array length=argc] [inout]
Returns
YES if initialization succeeded, otherwise NO

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