summaryrefslogtreecommitdiff
path: root/src/canvas.c
blob: 01686398923249c71c6316d94bd985506720988b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
/*
 * 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 "canvas.h"
#include "document.h"

/* http://www.gnomejournal.org/article/34/writing-a-widget-using-cairo-and-gtk28 */

/**
 * SECTION: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);
}