changed reading hint
[gromacs/adressmacs.git] / src / ngmx / popup.h
blob04c94aa61dfcdac3cbb4c2bbbcdb04235f594b6c
1 /*
2 * $Id$
3 *
4 * This source code is part of
5 *
6 * G R O M A C S
7 *
8 * GROningen MAchine for Chemical Simulations
9 *
10 * VERSION 2.0
12 * Copyright (c) 1991-1999
13 * BIOSON Research Institute, Dept. of Biophysical Chemistry
14 * University of Groningen, The Netherlands
16 * Please refer to:
17 * GROMACS: A message-passing parallel molecular dynamics implementation
18 * H.J.C. Berendsen, D. van der Spoel and R. van Drunen
19 * Comp. Phys. Comm. 91, 43-56 (1995)
21 * Also check out our WWW page:
22 * http://md.chem.rug.nl/~gmx
23 * or e-mail to:
24 * gromacs@chem.rug.nl
26 * And Hey:
27 * Great Red Oystrich Makes All Chemists Sane
30 #ifndef _popup_h
31 #define _popup_h
33 static char *SRCID_popup_h = "$Id$";
35 #ifdef HAVE_IDENT
36 #ident "@(#) popup.h 1.3 11/23/92"
37 #endif /* HAVE_IDENT */
38 #include "x11.h"
39 #include "xutil.h"
41 typedef struct {
42 Window send_to; /* Window to send messages to */
43 int nreturn; /* Value returned when entry is selected */
44 bool bChecked; /* Indicate whether menu item is check-marked */
45 char *str; /* Text for menu entry */
46 } t_mentry;
48 typedef struct {
49 t_windata wd; /* The window struct */
50 t_mentry *m; /* The menu entry */
51 Window Parent; /* Parent window id */
52 } t_child;
54 typedef struct {
55 t_windata wd; /* The window struct */
56 Window Parent; /* The parent of the menu */
57 int nitem; /* The number of menu items */
58 t_child *item; /* Array of child windows */
59 bool bGrabbed; /* Did this menu grab the pointer? */
60 } t_menu;
62 extern t_menu *init_menu(t_x11 *x11,Window Parent,unsigned long fg,unsigned long bg,
63 int nent,t_mentry ent[],int ncol);
64 /* This routine will create a popup menu. It will create a
65 * a base window, and child windows for all the items.
66 * If ncol != 0 then ncol columns of items will be created;
67 * otherwise the routine will try to evenly space the menu, eg. if there
68 * are 20 items then the menu will be 2x10 entries, depending on the
69 * string lengths.
70 * !!!
71 * !!! Do not destroy the ent structure while using this menu
72 * !!!
73 * The routine will create the windows but not map them. That is, this
74 * routine can be called once at the beginning of a program. When a menu
75 * has to be shown, call show_menu.
78 extern void show_menu(t_x11 *x11,t_menu *m,int x, int y,bool bGrab);
79 /* Show the menu in m at (x,y)
80 * This will popup the menu, and when a button is released in the
81 * menu send a ClientMessage to the Parent window of the menu
82 * specifying the selected menu item in xclient.data.l[0].
83 * bGrab specifies whether or not to grab the pointer.
86 extern void hide_menu(t_x11 *x11,t_menu *m);
87 /* Unmaps the window for m, hides the window */
89 extern void check_menu_item(t_menu *m,int nreturn,bool bStatus);
90 /* Set the bChecked field in the menu item with return code
91 * nreturn to bStatus. This function must always be called when
92 * the bChecked flag has to changed.
95 extern void done_menu(t_x11 *x11,t_menu *m);
96 /* This routine destroys the menu m, and unregisters it with x11 */
98 extern int menu_width(t_menu *m);
99 /* Return the width of the window */
101 extern int menu_height(t_menu *m);
102 /* Return the height of the window */
104 #endif /* _popup_h */