summaryrefslogtreecommitdiff
path: root/src/ld-canvas.c
diff options
context:
space:
mode:
authorPřemysl Janouch <p.janouch@gmail.com>2010-09-17 19:03:03 +0200
committerPřemysl Janouch <p.janouch@gmail.com>2010-09-19 19:12:12 +0200
commit341f51eb415c98c201b7744cea9ebc1fff321ad4 (patch)
treedf95eb3d7c8e416eb1e5669ee7f34e91f82ddb8e /src/ld-canvas.c
parentdb46ae550527f1a36101f613dafdb15e0b6ac530 (diff)
downloadlogdiag-341f51eb415c98c201b7744cea9ebc1fff321ad4.tar.gz
logdiag-341f51eb415c98c201b7744cea9ebc1fff321ad4.tar.xz
logdiag-341f51eb415c98c201b7744cea9ebc1fff321ad4.zip
Renamed source files.
Also a little change in CMakeLists.txt. The next commit is going to change the object prefix.
Diffstat (limited to 'src/ld-canvas.c')
-rw-r--r--src/ld-canvas.c99
1 files changed, 99 insertions, 0 deletions
diff --git a/src/ld-canvas.c b/src/ld-canvas.c
new file mode 100644
index 0000000..17e38a4
--- /dev/null
+++ b/src/ld-canvas.c
@@ -0,0 +1,99 @@
+/*
+ * ld-canvas.c
+ *
+ * This file is a part of logdiag.
+ * Copyright Přemysl Janouch 2010. All rights reserved.
+ *
+ * See the file LICENSE for licensing information.
+ *
+ */
+
+#include <gtk/gtk.h>
+
+#include "config.h"
+
+#include "ld-canvas.h"
+#include "ld-document.h"
+
+/* http://www.gnomejournal.org/article/34/writing-a-widget-using-cairo-and-gtk28 */
+
+/**
+ * SECTION:ld-canvas
+ * @short_description: A canvas.
+ * @see_also: #LogdiagDocument
+ *
+ * #LogdiagCanvas is used for displaying #LogdiagDocument objects.
+ */
+
+/*
+ * LogdiagCanvasPrivate:
+ * @document: A document object assigned to this canvas as a model.
+ */
+struct _LogdiagCanvasPrivate
+{
+ LogdiagDocument *document;
+};
+
+G_DEFINE_TYPE (LogdiagCanvas, logdiag_canvas, GTK_TYPE_DRAWING_AREA);
+
+static void
+logdiag_canvas_finalize (GObject *gobject);
+
+
+static void
+logdiag_canvas_class_init (LogdiagCanvasClass *klass)
+{
+ GObjectClass *object_class;
+ GtkWidgetClass *widget_class;
+
+ object_class = G_OBJECT_CLASS (klass);
+ object_class->finalize = logdiag_canvas_finalize;
+
+ widget_class = GTK_WIDGET_CLASS (klass);
+
+/**
+ * LogdiagCanvas::set-scroll-adjustments:
+ * @canvas: The canvas object.
+ *
+ * Contents of the library have changed.
+ */
+/*
+ widget_class->set_scroll_adjustments_signal = g_signal_new
+ ("set-scroll-adjustments", G_TYPE_FROM_CLASS (widget_class),
+ G_SIGNAL_RUN_LAST | G_SIGNAL_ACTION,
+ 0, // G_STRUCT_OFFSET (LogdiagCanvasClass, ...)
+ NULL, NULL,
+ gtk_marshal_NONE__POINTER_POINTER,
+ G_TYPE_NONE, 2, GTK_TYPE_ADJUSTMENT, GTK_TYPE_ADJUSTMENT);
+*/
+ g_type_class_add_private (klass, sizeof (LogdiagCanvasPrivate));
+}
+
+static void
+logdiag_canvas_init (LogdiagCanvas *self)
+{
+ self->priv = G_TYPE_INSTANCE_GET_PRIVATE
+ (self, LOGDIAG_TYPE_CANVAS, LogdiagCanvasPrivate);
+}
+
+static void
+logdiag_canvas_finalize (GObject *gobject)
+{
+ LogdiagCanvas *self;
+
+ self = LOGDIAG_CANVAS (gobject);
+
+ /* Chain up to the parent class. */
+ G_OBJECT_CLASS (logdiag_canvas_parent_class)->finalize (gobject);
+}
+
+/**
+ * logdiag_canvas_new:
+ *
+ * Create an instance.
+ */
+LogdiagCanvas *
+logdiag_canvas_new (void)
+{
+ return g_object_new (LOGDIAG_TYPE_CANVAS, NULL);
+}