Selection output to xvgr files is now cleaner.
[gromacs/qmmm-gamess-us.git] / src / ngmx / xdlgitem.h
blob5de7b8a390aa61f5f2b83c55dc23d07be6679d58
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.
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.
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.
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.
30 * For more info, check our website at http://www.gromacs.org
32 * And Hey:
33 * Gyas ROwers Mature At Cryogenic Speed
36 #ifndef _xdlgitem_h
37 #define _xdlgitem_h
39 #include <typedefs.h>
40 #include <Xstuff.h>
41 #include <xutil.h>
42 #include <x11.h>
44 #define XCARET 2
46 enum {
47 ITEMOK, RBPRESSED, BNPRESSED, CBPRESSED, ETCHANGED, HELPPRESSED, ENTERPRESSED
50 typedef int t_id;
52 typedef struct {
53 bool bDefault; /* This is the default button */
54 } t_button;
56 typedef struct {
57 bool bSelect; /* Is this rb selected ? */
58 } t_radiobutton;
60 typedef struct {
61 bool bChecked; /* Is this cb checked ? */
62 } t_checkbox;
64 typedef struct {
65 Pixmap pm; /* The pixmap bits */
66 } t_pixmap;
68 typedef struct {
69 int nlines;
70 char **lines;
71 } t_statictext;
73 typedef struct {
74 int buflen,strbegin; /* Length of the screen buf and begin of string */
75 int pos/*,len*/; /* Current length of the string and pos of caret */
76 /* Pos is relative to strbegin, and is the pos */
77 /* in the window. */
78 bool bChanged;
79 char *buf;
80 } t_edittext;
82 typedef struct {
83 int nitems;
84 t_id *item;
85 } t_groupbox;
87 typedef enum {
88 edlgBN, edlgRB, edlgGB, edlgCB, edlgPM, edlgST, edlgET, edlgNR
89 } edlgitem;
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;
109 /*****************************
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.
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);
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);
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);
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);
141 extern t_dlgitem *CreatePixmap(t_x11 *x11,Pixmap pm,t_id id,t_id groupid,
142 int x0,int y0,int w,int h,int bw);
144 extern t_dlgitem *CreateStaticText(t_x11 *x11,
145 int nlines,char * const * lines,t_id id,
146 t_id groupid,
147 int x0,int y0,int w,int h,int bw);
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);
153 extern void SetDlgitemOpts(t_dlgitem *dlgitem,bool bUseMon,
154 char *set, char *get, char *help);
156 #endif /* _xdlgitem_h */