aboutsummaryrefslogtreecommitdiffstats
path: root/calendar/gui/gnome-month-item.h
diff options
context:
space:
mode:
authorFederico Mena Quintero <federico@nuclecu.unam.mx>1998-08-19 08:31:04 +0800
committerArturo Espinosa <unammx@src.gnome.org>1998-08-19 08:31:04 +0800
commit6158ea365fc20a777a444011e92713fa3168bdda (patch)
treef51458f962ea8aee3deb0ed465738f96f094f5a0 /calendar/gui/gnome-month-item.h
parentb7c9e891f64f19f1cda1294e1816898518be3ed9 (diff)
downloadgsoc2013-evolution-6158ea365fc20a777a444011e92713fa3168bdda.tar.gz
gsoc2013-evolution-6158ea365fc20a777a444011e92713fa3168bdda.tar.zst
gsoc2013-evolution-6158ea365fc20a777a444011e92713fa3168bdda.zip
We now have a nice generic monthly calendar item for the canvas. We
also have a convenient "Go To" dialog, just like in the PalmPilot. Next step is a pretty month view - Federico 1998-08-18 Federico Mena Quintero <federico@nuclecu.unam.mx> * gnome-month-item.c (gnome_month_item_day2index): New public function to get the displayed day index of the specified date. * gnome-cal.c (gnome_calendar_goto_today): New public function to jump to the current day. * goto.c (day_event): Jump to the selected day when the user clicks the mouse, and prelight days as appropriate. * timeutil.c (time_from_day): New public function to build a time_t from a year/month/day triplet. * gnome-month-item.c (gnome_month_item_num2child): (gnome_month_item_child2num): New public functions to convert an index into a child and vice-versa, respectively. (gnome_month_item_num2day): New public function to convert a child number into a displayed day number. * goto.c (goto_dialog): Doh, use gnome-dialog properly :-) * gnome-month-item.c (create_items): Use g_strdup()ed day names from the start. 1998-08-17 Federico Mena Quintero <federico@nuclecu.unam.mx> * main.c (gnome_toolbar): Made it use goto.xpm. * Makefile.am (EXTRA_DIST): Added goto.xpm to the list of files. svn path=/trunk/; revision=326
Diffstat (limited to 'calendar/gui/gnome-month-item.h')
-rw-r--r--calendar/gui/gnome-month-item.h52
1 files changed, 52 insertions, 0 deletions
diff --git a/calendar/gui/gnome-month-item.h b/calendar/gui/gnome-month-item.h
index f6523aff94..b1b11f9d01 100644
--- a/calendar/gui/gnome-month-item.h
+++ b/calendar/gui/gnome-month-item.h
@@ -16,6 +16,37 @@
BEGIN_GNOME_DECLS
+/* These values are used to identify the canvas items that make up a complete GnomeMonthItem, which
+ * is made up of the following "pieces":
+ *
+ * Headings line:
+ * - 7 GnomeCanvasGroups:
+ * Each group contains one box (GnomeCanvasRectangle) and one label
+ * (GnomeCanvasText)
+ *
+ * Day slots:
+ * - 42 GnomeCanvasGroups:
+ * Each group contains one box (GnomeCanvasRectangle) and one label
+ * (GnomeCanvasText)
+ *
+ * The headings are organized from left to right. The day slots are organized as a table in
+ * row-major order.
+ *
+ * If you want to access the individual items of the GnomeMonthItem, you can use these numbers with
+ * the gnome_month_item_num2child() function. If you want to convert a number into the
+ * corresponding GnomeCanvasItem, you can use the gnome_month_item_child2num() function.
+ */
+typedef enum {
+ GNOME_MONTH_ITEM_HEAD_GROUP = 0, /* 7 groups for headings */
+ GNOME_MONTH_ITEM_HEAD_BOX = 7, /* 7 boxes for headings */
+ GNOME_MONTH_ITEM_HEAD_LABEL = 14, /* 7 labels for headings */
+ GNOME_MONTH_ITEM_DAY_GROUP = 21, /* 42 groups for days */
+ GNOME_MONTH_ITEM_DAY_BOX = 63, /* 42 boxes for days */
+ GNOME_MONTH_ITEM_DAY_LABEL = 105, /* 42 labels for days */
+ GNOME_MONTH_ITEM_LAST = 147 /* total number of items */
+} GnomeMonthItemChild;
+
+
#define GNOME_TYPE_MONTH_ITEM (gnome_month_item_get_type ())
#define GNOME_MONTH_ITEM(obj) (GTK_CHECK_CAST ((obj), GNOME_TYPE_MONTH_ITEM, GnomeMonthItem))
#define GNOME_MONTH_ITEM_CLASS(klass) (GTK_CHECK_CLASS_CAST ((klass), GNOME_TYPE_MONTH_ITEM, GnomeMonthItemClass))
@@ -47,6 +78,7 @@ struct _GnomeMonthItem {
GtkAnchorType day_anchor; /* Anchor side for the day number labels */
GnomeCanvasItem **items; /* All the items that make up the calendar */
+ int day_numbers[42]; /* The numbers of the days */
int start_on_monday : 1; /* Start the week on Monday? If false, then start from Sunday */
};
@@ -65,6 +97,26 @@ GnomeCanvasItem *gnome_month_item_new (GnomeCanvasGroup *parent);
/* Constructor function useful for derived classes */
void gnome_month_item_construct (GnomeMonthItem *mitem);
+/* Returns the child item defined by the child number (as specified on the GnomeMonthItemChild
+ * enumeration above).
+ */
+GnomeCanvasItem *gnome_month_item_num2child (GnomeMonthItem *mitem, GnomeMonthItemChild child_num);
+
+/* Returns the number of the specified child item, as defined on the GnomeMonthItemChild enumeration
+ * above. If the specified object is not found, it returns -1.
+ */
+GnomeMonthItemChild gnome_month_item_child2num (GnomeMonthItem *mitem, GnomeCanvasItem *child);
+
+/* Returns the number of the day relevant to the specified child item. Day numbers are 1-based. If
+ * the specified child is outside the range of displayed days, then it returns 0.
+ */
+int gnome_month_item_num2day (GnomeMonthItem *mitem, GnomeMonthItemChild child_num);
+
+/* Returns the index (0-41) of the specified date within the table of days. If the day number is
+ * invalid for the current monthly calendar, then -1 is returned.
+ */
+int gnome_month_item_day2index (GnomeMonthItem *mitem, int day_num);
+
END_GNOME_DECLS