fixed off-by-one bug
[swftools.git] / lib / gfxwindow.h
blobba88639a2874c5112dd643e3c355d457b5d631a9
1 /* gfxwindow.h
3 Simple GUI abstraction.
5 Part of the swftools package.
7 Copyright (c) 2005 Matthias Kramm <kramm@quiss.org>
9 This program is free software; you can redistribute it and/or modify
10 it under the terms of the GNU General Public License as published by
11 the Free Software Foundation; either version 2 of the License, or
12 (at your option) any later version.
14 This program is distributed in the hope that it will be useful,
15 but WITHOUT ANY WARRANTY; without even the implied warranty of
16 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 GNU General Public License for more details.
19 You should have received a copy of the GNU General Public License
20 along with this program; if not, write to the Free Software
21 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
23 #ifndef __gfxwindow_h__
24 #define __gfxwindow_h__
26 #ifdef __cplusplus
27 extern "C" {
28 #endif
30 #define GFXEVENT_NOTHING 0
32 #define GFXEVENT_KEY 4
33 #define GFXEVENT_KEYPRESS 4
34 #define GFXEVENT_KEYRELEASE 5
36 #define GFXEVENT_MOUSEPRESS 8
37 #define GFXEVENT_MOUSERELEASE 9
38 #define GFXEVENT_MOUSEMOVE 10
39 #define GFXEVENT_MOUSEENTER 11
40 #define GFXEVENT_MOUSELEAVE 12
42 #define GFXEVENT_DESTROY 16
44 typedef struct _gfxevent
46 void * internal;
47 int type;
48 int key; //if type == KEY
49 int x,y; //if type == MOUSEMOVED
50 int button; //if type = MOUSEPRESSED/RELEASED
51 } gfxevent_t;
53 typedef struct _gfxwindow
55 void * internal;
56 unsigned char* currentscr;
57 unsigned char* lastscr;
58 int width;
59 int height;
60 void (*flippage)(struct _gfxwindow*win);
61 void (*move)(struct _gfxwindow*win,int x, int y);
62 void (*resize)(struct _gfxwindow*win,int width, int height);
63 gfxevent_t (*getEvent)(struct _gfxwindow*win);
64 void (*destroy)(struct _gfxwindow*win);
65 } gfxwindow_t;
67 gfxwindow_t* gfxwindow_new(int width, int height);
69 #ifdef __cplusplus
71 #endif
73 #endif