GimpUnitMenu

Name

GimpUnitMenu -- Widget for selecting a GimpUnit.

Synopsis



struct      GimpUnitMenu;
GtkWidget*  gimp_unit_menu_new              (const gchar *format,
                                             GimpUnit unit,
                                             gboolean show_pixels,
                                             gboolean show_percent,
                                             gboolean show_custom);
void        gimp_unit_menu_set_unit         (GimpUnitMenu *gum,
                                             GimpUnit unit);
GimpUnit    gimp_unit_menu_get_unit         (GimpUnitMenu *gum);

Object Hierarchy


  GObject
   +----GtkObject
         +----GtkWidget
               +----GtkContainer
                     +----GtkBin
                           +----GtkButton
                                 +----GtkOptionMenu
                                       +----GimpUnitMenu

Signal Prototypes


"unit-changed"
            void        user_function      (GimpUnitMenu *gimpunitmenu,
                                            gpointer user_data);

Description

This widget provides a GtkOptionMenu which contains a list of GimpUnit's.

You can specify the string that will be displayed for each unit by passing a printf-like format string to gimp_unit_menu_new().

The constructor also lets you choose if the menu should contain items for GIMP_UNIT_PIXEL, GIMP_UNIT_PERCENT and a "More..." item which will pop up a dialog for selecting user-defined units.

Whenever the user selects a unit from the menu or the dialog, the "unit_changed" signal will be emitted.

Details

struct GimpUnitMenu

struct GimpUnitMenu;


gimp_unit_menu_new ()

GtkWidget*  gimp_unit_menu_new              (const gchar *format,
                                             GimpUnit unit,
                                             gboolean show_pixels,
                                             gboolean show_percent,
                                             gboolean show_custom);

Creates a new GimpUnitMenu widget.

The format string supports the following percent expansions:

% fFactor (how many units make up an inch)
% ySymbol (e.g. "''" for GIMP_UNIT_INCH)
% aAbbreviation
% sSingular
% pPlural
%%Literal percent

format :

A printf-like format string which is used to create the unit strings.

unit :

The initially selected unit.

show_pixels :

TRUE if the unit menu should contain an item for GIMP_UNIT_PIXEL.

show_percent :

TRUE in the unit menu should contain an item for GIMP_UNIT_PERCENT.

show_custom :

TRUE if the unit menu should contain a "More..." item for opening the user-defined-unit selection dialog.

Returns :

A pointer to the new GimpUnitMenu widget.


gimp_unit_menu_set_unit ()

void        gimp_unit_menu_set_unit         (GimpUnitMenu *gum,
                                             GimpUnit unit);

Sets a new GimpUnit for the specified GimpUnitMenu.

gum :

The unit menu you want to set the unit for.

unit :

The new unit.


gimp_unit_menu_get_unit ()

GimpUnit    gimp_unit_menu_get_unit         (GimpUnitMenu *gum);

Returns the GimpUnit the user has selected from the GimpUnitMenu.

gum :

The unit menu you want to know the unit of.

Returns :

The unit the user has selected.

Signals

The "unit-changed" signal

void        user_function                  (GimpUnitMenu *gimpunitmenu,
                                            gpointer user_data);

This signal is emitted whenever the user selects a GimpUnit from the GimpUnitMenu.

gimpunitmenu :

the object which received the signal.

user_data :

user data set when the signal handler was connected.

See Also

GimpUnit

GimpSizeEntry

gimp_coordinates_new()