1cdk_calendar(3)            Library Functions Manual            cdk_calendar(3)
2
3
4

NAME

6       cdk_calendar - curses calendar widget.
7

SYNOPSIS

9       cc [ flag ... ] file ...  -lcdk [ library ... ]
10
11       #include <cdk.h>
12
13       time_t activateCDKCalendar (CDKCALENDAR * calendar ,
14                      chtype *actions);
15
16       void destroyCDKCalendar (
17                      CDKCALENDAR *calendar);
18
19       void drawCDKCalendar (CDKCALENDAR * calendar ,
20                      boolean box);
21
22       void eraseCDKCalendar (
23                      CDKCALENDAR *calendar);
24
25       boolean getCDKCalendarBox (
26                      CDKCALENDAR *calendar);
27
28       void getCDKCalendarDate (CDKCALENDAR * calendar ,
29                      int *day,
30                      int *month,
31                      int *year);
32
33       chtype getCDKCalendarDayAttribute (
34                      CDKCALENDAR *calendar);
35
36       chtype getCDKCalendarHighlight (
37                      CDKCALENDAR *calendar);
38
39       chtype getCDKCalendarMarker (
40                      CDKCALENDAR *calendar,
41                      int day,
42                      int month,
43                      int year);
44
45       chtype getCDKCalendarMonthAttribute (
46                      CDKCALENDAR *calendar);
47
48       chtype getCDKCalendarYearAttribute (
49                      CDKCALENDAR *calendar);
50
51       time_t injectCDKCalendar (
52                      CDKCALENDAR *calendar,
53                      chtype input);
54
55       void moveCDKCalendar (
56                      CDKCALENDAR *calendar,
57                      int xpos,
58                      int ypos,
59                      boolean relative,
60                      boolean refresh);
61
62       CDKCALENDAR *newCDKCalendar (CDKSCREEN * cdkscreen ,
63                      int xpos,
64                      int ypos,
65                      const char *title,
66                      int day,
67                      int month,
68                      int year,
69                      chtype dayAttrib,
70                      chtype monthAttrib,
71                      chtype yearAttrib,
72                      chtype highlight,
73                      boolean box,
74                      boolean shadow);
75
76       void positionCDKCalendar (
77                      CDKCALENDAR *calendar);
78
79       void removeCDKCalendarMarker (
80                      CDKCALENDAR *calendar,
81                      int day,
82                      int month,
83                      int year);
84
85       void setCDKCalendar (
86                      CDKCALENDAR *calendar,
87                      int day,
88                      int month,
89                      int year,
90                      chtype dayAttrib,
91                      chtype monthAttrib,
92                      chtype yearAttrib,
93                      chtype highlight,
94                      boolean box);
95
96       void setCDKCalendarBackgroundAttrib (
97                      CDKCALENDAR *calendar,
98                      chtype attribute);
99
100       void setCDKCalendarBackgroundColor (
101                      CDKCALENDAR *calendar,
102                      const char * color);
103
104       void setCDKCalendarBox (
105                      CDKCALENDAR *calendar,
106                      boolean box);
107
108       setCDKCalendarBoxAttribute ("
109                      CDKCALENDAR *calendar,
110                      chtype ch);
111
112       void setCDKCalendarDate (
113                      CDKCALENDAR *calendar,
114                      int day,
115                      int month,
116                      int year);
117
118       void setCDKCalendarDayAttribute (
119                      CDKCALENDAR *calendar,
120                      chtype attribute);
121
122       void setCDKCalendarDaysNames (
123                      CDKCALENDAR *calendar,
124                      const char *days);
125
126       void setCDKCalendarHighlight (
127                      CDKCALENDAR *calendar,
128                      chtype attribute);
129
130       void setCDKCalendarHorizontalChar (
131                      CDKCALENDAR *calendar,
132                      chtype ch);
133
134       void setCDKCalendarLLChar (
135                      CDKCALENDAR *calendar,
136                      chtype ch);
137
138       void setCDKCalendarLRChar (
139                      CDKCALENDAR *calendar,
140                      chtype ch);
141
142       void setCDKCalendarMarker (
143                      CDKCALENDAR *calendar,
144                      int day,
145                      int month,
146                      int year,
147                      chtype marker);
148
149       void setCDKCalendarMonthAttribute (
150                      CDKCALENDAR *calendar,
151                      chtype attribute);
152
153       void setCDKCalendarMonthsNames (
154                      CDKCALENDAR *calendar,
155                      CDK_CONST char **months);
156
157       void setCDKCalendarPostProcess (
158                      CDKCALENDAR *calendar,
159                      PROCESSFN callback,
160                      void * data);
161
162       void setCDKCalendarPreProcess (
163                      CDKCALENDAR *calendar,
164                      PROCESSFN callback,
165                      void * data);
166
167       setCDKCalendarULChar ("
168                      CDKCALENDAR *calendar,
169                      chtype ch);
170
171       setCDKCalendarURChar ("
172                      CDKCALENDAR *calendar,
173                      chtype ch);
174
175       setCDKCalendarVerticalChar ("
176                      CDKCALENDAR *calendar,
177                      chtype ch);
178
179       void setCDKCalendarYearAttribute (
180                      CDKCALENDAR *calendar,
181                      chtype attribute);
182

DESCRIPTION

184       The Cdk calendar widget creates a pop-up calendar.  The calendar widget
185       allows the user to traverse through months/years using the cursor keys.
186

AVAILABLE FUNCTIONS

188       activateCDKCalendar
189            activates the calendar widget and lets the user interact with  the
190            widget.
191
192            ·   The  calendar  widget is a pointer to a non-NULL calendar wid‐
193                get.
194
195            ·   If the actions parameter is passed with a non-NULL value,  the
196                characters in the array will be injected into the widget.
197
198                To  activate  the  widget interactively pass in a NULL pointer
199                for actions.
200
201                If the character entered into this widget is RETURN then  this
202                function will return a type of time_t.
203
204            ·   The time_t type is used in the functions defined in the time.h
205                header file.  (see localtime or ctime for more information).
206
207            If the character entered into this widget was ESCAPE or  TAB  then
208            this  function  will  return  a value of (time_t)-1 and the widget
209            data exitType will be set to vESCAPE_HIT.
210
211       destroyCDKCalendar
212            removes the widget from the screen and  frees  memory  the  object
213            used.
214
215       drawCDKCalendar
216            draws the label widget on the screen.
217
218            If the box parameter is true, the widget is drawn with a box.
219
220       eraseCDKCalendar
221            removes  the  widget  from  the screen.  This does NOT destroy the
222            widget.
223
224       getCDKCalendarBox
225            returns whether the widget will be drawn with a box around it.
226
227       getCDKCalendarDate
228            returns the current date the calendar is displaying.
229
230       getCDKCalendarDayAttribute
231            returns the attribute of the day attribute of the calendar.
232
233       getCDKCalendarHighlight
234            returns the attribute of the highlight bar of the  scrolling  list
235            portion of the widget.
236
237       getCDKCalendarMarker
238            returns the marker set on the calendar by setCDKCalendarMarker.
239
240       getCDKCalendarMonthAttribute
241            returns the attribute of the month attribute of the calendar.
242
243       getCDKCalendarYearAttribute
244            returns the attribute of the year attribute of the calendar.
245
246       injectCDKCalendar
247            injects a single character into the widget.
248
249            ·   The  parameter  calendar  is  a pointer to a non-NULL calendar
250                widget.
251
252            ·   The parameter character is the character to  inject  into  the
253                widget.
254
255            The  return  value  and side-effect (setting the widget data exit‐
256            Type) depend upon the injected character:
257
258            RETURN or TAB
259                   the function returns a value of type time_t (see  localtime
260                   or  ctime  for more information).  The widget data exitType
261                   is set to vNORMAL.
262
263            ESCAPE the function returns (time_t)-1.  The widget data  exitType
264                   is set to vESCAPE_HIT.
265
266            Otherwise
267                   unless  modified  by  preprocessing,  postprocessing or key
268                   bindings, the function returns (time_t)-1.  The widget data
269                   exitType is set to vEARLY_EXIT.
270
271       moveCDKCalendar
272            moves the given widget to the given position.
273
274            ·   The  parameters xpos and ypos are the new position of the wid‐
275                get.
276
277                The parameter xpos may be an integer or one of the pre-defined
278                values TOP, BOTTOM, and CENTER.
279
280                The  parameter  ypos  may  be  an  integer, or one of the pre-
281                defined values LEFT, RIGHT, and CENTER.
282
283            ·   The parameter relative states whether the xpos/ypos pair is  a
284                relative move or an absolute move.
285
286                For  example,  if  xpos  = 1 and ypos = 2 and relative = TRUE,
287                then the widget would move one row down and two columns right.
288                If the value of relative was FALSE, then the widget would move
289                to the position (1,2).
290
291                Do not use the values TOP, BOTTOM, LEFT, RIGHT, or CENTER when
292                relative = TRUE.  (weird things may happen).
293
294            ·   The  final  parameter  refresh is a boolean value which states
295                whether the widget will get refreshed after the move.
296
297       newCDKCalendar
298            creates a calendar widget and returns a pointer  to  it.   Parame‐
299            ters:
300
301            screen
302                 is the screen you wish this widget to be placed in.
303
304            xpos controls  the  placement  of  the object along the horizontal
305                 axis.  It may be an integer or one of the pre-defined  values
306                 LEFT, RIGHT, and CENTER.
307
308            ypos controls the placement of the object along the vertical axis.
309                 It may be an integer or one of the  pre-defined  values  TOP,
310                 BOTTOM, and CENTER.
311
312            title
313                 is  the string which will be displayed at the top of the wid‐
314                 get.  The title can be more than one  line;  just  provide  a
315                 carriage return character at the line break.
316
317            year,
318
319            month and
320
321            day
322                 set the initial date of the calendar.
323
324            yearAttrib,
325
326            monthAttrib and
327
328            dayAttrib
329                 represent  the attributes of the year, month, and day respec‐
330                 tively.
331
332            highlight
333                 sets the highlight of the currently selected day.
334
335            box  is true if the widget should be drawn with a box around it.
336
337            shadow
338                 turns the shadow on or off around this widget.
339
340            If the widget  could  not  be  created  then  a  NULL  pointer  is
341            returned.
342
343       positionCDKCalendar
344            allows  the user to move the widget around the screen via the cur‐
345            sor/keypad keys.  See cdk_position (3) for key bindings.
346
347       removeCDKCalendarMarker
348            removes a marker from the calendar.
349
350       setCDKCalendar
351            lets the programmer modify certain elements of an existing  calen‐
352            dar widget.
353
354            ·   The   calendar   parameter  represents  an  existing  calendar
355                pointer.
356
357            ·   The other parameter names correspond  to  the  same  parameter
358                names listed in the newCDKCalendar function.
359
360       setCDKCalendarBackgroundAttrib
361            sets the background attribute of the widget.
362
363            The parameter attribute is a curses attribute, e.g., A_BOLD.
364
365       setCDKCalendarBackgroundColor
366            sets the background color of the widget.
367
368            The parameter color is in the format of the Cdk format strings.
369
370            See cdk_display (3).
371
372       setCDKCalendarBox
373            sets whether the widget will be drawn with a box around it.
374
375       setCDKCalendarBoxAttribute
376            sets the attribute of the box.
377
378       setCDKCalendarDate
379            sets the calendar to the given date.
380
381            If  the value of the day, month, or year parameters is -1 then the
382            current day, month, or year is used to set the date.
383
384       setCDKCalendarDayAttribute
385            sets the attribute of the day in the calendar.
386
387       setCDKCalendarDaysNames
388            sets the names of the days of the week.
389
390            The parameter is a string listing  the  2-character  abbreviations
391            for the days.
392
393            The default value is
394            "Su Mo Tu We Th Fr Sa"
395
396            "Su"  (Sunday)  is  numbered zero internally, making it by default
397            the first day of the week.  Set the weekBase member of the  widget
398            to  select a different day.  For example, Monday would be 1, Tues‐
399            day 2, etc.
400
401       setCDKCalendarHighlight
402            sets the attribute of the highlight bar of the scrolling list por‐
403            tion of the widget.
404
405       setCDKCalendarHorizontalChar
406            sets  the  horizontal  drawing  character for the box to the given
407            character.
408
409       setCDKCalendarLLChar
410            sets the lower left hand corner of the widget's box to  the  given
411            character.
412
413       setCDKCalendarLRChar
414            sets  the lower right hand corner of the widget's box to the given
415            character.
416
417       setCDKCalendarMarker
418            allows the user to set a marker which will be displayed  when  the
419            month is drawn.
420
421            The  marker  parameter  is  the  attribute to use when drawing the
422            marker.  If more than one marker is set on a single day, then  the
423            day will blink with the original marker attribute.
424
425       setCDKCalendarMonthAttribute
426            sets the attribute of the month in the calendar.
427
428       setCDKCalendarMonthsNames
429            sets the names of the months of the year.
430
431            The  parameter  is  a 13-element array (since indexing starts with
432            1).
433
434            The default values are the English month names, e.g., "January".
435
436       setCDKCalendarPostProcess
437            allows the user to have the widget call a function after  the  key
438            has been applied to the widget.
439
440            ·   The parameter function is the callback function.
441
442            ·   The parameter data points to data passed to the callback func‐
443                tion.
444
445            To learn more about post-processing see cdk_process (3).
446
447       setCDKCalendarPreProcess
448            allows the user to have the widget call a function after a key  is
449            hit and before the key is applied to the widget.
450
451            ·   The parameter function is the callback function.
452
453            ·   The parameter data points to data passed to the callback func‐
454                tion.
455
456            To learn more about pre-processing see cdk_process (3).
457
458       setCDKCalendarULChar
459            sets the upper left hand corner of the widget's box to  the  given
460            character.
461
462       setCDKCalendarURChar
463            sets  the upper right hand corner of the widget's box to the given
464            character.
465
466       setCDKCalendarVerticalChar
467            sets the vertical drawing character for the box to the given char‐
468            acter.
469
470       setCDKCalendarYearAttribute
471            sets the attribute of the year in the calendar.
472

KEY BINDINGS

474       When  the  widget  is  activated there are several default key bindings
475       which will help the user enter or manipulate the  information  quickly.
476       The  following  table outlines the keys and their actions for this wid‐
477       get.
478
479             ┌────────────────┬─────────────────────────────────────────┐
480Key             Action                                  
481             ├────────────────┼─────────────────────────────────────────┤
482             ├────────────────┼─────────────────────────────────────────┤
483             │Left Arrow      │ Moves the cursor to the previous day.   │
484             ├────────────────┼─────────────────────────────────────────┤
485             │Right Arrow     │ Moves the cursor to the next day.       │
486             ├────────────────┼─────────────────────────────────────────┤
487             │Up Arrow        │ Moves the cursor to the next week.      │
488             ├────────────────┼─────────────────────────────────────────┤
489             │Down Arrow      │ Moves the cursor to the previous week.  │
490             ├────────────────┼─────────────────────────────────────────┤
491             │t               │ Sets the calendar to the current date.  │
492             ├────────────────┼─────────────────────────────────────────┤
493             │T               │ Sets the calendar to the current date.  │
494             ├────────────────┼─────────────────────────────────────────┤
495             │n               │ Advances the calendar one month ahead.  │
496             ├────────────────┼─────────────────────────────────────────┤
497             │N               │ Advances the calendar six months ahead. │
498             ├────────────────┼─────────────────────────────────────────┤
499             │p               │ Advances the calendar one month back.   │
500             ├────────────────┼─────────────────────────────────────────┤
501             │P               │ Advances the calendar six months back.  │
502             ├────────────────┼─────────────────────────────────────────┤
503             │-               │ Advances the calendar one year ahead.   │
504             ├────────────────┼─────────────────────────────────────────┤
505             │+               │ Advances the calendar one year back.    │
506             ├────────────────┼─────────────────────────────────────────┤
507             │Return          │ Exits the widget and returns a value of │
508             │                │ time_t   which   represents   the   day │
509             │                │ selected at 1  second  after  midnight. │
510             │                │ This also sets the widget data exitType
511             │                │ to vNORMAL.                             │
512             ├────────────────┼─────────────────────────────────────────┤
513             │Tab             │ Exits the widget and returns a value of │
514             │                │ time_t   which   represents   the   day │
515             │                │ selected at 1  second  after  midnight. │
516             │                │ This also sets the widget data exitType
517             │                │ to vNORMAL.                             │
518             ├────────────────┼─────────────────────────────────────────┤
519             │Escape          │ Exits the widget and returns (time_)-1. │
520             │                │ This also sets the widget data exitType
521             │                │ to vESCAPE_HIT.                         │
522             ├────────────────┼─────────────────────────────────────────┤
523             │Ctrl-L          │ Refreshes the screen.                   │
524             └────────────────┴─────────────────────────────────────────┘

SEE ALSO

526       cdk(3), cdk_binding(3), cdk_display(3), cdk_position(3), cdk_screen(3)
527
528
529
530                                                               cdk_calendar(3)
Impressum