#include <config.h>
#include "gtkalignment.h"
+#include "gtkprivate.h"
#include "gtkintl.h"
#include "gtkalias.h"
(GInstanceInitFunc) gtk_alignment_init,
};
- alignment_type = g_type_register_static (GTK_TYPE_BIN, "GtkAlignment",
+ alignment_type = g_type_register_static (GTK_TYPE_BIN, I_("GtkAlignment"),
&alignment_info, 0);
}
0.0,
1.0,
0.5,
- G_PARAM_READABLE | G_PARAM_WRITABLE));
+ GTK_PARAM_READWRITE));
g_object_class_install_property (gobject_class,
PROP_YALIGN,
0.0,
1.0,
0.5,
- G_PARAM_READABLE | G_PARAM_WRITABLE));
+ GTK_PARAM_READWRITE));
g_object_class_install_property (gobject_class,
PROP_XSCALE,
g_param_spec_float("xscale",
0.0,
1.0,
1.0,
- G_PARAM_READABLE | G_PARAM_WRITABLE));
+ GTK_PARAM_READWRITE));
g_object_class_install_property (gobject_class,
PROP_YSCALE,
g_param_spec_float("yscale",
0.0,
1.0,
1.0,
- G_PARAM_READABLE | G_PARAM_WRITABLE));
+ GTK_PARAM_READWRITE));
/**
0,
G_MAXINT,
0,
- G_PARAM_READABLE | G_PARAM_WRITABLE));
+ GTK_PARAM_READWRITE));
/**
- * GtkAlignment:top-padding:
+ * GtkAlignment:bottom-padding:
*
* The padding to insert at the bottom of the widget.
*
0,
G_MAXINT,
0,
- G_PARAM_READABLE | G_PARAM_WRITABLE));
+ GTK_PARAM_READWRITE));
/**
- * GtkAlignment:top-padding:
+ * GtkAlignment:left-padding:
*
* The padding to insert at the left of the widget.
*
0,
G_MAXINT,
0,
- G_PARAM_READABLE | G_PARAM_WRITABLE));
+ GTK_PARAM_READWRITE));
/**
- * GtkAlignment:top-padding:
+ * GtkAlignment:right-padding:
*
* The padding to insert at the right of the widget.
*
0,
G_MAXINT,
0,
- G_PARAM_READABLE | G_PARAM_WRITABLE));
+ GTK_PARAM_READWRITE));
g_type_class_add_private (gobject_class, sizeof (GtkAlignmentPrivate));
}
gtk_alignment_size_request (GtkWidget *widget,
GtkRequisition *requisition)
{
- GtkAlignment *alignment;
GtkBin *bin;
GtkAlignmentPrivate *priv;
- alignment = GTK_ALIGNMENT (widget);
bin = GTK_BIN (widget);
priv = GTK_ALIGNMENT_GET_PRIVATE (widget);
gint border_width;
gint padding_horizontal, padding_vertical;
GtkAlignmentPrivate *priv;
- gfloat xalign;
padding_horizontal = 0;
padding_vertical = 0;
else
child_allocation.height = height;
- xalign = alignment->xalign;
if (gtk_widget_get_direction (widget) == GTK_TEXT_DIR_RTL)
- xalign = 1.0 - xalign;
+ child_allocation.x = (1.0 - alignment->xalign) * (width - child_allocation.width) + allocation->x + border_width + priv->padding_right;
+ else
+ child_allocation.x = alignment->xalign * (width - child_allocation.width) + allocation->x + border_width + priv->padding_left;
- child_allocation.x = xalign * (width - child_allocation.width) + allocation->x + border_width + priv->padding_left;
child_allocation.y = alignment->yalign * (height - child_allocation.height) + allocation->y + border_width + priv->padding_top;
gtk_widget_size_allocate (bin->child, &child_allocation);
if (priv->padding_top != padding_top)
{
priv->padding_top = padding_top;
- g_object_notify (G_OBJECT (alignment), "top_padding");
+ g_object_notify (G_OBJECT (alignment), "top-padding");
}
if (priv->padding_bottom != padding_bottom)
{
priv->padding_bottom = padding_bottom;
- g_object_notify (G_OBJECT (alignment), "bottom_padding");
+ g_object_notify (G_OBJECT (alignment), "bottom-padding");
}
if (priv->padding_left != padding_left)
{
priv->padding_left = padding_left;
- g_object_notify (G_OBJECT (alignment), "left_padding");
+ g_object_notify (G_OBJECT (alignment), "left-padding");
}
if (priv->padding_right != padding_right)
{
priv->padding_right = padding_right;
- g_object_notify (G_OBJECT (alignment), "right_padding");
+ g_object_notify (G_OBJECT (alignment), "right-padding");
}
g_object_thaw_notify (G_OBJECT (alignment));