Remove repeat sfree(state->nosehoover_xi)
[alexxy/gromacs.git] / src / programs / view / xdlgitem.h
1 /*
2  *
3  *                This source code is part of
4  *
5  *                 G   R   O   M   A   C   S
6  *
7  *          GROningen MAchine for Chemical Simulations
8  *
9  *                        VERSION 3.2.0
10  * Written by David van der Spoel, Erik Lindahl, Berk Hess, and others.
11  * Copyright (c) 1991-2000, University of Groningen, The Netherlands.
12  * Copyright (c) 2001-2004, The GROMACS development team,
13  * check out http://www.gromacs.org for more information.
14
15  * This program is free software; you can redistribute it and/or
16  * modify it under the terms of the GNU General Public License
17  * as published by the Free Software Foundation; either version 2
18  * of the License, or (at your option) any later version.
19  *
20  * If you want to redistribute modifications, please consider that
21  * scientific software is very special. Version control is crucial -
22  * bugs must be traceable. We will be happy to consider code for
23  * inclusion in the official distribution, but derived work must not
24  * be called official GROMACS. Details are found in the README & COPYING
25  * files - if they are missing, get the official version at www.gromacs.org.
26  *
27  * To help us fund GROMACS development, we humbly ask that you cite
28  * the papers on the package - you can find them in the top README file.
29  *
30  * For more info, check our website at http://www.gromacs.org
31  *
32  * And Hey:
33  * Gyas ROwers Mature At Cryogenic Speed
34  */
35
36 #ifndef _xdlgitem_h
37 #define _xdlgitem_h
38
39 #include <typedefs.h>
40 #include "Xstuff.h"
41 #include "xutil.h"
42 #include "x11.h"
43
44 typedef enum {
45     edlgBN, edlgRB, edlgGB, edlgCB, edlgPM, edlgST, edlgET, edlgNR
46 } edlgitem;
47 #define XCARET  2
48
49 enum {
50     ITEMOK, RBPRESSED, BNPRESSED, CBPRESSED, ETCHANGED, HELPPRESSED, ENTERPRESSED
51 };
52
53 typedef int t_id;
54
55 typedef struct {
56     bool bDefault;  /* This is the default button */
57 } t_button;
58
59 typedef struct {
60     bool bSelect;   /* Is this rb selected ? */
61 } t_radiobutton;
62
63 typedef struct {
64     bool bChecked;  /* Is this cb checked ? */
65 } t_checkbox;
66
67 typedef struct {
68     Pixmap pm;      /* The pixmap bits */
69 } t_pixmap;
70
71 typedef struct {
72     int    nlines;
73     char **lines;
74 } t_statictext;
75
76 typedef struct {
77     int  buflen, strbegin; /* Length of the screen buf and begin of string  */
78     int  pos;              /* Current length of the string and pos of caret */
79     /* Pos is relative to strbegin, and is the pos   */
80     /* in the window.                                */
81     bool     bChanged;
82     char    *buf;
83 } t_edittext;
84
85 typedef struct {
86     int   nitems;
87     t_id *item;
88 } t_groupbox;
89
90
91 typedef struct t_dlgitem {
92     t_windata         win;
93     t_id              ID, GroupID;
94     bool              bUseMon;
95     char             *set, *get, *help;
96     edlgitem          type;
97     int       (*WndProc)(t_x11 *x11, struct t_dlgitem *dlgitem, XEvent *event);
98     union {
99         t_button      button;
100         t_radiobutton radiobutton;
101         t_groupbox    groupbox;
102         t_checkbox    checkbox;
103         t_pixmap      pixmap;
104         t_statictext  statictext;
105         t_edittext    edittext;
106     } u;
107 } t_dlgitem;
108
109 /*****************************
110  *
111  * Routines to create dialog items, all items have an id
112  * which you can use to extract info. It is possible to have
113  * multiple items with the same id but it may then not be possible
114  * to extract information.
115  * All routines take the position relative to the parent dlg
116  * and the size and border width.
117  * If the width and height are set to zero initially, they will
118  * be calculated and set by the routine. With the dlgitem manipulation
119  * routines listed below, the application can then move the items around
120  * on the dlg box, and if wished resize them.
121  *
122  ****************************/
123 extern t_dlgitem *CreateButton(t_x11 *x11, const char *szLab, bool bDef,
124                                t_id id, t_id groupid,
125                                int x0, int y0, int w, int h, int bw);
126
127 extern t_dlgitem *CreateRadioButton(t_x11 *x11,
128                                     const char *szLab, bool bSet, t_id id,
129                                     t_id groupid,
130                                     int x0, int y0, int w, int h, int bw);
131
132 extern t_dlgitem *CreateGroupBox(t_x11 *x11, const char *szLab, t_id id,
133                                  int nitems, t_id items[],
134                                  int x0, int y0, int w, int h, int bw);
135
136 extern t_dlgitem *CreateCheckBox(t_x11 *x11, const char *szLab,
137                                  bool bCheckedInitial,
138                                  t_id id, t_id groupid,
139                                  int x0, int y0, int w, int h, int bw);
140
141 extern t_dlgitem *CreatePixmap(Pixmap pm, t_id id, t_id groupid,
142                                int x0, int y0, int w, int h, int bw);
143
144 extern t_dlgitem *CreateStaticText(t_x11 *x11,
145                                    int nlines, const char * const *lines,
146                                    t_id id, t_id groupid,
147                                    int x0, int y0, int w, int h, int bw);
148
149 extern t_dlgitem *CreateEditText(t_x11 *x11, const char *title,
150                                  int screenbuf, char *buf, t_id id, t_id groupid,
151                                  int x0, int y0, int w, int h, int bw);
152
153 extern void SetDlgitemOpts(t_dlgitem *dlgitem, bool bUseMon,
154                            char *set, char *get, char *help);
155
156 #endif  /* _xdlgitem_h */