<refentry id="lunar-LunarCalendar">
<refmeta>
<refentrytitle role="top_of_page" id="lunar-LunarCalendar.top_of_page">LunarCalendar</refentrytitle>
<manvolnum>3</manvolnum>
<refmiscinfo>LUNAR Library</refmiscinfo>
</refmeta>

<refnamediv>
<refname>LunarCalendar</refname>
<refpurpose>a gtk widget that can displays a chinese lunar calendar</refpurpose>
<!--[<xref linkend="desc" endterm="desc.title"/>]-->
</refnamediv>

<refsynopsisdiv id="lunar-LunarCalendar.synopsis" role="synopsis">
<title role="synopsis.title">Synopsis</title>

<synopsis>

#include &lt;lunar/lunar.h&gt;

                    <link linkend="LunarCalendar">LunarCalendar</link>;
enum                <link linkend="LunarCalendarDisplayOptions">LunarCalendarDisplayOptions</link>;
<link linkend="GtkWidget">GtkWidget</link>*          <link linkend="lunar-calendar-new">lunar_calendar_new</link>                  (void);
<link linkend="gboolean">gboolean</link>            <link linkend="lunar-calendar-select-month">lunar_calendar_select_month</link>         (<link linkend="LunarCalendar">LunarCalendar</link> *calendar,
                                                         <link linkend="guint">guint</link> month,
                                                         <link linkend="guint">guint</link> year);
<link linkend="void">void</link>                <link linkend="lunar-calendar-select-day">lunar_calendar_select_day</link>           (<link linkend="LunarCalendar">LunarCalendar</link> *calendar,
                                                         <link linkend="guint">guint</link> day);
<link linkend="gboolean">gboolean</link>            <link linkend="lunar-calendar-mark-day">lunar_calendar_mark_day</link>             (<link linkend="LunarCalendar">LunarCalendar</link> *calendar,
                                                         <link linkend="guint">guint</link> day);
<link linkend="gboolean">gboolean</link>            <link linkend="lunar-calendar-unmark-day">lunar_calendar_unmark_day</link>           (<link linkend="LunarCalendar">LunarCalendar</link> *calendar,
                                                         <link linkend="guint">guint</link> day);
<link linkend="void">void</link>                <link linkend="lunar-calendar-clear-marks">lunar_calendar_clear_marks</link>          (<link linkend="LunarCalendar">LunarCalendar</link> *calendar);
<link linkend="LunarCalendarDisplayOptions">LunarCalendarDisplayOptions</link> <link linkend="lunar-calendar-get-display-options">lunar_calendar_get_display_options</link>
                                                        (<link linkend="LunarCalendar">LunarCalendar</link> *calendar);
<link linkend="void">void</link>                <link linkend="lunar-calendar-set-display-options">lunar_calendar_set_display_options</link>  (<link linkend="LunarCalendar">LunarCalendar</link> *calendar,
                                                         <link linkend="LunarCalendarDisplayOptions">LunarCalendarDisplayOptions</link> flags);
<link linkend="void">void</link>                <link linkend="lunar-calendar-display-options">lunar_calendar_display_options</link>      (<link linkend="LunarCalendar">LunarCalendar</link> *calendar,
                                                         <link linkend="LunarCalendarDisplayOptions">LunarCalendarDisplayOptions</link> flags);
<link linkend="void">void</link>                <link linkend="lunar-calendar-get-date">lunar_calendar_get_date</link>             (<link linkend="LunarCalendar">LunarCalendar</link> *calendar,
                                                         <link linkend="guint">guint</link> *year,
                                                         <link linkend="guint">guint</link> *month,
                                                         <link linkend="guint">guint</link> *day);
<link linkend="void">void</link>                <link linkend="lunar-calendar-freeze">lunar_calendar_freeze</link>               (<link linkend="LunarCalendar">LunarCalendar</link> *calendar);
<link linkend="void">void</link>                <link linkend="lunar-calendar-thaw">lunar_calendar_thaw</link>                 (<link linkend="LunarCalendar">LunarCalendar</link> *calendar);
</synopsis>
</refsynopsisdiv>









<refsect1 id="lunar-LunarCalendar.description" role="desc">
<title role="desc.title">Description</title>
<para>

</para>
</refsect1>

<refsect1 id="lunar-LunarCalendar.details" role="details">
<title role="details.title">Details</title>
<refsect2 id="LunarCalendar" role="struct">
<title>LunarCalendar</title>
<indexterm zone="LunarCalendar"><primary>LunarCalendar</primary></indexterm><programlisting>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;
</programlisting>
<para>

</para></refsect2>
<refsect2 id="LunarCalendarDisplayOptions" role="enum">
<title>enum LunarCalendarDisplayOptions</title>
<indexterm zone="LunarCalendarDisplayOptions"><primary>LunarCalendarDisplayOptions</primary></indexterm><programlisting>typedef enum
{
  LUNAR_CALENDAR_SHOW_HEADING		= 1 &lt;&lt; 0,
  LUNAR_CALENDAR_SHOW_DAY_NAMES		= 1 &lt;&lt; 1,
  LUNAR_CALENDAR_NO_MONTH_CHANGE		= 1 &lt;&lt; 2,
  LUNAR_CALENDAR_SHOW_WEEK_NUMBERS	= 1 &lt;&lt; 3,
  LUNAR_CALENDAR_WEEK_START_MONDAY	= 1 &lt;&lt; 4,
  LUNAR_CALENDAR_SHOW_LUNAR		= 1 &lt;&lt; 5
} LunarCalendarDisplayOptions;
</programlisting>
<para>

</para></refsect2>
<refsect2 id="lunar-calendar-new" role="function">
<title>lunar_calendar_new ()</title>
<indexterm zone="lunar-calendar-new"><primary>lunar_calendar_new</primary></indexterm><programlisting><link linkend="GtkWidget">GtkWidget</link>*          lunar_calendar_new                  (void);</programlisting>
<para>
Creates a new calendar, with the current date being selected.</para>
<para>

</para><variablelist role="params">
<varlistentry><term><emphasis>Returns</emphasis>&nbsp;:</term><listitem><simpara> a newly <link linkend="LunarCalendar"><type>LunarCalendar</type></link> widget
</simpara></listitem></varlistentry>
</variablelist></refsect2>
<refsect2 id="lunar-calendar-select-month" role="function">
<title>lunar_calendar_select_month ()</title>
<indexterm zone="lunar-calendar-select-month"><primary>lunar_calendar_select_month</primary></indexterm><programlisting><link linkend="gboolean">gboolean</link>            lunar_calendar_select_month         (<link linkend="LunarCalendar">LunarCalendar</link> *calendar,
                                                         <link linkend="guint">guint</link> month,
                                                         <link linkend="guint">guint</link> year);</programlisting>
<para>
Shifts the calendar to a different month.</para>
<para>

</para><variablelist role="params">
<varlistentry><term><parameter>calendar</parameter>&nbsp;:</term>
<listitem><simpara> a <link linkend="LunarCalendar"><type>LunarCalendar</type></link>
</simpara></listitem></varlistentry>
<varlistentry><term><parameter>month</parameter>&nbsp;:</term>
<listitem><simpara> a month number between 0 and 11.
</simpara></listitem></varlistentry>
<varlistentry><term><parameter>year</parameter>&nbsp;:</term>
<listitem><simpara> the year the month is in.
</simpara></listitem></varlistentry>
<varlistentry><term><emphasis>Returns</emphasis>&nbsp;:</term><listitem><simpara> <link linkend="TRUE:CAPS"><literal>TRUE</literal></link>, always
</simpara></listitem></varlistentry>
</variablelist></refsect2>
<refsect2 id="lunar-calendar-select-day" role="function">
<title>lunar_calendar_select_day ()</title>
<indexterm zone="lunar-calendar-select-day"><primary>lunar_calendar_select_day</primary></indexterm><programlisting><link linkend="void">void</link>                lunar_calendar_select_day           (<link linkend="LunarCalendar">LunarCalendar</link> *calendar,
                                                         <link linkend="guint">guint</link> day);</programlisting>
<para>
Selects a day from the current month.</para>
<para>

</para><variablelist role="params">
<varlistentry><term><parameter>calendar</parameter>&nbsp;:</term>
<listitem><simpara> a <link linkend="LunarCalendar"><type>LunarCalendar</type></link>.
</simpara></listitem></varlistentry>
<varlistentry><term><parameter>day</parameter>&nbsp;:</term>
<listitem><simpara> the day number between 1 and 31, or 0 to unselect 
  the currently selected day.
</simpara></listitem></varlistentry>
</variablelist></refsect2>
<refsect2 id="lunar-calendar-mark-day" role="function">
<title>lunar_calendar_mark_day ()</title>
<indexterm zone="lunar-calendar-mark-day"><primary>lunar_calendar_mark_day</primary></indexterm><programlisting><link linkend="gboolean">gboolean</link>            lunar_calendar_mark_day             (<link linkend="LunarCalendar">LunarCalendar</link> *calendar,
                                                         <link linkend="guint">guint</link> day);</programlisting>
<para>
Places a visual marker on a particular day.</para>
<para>

</para><variablelist role="params">
<varlistentry><term><parameter>calendar</parameter>&nbsp;:</term>
<listitem><simpara> a <link linkend="LunarCalendar"><type>LunarCalendar</type></link> 
</simpara></listitem></varlistentry>
<varlistentry><term><parameter>day</parameter>&nbsp;:</term>
<listitem><simpara> the day number to mark between 1 and 31.
</simpara></listitem></varlistentry>
<varlistentry><term><emphasis>Returns</emphasis>&nbsp;:</term><listitem><simpara> <link linkend="TRUE:CAPS"><literal>TRUE</literal></link>, always
</simpara></listitem></varlistentry>
</variablelist></refsect2>
<refsect2 id="lunar-calendar-unmark-day" role="function">
<title>lunar_calendar_unmark_day ()</title>
<indexterm zone="lunar-calendar-unmark-day"><primary>lunar_calendar_unmark_day</primary></indexterm><programlisting><link linkend="gboolean">gboolean</link>            lunar_calendar_unmark_day           (<link linkend="LunarCalendar">LunarCalendar</link> *calendar,
                                                         <link linkend="guint">guint</link> day);</programlisting>
<para>
Removes the visual marker from a particular day.</para>
<para>

</para><variablelist role="params">
<varlistentry><term><parameter>calendar</parameter>&nbsp;:</term>
<listitem><simpara> a <link linkend="LunarCalendar"><type>LunarCalendar</type></link>.
</simpara></listitem></varlistentry>
<varlistentry><term><parameter>day</parameter>&nbsp;:</term>
<listitem><simpara> the day number to unmark between 1 and 31.
</simpara></listitem></varlistentry>
<varlistentry><term><emphasis>Returns</emphasis>&nbsp;:</term><listitem><simpara> <link linkend="TRUE:CAPS"><literal>TRUE</literal></link>, always
</simpara></listitem></varlistentry>
</variablelist></refsect2>
<refsect2 id="lunar-calendar-clear-marks" role="function">
<title>lunar_calendar_clear_marks ()</title>
<indexterm zone="lunar-calendar-clear-marks"><primary>lunar_calendar_clear_marks</primary></indexterm><programlisting><link linkend="void">void</link>                lunar_calendar_clear_marks          (<link linkend="LunarCalendar">LunarCalendar</link> *calendar);</programlisting>
<para>
Remove all visual markers.</para>
<para>

</para><variablelist role="params">
<varlistentry><term><parameter>calendar</parameter>&nbsp;:</term>
<listitem><simpara> a <link linkend="LunarCalendar"><type>LunarCalendar</type></link>
</simpara></listitem></varlistentry>
</variablelist></refsect2>
<refsect2 id="lunar-calendar-get-display-options" role="function" condition="since:2.4">
<title>lunar_calendar_get_display_options ()</title>
<indexterm zone="lunar-calendar-get-display-options" role="2.4"><primary>lunar_calendar_get_display_options</primary></indexterm><programlisting><link linkend="LunarCalendarDisplayOptions">LunarCalendarDisplayOptions</link> lunar_calendar_get_display_options
                                                        (<link linkend="LunarCalendar">LunarCalendar</link> *calendar);</programlisting>
<para>
Returns the current display options of <parameter>calendar</parameter>.</para>
<para>

</para><variablelist role="params">
<varlistentry><term><parameter>calendar</parameter>&nbsp;:</term>
<listitem><simpara> a <link linkend="LunarCalendar"><type>LunarCalendar</type></link>
</simpara></listitem></varlistentry>
<varlistentry><term><emphasis>Returns</emphasis>&nbsp;:</term><listitem><simpara> the display options.

</simpara></listitem></varlistentry>
</variablelist><para role="since">Since  2.4
</para></refsect2>
<refsect2 id="lunar-calendar-set-display-options" role="function" condition="since:2.4">
<title>lunar_calendar_set_display_options ()</title>
<indexterm zone="lunar-calendar-set-display-options" role="2.4"><primary>lunar_calendar_set_display_options</primary></indexterm><programlisting><link linkend="void">void</link>                lunar_calendar_set_display_options  (<link linkend="LunarCalendar">LunarCalendar</link> *calendar,
                                                         <link linkend="LunarCalendarDisplayOptions">LunarCalendarDisplayOptions</link> flags);</programlisting>
<para>
Sets display options (whether to display the heading and the month  
headings).</para>
<para>

</para><variablelist role="params">
<varlistentry><term><parameter>calendar</parameter>&nbsp;:</term>
<listitem><simpara> a <link linkend="LunarCalendar"><type>LunarCalendar</type></link>
</simpara></listitem></varlistentry>
<varlistentry><term><parameter>flags</parameter>&nbsp;:</term>
<listitem><simpara> the display options to set
</simpara></listitem></varlistentry>
</variablelist><para role="since">Since  2.4
</para></refsect2>
<refsect2 id="lunar-calendar-display-options" role="function" condition="deprecated:2.4: Use lunar_calendar_set_display_options() instead">
<title>lunar_calendar_display_options ()</title>
<indexterm zone="lunar-calendar-display-options" role="deprecated"><primary>lunar_calendar_display_options</primary></indexterm><programlisting><link linkend="void">void</link>                lunar_calendar_display_options      (<link linkend="LunarCalendar">LunarCalendar</link> *calendar,
                                                         <link linkend="LunarCalendarDisplayOptions">LunarCalendarDisplayOptions</link> flags);</programlisting>
<warning><para><literal>lunar_calendar_display_options</literal> has been deprecated since version 2.4 and should not be used in newly-written code. Use <link linkend="lunar-calendar-set-display-options"><function>lunar_calendar_set_display_options()</function></link> instead</para></warning>
<para>
Sets display options (whether to display the heading and the month headings).</para>
<para>

</para><variablelist role="params">
<varlistentry><term><parameter>calendar</parameter>&nbsp;:</term>
<listitem><simpara> a <link linkend="LunarCalendar"><type>LunarCalendar</type></link>.
</simpara></listitem></varlistentry>
<varlistentry><term><parameter>flags</parameter>&nbsp;:</term>
<listitem><simpara> the display options to set.
</simpara></listitem></varlistentry>
</variablelist></refsect2>
<refsect2 id="lunar-calendar-get-date" role="function">
<title>lunar_calendar_get_date ()</title>
<indexterm zone="lunar-calendar-get-date"><primary>lunar_calendar_get_date</primary></indexterm><programlisting><link linkend="void">void</link>                lunar_calendar_get_date             (<link linkend="LunarCalendar">LunarCalendar</link> *calendar,
                                                         <link linkend="guint">guint</link> *year,
                                                         <link linkend="guint">guint</link> *month,
                                                         <link linkend="guint">guint</link> *day);</programlisting>
<para>
Obtains the selected date from a <link linkend="LunarCalendar"><type>LunarCalendar</type></link>.</para>
<para>

</para><variablelist role="params">
<varlistentry><term><parameter>calendar</parameter>&nbsp;:</term>
<listitem><simpara> a <link linkend="LunarCalendar"><type>LunarCalendar</type></link>
</simpara></listitem></varlistentry>
<varlistentry><term><parameter>year</parameter>&nbsp;:</term>
<listitem><simpara> location to store the year number, or <link linkend="NULL:CAPS"><literal>NULL</literal></link>
</simpara></listitem></varlistentry>
<varlistentry><term><parameter>month</parameter>&nbsp;:</term>
<listitem><simpara> location to store the month number (between 0 and 11), or <link linkend="NULL:CAPS"><literal>NULL</literal></link>
</simpara></listitem></varlistentry>
<varlistentry><term><parameter>day</parameter>&nbsp;:</term>
<listitem><simpara> location to store the day number (between 1 and 31), or <link linkend="NULL:CAPS"><literal>NULL</literal></link>
</simpara></listitem></varlistentry>
</variablelist></refsect2>
<refsect2 id="lunar-calendar-freeze" role="function" condition="deprecated:2.8:">
<title>lunar_calendar_freeze ()</title>
<indexterm zone="lunar-calendar-freeze" role="deprecated"><primary>lunar_calendar_freeze</primary></indexterm><programlisting><link linkend="void">void</link>                lunar_calendar_freeze               (<link linkend="LunarCalendar">LunarCalendar</link> *calendar);</programlisting>
<warning><para><literal>lunar_calendar_freeze</literal> has been deprecated since version 2.8 and should not be used in newly-written code. </para></warning>
<para>
Does nothing. Previously locked the display of the calendar until
it was thawed with <link linkend="lunar-calendar-thaw"><function>lunar_calendar_thaw()</function></link>.</para>
<para>

</para><variablelist role="params">
<varlistentry><term><parameter>calendar</parameter>&nbsp;:</term>
<listitem><simpara> a <link linkend="LunarCalendar"><type>LunarCalendar</type></link>
</simpara></listitem></varlistentry>
</variablelist></refsect2>
<refsect2 id="lunar-calendar-thaw" role="function" condition="deprecated:2.8:">
<title>lunar_calendar_thaw ()</title>
<indexterm zone="lunar-calendar-thaw" role="deprecated"><primary>lunar_calendar_thaw</primary></indexterm><programlisting><link linkend="void">void</link>                lunar_calendar_thaw                 (<link linkend="LunarCalendar">LunarCalendar</link> *calendar);</programlisting>
<warning><para><literal>lunar_calendar_thaw</literal> has been deprecated since version 2.8 and should not be used in newly-written code. </para></warning>
<para>
Does nothing. Previously defrosted a calendar; all the changes made
since the last <link linkend="lunar-calendar-freeze"><function>lunar_calendar_freeze()</function></link> were displayed.</para>
<para>

</para><variablelist role="params">
<varlistentry><term><parameter>calendar</parameter>&nbsp;:</term>
<listitem><simpara> a <link linkend="LunarCalendar"><type>LunarCalendar</type></link>
</simpara></listitem></varlistentry>
</variablelist></refsect2>

</refsect1>




</refentry>
