# 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: GTKAcceleratorTable GTKMenuFactory GTKObject GTKStyle GTKTooltips
Last modified: 10.8.98 (./GTK.h)

## Instance Variables

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

## Method Index

+ (void) addUserSignal:(NSString *) signal
- (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
- (gpointer) gtk
- initWithGtk:(gpointer) gtk
- (void) setTag:(int) tag
- (void) stop:sender signal:(NSString *) signal
- (int) tag
- (void) unblockAction:(GTKAction *) action

## Methods

- (unsigned) hash

  Return a hash code for this object.

- (BOOL) isEqual:anObject

  Compare two objects for equality.

- 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 object that do not have access methods. 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:(int) _tag

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

- (int) tag

  Return the receiver's tag value.

+ (void) addUserSignal:(NSString *) signal

  Add a user defined signal (without parameters) to the target class. The 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.

- (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.

- (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.

- (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 Mon Aug 10 22:08:07 1998 by Objcdoc