X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=src%2Fui%2Fgui%2Fpsppire-data-sheet.c;h=59268d21f431a3e569e8f7f3a4ddff654ebad02e;hb=37cd3133c06caf3fce7e449a939098f62bd41a55;hp=ca22471c8897d059730ab4b6aa6e5bc8ccede32d;hpb=193090d0821d84eee24d5d340c91bc069bb55827;p=pspp diff --git a/src/ui/gui/psppire-data-sheet.c b/src/ui/gui/psppire-data-sheet.c index ca22471c88..59268d21f4 100644 --- a/src/ui/gui/psppire-data-sheet.c +++ b/src/ui/gui/psppire-data-sheet.c @@ -26,6 +26,7 @@ #include "ui/gui/executor.h" #include "psppire-data-window.h" +#include "ssw-axis-model.h" static void do_sort (PsppireDataSheet *sheet, GtkSortType order) @@ -102,16 +103,9 @@ change_data_value (PsppireDataSheet *sheet, gint col, gint row, GValue *value) value_destroy_from_variant (&v, vrnt); } -static gchar * -data_store_value_to_string (SswSheet *data_sheet, PsppireDataStore *store, gint col, gint row, const GValue *v) -{ - return psppire_data_store_value_to_string (store, col, row, v); -} - gboolean myreversefunc (GtkTreeModel *model, gint col, gint row, const gchar *in, GValue *out); - static void @@ -355,13 +349,41 @@ psppire_data_sheet_new (void) { GObject *obj = g_object_new (PSPPIRE_TYPE_DATA_SHEET, - "forward-conversion", data_store_value_to_string, + "forward-conversion", psppire_data_store_value_to_string, "reverse-conversion", myreversefunc, NULL); return GTK_WIDGET (obj); } + +static gboolean +indicate_filtered_case (GtkWidget *widget, cairo_t *cr, PsppireDataStore *store) +{ + guint row = g_object_get_data (widget, "row"); + + if (!psppire_data_store_filtered (store, row)) + return FALSE; + + /* Draw a diagonal line through the widget */ + guint width = gtk_widget_get_allocated_width (widget); + guint height = gtk_widget_get_allocated_height (widget); + + GtkStyleContext *sc = gtk_widget_get_style_context (widget); + gtk_render_line (sc, cr, 0, 0, width, height); + + return FALSE; +} + +static void +button_post_create (GtkWidget *button, uint i, gpointer user_data) +{ + PsppireDataStore *data_store = PSPPIRE_DATA_STORE (user_data); + + g_object_set_data (button, "row", GUINT_TO_POINTER (i)); + g_signal_connect_after (button, "draw", indicate_filtered_case, data_store); +} + static void set_dictionary (PsppireDataSheet *sheet) { @@ -370,6 +392,16 @@ set_dictionary (PsppireDataSheet *sheet) PsppireDataStore *store = PSPPIRE_DATA_STORE (data_model); g_object_set (sheet, "hmodel", store->dict, NULL); + + + SswAxisModel *vmodel = NULL; + g_object_get (sheet, "vmodel", &vmodel, NULL); + g_assert (SSW_IS_AXIS_MODEL (vmodel)); + + g_object_set (vmodel, + "post-button-create-func", button_post_create, + "post-button-create-func-data", store, + NULL); } static void