From 5a2e01a7af2f63f01ce96c6f82fd66bdbb7f9cea Mon Sep 17 00:00:00 2001 From: Christopher James Lahey Date: Wed, 28 Feb 2001 03:32:47 +0000 Subject: Added e-sorter.lo and e-selection-model.lo. 2001-02-27 Christopher James Lahey * gal/Makefile.am: Added e-sorter.lo and e-selection-model.lo. * gal/util/Makefile.am: Added e-sorter.c and e-sorter.h. * gal/util/e-sorter.c, gal/util/e-sorter.h: New class. This is a new simple virtual class for use with ESelectionModel. It implements the same set of methods as ETableSorter but the default behavior is as if the sorting was a no-op. * gal/widgets/Makefile.am: Added e-selection-model.c and e-selection-model.h. * gal/widgets/e-selection-model.c, gal/widgets/e-selection-model.h: New class. Implements all of the semantics of ETableSelectionModel except for the connection to the ETableModel. svn path=/trunk/; revision=8421 --- widgets/misc/e-selection-model.h | 100 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 100 insertions(+) create mode 100644 widgets/misc/e-selection-model.h (limited to 'widgets/misc/e-selection-model.h') diff --git a/widgets/misc/e-selection-model.h b/widgets/misc/e-selection-model.h new file mode 100644 index 0000000000..564a3e6e50 --- /dev/null +++ b/widgets/misc/e-selection-model.h @@ -0,0 +1,100 @@ +/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ +#ifndef _E_SELECTION_MODEL_H_ +#define _E_SELECTION_MODEL_H_ + +#include +#include +#include + +#ifdef __cplusplus +extern "C" { +#endif /* __cplusplus */ + +#define E_SELECTION_MODEL_TYPE (e_selection_model_get_type ()) +#define E_SELECTION_MODEL(o) (GTK_CHECK_CAST ((o), E_SELECTION_MODEL_TYPE, ESelectionModel)) +#define E_SELECTION_MODEL_CLASS(k) (GTK_CHECK_CLASS_CAST((k), E_SELECTION_MODEL_TYPE, ESelectionModelClass)) +#define E_IS_SELECTION_MODEL(o) (GTK_CHECK_TYPE ((o), E_SELECTION_MODEL_TYPE)) +#define E_IS_SELECTION_MODEL_CLASS(k) (GTK_CHECK_CLASS_TYPE ((k), E_SELECTION_MODEL_TYPE)) + +typedef void (*EForeachFunc) (int model_row, + gpointer closure); + +/* list selection modes */ +typedef enum { + E_CURSOR_LINE, + E_CURSOR_SIMPLE, + E_CURSOR_SPREADSHEET, +} ECursorMode; + +typedef struct { + GtkObject base; + + ESorter *sorter; + + gint row_count; + guint32 *selection; + + gint cursor_row; + gint cursor_col; + gint selection_start_row; + + guint model_changed_id; + guint model_row_inserted_id, model_row_deleted_id; + + guint frozen : 1; + guint selection_model_changed : 1; + guint group_info_changed : 1; + + GtkSelectionMode mode; + ECursorMode cursor_mode; +} ESelectionModel; + +typedef struct { + GtkObjectClass parent_class; + + gint (*get_row_count) (ESelectionModel *selection); + + /* + * Signals + */ + + void (*cursor_changed) (ESelectionModel *selection, int row, int col); + void (*cursor_activated) (ESelectionModel *selection, int row, int col); + void (*selection_changed) (ESelectionModel *selection); + +} ESelectionModelClass; + +GtkType e_selection_model_get_type (void); +gboolean e_selection_model_is_row_selected (ESelectionModel *selection, + gint n); +void e_selection_model_foreach (ESelectionModel *selection, + EForeachFunc callback, + gpointer closure); +void e_selection_model_do_something (ESelectionModel *selection, + guint row, + guint col, + GdkModifierType state); +void e_selection_model_maybe_do_something (ESelectionModel *selection, + guint row, + guint col, + GdkModifierType state); +gint e_selection_model_key_press (ESelectionModel *selection, + GdkEventKey *key); +void e_selection_model_clear (ESelectionModel *selection); +gint e_selection_model_selected_count (ESelectionModel *selection); +void e_selection_model_select_all (ESelectionModel *selection); +void e_selection_model_invert_selection (ESelectionModel *selection); +void e_selection_model_insert_row (ESelectionModel *esm, + int row); +void e_selection_model_delete_row (ESelectionModel *esm, + int row); + +/* Virtual Function */ +gint e_selection_model_get_row_count (ESelectionModel *esm); + +#ifdef __cplusplus +} +#endif /* __cplusplus */ + + +#endif /* _E_SELECTION_MODEL_H_ */ -- cgit