/[james]/archive/guilib/gui_riscos.h
ViewVC logotype

Annotation of /archive/guilib/gui_riscos.h

Parent Directory Parent Directory | Revision Log Revision Log


Revision 16 - (hide annotations) (download) (as text)
Mon Feb 10 22:56:40 2003 UTC (21 years, 8 months ago) by james
File MIME type: text/x-chdr
File size: 3923 byte(s)
Initial import.

1 james 16 /*
2     * gui_riscos.h -- portable gui library, RISC OS header
3     */
4    
5     #include "oslib/colourtrans.h"
6     #include "oslib/help.h"
7     #include "oslib/messagetrans.h"
8     #include "oslib/osbyte.h"
9     #include "oslib/wimp.h"
10     #include "ufont.h"
11    
12     typedef unsigned int gui_window_id;
13     #define gui_WINDOW_UNKNOWN ((gui_window_id) 0xffffffff)
14     typedef unsigned int gui_gadget_id;
15     typedef wimp_menu *gui_menu_id;
16    
17     extern wimp_t gui_wimp_task; /* wimp task handle */
18     extern os_error *gui_error; /* last error block pointer */
19     extern const char *gui_error_message; /* last error message */
20     extern int gui_error_line; /* last error line */
21     extern jmp_buf gui_error_jump; /* longjmp buffer for error handling */
22    
23     struct gui_dialog_icon
24     {
25     enum { ICON_NONE, ICON_ACTION } type;
26     void (*click_fn)(gui_window_id window_id, gui_gadget_id gadget_id);
27     const char *help;
28     };
29    
30     struct gui_window_data
31     {
32     enum { UNUSED, WINDOW, DIALOG } used;
33     wimp_w handle;
34     char *title;
35     void (*close_fn)(gui_window_id window_id);
36     void (*redraw_fn)(gui_window_id window_id, unsigned int invalid[]);
37     void (*click_fn)(gui_window_id window_id, unsigned int x, unsigned int y, unsigned int z);
38     void (*resize_fn)(gui_window_id window_id, unsigned int width, unsigned int height);
39     bool (*key_fn)(gui_window_id window_id, unsigned int key);
40     void (*input_fn)(gui_window_id window_id, wchar_t key);
41     void (*menu_fn)(gui_window_id window_id, unsigned int items[]);
42     unsigned int width, height;
43     wimp_menu *menu;
44     wimp_w *bbar;
45     struct gui_dialog_icon *icon;
46     const char *help;
47     };
48     extern struct gui_window_data *gui_window_list; /* array of window details */
49     extern unsigned int gui_window_list_items; /* length of windows list */
50    
51     extern gui_window_id gui_get_free_window_id(void);
52     extern gui_window_id gui_handle_to_window_id(wimp_w handle);
53     extern signed int gui_window_origin_x, gui_window_origin_y;
54    
55     #define WINDOW_LIST_CHUNK 20
56    
57    
58     struct gui_ta_style
59     {
60     unsigned int xsize;
61     unsigned int ysize;
62     unsigned int fcolour;
63     unsigned int bcolour;
64     unsigned int space;
65     ufont_f handle;
66     char font[1];
67     };
68    
69     #define gui_SIZEOF_GUI_TA_STYLE(n) (offsetof(struct gui_ta_style, font) + (n) * sizeof(char))
70    
71    
72     #define KEY_BACKSPACE wimp_KEY_BACKSPACE
73     #define KEY_RETURN wimp_KEY_RETURN
74     #define KEY_ESCAPE wimp_KEY_ESCAPE
75     #define KEY_HOME wimp_KEY_HOME
76     #define KEY_DELETE wimp_KEY_DELETE
77     #define KEY_SHIFT wimp_KEY_SHIFT
78     #define KEY_CONTROL wimp_KEY_CONTROL
79     #define KEY_PRINT wimp_KEY_PRINT
80     #define KEY_F1 wimp_KEY_F1
81     #define KEY_F2 wimp_KEY_F2
82     #define KEY_F3 wimp_KEY_F3
83     #define KEY_F4 wimp_KEY_F4
84     #define KEY_F5 wimp_KEY_F5
85     #define KEY_F6 wimp_KEY_F6
86     #define KEY_F7 wimp_KEY_F7
87     #define KEY_F8 wimp_KEY_F8
88     #define KEY_F9 wimp_KEY_F9
89     #define KEY_TAB wimp_KEY_TAB
90     #define KEY_COPY wimp_KEY_COPY
91     #define KEY_LEFT wimp_KEY_LEFT
92     #define KEY_RIGHT wimp_KEY_RIGHT
93     #define KEY_LOGO wimp_KEY_LOGO
94     #define KEY_MENU wimp_KEY_MENU
95     #define KEY_F10 wimp_KEY_F10
96     #define KEY_F11 wimp_KEY_F11
97     #define KEY_F12 wimp_KEY_F12
98     #define KEY_INSERT wimp_KEY_INSERT
99     #define KEY_DOWN wimp_KEY_DOWN
100     #define KEY_UP wimp_KEY_UP
101     #define KEY_PAGE_DOWN wimp_KEY_PAGE_DOWN
102     #define KEY_PAGE_UP wimp_KEY_PAGE_UP
103    
104    
105    
106    
107     /*
108     * Error handling
109     */
110    
111     /*
112     * gui_check_error -- check for an error after a swi
113     */
114    
115     #define gui_check_error() if (gui_error) { gui_error_message = gui_error->errmess; gui_error_line = __LINE__; longjmp(gui_error_jump, 1); }
116    
117     /*
118     * gui_raise_error -- generate an error
119     */
120    
121     #define gui_raise_error(message) { gui_error_message = (message); gui_error_line = __LINE__; longjmp(gui_error_jump, 1); }
122    
123    
124     /*
125     * assert
126     */
127    
128     #ifdef DEBUG
129     #define assert(expression) ((void) ((expression) ? 0 : (printf("%s:%u: *** assert(" #expression ") failed ***\n", __FILE__, __LINE__), exit(EXIT_FAILURE), 0)))
130     #else
131     #define assert(expression) ((void) 0)
132     #endif

  ViewVC Help
Powered by ViewVC 1.1.26