-/*
+/* vim:set sw=4 expandtab cino=(0:
+ *
* This file is a part of hildon
*
* Copyright (C) 2005, 2006 Nokia Corporation, all rights reserved.
GtkRequisition req;
GtkRequisition max_req;
GList *iter;
+ gboolean rtl;
g_assert (GTK_IS_WIDGET (widget));
g_assert (allocation != NULL);
ed = HILDON_DATE_EDITOR (widget);
priv = HILDON_DATE_EDITOR_GET_PRIVATE (ed);
+ rtl = (gtk_widget_get_direction (widget) == GTK_TEXT_DIR_RTL);
widget->allocation = *allocation;
gtk_widget_get_child_requisition (widget, &max_req);
f_alloc.x = img_alloc.x = allocation->x +
MAX (allocation->width - max_req.width, 0) / 2;
- /* allocate frame */
- if (GTK_WIDGET_VISIBLE (priv->frame)) {
+ /* calculate allocations */
+ if (GTK_WIDGET_VISIBLE (widget)) {
+ /* allocate frame */
gtk_widget_get_child_requisition (priv->frame, &req);
f_alloc.width = req.width;
f_alloc.height = max_req.height;
- gtk_widget_size_allocate (priv->frame, &f_alloc);
- }
- /* allocate icon */
- if (GTK_WIDGET_VISIBLE (priv->d_button_image)) {
+ /* allocate icon */
gtk_widget_get_child_requisition (priv->d_button_image,
&req);
img_alloc.x += f_alloc.width + HILDON_MARGIN_DEFAULT;
img_alloc.width = req.width;
img_alloc.height = max_req.height;
- gtk_widget_size_allocate (priv->d_button_image, &img_alloc);
+
+ if (rtl)
+ {
+ img_alloc.x = f_alloc.x;
+ f_alloc.x += img_alloc.width + HILDON_MARGIN_DEFAULT;
+ }
+
+ if (GTK_WIDGET_VISIBLE (priv->d_button_image)) {
+ gtk_widget_size_allocate (priv->d_button_image, &img_alloc);
+ }
+
+ if (GTK_WIDGET_VISIBLE (priv->frame)) {
+ gtk_widget_size_allocate (priv->frame, &f_alloc);
+ }
}
/* FIXME: We really should not alloc delimeters by hand (since they