GTK4: start building similar thing through scratchpad

This commit is contained in:
NunoSempere 2024-07-20 21:15:34 -04:00
parent a7e0a98b1d
commit 6e7966b3b3
2 changed files with 44 additions and 0 deletions

2
scratchpad/makefile Normal file
View File

@ -0,0 +1,2 @@
build:
gcc -std=c99 -Wall `pkg-config --cflags gtk4` test.c -o rosenrot `pkg-config --libs gtk4`

42
scratchpad/test.c Normal file
View File

@ -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;
}