static void gtk_calex_size_allocate (GtkWidget *widget,
GtkAllocation *allocation);
+static void gtk_calex_draw_day (GtkCalEx *gtk_calex);
+
#define GTK_CALEX_GET_PRIVATE(obj) (G_TYPE_INSTANCE_GET_PRIVATE ((obj), TYPE_GTK_CALEX, GtkCalExPrivate))
priv->goo_canvas_root = goo_canvas_get_root_item (GOO_CANVAS (priv->goo_canvas));
- goo_canvas_rect_new (priv->goo_canvas_root, 100, 100, 400, 400,
- "line-width", 10.0,
- "radius-x", 20.0,
- "radius-y", 10.0,
- "stroke-color", "yellow",
- "fill-color", "red",
- NULL);
-
priv->view_type = GTK_CALEX_VIEW_TYPE_DAY;
priv->date = g_date_new ();
g_get_current_time (&tval);
g_date_set_time_val (priv->date, &tval);
+
+ gtk_calex_draw_day (gtk_calex);
}
static void
gtk_widget_size_allocate (bin->child, &child_allocation);
}
}
+
+static void
+gtk_calex_draw_day (GtkCalEx *gtk_calex)
+{
+ guint hour;
+
+ g_return_if_fail (IS_GTK_CALEX (gtk_calex));
+
+ GtkCalExPrivate *priv = GTK_CALEX_GET_PRIVATE (gtk_calex);
+
+ for (hour = 0; hour < 24; hour++)
+ {
+ goo_canvas_text_new (priv->goo_canvas_root, g_strdup_printf ("%d", hour),
+ 0, hour * 40, 50,
+ GTK_ANCHOR_NORTH_WEST,
+ "font", "Sans 24",
+ NULL);
+ goo_canvas_text_new (priv->goo_canvas_root, "00",
+ 25, hour * 40, 25,
+ GTK_ANCHOR_NORTH_WEST,
+ "font", "Sans 12",
+ NULL);
+ goo_canvas_polyline_new_line (priv->goo_canvas_root, 0, hour * 40, 50, hour * 40,
+ "stroke-color", "black",
+ NULL);
+ goo_canvas_rect_new (priv->goo_canvas_root, 55, hour * 40, 400, 20,
+ "line-width", 1.0,
+ "stroke-color", "black",
+ "fill-color", "yellow",
+ NULL);
+ goo_canvas_polyline_new_line (priv->goo_canvas_root, 25, hour * 40 + 20, 50, hour * 40 + 20,
+ "stroke-color", "black",
+ NULL);
+ goo_canvas_rect_new (priv->goo_canvas_root, 55, hour * 40 + 20, 400, 20,
+ "line-width", 1.0,
+ "stroke-color", "black",
+ "fill-color", "yellow",
+ NULL);
+ }
+}