Commit 09423315 authored by Tim Janik's avatar Tim Janik Committed by Tim Janik

GtkType and macro fixups.

Sun Jun 28 11:39:17 1998  Tim Janik  <timj@gtk.org>

        * gtk/gtkalignment.h:
        * gtk/gtkbin.h: GtkType and macro fixups.

        * gtk/gtkalignment.c (gtk_alignment_class_init): widget argument
        implementation: GtkAlignment::xalign, GtkAlignment::yalign,
        GtkAlignment::xscale, GtkAlignment::yscale.
parent e63d08e4
Sun Jun 28 11:39:17 1998 Tim Janik <timj@gtk.org>
* gtk/gtkalignment.h:
* gtk/gtkbin.h: GtkType and macro fixups.
* gtk/gtkalignment.c (gtk_alignment_class_init): widget argument
implementation: GtkAlignment::xalign, GtkAlignment::yalign,
GtkAlignment::xscale, GtkAlignment::yscale.
Sun Jun 28 04:29:10 1998 Tim Janik <timj@gtk.org>
* gtk/gtktypeutils.c (gtk_type_class_init): call the base class init
......
Sun Jun 28 11:39:17 1998 Tim Janik <timj@gtk.org>
* gtk/gtkalignment.h:
* gtk/gtkbin.h: GtkType and macro fixups.
* gtk/gtkalignment.c (gtk_alignment_class_init): widget argument
implementation: GtkAlignment::xalign, GtkAlignment::yalign,
GtkAlignment::xscale, GtkAlignment::yscale.
Sun Jun 28 04:29:10 1998 Tim Janik <timj@gtk.org>
* gtk/gtktypeutils.c (gtk_type_class_init): call the base class init
......
Sun Jun 28 11:39:17 1998 Tim Janik <timj@gtk.org>
* gtk/gtkalignment.h:
* gtk/gtkbin.h: GtkType and macro fixups.
* gtk/gtkalignment.c (gtk_alignment_class_init): widget argument
implementation: GtkAlignment::xalign, GtkAlignment::yalign,
GtkAlignment::xscale, GtkAlignment::yscale.
Sun Jun 28 04:29:10 1998 Tim Janik <timj@gtk.org>
* gtk/gtktypeutils.c (gtk_type_class_init): call the base class init
......
Sun Jun 28 11:39:17 1998 Tim Janik <timj@gtk.org>
* gtk/gtkalignment.h:
* gtk/gtkbin.h: GtkType and macro fixups.
* gtk/gtkalignment.c (gtk_alignment_class_init): widget argument
implementation: GtkAlignment::xalign, GtkAlignment::yalign,
GtkAlignment::xscale, GtkAlignment::yscale.
Sun Jun 28 04:29:10 1998 Tim Janik <timj@gtk.org>
* gtk/gtktypeutils.c (gtk_type_class_init): call the base class init
......
Sun Jun 28 11:39:17 1998 Tim Janik <timj@gtk.org>
* gtk/gtkalignment.h:
* gtk/gtkbin.h: GtkType and macro fixups.
* gtk/gtkalignment.c (gtk_alignment_class_init): widget argument
implementation: GtkAlignment::xalign, GtkAlignment::yalign,
GtkAlignment::xscale, GtkAlignment::yscale.
Sun Jun 28 04:29:10 1998 Tim Janik <timj@gtk.org>
* gtk/gtktypeutils.c (gtk_type_class_init): call the base class init
......
Sun Jun 28 11:39:17 1998 Tim Janik <timj@gtk.org>
* gtk/gtkalignment.h:
* gtk/gtkbin.h: GtkType and macro fixups.
* gtk/gtkalignment.c (gtk_alignment_class_init): widget argument
implementation: GtkAlignment::xalign, GtkAlignment::yalign,
GtkAlignment::xscale, GtkAlignment::yscale.
Sun Jun 28 04:29:10 1998 Tim Janik <timj@gtk.org>
* gtk/gtktypeutils.c (gtk_type_class_init): call the base class init
......
Sun Jun 28 11:39:17 1998 Tim Janik <timj@gtk.org>
* gtk/gtkalignment.h:
* gtk/gtkbin.h: GtkType and macro fixups.
* gtk/gtkalignment.c (gtk_alignment_class_init): widget argument
implementation: GtkAlignment::xalign, GtkAlignment::yalign,
GtkAlignment::xscale, GtkAlignment::yscale.
Sun Jun 28 04:29:10 1998 Tim Janik <timj@gtk.org>
* gtk/gtktypeutils.c (gtk_type_class_init): call the base class init
......
......@@ -19,18 +19,34 @@
#include "gtkalignment.h"
enum {
ARG_0,
ARG_XALIGN,
ARG_YALIGN,
ARG_XSCALE,
ARG_YSCALE
};
static void gtk_alignment_class_init (GtkAlignmentClass *klass);
static void gtk_alignment_init (GtkAlignment *alignment);
static void gtk_alignment_size_request (GtkWidget *widget,
GtkRequisition *requisition);
static void gtk_alignment_size_allocate (GtkWidget *widget,
GtkAllocation *allocation);
static void gtk_alignment_set_arg (GtkObject *object,
GtkArg *arg,
guint arg_id);
static void gtk_alignment_get_arg (GtkObject *object,
GtkArg *arg,
guint arg_id);
guint
GtkType
gtk_alignment_get_type (void)
{
static guint alignment_type = 0;
static GtkType alignment_type = 0;
if (!alignment_type)
{
......@@ -46,7 +62,7 @@ gtk_alignment_get_type (void)
(GtkClassInitFunc) NULL,
};
alignment_type = gtk_type_unique (gtk_bin_get_type (), &alignment_info);
alignment_type = gtk_type_unique (GTK_TYPE_BIN, &alignment_info);
}
return alignment_type;
......@@ -55,10 +71,20 @@ gtk_alignment_get_type (void)
static void
gtk_alignment_class_init (GtkAlignmentClass *class)
{
GtkObjectClass *object_class;
GtkWidgetClass *widget_class;
object_class = (GtkObjectClass*) class;
widget_class = (GtkWidgetClass*) class;
gtk_object_add_arg_type ("GtkAlignment::xalign", GTK_TYPE_FLOAT, GTK_ARG_READWRITE, ARG_XALIGN);
gtk_object_add_arg_type ("GtkAlignment::yalign", GTK_TYPE_FLOAT, GTK_ARG_READWRITE, ARG_YALIGN);
gtk_object_add_arg_type ("GtkAlignment::xscale", GTK_TYPE_FLOAT, GTK_ARG_READWRITE, ARG_XSCALE);
gtk_object_add_arg_type ("GtkAlignment::yscale", GTK_TYPE_FLOAT, GTK_ARG_READWRITE, ARG_YSCALE);
object_class->set_arg = gtk_alignment_set_arg;
object_class->get_arg = gtk_alignment_get_arg;
widget_class->size_request = gtk_alignment_size_request;
widget_class->size_allocate = gtk_alignment_size_allocate;
}
......@@ -92,6 +118,79 @@ gtk_alignment_new (gfloat xalign,
return GTK_WIDGET (alignment);
}
static void
gtk_alignment_set_arg (GtkObject *object,
GtkArg *arg,
guint arg_id)
{
GtkAlignment *alignment;
alignment = GTK_ALIGNMENT (object);
switch (arg_id)
{
case ARG_XALIGN:
gtk_alignment_set (alignment,
GTK_VALUE_FLOAT (*arg),
alignment->yalign,
alignment->xscale,
alignment->yscale);
break;
case ARG_YALIGN:
gtk_alignment_set (alignment,
alignment->xalign,
GTK_VALUE_FLOAT (*arg),
alignment->xscale,
alignment->yscale);
break;
case ARG_XSCALE:
gtk_alignment_set (alignment,
alignment->xalign,
alignment->yalign,
GTK_VALUE_FLOAT (*arg),
alignment->yscale);
break;
case ARG_YSCALE:
gtk_alignment_set (alignment,
alignment->xalign,
alignment->yalign,
alignment->xscale,
GTK_VALUE_FLOAT (*arg));
break;
default:
break;
}
}
static void
gtk_alignment_get_arg (GtkObject *object,
GtkArg *arg,
guint arg_id)
{
GtkAlignment *alignment;
alignment = GTK_ALIGNMENT (object);
switch (arg_id)
{
case ARG_XALIGN:
GTK_VALUE_FLOAT (*arg) = alignment->xalign;
break;
case ARG_YALIGN:
GTK_VALUE_FLOAT (*arg) = alignment->yalign;
break;
case ARG_XSCALE:
GTK_VALUE_FLOAT (*arg) = alignment->xscale;
break;
case ARG_YSCALE:
GTK_VALUE_FLOAT (*arg) = alignment->yscale;
break;
default:
arg->type = GTK_TYPE_INVALID;
break;
}
}
void
gtk_alignment_set (GtkAlignment *alignment,
gfloat xalign,
......@@ -166,25 +265,25 @@ gtk_alignment_size_allocate (GtkWidget *widget,
widget->allocation = *allocation;
alignment = GTK_ALIGNMENT (widget);
bin = GTK_BIN (widget);
if (bin->child && GTK_WIDGET_VISIBLE (bin->child))
{
x = GTK_CONTAINER (alignment)->border_width;
y = GTK_CONTAINER (alignment)->border_width;
width = MAX (allocation->width - 2 * x, 0);
height = MAX (allocation->height - 2 * y, 0);
if (width > bin->child->requisition.width)
child_allocation.width = (bin->child->requisition.width *
(1.0 - alignment->xscale) +
width * alignment->xscale);
else
child_allocation.width = width;
if (height > bin->child->requisition.height)
child_allocation.height = (bin->child->requisition.height *
(1.0 - alignment->yscale) +
height * alignment->yscale);
(1.0 - alignment->yscale) +
height * alignment->yscale);
else
child_allocation.height = height;
......
......@@ -29,9 +29,11 @@ extern "C" {
#endif /* __cplusplus */
#define GTK_ALIGNMENT(obj) GTK_CHECK_CAST (obj, gtk_alignment_get_type (), GtkAlignment)
#define GTK_ALIGNMENT_CLASS(klass) GTK_CHECK_CLASS_CAST (klass, gtk_alignment_get_type (), GtkAlignmentClass)
#define GTK_IS_ALIGNMENT(obj) GTK_CHECK_TYPE (obj, gtk_alignment_get_type ())
#define GTK_TYPE_ALIGNMENT (gtk_alignment_get_type ())
#define GTK_ALIGNMENT(obj) (GTK_CHECK_CAST ((obj), GTK_TYPE_ALIGNMENT, GtkAlignment))
#define GTK_ALIGNMENT_CLASS(klass) (GTK_CHECK_CLASS_CAST ((klass), GTK_TYPE_ALIGNMENT, GtkAlignmentClass))
#define GTK_IS_ALIGNMENT(obj) (GTK_CHECK_TYPE ((obj), GTK_TYPE_ALIGNMENT))
#define GTK_IS_ALIGNMENT_CLASS(klass) (GTK_CHECK_CLASS_TYPE ((klass), GTK_TYPE_ALIGNMENT))
typedef struct _GtkAlignment GtkAlignment;
......@@ -53,7 +55,7 @@ struct _GtkAlignmentClass
};
guint gtk_alignment_get_type (void);
GtkType gtk_alignment_get_type (void);
GtkWidget* gtk_alignment_new (gfloat xalign,
gfloat yalign,
gfloat xscale,
......
......@@ -40,7 +40,7 @@ static GtkType gtk_bin_child_type (GtkContainer*container);
static GtkContainerClass *parent_class = NULL;
guint
GtkType
gtk_bin_get_type (void)
{
static guint bin_type = 0;
......@@ -59,7 +59,7 @@ gtk_bin_get_type (void)
(GtkClassInitFunc) NULL,
};
bin_type = gtk_type_unique (gtk_container_get_type (), &bin_info);
bin_type = gtk_type_unique (GTK_TYPE_CONTAINER, &bin_info);
}
return bin_type;
......@@ -76,7 +76,7 @@ gtk_bin_class_init (GtkBinClass *class)
widget_class = (GtkWidgetClass*) class;
container_class = (GtkContainerClass*) class;
parent_class = gtk_type_class (gtk_container_get_type ());
parent_class = gtk_type_class (GTK_TYPE_CONTAINER);
widget_class->map = gtk_bin_map;
widget_class->unmap = gtk_bin_unmap;
......
......@@ -29,9 +29,11 @@ extern "C" {
#endif /* __cplusplus */
#define GTK_BIN(obj) GTK_CHECK_CAST (obj, gtk_bin_get_type (), GtkBin)
#define GTK_BIN_CLASS(klass) GTK_CHECK_CLASS_CAST (klass, gtk_bin_get_type (), GtkBinClass)
#define GTK_IS_BIN(obj) GTK_CHECK_TYPE (obj, gtk_bin_get_type ())
#define GTK_TYPE_BIN (gtk_bin_get_type ())
#define GTK_BIN(obj) (GTK_CHECK_CAST ((obj), GTK_TYPE_BIN, GtkBin))
#define GTK_BIN_CLASS(klass) (GTK_CHECK_CLASS_CAST ((klass), GTK_TYPE_BIN, GtkBinClass))
#define GTK_IS_BIN(obj) (GTK_CHECK_TYPE ((obj), GTK_TYPE_BIN))
#define GTK_IS_BIN_CLASS(klass) (GTK_CHECK_CLASS_TYPE ((klass), GTK_TYPE_BIN))
typedef struct _GtkBin GtkBin;
......@@ -50,7 +52,7 @@ struct _GtkBinClass
};
guint gtk_bin_get_type (void);
GtkType gtk_bin_get_type (void);
#ifdef __cplusplus
......
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