summaryrefslogtreecommitdiff
path: root/backingstore.h
blob: 32378854e1a5d83cdd8758d6f60614cdc387a2ee (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
#include <gtk/gtk.h>
#include <gdk/gdk.h>
#include <cairo.h>

typedef struct BackingStore BackingStore;
typedef struct BackingStoreEvent BackingStoreEvent;

typedef enum
{
    BACKING_STORE_NONE,
    BACKING_STORE_BUTTON_PRESS,
    BACKING_STORE_BUTTON_RELEASE,
    BACKING_STORE_ENTER,
    BACKING_STORE_LEAVE,
    BACKING_STORE_MOTION,
} BackingStoreEventType;

struct BackingStoreEvent
{
    BackingStoreEventType	type;
    int				x;
    int				y;
    int				button;
};

typedef void     (* BackingPaintFunc) (cairo_t   *cr,
				       GdkRegion *region,
				       gpointer   data);
typedef gboolean (* BackingStoreEventFunc) (BackingStore *store,
					    BackingStoreEvent *event,
					    gpointer          *data);

BackingStore *backing_store_new                   (GdkWindow       *window,
						   int              width,
						   int              height);
void	      backing_store_free                  (BackingStore    *store);
void          backing_store_draw                  (BackingStore    *store, 
						   GdkDrawable     *dest,
						   GdkRegion       *clip,
						   int              dest_x,
						   int              dest_y);

void	      backing_store_move_area		  (BackingStore    *store,
						   int		    x,
						   int              y,
						   int		    width,
						   int              height,
						   int              dx,
						   int              dy);
void          backing_store_scroll                (BackingStore    *store,
						   int              dx,
						   int              dy);
void          backing_store_invalidate_rect       (BackingStore    *store,
						   GdkRectangle    *rect);
void          backing_store_invalidate_region     (BackingStore    *store,
						   GdkRegion       *region);
void          backing_store_invalidate_all        (BackingStore    *store);
void          backing_store_resize                (BackingStore    *store,
						   int              width,
						   int              height);
void          backing_store_process_updates       (BackingStore    *store,
						   BackingPaintFunc func,
						   gpointer         data);

/* Input */
void	      backing_store_process_event         (BackingStore    *store,
						   GdkEvent        *event);
void	      backing_store_add_input             (BackingStore    *store,
						   cairo_t         *cr,
						   gboolean	    is_stroke,
						   BackingStoreEventFunc func,
						   gpointer         data);