diff options
Diffstat (limited to 'gui/gtk/src/main.c')
| -rw-r--r-- | gui/gtk/src/main.c | 51 |
1 files changed, 51 insertions, 0 deletions
diff --git a/gui/gtk/src/main.c b/gui/gtk/src/main.c new file mode 100644 index 0000000..c25715c --- /dev/null +++ b/gui/gtk/src/main.c @@ -0,0 +1,51 @@ +#include <gtk/gtk.h> +#include <lib_butck.h> + +// Callback function for button click +static void on_button_clicked(GtkWidget *widget, gpointer data) { + g_print("Hello, World!\n"); +} + +// Callback function for window close +static void on_window_destroy(GtkWidget *widget, gpointer data) { + gtk_main_quit(); +} + +int main(int argc, char *argv[]) { + GtkWidget *window; + GtkWidget *button; + GtkWidget *box; + + // Initialize GTK + gtk_init(&argc, &argv); + + // Create main window + window = gtk_window_new(GTK_WINDOW_TOPLEVEL); + gtk_window_set_title(GTK_WINDOW(window), "Butchunker - GTK"); + gtk_window_set_default_size(GTK_WINDOW(window), 400, 300); + gtk_container_set_border_width(GTK_CONTAINER(window), 10); + + // Connect destroy signal + g_signal_connect(window, "destroy", G_CALLBACK(on_window_destroy), NULL); + + // Create vertical box container + box = gtk_box_new(GTK_ORIENTATION_VERTICAL, 5); + gtk_container_add(GTK_CONTAINER(window), box); + + // Create label + GtkWidget *label = gtk_label_new("Welcome to Butchunker!"); + gtk_box_pack_start(GTK_BOX(box), label, FALSE, FALSE, 0); + + // Create button + button = gtk_button_new_with_label("Click Me!"); + g_signal_connect(button, "clicked", G_CALLBACK(on_button_clicked), NULL); + gtk_box_pack_start(GTK_BOX(box), button, FALSE, FALSE, 0); + + // Show all widgets + gtk_widget_show_all(window); + + // Start GTK main loop + gtk_main(); + + return 0; +} |
