| 1 |
/* @(#)HelpShell.c 19.1 (ES0-DMD) 02/25/03 13:45:56 */ |
| 2 |
/*=========================================================================== |
| 3 |
Copyright (C) 1995 European Southern Observatory (ESO) |
| 4 |
|
| 5 |
This program is free software; you can redistribute it and/or |
| 6 |
modify it under the terms of the GNU General Public License as |
| 7 |
published by the Free Software Foundation; either version 2 of |
| 8 |
the License, or (at your option) any later version. |
| 9 |
|
| 10 |
This program is distributed in the hope that it will be useful, |
| 11 |
but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 12 |
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 13 |
GNU General Public License for more details. |
| 14 |
|
| 15 |
You should have received a copy of the GNU General Public |
| 16 |
License along with this program; if not, write to the Free |
| 17 |
Software Foundation, Inc., 675 Massachusetss Ave, Cambridge, |
| 18 |
MA 02139, USA. |
| 19 |
|
| 20 |
Corresponding concerning ESO-MIDAS should be addressed as follows: |
| 21 |
Internet e-mail: [email protected] |
| 22 |
Postal address: European Southern Observatory |
| 23 |
Data Management Division |
| 24 |
Karl-Schwarzschild-Strasse 2 |
| 25 |
D 85748 Garching bei Muenchen |
| 26 |
GERMANY |
| 27 |
===========================================================================*/ |
| 28 |
|
| 29 |
|
| 30 |
/******************************************************************************* |
| 31 |
HelpShell.c |
| 32 |
|
| 33 |
*******************************************************************************/ |
| 34 |
|
| 35 |
#include <stdio.h> |
| 36 |
#include "UxLib.h" |
| 37 |
#include "UxPushB.h" |
| 38 |
#include "UxText.h" |
| 39 |
#include "UxRowCol.h" |
| 40 |
#include "UxScrW.h" |
| 41 |
#include "UxForm.h" |
| 42 |
#include "UxTopSh.h" |
| 43 |
|
| 44 |
/******************************************************************************* |
| 45 |
Includes, Defines, and Global variables from the Declarations Editor: |
| 46 |
*******************************************************************************/ |
| 47 |
|
| 48 |
#include <ExternResources.h> |
| 49 |
|
| 50 |
/******************************************************************************* |
| 51 |
The definition of the context structure: |
| 52 |
If you create multiple instances of your interface, the context |
| 53 |
structure ensures that your callbacks use the variables for the |
| 54 |
correct instance. |
| 55 |
|
| 56 |
For each swidget in the interface, each argument to the Interface |
| 57 |
function, and each variable in the Instance Specific section of the |
| 58 |
Declarations Editor, there is an entry in the context structure. |
| 59 |
and a #define. The #define makes the variable name refer to the |
| 60 |
corresponding entry in the context structure. |
| 61 |
*******************************************************************************/ |
| 62 |
|
| 63 |
typedef struct |
| 64 |
{ |
| 65 |
swidget UxHelpShell; |
| 66 |
swidget Uxform21; |
| 67 |
swidget UxscrolledWindow9; |
| 68 |
swidget UxrowColumn8; |
| 69 |
swidget Uxtx_extended_help; |
| 70 |
swidget Uxhelp_print; |
| 71 |
swidget Uxpb_help_return; |
| 72 |
} _UxCHelpShell; |
| 73 |
|
| 74 |
#define HelpShell UxHelpShellContext->UxHelpShell |
| 75 |
#define form21 UxHelpShellContext->Uxform21 |
| 76 |
#define scrolledWindow9 UxHelpShellContext->UxscrolledWindow9 |
| 77 |
#define rowColumn8 UxHelpShellContext->UxrowColumn8 |
| 78 |
#define tx_extended_help UxHelpShellContext->Uxtx_extended_help |
| 79 |
#define help_print UxHelpShellContext->Uxhelp_print |
| 80 |
#define pb_help_return UxHelpShellContext->Uxpb_help_return |
| 81 |
|
| 82 |
static _UxCHelpShell *UxHelpShellContext; |
| 83 |
|
| 84 |
|
| 85 |
/******************************************************************************* |
| 86 |
Forward declarations of functions that are defined later in this file. |
| 87 |
*******************************************************************************/ |
| 88 |
|
| 89 |
swidget create_HelpShell(); |
| 90 |
|
| 91 |
/******************************************************************************* |
| 92 |
The following are callback functions. |
| 93 |
*******************************************************************************/ |
| 94 |
|
| 95 |
static void activateCB_pb_help_return( UxWidget, UxClientData, UxCallbackArg ) |
| 96 |
Widget UxWidget; |
| 97 |
XtPointer UxClientData, UxCallbackArg; |
| 98 |
{ |
| 99 |
_UxCHelpShell *UxSaveCtx, *UxContext; |
| 100 |
swidget UxThisWidget; |
| 101 |
|
| 102 |
UxThisWidget = UxWidgetToSwidget( UxWidget ); |
| 103 |
UxSaveCtx = UxHelpShellContext; |
| 104 |
UxHelpShellContext = UxContext = |
| 105 |
(_UxCHelpShell *) UxGetContext( UxThisWidget ); |
| 106 |
{ |
| 107 |
UxPopdownInterface(UxFindSwidget("HelpShell")); |
| 108 |
|
| 109 |
|
| 110 |
} |
| 111 |
UxHelpShellContext = UxSaveCtx; |
| 112 |
} |
| 113 |
|
| 114 |
/******************************************************************************* |
| 115 |
The 'init_' function sets the private properties for all the |
| 116 |
swidgets to the values specified in the Property Table. |
| 117 |
Some properties need to be set after the X widgets have been |
| 118 |
created and the setting of these properties is done in the |
| 119 |
'build_' function after the UxCreateWidget call. |
| 120 |
*******************************************************************************/ |
| 121 |
|
| 122 |
static void _Uxinit_HelpShell() |
| 123 |
{ |
| 124 |
UxPutGeometry( HelpShell, "-0+0" ); |
| 125 |
UxPutBackground( HelpShell, ButtonBackground ); |
| 126 |
UxPutIconName( HelpShell, "Extended help" ); |
| 127 |
UxPutKeyboardFocusPolicy( HelpShell, "pointer" ); |
| 128 |
UxPutTitle( HelpShell, "Extended help" ); |
| 129 |
UxPutHeight( HelpShell, 415 ); |
| 130 |
UxPutWidth( HelpShell, 700 ); |
| 131 |
UxPutY( HelpShell, 70 ); |
| 132 |
UxPutX( HelpShell, 20 ); |
| 133 |
|
| 134 |
UxPutBackground( form21, ButtonBackground ); |
| 135 |
UxPutHeight( form21, 284 ); |
| 136 |
UxPutWidth( form21, 664 ); |
| 137 |
UxPutY( form21, 0 ); |
| 138 |
UxPutX( form21, 0 ); |
| 139 |
UxPutUnitType( form21, "pixels" ); |
| 140 |
UxPutResizePolicy( form21, "resize_none" ); |
| 141 |
|
| 142 |
UxPutBackground( scrolledWindow9, WindowBackground ); |
| 143 |
UxPutScrollBarPlacement( scrolledWindow9, "bottom_left" ); |
| 144 |
UxPutHeight( scrolledWindow9, 372 ); |
| 145 |
UxPutWidth( scrolledWindow9, 710 ); |
| 146 |
UxPutY( scrolledWindow9, 2 ); |
| 147 |
UxPutX( scrolledWindow9, 0 ); |
| 148 |
UxPutScrollingPolicy( scrolledWindow9, "automatic" ); |
| 149 |
|
| 150 |
UxPutEntryAlignment( rowColumn8, "alignment_beginning" ); |
| 151 |
UxPutBackground( rowColumn8, "white" ); |
| 152 |
UxPutOrientation( rowColumn8, "horizontal" ); |
| 153 |
UxPutHeight( rowColumn8, 427 ); |
| 154 |
UxPutWidth( rowColumn8, 418 ); |
| 155 |
UxPutY( rowColumn8, 4 ); |
| 156 |
UxPutX( rowColumn8, 25 ); |
| 157 |
|
| 158 |
UxPutHighlightColor( tx_extended_help, "Black" ); |
| 159 |
UxPutForeground( tx_extended_help, TextForeground ); |
| 160 |
UxPutCursorPositionVisible( tx_extended_help, "false" ); |
| 161 |
UxPutEditMode( tx_extended_help, "multi_line_edit" ); |
| 162 |
UxPutFontList( tx_extended_help, SmallFont ); |
| 163 |
UxPutBackground( tx_extended_help, TextBackground ); |
| 164 |
UxPutHeight( tx_extended_help, 853 ); |
| 165 |
UxPutWidth( tx_extended_help, 673 ); |
| 166 |
UxPutY( tx_extended_help, 3 ); |
| 167 |
UxPutX( tx_extended_help, 3 ); |
| 168 |
|
| 169 |
UxPutForeground( help_print, ButtonForeground ); |
| 170 |
UxPutHighlightOnEnter( help_print, "true" ); |
| 171 |
UxPutHighlightColor( help_print, "Black" ); |
| 172 |
UxPutFontList( help_print, BoldTextFont ); |
| 173 |
UxPutLabelString( help_print, "Print" ); |
| 174 |
UxPutBackground( help_print, ButtonBackground ); |
| 175 |
UxPutHeight( help_print, 32 ); |
| 176 |
UxPutWidth( help_print, 82 ); |
| 177 |
UxPutY( help_print, 378 ); |
| 178 |
UxPutX( help_print, 516 ); |
| 179 |
|
| 180 |
UxPutForeground( pb_help_return, CancelForeground ); |
| 181 |
UxPutHighlightOnEnter( pb_help_return, "true" ); |
| 182 |
UxPutHighlightColor( pb_help_return, "red" ); |
| 183 |
UxPutLabelString( pb_help_return, "Quit" ); |
| 184 |
UxPutFontList( pb_help_return, BoldTextFont ); |
| 185 |
UxPutBackground( pb_help_return, ButtonBackground ); |
| 186 |
UxPutHeight( pb_help_return, 32 ); |
| 187 |
UxPutWidth( pb_help_return, 82 ); |
| 188 |
UxPutY( pb_help_return, 378 ); |
| 189 |
UxPutX( pb_help_return, 604 ); |
| 190 |
|
| 191 |
} |
| 192 |
|
| 193 |
/******************************************************************************* |
| 194 |
The 'build_' function creates all the swidgets and X widgets, |
| 195 |
and sets their properties to the values specified in the |
| 196 |
Property Editor. |
| 197 |
*******************************************************************************/ |
| 198 |
|
| 199 |
static swidget _Uxbuild_HelpShell() |
| 200 |
{ |
| 201 |
/* Create the swidgets */ |
| 202 |
|
| 203 |
HelpShell = UxCreateTopLevelShell( "HelpShell", NO_PARENT ); |
| 204 |
UxPutContext( HelpShell, UxHelpShellContext ); |
| 205 |
|
| 206 |
form21 = UxCreateForm( "form21", HelpShell ); |
| 207 |
scrolledWindow9 = UxCreateScrolledWindow( "scrolledWindow9", form21 ); |
| 208 |
rowColumn8 = UxCreateRowColumn( "rowColumn8", scrolledWindow9 ); |
| 209 |
tx_extended_help = UxCreateText( "tx_extended_help", rowColumn8 ); |
| 210 |
help_print = UxCreatePushButton( "help_print", form21 ); |
| 211 |
pb_help_return = UxCreatePushButton( "pb_help_return", form21 ); |
| 212 |
|
| 213 |
_Uxinit_HelpShell(); |
| 214 |
|
| 215 |
/* Create the X widgets */ |
| 216 |
|
| 217 |
UxCreateWidget( HelpShell ); |
| 218 |
UxCreateWidget( form21 ); |
| 219 |
UxCreateWidget( scrolledWindow9 ); |
| 220 |
UxCreateWidget( rowColumn8 ); |
| 221 |
UxCreateWidget( tx_extended_help ); |
| 222 |
UxCreateWidget( help_print ); |
| 223 |
UxCreateWidget( pb_help_return ); |
| 224 |
|
| 225 |
UxAddCallback( pb_help_return, XmNactivateCallback, |
| 226 |
activateCB_pb_help_return, |
| 227 |
(XtPointer) UxHelpShellContext ); |
| 228 |
|
| 229 |
|
| 230 |
/* Finally, call UxRealizeInterface to create the X windows |
| 231 |
for the widgets created above. */ |
| 232 |
|
| 233 |
UxRealizeInterface( HelpShell ); |
| 234 |
|
| 235 |
return ( HelpShell ); |
| 236 |
} |
| 237 |
|
| 238 |
/******************************************************************************* |
| 239 |
The following function includes the code that was entered |
| 240 |
in the 'Initial Code' and 'Final Code' sections of the |
| 241 |
Declarations Editor. This function is called from the |
| 242 |
'Interface function' below. |
| 243 |
*******************************************************************************/ |
| 244 |
|
| 245 |
static swidget _Ux_create_HelpShell() |
| 246 |
{ |
| 247 |
swidget rtrn; |
| 248 |
_UxCHelpShell *UxContext; |
| 249 |
|
| 250 |
UxHelpShellContext = UxContext = |
| 251 |
(_UxCHelpShell *) UxMalloc( sizeof(_UxCHelpShell) ); |
| 252 |
|
| 253 |
rtrn = _Uxbuild_HelpShell(); |
| 254 |
|
| 255 |
return(rtrn); |
| 256 |
} |
| 257 |
|
| 258 |
/******************************************************************************* |
| 259 |
The following is the 'Interface function' which is the |
| 260 |
external entry point for creating this interface. |
| 261 |
This function should be called from your application or from |
| 262 |
a callback function. |
| 263 |
*******************************************************************************/ |
| 264 |
|
| 265 |
swidget create_HelpShell() |
| 266 |
{ |
| 267 |
swidget _Uxrtrn; |
| 268 |
|
| 269 |
_Uxrtrn = _Ux_create_HelpShell(); |
| 270 |
|
| 271 |
return ( _Uxrtrn ); |
| 272 |
} |
| 273 |
|
| 274 |
/******************************************************************************* |
| 275 |
END OF FILE |
| 276 |
*******************************************************************************/ |
| 277 |
|