LunarCalendar

## LunarCalendar LunarCalendar — a gtk widget that can displays a chinese lunar calendar |

## Synopsis

    #include <lunar/lunar.h>

                        LunarCalendar;
    enum                LunarCalendarDisplayOptions;
    GtkWidget*          lunar_calendar_new                  (void);
    gboolean            lunar_calendar_select_month         (LunarCalendar *calendar,
                                                             guint month,
                                                             guint year);
    void                lunar_calendar_select_day           (LunarCalendar *calendar,
                                                             guint day);
    gboolean            lunar_calendar_mark_day             (LunarCalendar *calendar,
                                                             guint day);
    gboolean            lunar_calendar_unmark_day           (LunarCalendar *calendar,
                                                             guint day);
    void                lunar_calendar_clear_marks          (LunarCalendar *calendar);
    LunarCalendarDisplayOptions lunar_calendar_get_display_options
                                                            (LunarCalendar *calendar);
    void                lunar_calendar_set_display_options  (LunarCalendar *calendar,
                                                             LunarCalendarDisplayOptions flags);
    void                lunar_calendar_display_options      (LunarCalendar *calendar,
                                                             LunarCalendarDisplayOptions flags);
    void                lunar_calendar_get_date             (LunarCalendar *calendar,
                                                             guint *year,
                                                             guint *month,
                                                             guint *day);
    void                lunar_calendar_freeze               (LunarCalendar *calendar);
    void                lunar_calendar_thaw                 (LunarCalendar *calendar);

## Description

## Details

### LunarCalendar

    typedef struct {
      GtkWidget widget;

      GtkStyle  *header_style;
      GtkStyle  *label_style;

      gint month;
      gint year;
      gint selected_day;

      gint day_month[6][7];
      gint day[6][7];

      gint num_marked_dates;
      gint marked_date[31];
      LunarCalendarDisplayOptions  display_flags;
      GdkColor marked_date_color[31];

      GdkGC *gc;			/* unused */
      GdkGC *xor_gc;		/* unused */

      gint focus_row;
      gint focus_col;

      gint highlight_row;
      gint highlight_col;

      LunarCalendarPrivate *priv;
      gchar grow_space [32];

      /* Padding for future expansion */
      void (*_gtk_reserved1) (void);
      void (*_gtk_reserved2) (void);
      void (*_gtk_reserved3) (void);
      void (*_gtk_reserved4) (void);
    } LunarCalendar;

### enum LunarCalendarDisplayOptions

    typedef enum
    {
      LUNAR_CALENDAR_SHOW_HEADING		= 1 << 0,
      LUNAR_CALENDAR_SHOW_DAY_NAMES		= 1 << 1,
      LUNAR_CALENDAR_NO_MONTH_CHANGE		= 1 << 2,
      LUNAR_CALENDAR_SHOW_WEEK_NUMBERS	= 1 << 3,
      LUNAR_CALENDAR_WEEK_START_MONDAY	= 1 << 4,
      LUNAR_CALENDAR_SHOW_LUNAR		= 1 << 5
    } LunarCalendarDisplayOptions;

### lunar_calendar_new ()

    GtkWidget*          lunar_calendar_new                  (void);

Creates a new calendar, with the current date being selected.

Returns : | a newly LunarCalendar widget

### lunar_calendar_select_month ()

    gboolean            lunar_calendar_select_month         (LunarCalendar *calendar,
                                                             guint month,
                                                             guint year);

Shifts the calendar to a different month.

`calendar` : | a LunarCalendar
`month` : | a month number between 0 and 11.
`year` : | the year the month is in.
Returns : | `TRUE`, always

### lunar_calendar_select_day ()

    void                lunar_calendar_select_day           (LunarCalendar *calendar,
                                                             guint day);

Selects a day from the current month.

`calendar` : | a LunarCalendar.
`day` : | the day number between 1 and 31, or 0 to unselect the currently selected day.

### lunar_calendar_mark_day ()

    gboolean            lunar_calendar_mark_day             (LunarCalendar *calendar,
                                                             guint day);

Places a visual marker on a particular day.

`calendar` : | a LunarCalendar
`day` : | the day number to mark between 1 and 31.
Returns : | `TRUE`, always

### lunar_calendar_unmark_day ()

    gboolean            lunar_calendar_unmark_day           (LunarCalendar *calendar,
                                                             guint day);

Removes the visual marker from a particular day.

`calendar` : | a LunarCalendar.
`day` : | the day number to unmark between 1 and 31.
Returns : | `TRUE`, always

### lunar_calendar_clear_marks ()

    void                lunar_calendar_clear_marks          (LunarCalendar *calendar);

Remove all visual markers.

`calendar` : | a LunarCalendar

### lunar_calendar_get_display_options ()

    LunarCalendarDisplayOptions lunar_calendar_get_display_options
                                                            (LunarCalendar *calendar);

Returns the current display options of `calendar`.

`calendar` : | a LunarCalendar
Returns : | the display options.

Since 2.4

### lunar_calendar_set_display_options ()

    void                lunar_calendar_set_display_options  (LunarCalendar *calendar,
                                                             LunarCalendarDisplayOptions flags);

Sets display options (whether to display the heading and the month headings).

`calendar` : | a LunarCalendar
`flags` : | the display options to set

Since 2.4

### lunar_calendar_display_options ()

    void                lunar_calendar_display_options      (LunarCalendar *calendar,
                                                             LunarCalendarDisplayOptions flags);

### Warning

`lunar_calendar_display_options` has been deprecated since version 2.4 and should not be used in newly-written code. Use `lunar_calendar_set_display_options()` instead

Sets display options (whether to display the heading and the month headings).

`calendar` : | a LunarCalendar.
`flags` : | the display options to set.

### lunar_calendar_get_date ()

    void                lunar_calendar_get_date             (LunarCalendar *calendar,
                                                             guint *year,
                                                             guint *month,
                                                             guint *day);

Obtains the selected date from a LunarCalendar.

`calendar` : | a LunarCalendar
`year` : | location to store the year number, or `NULL`
`month` : | location to store the month number (between 0 and 11), or `NULL`
`day` : | location to store the day number (between 1 and 31), or `NULL`

### lunar_calendar_freeze ()

    void                lunar_calendar_freeze               (LunarCalendar *calendar);

### Warning

`lunar_calendar_freeze` has been deprecated since version 2.8 and should not be used in newly-written code.

Does nothing. Previously locked the display of the calendar until it was thawed with `lunar_calendar_thaw()`.

`calendar` : | a LunarCalendar

### lunar_calendar_thaw ()

    void                lunar_calendar_thaw                 (LunarCalendar *calendar);

### Warning

`lunar_calendar_thaw` has been deprecated since version 2.8 and should not be used in newly-written code.

Does nothing. Previously defrosted a calendar; all the changes made since the last `lunar_calendar_freeze()` were displayed.

`calendar` : | a LunarCalendar