Compilation: fix warning.
[gnumeric.git] / src / sheet-view.h
blobf659f0377f4de02be76cba0ed41b5fd12ccb19d0
1 /* vim: set sw=8: -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
2 #ifndef _GNM_SHEET_VIEW_H_
3 # define _GNM_SHEET_VIEW_H_
5 #include "gnumeric.h"
6 #include <glib-object.h>
8 G_BEGIN_DECLS
10 typedef enum {
11 GNM_SHEET_VIEW_NORMAL_MODE,
12 GNM_SHEET_VIEW_PAGE_BREAK_MODE,
13 GNM_SHEET_VIEW_LAYOUT_MODE
14 } GnmSheetViewMode;
16 struct _SheetView {
17 GObject base;
19 Sheet *sheet;
20 WorkbookView *sv_wbv;
21 GPtrArray *controls;
23 GList *ants; /* animated cursors */
25 /* an ordered list of Ranges, the first of which corresponds to the
26 * a normalized version of SheetView::{cursor.base_corner:move_corner}
28 GSList *selections;
29 GSList *selections_simplified;
30 int selection_mode; /* GnmSelectionMode */
32 GnmCellPos edit_pos; /* Cell that would be edited */
33 GnmCellPos edit_pos_real; /* Even in the middle of a merged cell */
34 int first_tab_col; /* where to jump to after an Enter */
36 struct {
37 /* Static corner to rubber band the selection range around */
38 GnmCellPos base_corner;
39 /* Corner that is moved when the selection range is extended */
40 GnmCellPos move_corner;
41 } cursor;
43 GnmCellPos initial_top_left;
44 GnmCellPos frozen_top_left;
45 GnmCellPos unfrozen_top_left;
47 /* state flags */
48 unsigned char enable_insert_rows;
49 unsigned char enable_insert_cols;
50 unsigned char enable_insert_cells;
51 unsigned char reposition_selection;
53 GnmSheetViewMode view_mode;
55 /* TODO : these should be replaced with Dependents when we support
56 * format based dependents
58 unsigned char selection_content_changed;
59 struct {
60 unsigned char location;
61 unsigned char content; /* entered content NOT value */
62 unsigned char style;
63 } edit_pos_changed;
64 guint auto_expr_timer;
67 typedef GObjectClass SheetViewClass;
69 #define GNM_SV_TYPE (sheet_view_get_type ())
70 #define GNM_SV(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GNM_SV_TYPE, SheetView))
71 #define GNM_IS_SV(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), GNM_SV_TYPE))
72 #define GNM_SV_CLASS(k) (G_TYPE_CHECK_CLASS_CAST ((k), GNM_SV_TYPE, SheetViewClass))
74 /* Lifecycle */
75 GType sheet_view_get_type (void);
76 SheetView *sheet_view_new (Sheet *sheet, WorkbookView *wbv);
77 void sv_attach_control (SheetView *sv, SheetControl *sc);
78 void sv_detach_control (SheetControl *sc);
79 void sv_weak_ref (SheetView *sv, SheetView **ptr);
80 void sv_weak_unref (SheetView **ptr);
81 void sv_update (SheetView *sv);
82 void sv_dispose (SheetView *sv);
84 /* Information */
85 Sheet *sv_sheet (SheetView const *sv);
86 WorkbookView *sv_wbv (SheetView const *sv);
87 gboolean sv_is_frozen (SheetView const *sv);
89 GnmFilter *sv_editpos_in_filter (SheetView const *sv);
90 GnmFilter *sv_selection_intersects_filter_rows (SheetView const *sv);
91 GnmRange *sv_selection_extends_filter (SheetView const *sv,
92 GnmFilter const *f);
93 GnmSheetSlicer *sv_editpos_in_slicer (SheetView const *sv);
95 /* Manipulation */
96 void sv_flag_status_update_pos (SheetView *sv, GnmCellPos const *pos);
97 void sv_flag_status_update_range (SheetView *sv, GnmRange const *range);
98 void sv_flag_style_update_range (SheetView *sv, GnmRange const *range);
99 void sv_flag_selection_change (SheetView *sv);
101 void sv_unant (SheetView *sv);
102 void sv_ant (SheetView *sv, GList *ranges);
103 gboolean sv_selection_copy (SheetView *sv, WorkbookControl *wbc);
104 gboolean sv_selection_cut (SheetView *sv, WorkbookControl *wbc);
106 void sv_make_cell_visible (SheetView *sv, int col, int row,
107 gboolean couple_panes);
108 void sv_redraw_range (SheetView *sv, GnmRange const *r);
109 void sv_redraw_headers (SheetView const *sheet,
110 gboolean col, gboolean row,
111 GnmRange const* r /* optional == NULL */);
112 void sv_cursor_set (SheetView *sv,
113 GnmCellPos const *edit,
114 int base_col, int base_row,
115 int move_col, int move_row,
116 GnmRange const *bound);
117 void sv_set_edit_pos (SheetView *sv, GnmCellPos const *pos);
119 void sv_freeze_panes (SheetView *sv,
120 GnmCellPos const *frozen_top_left,
121 GnmCellPos const *unfrozen_top_left);
122 void sv_panes_insdel_colrow (SheetView *sv, gboolean is_cols,
123 gboolean is_insert, int start, int count);
124 void sv_set_initial_top_left(SheetView *sv, int col, int row);
126 #define SHEET_VIEW_FOREACH_CONTROL(sv, control, code) \
127 do { \
128 int j; \
129 GPtrArray *controls = (sv)->controls; \
130 if (controls != NULL) /* Reverse is important during destruction */ \
131 for (j = controls->len; j-- > 0 ;) { \
132 SheetControl *control = \
133 g_ptr_array_index (controls, j); \
134 code \
136 } while (0)
138 G_END_DECLS
140 #endif /* _GNM_SHEET_VIEW_H_ */