/* Monolith calendar widget. * - by Richard W.M. Jones * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Library General Public * License as published by the Free Software Foundation; either * version 2 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Library General Public License for more details. * * You should have received a copy of the GNU Library General Public * License along with this library; if not, write to the Free * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. * * $Id: ml_calendar.h,v 1.4 2003/02/22 15:34:25 rich Exp $ */ #ifndef ML_CALENDAR_H #define ML_CALENDAR_H #include #include struct ml_calendar; typedef struct ml_calendar *ml_calendar; /* Function: new_ml_calendar - monolith calendar widget * Function: ml_calendar_add_calendar * Function: ml_calendar_del_calendar * Function: ml_calendar_set_date * Function: ml_calendar_get_date * * This is the monolith calendar widget. It supports single and * recurring events, alerts, shared calendars, and views of multiple * calendars. * * The schema for this widget can be found in * @code{sql/ml_calendar_create.sql}. * * @code{new_ml_calendar} creates a new calendar widget. @code{pool} * is the pool for allocations, @code{session} is the current session, and * @code{dhf} is a database handle factory. @code{res_name} is the name * of the calendar resource (from the @code{ml_resources} table). * * The function returns the calendar widget, or @code{NULL} if there * was a problem, such as the calendar not existing. * * The calendar widget can view multiple calendars (there must be * at least one calendar in view at all times). * @code{ml_calendar_add_calendar} adds another calendar to the * list of calendars visible. @code{ml_calendar_del_calendar} * removes a calendar. These functions return 0 on success or * -1 on failure (including attempting to delete all the visible * calendars). * * @code{ml_calendar_(set|get)_date} updates the currently displayed * date in the calendar. The @code{ml_calendar_set_date} function changes * the displayed date to the given @code{yyyy/mm/dd}. This date * must be correct, else the calendar throws an assertion error. * Note in particular that the calendar does not support dates * prior to 1900/1/1 and will throw an error if given such a date. * Note also that @code{yyyy} must be a full four-digit year. * @code{ml_calendar_get_date} returns the current date in the * variables pointed to by @code{yyyy}, @code{mm} and @code{dd} (which * are all pointers to @code{int}). */ extern ml_calendar new_ml_calendar (pool, ml_session, const char *conninfo, const char *res_name); extern int ml_calendar_add_calendar (ml_calendar, const char *res_name); extern int ml_calendar_del_calendar (ml_calendar, const char *res_name); extern void ml_calendar_set_date (ml_calendar, int yyyy, int mm, int dd); extern void ml_calendar_get_date (ml_calendar, int *yyyy, int *mm, int *dd); /* This function returns a list of all calendar resources. */ extern const vector _ml_calendar_get_calendars (ml_calendar); #endif /* ML_CALENDAR_H */