WIP: cleaning dispatching topbar & data page (is OK +)
This commit is contained in:
parent
62aa327e3a
commit
f58358b551
|
@ -49,15 +49,23 @@ void *widget_get_main_window();
|
||||||
void *widget_get_dialog_window();
|
void *widget_get_dialog_window();
|
||||||
void *widget_get_text_window();
|
void *widget_get_text_window();
|
||||||
|
|
||||||
|
void *get_btt_state();
|
||||||
|
void *get_btt_rules();
|
||||||
|
void *get_btt_data();
|
||||||
|
|
||||||
|
void window_header_bar_left (GtkWidget *header_bar);
|
||||||
|
void window_header_bar_right (GtkWidget *header_bar);
|
||||||
|
|
||||||
|
|
||||||
/******************************************************************************/
|
/******************************************************************************/
|
||||||
/* W I D G E T S */
|
/* W I D G E T S */
|
||||||
/******************************************************************************/
|
/******************************************************************************/
|
||||||
// called in signal.c
|
// called in signal.c
|
||||||
|
|
||||||
void *widget_get_state_page(); // in : src/widget/state/distrib.c
|
void *widget_get_state_page(); // in : src/widget/state/dispatch.c
|
||||||
void *widget_get_rules_page(); // in : src/widget/rules.c
|
void *widget_get_rules_page(); // in : src/widget/rules/dispatch.c
|
||||||
void *widget_get_stock_page(); // in : src/widget/stock.c
|
void *widget_get_data_page(); // in : src/widget/data /dispatch.c
|
||||||
|
void *widget_get_stock_page(); // in : src/widget/data /stock.c < to delete
|
||||||
|
|
||||||
#define W_IMAGE_LOCAL 1920 / 32 // 1920 x 960 ad hoc (pour mon écran)
|
#define W_IMAGE_LOCAL 1920 / 32 // 1920 x 960 ad hoc (pour mon écran)
|
||||||
#define H_IMAGE_LOCAL 800
|
#define H_IMAGE_LOCAL 800
|
||||||
|
@ -143,6 +151,7 @@ void *get_an_impression_of_what_a_rules_comparator_could_be();
|
||||||
/******************************************************************************/
|
/******************************************************************************/
|
||||||
/* L A B O */
|
/* L A B O */
|
||||||
/******************************************************************************/
|
/******************************************************************************/
|
||||||
|
// now in : src/widget/rules/tree_tools/
|
||||||
// called by tree.c widget_get_user_rules_tree()
|
// called by tree.c widget_get_user_rules_tree()
|
||||||
|
|
||||||
void widget_let_us_create_a_complex_useless_and_expensive_tree (struct TreeNode_t *tree_root);
|
void widget_let_us_create_a_complex_useless_and_expensive_tree (struct TreeNode_t *tree_root);
|
||||||
|
|
|
@ -274,7 +274,7 @@ static void switch_state_rules_data()
|
||||||
|
|
||||||
case (DATA) :
|
case (DATA) :
|
||||||
gtk_window_set_child (GTK_WINDOW (widget_get_main_window ()),
|
gtk_window_set_child (GTK_WINDOW (widget_get_main_window ()),
|
||||||
GTK_WIDGET (widget_get_stock_page()));
|
GTK_WIDGET (widget_get_data_page()));
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default :
|
default :
|
||||||
|
|
|
@ -0,0 +1,37 @@
|
||||||
|
/* * * * * * * * * * * * * * * * * * * * * * * * * * *
|
||||||
|
* *
|
||||||
|
* Gem-graph client *
|
||||||
|
* *
|
||||||
|
* Stock *
|
||||||
|
* *
|
||||||
|
* Copyright © 2021 Libre en Communs <contact@a-lec.org> *
|
||||||
|
* Copyright © 2021 Jean Sirmai <jean@a-lec.org> *
|
||||||
|
* *
|
||||||
|
* This file is part of Gem-graph. *
|
||||||
|
* *
|
||||||
|
* This program is free software: you can redistribute it and/or modify it *
|
||||||
|
* under the terms of the GNU Affero General Public License *
|
||||||
|
* as published by the Free Software Foundation, *
|
||||||
|
* either version 3 of the License, *
|
||||||
|
* or (at your option) any later version. *
|
||||||
|
* *
|
||||||
|
* This program is distributed in the hope that it will be useful, *
|
||||||
|
* but WITHOUT ANY WARRANTY; *
|
||||||
|
* without even the implied warranty of MERCHANTABILITY *
|
||||||
|
* or FITNESS FOR A PARTICULAR PURPOSE. *
|
||||||
|
* See the GNU Affero General Public License for more details. *
|
||||||
|
* *
|
||||||
|
* You should have received a copy of the GNU Affero General Public License *
|
||||||
|
* along with this program. If not, see <http://www.gnu.org/licenses/>. *
|
||||||
|
* *
|
||||||
|
* * * * * * * * * * * * * * * * * * * * * * * * * * */
|
||||||
|
|
||||||
|
|
||||||
|
#include "../../../include/base.h"
|
||||||
|
#include "../../../include/signal.h"
|
||||||
|
#include "../../../include/widget.h"
|
||||||
|
|
||||||
|
void *widget_get_data_page()
|
||||||
|
{
|
||||||
|
widget_get_stock_page();
|
||||||
|
}
|
|
@ -27,9 +27,9 @@
|
||||||
* * * * * * * * * * * * * * * * * * * * * * * * * * */
|
* * * * * * * * * * * * * * * * * * * * * * * * * * */
|
||||||
|
|
||||||
|
|
||||||
#include "../../include/base.h"
|
#include "../../../include/base.h"
|
||||||
#include "../../include/signal.h"
|
#include "../../../include/signal.h"
|
||||||
#include "../../include/widget.h"
|
#include "../../../include/widget.h"
|
||||||
|
|
||||||
void *widget_get_stock_page () {
|
void *widget_get_stock_page () {
|
||||||
GtkBox *data_box = GTK_BOX (gtk_box_new (GTK_ORIENTATION_VERTICAL, 32));
|
GtkBox *data_box = GTK_BOX (gtk_box_new (GTK_ORIENTATION_VERTICAL, 32));
|
||||||
|
@ -81,20 +81,48 @@ void *widget_get_stock_text (gchar *text_address) {
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/******************************************************************************/
|
/******************************************************************************/
|
||||||
/* T E X T S */
|
/* C O N T A I N E R S */
|
||||||
/******************************************************************************/
|
/******************************************************************************/
|
||||||
|
|
||||||
char *widget_get_text_address_theory () {
|
|
||||||
return "/home/jean/Gem-Graph/gem-graph-client/data/text/théorie.txt";
|
|
||||||
}
|
|
||||||
|
|
||||||
char *widget_get_text_address_about_commands () {
|
|
||||||
return "/home/jean/Gem-Graph/gem-graph-client/data/text/about_commands.txt";
|
|
||||||
}
|
|
||||||
|
|
||||||
char *widget_get_text_address_any () {
|
|
||||||
return "/home/jean/Gem-Graph/gem-graph-client/data/text/any.txt";
|
|
||||||
}
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
"rule effect"
|
||||||
|
"rule topic"
|
||||||
|
"data type"
|
||||||
|
"interpretation"
|
||||||
|
"discussion"
|
||||||
|
"game"
|
||||||
|
"help"
|
||||||
|
"movement"
|
||||||
|
"transport"
|
||||||
|
"transformation"
|
||||||
|
"objects"
|
||||||
|
"situations"
|
||||||
|
"accuracy"
|
||||||
|
"pattern recognition"
|
||||||
|
"repartitions"
|
||||||
|
"evolutions"
|
||||||
|
"correlations"
|
||||||
|
"stochastic"
|
||||||
|
"deterministic"
|
||||||
|
"physical"
|
||||||
|
"chemical"
|
||||||
|
"biological"
|
||||||
|
"social"
|
||||||
|
"context"
|
||||||
|
"methodology"
|
||||||
|
"comparisons"
|
||||||
|
"to improve"
|
||||||
|
"summary"
|
||||||
|
"single player"
|
||||||
|
"multiple players"
|
||||||
|
"edition facilities"
|
||||||
|
"modelization"
|
||||||
|
"measurements"
|
||||||
|
"results"
|
||||||
|
"data analysis"
|
||||||
|
"preferences"
|
||||||
|
*/
|
||||||
|
|
|
@ -27,7 +27,8 @@
|
||||||
* * * * * * * * * * * * * * * * * * * * * * * * * * */
|
* * * * * * * * * * * * * * * * * * * * * * * * * * */
|
||||||
|
|
||||||
|
|
||||||
#include "../../include/widget.h"
|
#include "../../../../include/widget.h"
|
||||||
|
|
||||||
|
|
||||||
// (NB à terme, labo.c disparaitra, bien sûr !)
|
// (NB à terme, labo.c disparaitra, bien sûr !)
|
||||||
|
|
||||||
|
@ -86,6 +87,11 @@ void widget_let_us_create_a_complex_useless_and_expensive_tree (struct TreeNode_
|
||||||
struct TreeNode_t *aaab = widget_create_user_tree_node("write"); widget_add_child_node(aaa, aaab);
|
struct TreeNode_t *aaab = widget_create_user_tree_node("write"); widget_add_child_node(aaa, aaab);
|
||||||
struct TreeNode_t *aaac = widget_create_user_tree_node("compute"); widget_add_child_node(aaa, aaac);
|
struct TreeNode_t *aaac = widget_create_user_tree_node("compute"); widget_add_child_node(aaa, aaac);
|
||||||
struct TreeNode_t *aaad = widget_create_user_tree_node("code"); widget_add_child_node(aaa, aaad);
|
struct TreeNode_t *aaad = widget_create_user_tree_node("code"); widget_add_child_node(aaa, aaad);
|
||||||
|
struct TreeNode_t *aaag = widget_create_user_tree_node("imagine"); widget_add_child_node(aaad, aaag);
|
||||||
|
struct TreeNode_t *aaah = widget_create_user_tree_node("combine"); widget_add_child_node(aaad, aaah);
|
||||||
|
struct TreeNode_t *aaai = widget_create_user_tree_node("invent"); widget_add_child_node(aaad, aaai);
|
||||||
|
struct TreeNode_t *aaaj = widget_create_user_tree_node("create"); widget_add_child_node(aaad, aaaj);
|
||||||
|
struct TreeNode_t *aaak = widget_create_user_tree_node("enjoy !"); widget_add_child_node(aaad, aaak);
|
||||||
// struct TreeNode_t *aaae = widget_create_user_tree_node("interact"); widget_add_child_node(aaa, aaae);
|
// struct TreeNode_t *aaae = widget_create_user_tree_node("interact"); widget_add_child_node(aaa, aaae);
|
||||||
|
|
||||||
struct TreeNode_t *aaaco = widget_create_user_tree_node("copy"); widget_add_child_node(aaaa, aaaco);
|
struct TreeNode_t *aaaco = widget_create_user_tree_node("copy"); widget_add_child_node(aaaa, aaaco);
|
||||||
|
@ -116,51 +122,17 @@ void widget_let_us_create_a_complex_useless_and_expensive_tree (struct TreeNode_
|
||||||
struct TreeNode_t *ca = widget_create_user_tree_node("free"); widget_add_child_node(c, ca);
|
struct TreeNode_t *ca = widget_create_user_tree_node("free"); widget_add_child_node(c, ca);
|
||||||
struct TreeNode_t *cb = widget_create_user_tree_node("code"); widget_add_child_node(c, cb);
|
struct TreeNode_t *cb = widget_create_user_tree_node("code"); widget_add_child_node(c, cb);
|
||||||
struct TreeNode_t *cc = widget_create_user_tree_node("access"); widget_add_child_node(c, cc);
|
struct TreeNode_t *cc = widget_create_user_tree_node("access"); widget_add_child_node(c, cc);
|
||||||
}
|
|
||||||
|
struct TreeNode_t *cca = widget_create_user_tree_node("tiens ?"); widget_add_child_node(cc, cca);
|
||||||
|
struct TreeNode_t *ccb = widget_create_user_tree_node("y a comme"); widget_add_child_node(cc, ccb);
|
||||||
|
struct TreeNode_t *ccc = widget_create_user_tree_node("un bug..."); widget_add_child_node(cc, ccc);
|
||||||
|
struct TreeNode_t *ccd = widget_create_user_tree_node("imprévu"); widget_add_child_node(cc, ccd);
|
||||||
|
struct TreeNode_t *cce = widget_create_user_tree_node("ici ( ;- )"); widget_add_child_node(cc, cce);
|
||||||
|
} // TODO bug in this tree
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/*
|
|
||||||
"rule effect"
|
|
||||||
"rule topic"
|
|
||||||
"data type"
|
|
||||||
"interpretation"
|
|
||||||
"discussion"
|
|
||||||
"game"
|
|
||||||
"help"
|
|
||||||
"movement"
|
|
||||||
"transport"
|
|
||||||
"transformation"
|
|
||||||
"objects"
|
|
||||||
"situations"
|
|
||||||
"accuracy"
|
|
||||||
"pattern recognition"
|
|
||||||
"repartitions"
|
|
||||||
"evolutions"
|
|
||||||
"correlations"
|
|
||||||
"stochastic"
|
|
||||||
"deterministic"
|
|
||||||
"physical"
|
|
||||||
"chemical"
|
|
||||||
"biological"
|
|
||||||
"social"
|
|
||||||
"context"
|
|
||||||
"methodology"
|
|
||||||
"comparisons"
|
|
||||||
"to improve"
|
|
||||||
"summary"
|
|
||||||
"single player"
|
|
||||||
"multiple players"
|
|
||||||
"edition facilities"
|
|
||||||
"modelization"
|
|
||||||
"measurements"
|
|
||||||
"results"
|
|
||||||
"data analysis"
|
|
||||||
"preferences"
|
|
||||||
*/
|
|
||||||
|
|
||||||
|
|
||||||
// https://blog.gtk.org/2020/09/08/on-list-models/ < TODO
|
// https://blog.gtk.org/2020/09/08/on-list-models/ < TODO
|
||||||
// https://docs.gtk.org/gtk4/visual_index.html < widgets gallery
|
// https://docs.gtk.org/gtk4/visual_index.html < widgets gallery
|
||||||
// https://iconduck.com/sets/adwaita-icon-theme
|
// https://iconduck.com/sets/adwaita-icon-theme
|
|
@ -1,297 +0,0 @@
|
||||||
/* * * * * * * * * * * * * * * * * * * * * * * * * * *
|
|
||||||
* *
|
|
||||||
* Gem-graph client *
|
|
||||||
* *
|
|
||||||
* Windows && Headers *
|
|
||||||
* *
|
|
||||||
* Copyright © 2021 Libre en Communs <contact@a-lec.org> *
|
|
||||||
* Copyright © 2021 Adrien Bourmault <neox@a-lec.org> *
|
|
||||||
* Copyright © 2021 Jean Sirmai <jean@a-lec.org> *
|
|
||||||
* *
|
|
||||||
* This file is part of Gem-graph. *
|
|
||||||
* *
|
|
||||||
* This program is free software: you can redistribute it and/or modify it *
|
|
||||||
* under the terms of the GNU Affero General Public License *
|
|
||||||
* as published by the Free Software Foundation, *
|
|
||||||
* either version 3 of the License, *
|
|
||||||
* or (at your option) any later version. *
|
|
||||||
* *
|
|
||||||
* This program is distributed in the hope that it will be useful, *
|
|
||||||
* but WITHOUT ANY WARRANTY; *
|
|
||||||
* without even the implied warranty of MERCHANTABILITY *
|
|
||||||
* or FITNESS FOR A PARTICULAR PURPOSE. *
|
|
||||||
* See the GNU Affero General Public License for more details. *
|
|
||||||
* *
|
|
||||||
* You should have received a copy of the GNU Affero General Public License *
|
|
||||||
* along with this program. If not, see <http://www.gnu.org/licenses/>. *
|
|
||||||
* *
|
|
||||||
* * * * * * * * * * * * * * * * * * * * * * * * * * */
|
|
||||||
|
|
||||||
|
|
||||||
#include "../../include/base.h"
|
|
||||||
#include "../../include/signal.h"
|
|
||||||
#include "../../include/widget.h"
|
|
||||||
|
|
||||||
#define W_TEXT_WINDOW 700 // ad hoc (mais sans conséquences ici)
|
|
||||||
#define H_TEXT_WINDOW 1000
|
|
||||||
|
|
||||||
|
|
||||||
static GtkButton *btt_STATE, *btt_RULES, *btt_DATA;
|
|
||||||
|
|
||||||
|
|
||||||
/******************************************************************************/
|
|
||||||
/* T E X T W I N D O W */
|
|
||||||
/******************************************************************************/
|
|
||||||
|
|
||||||
void widget_design_text_window (GtkWindow *main_window, GtkWindow *text_window)
|
|
||||||
{
|
|
||||||
char *title = " Learn more about Gem Graph. ";
|
|
||||||
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_window_set_titlebar (text_window, header_bar);
|
|
||||||
|
|
||||||
GtkWidget *child = widget_get_stock_text (widget_get_text_address_theory());
|
|
||||||
child = widget_get_stock_text (widget_get_text_address_about_commands());
|
|
||||||
gtk_window_set_child (GTK_WINDOW (text_window), GTK_WIDGET (child));
|
|
||||||
gtk_widget_set_size_request (GTK_WIDGET (child), W_TEXT_WINDOW, H_TEXT_WINDOW);
|
|
||||||
|
|
||||||
// gtk_window_set_resizable (GTK_WINDOW (text_window), TRUE);
|
|
||||||
gtk_window_set_transient_for (GTK_WINDOW (text_window), GTK_WINDOW (main_window));
|
|
||||||
gtk_window_set_destroy_with_parent (GTK_WINDOW (text_window), TRUE);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/******************************************************************************/
|
|
||||||
/* D I A L O G W I N D O W */
|
|
||||||
/******************************************************************************/
|
|
||||||
|
|
||||||
void widget_design_dialog_window (GtkWindow *main_window, GtkWindow *dialog_window)
|
|
||||||
{
|
|
||||||
char *title = " Save the current model before modifying it? ";
|
|
||||||
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_window_set_titlebar (dialog_window, header_bar);
|
|
||||||
|
|
||||||
GtkWidget *dialog_window_grid = gtk_grid_new ();
|
|
||||||
|
|
||||||
const char *txt = " SAVE CURRENT MODEL ";
|
|
||||||
GtkButton *action_save_current_model = GTK_BUTTON (gtk_button_new_with_label (txt));
|
|
||||||
gtk_widget_set_sensitive (GTK_WIDGET (action_save_current_model), FALSE);
|
|
||||||
g_signal_connect (action_save_current_model, "clicked",
|
|
||||||
G_CALLBACK (on_write_current_model), dialog_window);
|
|
||||||
|
|
||||||
GtkButton *click_yes = GTK_BUTTON (gtk_button_new_with_label ("YES"));
|
|
||||||
g_signal_connect (click_yes, "clicked",
|
|
||||||
G_CALLBACK (on_save_current_model_before_editing), action_save_current_model);
|
|
||||||
|
|
||||||
GtkButton *click_no = GTK_BUTTON (gtk_button_new_with_label ("NO"));
|
|
||||||
g_signal_connect (click_no, "clicked",
|
|
||||||
G_CALLBACK (on_discard_current_model_before_editing), dialog_window);
|
|
||||||
|
|
||||||
gtk_grid_attach (GTK_GRID (dialog_window_grid), GTK_WIDGET (click_yes), 0, 0, 1, 1) ;
|
|
||||||
gtk_grid_attach (GTK_GRID (dialog_window_grid), GTK_WIDGET (click_no), 1, 0, 1, 1) ;
|
|
||||||
gtk_grid_attach (GTK_GRID (dialog_window_grid), GTK_WIDGET (action_save_current_model), 0, 2, 2, 1) ;
|
|
||||||
gtk_window_set_child (GTK_WINDOW (dialog_window), GTK_WIDGET (dialog_window_grid));
|
|
||||||
|
|
||||||
gtk_window_set_transient_for (GTK_WINDOW (dialog_window), GTK_WINDOW (main_window));
|
|
||||||
gtk_window_set_destroy_with_parent (GTK_WINDOW (dialog_window), TRUE);
|
|
||||||
gtk_window_set_deletable (GTK_WINDOW (dialog_window), FALSE); // FALSE
|
|
||||||
gtk_window_set_modal (GTK_WINDOW (dialog_window), TRUE);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/******************************************************************************/
|
|
||||||
/* M A I N W I N D O W T O P B A R ( C E N T E R ) */
|
|
||||||
/******************************************************************************/
|
|
||||||
|
|
||||||
static GtkWidget *window_header_bar (GtkWindow *window);
|
|
||||||
static void window_header_bar_left (GtkWidget *header_bar);
|
|
||||||
static void window_header_bar_right (GtkWidget *header_bar);
|
|
||||||
|
|
||||||
|
|
||||||
void widget_design_main_window (GtkWindow *main_window)
|
|
||||||
{
|
|
||||||
GtkWidget *header_bar = window_header_bar (main_window);
|
|
||||||
window_header_bar_left (header_bar);
|
|
||||||
window_header_bar_right (header_bar);
|
|
||||||
|
|
||||||
// use the next line to select the page that will be presented first
|
|
||||||
// it triggers <=> signal.on_toggle_state_rule_data (a btt_NAME)
|
|
||||||
|
|
||||||
// gtk_check_button_set_active (GTK_CHECK_BUTTON (btt_STATE), TRUE);
|
|
||||||
gtk_check_button_set_active (GTK_CHECK_BUTTON (btt_RULES), TRUE);
|
|
||||||
|
|
||||||
gtk_window_present (GTK_WINDOW (main_window));
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
static GtkWidget *window_header_bar (GtkWindow *window)
|
|
||||||
{
|
|
||||||
char *title = "E coli (with permission from David S. Goodsell, 2009)";
|
|
||||||
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_window_set_titlebar (window, header_bar);
|
|
||||||
return header_bar;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/******************************************************************************/
|
|
||||||
/* M A I N W I N D O W T O P B A R ( L E F T ) */
|
|
||||||
/******************************************************************************/
|
|
||||||
|
|
||||||
static void window_header_bar_left (GtkWidget *header_bar)
|
|
||||||
{
|
|
||||||
gpointer no_local_data = NULL;
|
|
||||||
|
|
||||||
GtkButton *btt_XOR_EXEC_EDIT = GTK_BUTTON (gtk_toggle_button_new ());
|
|
||||||
gtk_button_set_icon_name (btt_XOR_EXEC_EDIT, "system-run-symbolic");
|
|
||||||
gtk_button_set_icon_name (btt_XOR_EXEC_EDIT, "power-profile-balanced-rtl-symbolic");
|
|
||||||
g_signal_connect (btt_XOR_EXEC_EDIT, "clicked", G_CALLBACK (on_toggle_exec_edit), no_local_data);
|
|
||||||
|
|
||||||
GtkWidget *any_Label = GTK_WIDGET (gtk_label_new (" | "));
|
|
||||||
|
|
||||||
GtkCheckButton *group_state_rules_data = GTK_CHECK_BUTTON (gtk_check_button_new ());
|
|
||||||
|
|
||||||
btt_STATE = GTK_BUTTON (gtk_check_button_new_with_label ("state"));
|
|
||||||
g_signal_connect (btt_STATE, "toggled", G_CALLBACK (on_toggle_state_rules_data), no_local_data);
|
|
||||||
gtk_check_button_set_group (GTK_CHECK_BUTTON (btt_STATE), group_state_rules_data);
|
|
||||||
|
|
||||||
btt_RULES = GTK_BUTTON (gtk_check_button_new_with_label ("rules"));
|
|
||||||
g_signal_connect (btt_RULES, "toggled", G_CALLBACK (on_toggle_state_rules_data), no_local_data);
|
|
||||||
gtk_check_button_set_group (GTK_CHECK_BUTTON (btt_RULES), group_state_rules_data);
|
|
||||||
|
|
||||||
btt_DATA = GTK_BUTTON (gtk_check_button_new_with_label ("data analysis"));
|
|
||||||
g_signal_connect (btt_DATA, "toggled", G_CALLBACK (on_toggle_state_rules_data), no_local_data);
|
|
||||||
gtk_check_button_set_group (GTK_CHECK_BUTTON (btt_DATA), group_state_rules_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 (any_Label));
|
|
||||||
gtk_header_bar_pack_start (GTK_HEADER_BAR (header_bar), GTK_WIDGET (btt_STATE));
|
|
||||||
gtk_header_bar_pack_start (GTK_HEADER_BAR (header_bar), GTK_WIDGET (btt_RULES));
|
|
||||||
gtk_header_bar_pack_start (GTK_HEADER_BAR (header_bar), GTK_WIDGET (btt_DATA));
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/******************************************************************************/
|
|
||||||
/* M A I N W I N D O W T O P B A R ( R I G H T ) */
|
|
||||||
/******************************************************************************/
|
|
||||||
|
|
||||||
static void connect(GApplication *app, gpointer *data) { puts("Connect menu item clicked.\n"); }
|
|
||||||
|
|
||||||
static void window_header_bar_right (GtkWidget *header_bar)
|
|
||||||
{
|
|
||||||
gpointer no_local_data = NULL;
|
|
||||||
|
|
||||||
GtkButton *btt_go_home = GTK_BUTTON (gtk_button_new ());
|
|
||||||
gtk_button_set_icon_name (btt_go_home, "go-home-symbolic");
|
|
||||||
// gtk_widget_error_bell (GTK_WIDGET (btt_go_home)); << TODO si c'est possible ?
|
|
||||||
g_signal_connect (btt_go_home, "clicked", G_CALLBACK (on_clicked_home), no_local_data);
|
|
||||||
gtk_header_bar_pack_end (GTK_HEADER_BAR (header_bar), GTK_WIDGET (btt_go_home));
|
|
||||||
|
|
||||||
GtkButton *search = GTK_BUTTON (gtk_button_new ());
|
|
||||||
gtk_button_set_icon_name (search, "folder-saved-search-symbolic");
|
|
||||||
g_signal_connect (search, "clicked", G_CALLBACK (on_clicked_search), no_local_data);
|
|
||||||
gtk_header_bar_pack_end (GTK_HEADER_BAR (header_bar), GTK_WIDGET (search));
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// https://discourse.gnome.org/t/when-do-we-really-have-to-use-gtk-popover-present-to-show-a-popover-at-a-given-widget/17566/5
|
|
||||||
// https://stackoverflow.com/questions/69135934/creating-a-simple-menubar-menu-and-menu-item-in-c-using-gtk4
|
|
||||||
|
|
||||||
|
|
||||||
GtkWidget* list_box = gtk_list_box_new();
|
|
||||||
GtkWidget *label_A = GTK_WIDGET (gtk_label_new("A")); gtk_list_box_append (GTK_LIST_BOX (list_box), label_A);
|
|
||||||
GtkWidget *label_B = GTK_WIDGET (gtk_label_new("B")); gtk_list_box_append (GTK_LIST_BOX (list_box), label_B);
|
|
||||||
GtkWidget *label_C = GTK_WIDGET (gtk_label_new("C")); gtk_list_box_append (GTK_LIST_BOX (list_box), label_C);
|
|
||||||
|
|
||||||
GtkWidget *pop = gtk_popover_new ();
|
|
||||||
gtk_popover_set_child (GTK_POPOVER (pop), 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);
|
|
||||||
|
|
||||||
GtkMenuButton *open_menu = GTK_MENU_BUTTON (gtk_menu_button_new ());
|
|
||||||
gtk_menu_button_set_icon_name (open_menu, "open-menu-symbolic");
|
|
||||||
gtk_menu_button_set_always_show_arrow (open_menu, TRUE);
|
|
||||||
gtk_menu_button_set_popover (open_menu, GTK_WIDGET (pop));
|
|
||||||
gtk_header_bar_pack_end (GTK_HEADER_BAR (header_bar), GTK_WIDGET (open_menu));
|
|
||||||
|
|
||||||
|
|
||||||
GSimpleAction *act_connect = g_simple_action_new("connect", NULL);
|
|
||||||
g_signal_connect(act_connect, "activate", G_CALLBACK(connect), NULL);
|
|
||||||
|
|
||||||
|
|
||||||
// gtk_menu_button_popup (open_menu); gtk_menu_button_popdown (open_menu);
|
|
||||||
// gtk_menu_item_activate (label_C);
|
|
||||||
// g_action_map_add_action(G_ACTION_MAP(app), G_ACTION(act_connect));
|
|
||||||
// GMenuItem *label_E = g_menu_item_new("connect", "app.connect");
|
|
||||||
// gtk_list_box_append (GTK_LIST_BOX (list_box), GTK_WIDGET (label_E));
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/*
|
|
||||||
https://docs.gtk.org/gtk4/class.ListView.html
|
|
||||||
GtkStringList *model = gtk_string_list_new (NULL); // model = create_application_list ();
|
|
||||||
|
|
||||||
GtkSignalListItemFactory *factory = GTK_SIGNAL_LIST_ITEM_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);
|
|
||||||
|
|
||||||
GtkStringList *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_scrolled_window_set_child (GTK_SCROLLED_WINDOW (sw), list);
|
|
||||||
*/
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// ce qui suit ira dans le callback
|
|
||||||
GtkListBoxRow *selected_row = gtk_list_box_get_selected_row (GTK_LIST_BOX (list_box));
|
|
||||||
if (selected_row != NULL)
|
|
||||||
printf("selected_row = %s\n",
|
|
||||||
gtk_button_get_label (GTK_BUTTON (gtk_list_box_row_get_child (selected_row))));
|
|
||||||
|
|
||||||
// g_signal_connect (label_C, "clicked", G_CALLBACK (on_clicked_HOME), no_local_data);
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/******************************************************************************/
|
|
||||||
/* L O C A L L A B ( I C O N S ) */
|
|
||||||
/******************************************************************************/
|
|
||||||
|
|
||||||
// https://iconduck.com/sets/adwaita-icon-theme
|
|
||||||
// https://iconduck.com/sets/carbon-icons
|
|
||||||
//
|
|
||||||
// gtk_button_set_icon_name (search, "user-trash-symbolic");
|
|
||||||
// gtk_button_set_icon_name (search, "emblem-documents-symbolic");
|
|
||||||
// gtk_button_set_icon_name (search, "preferences-desktop-appearance-symbolic");
|
|
||||||
// gtk_button_set_icon_name (search, "applications-utilities-symbolic");
|
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,75 @@
|
||||||
|
/* * * * * * * * * * * * * * * * * * * * * * * * * * *
|
||||||
|
* *
|
||||||
|
* Gem-graph client *
|
||||||
|
* *
|
||||||
|
* Windows && Headers *
|
||||||
|
* *
|
||||||
|
* Copyright © 2021 Libre en Communs <contact@a-lec.org> *
|
||||||
|
* Copyright © 2021 Adrien Bourmault <neox@a-lec.org> *
|
||||||
|
* Copyright © 2021 Jean Sirmai <jean@a-lec.org> *
|
||||||
|
* *
|
||||||
|
* This file is part of Gem-graph. *
|
||||||
|
* *
|
||||||
|
* This program is free software: you can redistribute it and/or modify it *
|
||||||
|
* under the terms of the GNU Affero General Public License *
|
||||||
|
* as published by the Free Software Foundation, *
|
||||||
|
* either version 3 of the License, *
|
||||||
|
* or (at your option) any later version. *
|
||||||
|
* *
|
||||||
|
* This program is distributed in the hope that it will be useful, *
|
||||||
|
* but WITHOUT ANY WARRANTY; *
|
||||||
|
* without even the implied warranty of MERCHANTABILITY *
|
||||||
|
* or FITNESS FOR A PARTICULAR PURPOSE. *
|
||||||
|
* See the GNU Affero General Public License for more details. *
|
||||||
|
* *
|
||||||
|
* You should have received a copy of the GNU Affero General Public License *
|
||||||
|
* along with this program. If not, see <http://www.gnu.org/licenses/>. *
|
||||||
|
* *
|
||||||
|
* * * * * * * * * * * * * * * * * * * * * * * * * * */
|
||||||
|
|
||||||
|
|
||||||
|
#include "../../../include/base.h"
|
||||||
|
#include "../../../include/signal.h"
|
||||||
|
#include "../../../include/widget.h"
|
||||||
|
|
||||||
|
|
||||||
|
/******************************************************************************/
|
||||||
|
/* D I A L O G W I N D O W */
|
||||||
|
/******************************************************************************/
|
||||||
|
|
||||||
|
void widget_design_dialog_window (GtkWindow *main_window, GtkWindow *dialog_window)
|
||||||
|
{
|
||||||
|
char *title = " Save the current model before modifying it? ";
|
||||||
|
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_window_set_titlebar (dialog_window, header_bar);
|
||||||
|
|
||||||
|
GtkWidget *dialog_window_grid = gtk_grid_new ();
|
||||||
|
|
||||||
|
const char *txt = " SAVE CURRENT MODEL ";
|
||||||
|
GtkButton *action_save_current_model = GTK_BUTTON (gtk_button_new_with_label (txt));
|
||||||
|
gtk_widget_set_sensitive (GTK_WIDGET (action_save_current_model), FALSE);
|
||||||
|
g_signal_connect (action_save_current_model, "clicked",
|
||||||
|
G_CALLBACK (on_write_current_model), dialog_window);
|
||||||
|
|
||||||
|
GtkButton *click_yes = GTK_BUTTON (gtk_button_new_with_label ("YES"));
|
||||||
|
g_signal_connect (click_yes, "clicked",
|
||||||
|
G_CALLBACK (on_save_current_model_before_editing), action_save_current_model);
|
||||||
|
|
||||||
|
GtkButton *click_no = GTK_BUTTON (gtk_button_new_with_label ("NO"));
|
||||||
|
g_signal_connect (click_no, "clicked",
|
||||||
|
G_CALLBACK (on_discard_current_model_before_editing), dialog_window);
|
||||||
|
|
||||||
|
gtk_grid_attach (GTK_GRID (dialog_window_grid), GTK_WIDGET (click_yes), 0, 0, 1, 1) ;
|
||||||
|
gtk_grid_attach (GTK_GRID (dialog_window_grid), GTK_WIDGET (click_no), 1, 0, 1, 1) ;
|
||||||
|
gtk_grid_attach (GTK_GRID (dialog_window_grid), GTK_WIDGET (action_save_current_model), 0, 2, 2, 1) ;
|
||||||
|
gtk_window_set_child (GTK_WINDOW (dialog_window), GTK_WIDGET (dialog_window_grid));
|
||||||
|
|
||||||
|
gtk_window_set_transient_for (GTK_WINDOW (dialog_window), GTK_WINDOW (main_window));
|
||||||
|
gtk_window_set_destroy_with_parent (GTK_WINDOW (dialog_window), TRUE);
|
||||||
|
gtk_window_set_deletable (GTK_WINDOW (dialog_window), FALSE); // FALSE
|
||||||
|
gtk_window_set_modal (GTK_WINDOW (dialog_window), TRUE);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,103 @@
|
||||||
|
/* * * * * * * * * * * * * * * * * * * * * * * * * * *
|
||||||
|
* *
|
||||||
|
* Gem-graph client *
|
||||||
|
* *
|
||||||
|
* Windows && Headers *
|
||||||
|
* *
|
||||||
|
* Copyright © 2021 Libre en Communs <contact@a-lec.org> *
|
||||||
|
* Copyright © 2021 Adrien Bourmault <neox@a-lec.org> *
|
||||||
|
* Copyright © 2021 Jean Sirmai <jean@a-lec.org> *
|
||||||
|
* *
|
||||||
|
* This file is part of Gem-graph. *
|
||||||
|
* *
|
||||||
|
* This program is free software: you can redistribute it and/or modify it *
|
||||||
|
* under the terms of the GNU Affero General Public License *
|
||||||
|
* as published by the Free Software Foundation, *
|
||||||
|
* either version 3 of the License, *
|
||||||
|
* or (at your option) any later version. *
|
||||||
|
* *
|
||||||
|
* This program is distributed in the hope that it will be useful, *
|
||||||
|
* but WITHOUT ANY WARRANTY; *
|
||||||
|
* without even the implied warranty of MERCHANTABILITY *
|
||||||
|
* or FITNESS FOR A PARTICULAR PURPOSE. *
|
||||||
|
* See the GNU Affero General Public License for more details. *
|
||||||
|
* *
|
||||||
|
* You should have received a copy of the GNU Affero General Public License *
|
||||||
|
* along with this program. If not, see <http://www.gnu.org/licenses/>. *
|
||||||
|
* *
|
||||||
|
* * * * * * * * * * * * * * * * * * * * * * * * * * */
|
||||||
|
|
||||||
|
|
||||||
|
#include "../../../include/base.h"
|
||||||
|
#include "../../../include/signal.h"
|
||||||
|
#include "../../../include/widget.h"
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/******************************************************************************/
|
||||||
|
/* M A I N W I N D O W T O P B A R ( C E N T E R ) */
|
||||||
|
/******************************************************************************/
|
||||||
|
|
||||||
|
static GtkWidget *window_header_bar (GtkWindow *window);
|
||||||
|
void window_header_bar_left (GtkWidget *header_bar);
|
||||||
|
void window_header_bar_right (GtkWidget *header_bar);
|
||||||
|
|
||||||
|
|
||||||
|
void widget_design_main_window (GtkWindow *main_window)
|
||||||
|
{
|
||||||
|
GtkWidget *header_bar = window_header_bar (main_window);
|
||||||
|
window_header_bar_left (header_bar);
|
||||||
|
window_header_bar_right (header_bar);
|
||||||
|
|
||||||
|
// use the next line to select the page that will be presented first
|
||||||
|
// it triggers <=> signal.on_toggle_state_rule_data (a btt_NAME)
|
||||||
|
|
||||||
|
// gtk_check_button_set_active (GTK_CHECK_BUTTON (btt_STATE), TRUE);
|
||||||
|
gtk_check_button_set_active (GTK_CHECK_BUTTON (get_btt_rules()), TRUE);
|
||||||
|
|
||||||
|
gtk_window_present (GTK_WINDOW (main_window));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
static GtkWidget *window_header_bar (GtkWindow *window)
|
||||||
|
{
|
||||||
|
char *title = "E coli (with permission from David S. Goodsell, 2009)";
|
||||||
|
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_window_set_titlebar (window, header_bar);
|
||||||
|
return header_bar;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/******************************************************************************/
|
||||||
|
/* L O C A L L A B ( I C O N S ) */
|
||||||
|
/******************************************************************************/
|
||||||
|
|
||||||
|
// https://iconduck.com/sets/adwaita-icon-theme
|
||||||
|
// https://iconduck.com/sets/carbon-icons
|
||||||
|
//
|
||||||
|
// gtk_button_set_icon_name (search, "user-trash-symbolic");
|
||||||
|
// gtk_button_set_icon_name (search, "emblem-documents-symbolic");
|
||||||
|
// gtk_button_set_icon_name (search, "preferences-desktop-appearance-symbolic");
|
||||||
|
// gtk_button_set_icon_name (search, "applications-utilities-symbolic");
|
||||||
|
|
||||||
|
|
||||||
|
/******************************************************************************/
|
||||||
|
/* T E X T S */
|
||||||
|
/******************************************************************************/
|
||||||
|
|
||||||
|
char *widget_get_text_address_theory () {
|
||||||
|
return "/home/jean/Gem-Graph/gem-graph-client/data/text/théorie.txt";
|
||||||
|
}
|
||||||
|
|
||||||
|
char *widget_get_text_address_about_commands () {
|
||||||
|
return "/home/jean/Gem-Graph/gem-graph-client/data/text/about_commands.txt";
|
||||||
|
}
|
||||||
|
|
||||||
|
char *widget_get_text_address_any () {
|
||||||
|
return "/home/jean/Gem-Graph/gem-graph-client/data/text/any.txt";
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,79 @@
|
||||||
|
/* * * * * * * * * * * * * * * * * * * * * * * * * * *
|
||||||
|
* *
|
||||||
|
* Gem-graph client *
|
||||||
|
* *
|
||||||
|
* Windows && Headers *
|
||||||
|
* *
|
||||||
|
* Copyright © 2021 Libre en Communs <contact@a-lec.org> *
|
||||||
|
* Copyright © 2021 Adrien Bourmault <neox@a-lec.org> *
|
||||||
|
* Copyright © 2021 Jean Sirmai <jean@a-lec.org> *
|
||||||
|
* *
|
||||||
|
* This file is part of Gem-graph. *
|
||||||
|
* *
|
||||||
|
* This program is free software: you can redistribute it and/or modify it *
|
||||||
|
* under the terms of the GNU Affero General Public License *
|
||||||
|
* as published by the Free Software Foundation, *
|
||||||
|
* either version 3 of the License, *
|
||||||
|
* or (at your option) any later version. *
|
||||||
|
* *
|
||||||
|
* This program is distributed in the hope that it will be useful, *
|
||||||
|
* but WITHOUT ANY WARRANTY; *
|
||||||
|
* without even the implied warranty of MERCHANTABILITY *
|
||||||
|
* or FITNESS FOR A PARTICULAR PURPOSE. *
|
||||||
|
* See the GNU Affero General Public License for more details. *
|
||||||
|
* *
|
||||||
|
* You should have received a copy of the GNU Affero General Public License *
|
||||||
|
* along with this program. If not, see <http://www.gnu.org/licenses/>. *
|
||||||
|
* *
|
||||||
|
* * * * * * * * * * * * * * * * * * * * * * * * * * */
|
||||||
|
|
||||||
|
|
||||||
|
#include "../../../include/base.h"
|
||||||
|
#include "../../../include/signal.h"
|
||||||
|
#include "../../../include/widget.h"
|
||||||
|
|
||||||
|
|
||||||
|
/******************************************************************************/
|
||||||
|
/* M A I N W I N D O W T O P B A R ( L E F T ) */
|
||||||
|
/******************************************************************************/
|
||||||
|
|
||||||
|
static GtkButton *btt_STATE, *btt_RULES, *btt_DATA;
|
||||||
|
void *get_btt_state () {return btt_STATE;}
|
||||||
|
void *get_btt_rules () {return btt_RULES;}
|
||||||
|
void *get_btt_data () {return btt_DATA;}
|
||||||
|
|
||||||
|
void window_header_bar_left (GtkWidget *header_bar)
|
||||||
|
{
|
||||||
|
gpointer no_local_data = NULL;
|
||||||
|
|
||||||
|
GtkButton *btt_XOR_EXEC_EDIT = GTK_BUTTON (gtk_toggle_button_new ());
|
||||||
|
gtk_button_set_icon_name (btt_XOR_EXEC_EDIT, "system-run-symbolic");
|
||||||
|
gtk_button_set_icon_name (btt_XOR_EXEC_EDIT, "power-profile-balanced-rtl-symbolic");
|
||||||
|
g_signal_connect (btt_XOR_EXEC_EDIT, "clicked", G_CALLBACK (on_toggle_exec_edit), no_local_data);
|
||||||
|
|
||||||
|
GtkWidget *any_Label = GTK_WIDGET (gtk_label_new (" | "));
|
||||||
|
|
||||||
|
GtkCheckButton *group_state_rules_data = GTK_CHECK_BUTTON (gtk_check_button_new ());
|
||||||
|
|
||||||
|
btt_STATE = GTK_BUTTON (gtk_check_button_new_with_label ("state"));
|
||||||
|
g_signal_connect (btt_STATE, "toggled", G_CALLBACK (on_toggle_state_rules_data), no_local_data);
|
||||||
|
gtk_check_button_set_group (GTK_CHECK_BUTTON (btt_STATE), group_state_rules_data);
|
||||||
|
|
||||||
|
btt_RULES = GTK_BUTTON (gtk_check_button_new_with_label ("rules"));
|
||||||
|
g_signal_connect (btt_RULES, "toggled", G_CALLBACK (on_toggle_state_rules_data), no_local_data);
|
||||||
|
gtk_check_button_set_group (GTK_CHECK_BUTTON (btt_RULES), group_state_rules_data);
|
||||||
|
|
||||||
|
btt_DATA = GTK_BUTTON (gtk_check_button_new_with_label ("data analysis"));
|
||||||
|
g_signal_connect (btt_DATA, "toggled", G_CALLBACK (on_toggle_state_rules_data), no_local_data);
|
||||||
|
gtk_check_button_set_group (GTK_CHECK_BUTTON (btt_DATA), group_state_rules_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 (any_Label));
|
||||||
|
gtk_header_bar_pack_start (GTK_HEADER_BAR (header_bar), GTK_WIDGET (btt_STATE));
|
||||||
|
gtk_header_bar_pack_start (GTK_HEADER_BAR (header_bar), GTK_WIDGET (btt_RULES));
|
||||||
|
gtk_header_bar_pack_start (GTK_HEADER_BAR (header_bar), GTK_WIDGET (btt_DATA));
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,62 @@
|
||||||
|
/* * * * * * * * * * * * * * * * * * * * * * * * * * *
|
||||||
|
* *
|
||||||
|
* Gem-graph client *
|
||||||
|
* *
|
||||||
|
* Windows && Headers *
|
||||||
|
* *
|
||||||
|
* Copyright © 2021 Libre en Communs <contact@a-lec.org> *
|
||||||
|
* Copyright © 2021 Adrien Bourmault <neox@a-lec.org> *
|
||||||
|
* Copyright © 2021 Jean Sirmai <jean@a-lec.org> *
|
||||||
|
* *
|
||||||
|
* This file is part of Gem-graph. *
|
||||||
|
* *
|
||||||
|
* This program is free software: you can redistribute it and/or modify it *
|
||||||
|
* under the terms of the GNU Affero General Public License *
|
||||||
|
* as published by the Free Software Foundation, *
|
||||||
|
* either version 3 of the License, *
|
||||||
|
* or (at your option) any later version. *
|
||||||
|
* *
|
||||||
|
* This program is distributed in the hope that it will be useful, *
|
||||||
|
* but WITHOUT ANY WARRANTY; *
|
||||||
|
* without even the implied warranty of MERCHANTABILITY *
|
||||||
|
* or FITNESS FOR A PARTICULAR PURPOSE. *
|
||||||
|
* See the GNU Affero General Public License for more details. *
|
||||||
|
* *
|
||||||
|
* You should have received a copy of the GNU Affero General Public License *
|
||||||
|
* along with this program. If not, see <http://www.gnu.org/licenses/>. *
|
||||||
|
* *
|
||||||
|
* * * * * * * * * * * * * * * * * * * * * * * * * * */
|
||||||
|
|
||||||
|
|
||||||
|
#include "../../../include/base.h"
|
||||||
|
#include "../../../include/signal.h"
|
||||||
|
#include "../../../include/widget.h"
|
||||||
|
|
||||||
|
#define W_TEXT_WINDOW 700 // ad hoc (mais sans conséquences ici)
|
||||||
|
#define H_TEXT_WINDOW 1000
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/******************************************************************************/
|
||||||
|
/* T E X T W I N D O W */
|
||||||
|
/******************************************************************************/
|
||||||
|
|
||||||
|
void widget_design_text_window (GtkWindow *main_window, GtkWindow *text_window)
|
||||||
|
{
|
||||||
|
char *title = " Learn more about Gem Graph. ";
|
||||||
|
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_window_set_titlebar (text_window, header_bar);
|
||||||
|
|
||||||
|
GtkWidget *child = widget_get_stock_text (widget_get_text_address_theory());
|
||||||
|
child = widget_get_stock_text (widget_get_text_address_about_commands());
|
||||||
|
gtk_window_set_child (GTK_WINDOW (text_window), GTK_WIDGET (child));
|
||||||
|
gtk_widget_set_size_request (GTK_WIDGET (child), W_TEXT_WINDOW, H_TEXT_WINDOW);
|
||||||
|
|
||||||
|
// gtk_window_set_resizable (GTK_WINDOW (text_window), TRUE);
|
||||||
|
gtk_window_set_transient_for (GTK_WINDOW (text_window), GTK_WINDOW (main_window));
|
||||||
|
gtk_window_set_destroy_with_parent (GTK_WINDOW (text_window), TRUE);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,139 @@
|
||||||
|
/* * * * * * * * * * * * * * * * * * * * * * * * * * *
|
||||||
|
* *
|
||||||
|
* Gem-graph client *
|
||||||
|
* *
|
||||||
|
* Windows && Headers *
|
||||||
|
* *
|
||||||
|
* Copyright © 2021 Libre en Communs <contact@a-lec.org> *
|
||||||
|
* Copyright © 2021 Adrien Bourmault <neox@a-lec.org> *
|
||||||
|
* Copyright © 2021 Jean Sirmai <jean@a-lec.org> *
|
||||||
|
* *
|
||||||
|
* This file is part of Gem-graph. *
|
||||||
|
* *
|
||||||
|
* This program is free software: you can redistribute it and/or modify it *
|
||||||
|
* under the terms of the GNU Affero General Public License *
|
||||||
|
* as published by the Free Software Foundation, *
|
||||||
|
* either version 3 of the License, *
|
||||||
|
* or (at your option) any later version. *
|
||||||
|
* *
|
||||||
|
* This program is distributed in the hope that it will be useful, *
|
||||||
|
* but WITHOUT ANY WARRANTY; *
|
||||||
|
* without even the implied warranty of MERCHANTABILITY *
|
||||||
|
* or FITNESS FOR A PARTICULAR PURPOSE. *
|
||||||
|
* See the GNU Affero General Public License for more details. *
|
||||||
|
* *
|
||||||
|
* You should have received a copy of the GNU Affero General Public License *
|
||||||
|
* along with this program. If not, see <http://www.gnu.org/licenses/>. *
|
||||||
|
* *
|
||||||
|
* * * * * * * * * * * * * * * * * * * * * * * * * * */
|
||||||
|
|
||||||
|
|
||||||
|
#include "../../../include/base.h"
|
||||||
|
#include "../../../include/signal.h"
|
||||||
|
#include "../../../include/widget.h"
|
||||||
|
|
||||||
|
|
||||||
|
/******************************************************************************/
|
||||||
|
/* M A I N W I N D O W T O P B A R ( R I G H T ) */
|
||||||
|
/******************************************************************************/
|
||||||
|
|
||||||
|
static void connect(GApplication *app, gpointer *data) { puts("Connect menu item clicked.\n"); }
|
||||||
|
|
||||||
|
void window_header_bar_right (GtkWidget *header_bar)
|
||||||
|
{
|
||||||
|
gpointer no_local_data = NULL;
|
||||||
|
|
||||||
|
GtkButton *btt_go_home = GTK_BUTTON (gtk_button_new ());
|
||||||
|
gtk_button_set_icon_name (btt_go_home, "go-home-symbolic");
|
||||||
|
// gtk_widget_error_bell (GTK_WIDGET (btt_go_home)); << TODO si c'est possible ?
|
||||||
|
g_signal_connect (btt_go_home, "clicked", G_CALLBACK (on_clicked_home), no_local_data);
|
||||||
|
gtk_header_bar_pack_end (GTK_HEADER_BAR (header_bar), GTK_WIDGET (btt_go_home));
|
||||||
|
|
||||||
|
GtkButton *search = GTK_BUTTON (gtk_button_new ());
|
||||||
|
gtk_button_set_icon_name (search, "folder-saved-search-symbolic");
|
||||||
|
g_signal_connect (search, "clicked", G_CALLBACK (on_clicked_search), no_local_data);
|
||||||
|
gtk_header_bar_pack_end (GTK_HEADER_BAR (header_bar), GTK_WIDGET (search));
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
// https://discourse.gnome.org/t/when-do-we-really-have-to-use-gtk-popover-present-to-show-a-popover-at-a-given-widget/17566/5
|
||||||
|
// https://stackoverflow.com/questions/69135934/creating-a-simple-menubar-menu-and-menu-item-in-c-using-gtk4
|
||||||
|
|
||||||
|
|
||||||
|
GtkWidget* list_box = gtk_list_box_new();
|
||||||
|
GtkWidget *label_A = GTK_WIDGET (gtk_label_new("A")); gtk_list_box_append (GTK_LIST_BOX (list_box), label_A);
|
||||||
|
GtkWidget *label_B = GTK_WIDGET (gtk_label_new("B")); gtk_list_box_append (GTK_LIST_BOX (list_box), label_B);
|
||||||
|
GtkWidget *label_C = GTK_WIDGET (gtk_label_new("C")); gtk_list_box_append (GTK_LIST_BOX (list_box), label_C);
|
||||||
|
|
||||||
|
GtkWidget *pop = gtk_popover_new ();
|
||||||
|
gtk_popover_set_child (GTK_POPOVER (pop), 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);
|
||||||
|
|
||||||
|
GtkMenuButton *open_menu = GTK_MENU_BUTTON (gtk_menu_button_new ());
|
||||||
|
gtk_menu_button_set_icon_name (open_menu, "open-menu-symbolic");
|
||||||
|
gtk_menu_button_set_always_show_arrow (open_menu, TRUE);
|
||||||
|
gtk_menu_button_set_popover (open_menu, GTK_WIDGET (pop));
|
||||||
|
gtk_header_bar_pack_end (GTK_HEADER_BAR (header_bar), GTK_WIDGET (open_menu));
|
||||||
|
|
||||||
|
|
||||||
|
GSimpleAction *act_connect = g_simple_action_new("connect", NULL);
|
||||||
|
g_signal_connect(act_connect, "activate", G_CALLBACK(connect), NULL);
|
||||||
|
|
||||||
|
|
||||||
|
// gtk_menu_button_popup (open_menu); gtk_menu_button_popdown (open_menu);
|
||||||
|
// gtk_menu_item_activate (label_C);
|
||||||
|
// g_action_map_add_action(G_ACTION_MAP(app), G_ACTION(act_connect));
|
||||||
|
// GMenuItem *label_E = g_menu_item_new("connect", "app.connect");
|
||||||
|
// gtk_list_box_append (GTK_LIST_BOX (list_box), GTK_WIDGET (label_E));
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
https://docs.gtk.org/gtk4/class.ListView.html
|
||||||
|
GtkStringList *model = gtk_string_list_new (NULL); // model = create_application_list ();
|
||||||
|
|
||||||
|
GtkSignalListItemFactory *factory = GTK_SIGNAL_LIST_ITEM_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);
|
||||||
|
|
||||||
|
GtkStringList *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_scrolled_window_set_child (GTK_SCROLLED_WINDOW (sw), list);
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
// ce qui suit ira dans le callback
|
||||||
|
GtkListBoxRow *selected_row = gtk_list_box_get_selected_row (GTK_LIST_BOX (list_box));
|
||||||
|
if (selected_row != NULL)
|
||||||
|
printf("selected_row = %s\n",
|
||||||
|
gtk_button_get_label (GTK_BUTTON (gtk_list_box_row_get_child (selected_row))));
|
||||||
|
|
||||||
|
// g_signal_connect (label_C, "clicked", G_CALLBACK (on_clicked_HOME), no_local_data);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue