diff --git a/include/fsm.h b/include/fsm.h index 2276eae..8cdd8ef 100644 --- a/include/fsm.h +++ b/include/fsm.h @@ -143,7 +143,8 @@ enum fsm_enum_log_source { SRC_CONTENT, /**< MAIN, APP, WIDGETS, SIGNAL */ MAIN, APP, WIDGETS, SIGNAL, WINDOW, /**< MAIN, DIALOG, MODAL, TEXT */ MAIN_WINDOW, DIALOG_WINDOW, MODAL_WINDOW, TEXT_WINDOW, - TOPBAR, /**< LEFT, CENTER, RIGHT */ TOPBAR_LEFT, TOPBAR_CENTER, TOPBAR_RIGHT, + HEADER_BAR, /**< LEFT, CENTER, RIGHT */ HEADER_BAR_LEFT, HEADER_BAR_CENTER, + HEADER_BAR_RIGHT, PAGE, /**< SYNTH, STATE, RULES, [USER TREE], [SELECTED_RULE], MEASURES, RESULTS */ SYNTH_PAGE, STATE_PAGE, RULES_PAGE, MEASURES_PAGE, RESULTS_PAGE, SYNTHESIS, /**< GLAREA, CAMERA, CONTROLS, RESULTS (duplicates from other pages) */ diff --git a/include/widget.h b/include/widget.h index a379674..35edeb7 100644 --- a/include/widget.h +++ b/include/widget.h @@ -31,3 +31,5 @@ void on_app_activation (GtkApplication *app); void widget_design_main_window (GtkWindow *main_window, GtkApplication *app); gboolean on_window_close_request (GtkWindow *main_window, gpointer user_data); +void on_toggle_exec_edit (GtkWidget *btt_XOR_EXEC_EDIT, gpointer user_data); + diff --git a/src/widget/main_window/design.c b/src/widget/main_window/design.c index def7ed1..d426bf8 100644 --- a/src/widget/main_window/design.c +++ b/src/widget/main_window/design.c @@ -33,6 +33,20 @@ #include "../../../include/widget.h" #include "../../../include/fsm.h" +/** + * every "on_" function is to go in "signal.c" (not yet implemented) + * + * @param *toggled_button + * @param user_data + */ +void on_toggle_exec_edit (GtkWidget *toggled_button, gpointer user_data) +{ + fsm_add_log (INFO, BUTTON, "signal", "toggle exec edit()", + "flip status request + bell 😇️ gdk_display_beep()"); + + gdk_display_beep (gdk_display_get_default()); +} + /** * @brief Main window design() * @@ -41,22 +55,34 @@ */ void widget_design_main_window (GtkWindow *main_window, GtkApplication *app) { - fsm_add_log (INFO, TOPBAR, "widget/main_window/design", + GtkWidget *header_bar = GTK_WIDGET (gtk_header_bar_new ()); + + gpointer no_local_data = NULL; + + fsm_add_log (INFO, HEADER_BAR_LEFT, "widget/main_window/design", __func__, "start of design"); - /* GtkWidget *topbar = GTK_WIDGET (gtk_header_bar_new ()); */ - - /* char *title = "E coli (with permission from David S. Goodsell, 2009)"; */ - /* gtk_header_bar_set_title_widget (GTK_HEADER_BAR (topbar), */ - /* gtk_label_new (title)); */ + char *title = "E coli (with permission from David S. Goodsell, 2009)"; + gtk_header_bar_set_title_widget (GTK_HEADER_BAR (header_bar), + gtk_label_new (title)); GtkWidget *e_coli = GTK_WIDGET (gtk_picture_new_for_filename ("./docs/showcase/E coli (Goodsell).png")); gtk_window_set_child (main_window, e_coli); + GtkButton *btt_XOR_EXEC_EDIT = GTK_BUTTON (gtk_toggle_button_new ()); + gtk_button_set_icon_name (btt_XOR_EXEC_EDIT, "power-profile-balanced-rtl-symbolic"); + g_signal_connect (btt_XOR_EXEC_EDIT, "clicked", G_CALLBACK (on_toggle_exec_edit), + no_local_data); + + gtk_header_bar_pack_start (GTK_HEADER_BAR (header_bar), + GTK_WIDGET (btt_XOR_EXEC_EDIT)); + + gtk_window_set_titlebar (main_window, GTK_WIDGET (header_bar)); + // g_object_unref (e_coli); - fsm_add_log (INFO, TOPBAR, "widget/main_window/design", - __func__, "end of design -> present"); + fsm_add_log (INFO, HEADER_BAR_LEFT, "widget/main_window/design", + __func__, "end of design -> present"); }