GimpChainButton -- Widget to visually connect two entry widgets.


struct      GimpChainButton;
#define     GIMP_CHAIN_BUTTON               (obj)
enum        GimpChainPosition;
GtkWidget*  gimp_chain_button_new           (GimpChainPosition position);
void        gimp_chain_button_set_active    (GimpChainButton *gcb,
                                             gboolean is_active);
gboolean    gimp_chain_button_get_active    (GimpChainButton *gcb);

Object Hierarchy


Signal Prototypes

"toggled"   void        user_function      (GimpChainButton *gimpchainbutton,
                                            gpointer user_data);


This widget provides a button showing either a linked or a broken chain that can be used to link two entries, spinbuttons, colors or other GUI elements and show that they may be locked. Use it for example to connect X and Y ratios to provide the possibility of a constrained aspect ratio.

The GimpChainButton only gives visual feedback, it does not really connect widgets. You have to take care of locking the values yourself by checking the state of the GimpChainButton whenever a value changes in one of the connected widgets and adjusting the other value if necessary.


struct GimpChainButton

struct GimpChainButton;


#define GIMP_CHAIN_BUTTON(obj)            (GTK_CHECK_CAST ((obj), GIMP_TYPE_CHAIN_BUTTON, GimpChainButton))

Checks if the passed pointer is a pointer to a GimpChainButton and performs the cast if valid.

obj :The pointer to cast.

enum GimpChainPosition

typedef enum
} GimpChainPosition;

gimp_chain_button_new ()

GtkWidget*  gimp_chain_button_new           (GimpChainPosition position);

Creates a new GimpChainButton widget.

This returns a button showing either a broken or a linked chain and small clamps attached to both sides that visually group the two widgets you want to connect. This widget looks best when attached to a table taking up two columns (or rows respectively) next to the widgets that it is supposed to connect. It may work for more than two widgets, but the look is optimized for two.

position : The position you are going to use for the button with respect to the widgets you want to chain.
Returns : Pointer to the new GimpChainButton, which is inactive by default. Use gimp_chain_button_set_active() to change its state.

gimp_chain_button_set_active ()

void        gimp_chain_button_set_active    (GimpChainButton *gcb,
                                             gboolean is_active);

Sets the state of the GimpChainButton to be either locked (TRUE) or unlocked (FALSE) and changes the showed pixmap to reflect the new state.

gcb : Pointer to a GimpChainButton.
is_active : The new state.

gimp_chain_button_get_active ()

gboolean    gimp_chain_button_get_active    (GimpChainButton *gcb);

Checks the state of the GimpChainButton.

gcb : Pointer to a GimpChainButton.
Returns : TRUE if the GimpChainButton is active (locked).


The "toggled" signal

void        user_function                  (GimpChainButton *gimpchainbutton,
                                            gpointer user_data);

gimpchainbutton :the object which received the signal.
user_data :user data set when the signal handler was connected.

See Also

You may want to use the convenience function gimp_coordinates_new() to set up two GimpSizeEntries (see GimpSizeEntry) linked with a GimpChainButton.