sheet.h 1.77 KB
Newer Older
Arturo Espinosa's avatar
Arturo Espinosa committed
1 2
#ifndef SHEET_H
#define SHEET_H
3 4 5 6 7 8

typedef GList ColStyleList;

struct Workbook;

typedef struct {
Arturo Espinosa's avatar
Arturo Espinosa committed
9 10 11 12 13 14 15 16 17
	GtkWidget  *toplevel;
	GtkWidget  *notebook;
	
	Style      style;
	GHashTable *sheets;	/* keeps a list of the Sheets on this workbook */
} Workbook;

typedef struct {
	Workbook   *parent_workbook;
18
	GtkWidget  *toplevel, *col_canvas, *row_canvas;
Arturo Espinosa's avatar
Arturo Espinosa committed
19
	GtkWidget  *sheet_view;
20 21 22
	GnomeCanvasItem *col_item, *row_item;
	
	double     last_zoom_factor_used;
23 24 25
	char       *name;
		   
	Style      style;
26 27

	ColInfo    default_col_style;
28
	GList      *cols_info;
29 30

	RowInfo    default_row_style;
31 32 33 34
	GList      *rows_info;
	void       *contents;
} Sheet;

35 36 37
typedef  void (*sheet_col_callback)(Sheet *sheet, ColInfo *ci, void *user_data);
typedef  void (*sheet_row_callback)(Sheet *sheet, RowInfo *ci, void *user_data);

Arturo Espinosa's avatar
Arturo Espinosa committed
38
Sheet    *sheet_new                (Workbook *wb, char *name);
39 40
ColInfo  *sheet_get_col_info       (Sheet *, int col);
RowInfo  *sheet_get_row_info       (Sheet *, int row);
41 42
int       sheet_col_get_distance   (Sheet *sheet, int from_col, int to_col);
int       sheet_row_get_distance   (Sheet *sheet, int from_row, int to_row);
43 44 45 46
void      sheet_foreach_col        (Sheet *sheet, sheet_col_callback, void *user_data);
void      sheet_foreach_row        (Sheet *sheet, sheet_row_callback, void *user_data);
void      sheet_set_zoom_factor    (Sheet *sheet, double factor);
void      sheet_get_cell_bounds    (Sheet *sheet, ColType col, RowType row, int *x, int *y, int *w, int *h);
Arturo Espinosa's avatar
Arturo Espinosa committed
47 48 49 50 51

Workbook *workbook_new             (void);
Workbook *workbook_new_with_sheets (int sheet_count);
void      workbook_attach_sheet    (Workbook *, Sheet *);

52 53 54 55 56 57
/*
 * Callback routine: invoked when the first view ItemGrid
 * is realized to allocate the default styles
 */
void     workbook_realized         (Workbook *, GdkWindow *);

58
#endif