# Class GTK

GTK is the base class of 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.

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

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

### Class-Hierarchy:

        NSObject
          |
          +---GTK

## Class GTK inherits from NSObject

Subclasses: GTKAccelGroup GTKMenuFactory GTKObject GTKStyle
Last modified: 19.1.2000 (GToolKit/GTK.h)

## Instance Variables

protected gpointer gtk
  internal gtk-object pointer
protected gint32 tag
  assigned tag value
protected NSMutableArray *actions
  array of connected actions

## Method Index

- internal methods
  + (void) taskNowMultiThreaded:(NSNotification *) event
  - initWithGtk:(gpointer) gtk
- commonly used methods
  - (gpointer) gtk
  - (void) setTag:(gint32) tag
  - (gint32) tag
- signal handling for GTKObject
  + (void) addUserSignal:(NSString *) signal flags:(GtkSignalRunType) flags
  - (void) blockAction:(GTKAction *) action
  - (void) connectSignal:(NSString *) signal withAction:(GTKAction *) action
  - (void) connectSignal:(NSString *) signal withActionAfter:(GTKAction *) action
  - (void) connectSignal:(NSString *) signal withTarget:target sel:(SEL) sel
  - (void) connectSignal:(NSString *) signal withTarget:target sel:(SEL) sel data:(const void *) data
  - (void) disconnectAction:(GTKAction *) action
  - (void) emit:sender signal:(NSString *) signal
  - (void) stop:sender signal:(NSString *) signal
  - (void) unblockAction:(GTKAction *) action

## Methods

+ (void) taskNowMultiThreaded:(NSNotification *) event

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

- 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 never be called from user code.

- (NSString *) description

  Return a textual description of the receiver.

- (gpointer) gtk

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

       GTKStyle *style = [button getStyle];
       GtkStyle *gtk_style = [style gtk];

       gdk_color_parse("yellow", &gtk_style->bg[GTK_STATE_NORMAL]);
       gdk_color_alloc(colormap, &gtk_style->bg[GTK_STATE_NORMAL]);

- (void) setTag:(gint32) _tag

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

- (gint32) tag

  Return the receiver's tag value.

  See also: -setTag:

+ (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) emit:sender signal:(NSString *) signal

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

  See also: -stop:signal:

- (void) stop: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:

- (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:sender
       ...
       - (void) bar: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 withTarget: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: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).

- (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) 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) 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) 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 Wed Jan 19 1:31:39 2000 by Objcdoc