Gtkcalendar
Is a component that can be used to display monthly subscriptions. As long as you use gtk_window_new () to create a component, you can have a complete daily metric component display. To set a date, you can use
Set the date and month by using gtk_calendar_select_month.
When using gtk_calendar_select_month () to set the parameter value, note that the value of the month can be set from 0 to 11. 0 indicates January, and 11 indicates December.
Use gtk_calendar_select_day () to set the value to 1 to 31, or set it to 0, indicating that the day is not selected.
You can use gtk_calendar_mark_day (), gtk_calendar_unmark_day (), or
Gtk_calendar_clear_marks () sets a date tag. To learn the recorded date information, you can access the members of The gtkcalendar structure.
Num_marked_dates indicates that a calendar day has been marked, and marked_date indicates a calendar column. It can be used to determine which day has been marked. For example:
If (calendar-> marked_date [26-1]) {
// The date 26 is marked
}
Note that the index value of the primary column starts from 0. Therefore, when you access marked_date, the index must be replaced by 1 in the date field.
In addition, month, year, And selected_day in the calendar member indicate the current month, year, and selected day. To obtain the selected year, month, or day, you can
To use the gtk_calendar_get_date () function, you must provide three change numbers to it, in the three changes, the corresponding year, month, and day will be stored:
Void gtk_calendar_get_date (gtkcalendar * calendar,
Guint * Year,
Guint * month,
Guint * day );
The following program is a simple example:
# Include <GTK/GTK. h>
Int main (INT argc, char * argv []) {
Gtkwidget * window;
Gtkwidget * calendar;
Guint year = 1975;
Guint month = 5-1; // May
Guint day = 26;
Guint mark_day = 19;
Gtk_init (& argc, & argv );
Window = gtk_window_new (gtk_window_toplevel );
Gtk_window_set_title (gtk_window (window), "gtkcalendar ");
Calendar = gtk_calendar_new ();
Gtk_calendar_select_month (gtk_calendar (calendar), month, year );
Gtk_calendar_select_day (gtk_calendar (calendar), Day );
Gtk_calendar_mark_day (gtk_calendar (calendar), mark_day );
Gtk_container_add (gtk_container (window), calendar );
G_signal_connect (gtk_object (window), "Destroy ",
G_callback (gtk_main_quit), null );
Gtk_widget_show_all (window );
Gtk_main ();
Return 0;
}
The results of a batch row are as follows: