~ubuntu-branches/ubuntu/trusty/libcdk5/trusty

« back to all changes in this revision

Viewing changes to cli/cdktemplate.c

  • Committer: Bazaar Package Importer
  • Author(s): John Goerzen
  • Date: 2007-06-06 03:54:31 UTC
  • mfrom: (1.1.1 upstream)
  • Revision ID: james.westby@ubuntu.com-20070606035431-ba4gdvw0h6ybffsu
Tags: 5.0.20060507-1
* New upstream release.
* Fixed header patching.  Patch from Robert Schiele.
  Closes: #402978, #416336.
* Update widget count in description.  Closes: #294709.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
/* $Id: cdktemplate.c,v 1.7 2005/03/08 19:52:57 tom Exp $ */
 
1
/* $Id: cdktemplate.c,v 1.9 2005/12/27 17:49:32 tom Exp $ */
2
2
 
3
 
#include <cdk.h>
 
3
#include <cdk_test.h>
4
4
 
5
5
#ifdef XCURSES
6
6
char *XCursesProgramName="cdktemplate";
74
74
   if (plate == 0)
75
75
   {
76
76
      fprintf (stderr, "Usage: %s %s\n", argv[0], FPUsage);
77
 
      exit (-1);
 
77
      ExitProgram (CLI_ERROR);
78
78
   }
79
79
 
80
80
   /* If the user asked for an output file, try to open it. */
83
83
      if ((fp = fopen (outputFile, "w")) == 0)
84
84
      {
85
85
         fprintf (stderr, "%s: Can not open output file %s\n", argv[0], outputFile);
86
 
         exit (-1);
 
86
         ExitProgram (CLI_ERROR);
87
87
      }
88
88
   }
89
89
 
122
122
      destroyCDKScreen (cdkScreen);
123
123
      endCDK();
124
124
 
125
 
      /* Spit out the message. */
126
125
      fprintf (stderr, "Error: Could not create the template field. Is the window too small?\n");
127
126
 
128
 
      /* Exit with an error. */
129
 
      exit (-1);
 
127
      ExitProgram (CLI_ERROR);
130
128
   }
131
129
 
132
130
   /* Split the buttons if they supplied some. */
147
145
      setCDKButtonboxULChar (buttonWidget, ACS_LTEE);
148
146
      setCDKButtonboxURChar (buttonWidget, ACS_RTEE);
149
147
 
150
 
     /*
151
 
      * We need to set the lower left and right
152
 
      * characters of the widget.
153
 
      */
 
148
      /*
 
149
       * We need to set the lower left and right
 
150
       * characters of the widget.
 
151
       */
154
152
      setCDKTemplateLLChar (widget, ACS_LTEE);
155
153
      setCDKTemplateLRChar (widget, ACS_RTEE);
156
154
 
157
 
     /*
158
 
      * Bind the Tab key in the widget to send a
159
 
      * Tab key to the button box widget.
160
 
      */
 
155
      /*
 
156
       * Bind the Tab key in the widget to send a
 
157
       * Tab key to the button box widget.
 
158
       */
161
159
      bindCDKObject (vTEMPLATE, widget, KEY_TAB, widgetCB, buttonWidget);
162
160
      bindCDKObject (vTEMPLATE, widget, CDK_NEXT, widgetCB, buttonWidget);
163
161
      bindCDKObject (vTEMPLATE, widget, CDK_PREV, widgetCB, buttonWidget);
169
167
      drawCDKButtonbox (buttonWidget, boxWidget);
170
168
   }
171
169
 
172
 
  /*
173
 
   * If the user asked for a shadow, we need to create one.
174
 
   * I do this instead of using the shadow parameter because
175
 
   * the button widget sin't part of the main widget and if
176
 
   * the user asks for both buttons and a shadow, we need to
177
 
   * create a shadow big enough for both widgets. We'll create
178
 
   * the shadow window using the widgets shadowWin element, so
179
 
   * screen refreshes will draw them as well.
180
 
   */
 
170
   /*
 
171
    * If the user asked for a shadow, we need to create one.  Do this instead
 
172
    * of using the shadow parameter because the button widget is not part of
 
173
    * the main widget and if the user asks for both buttons and a shadow, we
 
174
    * need to create a shadow big enough for both widgets.  Create the shadow
 
175
    * window using the widgets shadowWin element, so screen refreshes will draw
 
176
    * them as well.
 
177
    */
181
178
   if (shadowWidget == TRUE)
182
179
   {
183
180
      /* Determine the height of the shadow window. */
196
193
      {
197
194
         widget->shadow = TRUE;
198
195
 
199
 
        /*
200
 
         * We force the widget and buttonWidget to be drawn so the
201
 
         * buttonbox widget will be drawn when the widget is activated.
202
 
         * Otherwise the shadow window will draw over the button widget.
203
 
         */
 
196
         /*
 
197
          * We force the widget and buttonWidget to be drawn so the
 
198
          * buttonbox widget will be drawn when the widget is activated.
 
199
          * Otherwise the shadow window will draw over the button widget.
 
200
          */
204
201
         drawCDKTemplate (widget, ObjOf(widget)->box);
205
202
         eraseCDKButtonbox (buttonWidget);
206
203
         drawCDKButtonbox (buttonWidget, ObjOf(buttonWidget)->box);
250
247
      fprintf (fp, "%s\n", answer);
251
248
      freeChar (answer);
252
249
   }
 
250
   fclose (fp);
253
251
 
254
252
   /* Exit with the button number picked. */
255
 
   exit (selection);
 
253
   ExitProgram (selection);
256
254
}
257
255
 
258
256
static int widgetCB (EObjectType cdktype GCC_UNUSED, void *object GCC_UNUSED, void *clientData, chtype key)