GIMP Widgets Library Reference Manual | ||||
---|---|---|---|---|
Top | Description | Object Hierarchy | Implemented Interfaces | Signals |
GimpSizeEntry; GimpSizeEntryField; enum GimpSizeEntryUpdatePolicy; GtkWidget * gimp_size_entry_new (gint number_of_fields
,GimpUnit unit
,const gchar *unit_format
,gboolean menu_show_pixels
,gboolean menu_show_percent
,gboolean show_refval
,gint spinbutton_width
,GimpSizeEntryUpdatePolicy update_policy
); void gimp_size_entry_add_field (GimpSizeEntry *gse
,GtkSpinButton *value_spinbutton
,GtkSpinButton *refval_spinbutton
); GtkWidget * gimp_size_entry_attach_label (GimpSizeEntry *gse
,const gchar *text
,gint row
,gint column
,gfloat alignment
); void gimp_size_entry_set_resolution (GimpSizeEntry *gse
,gint field
,gdouble resolution
,gboolean keep_size
); void gimp_size_entry_set_size (GimpSizeEntry *gse
,gint field
,gdouble lower
,gdouble upper
); void gimp_size_entry_set_value_boundaries (GimpSizeEntry *gse
,gint field
,gdouble lower
,gdouble upper
); gdouble gimp_size_entry_get_value (GimpSizeEntry *gse
,gint field
); void gimp_size_entry_set_value (GimpSizeEntry *gse
,gint field
,gdouble value
); void gimp_size_entry_set_refval_boundaries (GimpSizeEntry *gse
,gint field
,gdouble lower
,gdouble upper
); void gimp_size_entry_set_refval_digits (GimpSizeEntry *gse
,gint field
,gint digits
); gdouble gimp_size_entry_get_refval (GimpSizeEntry *gse
,gint field
); void gimp_size_entry_set_refval (GimpSizeEntry *gse
,gint field
,gdouble refval
); GimpUnit gimp_size_entry_get_unit (GimpSizeEntry *gse
); void gimp_size_entry_set_unit (GimpSizeEntry *gse
,GimpUnit unit
); void gimp_size_entry_set_pixel_digits (GimpSizeEntry *gse
,gint digits
); void gimp_size_entry_show_unit_menu (GimpSizeEntry *gse
,gboolean show
); void gimp_size_entry_grab_focus (GimpSizeEntry *gse
); void gimp_size_entry_set_activates_default (GimpSizeEntry *gse
,gboolean setting
); GtkWidget * gimp_size_entry_get_help_widget (GimpSizeEntry *gse
,gint field
);
GObject +----GInitiallyUnowned +----GtkObject +----GtkWidget +----GtkContainer +----GtkTable +----GimpSizeEntry
This widget is used to enter pixel distances/sizes and resolutions.
You can specify the number of fields the widget should provide. For each field automatic mappings are performed between the field's "reference value" and its "value".
There is a GimpUnitComboBox right of the entry fields which lets you specify the GimpUnit of the displayed values.
For each field, there can be one or two GtkSpinButton's to enter
"value" and "reference value". If you specify show_refval
as
FALSE in gimp_size_entry_new()
there will be only one
GtkSpinButton and the GimpUnitComboBox will contain an item for
selecting GIMP_UNIT_PIXEL.
The "reference value" is either of GIMP_UNIT_PIXEL or dpi,
depending on which GimpSizeEntryUpdatePolicy you specify in
gimp_size_entry_new()
. The "value" is either the size in pixels
mapped to the size in a real-world-unit (see GimpUnit) or the dpi
value mapped to pixels per real-world-unit.
typedef enum { GIMP_SIZE_ENTRY_UPDATE_NONE = 0, GIMP_SIZE_ENTRY_UPDATE_SIZE = 1, GIMP_SIZE_ENTRY_UPDATE_RESOLUTION = 2 } GimpSizeEntryUpdatePolicy;
Update policies for GimpSizeEntry.
GtkWidget * gimp_size_entry_new (gint number_of_fields
,GimpUnit unit
,const gchar *unit_format
,gboolean menu_show_pixels
,gboolean menu_show_percent
,gboolean show_refval
,gint spinbutton_width
,GimpSizeEntryUpdatePolicy update_policy
);
Creates a new GimpSizeEntry widget.
To have all automatic calculations performed correctly, set up the widget in the following order:
2. (for each additional input field) gimp_size_entry_add_field()
For each input field:
4. gimp_size_entry_set_resolution()
5. gimp_size_entry_set_refval_boundaries()
(or gimp_size_entry_set_value_boundaries()
)
7. gimp_size_entry_set_refval()
(or gimp_size_entry_set_value()
)
The GimpSizeEntry is derived from GtkTable and will have an empty border of one cell width on each side plus an empty column left of the GimpUnitComboBox to allow the caller to add labels or a GimpChainButton.
|
The number of input fields. |
|
The initial unit. |
|
A printf-like unit-format string as is used with
gimp_unit_menu_new() . |
|
TRUE if the unit menu shold contain an item for
GIMP_UNIT_PIXEL (ignored if the update_policy is not
GIMP_SIZE_ENTRY_UPDATE_NONE). |
|
TRUE if the unit menu shold contain an item for
GIMP_UNIT_PERCENT. |
|
TRUE if you want an extra "reference value"
spinbutton per input field. |
|
The minimal horizontal size of the GtkSpinButton's. |
|
How the automatic pixel <-> real-world-unit calculations should be done. |
Returns : |
A Pointer to the new GimpSizeEntry widget. |
void gimp_size_entry_add_field (GimpSizeEntry *gse
,GtkSpinButton *value_spinbutton
,GtkSpinButton *refval_spinbutton
);
Adds an input field to the GimpSizeEntry.
The new input field will have the index 0. If you specified show_refval
as TRUE
in gimp_size_entry_new()
you have to pass an additional
GtkSpinButton to hold the reference value. If show_refval
was FALSE
,
refval_spinbutton
will be ignored.
|
The sizeentry you want to add a field to. |
|
The spinbutton to display the field's value. |
|
The spinbutton to display the field's reference value. |
GtkWidget * gimp_size_entry_attach_label (GimpSizeEntry *gse
,const gchar *text
,gint row
,gint column
,gfloat alignment
);
Attaches a GtkLabel to the GimpSizeEntry (which is a GtkTable).
|
The sizeentry you want to add a label to. |
|
The text of the label. |
|
The row where the label will be attached. |
|
The column where the label will be attached. |
|
The horizontal alignment of the label. |
Returns : |
A pointer to the new GtkLabel widget. |
void gimp_size_entry_set_resolution (GimpSizeEntry *gse
,gint field
,gdouble resolution
,gboolean keep_size
);
Sets the resolution (in dpi) for field # field
of the GimpSizeEntry.
The resolution
passed will be clamped to fit in
[GIMP_MIN_RESOLUTION..GIMP_MAX_RESOLUTION].
This function does nothing if the GimpSizeEntryUpdatePolicy specified in
gimp_size_entry_new()
doesn't equal to GIMP_SIZE_ENTRY_UPDATE_SIZE.
|
The sizeentry you want to set a resolution for. |
|
The index of the field you want to set the resolution for. |
|
The new resolution (in dpi) for the chosen field . |
|
TRUE if the field 's size in pixels should stay the same.
FALSE if the field 's size in units should stay the same. |
void gimp_size_entry_set_size (GimpSizeEntry *gse
,gint field
,gdouble lower
,gdouble upper
);
Sets the pixel values for field # field
of the GimpSizeEntry
which will be treated as 0% and 100%.
These values will be used if you specified menu_show_percent
as TRUE
in gimp_size_entry_new()
and the user has selected GIMP_UNIT_PERCENT in
the GimpSizeEntry's GimpUnitComboBox.
This function does nothing if the GimpSizeEntryUpdatePolicy specified in
gimp_size_entry_new()
doesn't equal to GIMP_SIZE_ENTRY_UPDATE_SIZE.
|
The sizeentry you want to set a size for. |
|
The index of the field you want to set the size for. |
|
The reference value which will be treated as 0%. |
|
The reference value which will be treated as 100%. |
void gimp_size_entry_set_value_boundaries (GimpSizeEntry *gse
,gint field
,gdouble lower
,gdouble upper
);
Limits the range of possible values which can be entered in field # field
of the GimpSizeEntry.
The current value of the field
will be clamped to fit in the field
's
new boundaries.
NOTE: In most cases you won't be interested in this function because the
GimpSizeEntry's purpose is to shield the programmer from unit
calculations. Use gimp_size_entry_set_refval_boundaries()
instead.
Whatever you do, don't mix these calls. A size entry should either
be clamped by the value or the reference value.
|
The sizeentry you want to set value boundaries for. |
|
The index of the field you want to set value boundaries for. |
|
The new lower boundary of the value of the chosen field . |
|
The new upper boundary of the value of the chosen field . |
gdouble gimp_size_entry_get_value (GimpSizeEntry *gse
,gint field
);
Returns the value of field # field
of the GimpSizeEntry.
The value
returned is a distance or resolution
in the GimpUnit the user has selected in the GimpSizeEntry's
GimpUnitComboBox.
NOTE: In most cases you won't be interested in this value because the
GimpSizeEntry's purpose is to shield the programmer from unit
calculations. Use gimp_size_entry_get_refval()
instead.
|
The sizeentry you want to know a value of. |
|
The index of the field you want to know the value of. |
Returns : |
The value of the chosen field . |
void gimp_size_entry_set_value (GimpSizeEntry *gse
,gint field
,gdouble value
);
Sets the value for field # field
of the GimpSizeEntry.
The value
passed is treated to be a distance or resolution
in the GimpUnit the user has selected in the GimpSizeEntry's
GimpUnitComboBox.
NOTE: In most cases you won't be interested in this value because the
GimpSizeEntry's purpose is to shield the programmer from unit
calculations. Use gimp_size_entry_set_refval()
instead.
|
The sizeentry you want to set a value for. |
|
The index of the field you want to set a value for. |
|
The new value for field . |
void gimp_size_entry_set_refval_boundaries (GimpSizeEntry *gse
,gint field
,gdouble lower
,gdouble upper
);
Limits the range of possible reference values which can be entered in
field # field
of the GimpSizeEntry.
The current reference value of the field
will be clamped to fit in the
field
's new boundaries.
|
The sizeentry you want to set the reference value boundaries for. |
|
The index of the field you want to set the reference value boundaries for. |
|
The new lower boundary of the reference value of the chosen field . |
|
The new upper boundary of the reference value of the chosen field . |
void gimp_size_entry_set_refval_digits (GimpSizeEntry *gse
,gint field
,gint digits
);
Sets the decimal digits of field # field
of the GimpSizeEntry to
digits
.
If you don't specify this value explicitly, the reference value's number of digits will equal to 0 for GIMP_SIZE_ENTRY_UPDATE_SIZE and to 2 for GIMP_SIZE_ENTRY_UPDATE_RESOLUTION.
|
The sizeentry you want to set the reference value digits for. |
|
The index of the field you want to set the reference value for. |
|
The new number of decimal digits for the GtkSpinButton which
displays field 's reference value. |
gdouble gimp_size_entry_get_refval (GimpSizeEntry *gse
,gint field
);
Returns the reference value for field # field
of the GimpSizeEntry.
The reference value is either a distance in pixels or a resolution
in dpi, depending on which GimpSizeEntryUpdatePolicy you chose in
gimp_size_entry_new()
.
|
The sizeentry you want to know a reference value of. |
|
The index of the field you want to know the reference value of. |
Returns : |
The reference value of the chosen field . |
void gimp_size_entry_set_refval (GimpSizeEntry *gse
,gint field
,gdouble refval
);
Sets the reference value for field # field
of the GimpSizeEntry.
The refval
passed is either a distance in pixels or a resolution in dpi,
depending on which GimpSizeEntryUpdatePolicy you chose in
gimp_size_entry_new()
.
|
The sizeentry you want to set a reference value for. |
|
The index of the field you want to set the reference value for. |
|
The new reference value for field . |
GimpUnit gimp_size_entry_get_unit (GimpSizeEntry *gse
);
Returns the GimpUnit the user has selected in the GimpSizeEntry's GimpUnitComboBox.
|
The sizeentry you want to know the unit of. |
Returns : |
The sizeentry's unit. |
void gimp_size_entry_set_unit (GimpSizeEntry *gse
,GimpUnit unit
);
Sets the GimpSizeEntry's unit. The reference value for all fields will
stay the same but the value in units or pixels per unit will change
according to which GimpSizeEntryUpdatePolicy you chose in
gimp_size_entry_new()
.
|
The sizeentry you want to change the unit for. |
|
The new unit. |
void gimp_size_entry_set_pixel_digits (GimpSizeEntry *gse
,gint digits
);
This function allows you set up a GimpSizeEntry so that sub-pixel sizes can be entered.
|
a GimpSizeEntry |
|
the number of digits to display for a pixel size |
void gimp_size_entry_show_unit_menu (GimpSizeEntry *gse
,gboolean show
);
Controls whether a unit menu is shown in the size entry. If
show
is TRUE, the menu is shown; otherwise it is hidden.
|
a GimpSizeEntry |
|
Boolean |
Since GIMP 2.4
void gimp_size_entry_grab_focus (GimpSizeEntry *gse
);
This function is rather ugly and just a workaround for the fact that
it's impossible to implement gtk_widget_grab_focus()
for a GtkTable.
|
The sizeentry you want to grab the keyboard focus. |
void gimp_size_entry_set_activates_default (GimpSizeEntry *gse
,gboolean setting
);
Iterates over all entries in the GimpSizeEntry and calls
gtk_entry_set_activates_default()
on them.
|
A GimpSizeEntry |
|
TRUE to activate window's default widget on Enter keypress |
Since GIMP 2.4
GtkWidget * gimp_size_entry_get_help_widget (GimpSizeEntry *gse
,gint field
);
You shouldn't fiddle with the internals of a GimpSizeEntry but
if you want to set tooltips using gimp_help_set_help_data()
you
can use this function to get a pointer to the spinbuttons.
|
a GimpSizeEntry |
|
the index of the widget you want to get a pointer to |
Returns : |
a GtkWidget pointer that you can attach a tooltip to. |
"refval-changed"
signalvoid user_function (GimpSizeEntry *gimpsizeentry,
gpointer user_data) : Run First
|
the object which received the signal. |
|
user data set when the signal handler was connected. |
"unit-changed"
signalvoid user_function (GimpSizeEntry *gimpsizeentry,
gpointer user_data) : Run First
|
the object which received the signal. |
|
user data set when the signal handler was connected. |
"value-changed"
signalvoid user_function (GimpSizeEntry *gimpsizeentry,
gpointer user_data) : Run First
|
the object which received the signal. |
|
user data set when the signal handler was connected. |