item-grid.h 1.67 KB
Newer Older
1 2
#ifndef GNUMERIC_ITEM_GRID_H
#define GNUMERIC_ITEM_GRID_H
3

4 5 6
#include "sheet.h"
#include "sheet-view.h"

Arturo Espinosa's avatar
Arturo Espinosa committed
7
#define ITEM_GRID(obj)          (GTK_CHECK_CAST((obj), item_grid_get_type (), ItemGrid))
8
#define ITEM_GRID_CLASS(k)      (GTK_CHECK_CLASS_CAST ((k), item_grid_get_type (), ItemGridClass))
9 10
#define IS_ITEM_GRID(o)         (GTK_CHECK_TYPE((o), item_grid_get_type ()))

11 12 13 14 15 16
typedef enum {
	ITEM_GRID_NO_SELECTION,
	ITEM_GRID_SELECTING_CELL_RANGE,
	ITEM_GRID_SELECTING_FORMULA_RANGE
} ItemGridSelectionType;

17 18 19
typedef struct {
	GnomeCanvasItem canvas_item;

Arturo Espinosa's avatar
Arturo Espinosa committed
20 21
	SheetView *sheet_view;
	Sheet     *sheet;
22 23

	/* The first displayed column and row */
24 25
	int        left_col;
	int        top_row;
26

27
	ItemGridSelectionType selecting;
28
	
29
	/* Offset from spreadsheet origin in units */
Arturo Espinosa's avatar
Arturo Espinosa committed
30 31
	long       top_offset;
	long       left_offset;
32

33
	GdkGC      *border_gc[BORDER_MAX];
Arturo Espinosa's avatar
Arturo Espinosa committed
34 35 36
	GdkGC      *grid_gc;	/* Draw grid gc */
	GdkGC      *fill_gc;	/* Default background fill gc */
	GdkGC      *gc;		/* Color used for the cell */
37
	GdkGC      *empty_gc;	/* GC used for drawing empty cells */
38
	
Arturo Espinosa's avatar
Arturo Espinosa committed
39 40 41
	GdkColor   background;
	GdkColor   grid_color;
	GdkColor   default_color;
Arturo Espinosa's avatar
Arturo Espinosa committed
42

Arturo Espinosa's avatar
Arturo Espinosa committed
43
	int        visual_is_paletted;
44 45 46 47 48

	/* Sliding scroll */
	int        sliding;	/* a gtk_timeout tag, -1 means not set */
	int        sliding_col, sliding_row;
	int        sliding_x, sliding_y;
49 50 51
} ItemGrid;

GtkType item_grid_get_type (void);
52 53
int     item_grid_find_col (ItemGrid *item_grid, int x, int *col_origin);
int     item_grid_find_row (ItemGrid *item_grid, int y, int *row_origin);
54
void    item_grid_popup_menu (Sheet *sheet, GdkEvent *event, int col, int row);
55 56 57 58 59

typedef struct {
	GnomeCanvasItemClass parent_class;
} ItemGridClass;

60
#endif /* GNUMERIC_ITEM_GRID_H */