From e61c74dba5dd3cd2a3e48aa1fc7ff2658e5cb6e1 Mon Sep 17 00:00:00 2001 From: Mattias Andrée Date: Sat, 6 Jun 2026 20:39:36 +0200 Subject: misc MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Mattias Andrée --- char-table.c | 44 ++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 44 insertions(+) create mode 100644 char-table.c (limited to 'char-table.c') diff --git a/char-table.c b/char-table.c new file mode 100644 index 0000000..da82544 --- /dev/null +++ b/char-table.c @@ -0,0 +1,44 @@ +/* See LICENSE file for copyright and license details. */ +#include "common.h" + +G_DEFINE_TYPE(CharTable, gcmap_char_table, GTK_TYPE_DRAWING_AREA) + + +static gboolean +gcmap_char_table_expose(GtkWidget *widget, GdkEventExpose *event) +{ + cairo_t *cr = gdk_cairo_create(widget->window); + + (void) event; + + cairo_set_source_rgb(cr, 0.2f, 0.2f, 0.2f); + cairo_paint(cr); + + cairo_set_source_rgb(cr, 1.0f, 1.0f, 1.0f); + cairo_move_to(cr, 10, 20); + cairo_show_text(cr, "Hello GTK+ 2"); + + cairo_destroy(cr); + return FALSE; +} + +static void +gcmap_char_table_init(CharTable *self) +{ + gtk_widget_set_size_request(GTK_WIDGET(self), 200, 100); +} + + +static void +gcmap_char_table_class_init(CharTableClass *klass) +{ + GtkWidgetClass *widget_class = GTK_WIDGET_CLASS(klass); + widget_class->expose_event = gcmap_char_table_expose; +} + + +GtkWidget * +gcmap_char_table_new(void) +{ + return g_object_new(GCMAP_TYPE_CHAR_TABLE, NULL); +} -- cgit v1.3.1