{
GtkWidget *widget = GTK_WIDGET (entry);
GtkAllocation allocation;
- GtkRequisition requisition;
- gint req_height;
+ gint req_height, unused;
gint frame_height;
GtkBorder borders;
- gtk_widget_get_preferred_size (widget, &requisition, NULL);
- req_height = requisition.height - gtk_widget_get_margin_top (widget) - gtk_widget_get_margin_bottom (widget);
+ gtk_entry_get_preferred_height_and_baseline_for_width (widget, -1, &req_height, &unused, NULL, NULL);
gtk_widget_get_allocation (widget, &allocation);
_gtk_entry_get_borders (entry, &borders);
{
GtkEntryPrivate *priv = entry->priv;
GtkAllocation allocation;
- GtkRequisition requisition;
GtkWidget *widget = GTK_WIDGET (entry);
- gint area_height, y_pos;
gint baseline;
- gint req_height;
- GtkBorder borders;
-
- gtk_widget_get_preferred_size (widget, &requisition, NULL);
+ gint req_height, req_baseline, unused;
- req_height = requisition.height - gtk_widget_get_margin_top (widget) - gtk_widget_get_margin_bottom (widget);
+ gtk_entry_get_preferred_height_and_baseline_for_width (widget, -1, &req_height, &unused, &req_baseline, &unused);
gtk_widget_get_allocation (widget, &allocation);
baseline = gtk_widget_get_allocated_baseline (widget);
if (baseline == -1)
*y = (allocation.height - req_height) / 2;
else
- {
- _gtk_entry_get_borders (entry, &borders);
- area_height = req_height - borders.top - borders.bottom;
- y_pos = ((area_height * PANGO_SCALE - priv->ascent - priv->descent) / 2 + priv->ascent) / PANGO_SCALE;
- *y = baseline - y_pos - borders.top;
- }
+ *y = baseline - req_baseline;
}
*y += allocation.y;
gint *y,
gint *width,
gint *height);
-static void gtk_spin_button_get_frame_size (GtkEntry *entry,
- gint *x,
- gint *y,
- gint *width,
- gint *height);
static void gtk_spin_button_unset_adjustment (GtkSpinButton *spin_button);
static void gtk_spin_button_set_orientation (GtkSpinButton *spin_button,
GtkOrientation orientation);
entry_class->activate = gtk_spin_button_activate;
entry_class->get_text_area_size = gtk_spin_button_get_text_area_size;
- entry_class->get_frame_size = gtk_spin_button_get_frame_size;
class->input = NULL;
class->output = NULL;
GTK_ENTRY_CLASS (gtk_spin_button_parent_class)->activate (entry);
}
-static void
-gtk_spin_button_get_frame_size (GtkEntry *entry,
- gint *x,
- gint *y,
- gint *width,
- gint *height)
-{
- GtkSpinButtonPrivate *priv = GTK_SPIN_BUTTON (entry)->priv;
- gint up_panel_width, up_panel_height;
- gint down_panel_width, down_panel_height;
-
- gtk_spin_button_panel_get_size (GTK_SPIN_BUTTON (entry), priv->up_panel, &up_panel_width, &up_panel_height);
- gtk_spin_button_panel_get_size (GTK_SPIN_BUTTON (entry), priv->down_panel, &down_panel_width, &down_panel_height);
-
- GTK_ENTRY_CLASS (gtk_spin_button_parent_class)->get_frame_size (entry, x, y, width, height);
-
- if (priv->orientation == GTK_ORIENTATION_VERTICAL)
- {
- if (y)
- *y += up_panel_height;
-
- if (height)
- *height -= up_panel_height + down_panel_height;
- }
-}
-
static void
gtk_spin_button_get_text_area_size (GtkEntry *entry,
gint *x,