1
/*===========================================================================
2
Copyright (C) 1995-2009 European Southern Observatory (ESO)
4
This program is free software; you can redistribute it and/or
5
modify it under the terms of the GNU General Public License as
6
published by the Free Software Foundation; either version 2 of
7
the License, or (at your option) any later version.
9
This program is distributed in the hope that it will be useful,
10
but WITHOUT ANY WARRANTY; without even the implied warranty of
11
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12
GNU General Public License for more details.
14
You should have received a copy of the GNU General Public
15
License along with this program; if not, write to the Free
16
Software Foundation, Inc., 675 Massachusetts Ave, Cambridge,
19
Correspondence concerning ESO-MIDAS should be addressed as follows:
20
Internet e-mail: midas@eso.org
21
Postal address: European Southern Observatory
22
Data Management Division
23
Karl-Schwarzschild-Strasse 2
24
D 85748 Garching bei Muenchen
26
===========================================================================*/
29
/*******************************************************************************
35
*******************************************************************************/
45
/*******************************************************************************
46
Includes, Defines, and Global variables from the Declarations Editor:
47
*******************************************************************************/
49
#include <ExternResources.h>
51
/*******************************************************************************
52
The definition of the context structure:
53
If you create multiple instances of your interface, the context
54
structure ensures that your callbacks use the variables for the
57
For each swidget in the interface, each argument to the Interface
58
function, and each variable in the Instance Specific section of the
59
Declarations Editor, there is an entry in the context structure.
60
and a #define. The #define makes the variable name refer to the
61
corresponding entry in the context structure.
62
*******************************************************************************/
66
swidget Uxfile_dialog;
69
swidget UxpushButton25;
70
swidget UxpushButton26;
71
swidget Uxlb_file_dialog;
72
swidget Uxtf_file_dialog;
75
#define file_dialog UxFile_dialogContext->Uxfile_dialog
76
#define form12 UxFile_dialogContext->Uxform12
77
#define form13 UxFile_dialogContext->Uxform13
78
#define pushButton25 UxFile_dialogContext->UxpushButton25
79
#define pushButton26 UxFile_dialogContext->UxpushButton26
80
#define lb_file_dialog UxFile_dialogContext->Uxlb_file_dialog
81
#define tf_file_dialog UxFile_dialogContext->Uxtf_file_dialog
83
static _UxCfile_dialog *UxFile_dialogContext;
85
extern void CallbackDialog();
88
/*******************************************************************************
89
Forward declarations of functions that are defined later in this file.
90
*******************************************************************************/
92
swidget create_file_dialog();
94
/*******************************************************************************
95
The following are callback functions.
96
*******************************************************************************/
98
static void activateCB_pushButton25( UxWidget, UxClientData, UxCallbackArg )
100
XtPointer UxClientData, UxCallbackArg;
102
_UxCfile_dialog *UxSaveCtx, *UxContext;
103
swidget UxThisWidget;
105
UxThisWidget = UxWidgetToSwidget( UxWidget );
106
UxSaveCtx = UxFile_dialogContext;
107
UxFile_dialogContext = UxContext =
108
(_UxCfile_dialog *) UxGetContext( UxThisWidget );
112
UxFile_dialogContext = UxSaveCtx;
115
static void activateCB_pushButton26( UxWidget, UxClientData, UxCallbackArg )
117
XtPointer UxClientData, UxCallbackArg;
119
_UxCfile_dialog *UxSaveCtx, *UxContext;
120
swidget UxThisWidget;
122
UxThisWidget = UxWidgetToSwidget( UxWidget );
123
UxSaveCtx = UxFile_dialogContext;
124
UxFile_dialogContext = UxContext =
125
(_UxCfile_dialog *) UxGetContext( UxThisWidget );
127
UxPopdownInterface(UxFindSwidget("file_dialog"));
129
UxFile_dialogContext = UxSaveCtx;
132
static void activateCB_tf_file_dialog( UxWidget, UxClientData, UxCallbackArg )
134
XtPointer UxClientData, UxCallbackArg;
136
_UxCfile_dialog *UxSaveCtx, *UxContext;
137
swidget UxThisWidget;
139
UxThisWidget = UxWidgetToSwidget( UxWidget );
140
UxSaveCtx = UxFile_dialogContext;
141
UxFile_dialogContext = UxContext =
142
(_UxCfile_dialog *) UxGetContext( UxThisWidget );
146
UxFile_dialogContext = UxSaveCtx;
149
/*******************************************************************************
150
The 'init_' function sets the private properties for all the
151
swidgets to the values specified in the Property Table.
152
Some properties need to be set after the X widgets have been
153
created and the setting of these properties is done in the
154
'build_' function after the UxCreateWidget call.
155
*******************************************************************************/
157
static void _Uxinit_file_dialog()
159
UxPutBackground( file_dialog, WindowBackground );
160
UxPutGeometry( file_dialog, "+100+100" );
161
UxPutKeyboardFocusPolicy( file_dialog, "pointer" );
162
UxPutTitle( file_dialog, "" );
163
UxPutHeight( file_dialog, 105 );
164
UxPutWidth( file_dialog, 408 );
165
UxPutY( file_dialog, 121 );
166
UxPutX( file_dialog, 102 );
168
UxPutBackground( form12, WindowBackground );
169
UxPutHeight( form12, 348 );
170
UxPutWidth( form12, 408 );
173
UxPutUnitType( form12, "pixels" );
174
UxPutResizePolicy( form12, "resize_none" );
176
UxPutBackground( form13, ButtonBackground );
177
UxPutHeight( form13, 40 );
178
UxPutWidth( form13, 452 );
179
UxPutY( form13, 62 );
181
UxPutResizePolicy( form13, "resize_none" );
183
UxPutLabelString( pushButton25, "Apply" );
184
UxPutForeground( pushButton25, ButtonForeground );
185
UxPutFontList( pushButton25, BoldTextFont );
186
UxPutBackground( pushButton25, ButtonBackground );
187
UxPutHeight( pushButton25, 30 );
188
UxPutWidth( pushButton25, 80 );
189
UxPutY( pushButton25, 4 );
190
UxPutX( pushButton25, 8 );
192
UxPutLabelString( pushButton26, "Return" );
193
UxPutForeground( pushButton26, CancelForeground );
194
UxPutFontList( pushButton26, BoldTextFont );
195
UxPutBackground( pushButton26, ButtonBackground );
196
UxPutHeight( pushButton26, 30 );
197
UxPutWidth( pushButton26, 80 );
198
UxPutY( pushButton26, 4 );
199
UxPutX( pushButton26, 100 );
201
UxPutForeground( lb_file_dialog, TextForeground );
202
UxPutAlignment( lb_file_dialog, "alignment_beginning" );
203
UxPutLabelString( lb_file_dialog, "Normalized flat frame :" );
204
UxPutFontList( lb_file_dialog, TextFont );
205
UxPutBackground( lb_file_dialog, LabelBackground );
206
UxPutHeight( lb_file_dialog, 30 );
207
UxPutWidth( lb_file_dialog, 176 );
208
UxPutY( lb_file_dialog, 12 );
209
UxPutX( lb_file_dialog, 10 );
211
UxPutForeground( tf_file_dialog, TextForeground );
212
UxPutHighlightOnEnter( tf_file_dialog, "true" );
213
UxPutFontList( tf_file_dialog, TextFont );
214
UxPutBackground( tf_file_dialog, TextBackground );
215
UxPutHeight( tf_file_dialog, 34 );
216
UxPutWidth( tf_file_dialog, 210 );
217
UxPutY( tf_file_dialog, 10 );
218
UxPutX( tf_file_dialog, 190 );
222
/*******************************************************************************
223
The 'build_' function creates all the swidgets and X widgets,
224
and sets their properties to the values specified in the
226
*******************************************************************************/
228
static swidget _Uxbuild_file_dialog()
230
/* Create the swidgets */
232
file_dialog = UxCreateApplicationShell( "file_dialog", NO_PARENT );
233
UxPutContext( file_dialog, UxFile_dialogContext );
235
form12 = UxCreateForm( "form12", file_dialog );
236
form13 = UxCreateForm( "form13", form12 );
237
pushButton25 = UxCreatePushButton( "pushButton25", form13 );
238
pushButton26 = UxCreatePushButton( "pushButton26", form13 );
239
lb_file_dialog = UxCreateLabel( "lb_file_dialog", form12 );
240
tf_file_dialog = UxCreateTextField( "tf_file_dialog", form12 );
242
_Uxinit_file_dialog();
244
/* Create the X widgets */
246
UxCreateWidget( file_dialog );
247
UxCreateWidget( form12 );
248
UxCreateWidget( form13 );
249
UxCreateWidget( pushButton25 );
250
UxCreateWidget( pushButton26 );
251
UxCreateWidget( lb_file_dialog );
252
UxCreateWidget( tf_file_dialog );
254
UxAddCallback( pushButton25, XmNactivateCallback,
255
activateCB_pushButton25,
256
(XtPointer) UxFile_dialogContext );
258
UxAddCallback( pushButton26, XmNactivateCallback,
259
activateCB_pushButton26,
260
(XtPointer) UxFile_dialogContext );
262
UxAddCallback( tf_file_dialog, XmNactivateCallback,
263
activateCB_tf_file_dialog,
264
(XtPointer) UxFile_dialogContext );
267
/* Finally, call UxRealizeInterface to create the X windows
268
for the widgets created above. */
270
UxRealizeInterface( file_dialog );
272
return ( file_dialog );
275
/*******************************************************************************
276
The following function includes the code that was entered
277
in the 'Initial Code' and 'Final Code' sections of the
278
Declarations Editor. This function is called from the
279
'Interface function' below.
280
*******************************************************************************/
282
static swidget _Ux_create_file_dialog()
285
_UxCfile_dialog *UxContext;
287
UxFile_dialogContext = UxContext =
288
(_UxCfile_dialog *) UxMalloc( sizeof(_UxCfile_dialog) );
290
rtrn = _Uxbuild_file_dialog();
295
/*******************************************************************************
296
The following is the 'Interface function' which is the
297
external entry point for creating this interface.
298
This function should be called from your application or from
300
*******************************************************************************/
302
swidget create_file_dialog()
306
_Uxrtrn = _Ux_create_file_dialog();
311
/*******************************************************************************
313
*******************************************************************************/