File: menu.h

package info (click to toggle)
xmhtml 1.1.7-7
  • links: PTS
  • area: main
  • in suites: woody
  • size: 6,104 kB
  • ctags: 8,347
  • sloc: ansic: 68,063; makefile: 496; sh: 161; perl: 36
file content (119 lines) | stat: -rw-r--r-- 3,649 bytes parent folder | download | duplicates (10)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
/*****
* menu.h : menu protos, structures & defines
*
* This file Version	$Revision$
*
* Creation date:		Sun Nov  9 16:21:52 GMT+0100 1997
* Last modification: 	$Date$
* By:					$Author$
* Current State:		$State$
*
* Author:				newt
*
* Copyright (C) 1994-1997 by Ripley Software Development 
* All Rights Reserved
*
* This file is part of the XmHTML Widget Library
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU [Library] General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
* Library General Public License for more details.
*
* You should have received a copy of the GNU [Library] General Public
* License along with this library; if not, write to the Free
* Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*
*****/
/*****
* $Source$
*****/
/*****
* ChangeLog 
* $Log$
*****/ 

#ifndef _menu_h_
#define _menu_h_

/*****
* Definition of the menu items.
* The id field in this structure is stored as XmNuserData for the created
* menu item. Setting it to -1 will make MenuBuild ignore it.
*****/ 
typedef struct _MenuItem{
	char *name;						/* menu item name		*/
	WidgetClass *class;				/* menu item class		*/
	KeySym mnemonic;				/* menu item mnemonic	*/
	Bool sensitive; 				/* initial menu state	*/
	XtPointer id;					/* menu button id		*/
	XtCallbackProc callback;		/* menu callback		*/
	XtPointer client_data; 			/* menu callback data	*/
	struct _MenuItem *subitems;		/* pullright menu items	*/
}MenuItem; 

/* build an entire menu, including the menubar entry */
extern Widget MenuBuild(Widget parent, int type, String title, 
	KeySym mnemonic, MenuItem *items);

/* build an entire ``floating'' menu (no menubar entry) */
extern Widget MenuBuildShared(Widget parent, int type, String title,
	MenuItem *items);

/* create a menubar entry and add the ``floating'' menu to it */
extern Widget MenuAddShared(Widget parent, int type, String title,
	KeySym mnemonic, Widget items);

/*****
* common menu convenience routines
*****/

/* return the children of the given menu */
extern void MenuGetChildren(Widget menu, WidgetList *children,
	int *num_children);

/* locate a menu button by it's id */
extern Widget MenuFindButtonById(Widget menu, int id);

/* locate a menu button by it's name */
extern Widget MenuFindButtonByName(WidgetList wlist, String name);

/* return the id of a menu button (value of XmNuserData resource) */
extern int MenuButtonGetId(Widget button);

/* make a menu with toggleButtons act as a radiobox */
extern void MenuIsToggleMenu(Widget menu);

/*****
* Option Menu specific routines
*****/

/* select the given OptionMenu menu item */
extern void MenuOptionSelectItem(Widget menu, int id);

/* set the state of a Toggle menu item in an OptionMenu */
extern void MenuOptionSetSensitivity(Widget menu, int id, int state);

/* return the selected item in an OptionMenu */
extern int MenuOptionGetSelected(Widget menu);

/*****
* Toggle Menu specific routines
*****/

/* return the selection state of a Toggle menu item */
extern Boolean MenuToggleSelected(Widget toggle);

/* get the state of a Toggle menu item */
extern Boolean MenuToggleGetState(Widget menu, int id);

/* set the state of a Toggle menu item */
extern void MenuToggleSetState(Widget menu, int id, Boolean state);

/* Don't add anything after this endif! */
#endif /* _menu_h_ */