GIMP Library Reference Manual | |||
---|---|---|---|
<<< Previous Page | Home | Up | Next Page >>> |
struct GimpSizeEntry; #define GIMP_SIZE_ENTRY (obj) enum GimpSizeEntryUpdatePolicy; struct GimpSizeEntryField; |
"value-changed" void user_function (GimpSizeEntry *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 it's "value".
There is a GimpUnitMenu right of the entry fields which lets you specify the GimpUnit of the displayed values.
For each field, there can be one or two
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.
#define GIMP_SIZE_ENTRY(obj) (GTK_CHECK_CAST ((obj), GIMP_TYPE_SIZE_ENTRY, GimpSizeEntry)) |
Checks if the passed pointer is a pointer to a GimpSizeEntry and performs the cast if valid.
obj : | The pointer to cast. |
typedef enum { GIMP_SIZE_ENTRY_UPDATE_NONE = 0, GIMP_SIZE_ENTRY_UPDATE_SIZE = 1, GIMP_SIZE_ENTRY_UPDATE_RESOLUTION = 2 } GimpSizeEntryUpdatePolicy; |
|
Creates a new GimpSizeEntry widget.
To have all automatic calculations performed correctly, set up the widget in the following order:
1. gimp_size_entry_new()
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
number_of_fields : | The number of input fields. |
unit : | The initial unit. |
unit_format : | A printf-like unit-format string (see GimpUnitMenu). |
menu_show_pixels : | |
menu_show_percent : | |
show_refval : | |
spinbutton_usize : | The minimal horizontal size of the |
update_policy : | How the automatic pixel <-> real-world-unit calculations should be performed. |
Returns : | A Pointer to the new GimpSizeEntry widget. |
void gimp_size_entry_add_field (GimpSizeEntry *gse, |
Adds an input field to the GimpSizeEntry.
The new input field will have the index 0. If you specified show_refval
as
gse : | The sizeentry you want to add a field to. |
value_spinbutton : | The spinbutton to display the field's value. |
refval_spinbutton : | The spinbutton to display the field's reference value. |
void gimp_size_entry_attach_label (GimpSizeEntry *gse, |
Attaches a
gse : | The sizeentry you want to add a label to. |
text : | The text of the label. |
row : | The row where the label will be attached. |
column : | The column where the label will be attached. |
alignment : | The horizontal alignment of the label. |
void gimp_size_entry_set_resolution (GimpSizeEntry *gse, |
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.
gse : | The sizeentry you want to set a resolution for. |
field : | The index of the field you want to set the resolution for. |
resolution : | The new resolution (in dpi) for the chosen field. |
keep_size : | |
void gimp_size_entry_set_size (GimpSizeEntry *gse, |
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
This function does nothing if the GimpSizeEntryUpdatePolicy specified in gimp_size_entry_new() doesn't equal to GIMP_SIZE_ENTRY_UPDATE_SIZE.
gse : | The sizeentry you want to set a size for. |
field : | The index of the field you want to set the size for. |
lower : | The reference value which will be treated as 0%. |
upper : | The reference value which will be treated as 100%. |
void gimp_size_entry_set_value_boundaries (GimpSizeEntry *gse, |
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 these values because the GimpSizeEntry's purpose is to shield the programmer from unit calculations. Use gimp_size_entry_set_refval_boundaries() instead.
gse : | The sizeentry you want to set value boundaries for. |
field : | The index of the field you want to set value boundaries for. |
lower : | The new lower boundary of the value of the chosen field. |
upper : | The new upper boundary of the value of the chosen 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 GimpUnitMenu.
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.
gse : | The sizeentry you want to know a value of. |
field : | The index of the filed you want to know the value of. |
Returns : | The value of the chosen field. |
void gimp_size_entry_set_value (GimpSizeEntry *gse, |
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 GimpUnitMenu.
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.
gse : | The sizeentry you want to set a value for. |
field : | The index of the field you want to set a value for. |
value : | The new value for field. |
void gimp_size_entry_set_refval_boundaries (GimpSizeEntry *gse, |
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.
gse : | The sizeentry you want to set the reference value boundaries for. |
field : | The index of the field you want to set the reference value boundaries for. |
lower : | The new lower boundary of the reference value of the chosen field. |
upper : | The new upper boundary of the reference value of the chosen field. |
void gimp_size_entry_set_refval_digits (GimpSizeEntry *gse, |
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.
gse : | The sizeentry you want to set the reference value digits for. |
field : | The index of the field you want to set the reference value for. |
digits : | The new number of decimal digits for the |
|
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().
gse : | The sizeentry you want to know a reference value of. |
field : | 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, |
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().
gse : | The sizeentry you want to set a reference value for. |
field : | The index of the field you want to set the reference value for. |
refval : | 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 GimpUnitMenu.
gse : | 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().
gse : | The sizeentry you want to change the unit for. |
unit : | The new unit. |
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
gse : | The sizeentry you want to grab the keyboard focus. |
void user_function (GimpSizeEntry *gimpsizeentry, |
gimpsizeentry : | the object which received the signal. |
user_data : | user data set when the signal handler was connected. |
void user_function (GimpSizeEntry *gimpsizeentry, |
gimpsizeentry : | the object which received the signal. |
user_data : | user data set when the signal handler was connected. |
void user_function (GimpSizeEntry *gimpsizeentry, |
gimpsizeentry : | the object which received the signal. |
user_data : | user data set when the signal handler was connected. |