4 * This source code is part of
8 * GROningen MAchine for Chemical Simulations
11 * Copyright (c) 1991-2001, University of Groningen, The Netherlands
12 * This program is free software; you can redistribute it and/or
13 * modify it under the terms of the GNU General Public License
14 * as published by the Free Software Foundation; either version 2
15 * of the License, or (at your option) any later version.
17 * If you want to redistribute modifications, please consider that
18 * scientific software is very special. Version control is crucial -
19 * bugs must be traceable. We will be happy to consider code for
20 * inclusion in the official distribution, but derived work must not
21 * be called official GROMACS. Details are found in the README & COPYING
22 * files - if they are missing, get the official version at www.gromacs.org.
24 * To help us fund GROMACS development, we humbly ask that you cite
25 * the papers on the package - you can find them in the top README file.
27 * For more info, check our website at http://www.gromacs.org
30 * Glycine aRginine prOline Methionine Alanine Cystine Serine
39 #define DLG_SHOW (1<<0)
40 #define DLG_HIDE (1<<1)
41 #define DLG_SHOWANDHIDE (DLG_SHOW | DLG_HIDE)
42 #define DLG_SYSTEMMODAL (1<<2)
43 #define DLG_APPLMODAL (1<<3)
44 #define DLG_HIDEONBUTTON (1<<4)
45 #define DLG_FREEONBUTTON (1<<5)
47 enum { DLG_SET
, DLG_EXIT
};
49 typedef void DlgCallback(t_x11
*x11
,int dlg_mess
,int item_id
,
50 char *set
,void *data
);
51 /* User function that can be called by the dialog box. All setting of
52 * check-boxes and radio-buttons etc., is done by the dialog manager,
53 * the user can let himself be informed about mouse activity also.
57 t_x11
*x11
; /* All about X */
58 t_windata win
; /* The position and size of the window */
59 char *title
; /* Window name */
60 Window wDad
; /* The parent window */
61 unsigned int xmax
,ymax
; /* Dimensions of parent window */
62 unsigned long flags
; /* Flags for display */
63 unsigned long fg
,bg
; /* The colours */
64 bool bPop
; /* Should we pop the mouse back */
65 bool bGrab
; /* Have we grabbed the mouse ? */
66 int nitem
; /* The number of items */
67 t_dlgitem
**dlgitem
; /* The array of item pointers */
68 DlgCallback
*cb
; /* User call back function */
69 void *data
; /* User data */
72 /*****************************
74 * Routine to create the DLG structure, returns NULL on failure
75 * cb and data may be NULL.
77 ****************************/
78 t_dlg
*CreateDlg(t_x11
*x11
,Window Parent
,char *title
,
79 int x0
,int y0
,int w
,int h
,int bw
,unsigned long fg
,unsigned long bg
,
80 DlgCallback
*cb
,void *data
);
82 /*****************************
84 * Routine to add an item to the dialog box
85 * The pointer to the item is copied to the dlg struct,
86 * the item itself may not be freed until the dlg is done with
88 ****************************/
89 void AddDlgItem(t_dlg
*dlg
,t_dlgitem
*new);
91 void AddDlgItems(t_dlg
*dlg
,int nitem
,t_dlgitem
*new[]);
93 /*****************************
95 * Routines to manipulate items on a dialog box
96 * They return TRUE on succes, FALSE otherwise
97 * FALSE will mean most of the time, that item id was not found
99 ****************************/
100 bool QueryDlgItemSize(t_dlg
*dlg
,t_id id
,int *w
,int *h
);
102 bool QueryDlgItemPos(t_dlg
*dlg
,t_id id
,int *x0
,int *y0
);
104 int QueryDlgItemX(t_dlg
*dlg
, t_id id
);
106 int QueryDlgItemY(t_dlg
*dlg
, t_id id
);
108 int QueryDlgItemW(t_dlg
*dlg
, t_id id
);
110 int QueryDlgItemH(t_dlg
*dlg
, t_id id
);
112 bool SetDlgItemSize(t_dlg
*dlg
,t_id id
,int w
,int h
);
114 bool SetDlgItemPos(t_dlg
*dlg
,t_id id
,int x0
,int y0
);
116 void SetDlgSize(t_dlg
*dlg
,int w
,int h
, bool bAutoPosition
);
118 /*****************************
120 * Routines to extract information from the dlg proc
121 * after dlg is exec'ed
123 ****************************/
124 bool IsCBChecked(t_dlg
*dlg
,t_id id
);
126 t_id
RBSelected(t_dlg
*dlg
,int gid
);
128 int EditTextLen(t_dlg
*dlg
,t_id id
);
130 char *EditText(t_dlg
*dlg
,t_id id
);
132 /*****************************
134 * Routines to do internal things
136 ****************************/
137 t_dlgitem
*FindWin(t_dlg
*dlg
, Window win
);
139 t_dlgitem
*FindItem(t_dlg
*dlg
, t_id id
);
141 void HelpDlg(t_dlg
*dlg
);
143 void HelpNow(t_dlg
*dlg
, t_dlgitem
*dlgitem
);
145 void NoHelp(t_dlg
*dlg
);
147 /*****************************
149 * Exececute the dialog box procedure
150 * Returns when a button is pushed.
151 * return value is the ID of the button
153 ****************************/
154 void ShowDlg(t_dlg
*dlg
);
156 void HideDlg(t_dlg
*dlg
);
158 void FreeDlgItem(t_dlg
*dlg
, t_id id
);
160 void FreeDlg(t_dlg
*dlg
);