commit 6e7966b3b3a78aeb624c00cb249151631881548d
parent a7e0a98b1d51d88f63831dee9258ca14bbff6fa9
Author: NunoSempere <nuno.semperelh@protonmail.com>
Date: Sat, 20 Jul 2024 21:15:34 -0400
GTK4: start building similar thing through scratchpad
Diffstat:
2 files changed, 44 insertions(+), 0 deletions(-)
diff --git a/scratchpad/makefile b/scratchpad/makefile
@@ -0,0 +1,2 @@
+build:
+ gcc -std=c99 -Wall `pkg-config --cflags gtk4` test.c -o rosenrot `pkg-config --libs gtk4`
diff --git a/scratchpad/test.c b/scratchpad/test.c
@@ -0,0 +1,42 @@
+#include <gtk/gtk.h>
+
+#define WIDTH 1920 // 960 for half-width, 1920 for full width
+// #define HEIGHT 1080
+#define HEIGHT 1080
+
+static GtkNotebook* notebook;
+
+int
+main (int argc, char **argv)
+{
+ GtkWidget *window;
+ // Initialize i18n support with bindtextdomain(), etc.
+
+ // ...
+
+ // Initialize the widget set
+ gtk_init ();
+
+ // Create the main window
+ window = gtk_window_new ();
+ gtk_window_set_default_size(GTK_WINDOW(window), WIDTH, HEIGHT);
+
+ // Set up our GUI elements
+
+ notebook = GTK_NOTEBOOK(gtk_notebook_new());
+ gtk_notebook_set_show_tabs(notebook, false);
+ gtk_notebook_set_show_border(notebook, false);
+
+ // ...
+
+ // Show the application window
+ gtk_window_present (GTK_WINDOW (window));
+ gtk_window_set_child(GTK_WINDOW(window), GTK_WIDGET(notebook));
+
+ // Enter the main event loop, and wait for user interaction
+ while (!0)
+ g_main_context_iteration (NULL, TRUE);
+
+ // The user lost interest
+ return 0;
+}