mirror of https://github.com/GNOME/gimp.git
allocate the full width for the label widget, looks better and is more
2004-05-04 Sven Neumann <sven@gimp.org> * libgimpwidgets/gimpframe.c (gimp_frame_size_allocate): allocate the full width for the label widget, looks better and is more convenient to use with activatable widgets such as toggle buttons.
This commit is contained in:
parent
90438eaaae
commit
ca18cc547f
|
@ -1,3 +1,9 @@
|
||||||
|
2004-05-04 Sven Neumann <sven@gimp.org>
|
||||||
|
|
||||||
|
* libgimpwidgets/gimpframe.c (gimp_frame_size_allocate): allocate
|
||||||
|
the full width for the label widget, looks better and is more
|
||||||
|
convenient to use with activatable widgets such as toggle buttons.
|
||||||
|
|
||||||
2004-05-04 Michael Natterer <mitch@gimp.org>
|
2004-05-04 Michael Natterer <mitch@gimp.org>
|
||||||
|
|
||||||
* app/widgets/gimpfiledialog.c: removed debugging output, added
|
* app/widgets/gimpfiledialog.c: removed debugging output, added
|
||||||
|
|
|
@ -33,7 +33,7 @@
|
||||||
|
|
||||||
#define DEFAULT_LABEL_SPACING 6
|
#define DEFAULT_LABEL_SPACING 6
|
||||||
#define GIMP_FRAME_INDENT_KEY "gimp-frame-indent"
|
#define GIMP_FRAME_INDENT_KEY "gimp-frame-indent"
|
||||||
#define GIMP_FRAME_EXPANDER_KEY "gimp-frame-in-expander"
|
#define GIMP_FRAME_IN_EXPANDER_KEY "gimp-frame-in-expander"
|
||||||
|
|
||||||
|
|
||||||
static void gimp_frame_class_init (GimpFrameClass *klass);
|
static void gimp_frame_class_init (GimpFrameClass *klass);
|
||||||
|
@ -174,22 +174,15 @@ gimp_frame_size_allocate (GtkWidget *widget,
|
||||||
{
|
{
|
||||||
GtkAllocation label_allocation;
|
GtkAllocation label_allocation;
|
||||||
GtkRequisition label_requisition;
|
GtkRequisition label_requisition;
|
||||||
gint border_width = GTK_CONTAINER (widget)->border_width;
|
gint border = GTK_CONTAINER (widget)->border_width;
|
||||||
gfloat xalign;
|
|
||||||
|
|
||||||
gtk_widget_get_child_requisition (frame->label_widget,
|
gtk_widget_get_child_requisition (frame->label_widget,
|
||||||
&label_requisition);
|
&label_requisition);
|
||||||
|
|
||||||
if (gtk_widget_get_direction (widget) == GTK_TEXT_DIR_LTR)
|
label_allocation.x = allocation->x + border;
|
||||||
xalign = frame->label_xalign;
|
label_allocation.y = allocation->y + border;
|
||||||
else
|
label_allocation.width = MAX (label_requisition.width,
|
||||||
xalign = 1.0 - frame->label_xalign;
|
allocation->width - 2 * border);
|
||||||
|
|
||||||
label_allocation.x = (allocation->x + border_width +
|
|
||||||
xalign * (gfloat) (allocation->width -
|
|
||||||
label_requisition.width));
|
|
||||||
label_allocation.y = allocation->y + border_width;
|
|
||||||
label_allocation.width = label_requisition.width;
|
|
||||||
label_allocation.height = label_requisition.height;
|
label_allocation.height = label_requisition.height;
|
||||||
|
|
||||||
gtk_widget_size_allocate (frame->label_widget, &label_allocation);
|
gtk_widget_size_allocate (frame->label_widget, &label_allocation);
|
||||||
|
@ -202,7 +195,7 @@ gimp_frame_child_allocate (GtkFrame *frame,
|
||||||
{
|
{
|
||||||
GtkWidget *widget = GTK_WIDGET (frame);
|
GtkWidget *widget = GTK_WIDGET (frame);
|
||||||
GtkAllocation *allocation = &widget->allocation;
|
GtkAllocation *allocation = &widget->allocation;
|
||||||
gint border_width = GTK_CONTAINER (frame)->border_width;
|
gint border = GTK_CONTAINER (frame)->border_width;
|
||||||
gint spacing = 0;
|
gint spacing = 0;
|
||||||
gint indent = gimp_frame_get_indent (widget);
|
gint indent = gimp_frame_get_indent (widget);
|
||||||
|
|
||||||
|
@ -218,17 +211,16 @@ gimp_frame_child_allocate (GtkFrame *frame,
|
||||||
spacing += gimp_frame_get_label_spacing (frame);
|
spacing += gimp_frame_get_label_spacing (frame);
|
||||||
|
|
||||||
if (gtk_widget_get_direction (widget) == GTK_TEXT_DIR_LTR)
|
if (gtk_widget_get_direction (widget) == GTK_TEXT_DIR_LTR)
|
||||||
child_allocation->x = border_width + indent;
|
child_allocation->x = border + indent;
|
||||||
else
|
else
|
||||||
child_allocation->x = border_width;
|
child_allocation->x = border;
|
||||||
|
|
||||||
child_allocation->y = border_width + spacing;
|
child_allocation->y = border + spacing;
|
||||||
child_allocation->width = MAX (1,
|
child_allocation->width = MAX (1,
|
||||||
allocation->width -
|
allocation->width - 2 * border - indent);
|
||||||
2 * border_width - indent);
|
|
||||||
child_allocation->height = MAX (1,
|
child_allocation->height = MAX (1,
|
||||||
allocation->height -
|
allocation->height -
|
||||||
child_allocation->y - border_width);
|
child_allocation->y - border);
|
||||||
|
|
||||||
child_allocation->x += allocation->x;
|
child_allocation->x += allocation->x;
|
||||||
child_allocation->y += allocation->y;
|
child_allocation->y += allocation->y;
|
||||||
|
@ -265,6 +257,9 @@ gimp_frame_label_widget_notify (GtkFrame *frame)
|
||||||
if (GTK_IS_LABEL (frame->label_widget))
|
if (GTK_IS_LABEL (frame->label_widget))
|
||||||
{
|
{
|
||||||
label = GTK_LABEL (frame->label_widget);
|
label = GTK_LABEL (frame->label_widget);
|
||||||
|
|
||||||
|
gtk_misc_set_alignment (GTK_MISC (label),
|
||||||
|
frame->label_xalign, frame->label_yalign);
|
||||||
}
|
}
|
||||||
else if (GTK_IS_BIN (frame->label_widget))
|
else if (GTK_IS_BIN (frame->label_widget))
|
||||||
{
|
{
|
||||||
|
@ -321,7 +316,7 @@ gimp_frame_get_label_spacing (GtkFrame *frame)
|
||||||
gint spacing = 0;
|
gint spacing = 0;
|
||||||
|
|
||||||
if ((frame->label_widget && GTK_WIDGET_VISIBLE (frame->label_widget)) ||
|
if ((frame->label_widget && GTK_WIDGET_VISIBLE (frame->label_widget)) ||
|
||||||
(g_object_get_data (G_OBJECT (frame), GIMP_FRAME_EXPANDER_KEY)))
|
(g_object_get_data (G_OBJECT (frame), GIMP_FRAME_IN_EXPANDER_KEY)))
|
||||||
{
|
{
|
||||||
gtk_widget_style_get (GTK_WIDGET (frame),
|
gtk_widget_style_get (GTK_WIDGET (frame),
|
||||||
"label_spacing", &spacing,
|
"label_spacing", &spacing,
|
||||||
|
@ -364,7 +359,7 @@ gimp_frame_new (const gchar *label)
|
||||||
|
|
||||||
if (expander)
|
if (expander)
|
||||||
g_object_set_data (G_OBJECT (frame),
|
g_object_set_data (G_OBJECT (frame),
|
||||||
GIMP_FRAME_EXPANDER_KEY, (gpointer) TRUE);
|
GIMP_FRAME_IN_EXPANDER_KEY, (gpointer) TRUE);
|
||||||
|
|
||||||
return frame;
|
return frame;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue