diff options
-rw-r--r-- | widgets/table/e-table-header-item.c | 2 | ||||
-rw-r--r-- | widgets/table/e-table-item.c | 139 | ||||
-rw-r--r-- | widgets/table/e-table-item.h | 56 | ||||
-rw-r--r-- | widgets/table/e-table-selection-model.c | 180 | ||||
-rw-r--r-- | widgets/table/e-table-selection-model.h | 47 | ||||
-rw-r--r-- | widgets/table/e-table-specification.c | 3 | ||||
-rw-r--r-- | widgets/table/e-table-specification.h | 1 | ||||
-rw-r--r-- | widgets/table/e-table.c | 18 |
8 files changed, 341 insertions, 105 deletions
diff --git a/widgets/table/e-table-header-item.c b/widgets/table/e-table-header-item.c index e1fb7f4b02..66dd882b3b 100644 --- a/widgets/table/e-table-header-item.c +++ b/widgets/table/e-table-header-item.c @@ -1288,7 +1288,7 @@ ethi_header_context_menu (ETableHeaderItem *ethi, GdkEventButton *event) info->ethi = ethi; info->col = ethi_find_col_by_x (ethi, event->x); col = e_table_header_get_column (ethi->eth, info->col); - e_popup_menu_run (ethi_context_menu, event, + e_popup_menu_run (ethi_context_menu, (GdkEvent *) event, 1 + (col->sortable ? 0 : 2) + (ethi->table ? 0 : 4), 0, info); diff --git a/widgets/table/e-table-item.c b/widgets/table/e-table-item.c index 3d6764c4f2..756a5d785b 100644 --- a/widgets/table/e-table-item.c +++ b/widgets/table/e-table-item.c @@ -726,6 +726,17 @@ eti_table_model_row_deleted (ETableModel *table_model, int row, ETableItem *eti) gnome_canvas_item_request_update (GNOME_CANVAS_ITEM (eti)); } +/** + * e_table_item_redraw_range + * @eti: %ETableItem which will be redrawn + * @start_col: The first col to redraw. + * @start_row: The first row to redraw. + * @end_col: The last col to redraw. + * @end_row: The last row to redraw. + * + * This routine redraws the given %ETableItem in the range given. The + * range is inclusive at both ends. + */ void e_table_item_redraw_range (ETableItem *eti, int start_col, int start_row, @@ -1166,7 +1177,7 @@ eti_draw (GnomeCanvasItem *item, GdkDrawable *drawable, int x, int y, int width, int f_x1, f_x2, f_y1, f_y2; gboolean f_found; double i2c [6]; - ArtPoint eti_base, eti_base_item; + ArtPoint eti_base, eti_base_item, lower_right; GtkWidget *canvas = GTK_WIDGET(item->canvas); GdkColor *background; @@ -1187,6 +1198,10 @@ eti_draw (GnomeCanvasItem *item, GdkDrawable *drawable, int x, int y, int width, eti_base_item.y = eti->y1; art_affine_point (&eti_base, &eti_base_item, i2c); + eti_base_item.x = eti->x1 + eti->width; + eti_base_item.y = eti->y1 + eti->height; + art_affine_point (&lower_right, &eti_base_item, i2c); + /* * First column to draw, last column to draw */ @@ -1327,12 +1342,27 @@ eti_draw (GnomeCanvasItem *item, GdkDrawable *drawable, int x, int y, int width, e_cell_draw (ecell_view, drawable, ecol->col_idx, col, row, flags, xd, yd, xd + ecol->width, yd + height); - if (view_to_model_col(eti, col) == cursor_col && view_to_model_row(eti, row) == cursor_row){ - f_x1 = xd; - f_x2 = xd + ecol->width; - f_y1 = yd; - f_y2 = yd + height; - f_found = TRUE; + if (!f_found) { + switch (eti->cursor_mode) { + case E_TABLE_CURSOR_LINE: + if (view_to_model_row(eti, row) == cursor_row) { + f_x1 = floor (eti_base.x) - x; + f_x2 = floor (lower_right.x) - x; + f_y1 = yd; + f_y2 = yd + height; + f_found = TRUE; + } + break; + case E_TABLE_CURSOR_SIMPLE: + if (view_to_model_col(eti, col) == cursor_col && view_to_model_row(eti, row) == cursor_row) { + f_x1 = xd; + f_x2 = xd + ecol->width; + f_y1 = yd; + f_y2 = yd + height; + f_found = TRUE; + } + break; + } } xd += ecol->width; @@ -1367,7 +1397,7 @@ eti_draw (GnomeCanvasItem *item, GdkDrawable *drawable, int x, int y, int width, /* * Draw focus */ - if (f_found && eti->draw_focus){ + if (eti->draw_focus && f_found) { gdk_gc_set_ts_origin (eti->focus_gc, f_x1, f_y1); gdk_draw_rectangle (drawable, eti->focus_gc, FALSE, f_x1, f_y1, f_x2 - f_x1 - 1, f_y2 - f_y1 - 1); @@ -1470,6 +1500,7 @@ eti_cursor_move_right (ETableItem *eti) eti_cursor_move (eti, model_to_view_row(eti, cursor_row), model_to_view_col(eti, cursor_col) + 1); } +#if 0 static void eti_cursor_move_up (ETableItem *eti) { @@ -1493,7 +1524,9 @@ eti_cursor_move_down (ETableItem *eti) eti_cursor_move (eti, model_to_view_row(eti, cursor_row) + 1, model_to_view_col(eti, cursor_col)); } +#endif +#if 0 static int _do_tooltip (ETableItem *eti) { @@ -1528,6 +1561,7 @@ _do_tooltip (ETableItem *eti) eti->tooltip); return FALSE; } +#endif static gint eti_e_cell_event (ETableItem *item, ECellView *ecell_view, GdkEvent *event, int time, int model_col, int view_col, int row, ECellFlags flags) @@ -1731,11 +1765,13 @@ eti_event (GnomeCanvasItem *item, GdkEvent *e) if (eti->tooltip->timer > 0) gtk_timeout_remove (eti->tooltip->timer); +#if 0 eti->tooltip->col = col; eti->tooltip->row = row; eti->tooltip->cx = e->motion.x; eti->tooltip->cy = e->motion.y; eti->tooltip->timer = gtk_timeout_add (100, (GSourceFunc)_do_tooltip, eti); +#endif if (cursor_row == view_to_model_row(eti, row) && cursor_col == view_to_model_col(eti, col)){ ecell_view = eti->cell_views [col]; @@ -1775,7 +1811,7 @@ eti_event (GnomeCanvasItem *item, GdkEvent *e) break; } - if (cursor_col != view_to_model_col(eti, 0)) + if (eti->cursor_mode != E_TABLE_CURSOR_LINE && cursor_col != view_to_model_col(eti, 0)) eti_cursor_move_left (eti); break; @@ -1785,11 +1821,16 @@ eti_event (GnomeCanvasItem *item, GdkEvent *e) break; } - if (cursor_col != view_to_model_col(eti, eti->cols - 1)) + if (eti->cursor_mode != E_TABLE_CURSOR_LINE && cursor_col != view_to_model_col(eti, eti->cols - 1)) eti_cursor_move_right (eti); break; case GDK_Up: + case GDK_Down: + return_val = e_table_selection_model_key_press(eti->selection, (GdkEventKey *) e); + break; +#if 0 + case GDK_Up: if (cursor_row != view_to_model_row(eti, 0)) eti_cursor_move_up (eti); else @@ -1802,7 +1843,7 @@ eti_event (GnomeCanvasItem *item, GdkEvent *e) else return_val = FALSE; break; - +#endif case GDK_Tab: case GDK_KP_Tab: case GDK_ISO_Left_Tab: @@ -1851,9 +1892,11 @@ eti_event (GnomeCanvasItem *item, GdkEvent *e) eti->editing_col, eti->editing_row, E_CELL_EDITING); #endif } - return_val = FALSE; - gtk_signal_emit (GTK_OBJECT (eti), eti_signals [KEY_PRESS], - model_to_view_row(eti, cursor_row), cursor_col, e, &return_val); + return_val = e_table_selection_model_key_press(eti->selection, (GdkEventKey *) e); + if (!return_val) { + gtk_signal_emit (GTK_OBJECT (eti), eti_signals [KEY_PRESS], + model_to_view_row(eti, cursor_row), cursor_col, e, &return_val); + } break; default: @@ -1872,11 +1915,15 @@ eti_event (GnomeCanvasItem *item, GdkEvent *e) if (!eti_editing (eti)){ gtk_signal_emit (GTK_OBJECT (eti), eti_signals [KEY_PRESS], model_to_view_row(eti, cursor_row), cursor_col, e, &return_val); + if (!return_val) + e_table_selection_model_key_press(eti->selection, (GdkEventKey *) e); } else { ecell_view = eti->cell_views [eti->editing_col]; return_val = eti_e_cell_event (eti, ecell_view, e, e->key.time, view_to_model_col(eti, eti->editing_col), eti->editing_col, eti->editing_row, E_CELL_EDITING); + if (!return_val) + e_table_selection_model_key_press(eti->selection, (GdkEventKey *) e); } } break; @@ -2031,6 +2078,14 @@ e_table_item_get_type (void) return type; } +/** + * e_table_item_set_cursor: + * @eti: %ETableItem which will have the cursor set. + * @col: Column to select. -1 means the last column. + * @row: Row to select. -1 means the last row. + * + * This routine sets the cursor of the %ETableItem canvas item. + */ void e_table_item_set_cursor (ETableItem *eti, int col, int row) { @@ -2058,6 +2113,14 @@ e_table_item_focus (ETableItem *eti, int col, int row, GdkModifierType state) } } +/** + * e_table_item_get_focused_column: + * @eti: %ETableItem which will have the cursor retrieved. + * + * This routine gets the cursor of the %ETableItem canvas item. + * + * Returns: The current cursor column. + */ gint e_table_item_get_focused_column (ETableItem *eti) { @@ -2073,15 +2136,6 @@ e_table_item_get_focused_column (ETableItem *eti) return cursor_col; } -gboolean -e_table_item_is_row_selected (ETableItem *eti, int row) -{ - g_return_val_if_fail (eti != NULL, FALSE); - g_return_val_if_fail (E_IS_TABLE_ITEM (eti), FALSE); - - return e_table_selection_model_is_row_selected(eti->selection, row); -} - static void eti_cursor_change (ETableSelectionModel *selection, int row, int col, ETableItem *eti) { @@ -2110,6 +2164,16 @@ eti_selection_change (ETableSelectionModel *selection, ETableItem *eti) gnome_canvas_item_request_update(GNOME_CANVAS_ITEM(eti)); } + +/** + * e_table_item_enter_edit + * @eti: %ETableItem which will start being edited + * @col: The view col to edit. + * @row: The view row to edit. + * + * This routine starts the given %ETableItem editing at the given view + * column and row. + */ void e_table_item_enter_edit (ETableItem *eti, int col, int row) { @@ -2125,6 +2189,12 @@ e_table_item_enter_edit (ETableItem *eti, int col, int row) eti->edit_ctx = e_cell_enter_edit (eti->cell_views [col], view_to_model_col(eti, col), col, row); } +/** + * e_table_item_leave_edit + * @eti: %ETableItem which will stop being edited + * + * This routine stops the given %ETableItem from editing. + */ void e_table_item_leave_edit (ETableItem *eti) { @@ -2150,6 +2220,20 @@ e_table_item_leave_edit (ETableItem *eti) col, row, edit_ctx); } +/** + * e_table_item_enter_edit + * @eti: %ETableItem to look in. + * @x: A pointer to the x location to find in the %ETableItem. + * @y: A pointer to the y location to find in the %ETableItem. + * @row: A pointer to the location to store the found row in. + * @col: A pointer to the location to store the found col in. + * + * This routine locates the pixel location (*x, *y) in the + * %ETableItem. If that location is in the %ETableItem, *row and *col + * are set to the view row and column where it was found. If that + * location is not in the %ETableItem, the height of the %ETableItem + * is removed from the value y points to. + */ void e_table_item_compute_location (ETableItem *eti, int *x, @@ -2448,6 +2532,15 @@ e_table_item_printable_destroy (GtkObject *object, g_free(itemcontext); } +/** + * e_table_item_get_printable + * @eti: %ETableItem which will be printed + * + * This routine creates and returns an %EPrintable that can be used to + * print the given %ETableItem. + * + * Returns: The %EPrintable. + */ EPrintable * e_table_item_get_printable (ETableItem *item) { diff --git a/widgets/table/e-table-item.h b/widgets/table/e-table-item.h index eaf52882e6..be53f0657f 100644 --- a/widgets/table/e-table-item.h +++ b/widgets/table/e-table-item.h @@ -104,43 +104,35 @@ typedef struct { gint (*click) (ETableItem *eti, int row, int col, GdkEvent *event); gint (*key_press) (ETableItem *eti, int row, int col, GdkEvent *event); } ETableItemClass; - -GtkType e_table_item_get_type (void); +GtkType e_table_item_get_type (void); /* * Focus */ -void e_table_item_set_cursor (ETableItem *eti, int col, int row); - -gint e_table_item_get_focused_column (ETableItem *eti); - -/* - * Handling the selection - */ -gboolean e_table_item_is_row_selected (ETableItem *e_table_Item, - int row); - -void e_table_item_selected_row_foreach (ETableItem *eti, - ETableForeachFunc func, - gpointer closure); - -void e_table_item_leave_edit (ETableItem *eti); -void e_table_item_enter_edit (ETableItem *eti, int col, int row); - -void e_table_item_redraw_range (ETableItem *eti, - int start_col, int start_row, - int end_col, int end_row); - -EPrintable *e_table_item_get_printable (ETableItem *eti); -void e_table_item_print_height (ETableItem *eti, - GnomePrintContext *context, - gdouble width); -void e_table_item_compute_location (ETableItem *eti, - int *x, - int *y, - int *row, - int *col); +void e_table_item_set_cursor (ETableItem *eti, + int col, + int row); + +gint e_table_item_get_focused_column (ETableItem *eti); + +void e_table_item_leave_edit (ETableItem *eti); +void e_table_item_enter_edit (ETableItem *eti, + int col, + int row); + +void e_table_item_redraw_range (ETableItem *eti, + int start_col, + int start_row, + int end_col, + int end_row); + +EPrintable *e_table_item_get_printable (ETableItem *eti); +void e_table_item_compute_location (ETableItem *eti, + int *x, + int *y, + int *row, + int *col); #endif /* _E_TABLE_ITEM_H_ */ diff --git a/widgets/table/e-table-selection-model.c b/widgets/table/e-table-selection-model.c index 7424a152bc..7c39648f55 100644 --- a/widgets/table/e-table-selection-model.c +++ b/widgets/table/e-table-selection-model.c @@ -3,14 +3,15 @@ * e-table-selection-model.c: a Table Selection Model * * Author: - * Miguel de Icaza (miguel@gnu.org) + * Christopher James Lahey <clahey@ximian.com> * - * (C) 1999 Ximian, Inc. + * (C) 2000, 2001 Ximian, Inc. */ #include <config.h> #include <gtk/gtksignal.h> #include "e-table-selection-model.h" #include "gal/util/e-util.h" +#include <gdk/gdkkeysyms.h> #define ETSM_CLASS(e) ((ETableSelectionModelClass *)((GtkObject *)e)->klass) @@ -306,12 +307,28 @@ e_table_selection_model_class_init (ETableSelectionModelClass *klass) E_MAKE_TYPE(e_table_selection_model, "ETableSelectionModel", ETableSelectionModel, e_table_selection_model_class_init, e_table_selection_model_init, PARENT_TYPE); +/** + * e_table_selection_model_new + * + * This routine creates a new #ETableSelectionModel. + * + * Returns: The new #ETableSelectionModel. + */ ETableSelectionModel * e_table_selection_model_new (void) { return gtk_type_new (e_table_selection_model_get_type ()); } +/** + * e_table_selection_model_is_row_selected + * @selection: #ETableSelectionModel to check + * @n: The row to check + * + * This routine calculates whether the given row is selected. + * + * Returns: %TRUE if the given row is selected + */ gboolean e_table_selection_model_is_row_selected (ETableSelectionModel *selection, gint n) @@ -322,6 +339,15 @@ e_table_selection_model_is_row_selected (ETableSelectionModel *selection, return (selection->selection[BOX(n)] >> OFFSET(n)) & 0x1; } +/** + * e_table_selection_model_foreach + * @selection: #ETableSelectionModel to traverse + * @callback: The callback function to call back. + * @closure: The closure + * + * This routine calls the given callback function once for each + * selected row, passing closure as the closure. + */ void e_table_selection_model_foreach (ETableSelectionModel *selection, ETableForeachFunc callback, @@ -399,6 +425,8 @@ etsm_select_single_row (ETableSelectionModel *selection, int row) break; } } + + selection->selection_start_row = row; } static void @@ -408,6 +436,7 @@ etsm_toggle_single_row (ETableSelectionModel *selection, int row) selection->selection[BOX(row)] &= ~BITMASK(row); else selection->selection[BOX(row)] |= BITMASK(row); + selection->selection_start_row = row; gtk_signal_emit(GTK_OBJECT(selection), e_table_selection_model_signals [SELECTION_CHANGED]); } @@ -434,7 +463,7 @@ etsm_move_selection_end (ETableSelectionModel *selection, int row) new_start = MIN (selection->selection_start_row, row); new_end = MAX (selection->selection_start_row, row) + 1; } - /* This wouldn't work nearly so smoothly if one end of the selection weren'theld in place. */ + /* This wouldn't work nearly so smoothly if one end of the selection weren't held in place. */ if (old_start < new_start) change_selection(selection, old_start, new_start, FALSE); if (new_start < old_start) @@ -447,6 +476,24 @@ etsm_move_selection_end (ETableSelectionModel *selection, int row) e_table_selection_model_signals [SELECTION_CHANGED]); } +static void +etsm_set_selection_end (ETableSelectionModel *selection, int row) +{ + etsm_select_single_row(selection, selection->selection_start_row); + selection->cursor_row = selection->selection_start_row; + etsm_move_selection_end(selection, row); +} + +/** + * e_table_selection_model_do_something + * @selection: #ETableSelectionModel to do something to. + * @row: The row to do something in. + * @col: The col to do something in. + * @state: The state in which to do something. + * + * This routine does whatever is appropriate as if the user clicked + * the mouse in the given row and column. + */ void e_table_selection_model_do_something (ETableSelectionModel *selection, guint row, @@ -466,20 +513,18 @@ e_table_selection_model_do_something (ETableSelectionModel *selection, switch (selection->mode) { case GTK_SELECTION_SINGLE: etsm_select_single_row (selection, row); - selection->selection_start_row = row; break; case GTK_SELECTION_BROWSE: case GTK_SELECTION_MULTIPLE: case GTK_SELECTION_EXTENDED: if (shift_p) { - etsm_move_selection_end (selection, row); + etsm_set_selection_end (selection, row); } else { if (ctrl_p) { etsm_toggle_single_row (selection, row); } else { etsm_select_single_row (selection, row); } - selection->selection_start_row = row; } break; } @@ -493,10 +538,24 @@ e_table_selection_model_do_something (ETableSelectionModel *selection, } } -void e_table_selection_model_maybe_do_something (ETableSelectionModel *selection, - guint row, - guint col, - GdkModifierType state) +/** + * e_table_selection_model_maybe_do_something + * @selection: #ETableSelectionModel to do something to. + * @row: The row to do something in. + * @col: The col to do something in. + * @state: The state in which to do something. + * + * If this row is selected, this routine just moves the cursor row and + * column. Otherwise, it does the same thing as + * e_table_selection_model_do_something(). This is for being used on + * right clicks and other events where if the user hit the selection, + * they don't want it to change. + */ +void +e_table_selection_model_maybe_do_something (ETableSelectionModel *selection, + guint row, + guint col, + GdkModifierType state) { if (e_table_selection_model_is_row_selected(selection, row)) { selection->cursor_row = row; @@ -506,6 +565,85 @@ void e_table_selection_model_maybe_do_something (ETableSelectio } } +static gint +move_selection (ETableSelectionModel *selection, + gboolean up, + GdkModifierType state) +{ + int row = selection->cursor_row; + int col = selection->cursor_col; + + gint shift_p = state & GDK_SHIFT_MASK; + gint ctrl_p = state & GDK_CONTROL_MASK; + + row = e_table_sorter_model_to_sorted(selection->sorter, row); + if (up) + row--; + else + row++; + if (row < 0 || row > selection->row_count) + return FALSE; + row = e_table_sorter_sorted_to_model(selection->sorter, row); + + switch (selection->mode) { + case GTK_SELECTION_BROWSE: + if (shift_p) { + etsm_set_selection_end (selection, row); + } else if (!ctrl_p) { + etsm_select_single_row (selection, row); + } + break; + case GTK_SELECTION_SINGLE: + case GTK_SELECTION_MULTIPLE: + case GTK_SELECTION_EXTENDED: + etsm_select_single_row (selection, row); + break; + } + if (row != -1) { + selection->cursor_row = row; + gtk_signal_emit(GTK_OBJECT(selection), + e_table_selection_model_signals[CURSOR_CHANGED], row, col); + } + return TRUE; +} + +/** + * e_table_selection_model_key_press + * @selection: #ETableSelectionModel to affect. + * @key: The event. + * + * This routine does whatever is appropriate as if the user pressed + * the given key. + * + * Returns: %TRUE if the #ETableSelectionModel used the key. + */ +gint +e_table_selection_model_key_press (ETableSelectionModel *selection, + GdkEventKey *key) +{ + switch (key->keyval) { + case GDK_Up: + return move_selection(selection, TRUE, key->state); + break; + case GDK_Down: + return move_selection(selection, FALSE, key->state); + break; + case GDK_space: + if (selection->mode != GTK_SELECTION_SINGLE) { + etsm_toggle_single_row (selection, selection->cursor_row); + return TRUE; + } + break; + } + return FALSE; +} + +/** + * e_table_selection_model_clear + * @selection: #ETableSelectionModel to clear + * + * This routine clears the selection to no rows selected. + */ void e_table_selection_model_clear(ETableSelectionModel *selection) { @@ -523,6 +661,14 @@ e_table_selection_model_clear(ETableSelectionModel *selection) #define PART(x,n) (((x) & (0x01010101 << n)) >> n) #define SECTION(x, n) (((x) >> (n * 8)) & 0xff) +/** + * e_table_selection_model_selected_count + * @selection: #ETableSelectionModel to count + * + * This routine calculates the number of rows selected. + * + * Returns: The number of rows selected in the given model. + */ gint e_table_selection_model_selected_count (ETableSelectionModel *selection) { @@ -549,6 +695,13 @@ e_table_selection_model_selected_count (ETableSelectionModel *selection) return count; } +/** + * e_table_selection_model_select_all + * @selection: #ETableSelectionModel to select all + * + * This routine selects all the rows in the given + * #ETableSelectionModel. + */ void e_table_selection_model_select_all (ETableSelectionModel *selection) { @@ -590,6 +743,13 @@ e_table_selection_model_select_all (ETableSelectionModel *selection) e_table_selection_model_signals [SELECTION_CHANGED]); } +/** + * e_table_selection_model_invert_selection + * @selection: #ETableSelectionModel to invert + * + * This routine inverts all the rows in the given + * #ETableSelectionModel. + */ void e_table_selection_model_invert_selection (ETableSelectionModel *selection) { diff --git a/widgets/table/e-table-selection-model.h b/widgets/table/e-table-selection-model.h index 0178ecd64b..f1d1d0cf45 100644 --- a/widgets/table/e-table-selection-model.h +++ b/widgets/table/e-table-selection-model.h @@ -48,28 +48,29 @@ typedef struct { } ETableSelectionModelClass; -GtkType e_table_selection_model_get_type (void); - -gboolean e_table_selection_model_is_row_selected (ETableSelectionModel *selection, - gint n); -void e_table_selection_model_foreach (ETableSelectionModel *selection, - ETableForeachFunc callback, - gpointer closure); - -void e_table_selection_model_do_something (ETableSelectionModel *selection, - guint row, - guint col, - GdkModifierType state); -void e_table_selection_model_maybe_do_something (ETableSelectionModel *selection, - guint row, - guint col, - GdkModifierType state); -void e_table_selection_model_clear (ETableSelectionModel *selection); -gint e_table_selection_model_selected_count (ETableSelectionModel *selection); - -void e_table_selection_model_select_all (ETableSelectionModel *selection); -void e_table_selection_model_invert_selection (ETableSelectionModel *selection); - -ETableSelectionModel *e_table_selection_model_new (void); +GtkType e_table_selection_model_get_type (void); +gboolean e_table_selection_model_is_row_selected (ETableSelectionModel *selection, + gint n); +void e_table_selection_model_foreach (ETableSelectionModel *selection, + ETableForeachFunc callback, + gpointer closure); + +void e_table_selection_model_do_something (ETableSelectionModel *selection, + guint row, + guint col, + GdkModifierType state); +void e_table_selection_model_maybe_do_something (ETableSelectionModel *selection, + guint row, + guint col, + GdkModifierType state); +gint e_table_selection_model_key_press (ETableSelectionModel *selection, + GdkEventKey *key); +void e_table_selection_model_clear (ETableSelectionModel *selection); +gint e_table_selection_model_selected_count (ETableSelectionModel *selection); + +void e_table_selection_model_select_all (ETableSelectionModel *selection); +void e_table_selection_model_invert_selection (ETableSelectionModel *selection); + +ETableSelectionModel *e_table_selection_model_new (void); #endif /* _E_TABLE_SELECTION_MODEL_H_ */ diff --git a/widgets/table/e-table-specification.c b/widgets/table/e-table-specification.c index 7f78fac681..33523129b8 100644 --- a/widgets/table/e-table-specification.c +++ b/widgets/table/e-table-specification.c @@ -62,6 +62,7 @@ etsp_init (ETableSpecification *etsp) etsp->no_headers = FALSE; etsp->click_to_add = FALSE; etsp->draw_grid = FALSE; + etsp->draw_focus = TRUE; etsp->cursor_mode = E_TABLE_CURSOR_SIMPLE; etsp->selection_mode = GTK_SELECTION_MULTIPLE; @@ -158,6 +159,7 @@ e_table_specification_load_from_node (ETableSpecification *specification, specification->no_headers = e_xml_get_bool_prop_by_name (node, "no-headers"); specification->click_to_add = e_xml_get_bool_prop_by_name (node, "click-to-add"); specification->draw_grid = e_xml_get_bool_prop_by_name (node, "draw-grid"); + specification->draw_focus = e_xml_get_bool_prop_by_name_with_default (node, "draw-focus", TRUE); specification->selection_mode = GTK_SELECTION_MULTIPLE; temp = e_xml_get_string_prop_by_name (node, "selection-mode"); @@ -293,6 +295,7 @@ e_table_specification_save_to_node (ETableSpecification *specification, e_xml_set_bool_prop_by_name (node, "no-headers", specification->no_headers); e_xml_set_bool_prop_by_name (node, "click-to-add", specification->click_to_add); e_xml_set_bool_prop_by_name (node, "draw-grid", specification->draw_grid); + e_xml_set_bool_prop_by_name (node, "draw-focus", specification->draw_focus); switch (specification->selection_mode){ case GTK_SELECTION_SINGLE: diff --git a/widgets/table/e-table-specification.h b/widgets/table/e-table-specification.h index 3434c51088..10f3b1c785 100644 --- a/widgets/table/e-table-specification.h +++ b/widgets/table/e-table-specification.h @@ -23,6 +23,7 @@ typedef struct { guint no_headers : 1; guint click_to_add : 1; guint draw_grid : 1; + guint draw_focus : 1; GtkSelectionMode selection_mode; ETableCursorMode cursor_mode; diff --git a/widgets/table/e-table.c b/widgets/table/e-table.c index 892a764a70..ba9b65a42c 100644 --- a/widgets/table/e-table.c +++ b/widgets/table/e-table.c @@ -64,7 +64,6 @@ enum { enum { ARG_0, - ARG_TABLE_DRAW_FOCUS, ARG_LENGTH_THRESHOLD, }; @@ -944,6 +943,7 @@ et_real_construct (ETable *e_table, ETableModel *etm, ETableExtras *ete, e_table->use_click_to_add = specification->click_to_add; e_table->click_to_add_message = g_strdup (gettext (specification->click_to_add_message)); e_table->draw_grid = specification->draw_grid; + e_table->draw_focus = specification->draw_focus; e_table->cursor_mode = specification->cursor_mode; e_table->full_header = et_spec_to_full_header(e_table, specification, ete); @@ -1344,11 +1344,8 @@ e_table_get_printable (ETable *e_table) static void et_get_arg (GtkObject *o, GtkArg *arg, guint arg_id) { - ETable *etable = E_TABLE (o); - switch (arg_id){ - case ARG_TABLE_DRAW_FOCUS: - GTK_VALUE_BOOL (*arg) = etable->draw_focus; + default: break; } } @@ -1373,14 +1370,6 @@ et_set_arg (GtkObject *o, GtkArg *arg, guint arg_id) } break; - case ARG_TABLE_DRAW_FOCUS: - etable->draw_focus = GTK_VALUE_BOOL (*arg); - if (etable->group) { - gnome_canvas_item_set (GNOME_CANVAS_ITEM(etable->group), - "drawfocus", GTK_VALUE_BOOL (*arg), - NULL); - } - break; } } @@ -2189,11 +2178,8 @@ e_table_class_init (GtkObjectClass *object_class) gtk_marshal_NONE__POINTER_POINTER, GTK_TYPE_NONE, 2, GTK_TYPE_ADJUSTMENT, GTK_TYPE_ADJUSTMENT); - gtk_object_add_arg_type ("ETable::drawfocus", GTK_TYPE_BOOL, - GTK_ARG_READWRITE, ARG_TABLE_DRAW_FOCUS); gtk_object_add_arg_type ("ETable::length_threshold", GTK_TYPE_INT, GTK_ARG_WRITABLE, ARG_LENGTH_THRESHOLD); } E_MAKE_TYPE(e_table, "ETable", ETable, e_table_class_init, e_table_init, PARENT_TYPE); - |