aboutsummaryrefslogtreecommitdiffstats
path: root/calendar/gui/month-view.c
diff options
context:
space:
mode:
authorFederico Mena Quintero <federico@nuclecu.unam.mx>1998-08-11 12:22:05 +0800
committerArturo Espinosa <unammx@src.gnome.org>1998-08-11 12:22:05 +0800
commit1596825b7da24002e23d90a236d6def417d7dd58 (patch)
tree9f1ec2b869985e722c230ec2589440aedf44d2bd /calendar/gui/month-view.c
parentf91ebfeae9cdbc0d4866e08fc538f7e466ab70f8 (diff)
downloadgsoc2013-evolution-1596825b7da24002e23d90a236d6def417d7dd58.tar
gsoc2013-evolution-1596825b7da24002e23d90a236d6def417d7dd58.tar.gz
gsoc2013-evolution-1596825b7da24002e23d90a236d6def417d7dd58.tar.bz2
gsoc2013-evolution-1596825b7da24002e23d90a236d6def417d7dd58.tar.lz
gsoc2013-evolution-1596825b7da24002e23d90a236d6def417d7dd58.tar.xz
gsoc2013-evolution-1596825b7da24002e23d90a236d6def417d7dd58.tar.zst
gsoc2013-evolution-1596825b7da24002e23d90a236d6def417d7dd58.zip
Start of the month view widget. This will use the generic month item and
1998-08-10 Federico Mena Quintero <federico@nuclecu.unam.mx> * month-view.[ch]: Start of the month view widget. This will use the generic month item and extend it to have the semantics desired for the gnomecal month view. * gnome-month-item.[ch]: New generic canvas item for the month view and the "small calendars". This is intended to be a high-level display engine for monthly calendars. This is a work in progress. * gnome-cal.h (GnomeCalendar): Added a month_view field. * gnome-cal.c (setup_widgets): Create the month view and insert it into the notebook. * Makefile.am: Added month-view.[ch] and gnome-month-item.[ch] to the sources. svn path=/trunk/; revision=307
Diffstat (limited to 'calendar/gui/month-view.c')
-rw-r--r--calendar/gui/month-view.c118
1 files changed, 118 insertions, 0 deletions
diff --git a/calendar/gui/month-view.c b/calendar/gui/month-view.c
new file mode 100644
index 0000000000..78eec0c91d
--- /dev/null
+++ b/calendar/gui/month-view.c
@@ -0,0 +1,118 @@
+/* Month view display for gncal
+ *
+ * Copyright (C) 1998 Red Hat Software, Inc.
+ *
+ * Author: Federico Mena <federico@nuclecu.unam.mx>
+ */
+
+#include <config.h>
+#include "month-view.h"
+
+
+static void month_view_class_init (MonthViewClass *class);
+static void month_view_init (MonthView *mv);
+static void month_view_size_request (GtkWidget *widget,
+ GtkRequisition *requisition);
+static void month_view_size_allocate (GtkWidget *widget,
+ GtkAllocation *allocation);
+
+
+static GnomeCanvasClass *parent_class;
+
+
+GtkType
+month_view_get_type (void)
+{
+ static GtkType month_view_type = 0;
+
+ if (!month_view_type) {
+ GtkTypeInfo month_view_info = {
+ "MonthView",
+ sizeof (MonthView),
+ sizeof (MonthViewClass),
+ (GtkClassInitFunc) month_view_class_init,
+ (GtkObjectInitFunc) month_view_init,
+ NULL, /* reserved_1 */
+ NULL, /* reserved_2 */
+ (GtkClassInitFunc) NULL
+ };
+
+ month_view_type = gtk_type_unique (gnome_canvas_get_type (), &month_view_info);
+ }
+
+ return month_view_type;
+}
+
+static void
+month_view_class_init (MonthViewClass *class)
+{
+ GtkWidgetClass *widget_class;
+
+ widget_class = (GtkWidgetClass *) class;
+
+ parent_class = gtk_type_class (gnome_canvas_get_type ());
+
+ widget_class->size_request = month_view_size_request;
+ widget_class->size_allocate = month_view_size_allocate;
+}
+
+static void
+month_view_init (MonthView *mv)
+{
+ mv->mitem = gnome_month_item_new (GNOME_CANVAS_GROUP (mv->canvas.root));
+ gnome_canvas_item_set (mv->mitem,
+ "x", 0.0,
+ "y", 0.0,
+ "anchor", GTK_ANCHOR_NW,
+ NULL);
+}
+
+GtkWidget *
+month_view_new (GnomeCalendar *calendar)
+{
+ MonthView *mv;
+
+ g_return_val_if_fail (calendar != NULL, NULL);
+
+ mv = gtk_type_new (month_view_get_type ());
+
+ mv->calendar = calendar;
+
+ return GTK_WIDGET (mv);
+}
+
+static void
+month_view_size_request (GtkWidget *widget, GtkRequisition *requisition)
+{
+ g_return_if_fail (widget != NULL);
+ g_return_if_fail (GTK_IS_WIDGET (widget));
+ g_return_if_fail (requisition != NULL);
+
+ if (GTK_WIDGET_CLASS (parent_class)->size_request)
+ (* GTK_WIDGET_CLASS (parent_class)->size_request) (widget, requisition);
+
+ requisition->width = 200;
+ requisition->height = 150;
+}
+
+static void
+month_view_size_allocate (GtkWidget *widget, GtkAllocation *allocation)
+{
+ MonthView *mv;
+
+ g_return_if_fail (widget != NULL);
+ g_return_if_fail (GTK_IS_WIDGET (widget));
+ g_return_if_fail (allocation != NULL);
+
+ mv = MONTH_VIEW (widget);
+
+ if (GTK_WIDGET_CLASS (parent_class)->size_allocate)
+ (* GTK_WIDGET_CLASS (parent_class)->size_allocate) (widget, allocation);
+
+ gnome_canvas_set_scroll_region (GNOME_CANVAS (mv), 0, 0, allocation->width, allocation->height);
+
+ gnome_canvas_item_set (mv->mitem,
+ "width", (double) allocation->width,
+ "height", (double) allocation->height,
+ NULL);
+}