Update mdrun test comparison infrastructure
[gromacs.git] / src / programs / view / xdlg.h
blob7700ec47ff586ea0a2a1186d76b7974d488b6a1f
1 /*
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 * Copyright (c) 2013, by the GROMACS development team, led by
7 * Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
8 * and including many others, as listed in the AUTHORS file in the
9 * top-level source directory and at http://www.gromacs.org.
11 * GROMACS is free software; you can redistribute it and/or
12 * modify it under the terms of the GNU Lesser General Public License
13 * as published by the Free Software Foundation; either version 2.1
14 * of the License, or (at your option) any later version.
16 * GROMACS is distributed in the hope that it will be useful,
17 * but WITHOUT ANY WARRANTY; without even the implied warranty of
18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
19 * Lesser General Public License for more details.
21 * You should have received a copy of the GNU Lesser General Public
22 * License along with GROMACS; if not, see
23 * http://www.gnu.org/licenses, or write to the Free Software Foundation,
24 * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
26 * If you want to redistribute modifications to GROMACS, please
27 * consider that scientific software is very special. Version
28 * control is crucial - bugs must be traceable. We will be happy to
29 * consider code for inclusion in the official distribution, but
30 * derived work must not be called official GROMACS. Details are found
31 * in the README & COPYING files - if they are missing, get the
32 * official version at http://www.gromacs.org.
34 * To help us fund GROMACS development, we humbly ask that you cite
35 * the research papers on the package. Check out http://www.gromacs.org.
38 #ifndef _xdlg_h
39 #define _xdlg_h
41 #include "xdlgitem.h"
43 #define DLG_SHOW (1<<0)
44 #define DLG_HIDE (1<<1)
45 #define DLG_SHOWANDHIDE (DLG_SHOW | DLG_HIDE)
46 #define DLG_SYSTEMMODAL (1<<2)
47 #define DLG_APPLMODAL (1<<3)
48 #define DLG_HIDEONBUTTON (1<<4)
49 #define DLG_FREEONBUTTON (1<<5)
51 enum {
52 DLG_SET, DLG_EXIT
55 typedef void DlgCallback (t_x11 *x11, int dlg_mess, int item_id,
56 char *set, void *data);
57 /* User function that can be called by the dialog box. All setting of
58 * check-boxes and radio-buttons etc., is done by the dialog manager,
59 * the user can let himself be informed about mouse activity also.
62 typedef struct {
63 t_x11 *x11; /* All about X */
64 t_windata win; /* The position and size of the window */
65 char *title; /* Window name */
66 Window wDad; /* The parent window */
67 unsigned int xmax, ymax; /* Dimensions of parent window */
68 unsigned long flags; /* Flags for display */
69 unsigned long fg, bg; /* The colours */
70 bool bPop; /* Should we pop the mouse back */
71 bool bGrab; /* Have we grabbed the mouse ? */
72 int nitem; /* The number of items */
73 t_dlgitem **dlgitem; /* The array of item pointers */
74 DlgCallback *cb; /* User call back function */
75 void *data; /* User data */
76 } t_dlg;
78 /*****************************
80 * Routine to create the DLG structure, returns NULL on failure
81 * cb and data may be NULL.
83 ****************************/
84 t_dlg *CreateDlg(t_x11 *x11, Window Parent, const char *title,
85 int x0, int y0, int w, int h, int bw,
86 DlgCallback *cb, void *data);
88 /*****************************
90 * Routine to add an item to the dialog box
91 * The pointer to the item is copied to the dlg struct,
92 * the item itself may not be freed until the dlg is done with
94 ****************************/
95 void AddDlgItem(t_dlg *dlg, t_dlgitem *item);
97 void AddDlgItems(t_dlg *dlg, int nitem, t_dlgitem *item[]);
99 /*****************************
101 * Routines to manipulate items on a dialog box
102 * They return true on succes, false otherwise
103 * false will mean most of the time, that item id was not found
105 ****************************/
106 bool QueryDlgItemSize(t_dlg *dlg, t_id id, int *w, int *h);
108 bool QueryDlgItemPos(t_dlg *dlg, t_id id, int *x0, int *y0);
110 int QueryDlgItemX(t_dlg *dlg, t_id id);
112 int QueryDlgItemY(t_dlg *dlg, t_id id);
114 int QueryDlgItemW(t_dlg *dlg, t_id id);
116 int QueryDlgItemH(t_dlg *dlg, t_id id);
118 bool SetDlgItemSize(t_dlg *dlg, t_id id, int w, int h);
120 bool SetDlgItemPos(t_dlg *dlg, t_id id, int x0, int y0);
122 void SetDlgSize(t_dlg *dlg, int w, int h, bool bAutoPosition);
124 /*****************************
126 * Routines to extract information from the dlg proc
127 * after dlg is exec'ed
129 ****************************/
130 bool IsCBChecked(t_dlg *dlg, t_id id);
132 t_id RBSelected(t_dlg *dlg, int gid);
134 int EditTextLen(t_dlg *dlg, t_id id);
136 char *EditText(t_dlg *dlg, t_id id);
138 /*****************************
140 * Routines to do internal things
142 ****************************/
143 t_dlgitem *FindWin(t_dlg *dlg, Window win);
145 t_dlgitem *FindItem(t_dlg *dlg, t_id id);
147 void HelpDlg(t_dlg *dlg);
149 void HelpNow(t_dlg *dlg, t_dlgitem *dlgitem);
151 void NoHelp(t_dlg *dlg);
153 /*****************************
155 * Exececute the dialog box procedure
156 * Returns when a button is pushed.
157 * return value is the ID of the button
159 ****************************/
160 void ShowDlg(t_dlg *dlg);
162 void HideDlg(t_dlg *dlg);
164 void FreeDlgItem(t_dlg *dlg, t_id id);
166 void FreeDlg(t_dlg *dlg);
168 #endif /* _xdlg_h */