65 lines
3.0 KiB
C
65 lines
3.0 KiB
C
#include <stdio.h>
|
|
#include <gtk-4.0/gtk/gtk.h>
|
|
|
|
#include "tree.h"
|
|
#include "display.h"
|
|
#include "contain.h"
|
|
#include "texts.h"
|
|
#include "in_depth.h"
|
|
|
|
/******************************************************************************/
|
|
/* M A I N W I N D O W A C T I V A T I O N */
|
|
/******************************************************************************/
|
|
void ui_main_window (GtkApplication *self, gpointer user_data)
|
|
{
|
|
GtkWindow *main_window = GTK_WINDOW (gtk_application_window_new (self));
|
|
window_header_bar (main_window,
|
|
"E coli (with permission from David S. Goodsell, 2009)");
|
|
two_notebooks_in_two_panes (main_window);
|
|
gtk_window_present (GTK_WINDOW (main_window));
|
|
}
|
|
|
|
/******************************************************************************/
|
|
/* T R E E */
|
|
/******************************************************************************/
|
|
void on_user_tree_expander_toggled(GtkExpander *expander, gpointer user_data)
|
|
{
|
|
// This is a conceptual callback for when an expander is toggled
|
|
GtkTreeListRow *row = GTK_TREE_LIST_ROW (user_data);
|
|
gboolean is_expanded = gtk_tree_list_row_get_expanded(row);
|
|
gtk_tree_list_row_set_expanded (row, !is_expanded);
|
|
}
|
|
|
|
void on_bind_user_tree_factory (GtkSignalListItemFactory *factory, GObject* object, gpointer user_data)
|
|
{
|
|
GtkListItem *list_item = GTK_LIST_ITEM (object); assert (list_item);
|
|
GtkTreeListRow *row = gtk_list_item_get_item (list_item); assert (row);
|
|
// if (row != NULL) {
|
|
const gchar *text = gtk_string_object_get_string (GTK_STRING_OBJECT (gtk_tree_list_row_get_item (row)));
|
|
GtkWidget *expander = gtk_list_item_get_child (list_item);
|
|
gtk_expander_set_label (GTK_EXPANDER (expander), text);
|
|
g_signal_handlers_disconnect_by_func(expander, G_CALLBACK (on_user_tree_expander_toggled), row);
|
|
g_signal_connect(expander, "activate", G_CALLBACK (on_user_tree_expander_toggled), row);
|
|
gtk_widget_set_margin_start(expander, gtk_tree_list_row_get_depth(row)*20);
|
|
gboolean is_expanded = gtk_tree_list_row_get_expanded(row);
|
|
if (0) printf("[on_bind_user_tree_factory] row content is [%s] and expander is [%d]\n", text, is_expanded);
|
|
// } else if (0) printf("[on_bind_user_tree_factory] row == NULL\n");
|
|
}
|
|
|
|
/******************************************************************************/
|
|
/* B U T T O N S */
|
|
/******************************************************************************/
|
|
void ui_toggle_run_edit (GtkWidget *btt_run_xor_edit, gpointer data)
|
|
{
|
|
printf("window.ui_toggle_run_edit() >>> mode = %d", get_run_edit_mode ());
|
|
if (get_run_edit_mode()) {
|
|
gtk_button_set_icon_name (GTK_BUTTON (btt_run_xor_edit), "system-run-symbolic");
|
|
set_run_edit_mode (0);
|
|
} else {
|
|
gtk_button_set_icon_name (GTK_BUTTON (btt_run_xor_edit), "document-edit-symbolic");
|
|
set_run_edit_mode (1);
|
|
}
|
|
printf(" > %d\n", get_run_edit_mode ());
|
|
}
|
|
|