gnumeric-canvas.h 3.38 KB
Newer Older
1 2
#ifndef GNUMERIC_GNUMERIC_SHEET_H
#define GNUMERIC_GNUMERIC_SHEET_H
3

Arturo Espinosa's avatar
Arturo Espinosa committed
4
#include "item-grid.h"
5
#include "item-cursor.h"
6
#include "item-bar.h"
7
#include "item-edit.h"
8
#include "sheet.h"
Arturo Espinosa's avatar
Arturo Espinosa committed
9

10 11
#define GNUMERIC_TYPE_SHEET     (gnumeric_sheet_get_type ())
#define GNUMERIC_SHEET(obj)     (GTK_CHECK_CAST((obj), GNUMERIC_TYPE_SHEET, GnumericSheet))
Arturo Espinosa's avatar
Arturo Espinosa committed
12
#define GNUMERIC_SHEET_CLASS(k) (GTK_CHECK_CLASS_CAST ((k), GNUMERIC_TYPE_SHEET))
13 14
#define GNUMERIC_IS_SHEET(o)    (GTK_CHECK_TYPE((o), GNUMERIC_TYPE_SHEET))

15 16 17 18 19 20 21 22
#define GNUMERIC_SHEET_PATTERNS 13
typedef struct {
	char *name;
	char pattern [8];
} gnumeric_sheet_pattern_t;

extern gnumeric_sheet_pattern_t gnumeric_sheet_patterns [GNUMERIC_SHEET_PATTERNS];

23
typedef struct {
24
	GnomeCanvas   canvas;
25

26 27
	GtkWidget     *entry;
	SheetView     *sheet_view;
28
	
29 30
	int           top_col, last_visible_col, last_full_col;
	int           top_row, last_visible_row, last_full_row;
31

32 33 34
	ItemGrid      *item_grid;
	ItemCursor    *item_cursor;
	ItemBar       *item_bar_col;
Arturo Espinosa's avatar
Arturo Espinosa committed
35

36
	ItemEdit      *item_editor;
37

38 39
	SheetModeType mode;
	
Miguel de Icaza's avatar
Miguel de Icaza committed
40 41
	/*
	 * This flag keeps track of a cell selector
42 43 44
	 * (ie, when the user uses the cursor keys
	 * to select a cell for an expression).
	 */
45 46 47 48
	int           selecting_cell;
	int           sel_cursor_pos;
	int           sel_text_len;
	ItemCursor    *selection;
Miguel de Icaza's avatar
Miguel de Icaza committed
49 50 51 52

	/*
	 * The column and row bars
	 */
53 54 55 56
	ItemBar       *colbar;
	ItemBar       *rowbar;

	GdkPixmap     *patterns [GNUMERIC_SHEET_PATTERNS];
57 58
} GnumericSheet;

59
GtkType    gnumeric_sheet_get_type               (void);
60

Arturo Espinosa's avatar
Today:  
Arturo Espinosa committed
61
GtkWidget *gnumeric_sheet_new            	 (SheetView *sheet, ItemBar *colbar, ItemBar *rowbar);
Arturo Espinosa's avatar
Arturo Espinosa committed
62
void       gnumeric_sheet_set_selection  	 (GnumericSheet *gsheet, SheetSelection *ss);
63 64
void       gnumeric_sheet_set_top_row            (GnumericSheet *gsheet, int new_top_row);
void       gnumeric_sheet_set_top_col            (GnumericSheet *gsheet, int new_top_col);
Arturo Espinosa's avatar
Arturo Espinosa committed
65
void       gnumeric_sheet_cursor_set     	 (GnumericSheet *gsheet,
66
					 	  int col, int row);
67 68
void       gnumeric_sheet_move_cursor            (GnumericSheet *gsheet,
						  int col, int row);
Miguel de Icaza's avatar
Miguel de Icaza committed
69
int        gnumeric_sheet_can_move_cursor        (GnumericSheet *gsheet);
Arturo Espinosa's avatar
Arturo Espinosa committed
70 71 72
void       gnumeric_sheet_set_cursor_bounds      (GnumericSheet *gsheet,
						  int start_col, int start_row,
						  int end_col,   int end_row);
73
void       gnumeric_sheet_compute_visible_ranges (GnumericSheet *gsheet);
Arturo Espinosa's avatar
Arturo Espinosa committed
74 75
void       gnumeric_sheet_make_cell_visible      (GnumericSheet *gsheet,
						  int col, int row);
Arturo Espinosa's avatar
Today:  
Arturo Espinosa committed
76 77 78 79 80 81
void       gnumeric_sheet_get_cell_bounds        (GnumericSheet *gsheet,
						  int col, int row,
						  int *x, int *y, int *w, int *h);
void       gnumeric_sheet_stop_cell_selection    (GnumericSheet *gsheet);
void       gnumeric_sheet_create_editing_cursor  (GnumericSheet *gsheet);
void       gnumeric_sheet_destroy_editing_cursor (GnumericSheet *gsheet);
82

Miguel de Icaza's avatar
Miguel de Icaza committed
83 84 85 86 87 88 89 90 91 92 93
/* Managing the selection of cell ranges when editing a formula */

void       gnumeric_sheet_start_cell_selection   (GnumericSheet *gsheet,
						  int col, int row);
void       gnumeric_sheet_stop_cell_selection    (GnumericSheet *gsheet);
void       gnumeric_sheet_selection_cursor_place (GnumericSheet *gsheet,
						  int col, int row);
void       gnumeric_sheet_selection_extend       (GnumericSheet *gsheet,
						  int col, int row);
void       gnumeric_sheet_stop_editing           (GnumericSheet *sheet);

94 95 96
typedef struct {
	GnomeCanvasClass parent_class;
} GnumericSheetClass;
Arturo Espinosa's avatar
Arturo Espinosa committed
97

98
#endif /* GNUMERIC_GNUMERIC_SHEET_H */