WIP: restructuring widget head (main window)
This commit is contained in:
parent
b3ea5c4676
commit
2115749c60
5
(notes)
5
(notes)
|
@ -1,5 +1,10 @@
|
|||
https://developer.gnome.org/hig/principles.html
|
||||
|
||||
// https://docs.gtk.org/gio/class.MenuModel.html
|
||||
// https://www.geany.org/manual/gtk/gobject/index.html
|
||||
// https://developer.gnome.org/hig/patterns/controls/menus.html
|
||||
|
||||
|
||||
|
||||
================================================================================
|
||||
|
||||
|
|
92
src/calls.c
92
src/calls.c
|
@ -348,6 +348,46 @@ void on_SITUATIONS_box_DO_RESET (GtkWidget *btt_reset, gpointer data)
|
|||
/******************************************************************************/
|
||||
|
||||
|
||||
void on_clicked_search (GtkWidget *btt_menu, gpointer list_box) {
|
||||
// next line presents the text_window and works only once.\nIt should present a menu.\n"); // TODO
|
||||
gtk_window_present (GTK_WINDOW (widget_head_get_TEXT_WINDOW()));
|
||||
}
|
||||
|
||||
void on_clicked_HOME (GtkWidget *btt_reset, gpointer data)
|
||||
{
|
||||
printf ("callback.on_clicked_HOME() button presents the dialog_window\
|
||||
( :- ) but it works only once.\n"); // TODO
|
||||
gtk_window_present (GTK_WINDOW (widget_head_get_DIALOG_WINDOW()));
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
/******************************************************************************/
|
||||
/* M E N U */
|
||||
/******************************************************************************/
|
||||
|
||||
void on_clicked_menu_experiment (GtkWidget *btt_menu, gpointer list_box) {
|
||||
printf ("callback.on_clicked_MENU() button > %p < &list_box > children nb > 3\n", list_box);
|
||||
// gpointer list_box = gtk_popover_get_child (GTK_POPOVER (pop));
|
||||
|
@ -363,21 +403,44 @@ void on_clicked_menu_experiment (GtkWidget *btt_menu, gpointer list_box) {
|
|||
// https://docs.gtk.org/gtk4/class.ListBox.html
|
||||
}
|
||||
|
||||
void on_clicked_search (GtkWidget *btt_menu, gpointer list_box) {
|
||||
// next line presents the text_window and works only once.\nIt should present a menu.\n"); // TODO
|
||||
gtk_window_present (GTK_WINDOW (widget_head_get_TEXT_WINDOW()));
|
||||
}
|
||||
|
||||
void on_clicked_HOME (GtkWidget *btt_reset, gpointer data)
|
||||
{
|
||||
printf ("callback.on_clicked_HOME() button presents the dialog_window\
|
||||
( :- ) but it works only once.\n"); // TODO
|
||||
gtk_window_present (GTK_WINDOW (widget_head_get_DIALOG_WINDOW()));
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
/******************************************************************************/
|
||||
/* M E N U */
|
||||
/* M E N U (from TREE) */
|
||||
/******************************************************************************/
|
||||
|
||||
static void on_user_menu_expander_toggled (GtkExpander *expander,
|
||||
|
@ -424,10 +487,3 @@ void on_setup_user_menu_factory (GtkSignalListItemFactory *factory,
|
|||
if (0) printf("[on_setup_user_menu_factory] here is an expander\n");
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
// GTK itself does not support event sounds, << A GREAT WAY TO DEBUG ! TODO
|
||||
// you have to use a loadable module like the one that comes with libcanberra.
|
||||
|
||||
|
||||
|
|
|
@ -35,6 +35,11 @@
|
|||
#define W_TEXT_WINDOW 700
|
||||
#define H_TEXT_WINDOW 1000
|
||||
|
||||
|
||||
/******************************************************************************/
|
||||
/* G E T + S E T A L L W I N D O W S */
|
||||
/******************************************************************************/
|
||||
|
||||
static GtkWindow *main_window, *dialog_window, *text_window;
|
||||
static GtkButton *btt_STATE, *btt_RULES, *btt_DATA;
|
||||
|
||||
|
@ -43,19 +48,13 @@ GtkWindow *widget_head_get_DIALOG_WINDOW() {return dialog_window;}
|
|||
GtkWindow *widget_head_get_TEXT_WINDOW() { return text_window; }
|
||||
|
||||
void widget_head_set_MAIN_WINDOW (GtkApplication *app)
|
||||
{
|
||||
main_window = GTK_WINDOW (gtk_application_window_new (app));
|
||||
}
|
||||
{ main_window = GTK_WINDOW (gtk_application_window_new (app)); }
|
||||
|
||||
void widget_head_set_DIALOG_WINDOW (GtkApplication *app)
|
||||
{
|
||||
dialog_window = GTK_WINDOW (gtk_application_window_new (app));
|
||||
}
|
||||
{ dialog_window = GTK_WINDOW (gtk_application_window_new (app)); }
|
||||
|
||||
void widget_head_set_TEXT_WINDOW (GtkApplication *app)
|
||||
{
|
||||
text_window = GTK_WINDOW (gtk_application_window_new (app));
|
||||
}
|
||||
{ text_window = GTK_WINDOW (gtk_application_window_new (app)); }
|
||||
|
||||
GtkButton *widget_head_get_GtkButton (char *btt_name)
|
||||
{
|
||||
|
@ -65,7 +64,11 @@ GtkButton *widget_head_get_GtkButton (char *btt_name)
|
|||
return NULL;
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
|
||||
/******************************************************************************/
|
||||
/* D I A L O G & T E X T W I N D O W S */
|
||||
/******************************************************************************/
|
||||
|
||||
void widget_head_TEXT_WINDOW_design (GtkWindow *main_window, GtkWindow *text_window)
|
||||
{
|
||||
|
@ -118,9 +121,25 @@ void widget_head_DIALOG_WINDOW_design (GtkWindow *main_window, GtkWindow *dialog
|
|||
gtk_window_set_modal (GTK_WINDOW (dialog_window), TRUE);
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
static void window_header_bar (GtkWindow *window, char *title)
|
||||
|
||||
/******************************************************************************/
|
||||
/* M A I N W I N D O W */
|
||||
/******************************************************************************/
|
||||
|
||||
static GtkWidget *window_header_bar (GtkWindow *window, char *title);
|
||||
|
||||
void widget_head_MAIN_WINDOW_design (GtkWindow *main_window){
|
||||
GtkWidget *header_bar = window_header_bar (main_window,
|
||||
"E coli (with permission from David S. Goodsell, 2009)");
|
||||
|
||||
// next line <=> calls.on_toggle_STATE_RULES_DATA (btt_STATE)
|
||||
gtk_check_button_set_active (GTK_CHECK_BUTTON (btt_STATE), TRUE);
|
||||
|
||||
gtk_window_present (GTK_WINDOW (main_window));
|
||||
}
|
||||
|
||||
static GtkWidget *window_header_bar (GtkWindow *window, char *title)
|
||||
{
|
||||
GtkWidget *header_bar = GTK_WIDGET (gtk_header_bar_new ());
|
||||
gtk_header_bar_set_title_widget (GTK_HEADER_BAR (header_bar), gtk_label_new (title));
|
||||
|
@ -195,10 +214,41 @@ static void window_header_bar (GtkWindow *window, char *title)
|
|||
gtk_menu_button_set_popover (open_menu, GTK_WIDGET (pop));
|
||||
gtk_header_bar_pack_end (GTK_HEADER_BAR (header_bar), GTK_WIDGET (open_menu));
|
||||
|
||||
// g_signal_connect (menu_item_D, "clicked", G_CALLBACK (on_clicked_menu_experiment), list_box);
|
||||
g_signal_connect (open_menu, "activate", G_CALLBACK (on_clicked_menu_experiment), list_box);
|
||||
// signal 'clicked' is invalid for instance '0xbcb2900' of type 'GtkMenuButton'
|
||||
// signal 'clicked' is invalid for instance '0x2812f80' of type 'GtkListBox'
|
||||
// signal 'clicked' is invalid for instance '0x2a15120' of type 'GtkLabel'
|
||||
// signal 'activate' is invalid for instance '0x17fb93d0' of type 'GtkLabel'
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
/*
|
||||
https://docs.gtk.org/gtk4/class.ListView.html
|
||||
GtkStringList *model = gtk_string_list_new (NULL); // model = create_application_list ();
|
||||
|
||||
GtkSignalListItemFactory *factory = GTK_SIGNAL_LIST_ITEM_FACTORY (gtk_signal_list_item_factory_new());
|
||||
g_signal_connect (factory, "setup", G_CALLBACK (setup_listitem_cb), NULL);
|
||||
g_signal_connect (factory, "bind", G_CALLBACK (bind_listitem_cb), NULL);
|
||||
|
||||
GtkStringList *list = gtk_list_view_new (GTK_SELECTION_MODEL (gtk_single_selection_new (model)), factory);
|
||||
|
||||
g_signal_connect (list, "activate", G_CALLBACK (activate_cb), NULL);
|
||||
|
||||
gtk_scrolled_window_set_child (GTK_SCROLLED_WINDOW (sw), list);
|
||||
*/
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
// ce qui suit ira dans le callback
|
||||
GtkListBoxRow *selected_row = gtk_list_box_get_selected_row (GTK_LIST_BOX (list_box));
|
||||
|
@ -208,13 +258,7 @@ static void window_header_bar (GtkWindow *window, char *title)
|
|||
|
||||
// g_signal_connect (menu_item_C, "clicked", G_CALLBACK (on_clicked_HOME), no_local_data);
|
||||
|
||||
}
|
||||
|
||||
void widget_head_MAIN_WINDOW_design (GtkWindow *main_window){
|
||||
window_header_bar (main_window,
|
||||
"E coli (with permission from David S. Goodsell, 2009)");
|
||||
gtk_check_button_set_active (GTK_CHECK_BUTTON (btt_STATE), TRUE);
|
||||
gtk_window_present (GTK_WINDOW (main_window));
|
||||
return header_bar;
|
||||
}
|
||||
|
||||
|
||||
|
|
Loading…
Reference in New Issue