WIP: menu <> model & list missing (see labo.learning...())
This commit is contained in:
parent
a7e83aee30
commit
76857c033e
|
@ -1,5 +1,5 @@
|
|||
|
||||
Dans : [space_page - mode RUN] doivent être : ------------------------------------------------------
|
||||
Dans : [space_page - mode RUN] doivent être : -------------------------------------------------------------
|
||||
|
||||
(1) les commandes de mouvement:
|
||||
- run/stop, slow down/speed up, step by step, do/undo/redo
|
||||
|
|
|
@ -63,7 +63,7 @@ void on_axis_value_change (GtkAdjustment *adjustment, gpointer data);
|
|||
|
||||
void on_reset_image (GtkWidget *btt_reset, gpointer data);
|
||||
void on_clicked_HOME (GtkWidget *btt_reset, gpointer data);
|
||||
void on_clicked_X (GtkWidget *btt_reset, gpointer data);
|
||||
void on_clicked_MENU (GtkWidget *btt_reset, gpointer data);
|
||||
|
||||
|
||||
|
||||
|
|
|
@ -61,6 +61,7 @@ GtkScrolledWindow *get_user_rules_tree ();
|
|||
|
||||
void icons_for_fun (GtkHeaderBar *header_bar);
|
||||
GtkWidget *get_window_child_DATA_lab();
|
||||
void learning_menus_and_all_that_stuff(GtkMenuButton* menu_button);
|
||||
|
||||
/******************************************************************************/
|
||||
/* I M A G E S */
|
||||
|
|
|
@ -320,8 +320,9 @@ void on_clicked_HOME (GtkWidget *btt_reset, gpointer data) {
|
|||
gtk_window_present (GTK_WINDOW (get_dialog_window())); // works once only !
|
||||
}
|
||||
|
||||
void on_clicked_X (GtkWidget *btt_reset, gpointer data) {
|
||||
printf ("callback.n_clicked_X button() presents the text_window ( :- ) but... it works only once.\n");
|
||||
void on_clicked_MENU (GtkWidget *btt_reset, gpointer menu_button) {
|
||||
printf ("callback.on_clicked_MENU button() presents the text_window ( :- ) but... it works only once.\n");
|
||||
learning_menus_and_all_that_stuff (menu_button);
|
||||
gtk_window_present (GTK_WINDOW (get_text_window())); // works once only !
|
||||
}
|
||||
|
||||
|
|
|
@ -165,7 +165,7 @@ static void window_header_bar (GtkWindow *window, char *title){
|
|||
|
||||
GtkButton *open_menu = GTK_BUTTON (gtk_button_new ());
|
||||
gtk_button_set_icon_name (open_menu, "open-menu-symbolic");
|
||||
g_signal_connect (open_menu, "clicked", G_CALLBACK (on_clicked_X), no_local_data);
|
||||
g_signal_connect (open_menu, "clicked", G_CALLBACK (on_clicked_MENU), open_menu);
|
||||
gtk_header_bar_pack_end (GTK_HEADER_BAR (header_bar), GTK_WIDGET (open_menu));
|
||||
}
|
||||
|
||||
|
|
|
@ -47,10 +47,81 @@
|
|||
|
||||
|
||||
|
||||
/******************************************************************************/
|
||||
/* E X P E R I M E N T A L A R E A */
|
||||
/******************************************************************************/
|
||||
|
||||
|
||||
|
||||
static void
|
||||
setup_listitem_cb (GtkListItemFactory *factory,
|
||||
GtkListItem *list_item)
|
||||
{
|
||||
GtkWidget *image;
|
||||
|
||||
image = gtk_image_new ();
|
||||
gtk_image_set_icon_size (GTK_IMAGE (image), GTK_ICON_SIZE_LARGE);
|
||||
gtk_list_item_set_child (list_item, image);
|
||||
}
|
||||
|
||||
static void
|
||||
bind_listitem_cb (GtkListItemFactory *factory,
|
||||
GtkListItem *list_item)
|
||||
{
|
||||
GtkWidget *image;
|
||||
GAppInfo *app_info;
|
||||
|
||||
image = gtk_list_item_get_child (list_item);
|
||||
app_info = gtk_list_item_get_item (list_item);
|
||||
gtk_image_set_from_gicon (GTK_IMAGE (image), g_app_info_get_icon (app_info));
|
||||
}
|
||||
|
||||
static void
|
||||
activate_cb (GtkListView *list,
|
||||
guint position,
|
||||
gpointer unused)
|
||||
{
|
||||
GAppInfo *app_info;
|
||||
|
||||
app_info = g_list_model_get_item (G_LIST_MODEL (gtk_list_view_get_model (list)), position);
|
||||
g_app_info_launch (app_info, NULL, NULL, NULL);
|
||||
g_object_unref (app_info);
|
||||
}
|
||||
|
||||
void learning_menus_and_all_that_stuff (GtkMenuButton* menu_button) {
|
||||
printf ("labo.learning_menus_and_all_that_stuff...()\
|
||||
> presents the text_window ( ;- ))\n \
|
||||
which, at the present time,... works only once ( :- ((\n");
|
||||
|
||||
gtk_window_present (GTK_WINDOW (get_text_window()));
|
||||
|
||||
|
||||
GtkListItemFactory *factory = gtk_signal_list_item_factory_new ();
|
||||
g_signal_connect (factory, "setup", G_CALLBACK (setup_listitem_cb), NULL);
|
||||
g_signal_connect (factory, "bind", G_CALLBACK (bind_listitem_cb), NULL);
|
||||
|
||||
// model =
|
||||
GSList *list = NULL;
|
||||
// list = gtk_list_view_new (GTK_SELECTION_MODEL (gtk_single_selection_new (model)), factory);
|
||||
g_signal_connect (list, "activate", G_CALLBACK (activate_cb), NULL); //
|
||||
gtk_menu_button_set_child (GTK_MENU_BUTTON (menu_button), NULL); // << list (a GtkWidget)
|
||||
|
||||
// https://docs.gtk.org/gtk4/class.ListView.html
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
/******************************************************************************/
|
||||
/* C O N T A I N E R S */
|
||||
/******************************************************************************/
|
||||
|
||||
// https://blog.gtk.org/2020/09/08/on-list-models/ < TODO
|
||||
// https://docs.gtk.org/gtk4/visual_index.html < widgets gallery
|
||||
// https://iconduck.com/sets/adwaita-icon-theme https://iconduck.com/sets/carbon-icons
|
||||
// https://iconduck.com/sets/adwaita-icon-theme
|
||||
// https://iconduck.com/sets/carbon-icons
|
||||
// https://docs.gtk.org/gtk4/section-text-widget.html
|
||||
// https://docs.gtk.org/gtk4/class.Widget.html#height-for-width-geometry-management
|
||||
// https://docs.gtk.org/gtk4/class.TextView.html
|
||||
|
@ -59,6 +130,7 @@
|
|||
// GTK_ORIENTATION_VERTICAL GTK_ORIENTATION_HORIZONTAL
|
||||
|
||||
|
||||
|
||||
void let_us_create_a_complex_useless_and_expensive_tree (struct TreeNode_t *tree_root) {
|
||||
struct TreeNode_t *a = create_user_tree_node("We, the people");add_child_node(tree_root, a);
|
||||
struct TreeNode_t *b = create_user_tree_node("in Order to"); add_child_node(tree_root, b);
|
||||
|
|
Loading…
Reference in New Issue