WIP: GtkStringList *my_string_list = gtk_string_list_new ((const char * const *) array);
This commit is contained in:
parent
6039ebacd9
commit
05230b7a64
|
@ -72,6 +72,7 @@ int main(int argc, char **argv)
|
||||||
"This signal comes from main.c");
|
"This signal comes from main.c");
|
||||||
|
|
||||||
// Jean 2024-01-20 Je désactive la visualisation de la fenêtre principale
|
// Jean 2024-01-20 Je désactive la visualisation de la fenêtre principale
|
||||||
|
// dans : application.c > gem_graph_client_application_activate()
|
||||||
// pour ne travailler que dans la fenêtre de sand_box.c
|
// pour ne travailler que dans la fenêtre de sand_box.c
|
||||||
|
|
||||||
res = g_application_run(G_APPLICATION(app), argc, argv);
|
res = g_application_run(G_APPLICATION(app), argc, argv);
|
||||||
|
|
|
@ -119,7 +119,7 @@ static void gem_graph_client_application_activate(GApplication *app)
|
||||||
// Jean 2024-01-20 Je désactive la visualisation de cette fenêtre
|
// Jean 2024-01-20 Je désactive la visualisation de cette fenêtre
|
||||||
// pour travailler dans une fenêtre minimale (cf. sand_box)
|
// pour travailler dans une fenêtre minimale (cf. sand_box)
|
||||||
//
|
//
|
||||||
gtk_window_present(window);
|
// gtk_window_present(window);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|
|
@ -28,24 +28,49 @@
|
||||||
#include "../../include/base.h"
|
#include "../../include/base.h"
|
||||||
#include "../../include/ui.h"
|
#include "../../include/ui.h"
|
||||||
|
|
||||||
static void just_use_gtk_application_window_new()
|
|
||||||
{
|
|
||||||
GtkApplication *app = gtk_application_new ("org.gtk.test", 0);
|
|
||||||
GtkWidget *that_window = gtk_application_window_new (app);
|
|
||||||
char *that_window_title = "Gloups ! Who am I ?";
|
|
||||||
gtk_window_set_title (GTK_WINDOW(that_window), that_window_title);
|
|
||||||
gtk_window_set_default_size (GTK_WINDOW(that_window), 300, 300);
|
|
||||||
gtk_widget_show (that_window);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
int n = 0;
|
int n = 0;
|
||||||
static void on_button_action (GtkWidget *widget, gpointer data){n++; g_print (data, n);}
|
static void on_button_action (GtkWidget *widget, gpointer data){n++; g_print (data, n);}
|
||||||
static void on_destroy (GtkWidget *widget, gpointer data) {if (data) g_print (data); exit(0);}
|
static void on_destroy (GtkWidget *widget, gpointer data) {if (data) g_print (data); exit(0);}
|
||||||
|
|
||||||
void on_activate_window_creation (GtkApplication *app, gpointer data) {
|
static void just_use_gtk_application_window_new()
|
||||||
|
{
|
||||||
|
GtkApplication *app = gtk_application_new ("org.gtk.test", 0);
|
||||||
|
GtkWidget *that_window = gtk_application_window_new (app);
|
||||||
|
g_signal_connect (G_OBJECT (that_window), "destroy", G_CALLBACK(on_destroy), "closes window using exit(0)\n");
|
||||||
|
char *that_window_title = "Gloups ! Who am I ?";
|
||||||
|
gtk_window_set_title (GTK_WINDOW(that_window), that_window_title);
|
||||||
|
gtk_window_set_default_size (GTK_WINDOW(that_window), 300, 300);
|
||||||
|
gtk_widget_show (that_window);
|
||||||
|
|
||||||
just_use_gtk_application_window_new();
|
char *array[] = {"one", "two", "three", "four", NULL};
|
||||||
|
GtkStringList *my_string_list = gtk_string_list_new ((const char * const *) array);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/* model = GtkStringList(string.(names(Gtk4))) */
|
||||||
|
/* selmodel = GtkSelectionModel(GtkSingleSelection(GListModel(model))) */
|
||||||
|
|
||||||
|
/* function setup_cb(f, li) */
|
||||||
|
/* set_child(li,GtkLabel("")) */
|
||||||
|
/* end */
|
||||||
|
|
||||||
|
/* function bind_cb(f, li) */
|
||||||
|
/* text = li[].string */
|
||||||
|
/* label = get_child(li) */
|
||||||
|
/* label.label = text */
|
||||||
|
/* end */
|
||||||
|
|
||||||
|
/* factory = GtkSignalListItemFactory(setup_cb, bind_cb) */
|
||||||
|
/* list = GtkListView(selmodel, factory) */
|
||||||
|
|
||||||
|
/* win = GtkWindow("Listview demo", 250, 800) */
|
||||||
|
/* sw = GtkScrolledWindow() */
|
||||||
|
/* win[] = sw */
|
||||||
|
/* sw[] = list */
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void on_activate_window_creation (GtkApplication *app, gpointer data) {
|
||||||
|
|
||||||
GtkDebugFlags my_debug_flags = gtk_get_debug_flags ();
|
GtkDebugFlags my_debug_flags = gtk_get_debug_flags ();
|
||||||
if (0) printf("my_debug_flags %d\n", my_debug_flags); // << null // gtk_init (); < usefulness ?
|
if (0) printf("my_debug_flags %d\n", my_debug_flags); // << null // gtk_init (); < usefulness ?
|
||||||
|
@ -62,15 +87,17 @@ void on_activate_window_creation (GtkApplication *app, gpointer data) {
|
||||||
|
|
||||||
my_box = gtk_box_new (GTK_ORIENTATION_VERTICAL, 0);
|
my_box = gtk_box_new (GTK_ORIENTATION_VERTICAL, 0);
|
||||||
gtk_window_set_child(GTK_WINDOW(my_window), GTK_WIDGET(my_box));
|
gtk_window_set_child(GTK_WINDOW(my_window), GTK_WIDGET(my_box));
|
||||||
gtk_widget_show (my_window); // show != present
|
// gtk_widget_show (my_window); // L E A R N > !!! show() != present() !!!
|
||||||
|
|
||||||
my_button = gtk_button_new_with_label (my_button_title);
|
my_button = gtk_button_new_with_label (my_button_title);
|
||||||
g_signal_connect(G_OBJECT (my_button), "clicked", G_CALLBACK(on_button_action), "button clicked (n = %d)\n");
|
g_signal_connect (G_OBJECT (my_button), "clicked", G_CALLBACK(on_button_action), "button clicked (n = %d)\n");
|
||||||
// g_signal_connect_swapped (my_button, "clicked", G_CALLBACK (gtk_window_close), my_window); // < Then my_button closes my_window
|
// g_signal_connect_swapped (my_button, "clicked", G_CALLBACK (gtk_window_close), my_window); // < Then my_button closes my_window
|
||||||
g_signal_connect(G_OBJECT (my_window), "destroy", G_CALLBACK(on_destroy), "closes window using exit(0)\n");
|
g_signal_connect (G_OBJECT (my_window), "destroy", G_CALLBACK(on_destroy), "closes window using exit(0)\n");
|
||||||
|
|
||||||
gtk_box_append(GTK_BOX (my_box), GTK_WIDGET(my_button)); // else : gtk_window_set_child (GTK_WINDOW (my_window), my_button);
|
gtk_box_append(GTK_BOX (my_box), GTK_WIDGET(my_button)); // else : gtk_window_set_child (GTK_WINDOW (my_window), my_button);
|
||||||
|
|
||||||
|
just_use_gtk_application_window_new();
|
||||||
|
|
||||||
if (data) {g_print (data); g_print (" and is displayed by [sand_box.c > on_activate_window_creation()] NB #define G_DEBUG_HERE (void) added\n");}
|
if (data) {g_print (data); g_print (" and is displayed by [sand_box.c > on_activate_window_creation()] NB #define G_DEBUG_HERE (void) added\n");}
|
||||||
printf("-------------------------------------------------------------------------------------------------------------------------------------------\n\
|
printf("-------------------------------------------------------------------------------------------------------------------------------------------\n\
|
||||||
[sand_box.c > on_activate_window_creation()] > widgets examples are in user/jean/01/GTK4/tree (learning)/The_Gnome_way/demos/gtk-demo <\n");
|
[sand_box.c > on_activate_window_creation()] > widgets examples are in user/jean/01/GTK4/tree (learning)/The_Gnome_way/demos/gtk-demo <\n");
|
||||||
|
|
Loading…
Reference in New Issue