Debian Codegraph @

gui/XDo/src/SelectDescrTable.c

raw
1
2 /*******************************************************************************
3 SelectDescrTable.c
4
5 *******************************************************************************/
6
7 #include <stdio.h>
8 #include "UxLib.h"
9 #include "UxFsBox.h"
10
11 /*******************************************************************************
12 Includes, Defines, and Global variables from the Declarations Editor:
13 *******************************************************************************/
14
15 #include <ExternResources.h>
16
17 /*******************************************************************************
18 The definition of the context structure:
19 If you create multiple instances of your interface, the context
20 structure ensures that your callbacks use the variables for the
21 correct instance.
22
23 For each swidget in the interface, each argument to the Interface
24 function, and each variable in the Instance Specific section of the
25 Declarations Editor, there is an entry in the context structure.
26 and a #define. The #define makes the variable name refer to the
27 corresponding entry in the context structure.
28 *******************************************************************************/
29
30 typedef struct
31 {
32 swidget UxSelectDescrTable;
33 } _UxCSelectDescrTable;
34
35 #define SelectDescrTable UxSelectDescrTableContext->UxSelectDescrTable
36
37 static _UxCSelectDescrTable *UxSelectDescrTableContext;
38
39
40 /*******************************************************************************
41 Forward declarations of functions that are defined later in this file.
42 *******************************************************************************/
43
44 swidget create_SelectDescrTable();
45
46 /*******************************************************************************
47 The following are callback functions.
48 *******************************************************************************/
49
50 static void okCallback_SelectDescrTable( UxWidget, UxClientData, UxCallbackArg )
51 Widget UxWidget;
52 XtPointer UxClientData, UxCallbackArg;
53 {
54 _UxCSelectDescrTable *UxSaveCtx, *UxContext;
55 swidget UxThisWidget;
56
57 UxThisWidget = UxWidgetToSwidget( UxWidget );
58 UxSaveCtx = UxSelectDescrTableContext;
59 UxSelectDescrTableContext = UxContext =
60 (_UxCSelectDescrTable *) UxGetContext( UxThisWidget );
61 {
62 XmFileSelectionBoxCallbackStruct *cbs;
63 char *value;
64
65 cbs = (XmFileSelectionBoxCallbackStruct *)UxCallbackArg;
66 XmStringGetLtoR(cbs->value,XmSTRING_DEFAULT_CHARSET,&value);
67 UxPutText(UxFindSwidget("ost_t3"),value);
68 XmTextShowPosition(UxGetWidget(UxFindSwidget("ost_t3")),strlen(value));
69 }
70 UxSelectDescrTableContext = UxSaveCtx;
71 }
72
73 static void cancelCB_SelectDescrTable( UxWidget, UxClientData, UxCallbackArg )
74 Widget UxWidget;
75 XtPointer UxClientData, UxCallbackArg;
76 {
77 _UxCSelectDescrTable *UxSaveCtx, *UxContext;
78 swidget UxThisWidget;
79
80 UxThisWidget = UxWidgetToSwidget( UxWidget );
81 UxSaveCtx = UxSelectDescrTableContext;
82 UxSelectDescrTableContext = UxContext =
83 (_UxCSelectDescrTable *) UxGetContext( UxThisWidget );
84 {
85 extern swidget dlist;
86 UxPopdownInterface(dlist);
87 }
88 UxSelectDescrTableContext = UxSaveCtx;
89 }
90
91 /*******************************************************************************
92 The 'init_' function sets the private properties for all the
93 swidgets to the values specified in the Property Table.
94 Some properties need to be set after the X widgets have been
95 created and the setting of these properties is done in the
96 'build_' function after the UxCreateWidget call.
97 *******************************************************************************/
98
99 static void _Uxinit_SelectDescrTable()
100 {
101 UxPutDialogTitle( SelectDescrTable, "" );
102 UxPutTextFontList( SelectDescrTable, BoldTextFont );
103 UxPutLabelFontList( SelectDescrTable, BoldTextFont );
104 UxPutButtonFontList( SelectDescrTable, BoldTextFont );
105 UxPutBackground( SelectDescrTable, WindowBackground );
106 UxPutHeight( SelectDescrTable, 400 );
107 UxPutWidth( SelectDescrTable, 350 );
108 UxPutY( SelectDescrTable, 330 );
109 UxPutX( SelectDescrTable, 770 );
110 UxPutUnitType( SelectDescrTable, "pixels" );
111 UxPutResizePolicy( SelectDescrTable, "resize_none" );
112
113 }
114
115 /*******************************************************************************
116 The 'build_' function creates all the swidgets and X widgets,
117 and sets their properties to the values specified in the
118 Property Editor.
119 *******************************************************************************/
120
121 static swidget _Uxbuild_SelectDescrTable()
122 {
123 /* Create the swidgets */
124
125 SelectDescrTable = UxCreateFileSelectionBox( "SelectDescrTable", NO_PARENT );
126 UxPutContext( SelectDescrTable, UxSelectDescrTableContext );
127 UxPutDefaultShell( SelectDescrTable, "topLevelShell" );
128
129
130 _Uxinit_SelectDescrTable();
131
132 /* Create the X widgets */
133
134 UxCreateWidget( SelectDescrTable );
135
136 UxAddCallback( SelectDescrTable, XmNokCallback,
137 okCallback_SelectDescrTable,
138 (XtPointer) UxSelectDescrTableContext );
139 UxAddCallback( SelectDescrTable, XmNcancelCallback,
140 cancelCB_SelectDescrTable,
141 (XtPointer) UxSelectDescrTableContext );
142
143
144 /* Finally, call UxRealizeInterface to create the X windows
145 for the widgets created above. */
146
147 UxRealizeInterface( SelectDescrTable );
148
149 return ( SelectDescrTable );
150 }
151
152 /*******************************************************************************
153 The following function includes the code that was entered
154 in the 'Initial Code' and 'Final Code' sections of the
155 Declarations Editor. This function is called from the
156 'Interface function' below.
157 *******************************************************************************/
158
159 static swidget _Ux_create_SelectDescrTable()
160 {
161 swidget rtrn;
162 _UxCSelectDescrTable *UxContext;
163
164 UxSelectDescrTableContext = UxContext =
165 (_UxCSelectDescrTable *) UxMalloc( sizeof(_UxCSelectDescrTable) );
166
167 rtrn = _Uxbuild_SelectDescrTable();
168
169 return(rtrn);
170 }
171
172 /*******************************************************************************
173 The following is the 'Interface function' which is the
174 external entry point for creating this interface.
175 This function should be called from your application or from
176 a callback function.
177 *******************************************************************************/
178
179 swidget create_SelectDescrTable()
180 {
181 swidget _Uxrtrn;
182
183 _Uxrtrn = _Ux_create_SelectDescrTable();
184
185 return ( _Uxrtrn );
186 }
187
188 /*******************************************************************************
189 END OF FILE
190 *******************************************************************************/
191