Class GTK

Inherits from:
NSObject
Declared in:
GToolKit/GTK.h

Class Hierarchy

    NSObject
      |
      +---GTK

Class Description

GTK is the base class of almost all classes in the Objective-C interface to the GIMP Toolkit. It provides access to the internal gtk-object and methods to connect signals to actions, which represent object/selector combinations. Because these "wrapper" objects do not carry (or cache) state information about their corresponding GTK+ objects, you can freely intermix ordinary GTK+ function calls (to the internal gtk-object pointer) with Objective-C method calls to the same object.

All objects may be assigned a tag (a user defined integer value) to allow for easy identification. The initial tag value is 0.

Note: The methods below that control signal connections and actions are valid only for instances of the GTKObject class and its subclasses.

Direct subclasses:
GTKAccelGroup, GTKMenuFactory, GTKObject, GTKStyle
Last modified:
21-Feb-2002 (GToolKit/GTK.m)

Instance Variables

public const gpointer gtk
internal gtk-object pointer (read only)
protected gint32 tag
assigned tag value (user data)
protected NSMutableArray *actions
array of connected actions

Method Index

Methods

+ (void) addUserSignal:(NSString *) signal flags:(GtkSignalRunType) flags

Add a user defined signal (without parameters) to the target class. flags may be either 0 or any valid combination of the signal flags defined in the header file gtk/gtkenums.h. The new signal can be emitted by sending -emit:signal: to an object of this class.

+ (void) taskNowMultiThreaded:(NSNotification *) event

Notify the GToolKit runtime system that resource locking is necessary. This method is intended only for use by the GTKApplication class and should never be called from user code.

- (void) blockAction:(GTKAction *) action

Blocks the action for all signals in the receiver that are connected to it. Multiple signal handlers may be blocked with this call.

- (void) connectSignal:(NSString *) signal withAction:(GTKAction *) action

Connect the action (a target/selector pair) to the given signal in the receiver. The object will call the -performWithSender:args:count: method of the GTKAction and pass itself as the sending object when the given signal is emitted.

Example:
- (void) foo:(id) sender
...
- (void) bar:(id) sender data:(myType *) data
...

[window connectSignal:@"destroy" withAction:
   [GTKAction actionWithTarget:anObject selector:@selector(foo:)]];

[button connectSignal:@"clicked" withAction:
   [GTKAction actionWithTarget:anObject selector:@selector(bar:data:)
    data:&myData]];

- (void) connectSignal:(NSString *) signal withActionAfter:(GTKAction *) action

Similar to -connectSignal:withAction: except the action is connected in the "after" slot. This allows a signal handler to be guaranteed to run after other signal handlers connected to the same signal on the same object and after the class function associated with the signal.

See also:
-connectSignal:withAction:

- (void) connectSignal:(NSString *) signal withTarget:(id) target sel:(SEL) sel

Connect the target/selector pair to the given signal in the receiver. This method is equivalent to the call:

[... connectSignal:signal withAction:
   [GTKAction actionWithTarget:target selector:sel]]
Use the -connectSignal:withAction: method if you need a reference to the GTKAction object (to block/unblock/disconnect it later).

- (void) connectSignal:(NSString *) signal withTarget:(id) target sel:(SEL) sel data:(const void *) data

Connect the target/selector pair to the given signal in the receiver. This method is equivalent to the call:

[... connectSignal:signal withAction:
   [GTKAction actionWithTarget:target selector:sel data:data]]
Use the -connectSignal:withAction: method if you need a reference to the GTKAction object (to block/unblock/disconnect it later).

- (NSString *) description

Return a textual description of the receiver.

- (void) disconnectAction:(GTKAction *) action

Disconnect the action from all signals in the receiver that it is connected to. Multiple signal handlers may be disconnected with this call.

- (void) emit:(id) sender signal:(NSString *) signal

Tell the receiver to emit the given signal (without parameters), i.e. invoke all actions connected to this signal. The sender parameter is ignored.

See also:
-stop:signal:

- (gpointer) gtk

Return the internal gtk-object pointer. This may sometimes be useful to access components of the underlying gtk object that do not have access methods. The macro call GTOOLKIT_OBJECT(gtk_pointer) can perform the reverse operation.

Example:
GTKButton *button = [GTKButton buttonWithLabel:label];
GtkButton *gtk_button = [button gtk];

GTK_WIDGET_SET_FLAGS(gtk_button, GTK_CAN_DEFAULT);

- (id) initWithGtk:(gpointer) _gtk

Initialize a new GTK object for the given gtk-object pointer gtk, which must not be NULL. This is an internal method and should generally not be called from user code, unless you really know what you are doing.

Use the GTOOLKIT_OBJECT macro (or the gtoolkit_object function) to create an Objective-C object from an existing gtk-object pointer.

- (void) setTag:(gint32) _tag

Set the receiver's tag value to tag (the initial tag value is 0).

- (void) stop:(id) sender signal:(NSString *) signal

Stop the emission process for the given signal. Attempting to stop the emission of a signal that isn't being emitted does nothing. See the GIMP Toolkit documentation for details. The sender parameter is ignored.

See also:
-emit:signal:

- (gint32) tag

Return the receiver's tag value.

See also:
-setTag:

- (void) unblockAction:(GTKAction *) action

Unblocks the action for all signals in the receiver that are connected to it. Multiple signal handlers may be unblocked with this call.


generated on 06-Mar-2002 by ObjcDoc 3.0.1