Commit ea5e1a72 authored by Sven Neumann's avatar Sven Neumann Committed by Sven Neumann
Browse files

take the left margin into account.

2004-05-02  Sven Neumann  <sven@gimp.org>

	* libgimpwidgets/gimpframe.c (gimp_frame_size_request): take the
	left margin into account.

	* app/widgets/gimpgrideditor.c
	* app/widgets/gimptemplateeditor.c: removed container borders that
	aren't needed any longer.
parent 522154d3
2004-05-02 Sven Neumann <sven@gimp.org>
* libgimpwidgets/gimpframe.c (gimp_frame_size_request): take the
left margin into account.
* app/widgets/gimpgrideditor.c
* app/widgets/gimptemplateeditor.c: removed container borders that
aren't needed any longer.
2004-05-02 Sven Neumann <sven@gimp.org>
* app/widgets/gimpenumwidgets.c
......
......@@ -205,7 +205,6 @@ gimp_grid_editor_constructor (GType type,
gtk_widget_show (frame);
table = gtk_table_new (3, 2, FALSE);
gtk_container_set_border_width (GTK_CONTAINER (table), 2);
gtk_table_set_row_spacings (GTK_TABLE (table), 2);
gtk_table_set_col_spacings (GTK_TABLE (table), 4);
gtk_container_add (GTK_CONTAINER (frame), table);
......
......@@ -217,7 +217,6 @@ gimp_template_editor_constructor (GType type,
gtk_widget_show (frame);
vbox = gtk_vbox_new (FALSE, 0);
gtk_container_set_border_width (GTK_CONTAINER (vbox), 2);
gtk_container_add (GTK_CONTAINER (frame), vbox);
gtk_widget_show (vbox);
......@@ -477,7 +476,6 @@ gimp_template_editor_constructor (GType type,
GTK_POLICY_AUTOMATIC);
gtk_scrolled_window_set_shadow_type (GTK_SCROLLED_WINDOW (scrolled_window),
GTK_SHADOW_ETCHED_IN);
gtk_container_set_border_width (GTK_CONTAINER (scrolled_window), 4);
gtk_container_add (GTK_CONTAINER (frame), scrolled_window);
gtk_widget_show (scrolled_window);
......
......@@ -43,6 +43,7 @@ static void gimp_frame_child_allocate (GtkFrame *frame,
static gboolean gimp_frame_expose (GtkWidget *widget,
GdkEventExpose *event);
static void gimp_frame_label_widget_notify (GtkFrame *frame);
static gint gimp_frame_left_margin (GtkWidget *widget);
static GtkVBoxClass *parent_class = NULL;
......@@ -139,9 +140,12 @@ gimp_frame_size_request (GtkWidget *widget,
if (bin->child && GTK_WIDGET_VISIBLE (bin->child))
{
gint left_margin = gimp_frame_left_margin (widget);
gtk_widget_size_request (bin->child, &child_requisition);
requisition->width = MAX (requisition->width, child_requisition.width);
requisition->width = MAX (requisition->width,
child_requisition.width + left_margin);
requisition->height += child_requisition.height;
}
......@@ -194,10 +198,9 @@ gimp_frame_child_allocate (GtkFrame *frame,
{
GtkWidget *widget = GTK_WIDGET (frame);
GtkAllocation *allocation = &widget->allocation;
PangoLayout *layout;
gint border_width = GTK_CONTAINER (frame)->border_width;
gint top_margin = 0;
gint left_margin;
gint left_margin = gimp_frame_left_margin (widget);
if (frame->label_widget)
{
......@@ -213,11 +216,6 @@ gimp_frame_child_allocate (GtkFrame *frame,
top_margin += child_requisition.height;
}
/* the HIG suggests to use four spaces so do just that */
layout = gtk_widget_create_pango_layout (widget, " ");
pango_layout_get_pixel_size (layout, &left_margin, NULL);
g_object_unref (layout);
if (gtk_widget_get_direction (widget) == GTK_TEXT_DIR_LTR)
child_allocation->x = border_width + left_margin;
else
......@@ -270,6 +268,20 @@ gimp_frame_label_widget_notify (GtkFrame *frame)
}
}
static gint
gimp_frame_left_margin (GtkWidget *widget)
{
PangoLayout *layout;
gint width;
/* the HIG suggests to use four spaces so do just that */
layout = gtk_widget_create_pango_layout (widget, " ");
pango_layout_get_pixel_size (layout, &width, NULL);
g_object_unref (layout);
return width;
}
/**
* gimp_frame_new:
* @label: text to set as the frame's title label (or %NULL for no title)
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment