WIP: GtkButton *get_GtkButton (char *btt_name) {...} in contain.c
This commit is contained in:
parent
e6871816a4
commit
5071f152e4
16
callback.c
16
callback.c
|
@ -185,10 +185,20 @@ void on_toggle_EXEC_EDIT (GtkWidget *btt_XOR_EXEC_EDIT, GtkWidget *btt_MODEL_RUN
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void on_open_STATE (GtkWidget *btt_open_STATE, gpointer data) {
|
||||||
|
printf("on_open_STATE status = %d\n", get_status ());
|
||||||
|
window_main_child (main_window, STATE);
|
||||||
|
}// SWITCH_TO (STATE);}
|
||||||
|
|
||||||
void on_open_STATE (GtkWidget *btt_open_STATE, gpointer data) {window_main_child (main_window, STATE); SWITCH_TO (STATE);}
|
void on_open_RULES (GtkWidget *btt_open_RULES, gpointer data) {
|
||||||
void on_open_RULES (GtkWidget *btt_open_RULES, gpointer data) {window_main_child (main_window, RULES); SWITCH_TO (RULES);}
|
printf("on_open_RULES status = %d\n", get_status ());
|
||||||
void on_open_DATA (GtkWidget *btt_open_DATA, gpointer data) {window_main_child (main_window, DATA); SWITCH_TO (DATA);}
|
window_main_child (main_window, RULES);
|
||||||
|
}// SWITCH_TO (RULES);}
|
||||||
|
|
||||||
|
void on_open_DATA (GtkWidget *btt_open_DATA, gpointer data) {
|
||||||
|
printf("on_open_DATA status = %d\n", get_status ());
|
||||||
|
window_main_child (main_window, DATA);
|
||||||
|
}// SWITCH_TO (DATA);}
|
||||||
|
|
||||||
void on_SAVE_CURRENT_MODEL_BEFORE_EDITING (GtkWidget *btt_SAVE_CURRENT_MODEL, gpointer data) {
|
void on_SAVE_CURRENT_MODEL_BEFORE_EDITING (GtkWidget *btt_SAVE_CURRENT_MODEL, gpointer data) {
|
||||||
gtk_widget_set_sensitive (GTK_WIDGET (data), TRUE);
|
gtk_widget_set_sensitive (GTK_WIDGET (data), TRUE);
|
||||||
|
|
49
contain.c
49
contain.c
|
@ -154,6 +154,23 @@ void window_main_child_bottom (GtkBox *page_box){
|
||||||
|
|
||||||
static void icons_for_fun (GtkHeaderBar *header_bar);
|
static void icons_for_fun (GtkHeaderBar *header_bar);
|
||||||
|
|
||||||
|
static GtkButton *btt_open_STATE;
|
||||||
|
static GtkButton *btt_open_RULES;
|
||||||
|
static GtkButton *btt_open_DATA;
|
||||||
|
|
||||||
|
GtkButton *get_GtkButton (char *btt_name) {
|
||||||
|
if (strcmp (btt_name, "state")) return btt_open_STATE;
|
||||||
|
if (strcmp (btt_name, "rules")) return btt_open_RULES;
|
||||||
|
if (strcmp (btt_name, "data analysis")) return btt_open_DATA;
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
void set_check_button_active (GtkButton *button, int active){
|
||||||
|
const char *lab = gtk_button_get_label (button);
|
||||||
|
if (strcmp (lab, "state")) printf("set_check_button_active > %s\n", lab);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
void window_header_bar (GtkWindow *window, char *title){
|
void window_header_bar (GtkWindow *window, char *title){
|
||||||
GtkWidget *header_bar = GTK_WIDGET (gtk_header_bar_new ());
|
GtkWidget *header_bar = GTK_WIDGET (gtk_header_bar_new ());
|
||||||
gtk_header_bar_set_title_widget (GTK_HEADER_BAR (header_bar), gtk_label_new (title));
|
gtk_header_bar_set_title_widget (GTK_HEADER_BAR (header_bar), gtk_label_new (title));
|
||||||
|
@ -178,20 +195,36 @@ void window_header_bar (GtkWindow *window, char *title){
|
||||||
|
|
||||||
GtkCheckButton *group_STATE_RULES_DATA = GTK_CHECK_BUTTON (gtk_check_button_new ());
|
GtkCheckButton *group_STATE_RULES_DATA = GTK_CHECK_BUTTON (gtk_check_button_new ());
|
||||||
|
|
||||||
GtkButton *btt_open_STATE = GTK_BUTTON (gtk_check_button_new_with_label ("state"));
|
btt_open_STATE = GTK_BUTTON (gtk_check_button_new_with_label ("state"));
|
||||||
g_signal_connect (btt_open_STATE, "toggled", G_CALLBACK (on_open_STATE), no_local_data);
|
g_signal_connect (btt_open_STATE, "toggled", G_CALLBACK (on_open_STATE), no_local_data);
|
||||||
gtk_check_button_set_group (GTK_CHECK_BUTTON (btt_open_STATE), group_STATE_RULES_DATA);
|
gtk_check_button_set_group (GTK_CHECK_BUTTON (btt_open_STATE), group_STATE_RULES_DATA);
|
||||||
|
|
||||||
GtkButton *btt_open_RULES = GTK_BUTTON (gtk_check_button_new_with_label ("rules"));
|
btt_open_RULES = GTK_BUTTON (gtk_check_button_new_with_label ("rules"));
|
||||||
g_signal_connect (btt_open_RULES, "toggled", G_CALLBACK (on_open_RULES), no_local_data);
|
g_signal_connect (btt_open_RULES, "toggled", G_CALLBACK (on_open_RULES), no_local_data);
|
||||||
gtk_check_button_set_group (GTK_CHECK_BUTTON (btt_open_RULES), group_STATE_RULES_DATA);
|
gtk_check_button_set_group (GTK_CHECK_BUTTON (btt_open_RULES), group_STATE_RULES_DATA);
|
||||||
|
|
||||||
GtkButton *btt_open_DATA = GTK_BUTTON (gtk_check_button_new_with_label ("data analysis"));
|
btt_open_DATA = GTK_BUTTON (gtk_check_button_new_with_label ("data analysis"));
|
||||||
g_signal_connect (btt_open_DATA, "toggled", G_CALLBACK (on_open_DATA), no_local_data);
|
g_signal_connect (btt_open_DATA, "toggled", G_CALLBACK (on_open_DATA), no_local_data);
|
||||||
gtk_check_button_set_group (GTK_CHECK_BUTTON (btt_open_DATA), group_STATE_RULES_DATA);
|
gtk_check_button_set_group (GTK_CHECK_BUTTON (btt_open_DATA), group_STATE_RULES_DATA);
|
||||||
|
|
||||||
|
// gtk_check_button_set_label (GTK_CHECK_BUTTON (btt_open_DATA), "any label");
|
||||||
|
if (0) printf("gtk_check_button_get_label(s) = %s, %s, %s\n",\
|
||||||
|
gtk_check_button_get_label (GTK_CHECK_BUTTON (btt_open_STATE)),
|
||||||
|
gtk_check_button_get_label (GTK_CHECK_BUTTON (btt_open_RULES)),
|
||||||
|
gtk_check_button_get_label (GTK_CHECK_BUTTON (btt_open_DATA)));
|
||||||
|
|
||||||
|
printf("gtk_check_button_get_active > before = %d, %d, %d\n",\
|
||||||
|
gtk_check_button_get_active (GTK_CHECK_BUTTON (btt_open_STATE)),
|
||||||
|
gtk_check_button_get_active (GTK_CHECK_BUTTON (btt_open_RULES)),
|
||||||
|
gtk_check_button_get_active (GTK_CHECK_BUTTON (btt_open_DATA)));
|
||||||
|
|
||||||
gtk_check_button_set_active (GTK_CHECK_BUTTON (btt_open_STATE), TRUE);
|
gtk_check_button_set_active (GTK_CHECK_BUTTON (btt_open_STATE), TRUE);
|
||||||
|
|
||||||
|
printf("gtk_check_button_get_active > after = %d, %d, %d\n",\
|
||||||
|
gtk_check_button_get_active (GTK_CHECK_BUTTON (btt_open_STATE)),
|
||||||
|
gtk_check_button_get_active (GTK_CHECK_BUTTON (btt_open_RULES)),
|
||||||
|
gtk_check_button_get_active (GTK_CHECK_BUTTON (btt_open_DATA)));
|
||||||
|
|
||||||
gtk_header_bar_pack_start (GTK_HEADER_BAR (header_bar), GTK_WIDGET (btt_XOR_EXEC_EDIT));
|
gtk_header_bar_pack_start (GTK_HEADER_BAR (header_bar), GTK_WIDGET (btt_XOR_EXEC_EDIT));
|
||||||
gtk_header_bar_pack_start (GTK_HEADER_BAR (header_bar), GTK_WIDGET (btt_MODEL_RUN_STOP));
|
gtk_header_bar_pack_start (GTK_HEADER_BAR (header_bar), GTK_WIDGET (btt_MODEL_RUN_STOP));
|
||||||
gtk_header_bar_pack_start (GTK_HEADER_BAR (header_bar), GTK_WIDGET (any_Label));
|
gtk_header_bar_pack_start (GTK_HEADER_BAR (header_bar), GTK_WIDGET (any_Label));
|
||||||
|
@ -204,10 +237,13 @@ void window_header_bar (GtkWindow *window, char *title){
|
||||||
|
|
||||||
void window_main_child (GtkWindow *main_window, int selected_page){
|
void window_main_child (GtkWindow *main_window, int selected_page){
|
||||||
// in automaton.h : enum { INTER, STATE, RULES, DATA }
|
// in automaton.h : enum { INTER, STATE, RULES, DATA }
|
||||||
|
if (0) printf ("window_main_child() selected_page = %d\n", selected_page);
|
||||||
|
|
||||||
switch (selected_page) {
|
switch (selected_page) {
|
||||||
case (INTER) : //SWITCH_TO (INTER);
|
case (INTER) : //SWITCH_TO (INTER);
|
||||||
break;
|
break;
|
||||||
case (STATE) :
|
case (STATE) :
|
||||||
|
// printf ("SWITCH_TO STATE\n");
|
||||||
GtkBox *page_box = GTK_BOX (gtk_box_new (GTK_ORIENTATION_VERTICAL, 2));
|
GtkBox *page_box = GTK_BOX (gtk_box_new (GTK_ORIENTATION_VERTICAL, 2));
|
||||||
gtk_box_append (page_box, GTK_WIDGET (get_OBJECTS_and_SITUATIONS()));
|
gtk_box_append (page_box, GTK_WIDGET (get_OBJECTS_and_SITUATIONS()));
|
||||||
gtk_box_append (page_box, GTK_WIDGET (gtk_separator_new (GTK_ORIENTATION_HORIZONTAL)));
|
gtk_box_append (page_box, GTK_WIDGET (gtk_separator_new (GTK_ORIENTATION_HORIZONTAL)));
|
||||||
|
@ -220,10 +256,10 @@ void window_main_child (GtkWindow *main_window, int selected_page){
|
||||||
//SWITCH_TO (STATE);
|
//SWITCH_TO (STATE);
|
||||||
break;
|
break;
|
||||||
case (RULES) : gtk_window_set_child (main_window, GTK_WIDGET (get_rules_page_new()));
|
case (RULES) : gtk_window_set_child (main_window, GTK_WIDGET (get_rules_page_new()));
|
||||||
//SWITCH_TO (RULES);
|
// printf ("SWITCH_TO RULES\n");
|
||||||
break;
|
break;
|
||||||
case (DATA) : gtk_window_set_child (main_window, GTK_WIDGET (get_measures_page_new()));
|
case (DATA) : gtk_window_set_child (main_window, GTK_WIDGET (get_measures_page_new()));
|
||||||
//SWITCH_TO (DATA);
|
// printf ("SWITCH_TO DATA\n");
|
||||||
break;
|
break;
|
||||||
case (4) : gtk_window_set_child (main_window, GTK_WIDGET (get_results_page_new())); break;
|
case (4) : gtk_window_set_child (main_window, GTK_WIDGET (get_results_page_new())); break;
|
||||||
case (5) : gtk_window_set_child (main_window, GTK_WIDGET (get_discuss_page_new())); break;
|
case (5) : gtk_window_set_child (main_window, GTK_WIDGET (get_discuss_page_new())); break;
|
||||||
|
@ -234,9 +270,10 @@ void window_main_child (GtkWindow *main_window, int selected_page){
|
||||||
}
|
}
|
||||||
|
|
||||||
void main_window_design (GtkWindow *main_window){
|
void main_window_design (GtkWindow *main_window){
|
||||||
window_main_child (main_window, STATE);
|
|
||||||
window_header_bar (main_window,
|
window_header_bar (main_window,
|
||||||
"E coli (with permission from David S. Goodsell, 2009)");
|
"E coli (with permission from David S. Goodsell, 2009)");
|
||||||
|
window_main_child (main_window, STATE);
|
||||||
|
// set_check_button_active (GTK_BUTTON (btt_open_STATE), 1);
|
||||||
gtk_window_present (GTK_WINDOW (main_window));
|
gtk_window_present (GTK_WINDOW (main_window));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -36,4 +36,5 @@ GtkWidget *get_selected_rules_vpaned_new();
|
||||||
GtkFrame *get_frame_with_label();
|
GtkFrame *get_frame_with_label();
|
||||||
void window_main_child_bottom (GtkBox *page_box);
|
void window_main_child_bottom (GtkBox *page_box);
|
||||||
void window_main_child (GtkWindow *main_window, int selected_page);
|
void window_main_child (GtkWindow *main_window, int selected_page);
|
||||||
|
void set_check_button_active (GtkButton *button, int active);
|
||||||
|
GtkButton *get_GtkButton (char *btt_name);
|
||||||
|
|
Loading…
Reference in New Issue