| 1 |
|
| 2 |
/******************************************************************************* |
| 3 |
transientShell1.c |
| 4 |
|
| 5 |
.VERSION |
| 6 |
090825 last modif |
| 7 |
|
| 8 |
*******************************************************************************/ |
| 9 |
|
| 10 |
#include <stdio.h> |
| 11 |
#include "UxLib.h" |
| 12 |
#include "UxLabel.h" |
| 13 |
#include "UxPushB.h" |
| 14 |
#include "UxScList.h" |
| 15 |
#include "UxScrW.h" |
| 16 |
#include "UxForm.h" |
| 17 |
#include "UxTranSh.h" |
| 18 |
|
| 19 |
/******************************************************************************* |
| 20 |
Includes, Defines, and Global variables from the Declarations Editor: |
| 21 |
*******************************************************************************/ |
| 22 |
|
| 23 |
#include <ExternResources.h> |
| 24 |
#include <midas_def.h> |
| 25 |
#include <tbldef.h> |
| 26 |
|
| 27 |
/******************************************************************************* |
| 28 |
The definition of the context structure: |
| 29 |
If you create multiple instances of your interface, the context |
| 30 |
structure ensures that your callbacks use the variables for the |
| 31 |
correct instance. |
| 32 |
|
| 33 |
For each swidget in the interface, each argument to the Interface |
| 34 |
function, and each variable in the Instance Specific section of the |
| 35 |
Declarations Editor, there is an entry in the context structure. |
| 36 |
and a #define. The #define makes the variable name refer to the |
| 37 |
corresponding entry in the context structure. |
| 38 |
*******************************************************************************/ |
| 39 |
|
| 40 |
typedef struct |
| 41 |
{ |
| 42 |
swidget UxtransientShell1; |
| 43 |
swidget Uxform2; |
| 44 |
swidget UxscrolledWindow3; |
| 45 |
swidget UxpushButton3; |
| 46 |
swidget Uxapply; |
| 47 |
swidget UxscrolledWindow8; |
| 48 |
swidget Uxlabel22; |
| 49 |
swidget Uxlabel23; |
| 50 |
} _UxCtransientShell1; |
| 51 |
|
| 52 |
#define transientShell1 UxTransientShell1Context->UxtransientShell1 |
| 53 |
#define form2 UxTransientShell1Context->Uxform2 |
| 54 |
#define scrolledWindow3 UxTransientShell1Context->UxscrolledWindow3 |
| 55 |
#define pushButton3 UxTransientShell1Context->UxpushButton3 |
| 56 |
#define apply UxTransientShell1Context->Uxapply |
| 57 |
#define scrolledWindow8 UxTransientShell1Context->UxscrolledWindow8 |
| 58 |
#define label22 UxTransientShell1Context->Uxlabel22 |
| 59 |
#define label23 UxTransientShell1Context->Uxlabel23 |
| 60 |
|
| 61 |
static _UxCtransientShell1 *UxTransientShell1Context; |
| 62 |
|
| 63 |
extern void display_col_table(); |
| 64 |
extern int selectlist(), getselectlist(); |
| 65 |
|
| 66 |
|
| 67 |
|
| 68 |
swidget columnlist; |
| 69 |
swidget columnlist1; |
| 70 |
|
| 71 |
/******************************************************************************* |
| 72 |
Forward declarations of functions that are defined later in this file. |
| 73 |
*******************************************************************************/ |
| 74 |
|
| 75 |
swidget create_transientShell1(); |
| 76 |
|
| 77 |
/******************************************************************************* |
| 78 |
The following are callback functions. |
| 79 |
*******************************************************************************/ |
| 80 |
|
| 81 |
static void extendedSelectionCB_columnlist( UxWidget, UxClientData, UxCallbackArg ) |
| 82 |
Widget UxWidget; |
| 83 |
XtPointer UxClientData, UxCallbackArg; |
| 84 |
{ |
| 85 |
_UxCtransientShell1 *UxSaveCtx, *UxContext; |
| 86 |
swidget UxThisWidget; |
| 87 |
|
| 88 |
UxThisWidget = UxWidgetToSwidget( UxWidget ); |
| 89 |
UxSaveCtx = UxTransientShell1Context; |
| 90 |
UxTransientShell1Context = UxContext = |
| 91 |
(_UxCtransientShell1 *) UxGetContext( UxThisWidget ); |
| 92 |
UxTransientShell1Context = UxSaveCtx; |
| 93 |
} |
| 94 |
|
| 95 |
static void browseSelectionCB_columnlist( UxWidget, UxClientData, UxCallbackArg ) |
| 96 |
Widget UxWidget; |
| 97 |
XtPointer UxClientData, UxCallbackArg; |
| 98 |
{ |
| 99 |
_UxCtransientShell1 *UxSaveCtx, *UxContext; |
| 100 |
swidget UxThisWidget; |
| 101 |
|
| 102 |
UxThisWidget = UxWidgetToSwidget( UxWidget ); |
| 103 |
UxSaveCtx = UxTransientShell1Context; |
| 104 |
UxTransientShell1Context = UxContext = |
| 105 |
(_UxCtransientShell1 *) UxGetContext( UxThisWidget ); |
| 106 |
{ |
| 107 |
|
| 108 |
} |
| 109 |
UxTransientShell1Context = UxSaveCtx; |
| 110 |
} |
| 111 |
|
| 112 |
static void activateCB_pushButton3( UxWidget, UxClientData, UxCallbackArg ) |
| 113 |
Widget UxWidget; |
| 114 |
XtPointer UxClientData, UxCallbackArg; |
| 115 |
{ |
| 116 |
_UxCtransientShell1 *UxSaveCtx, *UxContext; |
| 117 |
swidget UxThisWidget; |
| 118 |
|
| 119 |
UxThisWidget = UxWidgetToSwidget( UxWidget ); |
| 120 |
UxSaveCtx = UxTransientShell1Context; |
| 121 |
UxTransientShell1Context = UxContext = |
| 122 |
(_UxCtransientShell1 *) UxGetContext( UxThisWidget ); |
| 123 |
{ |
| 124 |
extern swidget clist; |
| 125 |
UxPopdownInterface(clist); |
| 126 |
} |
| 127 |
UxTransientShell1Context = UxSaveCtx; |
| 128 |
} |
| 129 |
|
| 130 |
static void activateCB_apply( UxWidget, UxClientData, UxCallbackArg ) |
| 131 |
Widget UxWidget; |
| 132 |
XtPointer UxClientData, UxCallbackArg; |
| 133 |
{ |
| 134 |
_UxCtransientShell1 *UxSaveCtx, *UxContext; |
| 135 |
swidget UxThisWidget; |
| 136 |
|
| 137 |
UxThisWidget = UxWidgetToSwidget( UxWidget ); |
| 138 |
UxSaveCtx = UxTransientShell1Context; |
| 139 |
UxTransientShell1Context = UxContext = |
| 140 |
(_UxCtransientShell1 *) UxGetContext( UxThisWidget ); |
| 141 |
{ |
| 142 |
extern swidget clist; |
| 143 |
getselectlist(UxGetWidget(UxFindSwidget("columnlist"))); |
| 144 |
display_col_table(UxGetWidget(UxFindSwidget("readtable"))); |
| 145 |
|
| 146 |
UxPopdownInterface(clist); |
| 147 |
} |
| 148 |
UxTransientShell1Context = UxSaveCtx; |
| 149 |
} |
| 150 |
|
| 151 |
static void extendedSelectionCB_columnlist1( UxWidget, UxClientData, UxCallbackArg ) |
| 152 |
Widget UxWidget; |
| 153 |
XtPointer UxClientData, UxCallbackArg; |
| 154 |
{ |
| 155 |
_UxCtransientShell1 *UxSaveCtx, *UxContext; |
| 156 |
swidget UxThisWidget; |
| 157 |
|
| 158 |
UxThisWidget = UxWidgetToSwidget( UxWidget ); |
| 159 |
UxSaveCtx = UxTransientShell1Context; |
| 160 |
UxTransientShell1Context = UxContext = |
| 161 |
(_UxCtransientShell1 *) UxGetContext( UxThisWidget ); |
| 162 |
{ |
| 163 |
|
| 164 |
} |
| 165 |
UxTransientShell1Context = UxSaveCtx; |
| 166 |
} |
| 167 |
|
| 168 |
static void browseSelectionCB_columnlist1( UxWidget, UxClientData, UxCallbackArg ) |
| 169 |
Widget UxWidget; |
| 170 |
XtPointer UxClientData, UxCallbackArg; |
| 171 |
{ |
| 172 |
_UxCtransientShell1 *UxSaveCtx, *UxContext; |
| 173 |
swidget UxThisWidget; |
| 174 |
|
| 175 |
UxThisWidget = UxWidgetToSwidget( UxWidget ); |
| 176 |
UxSaveCtx = UxTransientShell1Context; |
| 177 |
UxTransientShell1Context = UxContext = |
| 178 |
(_UxCtransientShell1 *) UxGetContext( UxThisWidget ); |
| 179 |
{ |
| 180 |
XmListCallbackStruct *cbs; |
| 181 |
char *choice,mymode[50]; |
| 182 |
cbs = (XmListCallbackStruct *)UxCallbackArg; |
| 183 |
XmStringGetLtoR(cbs->item, XmSTRING_DEFAULT_CHARSET, &choice); |
| 184 |
strcpy(mymode,choice); |
| 185 |
selectlist( mymode,UxGetWidget( UxFindSwidget("columnlist"))); |
| 186 |
XtFree(choice); |
| 187 |
} |
| 188 |
UxTransientShell1Context = UxSaveCtx; |
| 189 |
} |
| 190 |
|
| 191 |
/******************************************************************************* |
| 192 |
The 'init_' function sets the private properties for all the |
| 193 |
swidgets to the values specified in the Property Table. |
| 194 |
Some properties need to be set after the X widgets have been |
| 195 |
created and the setting of these properties is done in the |
| 196 |
'build_' function after the UxCreateWidget call. |
| 197 |
*******************************************************************************/ |
| 198 |
|
| 199 |
static void _Uxinit_transientShell1() |
| 200 |
{ |
| 201 |
UxPutTitle( transientShell1, "Select Columns" ); |
| 202 |
UxPutHeight( transientShell1, 580 ); |
| 203 |
UxPutWidth( transientShell1, 290 ); |
| 204 |
UxPutY( transientShell1, 100 ); |
| 205 |
UxPutX( transientShell1, 790 ); |
| 206 |
|
| 207 |
UxPutBackground( form2, ApplicBackground ); |
| 208 |
UxPutHeight( form2, 240 ); |
| 209 |
UxPutWidth( form2, 290 ); |
| 210 |
UxPutY( form2, 0 ); |
| 211 |
UxPutX( form2, 0 ); |
| 212 |
UxPutUnitType( form2, "pixels" ); |
| 213 |
UxPutResizePolicy( form2, "resize_none" ); |
| 214 |
|
| 215 |
UxPutScrollBarPlacement( scrolledWindow3, "bottom_left" ); |
| 216 |
UxPutBackground( scrolledWindow3, ApplicBackground ); |
| 217 |
UxPutWidth( scrolledWindow3, 270 ); |
| 218 |
UxPutHeight( scrolledWindow3, 316 ); |
| 219 |
UxPutShadowThickness( scrolledWindow3, 0 ); |
| 220 |
UxPutScrollBarDisplayPolicy( scrolledWindow3, "static" ); |
| 221 |
UxPutVisualPolicy( scrolledWindow3, "variable" ); |
| 222 |
UxPutY( scrolledWindow3, 10 ); |
| 223 |
UxPutX( scrolledWindow3, 10 ); |
| 224 |
UxPutScrollingPolicy( scrolledWindow3, "application_defined" ); |
| 225 |
|
| 226 |
UxPutAutomaticSelection( columnlist, "false" ); |
| 227 |
UxPutSelectionPolicy( columnlist, "extended_select" ); |
| 228 |
UxPutVisibleItemCount( columnlist, 16 ); |
| 229 |
UxPutScrollBarDisplayPolicy( columnlist, "static" ); |
| 230 |
UxPutForeground( columnlist, TextForeground ); |
| 231 |
UxPutFontList( columnlist, TextFont ); |
| 232 |
UxPutBackground( columnlist, TextBackground ); |
| 233 |
UxPutHeight( columnlist, 320 ); |
| 234 |
UxPutWidth( columnlist, 190 ); |
| 235 |
|
| 236 |
UxPutForeground( pushButton3, ButtonForeground ); |
| 237 |
UxPutFontList( pushButton3, BoldTextFont ); |
| 238 |
UxPutLabelString( pushButton3, "cancel" ); |
| 239 |
UxPutBackground( pushButton3, ButtonBackground ); |
| 240 |
UxPutHeight( pushButton3, 30 ); |
| 241 |
UxPutWidth( pushButton3, 200 ); |
| 242 |
UxPutY( pushButton3, 318 ); |
| 243 |
UxPutX( pushButton3, 0 ); |
| 244 |
|
| 245 |
UxPutForeground( apply, ButtonForeground ); |
| 246 |
UxPutFontList( apply, BoldTextFont ); |
| 247 |
UxPutLabelString( apply, "apply" ); |
| 248 |
UxPutBackground( apply, ButtonBackground ); |
| 249 |
UxPutHeight( apply, 30 ); |
| 250 |
UxPutWidth( apply, 200 ); |
| 251 |
UxPutY( apply, 330 ); |
| 252 |
UxPutX( apply, 160 ); |
| 253 |
|
| 254 |
UxPutScrollBarPlacement( scrolledWindow8, "bottom_left" ); |
| 255 |
UxPutBackground( scrolledWindow8, ApplicBackground ); |
| 256 |
UxPutWidth( scrolledWindow8, 270 ); |
| 257 |
UxPutHeight( scrolledWindow8, 316 ); |
| 258 |
UxPutShadowThickness( scrolledWindow8, 0 ); |
| 259 |
UxPutScrollBarDisplayPolicy( scrolledWindow8, "static" ); |
| 260 |
UxPutVisualPolicy( scrolledWindow8, "variable" ); |
| 261 |
UxPutY( scrolledWindow8, 10 ); |
| 262 |
UxPutX( scrolledWindow8, 10 ); |
| 263 |
UxPutScrollingPolicy( scrolledWindow8, "application_defined" ); |
| 264 |
|
| 265 |
UxPutSelectionPolicy( columnlist1, "browse_select" ); |
| 266 |
UxPutVisibleItemCount( columnlist1, 9 ); |
| 267 |
UxPutScrollBarDisplayPolicy( columnlist1, "static" ); |
| 268 |
UxPutForeground( columnlist1, TextForeground ); |
| 269 |
UxPutFontList( columnlist1, TextFont ); |
| 270 |
UxPutBackground( columnlist1, TextBackground ); |
| 271 |
UxPutHeight( columnlist1, 320 ); |
| 272 |
UxPutWidth( columnlist1, 190 ); |
| 273 |
|
| 274 |
UxPutLabelString( label22, "Instrument Mode" ); |
| 275 |
UxPutFontList( label22, BoldTextFont ); |
| 276 |
UxPutBackground( label22, WindowBackground ); |
| 277 |
UxPutHeight( label22, 30 ); |
| 278 |
UxPutWidth( label22, 270 ); |
| 279 |
UxPutY( label22, 0 ); |
| 280 |
UxPutX( label22, 20 ); |
| 281 |
|
| 282 |
UxPutLabelString( label23, "Columns " ); |
| 283 |
UxPutFontList( label23, BoldTextFont ); |
| 284 |
UxPutBackground( label23, WindowBackground ); |
| 285 |
UxPutHeight( label23, 30 ); |
| 286 |
UxPutWidth( label23, 270 ); |
| 287 |
UxPutY( label23, 10 ); |
| 288 |
UxPutX( label23, 10 ); |
| 289 |
|
| 290 |
} |
| 291 |
|
| 292 |
/******************************************************************************* |
| 293 |
The 'build_' function creates all the swidgets and X widgets, |
| 294 |
and sets their properties to the values specified in the |
| 295 |
Property Editor. |
| 296 |
*******************************************************************************/ |
| 297 |
|
| 298 |
static swidget _Uxbuild_transientShell1() |
| 299 |
{ |
| 300 |
/* Create the swidgets */ |
| 301 |
|
| 302 |
transientShell1 = UxCreateTransientShell( "transientShell1", NO_PARENT ); |
| 303 |
UxPutContext( transientShell1, UxTransientShell1Context ); |
| 304 |
|
| 305 |
form2 = UxCreateForm( "form2", transientShell1 ); |
| 306 |
scrolledWindow3 = UxCreateScrolledWindow( "scrolledWindow3", form2 ); |
| 307 |
columnlist = UxCreateScrolledList( "columnlist", scrolledWindow3 ); |
| 308 |
pushButton3 = UxCreatePushButton( "pushButton3", form2 ); |
| 309 |
apply = UxCreatePushButton( "apply", form2 ); |
| 310 |
scrolledWindow8 = UxCreateScrolledWindow( "scrolledWindow8", form2 ); |
| 311 |
columnlist1 = UxCreateScrolledList( "columnlist1", scrolledWindow8 ); |
| 312 |
label22 = UxCreateLabel( "label22", form2 ); |
| 313 |
label23 = UxCreateLabel( "label23", form2 ); |
| 314 |
|
| 315 |
_Uxinit_transientShell1(); |
| 316 |
|
| 317 |
/* Create the X widgets */ |
| 318 |
|
| 319 |
UxCreateWidget( transientShell1 ); |
| 320 |
UxCreateWidget( form2 ); |
| 321 |
UxPutTopOffset( scrolledWindow3, 225 ); |
| 322 |
UxPutTopAttachment( scrolledWindow3, "attach_form" ); |
| 323 |
UxPutRightOffset( scrolledWindow3, 2 ); |
| 324 |
UxPutRightAttachment( scrolledWindow3, "attach_form" ); |
| 325 |
UxPutLeftOffset( scrolledWindow3, 2 ); |
| 326 |
UxPutLeftAttachment( scrolledWindow3, "attach_form" ); |
| 327 |
UxPutBottomOffset( scrolledWindow3, 45 ); |
| 328 |
UxPutBottomAttachment( scrolledWindow3, "attach_form" ); |
| 329 |
UxCreateWidget( scrolledWindow3 ); |
| 330 |
|
| 331 |
UxCreateWidget( columnlist ); |
| 332 |
UxPutRightOffset( pushButton3, 10 ); |
| 333 |
UxPutRightAttachment( pushButton3, "attach_form" ); |
| 334 |
UxPutLeftOffset( pushButton3, 170 ); |
| 335 |
UxPutLeftAttachment( pushButton3, "attach_form" ); |
| 336 |
UxPutBottomOffset( pushButton3, 5 ); |
| 337 |
UxPutBottomAttachment( pushButton3, "attach_form" ); |
| 338 |
UxCreateWidget( pushButton3 ); |
| 339 |
|
| 340 |
UxPutRightOffset( apply, 160 ); |
| 341 |
UxPutRightAttachment( apply, "attach_form" ); |
| 342 |
UxPutLeftAttachment( apply, "attach_form" ); |
| 343 |
UxPutBottomOffset( apply, 5 ); |
| 344 |
UxPutBottomAttachment( apply, "attach_form" ); |
| 345 |
UxPutLeftOffset( apply, 10 ); |
| 346 |
UxCreateWidget( apply ); |
| 347 |
|
| 348 |
UxPutBottomOffset( scrolledWindow8, 380 ); |
| 349 |
UxPutBottomAttachment( scrolledWindow8, "attach_form" ); |
| 350 |
UxPutLeftOffset( scrolledWindow8, 0 ); |
| 351 |
UxPutLeftAttachment( scrolledWindow8, "attach_form" ); |
| 352 |
UxPutTopOffset( scrolledWindow8, 30 ); |
| 353 |
UxPutTopAttachment( scrolledWindow8, "attach_form" ); |
| 354 |
UxPutRightOffset( scrolledWindow8, 0 ); |
| 355 |
UxPutRightAttachment( scrolledWindow8, "attach_form" ); |
| 356 |
UxCreateWidget( scrolledWindow8 ); |
| 357 |
|
| 358 |
UxCreateWidget( columnlist1 ); |
| 359 |
UxPutTopOffset( label22, 0 ); |
| 360 |
UxPutTopAttachment( label22, "attach_form" ); |
| 361 |
UxPutRightOffset( label22, 0 ); |
| 362 |
UxPutRightAttachment( label22, "attach_form" ); |
| 363 |
UxPutLeftOffset( label22, 0 ); |
| 364 |
UxPutLeftAttachment( label22, "attach_form" ); |
| 365 |
UxCreateWidget( label22 ); |
| 366 |
|
| 367 |
UxPutTopOffset( label23, 195 ); |
| 368 |
UxPutTopAttachment( label23, "attach_form" ); |
| 369 |
UxPutRightOffset( label23, 0 ); |
| 370 |
UxPutRightAttachment( label23, "attach_form" ); |
| 371 |
UxPutLeftOffset( label23, 0 ); |
| 372 |
UxPutLeftAttachment( label23, "attach_form" ); |
| 373 |
UxCreateWidget( label23 ); |
| 374 |
|
| 375 |
|
| 376 |
UxAddCallback( columnlist, XmNextendedSelectionCallback, |
| 377 |
extendedSelectionCB_columnlist, |
| 378 |
(XtPointer) UxTransientShell1Context ); |
| 379 |
UxAddCallback( columnlist, XmNbrowseSelectionCallback, |
| 380 |
browseSelectionCB_columnlist, |
| 381 |
(XtPointer) UxTransientShell1Context ); |
| 382 |
|
| 383 |
UxAddCallback( pushButton3, XmNactivateCallback, |
| 384 |
activateCB_pushButton3, |
| 385 |
(XtPointer) UxTransientShell1Context ); |
| 386 |
|
| 387 |
UxAddCallback( apply, XmNactivateCallback, |
| 388 |
activateCB_apply, |
| 389 |
(XtPointer) UxTransientShell1Context ); |
| 390 |
|
| 391 |
UxAddCallback( columnlist1, XmNextendedSelectionCallback, |
| 392 |
extendedSelectionCB_columnlist1, |
| 393 |
(XtPointer) UxTransientShell1Context ); |
| 394 |
UxAddCallback( columnlist1, XmNbrowseSelectionCallback, |
| 395 |
browseSelectionCB_columnlist1, |
| 396 |
(XtPointer) UxTransientShell1Context ); |
| 397 |
|
| 398 |
|
| 399 |
/* Finally, call UxRealizeInterface to create the X windows |
| 400 |
for the widgets created above. */ |
| 401 |
|
| 402 |
UxRealizeInterface( transientShell1 ); |
| 403 |
|
| 404 |
return ( transientShell1 ); |
| 405 |
} |
| 406 |
|
| 407 |
/******************************************************************************* |
| 408 |
The following function includes the code that was entered |
| 409 |
in the 'Initial Code' and 'Final Code' sections of the |
| 410 |
Declarations Editor. This function is called from the |
| 411 |
'Interface function' below. |
| 412 |
*******************************************************************************/ |
| 413 |
|
| 414 |
static swidget _Ux_create_transientShell1() |
| 415 |
{ |
| 416 |
swidget rtrn; |
| 417 |
_UxCtransientShell1 *UxContext; |
| 418 |
|
| 419 |
UxTransientShell1Context = UxContext = |
| 420 |
(_UxCtransientShell1 *) UxMalloc( sizeof(_UxCtransientShell1) ); |
| 421 |
|
| 422 |
rtrn = _Uxbuild_transientShell1(); |
| 423 |
|
| 424 |
return(rtrn); |
| 425 |
} |
| 426 |
|
| 427 |
/******************************************************************************* |
| 428 |
The following is the 'Interface function' which is the |
| 429 |
external entry point for creating this interface. |
| 430 |
This function should be called from your application or from |
| 431 |
a callback function. |
| 432 |
*******************************************************************************/ |
| 433 |
|
| 434 |
swidget create_transientShell1() |
| 435 |
{ |
| 436 |
swidget _Uxrtrn; |
| 437 |
|
| 438 |
_Uxrtrn = _Ux_create_transientShell1(); |
| 439 |
|
| 440 |
return ( _Uxrtrn ); |
| 441 |
} |
| 442 |
|
| 443 |
/******************************************************************************* |
| 444 |
END OF FILE |
| 445 |
*******************************************************************************/ |
| 446 |
|