aboutsummaryrefslogtreecommitdiff
path: root/src/ctakgtk.c
diff options
context:
space:
mode:
authortslil <tslil@posteo.de>2021-01-29 19:28:15 -0500
committertslil <tslil@posteo.de>2026-08-28 19:37:41 +0100
commit7f7a0d0bfb8aa413997e9000a6be21308430ed3f (patch)
treea4ac71a0ba5f4b27765538960bfb383ff3f69812 /src/ctakgtk.c
parentbda3a7edb76c9fe3dc21cbe5a0836829b705b407 (diff)
Imported GTK 3.0 example, let's see what's involvedgtk
Diffstat (limited to 'src/ctakgtk.c')
-rw-r--r--src/ctakgtk.c52
1 files changed, 52 insertions, 0 deletions
diff --git a/src/ctakgtk.c b/src/ctakgtk.c
new file mode 100644
index 0000000..4ab690e
--- /dev/null
+++ b/src/ctakgtk.c
@@ -0,0 +1,52 @@
+#include <gtk-3.0/gtk/gtk.h>
+
+#include <tak.h>
+#include <negamax.h>
+
+inline void negamax_display_progress(const uint8_t cur_depth,
+ const uint32_t length) {
+ (void)(cur_depth);
+ (void)(length);
+
+}
+
+static void print_hello(GtkWidget *widget, gpointer data) {
+ (void)(widget);
+ (void)(data);
+
+ g_print("Exiting\n");
+}
+
+static void activate(GtkApplication* app, gpointer user_data) {
+ GtkWidget *window;
+ GtkWidget *button;
+ GtkWidget *button_box;
+
+ (void)(user_data);
+
+ window = gtk_application_window_new(app);
+ gtk_window_set_title(GTK_WINDOW(window), "ctakgtk");
+ gtk_window_set_default_size(GTK_WINDOW(window), 200, 200);
+
+ button_box = gtk_button_box_new(GTK_ORIENTATION_HORIZONTAL);
+ gtk_container_add(GTK_CONTAINER(window), button_box);
+
+ button = gtk_button_new_with_label("Hello World");
+ g_signal_connect(button, "clicked", G_CALLBACK(print_hello), NULL);
+ g_signal_connect_swapped(button, "clicked", G_CALLBACK(gtk_widget_destroy), window);
+ gtk_container_add(GTK_CONTAINER(button_box), button);
+
+ gtk_widget_show_all(window);
+}
+
+int main(int argc, char **argv) {
+ GtkApplication *app;
+ int status;
+
+ app = gtk_application_new("org.tslil.xyz", G_APPLICATION_FLAGS_NONE);
+ g_signal_connect(app, "activate", G_CALLBACK(activate), NULL);
+ status = g_application_run(G_APPLICATION(app), argc, argv);
+ g_object_unref(app);
+
+ return status;
+}