Compare commits

...

2 Commits

18 changed files with 84 additions and 29 deletions

View File

@ -162,3 +162,11 @@ void on_something_else (GtkWidget *btt, gpointer data);
void on_closing_page (GtkWidget *btt, gpointer data); void on_closing_page (GtkWidget *btt, gpointer data);
void on_start_new_engine (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);

View File

@ -170,7 +170,7 @@ void widget_state_XYZ_reset_all();
// def: widget / rules / selected / dispatch.c (= right) // def: widget / rules / selected / dispatch.c (= right)
void *widget_get_rules_tree_tools_pane(); void *widget_get_rules_tree_tools_pane();
void *widget_get_rules_selected_pane(); void *widget_get_single_selected_rule_pane();
// call: widget / rules / tree_tools / dispatch.c / widget_get_rules_tree_tools_pane() // call: widget / rules / tree_tools / dispatch.c / widget_get_rules_tree_tools_pane()
@ -182,7 +182,7 @@ void *widget_get_rules_tree_tools(); // pilot_box.c
void *widget_get_rules_use(); // freq.c void *widget_get_rules_use(); // freq.c
// call: widget / rules / selected / dispatch.c / widget_get_rules_selected_pane() // call: widget / rules / selected / dispatch.c / widget_get_single_selected_rule_pane()
// def: widget / rules / selected / dispatch.c // def: widget / rules / selected / dispatch.c
// def: widget / rules / selected / edit.c // def: widget / rules / selected / edit.c
// def: widget / rules / selected / enquire.c // def: widget / rules / selected / enquire.c
@ -202,7 +202,7 @@ void *widget_get_btt_assignations_list();
void *widget_get_btt_rule_identity(); void *widget_get_btt_rule_identity();
// def: widget / rules / selected / wip_menu.c // 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 */ /* D A T A */

View File

@ -45,6 +45,8 @@
/* */ /* */
/******************************************************************************/ /******************************************************************************/
/*
static void static void
setup_listitem_cb (GtkListItemFactory *factory, setup_listitem_cb (GtkListItemFactory *factory,
GtkListItem *list_item) GtkListItem *list_item)
@ -79,6 +81,8 @@ activate_cb (GtkListView *list,
g_app_info_launch (app_info, NULL, NULL, NULL); g_app_info_launch (app_info, NULL, NULL, NULL);
g_object_unref (app_info); g_object_unref (app_info);
} }
*/
/* /*
static void static void

View File

@ -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())); 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");
}

View File

@ -36,11 +36,30 @@
#define LIST_W 190 #define LIST_W 190
#define LIST_H 114 #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; int text_length = 40;
GtkEntryBuffer *entry_buffer = gtk_entry_buffer_new (text, text_length); GtkEntryBuffer *entry_buffer = gtk_entry_buffer_new (text, text_length);
GtkEntry *entry = GTK_ENTRY (gtk_entry_new ()); 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_entry_set_buffer (GTK_ENTRY (entry), GTK_ENTRY_BUFFER (entry_buffer));
gtk_list_box_append (GTK_LIST_BOX (list_box), GTK_WIDGET (entry)); gtk_list_box_append (GTK_LIST_BOX (list_box), GTK_WIDGET (entry));
return *entry; return *entry;
@ -51,7 +70,7 @@ void *widget_get_btt_conditions_list()
GtkWidget *list_box = gtk_list_box_new(); GtkWidget *list_box = gtk_list_box_new();
GtkWidget *scrolled_list_box = GTK_WIDGET (gtk_scrolled_window_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_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++) 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 str4[5]; sprintf(str4, "%d, ", rand() % 10); strcat(str1, str4);
char str5[8]; sprintf(str5, "%d) == ", rand() % 10); strcat(str1, str5); char str5[8]; sprintf(str5, "%d) == ", rand() % 10); strcat(str1, str5);
char str6[5]; sprintf(str6, "%d)", rand() % 10); strcat(str1, str6); 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 (); GtkWidget *pop = gtk_popover_new ();
gtk_popover_set_child (GTK_POPOVER (pop), scrolled_list_box); 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 *list_box = gtk_list_box_new();
GtkWidget *scrolled_list_box = GTK_WIDGET (gtk_scrolled_window_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_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++) 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 str4[5]; sprintf(str4, "%d, ", rand() % 10); strcat(str1, str4);
char str5[8]; sprintf(str5, "%d) = ", rand() % 10); strcat(str1, str5); char str5[8]; sprintf(str5, "%d) = ", rand() % 10); strcat(str1, str5);
char str6[5]; sprintf(str6, "%d", rand() % 10); strcat(str1, str6); 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 (); GtkWidget *pop = gtk_popover_new ();
gtk_popover_set_child (GTK_POPOVER (pop), scrolled_list_box); 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() void *widget_get_btt_rule_identity()
{ {
GtkWidget *list_box = gtk_list_box_new(); 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 *scrolled_list_box = GTK_WIDGET (gtk_scrolled_window_new ());
GtkWidget *label_B = GTK_WIDGET (gtk_label_new("AMP-activated protein kinase")); gtk_list_box_append (GTK_LIST_BOX (list_box), label_B); gtk_scrolled_window_set_child (GTK_SCROLLED_WINDOW (scrolled_list_box), list_box);
GtkWidget *label_C = GTK_WIDGET (gtk_label_new("date")); gtk_list_box_append (GTK_LIST_BOX (list_box), label_C); gtk_widget_set_size_request (GTK_WIDGET (scrolled_list_box), LIST_W + 100, LIST_H);
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); 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 (); 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_present (GTK_POPOVER (pop));
gtk_popover_set_autohide (GTK_POPOVER (pop), FALSE); gtk_popover_set_autohide (GTK_POPOVER (pop), FALSE);
gtk_popover_set_cascade_popdown (GTK_POPOVER (pop), TRUE); 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_label (GTK_MENU_BUTTON (identity), "identity");
gtk_menu_button_set_always_show_arrow (identity, TRUE); gtk_menu_button_set_always_show_arrow (identity, TRUE);
gtk_menu_button_set_popover (identity, GTK_WIDGET (pop)); gtk_menu_button_set_popover (identity, GTK_WIDGET (pop));
// gtk_widget_set_halign (GTK_WIDGET (identity), GTK_ALIGN_START);
return identity; return identity;
} }

View File

@ -34,14 +34,14 @@
void *widget_get_rules_page() void *widget_get_rules_page()
{ {
GtkPaned *tree_vs_selected = GTK_PANED (gtk_paned_new (GTK_ORIENTATION_HORIZONTAL)); GtkPaned *tree_vs_selected_one = GTK_PANED (gtk_paned_new (GTK_ORIENTATION_HORIZONTAL));
gtk_paned_set_start_child (tree_vs_selected, GTK_WIDGET (widget_get_rules_tree_tools_pane())); gtk_paned_set_start_child (tree_vs_selected_one, GTK_WIDGET (widget_get_rules_tree_tools_pane()));
gtk_paned_set_end_child (tree_vs_selected, GTK_WIDGET (widget_get_rules_selected_pane())); gtk_paned_set_end_child (tree_vs_selected_one, GTK_WIDGET (widget_get_single_selected_rule_pane()));
gtk_paned_set_position (tree_vs_selected, 340); // WARNING : c'est une position "absolue" gtk_paned_set_position (tree_vs_selected_one, 340); // WARNING : c'est une position "absolue"
gtk_paned_set_wide_handle (tree_vs_selected, TRUE); gtk_paned_set_wide_handle (tree_vs_selected_one, TRUE);
gtk_paned_set_shrink_start_child (tree_vs_selected, FALSE); gtk_paned_set_shrink_start_child (tree_vs_selected_one, FALSE);
gtk_paned_set_shrink_end_child (tree_vs_selected, FALSE); gtk_paned_set_shrink_end_child (tree_vs_selected_one, FALSE);
return GTK_WIDGET (tree_vs_selected); return GTK_WIDGET (tree_vs_selected_one);
} }

View File

@ -32,8 +32,8 @@
#include "../../../../include/signal.h" #include "../../../../include/signal.h"
void *widget_get_selected_rule() { void *widget_get_selected_rule()
{
GtkBox *images_and_texts = GTK_BOX (gtk_box_new (GTK_ORIENTATION_VERTICAL, 2)); 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_geometry ())); gtk_box_append (images_and_texts, GTK_WIDGET (widget_get_selected_rule_geometry ()));
gtk_box_append (images_and_texts, GTK_WIDGET (gtk_separator_new (GTK_ORIENTATION_HORIZONTAL))); gtk_box_append (images_and_texts, GTK_WIDGET (gtk_separator_new (GTK_ORIENTATION_HORIZONTAL)));
@ -42,7 +42,7 @@ void *widget_get_selected_rule() {
return GTK_WIDGET (images_and_texts); return GTK_WIDGET (images_and_texts);
} }
void *widget_get_rules_selected_pane() void *widget_get_single_selected_rule_pane()
{ {
GtkPaned *rule_itself_vs_explore_edit_pane = GTK_PANED (gtk_paned_new (GTK_ORIENTATION_VERTICAL)); GtkPaned *rule_itself_vs_explore_edit_pane = GTK_PANED (gtk_paned_new (GTK_ORIENTATION_VERTICAL));
gtk_paned_set_start_child (rule_itself_vs_explore_edit_pane, GTK_WIDGET (widget_get_selected_rule())); gtk_paned_set_start_child (rule_itself_vs_explore_edit_pane, GTK_WIDGET (widget_get_selected_rule()));
@ -59,3 +59,4 @@ void *widget_get_rules_selected_pane()
} }

View File

@ -85,7 +85,7 @@ static void display_widgets_at_the_right_side (GtkWidget *header_bar)
// https://stackoverflow.com/questions/69135934/creating-a-simple-menubar-menu-and-menu-item-in-c-using-gtk4 // https://stackoverflow.com/questions/69135934/creating-a-simple-menubar-menu-and-menu-item-in-c-using-gtk4
static void callback_aa () {puts("callback_aa() > menu item A clicked.\n");} //static void callback_aa () {puts("callback_aa() > menu item A clicked.\n");}
static void action_a (GSimpleAction *action, GVariant *parameter, gpointer app) {puts("menu item A clicked.\n");} static void action_a (GSimpleAction *action, GVariant *parameter, gpointer app) {puts("menu item A clicked.\n");}
static void connect(GApplication *app, gpointer *data) { puts("Connect menu item clicked.\n"); } static void connect(GApplication *app, gpointer *data) { puts("Connect menu item clicked.\n"); }
@ -94,7 +94,7 @@ void window_design_topbar_right (GtkWidget *header_bar, GtkApplication *app)
display_widgets_at_the_right_side (header_bar); display_widgets_at_the_right_side (header_bar);
GSimpleActionGroup *ga = g_simple_action_group_new (); GSimpleActionGroup *ga = g_simple_action_group_new ();
GtkShortcutAction *aa = gtk_named_action_new ("aa"); // GtkShortcutAction *aa = gtk_named_action_new ("aa");
gtk_widget_insert_action_group (btt_A, "aa", G_ACTION_GROUP (ga)); // GActionGroup* group gtk_widget_insert_action_group (btt_A, "aa", G_ACTION_GROUP (ga)); // GActionGroup* group
// GtkShortcutAction *act_aa = gtk_callback_action_new (callback_aa, NULL, NULL); // GtkShortcutAction *act_aa = gtk_callback_action_new (callback_aa, NULL, NULL);
@ -140,3 +140,4 @@ void window_design_topbar_right (GtkWidget *header_bar, GtkApplication *app)
} }