forked from AuroraMiddleware/gtk
fixed panel allocation and stacking order, fixed the base class
Sun Apr 5 08:03:01 1998 Tim Janik <timj@gtk.org> * gtk/gtkspinbutton.c: fixed panel allocation and stacking order, fixed the base class realization. * gtk/gtkmisc.c: implemented widget arguments. * gtk/gtkentry.c: fixes in _realize to behave similar to _size_allocate.
This commit is contained in:
parent
9a5ad5d44e
commit
6e28c40061
10
ChangeLog
10
ChangeLog
@ -1,3 +1,13 @@
|
|||||||
|
Sun Apr 5 08:03:01 1998 Tim Janik <timj@gtk.org>
|
||||||
|
|
||||||
|
* gtk/gtkspinbutton.c: fixed panel allocation and stacking order,
|
||||||
|
fixed the base class realization.
|
||||||
|
|
||||||
|
* gtk/gtkmisc.c: implemented widget arguments.
|
||||||
|
|
||||||
|
* gtk/gtkentry.c: fixes in _realize to behave similar to
|
||||||
|
_size_allocate.
|
||||||
|
|
||||||
Sat Apr 4 12:23:23 BST 1998 Tony Gale <gale@gtk.org>
|
Sat Apr 4 12:23:23 BST 1998 Tony Gale <gale@gtk.org>
|
||||||
|
|
||||||
* docs/gtk_tut.sgml: (gtk-crichton-980403-0) subsections on
|
* docs/gtk_tut.sgml: (gtk-crichton-980403-0) subsections on
|
||||||
|
@ -1,3 +1,13 @@
|
|||||||
|
Sun Apr 5 08:03:01 1998 Tim Janik <timj@gtk.org>
|
||||||
|
|
||||||
|
* gtk/gtkspinbutton.c: fixed panel allocation and stacking order,
|
||||||
|
fixed the base class realization.
|
||||||
|
|
||||||
|
* gtk/gtkmisc.c: implemented widget arguments.
|
||||||
|
|
||||||
|
* gtk/gtkentry.c: fixes in _realize to behave similar to
|
||||||
|
_size_allocate.
|
||||||
|
|
||||||
Sat Apr 4 12:23:23 BST 1998 Tony Gale <gale@gtk.org>
|
Sat Apr 4 12:23:23 BST 1998 Tony Gale <gale@gtk.org>
|
||||||
|
|
||||||
* docs/gtk_tut.sgml: (gtk-crichton-980403-0) subsections on
|
* docs/gtk_tut.sgml: (gtk-crichton-980403-0) subsections on
|
||||||
|
@ -1,3 +1,13 @@
|
|||||||
|
Sun Apr 5 08:03:01 1998 Tim Janik <timj@gtk.org>
|
||||||
|
|
||||||
|
* gtk/gtkspinbutton.c: fixed panel allocation and stacking order,
|
||||||
|
fixed the base class realization.
|
||||||
|
|
||||||
|
* gtk/gtkmisc.c: implemented widget arguments.
|
||||||
|
|
||||||
|
* gtk/gtkentry.c: fixes in _realize to behave similar to
|
||||||
|
_size_allocate.
|
||||||
|
|
||||||
Sat Apr 4 12:23:23 BST 1998 Tony Gale <gale@gtk.org>
|
Sat Apr 4 12:23:23 BST 1998 Tony Gale <gale@gtk.org>
|
||||||
|
|
||||||
* docs/gtk_tut.sgml: (gtk-crichton-980403-0) subsections on
|
* docs/gtk_tut.sgml: (gtk-crichton-980403-0) subsections on
|
||||||
|
@ -1,3 +1,13 @@
|
|||||||
|
Sun Apr 5 08:03:01 1998 Tim Janik <timj@gtk.org>
|
||||||
|
|
||||||
|
* gtk/gtkspinbutton.c: fixed panel allocation and stacking order,
|
||||||
|
fixed the base class realization.
|
||||||
|
|
||||||
|
* gtk/gtkmisc.c: implemented widget arguments.
|
||||||
|
|
||||||
|
* gtk/gtkentry.c: fixes in _realize to behave similar to
|
||||||
|
_size_allocate.
|
||||||
|
|
||||||
Sat Apr 4 12:23:23 BST 1998 Tony Gale <gale@gtk.org>
|
Sat Apr 4 12:23:23 BST 1998 Tony Gale <gale@gtk.org>
|
||||||
|
|
||||||
* docs/gtk_tut.sgml: (gtk-crichton-980403-0) subsections on
|
* docs/gtk_tut.sgml: (gtk-crichton-980403-0) subsections on
|
||||||
|
@ -1,3 +1,13 @@
|
|||||||
|
Sun Apr 5 08:03:01 1998 Tim Janik <timj@gtk.org>
|
||||||
|
|
||||||
|
* gtk/gtkspinbutton.c: fixed panel allocation and stacking order,
|
||||||
|
fixed the base class realization.
|
||||||
|
|
||||||
|
* gtk/gtkmisc.c: implemented widget arguments.
|
||||||
|
|
||||||
|
* gtk/gtkentry.c: fixes in _realize to behave similar to
|
||||||
|
_size_allocate.
|
||||||
|
|
||||||
Sat Apr 4 12:23:23 BST 1998 Tony Gale <gale@gtk.org>
|
Sat Apr 4 12:23:23 BST 1998 Tony Gale <gale@gtk.org>
|
||||||
|
|
||||||
* docs/gtk_tut.sgml: (gtk-crichton-980403-0) subsections on
|
* docs/gtk_tut.sgml: (gtk-crichton-980403-0) subsections on
|
||||||
|
@ -1,3 +1,13 @@
|
|||||||
|
Sun Apr 5 08:03:01 1998 Tim Janik <timj@gtk.org>
|
||||||
|
|
||||||
|
* gtk/gtkspinbutton.c: fixed panel allocation and stacking order,
|
||||||
|
fixed the base class realization.
|
||||||
|
|
||||||
|
* gtk/gtkmisc.c: implemented widget arguments.
|
||||||
|
|
||||||
|
* gtk/gtkentry.c: fixes in _realize to behave similar to
|
||||||
|
_size_allocate.
|
||||||
|
|
||||||
Sat Apr 4 12:23:23 BST 1998 Tony Gale <gale@gtk.org>
|
Sat Apr 4 12:23:23 BST 1998 Tony Gale <gale@gtk.org>
|
||||||
|
|
||||||
* docs/gtk_tut.sgml: (gtk-crichton-980403-0) subsections on
|
* docs/gtk_tut.sgml: (gtk-crichton-980403-0) subsections on
|
||||||
|
@ -1,3 +1,13 @@
|
|||||||
|
Sun Apr 5 08:03:01 1998 Tim Janik <timj@gtk.org>
|
||||||
|
|
||||||
|
* gtk/gtkspinbutton.c: fixed panel allocation and stacking order,
|
||||||
|
fixed the base class realization.
|
||||||
|
|
||||||
|
* gtk/gtkmisc.c: implemented widget arguments.
|
||||||
|
|
||||||
|
* gtk/gtkentry.c: fixes in _realize to behave similar to
|
||||||
|
_size_allocate.
|
||||||
|
|
||||||
Sat Apr 4 12:23:23 BST 1998 Tony Gale <gale@gtk.org>
|
Sat Apr 4 12:23:23 BST 1998 Tony Gale <gale@gtk.org>
|
||||||
|
|
||||||
* docs/gtk_tut.sgml: (gtk-crichton-980403-0) subsections on
|
* docs/gtk_tut.sgml: (gtk-crichton-980403-0) subsections on
|
||||||
|
@ -434,12 +434,13 @@ gtk_entry_realize (GtkWidget *widget)
|
|||||||
GTK_WIDGET_SET_FLAGS (widget, GTK_REALIZED);
|
GTK_WIDGET_SET_FLAGS (widget, GTK_REALIZED);
|
||||||
entry = GTK_ENTRY (widget);
|
entry = GTK_ENTRY (widget);
|
||||||
editable = GTK_EDITABLE (widget);
|
editable = GTK_EDITABLE (widget);
|
||||||
|
|
||||||
attributes.window_type = GDK_WINDOW_CHILD;
|
attributes.window_type = GDK_WINDOW_CHILD;
|
||||||
attributes.x = widget->allocation.x;
|
attributes.x = widget->allocation.x;
|
||||||
attributes.y = widget->allocation.y;
|
attributes.y = widget->allocation.y + (widget->allocation.height -
|
||||||
|
widget->requisition.height) / 2;
|
||||||
attributes.width = widget->allocation.width;
|
attributes.width = widget->allocation.width;
|
||||||
attributes.height = widget->allocation.height;
|
attributes.height = widget->requisition.height;
|
||||||
attributes.wclass = GDK_INPUT_OUTPUT;
|
attributes.wclass = GDK_INPUT_OUTPUT;
|
||||||
attributes.visual = gtk_widget_get_visual (widget);
|
attributes.visual = gtk_widget_get_visual (widget);
|
||||||
attributes.colormap = gtk_widget_get_colormap (widget);
|
attributes.colormap = gtk_widget_get_colormap (widget);
|
||||||
|
@ -19,9 +19,23 @@
|
|||||||
#include "gtkmisc.h"
|
#include "gtkmisc.h"
|
||||||
|
|
||||||
|
|
||||||
|
enum {
|
||||||
|
ARG_0,
|
||||||
|
ARG_XALIGN,
|
||||||
|
ARG_YALIGN,
|
||||||
|
ARG_XPAD,
|
||||||
|
ARG_YPAD,
|
||||||
|
};
|
||||||
|
|
||||||
static void gtk_misc_class_init (GtkMiscClass *klass);
|
static void gtk_misc_class_init (GtkMiscClass *klass);
|
||||||
static void gtk_misc_init (GtkMisc *misc);
|
static void gtk_misc_init (GtkMisc *misc);
|
||||||
static void gtk_misc_realize (GtkWidget *widget);
|
static void gtk_misc_realize (GtkWidget *widget);
|
||||||
|
static void gtk_misc_set_arg (GtkMisc *misc,
|
||||||
|
GtkArg *arg,
|
||||||
|
guint arg_id);
|
||||||
|
static void gtk_misc_get_arg (GtkMisc *misc,
|
||||||
|
GtkArg *arg,
|
||||||
|
guint arg_id);
|
||||||
|
|
||||||
|
|
||||||
guint
|
guint
|
||||||
@ -38,8 +52,8 @@ gtk_misc_get_type ()
|
|||||||
sizeof (GtkMiscClass),
|
sizeof (GtkMiscClass),
|
||||||
(GtkClassInitFunc) gtk_misc_class_init,
|
(GtkClassInitFunc) gtk_misc_class_init,
|
||||||
(GtkObjectInitFunc) gtk_misc_init,
|
(GtkObjectInitFunc) gtk_misc_init,
|
||||||
(GtkArgSetFunc) NULL,
|
(GtkArgSetFunc) gtk_misc_set_arg,
|
||||||
(GtkArgGetFunc) NULL,
|
(GtkArgGetFunc) gtk_misc_get_arg,
|
||||||
};
|
};
|
||||||
|
|
||||||
misc_type = gtk_type_unique (gtk_widget_get_type (), &misc_info);
|
misc_type = gtk_type_unique (gtk_widget_get_type (), &misc_info);
|
||||||
@ -55,6 +69,11 @@ gtk_misc_class_init (GtkMiscClass *class)
|
|||||||
|
|
||||||
widget_class = (GtkWidgetClass*) class;
|
widget_class = (GtkWidgetClass*) class;
|
||||||
|
|
||||||
|
gtk_object_add_arg_type ("GtkMisc::xalign", GTK_TYPE_DOUBLE, GTK_ARG_READWRITE, ARG_XALIGN);
|
||||||
|
gtk_object_add_arg_type ("GtkMisc::yalign", GTK_TYPE_DOUBLE, GTK_ARG_READWRITE, ARG_YALIGN);
|
||||||
|
gtk_object_add_arg_type ("GtkMisc::xpad", GTK_TYPE_INT, GTK_ARG_READWRITE, ARG_XPAD);
|
||||||
|
gtk_object_add_arg_type ("GtkMisc::ypad", GTK_TYPE_INT, GTK_ARG_READWRITE, ARG_YPAD);
|
||||||
|
|
||||||
widget_class->realize = gtk_misc_realize;
|
widget_class->realize = gtk_misc_realize;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -69,6 +88,56 @@ gtk_misc_init (GtkMisc *misc)
|
|||||||
misc->ypad = 0;
|
misc->ypad = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
gtk_misc_set_arg (GtkMisc *misc,
|
||||||
|
GtkArg *arg,
|
||||||
|
guint arg_id)
|
||||||
|
{
|
||||||
|
switch (arg_id)
|
||||||
|
{
|
||||||
|
case ARG_XALIGN:
|
||||||
|
gtk_misc_set_alignment (misc, GTK_VALUE_DOUBLE (*arg), misc->yalign);
|
||||||
|
break;
|
||||||
|
case ARG_YALIGN:
|
||||||
|
gtk_misc_set_alignment (misc, misc->xalign, GTK_VALUE_DOUBLE (*arg));
|
||||||
|
break;
|
||||||
|
case ARG_XPAD:
|
||||||
|
gtk_misc_set_alignment (misc, GTK_VALUE_INT (*arg), misc->ypad);
|
||||||
|
break;
|
||||||
|
case ARG_YPAD:
|
||||||
|
gtk_misc_set_alignment (misc, misc->xpad, GTK_VALUE_INT (*arg));
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
arg->type = GTK_TYPE_INVALID;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
gtk_misc_get_arg (GtkMisc *misc,
|
||||||
|
GtkArg *arg,
|
||||||
|
guint arg_id)
|
||||||
|
{
|
||||||
|
switch (arg_id)
|
||||||
|
{
|
||||||
|
case ARG_XALIGN:
|
||||||
|
GTK_VALUE_DOUBLE (*arg) = misc->xalign;
|
||||||
|
break;
|
||||||
|
case ARG_YALIGN:
|
||||||
|
GTK_VALUE_DOUBLE (*arg) = misc->yalign;
|
||||||
|
break;
|
||||||
|
case ARG_XPAD:
|
||||||
|
GTK_VALUE_INT (*arg) = misc->xpad;
|
||||||
|
break;
|
||||||
|
case ARG_YPAD:
|
||||||
|
GTK_VALUE_INT (*arg) = misc->ypad;
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
arg->type = GTK_TYPE_INVALID;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
gtk_misc_set_alignment (GtkMisc *misc,
|
gtk_misc_set_alignment (GtkMisc *misc,
|
||||||
gfloat xalign,
|
gfloat xalign,
|
||||||
|
@ -222,8 +222,8 @@ gtk_spin_button_map (GtkWidget *widget)
|
|||||||
|
|
||||||
if (GTK_WIDGET_REALIZED (widget) && !GTK_WIDGET_MAPPED (widget))
|
if (GTK_WIDGET_REALIZED (widget) && !GTK_WIDGET_MAPPED (widget))
|
||||||
{
|
{
|
||||||
gdk_window_show (GTK_SPIN_BUTTON (widget)->panel);
|
|
||||||
GTK_WIDGET_CLASS (parent_class)->map (widget);
|
GTK_WIDGET_CLASS (parent_class)->map (widget);
|
||||||
|
gdk_window_show (GTK_SPIN_BUTTON (widget)->panel);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -246,14 +246,18 @@ gtk_spin_button_realize (GtkWidget *widget)
|
|||||||
GtkSpinButton *spin;
|
GtkSpinButton *spin;
|
||||||
GdkWindowAttr attributes;
|
GdkWindowAttr attributes;
|
||||||
gint attributes_mask;
|
gint attributes_mask;
|
||||||
|
guint real_width;
|
||||||
|
|
||||||
g_return_if_fail (widget != NULL);
|
g_return_if_fail (widget != NULL);
|
||||||
g_return_if_fail (GTK_IS_SPIN_BUTTON (widget));
|
g_return_if_fail (GTK_IS_SPIN_BUTTON (widget));
|
||||||
|
|
||||||
spin = GTK_SPIN_BUTTON (widget);
|
spin = GTK_SPIN_BUTTON (widget);
|
||||||
|
|
||||||
|
real_width = widget->allocation.width;
|
||||||
|
widget->allocation.width -= ARROW_SIZE + 2 * widget->style->klass->xthickness;
|
||||||
GTK_WIDGET_CLASS (parent_class)->realize (widget);
|
GTK_WIDGET_CLASS (parent_class)->realize (widget);
|
||||||
|
widget->allocation.width = real_width;
|
||||||
|
|
||||||
attributes.window_type = GDK_WINDOW_CHILD;
|
attributes.window_type = GDK_WINDOW_CHILD;
|
||||||
attributes.wclass = GDK_INPUT_OUTPUT;
|
attributes.wclass = GDK_INPUT_OUTPUT;
|
||||||
attributes.visual = gtk_widget_get_visual (widget);
|
attributes.visual = gtk_widget_get_visual (widget);
|
||||||
@ -265,19 +269,18 @@ gtk_spin_button_realize (GtkWidget *widget)
|
|||||||
|
|
||||||
attributes_mask = GDK_WA_X | GDK_WA_Y | GDK_WA_VISUAL | GDK_WA_COLORMAP;
|
attributes_mask = GDK_WA_X | GDK_WA_Y | GDK_WA_VISUAL | GDK_WA_COLORMAP;
|
||||||
|
|
||||||
attributes.x = widget->allocation.x + widget->allocation.width
|
attributes.x = (widget->allocation.x + widget->allocation.width - ARROW_SIZE -
|
||||||
- ARROW_SIZE - 2 * widget->style->klass->xthickness;
|
2 * widget->style->klass->xthickness);
|
||||||
attributes.y = widget->allocation.y;
|
attributes.y = widget->allocation.y + (widget->allocation.height -
|
||||||
|
widget->requisition.height) / 2;
|
||||||
attributes.width = ARROW_SIZE;
|
attributes.width = ARROW_SIZE + 2 * widget->style->klass->xthickness;
|
||||||
attributes.height = widget->allocation.height;
|
attributes.height = widget->requisition.height;
|
||||||
|
|
||||||
spin->panel = gdk_window_new (gtk_widget_get_parent_window (widget),
|
spin->panel = gdk_window_new (gtk_widget_get_parent_window (widget),
|
||||||
&attributes, attributes_mask);
|
&attributes, attributes_mask);
|
||||||
|
gdk_window_set_user_data (spin->panel, widget);
|
||||||
|
|
||||||
gtk_style_set_background (widget->style, spin->panel, GTK_STATE_NORMAL);
|
gtk_style_set_background (widget->style, spin->panel, GTK_STATE_NORMAL);
|
||||||
|
|
||||||
gdk_window_set_user_data (spin->panel, widget);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
@ -325,9 +328,7 @@ gtk_spin_button_size_allocate (GtkWidget *widget,
|
|||||||
g_return_if_fail (allocation != NULL);
|
g_return_if_fail (allocation != NULL);
|
||||||
|
|
||||||
child_allocation = *allocation;
|
child_allocation = *allocation;
|
||||||
child_allocation.width = allocation->width - ARROW_SIZE
|
child_allocation.width -= ARROW_SIZE + 2 * widget->style->klass->xthickness;
|
||||||
- 2 * widget->style->klass->xthickness;
|
|
||||||
child_allocation.height = allocation->height;
|
|
||||||
|
|
||||||
GTK_WIDGET_CLASS (parent_class)->size_allocate (widget, &child_allocation);
|
GTK_WIDGET_CLASS (parent_class)->size_allocate (widget, &child_allocation);
|
||||||
|
|
||||||
@ -335,13 +336,11 @@ gtk_spin_button_size_allocate (GtkWidget *widget,
|
|||||||
|
|
||||||
if (GTK_WIDGET_REALIZED (widget))
|
if (GTK_WIDGET_REALIZED (widget))
|
||||||
{
|
{
|
||||||
child_allocation.width = ARROW_SIZE
|
child_allocation.width = ARROW_SIZE + 2 * widget->style->klass->xthickness;
|
||||||
+ 2 * widget->style->klass->xthickness;
|
|
||||||
child_allocation.height = widget->requisition.height;
|
child_allocation.height = widget->requisition.height;
|
||||||
child_allocation.x = (allocation->x + allocation->width - ARROW_SIZE -
|
child_allocation.x = (allocation->x + allocation->width - ARROW_SIZE -
|
||||||
2 * widget->style->klass->xthickness);
|
2 * widget->style->klass->xthickness);
|
||||||
child_allocation.y = allocation->y + (allocation->height -
|
child_allocation.y = allocation->y + (allocation->height - widget->requisition.height) / 2;
|
||||||
widget->requisition.height) / 2;
|
|
||||||
|
|
||||||
gdk_window_move_resize (GTK_SPIN_BUTTON (widget)->panel,
|
gdk_window_move_resize (GTK_SPIN_BUTTON (widget)->panel,
|
||||||
child_allocation.x,
|
child_allocation.x,
|
||||||
|
Loading…
Reference in New Issue
Block a user