From 242a4a8c3ef22fe4c2b18f08e7f05fdffefb9a58 Mon Sep 17 00:00:00 2001 From: Perry Werneck Date: Mon, 21 Oct 2019 11:40:36 -0300 Subject: [PATCH] Working on the new application window. --- src/include/pw3270/topmenu.h | 46 ++++++++++++++++++++++++++++++++++++++++++++++ src/widgets/window/init.c | 10 ++++++++-- src/widgets/window/private.h | 1 + src/widgets/window/testprogram/testprogram.c | 34 ++++++++++++++++++++++++++++++++++ src/widgets/window/window.cbp | 1 + 5 files changed, 90 insertions(+), 2 deletions(-) create mode 100644 src/include/pw3270/topmenu.h diff --git a/src/include/pw3270/topmenu.h b/src/include/pw3270/topmenu.h new file mode 100644 index 0000000..7215ac6 --- /dev/null +++ b/src/include/pw3270/topmenu.h @@ -0,0 +1,46 @@ +/* + * "Software pw3270, desenvolvido com base nos códigos fontes do WC3270 e X3270 + * (Paul Mattes Paul.Mattes@usa.net), de emulação de terminal 3270 para acesso a + * aplicativos mainframe. Registro no INPI sob o nome G3270. + * + * Copyright (C) <2008> + * + * Este programa é software livre. Você pode redistribuí-lo e/ou modificá-lo sob + * os termos da GPL v.2 - Licença Pública Geral GNU, conforme publicado pela + * Free Software Foundation. + * + * Este programa é distribuído na expectativa de ser útil, mas SEM QUALQUER + * GARANTIA; sem mesmo a garantia implícita de COMERCIALIZAÇÃO ou de ADEQUAÇÃO + * A QUALQUER PROPÓSITO EM PARTICULAR. Consulte a Licença Pública Geral GNU para + * obter mais detalhes. + * + * Você deve ter recebido uma cópia da Licença Pública Geral GNU junto com este + * programa; se não, escreva para a Free Software Foundation, Inc., 51 Franklin + * St, Fifth Floor, Boston, MA 02110-1301 USA + * + * Este programa está nomeado como - e possui - linhas de código. + * + * Contatos: + * + * perry.werneck@gmail.com (Alexandre Perry de Souza Werneck) + * erico.mendonca@gmail.com (Erico Mascarenhas Mendonça) + * + */ + +/** + * @brief Declares the pw3270 Top Menu widget. + * + */ + +#ifndef PW3270_TOP_MENU_H_INCLUDED + + #define PW3270_TOP_MENU_H_INCLUDED + + #include + + G_BEGIN_DECLS + + + G_END_DECLS + +#endif // PW3270_TOP_MENU_H_INCLUDED diff --git a/src/widgets/window/init.c b/src/widgets/window/init.c index 4a22dd1..fd00a73 100644 --- a/src/widgets/window/init.c +++ b/src/widgets/window/init.c @@ -28,6 +28,7 @@ */ #include "private.h" + #include G_DEFINE_TYPE(pw3270ApplicationWindow, pw3270ApplicationWindow, GTK_TYPE_APPLICATION_WINDOW); @@ -37,14 +38,19 @@ static void pw3270ApplicationWindow_init(pw3270ApplicationWindow *widget) { + GtkBox * vBox = GTK_BOX(gtk_box_new(GTK_ORIENTATION_VERTICAL,0)); + widget->notebook = GTK_NOTEBOOK(gtk_notebook_new()); + widget->terminal = pw3270_terminal_new(GTK_WIDGET(widget)); + widget->toolbar = GTK_TOOLBAR(pw3270_toolbar_new()); gtk_notebook_set_show_tabs(widget->notebook,FALSE); gtk_notebook_set_show_border(widget->notebook, FALSE); - widget->terminal = pw3270_terminal_new(GTK_WIDGET(widget)); + gtk_box_pack_start(vBox,GTK_WIDGET(widget->toolbar),FALSE,TRUE,0); + gtk_box_pack_start(vBox,GTK_WIDGET(widget->notebook),TRUE,TRUE,0); - gtk_container_add(GTK_CONTAINER(widget),GTK_WIDGET(widget->notebook)); + gtk_container_add(GTK_CONTAINER(widget),GTK_WIDGET(vBox)); gtk_widget_show_all(GTK_WIDGET(widget)); } diff --git a/src/widgets/window/private.h b/src/widgets/window/private.h index ce41e15..d5bd0d8 100644 --- a/src/widgets/window/private.h +++ b/src/widgets/window/private.h @@ -52,6 +52,7 @@ GtkWidget * terminal; GtkNotebook * notebook; + GtkToolbar * toolbar; }; diff --git a/src/widgets/window/testprogram/testprogram.c b/src/widgets/window/testprogram/testprogram.c index 5c29fcb..662dde3 100644 --- a/src/widgets/window/testprogram/testprogram.c +++ b/src/widgets/window/testprogram/testprogram.c @@ -30,6 +30,7 @@ #include #include + #include #include #include #include @@ -51,6 +52,39 @@ } +GtkWidget * pw3270_toolbar_new(void) { + + static const struct _item { + const gchar *icon; + const gchar *label; + } itens[] = { + + { + "gtk-connect", + "_Connect" + }, + + { + "gtk-disconnect", + "_Disconnect" + } + + }; + + GtkWidget * toolbar = gtk_toolbar_new(); + size_t item; + + for(item = 0; item < G_N_ELEMENTS(itens); item++) { + + GtkToolItem * button = gtk_tool_button_new(gtk_image_new_from_icon_name(itens[item].icon,GTK_ICON_SIZE_LARGE_TOOLBAR),itens[item].label); + gtk_tool_button_set_use_underline(GTK_TOOL_BUTTON(button),TRUE); + gtk_toolbar_insert(GTK_TOOLBAR(toolbar), button, -1); + + } + + return toolbar; +} + int main (int argc, char **argv) { GtkApplication *app; diff --git a/src/widgets/window/window.cbp b/src/widgets/window/window.cbp index b55292d..c00e20d 100644 --- a/src/widgets/window/window.cbp +++ b/src/widgets/window/window.cbp @@ -39,6 +39,7 @@ +