From b4100e31c6dc02bb5009c32bac6c6a4988da7275 Mon Sep 17 00:00:00 2001 From: Jean Sirmai Date: Mon, 29 Jul 2024 22:27:36 +0200 Subject: [PATCH] Rules : premiere liste de conditions (premier bouton sous l'image 'before') --- src/widget/rules/select_one.c | 30 +++++++++++++++++++++++++++--- 1 file changed, 27 insertions(+), 3 deletions(-) diff --git a/src/widget/rules/select_one.c b/src/widget/rules/select_one.c index f2ad7db..12f4388 100644 --- a/src/widget/rules/select_one.c +++ b/src/widget/rules/select_one.c @@ -32,15 +32,39 @@ #include "../../../include/signal.h" +static void *get_btt_conditions_list() +{ + GtkWidget* list_box = gtk_list_box_new(); + GtkWidget *label_A = GTK_WIDGET (gtk_label_new("if (value (0,0,1,3) == 2)")); gtk_list_box_append (GTK_LIST_BOX (list_box), label_A); + GtkWidget *label_B = GTK_WIDGET (gtk_label_new("if (value (0,1,1,0) == 0)")); gtk_list_box_append (GTK_LIST_BOX (list_box), label_B); + GtkWidget *label_C = GTK_WIDGET (gtk_label_new("if (value (0,1,1,2) == 0)")); gtk_list_box_append (GTK_LIST_BOX (list_box), label_C); + GtkWidget *label_D = GTK_WIDGET (gtk_label_new("if (value (1,0,1,2) == 1)")); gtk_list_box_append (GTK_LIST_BOX (list_box), label_D); + GtkWidget *label_E = GTK_WIDGET (gtk_label_new("if (value (1,1,1,0) == 0)")); gtk_list_box_append (GTK_LIST_BOX (list_box), label_E); + + + GtkWidget *pop = gtk_popover_new (); + gtk_popover_set_child (GTK_POPOVER (pop), list_box); + gtk_popover_present (GTK_POPOVER (pop)); + gtk_popover_set_autohide (GTK_POPOVER (pop), FALSE); + gtk_popover_set_cascade_popdown (GTK_POPOVER (pop), TRUE); + + GtkMenuButton *conditions = GTK_MENU_BUTTON (gtk_menu_button_new ()); + const char *condition_text_1 = "conditions list"; + gtk_menu_button_set_label (GTK_MENU_BUTTON (conditions), condition_text_1); + gtk_menu_button_set_always_show_arrow (conditions, TRUE); + gtk_menu_button_set_popover (conditions, GTK_WIDGET (pop)); + gtk_widget_set_halign (GTK_WIDGET (conditions), GTK_ALIGN_START); + + return conditions; +} + static void *get_conditions_actions_names_box() { GtkBox *conditions_actions_names_box = GTK_BOX (gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 2)); GtkLayoutManager *conditions_actions_names_layout = gtk_box_layout_new (GTK_ORIENTATION_HORIZONTAL); gtk_box_layout_set_spacing (GTK_BOX_LAYOUT (conditions_actions_names_layout), 100); // << TODO gtk_box_append (conditions_actions_names_box, GTK_WIDGET (conditions_actions_names_layout)); - GtkButton *conditions = GTK_BUTTON (gtk_button_new_with_label ("\n conditions list\n")); - gtk_box_append (conditions_actions_names_box, GTK_WIDGET (conditions)); - gtk_widget_set_halign (GTK_WIDGET (conditions), GTK_ALIGN_START); + gtk_box_append (conditions_actions_names_box, GTK_WIDGET (get_btt_conditions_list ())); gtk_box_append (conditions_actions_names_box, GTK_WIDGET (gtk_separator_new (GTK_ORIENTATION_VERTICAL))); GtkButton *actions = GTK_BUTTON (gtk_button_new_with_label ("\n actions list\n")); gtk_box_append (conditions_actions_names_box, GTK_WIDGET (actions));