From: John Darrington Date: Sun, 7 Dec 2008 00:12:32 +0000 (+0900) Subject: Add a resize method to the axis X-Git-Tag: v0.7.1~62 X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=fabb4c4b7d16a4c3451baa304b222734edfa24b8;p=pspp-builds.git Add a resize method to the axis --- diff --git a/lib/gtksheet/gtksheet.c b/lib/gtksheet/gtksheet.c index be86de25..3baee065 100644 --- a/lib/gtksheet/gtksheet.c +++ b/lib/gtksheet/gtksheet.c @@ -5158,7 +5158,7 @@ set_column_width (GtkSheet *sheet, gtk_sheet_column_size_request (sheet, column, &min_width); if (width < min_width) return; - psppire_axis_impl_resize (sheet->haxis, column, width); + psppire_axis_resize (sheet->haxis, column, width); if (GTK_WIDGET_REALIZED (GTK_WIDGET (sheet))) { @@ -5186,7 +5186,7 @@ set_row_height (GtkSheet *sheet, gtk_sheet_row_size_request (sheet, row, &min_height); if (height < min_height) return; - psppire_axis_impl_resize (sheet->vaxis, row, height); + psppire_axis_resize (sheet->vaxis, row, height); if (GTK_WIDGET_REALIZED (GTK_WIDGET (sheet)) ) { diff --git a/lib/gtksheet/psppire-axis-impl.c b/lib/gtksheet/psppire-axis-impl.c index 2e9228f3..be47d874 100644 --- a/lib/gtksheet/psppire-axis-impl.c +++ b/lib/gtksheet/psppire-axis-impl.c @@ -132,6 +132,8 @@ total_size (const PsppireAxis *axis) } +static void resize (PsppireAxis *axis, gint posn, glong size); + static void @@ -142,6 +144,7 @@ psppire_impl_iface_init (PsppireAxisIface *iface) iface->start_pixel = start_pixel; iface->unit_at_pixel = unit_at_pixel; iface->total_size = total_size; + iface->resize = resize; } /* --- functions --- */ @@ -368,9 +371,11 @@ make_single (PsppireAxisImpl *a, gint posn) return tower_data (n, struct axis_node, unit_node); } -void -psppire_axis_impl_resize (PsppireAxisImpl *a, gint posn, gint size) +static void +resize (PsppireAxis *axis, gint posn, glong size) { + PsppireAxisImpl *a = PSPPIRE_AXIS_IMPL (axis); + struct axis_node *an; g_return_if_fail (posn >= 0); @@ -385,6 +390,14 @@ psppire_axis_impl_resize (PsppireAxisImpl *a, gint posn, gint size) } +void +psppire_axis_impl_resize (PsppireAxisImpl *a, gint posn, gint size) +{ + resize (PSPPIRE_AXIS (a), posn, size); +} + + + void psppire_axis_impl_clear (PsppireAxisImpl *a) diff --git a/lib/gtksheet/psppire-axis.c b/lib/gtksheet/psppire-axis.c index ef95ec99..8a4eb568 100644 --- a/lib/gtksheet/psppire-axis.c +++ b/lib/gtksheet/psppire-axis.c @@ -253,3 +253,18 @@ psppire_axis_unit_at_pixel (const PsppireAxis *a, glong pixel) return PSPPIRE_AXIS_GET_IFACE (a)->unit_at_pixel (a, pixel); } + + +/* Set UNIT to size SIZE */ +void +psppire_axis_resize (PsppireAxis *a, gint unit, glong size) +{ + g_return_if_fail (PSPPIRE_IS_AXIS (a)); + + g_return_if_fail (PSPPIRE_AXIS_GET_IFACE (a)); + + if (PSPPIRE_AXIS_GET_IFACE (a)->resize) + PSPPIRE_AXIS_GET_IFACE (a)->resize (a, unit, size); +} + + diff --git a/lib/gtksheet/psppire-axis.h b/lib/gtksheet/psppire-axis.h index 7a8e1cc0..3836ecf0 100644 --- a/lib/gtksheet/psppire-axis.h +++ b/lib/gtksheet/psppire-axis.h @@ -79,7 +79,10 @@ struct _PsppireAxisIface gint (*unit_at_pixel) (const PsppireAxis *a, glong pixel); - glong (*total_size ) (const PsppireAxis *a); + glong (*total_size) (const PsppireAxis *a); + + + void (*resize) (PsppireAxis *a, gint unit, glong pixels); }; @@ -94,6 +97,8 @@ glong psppire_axis_start_pixel (const PsppireAxis *a, gint unit); gint psppire_axis_unit_at_pixel (const PsppireAxis *a, glong pixel); +void psppire_axis_resize (PsppireAxis *a, gint unit, glong size); + G_END_DECLS #endif /* PSPPIRE_AXIS_H__ */