88
88
/* Maybe they gave a filename to use to read. */
91
/* Read the file in. */
92
scrollLines = CDKreadFile (filename, &scrollList);
91
/* Read the file in. */
92
scrollLines = CDKreadFile (filename, &scrollList);
94
/* Check if there was an error. */
95
if (scrollLines == -1)
97
fprintf (stderr, "Error: Could not open the file '%s'.\n", filename);
94
/* Check if there was an error. */
95
if (scrollLines == -1)
97
fprintf (stderr, "Error: Could not open the file '%s'.\n", filename);
98
ExitProgram (CLI_ERROR);
103
/* They didn't provide anything. */
104
fprintf (stderr, "Usage: %s %s\n", argv[0], FPUsage);
103
/* They didn't provide anything. */
104
fprintf (stderr, "Usage: %s %s\n", argv[0], FPUsage);
105
ExitProgram (CLI_ERROR);
155
155
/* Make sure we could create the widget. */
158
/* Clean up some memory. */
159
158
CDKfreeStrings(scrollList);
161
/* Shut down curses and CDK. */
162
159
destroyCDKScreen (cdkScreen);
165
/* Spit out the message. */
166
162
fprintf (stderr, "Error: Could not create the alphalist. Is the window too small?\n");
168
/* Exit with an error. */
164
ExitProgram (CLI_ERROR);
172
167
/* Split the buttons if they supplied some. */
173
168
if (buttons != 0)
175
/* Split the button list up. */
176
170
buttonList = CDKsplitString (buttons, '\n');
177
171
buttonCount = CDKcountStrings (buttonList);
179
/* We need to create a buttonbox widget. */
180
173
buttonWidget = newCDKButtonbox (cdkScreen,
181
174
getbegx (widget->win) + 1,
182
175
getbegy (widget->win) + widget->boxHeight - 1,
184
177
0, 1, buttonCount,
185
178
buttonList, buttonCount,
186
179
A_REVERSE, boxWidget, FALSE);
180
CDKfreeStrings(buttonList);
187
182
setCDKButtonboxULChar (buttonWidget, ACS_LTEE);
188
183
setCDKButtonboxURChar (buttonWidget, ACS_RTEE);
191
* We need to set the lower left and right
192
* characters of the entry field.
186
* We need to set the lower left and right
187
* characters of the entry field.
194
189
setCDKAlphalistLLChar (widget, ACS_LTEE);
195
190
setCDKAlphalistLRChar (widget, ACS_RTEE);
198
* Bind the Tab key in the entry field to send a
199
* Tab key to the button box widget.
193
* Bind the Tab key in the entry field to send a
194
* Tab key to the button box widget.
201
196
bindCDKObject (vENTRY, widget->entryField, KEY_RIGHT, widgetCB, buttonWidget);
202
197
bindCDKObject (vENTRY, widget->entryField, KEY_LEFT, widgetCB, buttonWidget);
203
198
bindCDKObject (vENTRY, widget->entryField, CDK_NEXT, widgetCB, buttonWidget);
204
199
bindCDKObject (vENTRY, widget->entryField, CDK_PREV, widgetCB, buttonWidget);
206
/* Check if the user wants to set the background of the widget. */
207
201
setCDKButtonboxBackgroundColor (buttonWidget, CDK_WIDGET_COLOR);
209
/* Draw the button widget. */
210
203
drawCDKButtonbox (buttonWidget, boxWidget);
214
* If the user asked for a shadow, we need to create one.
215
* I do this instead of using the shadow parameter because
216
* the button widget sin't part of the main widget and if
217
* the user asks for both buttons and a shadow, we need to
218
* create a shadow big enough for both widgets. We'll create
219
* the shadow window using the widgets shadowWin element, so
220
* screen refreshes will draw them as well.
207
* If the user asked for a shadow, we need to create one. Do this instead
208
* of using the shadow parameter because the button widget is not part of
209
* the main widget and if the user asks for both buttons and a shadow, we
210
* need to create a shadow big enough for both widgets. Create the shadow
211
* window using the widgets shadowWin element, so screen refreshes will draw
222
214
if (shadowWidget == TRUE)
224
216
/* Determine the height of the shadow window. */
235
227
/* Make sure we could have created the shadow window. */
236
228
if (widget->shadowWin != 0)
238
widget->shadow = TRUE;
230
widget->shadow = TRUE;
241
* We force the widget and buttonWidget to be drawn so the
242
* buttonbox widget will be drawn when the widget is activated.
243
* Otherwise the shadow window will draw over the button widget.
245
drawCDKAlphalist (widget, ObjOf(widget)->box);
246
eraseCDKButtonbox (buttonWidget);
247
drawCDKButtonbox (buttonWidget, ObjOf(buttonWidget)->box);
233
* We force the widget and buttonWidget to be drawn so the
234
* buttonbox widget will be drawn when the widget is activated.
235
* Otherwise the shadow window will draw over the button widget.
237
drawCDKAlphalist (widget, ObjOf(widget)->box);
238
eraseCDKButtonbox (buttonWidget);
239
drawCDKButtonbox (buttonWidget, ObjOf(buttonWidget)->box);