📄 gtkcalendar.html
字号:
<HTML><HEAD><TITLE>GtkCalendar</TITLE><METANAME="GENERATOR"CONTENT="Modular DocBook HTML Stylesheet Version 1.61"><LINKREL="HOME"TITLE="GTK+ Reference Manual"HREF="index.html"><LINKREL="UP"TITLE="GTK+ Widgets and Objects"HREF="gtkobjects.html"><LINKREL="PREVIOUS"TITLE="GtkButton"HREF="gtkbutton.html"><LINKREL="NEXT"TITLE="GtkCheckButton"HREF="gtkcheckbutton.html"></HEAD><BODYCLASS="REFENTRY"BGCOLOR="#FFFFFF"TEXT="#000000"LINK="#0000FF"VLINK="#840084"ALINK="#0000FF"><DIVCLASS="NAVHEADER"><TABLEWIDTH="100%"BORDER="0"BGCOLOR="#000000"CELLPADDING="1"CELLSPACING="0"><TR><THCOLSPAN="4"ALIGN="center"><FONTCOLOR="#FFFFFF"SIZE="5">GTK+ Reference Manual</FONT></TH></TR><TR><TDWIDTH="25%"BGCOLOR="#C00000"ALIGN="left"><AHREF="gtkbutton.html"><FONTCOLOR="#FFFFFF"SIZE="3"><B><<< Previous Page</B></FONT></A></TD><TDWIDTH="25%"BGCOLOR="#0000C0"ALIGN="center"><FONTCOLOR="#FFFFFF"SIZE="3"><B><AHREF="index.html"><FONTCOLOR="#FFFFFF"SIZE="3"><B>Home</B></FONT></A></B></FONT></TD><TDWIDTH="25%"BGCOLOR="#00C000"ALIGN="center"><FONTCOLOR="#FFFFFF"SIZE="3"><B><AHREF="gtkobjects.html"><FONTCOLOR="#FFFFFF"SIZE="3"><B>Up</B></FONT></A></B></FONT></TD><TDWIDTH="25%"BGCOLOR="#C00000"ALIGN="right"><AHREF="gtkcheckbutton.html"><FONTCOLOR="#FFFFFF"SIZE="3"><B>Next Page >>></B></FONT></A></TD></TR></TABLE></DIV><H1><ANAME="GTKCALENDAR">GtkCalendar</A></H1><DIVCLASS="REFNAMEDIV"><ANAME="AEN15111"></A><H2>Name</H2>GtkCalendar -- display a calendar and/or allow the user to select a date.</DIV><DIVCLASS="REFSYNOPSISDIV"><ANAME="AEN15114"></A><H2>Synopsis</H2><TABLEBORDER="0"BGCOLOR="#D6E8FF"WIDTH="100%"CELLPADDING="6"><TR><TD><PRECLASS="SYNOPSIS"> #include <gtk/gtk.h>struct <AHREF="gtkcalendar.html#GTKCALENDAR-STRUCT">GtkCalendar</A>;enum <AHREF="gtkcalendar.html#GTKCALENDARDISPLAYOPTIONS">GtkCalendarDisplayOptions</A>;<AHREF="gtkwidget.html">GtkWidget</A>* <AHREF="gtkcalendar.html#GTK-CALENDAR-NEW">gtk_calendar_new</A> (void);<AHREF=../glib/glib-basic-types.html#GINT>gint</A> <AHREF="gtkcalendar.html#GTK-CALENDAR-SELECT-MONTH">gtk_calendar_select_month</A> (<AHREF="gtkcalendar.html">GtkCalendar</A> *calendar, <AHREF=../glib/glib-basic-types.html#GUINT>guint</A> month, <AHREF=../glib/glib-basic-types.html#GUINT>guint</A> year);void <AHREF="gtkcalendar.html#GTK-CALENDAR-SELECT-DAY">gtk_calendar_select_day</A> (<AHREF="gtkcalendar.html">GtkCalendar</A> *calendar, <AHREF=../glib/glib-basic-types.html#GUINT>guint</A> day);<AHREF=../glib/glib-basic-types.html#GINT>gint</A> <AHREF="gtkcalendar.html#GTK-CALENDAR-MARK-DAY">gtk_calendar_mark_day</A> (<AHREF="gtkcalendar.html">GtkCalendar</A> *calendar, <AHREF=../glib/glib-basic-types.html#GUINT>guint</A> day);<AHREF=../glib/glib-basic-types.html#GINT>gint</A> <AHREF="gtkcalendar.html#GTK-CALENDAR-UNMARK-DAY">gtk_calendar_unmark_day</A> (<AHREF="gtkcalendar.html">GtkCalendar</A> *calendar, <AHREF=../glib/glib-basic-types.html#GUINT>guint</A> day);void <AHREF="gtkcalendar.html#GTK-CALENDAR-CLEAR-MARKS">gtk_calendar_clear_marks</A> (<AHREF="gtkcalendar.html">GtkCalendar</A> *calendar);void <AHREF="gtkcalendar.html#GTK-CALENDAR-DISPLAY-OPTIONS">gtk_calendar_display_options</A> (<AHREF="gtkcalendar.html">GtkCalendar</A> *calendar, <AHREF="gtkcalendar.html#GTKCALENDARDISPLAYOPTIONS">GtkCalendarDisplayOptions</A> flags);void <AHREF="gtkcalendar.html#GTK-CALENDAR-GET-DATE">gtk_calendar_get_date</A> (<AHREF="gtkcalendar.html">GtkCalendar</A> *calendar, <AHREF=../glib/glib-basic-types.html#GUINT>guint</A> *year, <AHREF=../glib/glib-basic-types.html#GUINT>guint</A> *month, <AHREF=../glib/glib-basic-types.html#GUINT>guint</A> *day);void <AHREF="gtkcalendar.html#GTK-CALENDAR-FREEZE">gtk_calendar_freeze</A> (<AHREF="gtkcalendar.html">GtkCalendar</A> *calendar);void <AHREF="gtkcalendar.html#GTK-CALENDAR-THAW">gtk_calendar_thaw</A> (<AHREF="gtkcalendar.html">GtkCalendar</A> *calendar); </PRE></TD></TR></TABLE></DIV><DIVCLASS="REFSECT1"><ANAME="AEN15151"></A><H2>Object Hierarchy</H2><TABLEBORDER="0"BGCOLOR="#D6E8FF"WIDTH="100%"CELLPADDING="6"><TR><TD><PRECLASS="SYNOPSIS"> <AHREF="gtkobject.html">GtkObject</A> +----<AHREF="gtkwidget.html">GtkWidget</A> +----GtkCalendar</PRE></TD></TR></TABLE></DIV><DIVCLASS="REFSECT1"><ANAME="AEN15156"></A><H2>Signal Prototypes</H2><TABLEBORDER="0"BGCOLOR="#D6E8FF"WIDTH="100%"CELLPADDING="6"><TR><TD><PRECLASS="SYNOPSIS"> "<AHREF="gtkcalendar.html#GTKCALENDAR-MONTH-CHANGED">month-changed</A>" void user_function (<AHREF="gtkcalendar.html">GtkCalendar</A> *calendar, <AHREF=../glib/glib-basic-types.html#GPOINTER>gpointer</A> user_data);"<AHREF="gtkcalendar.html#GTKCALENDAR-DAY-SELECTED">day-selected</A>" void user_function (<AHREF="gtkcalendar.html">GtkCalendar</A> *calendar, <AHREF=../glib/glib-basic-types.html#GPOINTER>gpointer</A> user_data);"<AHREF="gtkcalendar.html#GTKCALENDAR-DAY-SELECTED-DOUBLE-CLICK">day-selected-double-click</A>" void user_function (<AHREF="gtkcalendar.html">GtkCalendar</A> *calendar, <AHREF=../glib/glib-basic-types.html#GPOINTER>gpointer</A> user_data);"<AHREF="gtkcalendar.html#GTKCALENDAR-PREV-MONTH">prev-month</A>" void user_function (<AHREF="gtkcalendar.html">GtkCalendar</A> *calendar, <AHREF=../glib/glib-basic-types.html#GPOINTER>gpointer</A> user_data);"<AHREF="gtkcalendar.html#GTKCALENDAR-NEXT-MONTH">next-month</A>" void user_function (<AHREF="gtkcalendar.html">GtkCalendar</A> *calendar, <AHREF=../glib/glib-basic-types.html#GPOINTER>gpointer</A> user_data);"<AHREF="gtkcalendar.html#GTKCALENDAR-PREV-YEAR">prev-year</A>" void user_function (<AHREF="gtkcalendar.html">GtkCalendar</A> *calendar, <AHREF=../glib/glib-basic-types.html#GPOINTER>gpointer</A> user_data);"<AHREF="gtkcalendar.html#GTKCALENDAR-NEXT-YEAR">next-year</A>" void user_function (<AHREF="gtkcalendar.html">GtkCalendar</A> *calendar, <AHREF=../glib/glib-basic-types.html#GPOINTER>gpointer</A> user_data);</PRE></TD></TR></TABLE></DIV><DIVCLASS="REFSECT1"><ANAME="AEN15180"></A><H2>Description</H2><P><AHREF="gtkcalendar.html">GtkCalendar</A> is a widget that displays a calendar, one month at a time. It can be created with <AHREF="gtkcalendar.html#GTK-CALENDAR-NEW">gtk_calendar_new</A>().</P><P>The month and year currently displayed can be altered with <AHREF="gtkcalendar.html#GTK-CALENDAR-SELECT-MONTH">gtk_calendar_select_month</A>(). The exact day can be selected from the displayed month using <AHREF="gtkcalendar.html#GTK-CALENDAR-SELECT-DAY">gtk_calendar_select_day</A>().</P><P>FIXME: (check)To place a visual marker on a particular day, use<AHREF="gtkcalendar.html#GTK-CALENDAR-MARK-DAY">gtk_calendar_mark_day</A>() and to remove the marker, <AHREF="gtkcalendar.html#GTK-CALENDAR-UNMARK-DAY">gtk_calendar_unmark_day</A>().Alternative, all marks can be cleared with <AHREF="gtkcalendar.html#GTK-CALENDAR-CLEAR-MARKS">gtk_calendar_clear_marks</A>().</P><P>The way in which the calendar itself is displayed can be altered using<AHREF="gtkcalendar.html#GTK-CALENDAR-DISPLAY-OPTIONS">gtk_calendar_display_options</A>().</P><P>The selected date can be retrieved from a <AHREF="gtkcalendar.html">GtkCalendar</A> using<AHREF="gtkcalendar.html#GTK-CALENDAR-GET-DATE">gtk_calendar_get_date</A>().</P><P>If performing many 'mark' operations, the calendar can be frozen to preventflicker, using <AHREF="gtkcalendar.html#GTK-CALENDAR-FREEZE">gtk_calendar_freeze</A>(), and 'thawed' again using<AHREF="gtkcalendar.html#GTK-CALENDAR-THAW">gtk_calendar_thaw</A>().</P></DIV><DIVCLASS="REFSECT1"><ANAME="AEN15200"></A><H2>Details</H2><DIVCLASS="REFSECT2"><ANAME="AEN15202"></A><H3><ANAME="GTKCALENDAR-STRUCT"></A>struct GtkCalendar</H3><TABLEBORDER="0"BGCOLOR="#D6E8FF"WIDTH="100%"CELLPADDING="6"><TR><TD><PRECLASS="PROGRAMLISTING">struct GtkCalendar;</PRE></TD></TR></TABLE><P><TTCLASS="STRUCTFIELD"><I>num_marked_dates</I></TT> is an integer containing thenumber of days that have a mark over them.</P><P><TTCLASS="STRUCTFIELD"><I>marked_date</I></TT> is an array containing the day numbersthat currently have a mark over them.</P><P><TTCLASS="STRUCTFIELD"><I>month</I></TT>, <TTCLASS="STRUCTFIELD"><I>year</I></TT>, and <TTCLASS="STRUCTFIELD"><I>selected_day</I></TT> contain the currently visible month,year, and selected day respectively.</P><P>All of these fields should be considered read only, and everything in thisstruct should only be modified using the functions provided below.</P></DIV><HR><DIVCLASS="REFSECT2"><ANAME="AEN15215"></A><H3><ANAME="GTKCALENDARDISPLAYOPTIONS"></A>enum GtkCalendarDisplayOptions</H3><TABLEBORDER="0"BGCOLOR="#D6E8FF"WIDTH="100%"CELLPADDING="6"><TR><TD><PRECLASS="PROGRAMLISTING">typedef enum{ GTK_CALENDAR_SHOW_HEADING = 1 << 0, GTK_CALENDAR_SHOW_DAY_NAMES = 1 << 1, GTK_CALENDAR_NO_MONTH_CHANGE = 1 << 2, GTK_CALENDAR_SHOW_WEEK_NUMBERS = 1 << 3, GTK_CALENDAR_WEEK_START_MONDAY = 1 << 4} GtkCalendarDisplayOptions;</PRE></TD></TR></TABLE><P><DIVCLASS="INFORMALTABLE"><ANAME="AEN15220"></A><P></P><TABLEBORDER="0"WIDTH="100%"BGCOLOR="#F0F0D0"CELLSPACING="0"CELLPADDING="4"CLASS="CALSTABLE"><TBODY><TR><TDWIDTH="11%"ALIGN="LEFT"VALIGN="TOP">GTK_CALENDAR_SHOW_HEADING</TD><TDWIDTH="89%"ALIGN="LEFT"VALIGN="TOP">Specifies that the month and year should be displayed.</TD></TR><TR><TDWIDTH="11%"ALIGN="LEFT"VALIGN="TOP">GTK_CALENDAR_SHOW_DAY_NAMES</TD><TDWIDTH="89%"ALIGN="LEFT"VALIGN="TOP">Specifies that three letter day descriptions should be present.</TD></TR><TR><TDWIDTH="11%"ALIGN="LEFT"VALIGN="TOP">GTK_CALENDAR_NO_MONTH_CHANGE</TD><TDWIDTH="89%"ALIGN="LEFT"VALIGN="TOP">Prevents the user from switching months with the calendar.</TD></TR><TR><TDWIDTH="11%"ALIGN="LEFT"VALIGN="TOP">GTK_CALENDAR_SHOW_WEEK_NUMBERS</TD><TDWIDTH="89%"ALIGN="LEFT"VALIGN="TOP">Displays each week numbers of the current year, down the left side ofthe calendar.</TD></TR><TR><TDWIDTH="11%"ALIGN="LEFT"VALIGN="TOP">GTK_CALENDAR_WEEK_START_MONDAY</TD><TDWIDTH="89%"ALIGN="LEFT"VALIGN="TOP">Starts the calendar week on Monday, instead of the default Sunday.</TD></TR></TBODY></TABLE><P></P></DIV></P></DIV><HR><DIVCLASS="REFSECT2"><ANAME="AEN15240"></A><H3><ANAME="GTK-CALENDAR-NEW"></A>gtk_calendar_new ()</H3><TABLEBORDER="0"BGCOLOR="#D6E8FF"WIDTH="100%"CELLPADDING="6"><TR><TD><PRECLASS="PROGRAMLISTING"><AHREF="gtkwidget.html">GtkWidget</A>* gtk_calendar_new (void);</PRE></TD></TR></TABLE><P>Creates a new calendar. FIXME:default date.</P><DIVCLASS="INFORMALTABLE"><ANAME="AEN15246"></A><P></P><TABLEBORDER="0"WIDTH="100%"BGCOLOR="#FFD0D0"CELLSPACING="0"CELLPADDING="4"CLASS="CALSTABLE"><TBODY><TR><TDWIDTH="20%"ALIGN="RIGHT"VALIGN="TOP"><ICLASS="EMPHASIS">Returns</I> :</TD><TDWIDTH="80%"ALIGN="LEFT"VALIGN="TOP">a <AHREF="gtkcalendar.html">GtkCalendar</A>. </TD></TR></TBODY></TABLE><P></P></DIV></DIV><HR><DIVCLASS="REFSECT2"><ANAME="AEN15256"></A><H3><ANAME="GTK-CALENDAR-SELECT-MONTH"></A>gtk_calendar_select_month ()</H3><TABLEBORDER="0"BGCOLOR="#D6E8FF"WIDTH="100%"CELLPADDING="6"><TR><TD><PRECLASS="PROGRAMLISTING"><AHREF=../glib/glib-basic-types.html#GINT>gint</A> gtk_calendar_select_month (<AHREF="gtkcalendar.html">GtkCalendar</A> *calendar, <AHREF=../glib/glib-basic-types.html#GUINT>guint</A> month, <AHREF=../glib/glib-basic-types.html#GUINT>guint</A> year);</PRE></TD></TR></TABLE><P>Shifts the calendar to a different month.</P><DIVCLASS="INFORMALTABLE"><ANAME="AEN15265"></A><P></P><TABLEBORDER="0"WIDTH="100%"BGCOLOR="#FFD0D0"CELLSPACING="0"CELLPADDING="4"CLASS="CALSTABLE"><TBODY><TR><TD
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -