]> git.scottworley.com Git - batteryviewer/blobdiff - chart.c
Start on chart GTK widget
[batteryviewer] / chart.c
diff --git a/chart.c b/chart.c
new file mode 100644 (file)
index 0000000..3efd454
--- /dev/null
+++ b/chart.c
@@ -0,0 +1,29 @@
+/*
+ * h/t https://ptomato.name/advanced-gtk-techniques/html/custom-container.html
+ * for examples of how to make GTK widgets
+ */
+
+#include "chart.h"
+#include <gtk/gtk.h>
+
+#define BV_CHART_PRIVATE(obj)                                                  \
+  (G_TYPE_INSTANCE_GET_PRIVATE((obj), BV_CHART_TYPE, BVChartPrivate))
+
+typedef struct _BVChartPrivate BVChartPrivate;
+
+struct _BVChartPrivate {
+  int temp;
+};
+
+G_DEFINE_TYPE_WITH_CODE(BVChart, bv_chart, GTK_TYPE_DRAWING_AREA,
+                        G_ADD_PRIVATE(BVChart))
+
+static void bv_chart_class_init(BVChartClass *klass __attribute__((unused))) {}
+
+static void bv_chart_init(BVChart *chart) {
+  gtk_widget_set_has_window(GTK_WIDGET(chart), FALSE);
+}
+
+GtkWidget *bv_chart_new() {
+  return GTK_WIDGET(g_object_new(bv_chart_get_type(), NULL));
+}