summaryrefslogtreecommitdiff
path: root/bin/display_driver.c
diff options
context:
space:
mode:
Diffstat (limited to 'bin/display_driver.c')
-rw-r--r--bin/display_driver.c53
1 files changed, 53 insertions, 0 deletions
diff --git a/bin/display_driver.c b/bin/display_driver.c
new file mode 100644
index 0000000..04f2900
--- /dev/null
+++ b/bin/display_driver.c
@@ -0,0 +1,53 @@
1#include <gtk/gtk.h>
2#include <stdio.h>
3#include <string.h>
4
5// Define the features array
6char *features[] = {"recourses", "greeting", "pomodoro", "weather", "speech", "command center"};
7
8// Function to create a button with a label
9void create_button(const char *label) {
10 GtkWidget *button = gtk_button_new_with_label(label);
11 // You can set the button properties or add it to a container here
12 g_print("Button created: %s\n", label); // For debugging purposes
13}
14
15static void activate(GtkApplication *app, gpointer user_data) {
16 // Create the window
17 GtkWidget *window = gtk_application_window_new(app);
18 gtk_window_set_title(GTK_WINDOW(window), "I2C CONTROLLER");
19 gtk_window_set_default_size(GTK_WINDOW(window), 400, 400);
20
21 // Create a container for buttons (e.g., vertical box)
22 GtkWidget *vbox = gtk_box_new(GTK_ORIENTATION_VERTICAL, 5);
23 gtk_container_add(GTK_CONTAINER(window), vbox);
24
25 // Calculate the number of features
26 int features_count = sizeof(features) / sizeof(features[0]);
27
28 // Create a button for each feature
29 for (int i = 0; i < features_count; i++) {
30 GtkWidget *button = gtk_button_new_with_label(features[i]);
31 gtk_box_pack_start(GTK_BOX(vbox), button, FALSE, FALSE, 0);
32 gtk_widget_set_size_request(button, 200, 100);
33 }
34
35 // Show all widgets
36 gtk_widget_show_all(window);
37}
38
39int main(int argc, char *argv[]) {
40 // Create the application
41 GtkApplication *app = gtk_application_new("com.example.GTK4Test", G_APPLICATION_FLAGS_NONE);
42
43 // Connect the "activate" signal to the callback function
44 g_signal_connect(app, "activate", G_CALLBACK(activate), NULL);
45
46 // Run the application
47 int status = g_application_run(G_APPLICATION(app), argc, argv);
48
49 // Clean up
50 g_object_unref(app);
51
52 return status;
53}