item-grid.h 1.57 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

Arturo Espinosa's avatar
Arturo Espinosa committed
33 34 35
	GdkGC      *grid_gc;	/* Draw grid gc */
	GdkGC      *fill_gc;	/* Default background fill gc */
	GdkGC      *gc;		/* Color used for the cell */
36
	
Arturo Espinosa's avatar
Arturo Espinosa committed
37 38 39
	GdkColor   background;
	GdkColor   grid_color;
	GdkColor   default_color;
Arturo Espinosa's avatar
Arturo Espinosa committed
40

Arturo Espinosa's avatar
Arturo Espinosa committed
41
	int        visual_is_paletted;
42 43 44 45 46

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

GtkType item_grid_get_type (void);
50 51
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);
52
void    item_grid_popup_menu (Sheet *sheet, GdkEvent *event, int col, int row);
53 54 55 56 57

typedef struct {
	GnomeCanvasItemClass parent_class;
} ItemGridClass;

58
#endif /* GNUMERIC_ITEM_GRID_H */