gem-graph-client/src/widget/stock.c

100 lines
5 KiB
C

/* * * * * * * * * * * * * * * * * * * * * * * * * * *
* *
* 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_stock_page () {
GtkBox *data_box = GTK_BOX (gtk_box_new (GTK_ORIENTATION_VERTICAL, 32));
GtkWidget* frame_rule_effect = gtk_frame_new ("rule effect");
GtkBox *rule_effect_box = GTK_BOX (gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 8));
gtk_frame_set_child (GTK_FRAME (frame_rule_effect), GTK_WIDGET (rule_effect_box));
GtkWidget* frame_rule_topic = gtk_frame_new ("rule topic");
GtkBox *rule_topic_box = GTK_BOX (gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 8));
gtk_frame_set_child (GTK_FRAME (frame_rule_topic), GTK_WIDGET (rule_topic_box));
GtkWidget* frame_data_type = gtk_frame_new ("data type");
GtkBox *data_type_box = GTK_BOX (gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 8));
gtk_frame_set_child (GTK_FRAME (frame_data_type), GTK_WIDGET (data_type_box));
gtk_box_append (data_box, GTK_WIDGET (frame_rule_effect));
gtk_box_append (data_box, GTK_WIDGET (frame_rule_topic));
gtk_box_append (data_box, GTK_WIDGET (frame_data_type));
gtk_box_append (rule_effect_box, gtk_button_new_with_label ("movement"));
gtk_box_append (rule_effect_box, gtk_button_new_with_label ("transport"));
gtk_box_append (rule_effect_box, gtk_button_new_with_label ("transformation"));
gtk_box_append (rule_topic_box, gtk_button_new_with_label ("objects"));
gtk_box_append (rule_topic_box, gtk_button_new_with_label ("situations"));
gtk_box_append (data_type_box, gtk_button_new_with_label ("repartitions"));
gtk_box_append (data_type_box, gtk_button_new_with_label ("evolutions"));
gtk_box_append (data_type_box, gtk_button_new_with_label ("correlations"));
return GTK_WIDGET (data_box);
}
void *widget_get_stock_text (gchar *text_address) {
GtkWidget *view = gtk_text_view_new ();
GtkTextBuffer *buffer = gtk_text_view_get_buffer (GTK_TEXT_VIEW (view));
gtk_text_buffer_set_text (buffer, read_file (text_address), -1);
gtk_text_buffer_set_modified (buffer, FALSE);
GtkScrolledWindow *scrolled_window = GTK_SCROLLED_WINDOW (gtk_scrolled_window_new());
gtk_scrolled_window_set_child (scrolled_window, view);
gtk_scrolled_window_set_policy (scrolled_window, GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC);
return GTK_WIDGET (scrolled_window);
}
/******************************************************************************/
/* 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";
}