Add lowlevel accessor gimp_item_set_size()

Sets the "width" and "height" properties and emits notifications and
"size-changed" if anything has changed. This in only to be used by
functions that actually resize the item, it does not scale/resize
anything.
This commit is contained in:
Michael Natterer 2009-08-26 13:00:13 +02:00
parent 9683af0d31
commit ce5d591336
2 changed files with 33 additions and 0 deletions

View File

@ -830,6 +830,36 @@ gimp_item_get_height (const GimpItem *item)
return item->height;
}
void
gimp_item_set_size (GimpItem *item,
gint width,
gint height)
{
g_return_if_fail (GIMP_IS_ITEM (item));
if (item->width != width ||
item->height != height)
{
g_object_freeze_notify (G_OBJECT (item));
if (item->width != width)
{
item->width = width;
g_object_notify (G_OBJECT (item), "width");
}
if (item->height != height)
{
item->height = height;
g_object_notify (G_OBJECT (item), "height");
}
g_object_thaw_notify (G_OBJECT (item));
gimp_viewable_size_changed (GIMP_VIEWABLE (item));
}
}
/**
* gimp_item_get_offset:
* @item: The #GimpItem to check.

View File

@ -165,6 +165,9 @@ gboolean gimp_item_rename (GimpItem *item,
gint gimp_item_get_width (const GimpItem *item);
gint gimp_item_get_height (const GimpItem *item);
void gimp_item_set_size (GimpItem *item,
gint width,
gint height);
void gimp_item_get_offset (const GimpItem *item,
gint *offset_x,