enum {
PROP_0,
PROP_CONSTRAIN,
+ PROP_FILL,
};
static void aspect_bin_size_request(GtkWidget *, GtkRequisition *);
abin->ratio = 1;
abin->align = 0;
abin->constrain = FALSE;
+ abin->fill = TRUE;
}
static void aspect_bin_class_init(AspectBinClass *class)
object_class->set_property = aspect_bin_set_property;
object_class->get_property = aspect_bin_get_property;
- g_object_class_install_property(object_class, PROP_CONSTRAIN,
+ g_object_class_install_property(object_class,
+ PROP_FILL,
+ g_param_spec_boolean("fill",
+ "Fill",
+ "Allocate all remaining space to the side.",
+ TRUE,
+ G_PARAM_READWRITE));
+ g_object_class_install_property(object_class,
+ PROP_CONSTRAIN,
g_param_spec_boolean("constrain",
"Constrain",
- "TRUE if side child should expand only as much as the"
- " body",
+ "Only expand the side to be as large as the body.",
FALSE,
G_PARAM_READWRITE));
}
abin->constrain = g_value_get_boolean(value);
gtk_widget_queue_resize(GTK_WIDGET(abin));
break;
+ case PROP_FILL:
+ abin->fill = g_value_get_boolean(value);
+ gtk_widget_queue_resize(GTK_WIDGET(abin));
+ break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID(object, prop_id, pspec);
}
case PROP_CONSTRAIN:
g_value_set_boolean(value, abin->constrain);
break;
+ case PROP_FILL:
+ g_value_set_boolean(value, abin->fill);
+ break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID(object, prop_id, pspec);
}
}
csize.width = allocation->width - asize.width;
- csize.height = MIN(allocation->height, creq.height);
- if (abin->constrain) {
- csize.height = MAX(csize.height, asize.height);
- }
csize.x = asize.width;
+
+ if (abin->fill && abin->constrain) {
+ csize.height = asize.height;
+ } else if (abin->fill) {
+ csize.height = allocation->height;
+ } else {
+ csize.height = creq.height;
+ }
}
csize.y = (allocation->height - csize.height) * abin->align + 0.5;