|
|
1.1 root 1: /*
2: * $Source: /u1/X11/clients/xterm/RCS/menu.h,v $
3: * $Header: menu.h,v 1.7 87/09/11 08:17:17 toddb Exp $
4: */
5:
6:
7: #include <X11/copyright.h>
8:
9: /*
10: * Copyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts.
11: *
12: * All Rights Reserved
13: *
14: * Permission to use, copy, modify, and distribute this software and its
15: * documentation for any purpose and without fee is hereby granted,
16: * provided that the above copyright notice appear in all copies and that
17: * both that copyright notice and this permission notice appear in
18: * supporting documentation, and that the name of Digital Equipment
19: * Corporation not be used in advertising or publicity pertaining to
20: * distribution of the software without specific, written prior permission.
21: *
22: *
23: * DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
24: * ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
25: * DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
26: * ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
27: * WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
28: * ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
29: * SOFTWARE.
30: */
31:
32: /* @(#)menu.h X10/6.6 11/3/86 */
33: /*
34: * Menu items are constructed as follows, starting from the left side:
35: *
36: * menuItemPad
37: * space for check mark
38: * menuItemPad
39: * text + padding
40: * menuItemPad
41: *
42: * The padding for the text is that amount that this text is narrower than the
43: * widest text.
44: */
45:
46: typedef struct _menuItem {
47: int itemHeight; /* total height of this item */
48: int itemFlags; /* flags of item */
49:
50: #define itemDisabled 0x0001 /* item is disabled */
51: #define itemChecked 0x0002 /* item has check mark */
52: #define itemStateMask 0x0003 /* mask for current state */
53: #define itemSetDisabled 0x0004 /* item wants to be disabled */
54: #define itemSetChecked 0x0008 /* item wants check mark */
55: #define itemSetMask 0x000c /* mask for desired state */
56: #define itemSetMaskShift 2 /* for comparison with actual */
57: #define itemChanged 0x0010 /* item desires change */
58:
59: char *itemText; /* text of item */
60: int itemTextWidth; /* width of text */
61: int itemTextLength; /* length of text */
62: struct _menuItem *nextItem; /* next item in chain */
63: } MenuItem;
64:
65: typedef struct _menu {
66: int menuWidth; /* full width of menu */
67: int menuHeight; /* full height of menu */
68: int menuFlags; /* flags of this menu */
69:
70: # define menuChanged 0x0001 /* menu changed, must redraw */
71: # define menuItemChanged 0x0002 /* item changed, must redraw */
72: # define menuMapped 0x0004 /* menu is now mapped */
73: # define menuFreeze 0x0008 /* freeze when doing menu */
74: # define menuSaveMenu 0x0010 /* save copy of menu */
75:
76: int menuMaxTextWidth; /* width of widest text */
77: int menuInitialItem; /* < 0 none, >= 0 initial item */
78: int menuBorderWidth; /* width of border */
79: int menuBgColor; /* background color */
80: int menuFgColor; /* foreground color */
81: XFontStruct *menuFontInfo; /* font info for menu font */
82: int menuItemPad; /* pad amount */
83: Window menuWindow; /* window of menu */
84: Cursor menuCursor; /* cursor used in menu */
85: Pixmap menuSaved; /* copy of menu */
86: Pixmap menuSavedImage; /* copy of image under menu */
87: int menuSavedImageX; /* X coordinate of the saved image */
88: int menuSavedImageY; /* Y coordinate of the saved image */
89: MenuItem *menuItems; /* head of menu item chain */
90: char *menuTitle; /* title of menu */
91: int menuTitleWidth; /* width of title */
92: int menuTitleLength; /* length of title */
93: int menuItemTop; /* position of top of first item */
94: } Menu;
95:
96: #define checkMarkWidth 9
97: #define checkMarkHeight 8
98: #define defaultCursorWidth 16
99: #define defaultCursorHeight 16
100: #define defaultCursorX 1
101: #define defaultCursorY 1
102: #define grayHeight 16
103: #define grayWidth 16
104: #define lineSeparatorHeight 9
105:
106: #define CheckItem(menu,item) SetItemCheck(menu,item,1)
107: #define DisableItem(menu,item) SetItemDisable(menu,item,1)
108: #define EnableItem(menu,item) SetItemDisable(menu,item,0)
109: #define UncheckItem(menu,item) SetItemCheck(menu,item,0)
110:
111: extern Menu *NewMenu();
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.