| 1 |
|
| 2 |
/******************************************************************************* |
| 3 |
Warning.c |
| 4 |
|
| 5 |
.VERSION |
| 6 |
090825 last modif |
| 7 |
|
| 8 |
*******************************************************************************/ |
| 9 |
|
| 10 |
#include <stdio.h> |
| 11 |
#include "UxLib.h" |
| 12 |
#include "UxMsgBD.h" |
| 13 |
|
| 14 |
/******************************************************************************* |
| 15 |
Includes, Defines, and Global variables from the Declarations Editor: |
| 16 |
*******************************************************************************/ |
| 17 |
|
| 18 |
#include <ExternResources.h> |
| 19 |
|
| 20 |
/******************************************************************************* |
| 21 |
The definition of the context structure: |
| 22 |
If you create multiple instances of your interface, the context |
| 23 |
structure ensures that your callbacks use the variables for the |
| 24 |
correct instance. |
| 25 |
|
| 26 |
For each swidget in the interface, each argument to the Interface |
| 27 |
function, and each variable in the Instance Specific section of the |
| 28 |
Declarations Editor, there is an entry in the context structure. |
| 29 |
and a #define. The #define makes the variable name refer to the |
| 30 |
corresponding entry in the context structure. |
| 31 |
*******************************************************************************/ |
| 32 |
|
| 33 |
typedef struct |
| 34 |
{ |
| 35 |
swidget UxWarning; |
| 36 |
} _UxCWarning; |
| 37 |
|
| 38 |
#define Warning UxWarningContext->UxWarning |
| 39 |
|
| 40 |
static _UxCWarning *UxWarningContext; |
| 41 |
|
| 42 |
extern int AppendDialogText(); |
| 43 |
|
| 44 |
|
| 45 |
/******************************************************************************* |
| 46 |
Forward declarations of functions that are defined later in this file. |
| 47 |
*******************************************************************************/ |
| 48 |
|
| 49 |
swidget create_Warning(); |
| 50 |
|
| 51 |
/******************************************************************************* |
| 52 |
The following are callback functions. |
| 53 |
*******************************************************************************/ |
| 54 |
|
| 55 |
static void createCB_Warning( UxWidget, UxClientData, UxCallbackArg ) |
| 56 |
Widget UxWidget; |
| 57 |
XtPointer UxClientData, UxCallbackArg; |
| 58 |
{ |
| 59 |
_UxCWarning *UxSaveCtx, *UxContext; |
| 60 |
swidget UxThisWidget; |
| 61 |
|
| 62 |
UxThisWidget = UxWidgetToSwidget( UxWidget ); |
| 63 |
UxSaveCtx = UxWarningContext; |
| 64 |
UxWarningContext = UxContext = |
| 65 |
(_UxCWarning *) UxGetContext( UxThisWidget ); |
| 66 |
{ |
| 67 |
/*XtVaSetValues(UxWidget,XmNallowShellResize,True,NULL); |
| 68 |
XtVaSetValues(UxWidget,XmNresizePolicy,XmRESIZE_ANY,NULL);*/ |
| 69 |
XtVaSetValues(UxWidget,XmNdialogType,XmDIALOG_QUESTION,NULL); |
| 70 |
} |
| 71 |
UxWarningContext = UxSaveCtx; |
| 72 |
} |
| 73 |
|
| 74 |
static void okCallback_Warning( UxWidget, UxClientData, UxCallbackArg ) |
| 75 |
Widget UxWidget; |
| 76 |
XtPointer UxClientData, UxCallbackArg; |
| 77 |
{ |
| 78 |
_UxCWarning *UxSaveCtx, *UxContext; |
| 79 |
swidget UxThisWidget; |
| 80 |
|
| 81 |
UxThisWidget = UxWidgetToSwidget( UxWidget ); |
| 82 |
UxSaveCtx = UxWarningContext; |
| 83 |
UxWarningContext = UxContext = |
| 84 |
(_UxCWarning *) UxGetContext( UxThisWidget ); |
| 85 |
{ |
| 86 |
extern char commerr[180]; |
| 87 |
|
| 88 |
AppendDialogText(commerr); |
| 89 |
|
| 90 |
} |
| 91 |
UxWarningContext = UxSaveCtx; |
| 92 |
} |
| 93 |
|
| 94 |
static void cancelCB_Warning( UxWidget, UxClientData, UxCallbackArg ) |
| 95 |
Widget UxWidget; |
| 96 |
XtPointer UxClientData, UxCallbackArg; |
| 97 |
{ |
| 98 |
_UxCWarning *UxSaveCtx, *UxContext; |
| 99 |
swidget UxThisWidget; |
| 100 |
|
| 101 |
UxThisWidget = UxWidgetToSwidget( UxWidget ); |
| 102 |
UxSaveCtx = UxWarningContext; |
| 103 |
UxWarningContext = UxContext = |
| 104 |
(_UxCWarning *) UxGetContext( UxThisWidget ); |
| 105 |
{ |
| 106 |
|
| 107 |
} |
| 108 |
UxWarningContext = UxSaveCtx; |
| 109 |
} |
| 110 |
|
| 111 |
/******************************************************************************* |
| 112 |
The 'init_' function sets the private properties for all the |
| 113 |
swidgets to the values specified in the Property Table. |
| 114 |
Some properties need to be set after the X widgets have been |
| 115 |
created and the setting of these properties is done in the |
| 116 |
'build_' function after the UxCreateWidget call. |
| 117 |
*******************************************************************************/ |
| 118 |
|
| 119 |
static void _Uxinit_Warning() |
| 120 |
{ |
| 121 |
UxPutResizePolicy( Warning, "resize_any" ); |
| 122 |
UxPutAllowShellResize( Warning, "true" ); |
| 123 |
UxPutBackground( Warning, WindowBackground ); |
| 124 |
UxPutTextFontList( Warning, BoldTextFont ); |
| 125 |
UxPutLabelFontList( Warning, TextFont ); |
| 126 |
UxPutButtonFontList( Warning, BoldTextFont ); |
| 127 |
UxPutDialogStyle( Warning, "dialog_modeless" ); |
| 128 |
UxPutDialogType( Warning, "dialog_file_selection" ); |
| 129 |
UxPutHeight( Warning, 150 ); |
| 130 |
UxPutWidth( Warning, 290 ); |
| 131 |
UxPutY( Warning, 600 ); |
| 132 |
UxPutX( Warning, 600 ); |
| 133 |
UxPutUnitType( Warning, "pixels" ); |
| 134 |
|
| 135 |
} |
| 136 |
|
| 137 |
/******************************************************************************* |
| 138 |
The 'build_' function creates all the swidgets and X widgets, |
| 139 |
and sets their properties to the values specified in the |
| 140 |
Property Editor. |
| 141 |
*******************************************************************************/ |
| 142 |
|
| 143 |
static swidget _Uxbuild_Warning() |
| 144 |
{ |
| 145 |
/* Create the swidgets */ |
| 146 |
|
| 147 |
Warning = UxCreateMessageBoxDialog( "Warning", NO_PARENT ); |
| 148 |
UxPutContext( Warning, UxWarningContext ); |
| 149 |
UxPutDefaultShell( Warning, "topLevelShell" ); |
| 150 |
|
| 151 |
|
| 152 |
_Uxinit_Warning(); |
| 153 |
|
| 154 |
/* Create the X widgets */ |
| 155 |
|
| 156 |
UxCreateWidget( Warning ); |
| 157 |
createCB_Warning( UxGetWidget( Warning ), |
| 158 |
(XtPointer) UxWarningContext, (XtPointer) NULL ); |
| 159 |
|
| 160 |
|
| 161 |
UxAddCallback( Warning, XmNokCallback, |
| 162 |
okCallback_Warning, |
| 163 |
(XtPointer) UxWarningContext ); |
| 164 |
UxAddCallback( Warning, XmNcancelCallback, |
| 165 |
cancelCB_Warning, |
| 166 |
(XtPointer) UxWarningContext ); |
| 167 |
|
| 168 |
|
| 169 |
/* Finally, call UxRealizeInterface to create the X windows |
| 170 |
for the widgets created above. */ |
| 171 |
|
| 172 |
UxRealizeInterface( Warning ); |
| 173 |
|
| 174 |
return ( Warning ); |
| 175 |
} |
| 176 |
|
| 177 |
/******************************************************************************* |
| 178 |
The following function includes the code that was entered |
| 179 |
in the 'Initial Code' and 'Final Code' sections of the |
| 180 |
Declarations Editor. This function is called from the |
| 181 |
'Interface function' below. |
| 182 |
*******************************************************************************/ |
| 183 |
|
| 184 |
static swidget _Ux_create_Warning() |
| 185 |
{ |
| 186 |
swidget rtrn; |
| 187 |
_UxCWarning *UxContext; |
| 188 |
|
| 189 |
UxWarningContext = UxContext = |
| 190 |
(_UxCWarning *) UxMalloc( sizeof(_UxCWarning) ); |
| 191 |
|
| 192 |
rtrn = _Uxbuild_Warning(); |
| 193 |
|
| 194 |
return(rtrn); |
| 195 |
} |
| 196 |
|
| 197 |
/******************************************************************************* |
| 198 |
The following is the 'Interface function' which is the |
| 199 |
external entry point for creating this interface. |
| 200 |
This function should be called from your application or from |
| 201 |
a callback function. |
| 202 |
*******************************************************************************/ |
| 203 |
|
| 204 |
swidget create_Warning() |
| 205 |
{ |
| 206 |
swidget _Uxrtrn; |
| 207 |
|
| 208 |
_Uxrtrn = _Ux_create_Warning(); |
| 209 |
|
| 210 |
return ( _Uxrtrn ); |
| 211 |
} |
| 212 |
|
| 213 |
/******************************************************************************* |
| 214 |
END OF FILE |
| 215 |
*******************************************************************************/ |
| 216 |
|