/[james]/archive/guilib/menu_riscos.c
ViewVC logotype

Annotation of /archive/guilib/menu_riscos.c

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-csrc
File size: 1517 byte(s)
Initial import.

1 james 16 /*
2     * menu_riscos.c -- menu creation, RISC OS
3     */
4    
5     #include "gui.h"
6    
7     wimp_menu *gui_menu(unsigned int base, unsigned int items)
8     {
9     char *text;
10     unsigned int line, i;
11     wimp_menu *menu;
12    
13     menu = malloc(wimp_SIZEOF_MENU(items));
14     if (menu == NULL) gui_raise_error("out of memory");
15    
16     menu->title_data.indirected_text.text = gui_message[base];
17     menu->title_fg = wimp_COLOUR_BLACK;
18     menu->title_bg = wimp_COLOUR_VERY_LIGHT_GREY;
19     menu->work_fg = wimp_COLOUR_RED;
20     menu->work_bg = wimp_COLOUR_WHITE;
21     menu->width = 300;
22     menu->height = wimp_MENU_ITEM_HEIGHT;
23     menu->gap = wimp_MENU_ITEM_GAP;
24    
25     for (i = 0; i < items; i++)
26     {
27     text = gui_message[base + 1 + i];
28    
29     line = (text[0] == '-'); if (line) text++;
30     menu->entries[i].menu_flags = (i == 0 ? wimp_MENU_TITLE_INDIRECTED : 0) |
31     (i == items-1 ? wimp_MENU_LAST : 0) |
32     (line ? wimp_MENU_SEPARATE : 0);
33     menu->entries[i].sub_menu = wimp_NO_SUB_MENU;
34     menu->entries[i].icon_flags = wimp_ICON_TEXT | wimp_ICON_VCENTRED | wimp_ICON_INDIRECTED |
35     wimp_COLOUR_BLACK << wimp_ICON_FG_COLOUR_SHIFT |
36     wimp_COLOUR_WHITE << wimp_ICON_BG_COLOUR_SHIFT;
37     menu->entries[i].data.indirected_text.text = text;
38     menu->entries[i].data.indirected_text.validation = (char *) "";
39     }
40    
41     return menu;
42     }
43    
44     void gui_menu_attach(wimp_menu *menu, unsigned int item, wimp_menu *submenu)
45     {
46     menu->entries[item].sub_menu = submenu;
47     }

  ViewVC Help
Powered by ViewVC 1.1.26