Partial commit of the project to remove all static variables.
[gromacs.git] / src / ngmx / xdlgitem.h
blob04cf1fca55078e2b433d754100fcea733e7bb429
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 3.1
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
29 * And Hey:
30 * Glycine aRginine prOline Methionine Alanine Cystine Serine
33 #ifndef _xdlgitem_h
34 #define _xdlgitem_h
36 #include <typedefs.h>
37 #include <Xstuff.h>
38 #include <xutil.h>
39 #include <x11.h>
41 #define XCARET 2
43 enum {
44 ITEMOK, RBPRESSED, BNPRESSED, CBPRESSED, ETCHANGED, HELPPRESSED, ENTERPRESSED
47 typedef int t_id;
49 typedef struct {
50 bool bDefault; /* This is the default button */
51 } t_button;
53 typedef struct {
54 bool bSelect; /* Is this rb selected ? */
55 } t_radiobutton;
57 typedef struct {
58 bool bChecked; /* Is this cb checked ? */
59 } t_checkbox;
61 typedef struct {
62 Pixmap pm; /* The pixmap bits */
63 } t_pixmap;
65 typedef struct {
66 int nlines;
67 char **lines;
68 } t_statictext;
70 typedef struct {
71 int buflen,strbegin; /* Length of the screen buf and begin of string */
72 int pos/*,len*/; /* Current length of the string and pos of caret */
73 /* Pos is relative to strbegin, and is the pos */
74 /* in the window. */
75 bool bChanged;
76 char *buf;
77 } t_edittext;
79 typedef struct {
80 int nitems;
81 t_id *item;
82 } t_groupbox;
84 typedef enum {
85 edlgBN, edlgRB, edlgGB, edlgCB, edlgPM, edlgST, edlgET, edlgNR
86 } edlgitem;
88 typedef struct t_dlgitem {
89 t_windata win;
90 t_id ID,GroupID;
91 bool bUseMon;
92 char *set,*get,*help;
93 edlgitem type;
94 int (*WndProc)(t_x11 *x11,struct t_dlgitem *dlgitem,XEvent *event);
95 union {
96 t_button button;
97 t_radiobutton radiobutton;
98 t_groupbox groupbox;
99 t_checkbox checkbox;
100 t_pixmap pixmap;
101 t_statictext statictext;
102 t_edittext edittext;
103 } u;
104 } t_dlgitem;
106 /*****************************
108 * Routines to create dialog items, all items have an id
109 * which you can use to extract info. It is possible to have
110 * multiple items with the same id but it may then not be possible
111 * to extract information.
112 * All routines take the position relative to the parent dlg
113 * and the size and border width.
114 * If the width and height are set to zero initially, they will
115 * be calculated and set by the routine. With the dlgitem manipulation
116 * routines listed below, the application can then move the items around
117 * on the dlg box, and if wished resize them.
119 ****************************/
120 extern t_dlgitem *CreateButton(t_x11 *x11, char *szLab,bool bDef,
121 t_id id,t_id groupid,
122 int x0,int y0,int w,int h,int bw);
124 extern t_dlgitem *CreateRadioButton(t_x11 *x11,
125 char *szLab,bool bSet,t_id id,
126 t_id groupid,
127 int x0,int y0,int w,int h,int bw);
129 extern t_dlgitem *CreateGroupBox(t_x11 *x11,char *szLab,t_id id,
130 int nitems, t_id items[],
131 int x0,int y0,int w,int h,int bw);
133 extern t_dlgitem *CreateCheckBox(t_x11 *x11,char *szLab,
134 bool bCheckedInitial,
135 t_id id,t_id groupid,
136 int x0,int y0,int w,int h,int bw);
138 extern t_dlgitem *CreatePixmap(t_x11 *x11,Pixmap pm,t_id id,t_id groupid,
139 int x0,int y0,int w,int h,int bw);
141 extern t_dlgitem *CreateStaticText(t_x11 *x11,
142 int nlines,char **lines,t_id id,
143 t_id groupid,
144 int x0,int y0,int w,int h,int bw);
146 extern t_dlgitem *CreateEditText(t_x11 *x11,char *title,
147 int screenbuf,char *buf, t_id id,t_id groupid,
148 int x0,int y0,int w,int h,int bw);
150 extern void SetDlgitemOpts(t_dlgitem *dlgitem,bool bUseMon,
151 char *set, char *get, char *help);
153 #endif /* _xdlgitem_h */