in contain.c gtk_window_set_titlebar() ok (line 187)

This commit is contained in:
Jean Sirmai 2024-05-28 22:23:20 +02:00
parent 566b67f10f
commit 97cd568e15
Signed by: jean
GPG Key ID: FB3115C340E057E3
3 changed files with 23 additions and 10 deletions

View File

@ -66,6 +66,8 @@ http://css.mammouthland.net/feuille-de-style-css-debutant.php
https://docs.gtk.org/gtk3/method.Widget.set_name.html
Widgets can be named, which allows you to refer to them from a CSS file.
https://docs.w3cub.com/gtk~4.0/gtkstylecontext.html
https://docs.gtk.org/gtk3/class.StyleContext.html
GtkStyleContext is an object that stores styling information affecting a widget defined by GtkWidgetPath.
on peut déclarer les styles à différents endroits, et selon ces endroits ils seront plus ou moins prioritaires.
On obtient donc une cascade de styles. Par priorité décroissante :

View File

@ -178,10 +178,17 @@ void window_bar(GtkWindow *window, char *title){
}
void experimental_activate_00 (GtkApplication *app, GtkWindow *window) {
window_bar (window, "E coli (with permission from David S. Goodsell, 2009)");
// window_bar (window, "E coli (with permission from David S. Goodsell, 2009)");
GtkWidget *my_header_bar = gtk_header_bar_new ();
gtk_header_bar_set_title_widget (my_header_bar, GTK_WIDGET (gtk_label_new ("E coli (with permission from David S. Goodsell, 2009)")));
GtkWidget *run_edit = gtk_toggle_button_new ();
gtk_button_set_icon_name (run_edit, "system-run-symbolic");
gtk_header_bar_pack_start (my_header_bar, run_edit);
gtk_window_set_titlebar (window, my_header_bar);
GtkNotebook *run_notebook = GTK_NOTEBOOK (gtk_notebook_new());
gtk_notebook_set_tab_pos (run_notebook, GTK_POS_TOP); // GTK_POS_LEFT
// gtk_notebook_set_tab_pos (run_notebook, GTK_POS_TOP); // TOP par défaut ? possible : GTK_POS_LEFT
gtk_notebook_append_page (run_notebook, get_run_space_page_new(), gtk_label_new ("space"));
gtk_notebook_append_page (run_notebook, get_run_rules_page_new(), gtk_label_new ("rules"));
@ -191,7 +198,7 @@ void experimental_activate_00 (GtkApplication *app, GtkWindow *window) {
gtk_notebook_append_page (run_notebook, get_run_help_page_new(), gtk_label_new ("help"));
GtkNotebook *edit_notebook = GTK_NOTEBOOK (gtk_notebook_new());
gtk_notebook_set_tab_pos (edit_notebook, GTK_POS_TOP); // GTK_POS_RIGHT
// gtk_notebook_set_tab_pos (edit_notebook, GTK_POS_TOP); // TOP par défaut, I presume
gtk_notebook_append_page (edit_notebook, get_edit_space_page_new(), gtk_label_new ("space"));
gtk_notebook_append_page (edit_notebook, get_edit_rules_page_new(), gtk_label_new ("rules"));
@ -207,7 +214,7 @@ void experimental_activate_00 (GtkApplication *app, GtkWindow *window) {
gtk_paned_set_position (GTK_PANED (run_xor_edit_horizontal_pane), W_IMAGE + 350); // '350' : AD HOC
gtk_window_set_child (window, GTK_WIDGET (run_xor_edit_horizontal_pane));
gtk_notebook_set_current_page (run_notebook, 1); // @see hot.c 2024-05-11 (line 68)
gtk_notebook_set_current_page (edit_notebook, 1); // @see hot.c 2024-05-11 (line 68)
gtk_notebook_set_current_page (run_notebook, 0); // @see tree.c 2024-05-11 (line 68)
gtk_notebook_set_current_page (edit_notebook, 1); // @see tree.c 2024-05-11 (line 68)
}

View File

@ -93,12 +93,16 @@ static GtkWidget *get_scroll_speed(){
gtk_widget_set_size_request (GTK_WIDGET (scroll_speed), 120, 2);
// gtk_scale_set_has_origin (GTK_SCALE (scroll_speed), TRUE);
// gtk_scale_set_draw_value (GTK_SCALE (scroll_speed), TRUE);
// void value_changed ( GtkRange* self, gpointer user_data)
// void value_changed ( GtkRange* self, gpointer user_data);
// 2024-05-28 essais
const gchar *new_name = "new_name"; gtk_widget_set_name (scroll_speed, new_name);
// const GtkWidgetPath* gtk_style_context_get_path (GtkStyleContext* context);
//
// GtkStyleContext *my_context = gtk_style_context_new ();
gtk_style_context_set_state (gtk_widget_get_style_context (scroll_speed), 100);
printf("display.get_scroll_speed() gtk_style_context_get_state (gtk_widget_get_style_context (scroll_speed)) = %d\n", gtk_style_context_get_state (gtk_widget_get_style_context (scroll_speed)));
if (0) printf("display.get_scroll_speed() gtk_style_context_get_state (gtk_widget_get_style_context (scroll_speed)) = %d\n",\
gtk_style_context_get_state (gtk_widget_get_style_context (scroll_speed)));
return scroll_speed;
}
@ -119,9 +123,9 @@ static GtkBox *get_DO_SPEED_box(){
GtkBox *get_RUN_STOP_box(){
GtkBox *RUN_STOP_box = GTK_BOX(gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 20));
gtk_box_append (RUN_STOP_box, GTK_WIDGET (get_UNDO_SPEED_box()));
gtk_box_append (RUN_STOP_box, GTK_WIDGET(gtk_label_new (" STEP\n(show active rule) ")));
gtk_box_append (RUN_STOP_box, GTK_WIDGET (gtk_label_new (" STEP\n(show active rule) ")));
gtk_box_append (RUN_STOP_box, GTK_WIDGET (get_DO_SPEED_box()));
gtk_box_append (RUN_STOP_box, GTK_WIDGET(gtk_label_new (" R U N\n S T O P")));
gtk_box_append (RUN_STOP_box, GTK_WIDGET (gtk_label_new (" R U N\n S T O P")));
return RUN_STOP_box;
}
//------------------------------------------------------------------------------