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

« back to all changes in this revision

Viewing changes to examples/scroll_ex.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: scroll_ex.c,v 1.20 2005/04/15 19:44:43 tom Exp $ */
 
1
/* $Id: scroll_ex.c,v 1.22 2005/12/28 02:01:48 tom Exp $ */
2
2
 
3
 
#include <cdk.h>
 
3
#include <cdk_test.h>
4
4
 
5
5
#ifdef HAVE_XCURSES
6
6
char *XCursesProgramName = "scroll_ex";
55
55
 
56
56
/*
57
57
 * This program demonstrates the Cdk scrolling list widget.
 
58
 *
 
59
 * Options (in addition to normal CLI parameters):
 
60
 *      -c      create the data after the widget
 
61
 *      -s SPOS location for the scrollbar
 
62
 *      -t TEXT title for the widget
58
63
 */
59
64
int main (int argc, char **argv)
60
65
{
69
74
 
70
75
   CDK_PARAMS params;
71
76
 
72
 
   CDKparseParams (argc, argv, &params, "s:t:" CDK_CLI_PARAMS);
 
77
   CDKparseParams (argc, argv, &params, "cs:t:" CDK_CLI_PARAMS);
73
78
 
74
79
   /* Set up CDK. */
75
80
   cursesWin = initscr ();
89
94
                              CDKparamValue (&params, 'H', 10),
90
95
                              CDKparamValue (&params, 'W', 50),
91
96
                              CDKparamString2(&params, 't', title),
92
 
                              item, count,
 
97
                              CDKparamNumber(&params, 'c') ? 0 : item,
 
98
                              CDKparamNumber(&params, 'c') ? 0 : count,
93
99
                              TRUE,
94
100
                              A_REVERSE,
95
101
                              CDKparamValue (&params, 'N', TRUE),
105
111
      /* Print out a message and exit. */
106
112
      printf
107
113
              ("Oops. Could not make scrolling list. Is the window too small?\n");
108
 
      exit (EXIT_FAILURE);
 
114
      ExitProgram (EXIT_FAILURE);
109
115
   }
110
116
 
 
117
   if (CDKparamNumber(&params, 'c'))
 
118
   {
 
119
      setCDKScrollItems (scrollList, item, count, TRUE);
 
120
   }
111
121
#if 0
112
122
   drawCDKScroll (scrollList, 1);
113
123
 
159
169
   destroyCDKScroll (scrollList);
160
170
   destroyCDKScreen (cdkscreen);
161
171
   endCDK ();
162
 
   exit (EXIT_SUCCESS);
 
172
   ExitProgram (EXIT_SUCCESS);
163
173
}