From f22ecd890ec08d6d66e01bca6c9e735ba4e3771b Mon Sep 17 00:00:00 2001 From: Jean Sirmai Date: Mon, 29 Jul 2024 18:08:59 +0200 Subject: [PATCH] Introducing [CONDITIONS] [ACTIONS] lists and [NAME] of the selected rule --- src/widget/rules/select_one.c | 61 ++++++++++++++++++++++++++++++----- 1 file changed, 53 insertions(+), 8 deletions(-) diff --git a/src/widget/rules/select_one.c b/src/widget/rules/select_one.c index ab52b4b..f2ad7db 100644 --- a/src/widget/rules/select_one.c +++ b/src/widget/rules/select_one.c @@ -32,12 +32,33 @@ #include "../../../include/signal.h" +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 (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)); + gtk_widget_set_halign (GTK_WIDGET (actions), GTK_ALIGN_CENTER); + gtk_box_append (conditions_actions_names_box, GTK_WIDGET (gtk_separator_new (GTK_ORIENTATION_VERTICAL))); + GtkButton *names = GTK_BUTTON (gtk_button_new_with_label ("\n names list\n")); + gtk_box_append (conditions_actions_names_box, GTK_WIDGET (names)); + gtk_widget_set_halign (GTK_WIDGET (names), GTK_ALIGN_END); + return GTK_WIDGET (conditions_actions_names_box); +} + + static void *get_under_rule_before() { GtkBox *under_rule_before_box = GTK_BOX (gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 2)); gtk_box_append (under_rule_before_box, - GTK_WIDGET (gtk_label_new ("\n | - - - - - - (some widgets here) - - - - - - - |\ - [ rule_before ] | - - - - - - - - (some other widgets there) - - - - - - - |"))); + GTK_WIDGET (gtk_label_new ("\n | - - - - - (some widgets here) - - - - |\ + [ rule_before ] | - - - - - (some other widgets there) - - - - - | \n"))); return GTK_WIDGET (under_rule_before_box); } @@ -46,8 +67,8 @@ static void *get_under_rule_after() { GtkBox *under_rule_after_box = GTK_BOX (gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 2)); gtk_box_append (under_rule_after_box, - GTK_WIDGET (gtk_label_new ("\n | - - - - - - - (some widgets here) - - - - - - - |\ - [ rule_after ] | - - - - - - - - (some other widgets there) - - - - - - - - |"))); + GTK_WIDGET (gtk_label_new ("\n | - - - - - - (some widgets here) - - - - - - |\ + [ rule_after ] | - - - - - - (some other widgets there) - - - - - - |\n"))); return GTK_WIDGET (under_rule_after_box); } @@ -60,7 +81,7 @@ static void *get_rule_before() ("/home/jean/Gem-Graph/gem-graph-client/data/image/AMP.png"))); gtk_box_append (rule_before, GTK_WIDGET (gtk_separator_new (GTK_ORIENTATION_VERTICAL))); gtk_box_append (rule_before, GTK_WIDGET (get_under_rule_before())); - gtk_widget_set_size_request (GTK_WIDGET (rule_before), W_IMAGE_LOCAL / 4, H_IMAGE_LOCAL / 3); +// gtk_widget_set_size_request (GTK_WIDGET (rule_before), W_IMAGE_LOCAL / 2, H_IMAGE_LOCAL / 2); return GTK_WIDGET (rule_before); } @@ -72,11 +93,11 @@ static void *get_rule_after() ("/home/jean/Gem-Graph/gem-graph-client/data/image/ADP.png"))); gtk_box_append (rule_after, GTK_WIDGET (gtk_separator_new (GTK_ORIENTATION_VERTICAL))); gtk_box_append (rule_after, GTK_WIDGET (get_under_rule_after())); -// gtk_widget_set_size_request (GTK_WIDGET (rule_after), W_IMAGE_LOCAL / 2, H_IMAGE_LOCAL / 2); +// gtk_widget_set_size_request (GTK_WIDGET (rule_after), W_IMAGE_LOCAL / 12, H_IMAGE_LOCAL / 12); return GTK_WIDGET (rule_after); } -void *widget_get_selected_rule() { +void *deprec_widget_get_selected_rule() { GtkPaned *before_vs_after = GTK_PANED (gtk_paned_new (GTK_ORIENTATION_HORIZONTAL)); gtk_paned_set_start_child (before_vs_after, GTK_WIDGET (get_rule_before ())); @@ -85,9 +106,33 @@ void *widget_get_selected_rule() { gtk_paned_set_shrink_start_child (before_vs_after, TRUE); gtk_paned_set_shrink_end_child (before_vs_after, TRUE); - gtk_paned_set_position (before_vs_after, 770); // WARNING : c'est une position "absolue" + gtk_paned_set_position (before_vs_after, 730); // WARNING : c'est une position "absolue" // gtk_widget_set_size_request (GTK_WIDGET (before_vs_after), W_IMAGE_LOCAL, H_IMAGE_LOCAL); return GTK_WIDGET (before_vs_after); } + +void *widget_get_selected_rule_images() { + + GtkBox *before_vs_after = GTK_BOX (gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 2)); + gtk_box_append (before_vs_after, GTK_WIDGET (get_rule_before ())); + gtk_box_append (before_vs_after, GTK_WIDGET (gtk_separator_new (GTK_ORIENTATION_VERTICAL))); + gtk_box_append (before_vs_after, GTK_WIDGET (get_rule_after ())); +// gtk_widget_set_size_request (GTK_WIDGET (before_vs_after), W_IMAGE_LOCAL / 10, H_IMAGE_LOCAL / 10); + + return GTK_WIDGET (before_vs_after); +} + + +void *widget_get_selected_rule() { + + GtkBox *images_and_texts = GTK_BOX (gtk_box_new (GTK_ORIENTATION_VERTICAL, 2)); + gtk_box_append (images_and_texts, GTK_WIDGET (widget_get_selected_rule_images ())); + gtk_box_append (images_and_texts, GTK_WIDGET (gtk_separator_new (GTK_ORIENTATION_HORIZONTAL))); + gtk_box_append (images_and_texts, GTK_WIDGET (get_conditions_actions_names_box ())); +// gtk_widget_set_size_request (GTK_WIDGET (images_and_texts), W_IMAGE_LOCAL / 10, H_IMAGE_LOCAL / 10); + + return GTK_WIDGET (images_and_texts); +} +