widget/rules/selected/wip_menu.c widget_get_btt_conditions_list() & assignations_list()
This commit is contained in:
parent
df71c999f9
commit
15470ea0a1
|
@ -198,6 +198,7 @@ void *widget_get_rule_analyse(); // analyse.c
|
|||
void *widget_get_selected_rule_texts();
|
||||
void *widget_get_selected_rule_images();
|
||||
void *widget_get_btt_conditions_list();
|
||||
void *widget_get_btt_assignations_list();
|
||||
|
||||
// def: widget / rules / selected / wip_menu.c
|
||||
GtkEntry widget_set_one_item_text_in_list (GtkWidget *list_box, const char *text);
|
||||
|
|
|
@ -31,32 +31,6 @@
|
|||
#include "../../../../include/widget.h"
|
||||
#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 ());
|
||||
gtk_menu_button_set_label (GTK_MENU_BUTTON (conditions), "conditions");
|
||||
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_btt_assign_list()
|
||||
{
|
||||
|
@ -82,7 +56,7 @@ static void *get_btt_assign_list()
|
|||
return actions;
|
||||
}
|
||||
|
||||
static void *get_btt_rule_identity()
|
||||
static void *widget_get_btt_rule_identity()
|
||||
{
|
||||
GtkWidget* list_box = gtk_list_box_new();
|
||||
GtkWidget *label_A = GTK_WIDGET (gtk_label_new("AMP > ADP")); gtk_list_box_append (GTK_LIST_BOX (list_box), label_A);
|
||||
|
@ -118,8 +92,8 @@ void *widget_get_selected_rule_texts()
|
|||
// allocate (GTK_LAYOUT_MANAGER (conditions_actions_identity_layout), get_btt_conditions_list (), 100, 20,100); TODO
|
||||
gtk_box_append (conditions_actions_names_box, GTK_WIDGET (label_ad_hoc));
|
||||
gtk_box_append (conditions_actions_names_box, GTK_WIDGET (widget_get_btt_conditions_list ()));
|
||||
gtk_box_append (conditions_actions_names_box, GTK_WIDGET (get_btt_assign_list()));
|
||||
gtk_box_append (conditions_actions_names_box, GTK_WIDGET (get_btt_rule_identity()));
|
||||
gtk_box_append (conditions_actions_names_box, GTK_WIDGET (widget_get_btt_assignations_list()));
|
||||
gtk_box_append (conditions_actions_names_box, GTK_WIDGET (widget_get_btt_rule_identity()));
|
||||
|
||||
return GTK_WIDGET (conditions_actions_names_box);
|
||||
}
|
||||
|
|
|
@ -30,9 +30,11 @@
|
|||
#include "../../../../include/fsm.h"
|
||||
#include "../../../../include/widget.h"
|
||||
#include "../../../../include/signal.h"
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
#define LIST_W 190
|
||||
#define LIST_H 800
|
||||
#define LIST_H 114
|
||||
|
||||
GtkEntry widget_set_one_item_text_in_list (GtkWidget *list_box, const char *text)
|
||||
{
|
||||
|
@ -51,32 +53,16 @@ void *widget_get_btt_conditions_list()
|
|||
gtk_scrolled_window_set_child (GTK_SCROLLED_WINDOW (scrolled_list_box), list_box);
|
||||
gtk_widget_set_size_request (GTK_WIDGET (scrolled_list_box), LIST_W, LIST_H); // OK (provisoire)
|
||||
|
||||
widget_set_one_item_text_in_list (list_box, "if ( value ( 0,2,0,1 ) == 1 )");
|
||||
widget_set_one_item_text_in_list (list_box, "if ( value ( 0,0,1,3 ) == 2 )");
|
||||
widget_set_one_item_text_in_list (list_box, "if ( value ( 0,1,1,0 ) == 0 )");
|
||||
widget_set_one_item_text_in_list (list_box, "if ( value ( 0,1,1,2 ) == 0 )");
|
||||
widget_set_one_item_text_in_list (list_box, "if ( value ( 1,0,1,2 ) == 1 )");
|
||||
widget_set_one_item_text_in_list (list_box, "if ( value ( 1,1,1,0 ) == 0 )");
|
||||
widget_set_one_item_text_in_list (list_box, "if ( value ( 2,2,0,1 ) == 1 )");
|
||||
widget_set_one_item_text_in_list (list_box, "if ( value ( 2,0,1,3 ) == 3 )");
|
||||
widget_set_one_item_text_in_list (list_box, "if ( value ( 3,4,1,0 ) == 0 )");
|
||||
widget_set_one_item_text_in_list (list_box, "if ( value ( 5,1,5,2 ) == 1 )");
|
||||
widget_set_one_item_text_in_list (list_box, "if ( value ( 5,0,3,4 ) == 2 )");
|
||||
widget_set_one_item_text_in_list (list_box, "if ( value ( 5,4,1,7 ) == 1 )");
|
||||
widget_set_one_item_text_in_list (list_box, "if ( value ( 6,2,0,1 ) == 1 )");
|
||||
widget_set_one_item_text_in_list (list_box, "if ( value ( 7,7,7,3 ) == 2 )");
|
||||
widget_set_one_item_text_in_list (list_box, "if ( value ( 7,1,4,10 ) == 1 )");
|
||||
widget_set_one_item_text_in_list (list_box, "if ( value ( 7,4,3,2 ) == 0 )");
|
||||
widget_set_one_item_text_in_list (list_box, "if ( value ( 8,0,1,2 ) == 1 )");
|
||||
widget_set_one_item_text_in_list (list_box, "if ( value ( 1,8,1,0 ) == 0 )");
|
||||
widget_set_one_item_text_in_list (list_box, "if ( value ( 2,2,8,1 ) == 1 )");
|
||||
widget_set_one_item_text_in_list (list_box, "if ( value ( 9,9,1,3 ) == 2 )");
|
||||
widget_set_one_item_text_in_list (list_box, "if ( value ( 3,9,4,5 ) == 2 )");
|
||||
widget_set_one_item_text_in_list (list_box, "if ( value ( 5,6,7,12 ) == 1 )");
|
||||
widget_set_one_item_text_in_list (list_box, "if ( value ( 7,0,3,4 ) == 2 )");
|
||||
widget_set_one_item_text_in_list (list_box, "if ( value ( 5,9,6,2 ) == 0 )");
|
||||
|
||||
|
||||
for (int i = 0; i < 32; i++)
|
||||
{
|
||||
char str1[40]; strcpy(str1, "if ( value (");
|
||||
char str2[5]; sprintf(str2, "%d, ", rand() % 10); strcat(str1, str2);
|
||||
char str3[5]; sprintf(str3, "%d, ", rand() % 10); strcat(str1, str3);
|
||||
char str4[5]; sprintf(str4, "%d, ", rand() % 10); strcat(str1, str4);
|
||||
char str5[8]; sprintf(str5, "%d) == ", rand() % 10); strcat(str1, str5);
|
||||
char str6[5]; sprintf(str6, "%d)", rand() % 10); strcat(str1, str6);
|
||||
widget_set_one_item_text_in_list (list_box, str1);
|
||||
}
|
||||
GtkWidget *pop = gtk_popover_new ();
|
||||
gtk_popover_set_child (GTK_POPOVER (pop), scrolled_list_box);
|
||||
gtk_popover_present (GTK_POPOVER (pop));
|
||||
|
@ -87,11 +73,40 @@ void *widget_get_btt_conditions_list()
|
|||
gtk_menu_button_set_label (GTK_MENU_BUTTON (conditions), "conditions");
|
||||
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;
|
||||
}
|
||||
|
||||
void *widget_get_btt_assignations_list()
|
||||
{
|
||||
GtkWidget *list_box = gtk_list_box_new();
|
||||
GtkWidget *scrolled_list_box = GTK_WIDGET (gtk_scrolled_window_new ());
|
||||
gtk_scrolled_window_set_child (GTK_SCROLLED_WINDOW (scrolled_list_box), list_box);
|
||||
gtk_widget_set_size_request (GTK_WIDGET (scrolled_list_box), LIST_W, LIST_H); // OK (provisoire)
|
||||
|
||||
for (int i = 0; i < 32; i++)
|
||||
{
|
||||
char str1[40]; strcpy(str1, "value (");
|
||||
char str2[5]; sprintf(str2, "%d, ", rand() % 10); strcat(str1, str2);
|
||||
char str3[5]; sprintf(str3, "%d, ", rand() % 10); strcat(str1, str3);
|
||||
char str4[5]; sprintf(str4, "%d, ", rand() % 10); strcat(str1, str4);
|
||||
char str5[8]; sprintf(str5, "%d) = ", rand() % 10); strcat(str1, str5);
|
||||
char str6[5]; sprintf(str6, "%d", rand() % 10); strcat(str1, str6);
|
||||
widget_set_one_item_text_in_list (list_box, str1);
|
||||
}
|
||||
GtkWidget *pop = gtk_popover_new ();
|
||||
gtk_popover_set_child (GTK_POPOVER (pop), scrolled_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 *actions = GTK_MENU_BUTTON (gtk_menu_button_new ());
|
||||
gtk_menu_button_set_label (GTK_MENU_BUTTON (actions), "actions");
|
||||
gtk_menu_button_set_always_show_arrow (actions, TRUE);
|
||||
gtk_menu_button_set_popover (actions, GTK_WIDGET (pop));
|
||||
|
||||
return actions;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
|
Loading…
Reference in New Issue