Initial revision
[ssr] / StraySrc / Libraries / Steel / h / xtearoff
1 /*
2 * Tearoff menu system
3 * Internal header file
4 *
5 * © 1994-1998 Straylight
6 */
7
8 /*----- Licensing note ----------------------------------------------------*
9 *
10 * This file is part of Straylight's Steel library.
11 *
12 * Steel is free software; you can redistribute it and/or modify
13 * it under the terms of the GNU General Public License as published by
14 * the Free Software Foundation; either version 2, or (at your option)
15 * any later version.
16 *
17 * Steel is distributed in the hope that it will be useful,
18 * but WITHOUT ANY WARRANTY; without even the implied warranty of
19 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
20 * GNU General Public License for more details.
21 *
22 * You should have received a copy of the GNU General Public License
23 * along with Steel. If not, write to the Free Software Foundation,
24 * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
25 */
26
27 #ifndef __xtearoff_h
28 #define __xtearoff_h
29
30 #include "tearoff.h"
31
32 #define tearoff__HEIGHT 24 /* Height of tearoff bar */
33
34 typedef struct tearoff__str
35 {
36 char *menuTitle; /* Title of menu */
37 int numberOfItems; /* Number of items in menu */
38 int width; /* Width of menu */
39 int keyWidth; /* Max width of shortcut */
40 int dotted; /* Height of dotted lines */
41 int selected; /* Currently selected item */
42 int maxHeight; /* Maximum height before scrollbar */
43 int fromItem; /* I came from this item */
44 tearoff_selectProc selectProc; /* Called with related event */
45 void *userHandle; /* User supplied handle */
46 wimp_w w; /* The `menu's window handle */
47 struct tearoff__str *sub; /* The submenu pointer thingy */
48 struct tearoff__str *prev; /* The previous menu */
49 struct tearoff__str *nextTornoff; /* The next tornoff menu in list */
50 char *indirected; /* Pointer to indirected space */
51 int indbytes; /* Length of indirected area */
52 BOOL open; /* Is menu open? */
53 BOOL tearoff :8; /* Can menu be torn off? */
54 BOOL tornoff :8; /* Has it been? */
55 BOOL warned :8; /* Hs usr bn wrnd about submenu? */
56 BOOL folded :8; /* Is menu folded */
57 BOOL redraw; /* Does it need redrawing? */
58 BOOL scrollBar; /* Menu has scroll bar */
59 /* Now followed by lots of items */
60 } tearoff__str;
61
62 typedef struct tearoff__item
63 {
64 char *text; /* Item text */
65 char *keys; /* Short cut text */
66 tearoff sub; /* Sub menu to open */
67 int y; /* y coord of item */
68 BOOL shaded :1; /* Item is shaded */
69 BOOL subShaded :1; /* Arrow is shaded */
70 BOOL selType :2; /* Item is ticked */
71 BOOL dotted :1; /* Dotted line next */
72 BOOL blank :1; /* Word Align */
73 BOOL subMenu :1; /* Item has submenu */
74 BOOL subMenuWarning :1; /* Report a submenu warning */
75 } tearoff__item;
76
77 typedef struct tearoff__alarm
78 {
79 tearoff t; /* The tearoff alarm was set on */
80 int item; /* The item is was set for */
81 }
82 tearoff__alarm;
83
84 void tearoff__doRedraw(tearoff t, wimp_redrawstr *r);
85 void tearoff_calculateMenuWidth(tearoff t);
86 void tearoff_rebuildMenu(tearoff t);
87 void tearoff_highlightItem(int s, tearoff t, BOOL select);
88
89 #ifdef notdef
90 os_error *tearoff_opened(wimp_t task);
91 os_error *tearoff_closed(void);
92 os_error *tearoff_closeMenus(void);
93 #endif
94
95 #endif