2 * This file is part of the GROMACS molecular simulation package.
4 * Copyright (c) 1991-2000, University of Groningen, The Netherlands.
5 * Copyright (c) 2001-2004, The GROMACS development team,
6 * check out http://www.gromacs.org for more information.
7 * Copyright (c) 2012, by the GROMACS development team, led by
8 * David van der Spoel, Berk Hess, Erik Lindahl, and including many
9 * others, as listed in the AUTHORS file in the top-level source
10 * directory and at http://www.gromacs.org.
12 * GROMACS is free software; you can redistribute it and/or
13 * modify it under the terms of the GNU Lesser General Public License
14 * as published by the Free Software Foundation; either version 2.1
15 * of the License, or (at your option) any later version.
17 * GROMACS 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 GNU
20 * Lesser General Public License for more details.
22 * You should have received a copy of the GNU Lesser General Public
23 * License along with GROMACS; if not, see
24 * http://www.gnu.org/licenses, or write to the Free Software Foundation,
25 * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
27 * If you want to redistribute modifications to GROMACS, please
28 * consider that scientific software is very special. Version
29 * control is crucial - bugs must be traceable. We will be happy to
30 * consider code for inclusion in the official distribution, but
31 * derived work must not be called official GROMACS. Details are found
32 * in the README & COPYING files - if they are missing, get the
33 * official version at http://www.gromacs.org.
35 * To help us fund GROMACS development, we humbly ask that you cite
36 * the research papers on the package. Check out http://www.gromacs.org.
44 #define DLG_SHOW (1<<0)
45 #define DLG_HIDE (1<<1)
46 #define DLG_SHOWANDHIDE (DLG_SHOW | DLG_HIDE)
47 #define DLG_SYSTEMMODAL (1<<2)
48 #define DLG_APPLMODAL (1<<3)
49 #define DLG_HIDEONBUTTON (1<<4)
50 #define DLG_FREEONBUTTON (1<<5)
52 enum { DLG_SET, DLG_EXIT };
54 typedef void DlgCallback(t_x11 *x11,int dlg_mess,int item_id,
55 char *set,void *data);
56 /* User function that can be called by the dialog box. All setting of
57 * check-boxes and radio-buttons etc., is done by the dialog manager,
58 * the user can let himself be informed about mouse activity also.
62 t_x11 *x11; /* All about X */
63 t_windata win; /* The position and size of the window */
64 char *title; /* Window name */
65 Window wDad; /* The parent window */
66 unsigned int xmax,ymax; /* Dimensions of parent window */
67 unsigned long flags; /* Flags for display */
68 unsigned long fg,bg; /* The colours */
69 gmx_bool bPop; /* Should we pop the mouse back */
70 gmx_bool bGrab; /* Have we grabbed the mouse ? */
71 int nitem; /* The number of items */
72 t_dlgitem **dlgitem; /* The array of item pointers */
73 DlgCallback *cb; /* User call back function */
74 void *data; /* User data */
77 /*****************************
79 * Routine to create the DLG structure, returns NULL on failure
80 * cb and data may be NULL.
82 ****************************/
83 t_dlg *CreateDlg(t_x11 *x11,Window Parent,const char *title,
84 int x0,int y0,int w,int h,int bw,unsigned long fg,unsigned long bg,
85 DlgCallback *cb,void *data);
87 /*****************************
89 * Routine to add an item to the dialog box
90 * The pointer to the item is copied to the dlg struct,
91 * the item itself may not be freed until the dlg is done with
93 ****************************/
94 void AddDlgItem(t_dlg *dlg,t_dlgitem *item);
96 void AddDlgItems(t_dlg *dlg,int nitem,t_dlgitem *item[]);
98 /*****************************
100 * Routines to manipulate items on a dialog box
101 * They return TRUE on succes, FALSE otherwise
102 * FALSE will mean most of the time, that item id was not found
104 ****************************/
105 gmx_bool QueryDlgItemSize(t_dlg *dlg,t_id id,int *w,int *h);
107 gmx_bool QueryDlgItemPos(t_dlg *dlg,t_id id,int *x0,int *y0);
109 int QueryDlgItemX(t_dlg *dlg, t_id id);
111 int QueryDlgItemY(t_dlg *dlg, t_id id);
113 int QueryDlgItemW(t_dlg *dlg, t_id id);
115 int QueryDlgItemH(t_dlg *dlg, t_id id);
117 gmx_bool SetDlgItemSize(t_dlg *dlg,t_id id,int w,int h);
119 gmx_bool SetDlgItemPos(t_dlg *dlg,t_id id,int x0,int y0);
121 void SetDlgSize(t_dlg *dlg,int w,int h, gmx_bool bAutoPosition);
123 /*****************************
125 * Routines to extract information from the dlg proc
126 * after dlg is exec'ed
128 ****************************/
129 gmx_bool IsCBChecked(t_dlg *dlg,t_id id);
131 t_id RBSelected(t_dlg *dlg,int gid);
133 int EditTextLen(t_dlg *dlg,t_id id);
135 char *EditText(t_dlg *dlg,t_id id);
137 /*****************************
139 * Routines to do internal things
141 ****************************/
142 t_dlgitem *FindWin(t_dlg *dlg, Window win);
144 t_dlgitem *FindItem(t_dlg *dlg, t_id id);
146 void HelpDlg(t_dlg *dlg);
148 void HelpNow(t_dlg *dlg, t_dlgitem *dlgitem);
150 void NoHelp(t_dlg *dlg);
152 /*****************************
154 * Exececute the dialog box procedure
155 * Returns when a button is pushed.
156 * return value is the ID of the button
158 ****************************/
159 void ShowDlg(t_dlg *dlg);
161 void HideDlg(t_dlg *dlg);
163 void FreeDlgItem(t_dlg *dlg, t_id id);
165 void FreeDlg(t_dlg *dlg);