mumm... let's make a little commit before changing everything...
This commit is contained in:
parent
3d5e5d2d69
commit
a26478ff8d
|
@ -162,3 +162,11 @@ void on_something_else (GtkWidget *btt, gpointer data);
|
|||
void on_closing_page (GtkWidget *btt, gpointer data);
|
||||
|
||||
void on_start_new_engine (GtkWidget *btt, gpointer data);
|
||||
|
||||
|
||||
/******************************************************************************/
|
||||
/* R U L E S */
|
||||
/******************************************************************************/
|
||||
|
||||
void on_entry_name_insert_after (GtkWidget *entry, gpointer data);
|
||||
void on_entry_name_delete_after (GtkWidget *entry, gpointer data);
|
||||
|
|
|
@ -202,7 +202,7 @@ void *widget_get_btt_assignations_list();
|
|||
void *widget_get_btt_rule_identity();
|
||||
|
||||
// def: widget / rules / selected / wip_menu.c
|
||||
GtkEntry widget_set_one_item_text_in_list (GtkWidget *list_box, const char *text);
|
||||
GtkEntry widget_set_item_text (GtkWidget *list_box, const char *text, bool editable);
|
||||
|
||||
/******************************************************************************/
|
||||
/* D A T A */
|
||||
|
|
16
src/signal.c
16
src/signal.c
|
@ -453,3 +453,19 @@ void on_measure_third_event_occurences_in_between (GtkWidget *btt, gpointer data
|
|||
GTK_WIDGET (widget_measure_third_event_occurences_in_between()));
|
||||
}
|
||||
|
||||
|
||||
/******************************************************************************/
|
||||
/* R U L E S */
|
||||
/******************************************************************************/
|
||||
|
||||
void on_entry_name_insert_after (GtkWidget *entry, gpointer data)
|
||||
{
|
||||
printf("on_entry_name_insert_after(.)\n");
|
||||
}
|
||||
|
||||
void on_entry_name_delete_after (GtkWidget *entry, gpointer data)
|
||||
{
|
||||
printf("on_entry_name_delete_after(.)\n");
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -27,9 +27,9 @@
|
|||
* * * * * * * * * * * * * * * * * * * * * * * * * * */
|
||||
|
||||
|
||||
#include "../../../../include/fsm.h"
|
||||
#include "../../../../include/widget.h"
|
||||
#include "../../../../include/signal.h"
|
||||
#include "../../../../../include/fsm.h"
|
||||
#include "../../../../../include/widget.h"
|
||||
#include "../../../../../include/signal.h"
|
||||
|
||||
|
||||
void *widget_get_selected_rule_algebra()
|
|
@ -36,11 +36,30 @@
|
|||
#define LIST_W 190
|
||||
#define LIST_H 114
|
||||
|
||||
GtkEntry widget_set_one_item_text_in_list (GtkWidget *list_box, const char *text)
|
||||
|
||||
static void widget_let_us_play_with_events (GtkEntry *entry)
|
||||
{
|
||||
gtk_entry_set_icon_from_icon_name (entry, 0, "text-editor-symbolic");
|
||||
gtk_entry_set_icon_activatable (entry, GTK_ENTRY_ICON_PRIMARY, TRUE);
|
||||
// https://docs.gtk.org/gtk4/input-handling.html
|
||||
// https://docs.gtk.org/gdk4/enum.EventType.html
|
||||
// https://docs.gtk.org/gtk4/method.IMContext.filter_keypress.html
|
||||
// g_signal_connect (entry, "clicked", G_CALLBACK (on_clicked_topbar_right_home), NULL);
|
||||
g_signal_connect_after( entry, "insert-text", G_CALLBACK (on_entry_name_insert_after), NULL );
|
||||
g_signal_connect_after( entry, "delete-text", G_CALLBACK (on_entry_name_delete_after), NULL );
|
||||
// icon_press (entry, GTK_ENTRY_ICON_PRIMARY, NULL);
|
||||
}
|
||||
|
||||
GtkEntry widget_set_item_text (GtkWidget *list_box,
|
||||
const char *text,
|
||||
bool editable)
|
||||
{
|
||||
int text_length = 40;
|
||||
GtkEntryBuffer *entry_buffer = gtk_entry_buffer_new (text, text_length);
|
||||
GtkEntry *entry = GTK_ENTRY (gtk_entry_new ());
|
||||
gtk_entry_set_overwrite_mode (entry, editable);
|
||||
if (! editable) widget_let_us_play_with_events (entry);
|
||||
gtk_entry_get_buffer (entry);
|
||||
gtk_entry_set_buffer (GTK_ENTRY (entry), GTK_ENTRY_BUFFER (entry_buffer));
|
||||
gtk_list_box_append (GTK_LIST_BOX (list_box), GTK_WIDGET (entry));
|
||||
return *entry;
|
||||
|
@ -51,7 +70,7 @@ void *widget_get_btt_conditions_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)
|
||||
gtk_widget_set_size_request (GTK_WIDGET (scrolled_list_box), LIST_W, LIST_H);
|
||||
|
||||
for (int i = 0; i < 32; i++)
|
||||
{
|
||||
|
@ -61,7 +80,7 @@ void *widget_get_btt_conditions_list()
|
|||
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);
|
||||
widget_set_item_text (list_box, str1, TRUE);
|
||||
}
|
||||
GtkWidget *pop = gtk_popover_new ();
|
||||
gtk_popover_set_child (GTK_POPOVER (pop), scrolled_list_box);
|
||||
|
@ -82,7 +101,7 @@ 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)
|
||||
gtk_widget_set_size_request (GTK_WIDGET (scrolled_list_box), LIST_W, LIST_H);
|
||||
|
||||
for (int i = 0; i < 32; i++)
|
||||
{
|
||||
|
@ -92,7 +111,7 @@ void *widget_get_btt_assignations_list()
|
|||
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);
|
||||
widget_set_item_text (list_box, str1, TRUE);
|
||||
}
|
||||
GtkWidget *pop = gtk_popover_new ();
|
||||
gtk_popover_set_child (GTK_POPOVER (pop), scrolled_list_box);
|
||||
|
@ -111,14 +130,21 @@ void *widget_get_btt_assignations_list()
|
|||
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);
|
||||
GtkWidget *label_B = GTK_WIDGET (gtk_label_new("AMP-activated protein kinase")); gtk_list_box_append (GTK_LIST_BOX (list_box), label_B);
|
||||
GtkWidget *label_C = GTK_WIDGET (gtk_label_new("date")); gtk_list_box_append (GTK_LIST_BOX (list_box), label_C);
|
||||
GtkWidget *label_D = GTK_WIDGET (gtk_label_new("author")); gtk_list_box_append (GTK_LIST_BOX (list_box), label_D);
|
||||
GtkWidget *label_E = GTK_WIDGET (gtk_label_new("status, activity")); gtk_list_box_append (GTK_LIST_BOX (list_box), label_E);
|
||||
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 + 100, LIST_H);
|
||||
|
||||
widget_set_item_text (list_box, "AMP > ADP", TRUE);
|
||||
widget_set_item_text (list_box, " > AMP-activated protein kinase", FALSE);
|
||||
widget_set_item_text (list_box, "date", TRUE);
|
||||
widget_set_item_text (list_box, "author", TRUE);
|
||||
widget_set_item_text (list_box, "status", TRUE);
|
||||
widget_set_item_text (list_box, "activity", TRUE);
|
||||
widget_set_item_text (list_box, "group", TRUE);
|
||||
widget_set_item_text (list_box, "last edition date", TRUE);
|
||||
|
||||
GtkWidget *pop = gtk_popover_new ();
|
||||
gtk_popover_set_child (GTK_POPOVER (pop), list_box);
|
||||
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);
|
||||
|
@ -127,7 +153,6 @@ void *widget_get_btt_rule_identity()
|
|||
gtk_menu_button_set_label (GTK_MENU_BUTTON (identity), "identity");
|
||||
gtk_menu_button_set_always_show_arrow (identity, TRUE);
|
||||
gtk_menu_button_set_popover (identity, GTK_WIDGET (pop));
|
||||
// gtk_widget_set_halign (GTK_WIDGET (identity), GTK_ALIGN_START);
|
||||
|
||||
return identity;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue