WIP: adding a stack_switcher in the header_bar... a switcher, but not its pages ?...
This commit is contained in:
parent
53f2fea60c
commit
29b09fa771
14
(notes)
14
(notes)
|
@ -24,6 +24,20 @@ graph_stack.c: (316) stack->arrows_nb = set_arrow (stack_id, stack->arrows_nb
|
||||||
|
|
||||||
contain is called (#included) in : callback, display, tree, graph_stack, graph_area, init,
|
contain is called (#included) in : callback, display, tree, graph_stack, graph_area, init,
|
||||||
|
|
||||||
|
--------------------------------------------------------------------------------
|
||||||
|
https://developer.gnome.org/documentation/guidelines.html
|
||||||
|
https://developer.gnome.org/documentation/guidelines/devel-docs.html
|
||||||
|
|
||||||
|
https://docs.gtk.org/gtk4/class.StackPage.html
|
||||||
|
https://docs.gtk.org/gtk4/class.Stack.html
|
||||||
|
https://docs.gtk.org/gtk4/class.StackSwitcher.html
|
||||||
|
|
||||||
|
https://docs.gtk.org/gtk4/method.StackSwitcher.set_stack.html
|
||||||
|
https://docs.gtk.org/gtk4/ctor.StackSwitcher.new.html
|
||||||
|
https://docs.gtk.org/gtk4/ctor.Stack.new.html
|
||||||
|
|
||||||
|
https://docs.gtk.org/gtk4/class.ToggleButton.html
|
||||||
|
|
||||||
--------------------------------------------------------------------------------
|
--------------------------------------------------------------------------------
|
||||||
|
|
||||||
// https://docs.gtk.org/gtk4/visual_index.html < widgets gallery
|
// https://docs.gtk.org/gtk4/visual_index.html < widgets gallery
|
||||||
|
|
|
@ -188,19 +188,19 @@ void on_toggle_EXEC_EDIT (GtkWidget *btt_XOR_EXEC_EDIT, GtkWidget *btt_MODEL_RUN
|
||||||
|
|
||||||
void on_open_STATE (GtkWidget *btt_open_STATE, gpointer data) {
|
void on_open_STATE (GtkWidget *btt_open_STATE, gpointer data) {
|
||||||
g_print ("Toggle button %s is active: %s\n",
|
g_print ("Toggle button %s is active: %s\n",
|
||||||
gtk_button_get_label (GTK_TOGGLE_BUTTON (btt_open_STATE)),
|
gtk_button_get_label (GTK_BUTTON (btt_open_STATE)),
|
||||||
gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (btt_open_STATE)) ? "Yes" : "No");
|
gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (btt_open_STATE)) ? "Yes" : "No");
|
||||||
}//{window_main_child (main_window, STATE); toggle_TO (RUN, STATE);}
|
}//{window_main_child (main_window, STATE); toggle_TO (RUN, STATE);}
|
||||||
|
|
||||||
void on_open_RULES (GtkWidget *btt_open_RULES, gpointer data) {
|
void on_open_RULES (GtkWidget *btt_open_RULES, gpointer data) {
|
||||||
g_print ("Toggle button %s is active: %s\n",
|
g_print ("Toggle button %s is active: %s\n",
|
||||||
gtk_button_get_label (GTK_TOGGLE_BUTTON (btt_open_RULES)),
|
gtk_button_get_label (GTK_BUTTON (btt_open_RULES)),
|
||||||
gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (btt_open_RULES)) ? "Yes" : "No");
|
gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (btt_open_RULES)) ? "Yes" : "No");
|
||||||
}//{window_main_child (main_window, RULES); toggle_TO (RUN, RULES);}
|
}//{window_main_child (main_window, RULES); toggle_TO (RUN, RULES);}
|
||||||
|
|
||||||
void on_open_DATA (GtkWidget *btt_open_DATA, gpointer data) {
|
void on_open_DATA (GtkWidget *btt_open_DATA, gpointer data) {
|
||||||
g_print ("Toggle button %s is active: %s\n",
|
g_print ("Toggle button %s is active: %s\n",
|
||||||
gtk_button_get_label (GTK_TOGGLE_BUTTON (btt_open_DATA)),
|
gtk_button_get_label (GTK_BUTTON (btt_open_DATA)),
|
||||||
gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (btt_open_DATA)) ? "Yes" : "No");
|
gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (btt_open_DATA)) ? "Yes" : "No");
|
||||||
}//{window_main_child (main_window, DATA); toggle_TO (RUN, DATA);}
|
}//{window_main_child (main_window, DATA); toggle_TO (RUN, DATA);}
|
||||||
|
|
||||||
|
|
44
contain.c
44
contain.c
|
@ -1,5 +1,6 @@
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <gtk-4.0/gtk/gtk.h>
|
#include <gtk-4.0/gtk/gtk.h>
|
||||||
|
#include <glib-object.h>
|
||||||
|
|
||||||
#include "callback.h"
|
#include "callback.h"
|
||||||
#include "automaton.h"
|
#include "automaton.h"
|
||||||
|
@ -152,7 +153,7 @@ void window_main_child_bottom (GtkBox *page_box){
|
||||||
// gtk_box_append (page_box, GTK_WIDGET (get_SPACE_EDIT_controls_box()));
|
// gtk_box_append (page_box, GTK_WIDGET (get_SPACE_EDIT_controls_box()));
|
||||||
}
|
}
|
||||||
|
|
||||||
static void icons_for_fun (GtkHeaderBar *header_bar);
|
// static void icons_for_fun (GtkHeaderBar *header_bar);
|
||||||
|
|
||||||
void window_header_bar (GtkWindow *window, char *title){
|
void window_header_bar (GtkWindow *window, char *title){
|
||||||
GtkWidget *header_bar = GTK_WIDGET (gtk_header_bar_new ());
|
GtkWidget *header_bar = GTK_WIDGET (gtk_header_bar_new ());
|
||||||
|
@ -193,14 +194,31 @@ void window_header_bar (GtkWindow *window, char *title){
|
||||||
// g_signal_connect (btt_open_RULES, "toggled", G_CALLBACK (on_open_RULES), no_local_data);
|
// g_signal_connect (btt_open_RULES, "toggled", G_CALLBACK (on_open_RULES), no_local_data);
|
||||||
// g_signal_connect (btt_open_DATA, "toggled", G_CALLBACK (on_open_DATA), no_local_data);
|
// g_signal_connect (btt_open_DATA, "toggled", G_CALLBACK (on_open_DATA), no_local_data);
|
||||||
|
|
||||||
gtk_header_bar_pack_start (GTK_HEADER_BAR (header_bar), GTK_WIDGET (btt_XOR_EXEC_EDIT));
|
GtkBox *page_box = GTK_BOX (gtk_box_new (GTK_ORIENTATION_VERTICAL, 2));
|
||||||
gtk_header_bar_pack_start (GTK_HEADER_BAR (header_bar), GTK_WIDGET (btt_MODEL_RUN_STOP));
|
gtk_box_append (page_box, GTK_WIDGET (get_OBJECTS_and_SITUATIONS()));
|
||||||
gtk_header_bar_pack_start (GTK_HEADER_BAR (header_bar), GTK_WIDGET (any_Label));
|
gtk_box_append (page_box, GTK_WIDGET (gtk_separator_new (GTK_ORIENTATION_HORIZONTAL)));
|
||||||
gtk_header_bar_pack_start (GTK_HEADER_BAR (header_bar), GTK_WIDGET (btt_open_STATE));
|
gtk_box_append (page_box, GTK_WIDGET (get_SPACE_VIEW_box()));
|
||||||
gtk_header_bar_pack_start (GTK_HEADER_BAR (header_bar), GTK_WIDGET (btt_open_RULES));
|
gtk_box_append (page_box, GTK_WIDGET (gtk_separator_new (GTK_ORIENTATION_HORIZONTAL)));
|
||||||
gtk_header_bar_pack_start (GTK_HEADER_BAR (header_bar), GTK_WIDGET (btt_open_DATA));
|
gtk_box_append (page_box, GTK_WIDGET (get_TIME_EXEC_controls_box()));
|
||||||
|
|
||||||
icons_for_fun (GTK_HEADER_BAR (header_bar)); // https://iconduck.com/sets/adwaita-icon-theme
|
// GObject *a_stack_page = g_object_new (GTK_STACK_PAGE ? );
|
||||||
|
// https://docs.gtk.org/gobject/tutorial.html#how-to-define-and-implement-a-new-gobject
|
||||||
|
|
||||||
|
GtkWidget *a_stack = gtk_stack_new ();
|
||||||
|
GtkWidget *a_switcher = gtk_stack_switcher_new ();
|
||||||
|
gtk_stack_switcher_set_stack (GTK_STACK_SWITCHER (a_switcher), GTK_STACK (a_stack));
|
||||||
|
gtk_stack_add_titled (GTK_STACK (a_stack), GTK_WIDGET (page_box), "a_name", "space");
|
||||||
|
// gtk_stack_page_set_visible (*self, TRUE);
|
||||||
|
|
||||||
|
gtk_header_bar_pack_start (GTK_HEADER_BAR (header_bar), GTK_WIDGET (btt_XOR_EXEC_EDIT));
|
||||||
|
// gtk_header_bar_pack_start (GTK_HEADER_BAR (header_bar), GTK_WIDGET (btt_MODEL_RUN_STOP));
|
||||||
|
gtk_header_bar_pack_start (GTK_HEADER_BAR (header_bar), GTK_WIDGET (any_Label));
|
||||||
|
// gtk_header_bar_pack_start (GTK_HEADER_BAR (header_bar), GTK_WIDGET (btt_open_STATE));
|
||||||
|
// gtk_header_bar_pack_start (GTK_HEADER_BAR (header_bar), GTK_WIDGET (btt_open_RULES));
|
||||||
|
// gtk_header_bar_pack_start (GTK_HEADER_BAR (header_bar), GTK_WIDGET (btt_open_DATA));
|
||||||
|
gtk_header_bar_pack_start (GTK_HEADER_BAR (header_bar), GTK_WIDGET (a_switcher));
|
||||||
|
|
||||||
|
// icons_for_fun (GTK_HEADER_BAR (header_bar)); // https://iconduck.com/sets/adwaita-icon-theme
|
||||||
}
|
}
|
||||||
|
|
||||||
void window_main_child (GtkWindow *main_window, int selected_page){
|
void window_main_child (GtkWindow *main_window, int selected_page){
|
||||||
|
@ -208,18 +226,19 @@ void window_main_child (GtkWindow *main_window, int selected_page){
|
||||||
switch (selected_page) {
|
switch (selected_page) {
|
||||||
case (INTER) : //SWITCH_TO (INTER);
|
case (INTER) : //SWITCH_TO (INTER);
|
||||||
break;
|
break;
|
||||||
case (STATE) :
|
case (STATE) :*/
|
||||||
GtkBox *page_box = GTK_BOX (gtk_box_new (GTK_ORIENTATION_VERTICAL, 2));
|
GtkBox *page_box = GTK_BOX (gtk_box_new (GTK_ORIENTATION_VERTICAL, 2));
|
||||||
gtk_box_append (page_box, GTK_WIDGET (get_OBJECTS_and_SITUATIONS()));
|
gtk_box_append (page_box, GTK_WIDGET (get_OBJECTS_and_SITUATIONS()));
|
||||||
gtk_box_append (page_box, GTK_WIDGET (gtk_separator_new (GTK_ORIENTATION_HORIZONTAL)));
|
gtk_box_append (page_box, GTK_WIDGET (gtk_separator_new (GTK_ORIENTATION_HORIZONTAL)));
|
||||||
gtk_box_append (page_box, GTK_WIDGET (get_SPACE_VIEW_box()));
|
gtk_box_append (page_box, GTK_WIDGET (get_SPACE_VIEW_box()));
|
||||||
gtk_box_append (page_box, GTK_WIDGET (gtk_separator_new (GTK_ORIENTATION_HORIZONTAL)));
|
gtk_box_append (page_box, GTK_WIDGET (gtk_separator_new (GTK_ORIENTATION_HORIZONTAL)));
|
||||||
|
gtk_box_append (page_box, GTK_WIDGET (get_TIME_EXEC_controls_box()));
|
||||||
// window_main_child_bottom (page_box);
|
// window_main_child_bottom (page_box);
|
||||||
// if (!get_mode ()) gtk_box_append (page_box, GTK_WIDGET (get_TIME_EXEC_controls_box()));
|
// if (!get_mode ()) gtk_box_append (page_box, GTK_WIDGET (get_TIME_EXEC_controls_box()));
|
||||||
// else gtk_box_append (page_box, GTK_WIDGET (get_SPACE_EDIT_controls_box()));
|
// else gtk_box_append (page_box, GTK_WIDGET (get_SPACE_EDIT_controls_box()));
|
||||||
gtk_window_set_child (main_window, GTK_WIDGET (page_box));
|
gtk_window_set_child (main_window, GTK_WIDGET (page_box));
|
||||||
//SWITCH_TO (STATE);
|
//SWITCH_TO (STATE);
|
||||||
break;
|
/* break;
|
||||||
case (RULES) : gtk_window_set_child (main_window, GTK_WIDGET (get_rules_page_new()));
|
case (RULES) : gtk_window_set_child (main_window, GTK_WIDGET (get_rules_page_new()));
|
||||||
//SWITCH_TO (RULES);
|
//SWITCH_TO (RULES);
|
||||||
break;
|
break;
|
||||||
|
@ -236,7 +255,7 @@ void window_main_child (GtkWindow *main_window, int selected_page){
|
||||||
}
|
}
|
||||||
|
|
||||||
void main_window_design (GtkWindow *main_window){
|
void main_window_design (GtkWindow *main_window){
|
||||||
window_main_child (main_window, STATE);
|
// window_main_child (main_window, STATE);
|
||||||
window_header_bar (main_window,
|
window_header_bar (main_window,
|
||||||
"E coli (with permission from David S. Goodsell, 2009)");
|
"E coli (with permission from David S. Goodsell, 2009)");
|
||||||
gtk_window_present (GTK_WINDOW (main_window));
|
gtk_window_present (GTK_WINDOW (main_window));
|
||||||
|
@ -252,7 +271,7 @@ void main_window_design (GtkWindow *main_window){
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
static void icons_for_fun (GtkHeaderBar *header_bar)
|
static void icons_for_fun (GtkHeaderBar *header_bar)
|
||||||
{
|
{
|
||||||
GtkButton *go_home = GTK_BUTTON (gtk_button_new ());
|
GtkButton *go_home = GTK_BUTTON (gtk_button_new ());
|
||||||
|
@ -323,3 +342,4 @@ static void icons_for_fun (GtkHeaderBar *header_bar)
|
||||||
gtk_button_set_icon_name (power_low, "power-profile-power-saver-symbolic");
|
gtk_button_set_icon_name (power_low, "power-profile-power-saver-symbolic");
|
||||||
gtk_header_bar_pack_end (header_bar, GTK_WIDGET (power_low));
|
gtk_header_bar_pack_end (header_bar, GTK_WIDGET (power_low));
|
||||||
}
|
}
|
||||||
|
*/
|
||||||
|
|
Loading…
Reference in New Issue