Commit fde95757 authored by Michael Natterer's avatar Michael Natterer 😴 Committed by Michael Natterer

derive it from GtkBin, not from GtkVBox. Removed "content_spacing" style

2003-04-11  Michael Natterer  <mitch@gimp.org>

	* app/widgets/gimpdockable.[ch]: derive it from GtkBin, not from
	GtkVBox. Removed "content_spacing" style property.

	* app/widgets/gimpcontainerview-utils.c
	* etc/gtkrc_user
	* themes/Default/gtkrc: changed accordingly.
parent 5f26afe7
2003-04-11 Michael Natterer <mitch@gimp.org>
* app/widgets/gimpdockable.[ch]: derive it from GtkBin, not from
GtkVBox. Removed "content_spacing" style property.
* app/widgets/gimpcontainerview-utils.c
* etc/gtkrc_user
* themes/Default/gtkrc: changed accordingly.
2003-04-11 Raphael Quinet <quinet@gamers.org>
* plug-ins/flame/flame.c (dialog): restore the original input
......@@ -33,21 +33,21 @@
GimpContainerView *
gimp_container_view_get_by_dockable (GimpDockable *dockable)
{
g_return_val_if_fail (GIMP_IS_DOCKABLE (dockable), NULL);
GtkBin *bin;
if (GTK_BOX (dockable)->children)
{
GtkWidget *child;
g_return_val_if_fail (GIMP_IS_DOCKABLE (dockable), NULL);
child = ((GtkBoxChild *) GTK_BOX (dockable)->children->data)->widget;
bin = GTK_BIN (dockable);
if (GIMP_IS_CONTAINER_EDITOR (child))
if (bin->child)
{
if (GIMP_IS_CONTAINER_EDITOR (bin->child))
{
return GIMP_CONTAINER_EDITOR (child)->view;
return GIMP_CONTAINER_EDITOR (bin->child)->view;
}
else if (GIMP_IS_CONTAINER_VIEW (child))
else if (GIMP_IS_CONTAINER_VIEW (bin->child))
{
return GIMP_CONTAINER_VIEW (child);
return GIMP_CONTAINER_VIEW (bin->child);
}
}
......
......@@ -31,21 +31,25 @@
#include "gimpdockbook.h"
static void gimp_dockable_class_init (GimpDockableClass *klass);
static void gimp_dockable_init (GimpDockable *dockable);
static void gimp_dockable_class_init (GimpDockableClass *klass);
static void gimp_dockable_init (GimpDockable *dockable);
static void gimp_dockable_destroy (GtkObject *object);
static void gimp_dockable_style_set (GtkWidget *widget,
GtkStyle *prev_style);
static void gimp_dockable_destroy (GtkObject *object);
static void gimp_dockable_size_request (GtkWidget *widget,
GtkRequisition *requisition);
static void gimp_dockable_size_allocate (GtkWidget *widget,
GtkAllocation *allocation);
static void gimp_dockable_style_set (GtkWidget *widget,
GtkStyle *prev_style);
static GtkWidget * gimp_dockable_real_get_tab_widget (GimpDockable *dockable,
GimpDockbook *dockbook,
GtkIconSize size);
static void gimp_dockable_real_set_context (GimpDockable *dockable,
GimpContext *context);
static GtkWidget * gimp_dockable_real_get_tab_widget (GimpDockable *dockable,
GimpDockbook *dockbook,
GtkIconSize size);
static void gimp_dockable_real_set_context (GimpDockable *dockable,
GimpContext *context);
static GtkVBoxClass *parent_class = NULL;
static GtkBinClass *parent_class = NULL;
GType
......@@ -68,7 +72,7 @@ gimp_dockable_get_type (void)
(GInstanceInitFunc) gimp_dockable_init,
};
dockable_type = g_type_register_static (GTK_TYPE_VBOX,
dockable_type = g_type_register_static (GTK_TYPE_BIN,
"GimpDockable",
&dockable_info, 0);
}
......@@ -87,12 +91,14 @@ gimp_dockable_class_init (GimpDockableClass *klass)
parent_class = g_type_class_peek_parent (klass);
object_class->destroy = gimp_dockable_destroy;
object_class->destroy = gimp_dockable_destroy;
widget_class->style_set = gimp_dockable_style_set;
widget_class->size_request = gimp_dockable_size_request;
widget_class->size_allocate = gimp_dockable_size_allocate;
widget_class->style_set = gimp_dockable_style_set;
klass->get_tab_widget = gimp_dockable_real_get_tab_widget;
klass->set_context = gimp_dockable_real_set_context;
klass->get_tab_widget = gimp_dockable_real_get_tab_widget;
klass->set_context = gimp_dockable_real_set_context;
gtk_widget_class_install_style_property (widget_class,
g_param_spec_int ("content_border",
......@@ -101,14 +107,6 @@ gimp_dockable_class_init (GimpDockableClass *klass)
G_MAXINT,
0,
G_PARAM_READABLE));
gtk_widget_class_install_style_property (widget_class,
g_param_spec_int ("content_spacing",
NULL, NULL,
0,
G_MAXINT,
0,
G_PARAM_READABLE));
}
static void
......@@ -155,20 +153,62 @@ gimp_dockable_destroy (GtkObject *object)
GTK_OBJECT_CLASS (parent_class)->destroy (object);
}
static void
gimp_dockable_size_request (GtkWidget *widget,
GtkRequisition *requisition)
{
GtkBin *bin = GTK_BIN (widget);
requisition->width = GTK_CONTAINER (widget)->border_width * 2;
requisition->height = GTK_CONTAINER (widget)->border_width * 2;
if (bin->child && GTK_WIDGET_VISIBLE (bin->child))
{
GtkRequisition child_requisition;
gtk_widget_size_request (bin->child, &child_requisition);
requisition->width += child_requisition.width;
requisition->height += child_requisition.height;
}
}
static void
gimp_dockable_size_allocate (GtkWidget *widget,
GtkAllocation *allocation)
{
GtkBin *bin = GTK_BIN (widget);
widget->allocation = *allocation;
if (bin->child)
{
GtkAllocation child_allocation;
child_allocation.x = allocation->x;
child_allocation.y = allocation->y;
child_allocation.width = MAX (allocation->width -
GTK_CONTAINER (widget)->border_width * 2,
0);
child_allocation.height = MAX (allocation->height -
GTK_CONTAINER (widget)->border_width * 2,
0);
gtk_widget_size_allocate (bin->child, &child_allocation);
}
}
static void
gimp_dockable_style_set (GtkWidget *widget,
GtkStyle *prev_style)
{
gint content_border;
gint content_spacing;
gtk_widget_style_get (widget,
"content_border", &content_border,
"content_spacing", &content_spacing,
"content_border", &content_border,
NULL);
gtk_container_set_border_width (GTK_CONTAINER (widget), content_border);
gtk_box_set_spacing (GTK_BOX (widget), content_spacing);
if (GTK_WIDGET_CLASS (parent_class)->style_set)
GTK_WIDGET_CLASS (parent_class)->style_set (widget, prev_style);
......
......@@ -46,7 +46,7 @@ typedef struct _GimpDockableClass GimpDockableClass;
struct _GimpDockable
{
GtkVBox parent_instance;
GtkBin parent_instance;
gchar *name;
gchar *short_name;
......@@ -63,7 +63,7 @@ struct _GimpDockable
struct _GimpDockableClass
{
GtkVBoxClass parent_class;
GtkBinClass parent_class;
GtkWidget * (* get_tab_widget) (GimpDockable *dockable,
GimpDockbook *dockbook,
......
......@@ -29,7 +29,6 @@ style "gimp-small-style"
GimpDockbook::tab_border = 0
GimpDockbook::tab_icon_size = menu
GimpDockable::content_border = 1
GimpDockable::content_spacing = 1
GimpEditor::content_spacing = 1
GimpEditor::button_spacing = 1
GimpEditor::button_icon_size = menu
......@@ -53,7 +52,7 @@ binding "gimp-help-binding"
# class "GtkWidget" binding "gimp-help-binding"
# The dock separator is configurable using it's name.
# The dock separator is configurable using its name.
# Note that it uses the bg color of the selected state.
style "gimp-red-separator-style"
......
......@@ -45,7 +45,6 @@ style "gimp-default-style"
GimpDockbook::tab_border = 0
GimpDockbook::tab_size = button
GimpDockable::content_border = 2
GimpDockable::content_spacing = 2
GimpEditor::content_spacing = 2
GimpEditor::button_spacing = 2
GimpEditor::button_icon_size = menu
......
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