LunarCalendar

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

Functions

Types and Values

Includes

#include <lunar/lunar.h>

Description

Functions

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.

Parameters

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.

Parameters

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.

Parameters

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.

Parameters

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.

Parameters

calendar

a LunarCalendar

 

lunar_calendar_get_display_options ()

LunarCalendarDisplayOptions
lunar_calendar_get_display_options (LunarCalendar *calendar);

Returns the current display options of calendar .

Parameters

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).

Parameters

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);

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).

Parameters

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.

Parameters

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);

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().

Parameters

calendar

a LunarCalendar

 

lunar_calendar_thaw ()

void
lunar_calendar_thaw (LunarCalendar *calendar);

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.

Parameters

calendar

a LunarCalendar

 

Types and Values

struct LunarCalendar

struct LunarCalendar {
  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);
};


enum LunarCalendarDisplayOptions

Members

LUNAR_CALENDAR_SHOW_HEADING

   

LUNAR_CALENDAR_SHOW_DAY_NAMES

   

LUNAR_CALENDAR_NO_MONTH_CHANGE

   

LUNAR_CALENDAR_SHOW_WEEK_NUMBERS

   

LUNAR_CALENDAR_WEEK_START_MONDAY

   

LUNAR_CALENDAR_SHOW_LUNAR