source: trunk/third/xmh/menu.c @ 9658

Revision 9658, 2.4 KB checked in by ghudson, 28 years ago (diff)
This commit was generated by cvs2svn to compensate for changes in r9657, which included commits to RCS files with non-trunk default branches.
RevLine 
[9657]1/*
2 * $XConsortium: menu.c,v 1.5 89/12/14 21:10:50 converse Exp $
3 *
4 * Copyright 1989 Massachusetts Institute of Technology
5 *
6 * Permission to use, copy, modify, distribute, and sell this software and its
7 * documentation for any purpose is hereby granted without fee, provided that
8 * the above copyright notice appear in all copies and that both that
9 * copyright notice and this permission notice appear in supporting
10 * documentation, and that the name of M.I.T. not be used in advertising or
11 * publicity pertaining to distribution of the software without specific,
12 * written prior permission.  M.I.T. makes no representations about the
13 * suitability of this software for any purpose.  It is provided "as is"
14 * without express or implied warranty.
15 *
16 * M.I.T. DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL
17 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL M.I.T.
18 * BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
19 * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION
20 * OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN
21 * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
22 *
23 */
24
25#include "xmh.h"
26#include "bboxint.h"
27
28
29void AttachMenuToButton(button, menu, menu_name)
30    Button      button;
31    Widget      menu;
32    char *      menu_name;
33{
34    Arg         args[3];
35
36    if (button == NULL) return;
37    button->menu = menu;
38    XtSetArg(args[0], XtNmenuName, XtNewString(menu_name));
39    XtSetValues(button->widget, args, (Cardinal) 1);
40}
41
42
43/*ARGSUSED*/
44void DoRememberMenuSelection(widget, client_data, call_data)
45    Widget      widget;         /* menu entry object */
46    XtPointer   client_data;
47    XtPointer   call_data;
48{
49    static Arg  args[] = {
50        { XtNpopupOnEntry,      (XtArgVal) NULL },
51    };
52    args[0].value = (XtArgVal) widget;
53    XtSetValues(XtParent(widget), args, XtNumber(args));
54}
55
56
57void SendMenuEntryEnableMsg(button, entry_name, value)
58    Button      button;
59    char *      entry_name;
60    int         value;
61{
62    Widget      entry;
63    static Arg  args[] = { XtNsensitive, (XtArgVal) NULL };
64
65    if ((entry = XtNameToWidget(button->menu, entry_name)) != NULL) {
66        args[0].value = (XtArgVal) ((value == 0) ? False : True);
67        XtSetValues(entry, args, (Cardinal) 1);
68    }
69}
70
71
72void ToggleMenuItem(entry, state)
73    Widget      entry;
74    Boolean     state;
75{
76    Arg         args[1];
77
78    XtSetArg(args[0], XtNleftBitmap, (state ? MenuItemBitmap : None));
79    XtSetValues(entry, args, (Cardinal) 1);
80}
Note: See TracBrowser for help on using the repository browser.