modules ? how to ?
This commit is contained in:
parent
d767873533
commit
6a2f0fd2ca
34
main.c
34
main.c
|
@ -1,4 +1,5 @@
|
|||
#include <gtk/gtk.h>
|
||||
#include "./warm.h"
|
||||
|
||||
static void print (GtkWidget *widget, gpointer data) {g_print (data);}
|
||||
|
||||
|
@ -10,17 +11,22 @@ static void activate (GtkApplication *app, gpointer user_data) {
|
|||
GtkWidget *button_4 = gtk_button_new_with_label ("IV");
|
||||
GtkWidget *button_5 = gtk_button_new_with_label ("V");
|
||||
|
||||
char *text = "niofnein";
|
||||
printf("in main.c : %s\n", text);
|
||||
// print_text(text);
|
||||
|
||||
GtkWidget *window = gtk_application_window_new (app);
|
||||
GtkWidget *titlebar = gtk_header_bar_new();
|
||||
|
||||
GtkWidget *switcher = gtk_stack_switcher_new();
|
||||
// GtkWidget *sidebar = gtk_stack_sidebar_new();
|
||||
GtkStack *stack = GTK_STACK (gtk_stack_new());
|
||||
GtkWidget *page_0 = gtk_paned_new(GTK_ORIENTATION_VERTICAL);
|
||||
GtkWidget *page_1 = gtk_paned_new(GTK_ORIENTATION_VERTICAL);
|
||||
GtkWidget *page_2 = gtk_paned_new(GTK_ORIENTATION_VERTICAL);
|
||||
GtkWidget *grid = gtk_grid_new();
|
||||
GtkWidget *grid_3 = gtk_grid_new();
|
||||
// GtkWidget *grid_1 = gtk_grid_new();
|
||||
GtkWidget *box = gtk_box_new (0, 6); // 6 = spacing
|
||||
GtkWidget *box_1 = gtk_box_new (0, 6); // 6 = spacing
|
||||
|
||||
gtk_window_set_title (GTK_WINDOW (window), "Window");
|
||||
gtk_widget_set_size_request (window, 60, 0);
|
||||
|
@ -37,17 +43,22 @@ static void activate (GtkApplication *app, gpointer user_data) {
|
|||
gtk_grid_attach (GTK_GRID (grid), button_0, 0, 1, 2, 1);
|
||||
gtk_box_append (GTK_BOX (box), button_3);
|
||||
gtk_box_append (GTK_BOX (box), button_4);
|
||||
gtk_box_append (GTK_BOX (box_1), button_5);
|
||||
|
||||
|
||||
gtk_grid_attach (GTK_GRID (grid), box, 0, 2, 2, 1);
|
||||
|
||||
// https://developer-old.gnome.org/gtk4/stable/GtkStack.html
|
||||
// https://developer.gnome.org/documentation/index.html
|
||||
// https://docs.gtk.org/gtk4/enum.AccessibleRole.html
|
||||
|
||||
// GtkToggleButton *tb1 = GTK_TOGGLE_BUTTON (gtk_button_new_with_label ("tb1"));
|
||||
gtk_stack_add_titled (stack, page_1, "n°0", "A");
|
||||
gtk_stack_add_titled (stack, page_2, "n°1", "B");
|
||||
GtkStackPage *page_3 = gtk_stack_add_titled (stack, grid_3, "n°2", "C");
|
||||
gtk_grid_attach (GTK_GRID (grid_3), button_5, 0, 0, 1, 1);
|
||||
gtk_stack_add_titled (stack, page_0, "n°0", "A");
|
||||
gtk_stack_add_titled (stack, page_1, "n°1", "B");
|
||||
GtkStackPage *page_2 = gtk_stack_add_titled (stack, box_1, "any name", "C");
|
||||
gtk_stack_page_set_name (page_2, "n°2");
|
||||
|
||||
|
||||
// gtk_grid_attach (GTK_GRID (grid_1), button_5, 0, 0, 1, 1);
|
||||
|
||||
|
||||
gtk_orientable_set_orientation (GTK_ORIENTABLE (switcher), GTK_ORIENTATION_VERTICAL);
|
||||
|
@ -56,17 +67,12 @@ static void activate (GtkApplication *app, gpointer user_data) {
|
|||
gtk_stack_switcher_set_stack (GTK_STACK_SWITCHER (switcher), stack);
|
||||
// gtk_stack_sidebar_set_stack (GTK_STACK_SIDEBAR (sidebar), stack);
|
||||
|
||||
// gtk_stack_page_get_child (GTK_STACK_PAGE(page_1));
|
||||
gtk_stack_page_set_name (GTK_STACK_PAGE(page_3), "new name");
|
||||
|
||||
GtkSelectionModel *stack_selection_model = gtk_stack_get_pages (stack);
|
||||
gtk_selection_model_select_item (stack_selection_model, 2, 1);
|
||||
// gtk_stack_set_visible_child_name (stack, "n°3");
|
||||
|
||||
printf("selected page name is [%s] (can't get its title !)\n",
|
||||
printf("selected page name is [%s] (how do I get its title ?)\n",
|
||||
gtk_stack_get_visible_child_name (stack));
|
||||
gtk_stack_set_transition_type (GTK_STACK (stack),
|
||||
GTK_STACK_TRANSITION_TYPE_CROSSFADE);
|
||||
// gtk_stack_set_transition_type (GTK_STACK (stack), GTK_STACK_TRANSITION_TYPE_CROSSFADE);
|
||||
|
||||
gtk_grid_attach (GTK_GRID (grid), switcher, 0, 3, 2, 1);
|
||||
gtk_window_present (GTK_WINDOW (window));
|
||||
|
|
|
@ -0,0 +1,15 @@
|
|||
#pragma once
|
||||
#include <unistd.h>
|
||||
#include <stdio.h>
|
||||
#include <gtk-4.0/gtk/gtk.h>
|
||||
|
||||
button_0 = gtk_button_new_with_label ("Quit");
|
||||
GtkWidget *button_1 = gtk_button_new_with_label ("I");
|
||||
GtkWidget *button_2 = gtk_button_new_with_label ("II");
|
||||
GtkWidget *button_3 = gtk_button_new_with_label ("III");
|
||||
GtkWidget *button_4 = gtk_button_new_with_label ("IV");
|
||||
GtkWidget *button_5 = gtk_button_new_with_label ("V");
|
||||
|
||||
// GtkToggleButton *tb1 = GTK_TOGGLE_BUTTON (gtk_button_new_with_label ("tb1"));
|
||||
|
||||
void print_text(char *text) {printf("in warm.c : %s\n", text);}
|
|
@ -0,0 +1,24 @@
|
|||
#pragma once
|
||||
#include <assert.h>
|
||||
#include <errno.h>
|
||||
#include <fcntl.h>
|
||||
#include <math.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <stdbool.h>
|
||||
#include <sys/types.h>
|
||||
#include <sys/stat.h>
|
||||
#include <unistd.h>
|
||||
#include <glib-2.0/glib.h>
|
||||
#include <gtk-4.0/gtk/gtk.h>
|
||||
|
||||
extern GtkWidget *button_0;
|
||||
extern GtkWidget *button_1;
|
||||
extern GtkWidget *button_2;
|
||||
extern GtkWidget *button_3;
|
||||
extern GtkWidget *button_4;
|
||||
extern GtkWidget *button_5;
|
||||
|
||||
void print_text(char *text);
|
||||
|
Loading…
Reference in New Issue