cdk_calendar(3) cdk_calendar(3)
NAME
newCDKCalendar, activateCDKCalendar, injectCDKCalendar, setCDKCalendar, setCDKCalendarDate, getCDKCalendarDate, setCDKCalendarDayAttribute, getCDKCalendarDayAttribute, setCDKCalendarMonthAttribute, getCDKCalen- darMonthAttribute, setCDKCalendarYearAttribute, getCDKCalendarYearAt- tribute, setCDKCalendarHighlight, getCDKCalendarHighlight, setCDKCalen- darBox, getCDKCalendarBox, setCDKCalendarMarker, removeCDKCalendar- Marker, drawCDKCalendar, eraseCDKCalendar, destroyCDKCalendar, setCD- KCalendarPreProcess, setCDKCalendarPostProcess - Creates a managed curses calendar widget.
SYNOPSIS
cc [ flag ... ] file ... -lcdk [ library ... ] CDKCALENDAR *newCDKCalendar (CDKSCREEN *cdkscreen, int xpos, int ypos, char *title, int day, int month, int year, chtype dayAttrib, chtype monthAttrib, chtype yearAttrib, chtype highlight, boolean box, boolean shadow); time_t activateCDKCalendar (CDKCALENDAR *calendar, chtype *actions); time_t injectCDKCalendar (CDKCALENDAR *calendar, chtype input); int setCDKCalendar (CDKCALENDAR *calendar, int day, int month, int year, chtype dayAttrib, chtype monthAttrib, chtype yearAttrib, boolean box); void setCDKCalendarDate (CDKCALENDAR *calendar, int day, int month, int year); void getCDKCalendarDate (CDKCALENDAR *calendar, int *day, int *month, int *year); void setCDKCalendarDayAttribute (CDKCALENDAR *calendar, chtype attribute); chtype getCDKCalendarDayAttribute (CDKCALENDAR *calendar); void setCDKCalendarMonthAttribute (CDKCALENDAR *calendar, chtype attribute); chtype getCDKCalendarMonthAttribute (CDKCALENDAR *calendar); void setCDKCalendarYearAttribute (CDKCALENDAR *calendar, chtype attribute); chtype getCDKCalendarYearAttribute (CDKCALENDAR *calendar); void setCDKCalendarHighlight (CDKCALENDAR *calendar, chtype attribute); chtype getCDKCalendarHighlight (CDKCALENDAR *calendar); void setCDKCalendarBox (CDKCALENDAR *calendar, boolean box); boolean getCDKCalendarBox (CDKCALENDAR *calendar); void setCDKCalendarMarker (CDKCALENDAR *calendar, int day, int month, int year, chtype marker); void removeCDKCalendarMarker (CDKCALENDAR *calendar, int day, int month, int year); void moveCDKCalendar (CDKCALENDAR *calendar, int box, int box, boolean relative, boolean refresh); void positionCDKCalendar (CDKCALENDAR *calendar); void drawCDKCalendar (CDKCALENDAR *calendar, boolean box); void eraseCDKCalendar (CDKCALENDAR *calendar); void destroyCDKCalendar (CDKCALENDAR *calendar); void setCDKCalendarPreProcess (CDKCALENDAR *calendar, PROCESSFN call- back, void * data); void setCDKCalendarPostProcess (CDKCALENDAR *calendar, PROCESSFN call- back, void * data); void bindCDKObject (EObjectType widgetType, void *object, chtype key, BINDFN function, void *data);
DESCRIPTION
The Cdk calendar widget creates a pop-up calendar. The calendar widget allows the user to traverse through months/years using the cursor keys.
AVAILABLE FUNCTIONS
CDKCALENDAR *newCDKCalendar (CDKSCREEN *screen, int xpos, int ypos, char *title, int day, int month, int year, chtype dayAttrib, chtype monthAttrib, chtype yearAttrib, chtype highlight, boolean box, boolean shadow); This function creates a pointer to a calendar widget. The screen parameter is the screen you wish this widget to be placed in. The parameter xpos controls the placement of the object along the hori- zontal axis. This parameter can take integer value or one of the pre-defined values of LEFT, RIGHT, and CENTER. The parameter ypos controls the placement of the object along the vertical axis. This parameter can accept an integer value or a pre-defined value of TOP, BOTTOM, and CENTER. The title parameter is the string which will be displayed at the top of the widget. The title can be more than one line; just provide a carriage return character at the line break. The parameters year, month, and day set the initial date of the cal- endar. The three parameters following yearAttrib, monthAttrib, and dayAttrib represent the attributes of the year, month, and day respectfully. The highlight parameter sets the highlight of the cur- rently selected day. The box parameter states whether the widget will be drawn with a box around it or not. The shadow parameter accepts a boolean value to turn the shadow on or off around this widget. If the widget could not be created then a NULL pointer is returned. time_t activateCDKCalendar (CDKCALENDAR *calendar, chtype *actions); This function activates the calendar widget and lets the user inter- act with the widget. The calendar widget is a pointer to a non-NULL calendar widget. If the actions parameter is passed with a non-NULL value, the characters in the array will be injected into the widget. To activate the widget interactively pass in a NULL pointer for actions. If the character entered into this widget is RETURN then this function will return a type of time_t. The time_t type is used in the functions defined in the time.h header file. (do a man on localtime or ctime for more information). If the character entered into this widget was ESCAPE or TAB then this function will return a value of (time_t)-1 and the structure member exitType will be set to vESCAPE_HIT. time_t injectCDKCalendar (CDKCALENDAR *calendar, chtype character); This function injects a single character into the widget. The param- eter calendar is a pointer to a non-NULL calendar widget. The param- eter character is the character to inject into the widget. If the character entered into this widget is RETURN then this function will return a type of time_t. The time_t type is used in the functions defined in the time.h header file. (do a man on localtime or ctime for more information). If the character entered into this widget was ESCAPE or TAB then this function will return a value of (time_t)-1 and the structure member exitType will be set to vESCAPE_HIT. Any other character injected into the widget will set the structure mem- ber exitType to vEARLY_EXIT and the function will return (time_t)-1. void setCDKCalendar (CDKCALENDAR *calendar, int day, int month, int year, chtype dayAttrib, chtype monthAttrib, chtype yearAttrib, chtype highlight, boolean box); This function lets the programmer modify certain elements of an already defined calendar widget. The calendar parameter represents an already defined calendar pointer. The other parameter names cor- respond to the same parameter names listed in the newCDKCalendar function. void setCDKCalendarDate (CDKCALENDAR *calendar, int day, int month, int year); This sets the current date the calendar displays. void getCDKCalendarDate (CDKCALENDAR *calendar, int *day, int *month, int *year); This returns the current date the calendar is displaying. void setCDKCalendarDayAttribute (CDKCALENDAR *calendar, chtype attribute); This sets the attribute of the day in the calendar. chtype getCDKCalendarDayAttribute (CDKCALENDAR *calendar); This returns the attribute of the day attribute of the calendar. void setCDKCalendarMonthAttribute (CDKCALENDAR *calendar, chtype attribute); This sets the attribute of the month in the calendar. chtype getCDKCalendarMonthAttribute (CDKCALENDAR *calendar); This returns the attribute of the month attribute of the calendar. void setCDKCalendarYearAttribute (CDKCALENDAR *calendar, chtype attribute); This sets the attribute of the year in the calendar. chtype getCDKCalendarYearAttribute (CDKCALENDAR *calendar); This returns the attribute of the year attribute of the calendar. void setCDKCalendarHighlight (CDKCALENDAR *calendar, chtype highlight); This function sets the attribute of the highlight bar of the scrolling list portion of the widget. chtype getCDKCalendarHighlight (CDKCALENDAR *calendar); This returns the attribute of the highlight bar of the scrolling list portion of the widget. void setCDKCalendarBox (CDKCALENDAR *calendar, boolean boxWidget); This sets whether or not the widget will be draw with a box around it. boolean getCDKCalendarBox (CDKCALENDAR *calendar); This returns whether or not the widget will be drawn with a box around it. void setCDKCalendarMarker (CDKCALENDAR *calendar, int day, int month, int year, chtype marker); This allows the user to set a marker which will be displayed when the month is drawn. The marker parameter is the attribute to use when drawing the marker. If more than one marker is set on a single day, then the day will blink with the original marker attribute. void removeCDKCalendarMarker (CDKCALENDAR *calendar, int day, int month, int year); This function removes a marker from the calendar. void setCDKCalendarDate (CDKCALENDAR *calendar, int day, int month, int year); This function sets the calendar to the given date. If the value of the day, month, or year parameters is -1 then the current day, month, or year is used to set the date. void moveCDKCalendar (CDKCALENDAR *calendar, int xpos, int ypos, boolean relative, boolean refresh); This function moves the given widget to the given position. The parameters xpos and ypos is the new position of the widget. The parameter xpos can accept an integer value or one of the pre-defined values of TOP, BOTTOM, and CENTER. The parameter ypos can accept an integer value or one of the pre-defined values of LEFT, RIGHT, and CENTER. The parameter relative states whether the xpos/ypos pair is a relative move or an absolute move. For example if xpos = 1 and ypos = 2 and relative = TRUE, then the widget would move one row down and two columns right. If the value of relative was FALSE then the widget would move to the position (1,2). Do not use the values of TOP, BOTTOM, LEFT, RIGHT, or CENTER when relative = TRUE. (weird things may happen). The final parameter refresh is a boolean value which states whether the widget will get refreshed after the move or not. void positionCDKCalendar (CDKCALENDAR *calendar); This function allows the user to move the widget around the screen via the cursor/keypad keys. The following key bindings can be used to move the widget around the screen. Key Bindings Key Action Up Arrow Moves the widget up one line. Down Arrow Moves the widget down one line. Left Arrow Moves the widget left one column Right Arrow Moves the widget right one column Keypad-1 Moves the widget down one line and left one column. Keypad-2 Moves the widget down one line. Keypad-3 Moves the widget down one line and right one column. Keypad-4 Moves the widget left one column Keypad-5 Centers the widget both vertically and horizontally. Keypad-6 Moves the widget right one column Keypad-7 Moves the widget up one line and left one column. Keypad-8 Moves the widget up one line. Keypad-9 Moves the widget up one line and right one column. t Moves the widget to the top of the screen. b Moves the widget to the bottom of the screen. l Moves the widget to the left of the screen. r Moves the widget to the right of the screen. c Centers the widget between the left and right of the window. C Centers the widget between the top and bottom of the window. Escape Returns the widget to its original position. Return Exits the function and leaves the widget where it was. Keypad means that if the keyboard you are using has a keypad, then the Num-Lock light has to be on in order to use the keys as listed. (The numeric keys at the top of the keyboard will work as well.) void drawCDKCalendar (CDKCALENDAR *calendar, boolean box); This function draws the label widget on the screen. The box option draws the widget with or without a box. void eraseCDKCalendar (CDKCALENDAR *calendar); This function removes the widget from the screen. This does NOT destroy the widget. void destroyCDKCalendar (CDKCALENDAR *calendar); This function removes the widget from the screen and frees up any memory the object may be using. void setCDKCalendarPreProcess (CDKCALENDAR *calendar, PROCESSFN function, void *data); This function allows the user to have the widget call a func- tion after a key is hit and before the key is applied to the widget. The parameter function if of type PROCESSFN. The parameter data is a pointer to void. To learn more about pre- processing read the cdk_process manual page. void setCDKCalendarPostProcess (CDKCALENDAR *calendar, PROCESSFN function, void *data); This function allows the user to have the widget call a func- tion after the key has been applied to the widget. The param- eter function if of type PROCESSFN. The parameter data is a pointer to void. To learn more about post-processing read the cdk_process manual page. void bindCDKObject (EObjectType widgetType, void *object, char key, BINDFN function, void *data); This function allows the user to create special key bindings. The widgetType parameter is a defined type which states what Cdk object type is being used. The object parameter is the pointer to the widget object. The widgetType parameter is a defined type which states what Cdk object type is being used. To learn more about the type EObjectType read the cdk_binding manual page. The object parameter is the pointer to the widget object. The key is the character to bind. The function is the function type. To learn more about the key binding callback function types read the cdk_binding manual page. The last parameter data is a pointer to any data that needs to get passed to the callback function.
KEY BINDINGS
When the widget is activated there are several default key bindings which will help the user enter or manipulate the information quickly. The following table outlines the keys and their actions for this wid- get. Key Action Left Arrow Moves the cursor to the previous day. Right Arrow Moves the cursor to the next day. Up Arrow Moves the cursor to the next week. Down Arrow Moves the cursor to the previous week. t Sets the calendar to the current date. T Sets the calendar to the current date. n Advances the calendar one month ahead. N Advances the calendar six months ahead. p Advances the calendar one month back. P Advances the calendar six months back. - Advances the calendar one year ahead. + Advances the calendar one year back. Return Exits the widget and returns a value of time_t which represents the day selected at 1 second after midnight. This also sets the member exitType in the widget structure to the value of vNORMAL. Tab Exits the widget and returns a value of time_t which represents the day selected at 1 second after midnight. This also sets the member exitType in the widget structure to the value of vNORMAL. Escape Exits the widget and returns (time_)-1. This also sets the structure member exitType to the value of vESCAPE_HIT. Ctrl-L Refreshes the screen.
SEE ALSO
cdk(3), cdk_binding(3), cdk_display(3), cdk_screen(3)
NOTES
The header file <cdk.h> automatically includes the header files <curses.h>, <stdlib.h>, <string.h>, <ctype.h>, <unistd.h>, <dirent.h>, <time.h>, <errno.h>, <pwd.h>, <grp.h>, <sys/stat.h>, and <sys/types.h>. The <curses.h> header file includes <stdio.h> and <unctrl.h>. If you have Ncurses installed on your machine add -DNCURSES to the com- pile line to include the Ncurses header files instead. 24 April 1997 cdk_calendar(3)
Powered by man-cgi (2024-08-26). Maintained for NetBSD by Kimmo Suominen. Based on man-cgi by Panagiotis Christias.