Commit 242a4a8c3ef22fe4c2b18f08e7f05fdffefb9a58
1 parent
eaf8662c
Exists in
master
and in
4 other branches
Working on the new application window.
Showing
5 changed files
with
90 additions
and
2 deletions
Show diff stats
@@ -0,0 +1,46 @@ | @@ -0,0 +1,46 @@ | ||
1 | +/* | ||
2 | + * "Software pw3270, desenvolvido com base nos códigos fontes do WC3270 e X3270 | ||
3 | + * (Paul Mattes Paul.Mattes@usa.net), de emulação de terminal 3270 para acesso a | ||
4 | + * aplicativos mainframe. Registro no INPI sob o nome G3270. | ||
5 | + * | ||
6 | + * Copyright (C) <2008> <Banco do Brasil S.A.> | ||
7 | + * | ||
8 | + * Este programa é software livre. Você pode redistribuí-lo e/ou modificá-lo sob | ||
9 | + * os termos da GPL v.2 - Licença Pública Geral GNU, conforme publicado pela | ||
10 | + * Free Software Foundation. | ||
11 | + * | ||
12 | + * Este programa é distribuído na expectativa de ser útil, mas SEM QUALQUER | ||
13 | + * GARANTIA; sem mesmo a garantia implícita de COMERCIALIZAÇÃO ou de ADEQUAÇÃO | ||
14 | + * A QUALQUER PROPÓSITO EM PARTICULAR. Consulte a Licença Pública Geral GNU para | ||
15 | + * obter mais detalhes. | ||
16 | + * | ||
17 | + * Você deve ter recebido uma cópia da Licença Pública Geral GNU junto com este | ||
18 | + * programa; se não, escreva para a Free Software Foundation, Inc., 51 Franklin | ||
19 | + * St, Fifth Floor, Boston, MA 02110-1301 USA | ||
20 | + * | ||
21 | + * Este programa está nomeado como - e possui - linhas de código. | ||
22 | + * | ||
23 | + * Contatos: | ||
24 | + * | ||
25 | + * perry.werneck@gmail.com (Alexandre Perry de Souza Werneck) | ||
26 | + * erico.mendonca@gmail.com (Erico Mascarenhas Mendonça) | ||
27 | + * | ||
28 | + */ | ||
29 | + | ||
30 | +/** | ||
31 | + * @brief Declares the pw3270 Top Menu widget. | ||
32 | + * | ||
33 | + */ | ||
34 | + | ||
35 | +#ifndef PW3270_TOP_MENU_H_INCLUDED | ||
36 | + | ||
37 | + #define PW3270_TOP_MENU_H_INCLUDED | ||
38 | + | ||
39 | + #include <gtk/gtk.h> | ||
40 | + | ||
41 | + G_BEGIN_DECLS | ||
42 | + | ||
43 | + | ||
44 | + G_END_DECLS | ||
45 | + | ||
46 | +#endif // PW3270_TOP_MENU_H_INCLUDED |
src/widgets/window/init.c
@@ -28,6 +28,7 @@ | @@ -28,6 +28,7 @@ | ||
28 | */ | 28 | */ |
29 | 29 | ||
30 | #include "private.h" | 30 | #include "private.h" |
31 | + #include <pw3270/toolbar.h> | ||
31 | 32 | ||
32 | G_DEFINE_TYPE(pw3270ApplicationWindow, pw3270ApplicationWindow, GTK_TYPE_APPLICATION_WINDOW); | 33 | G_DEFINE_TYPE(pw3270ApplicationWindow, pw3270ApplicationWindow, GTK_TYPE_APPLICATION_WINDOW); |
33 | 34 | ||
@@ -37,14 +38,19 @@ | @@ -37,14 +38,19 @@ | ||
37 | 38 | ||
38 | static void pw3270ApplicationWindow_init(pw3270ApplicationWindow *widget) { | 39 | static void pw3270ApplicationWindow_init(pw3270ApplicationWindow *widget) { |
39 | 40 | ||
41 | + GtkBox * vBox = GTK_BOX(gtk_box_new(GTK_ORIENTATION_VERTICAL,0)); | ||
42 | + | ||
40 | widget->notebook = GTK_NOTEBOOK(gtk_notebook_new()); | 43 | widget->notebook = GTK_NOTEBOOK(gtk_notebook_new()); |
44 | + widget->terminal = pw3270_terminal_new(GTK_WIDGET(widget)); | ||
45 | + widget->toolbar = GTK_TOOLBAR(pw3270_toolbar_new()); | ||
41 | 46 | ||
42 | gtk_notebook_set_show_tabs(widget->notebook,FALSE); | 47 | gtk_notebook_set_show_tabs(widget->notebook,FALSE); |
43 | gtk_notebook_set_show_border(widget->notebook, FALSE); | 48 | gtk_notebook_set_show_border(widget->notebook, FALSE); |
44 | 49 | ||
45 | - widget->terminal = pw3270_terminal_new(GTK_WIDGET(widget)); | 50 | + gtk_box_pack_start(vBox,GTK_WIDGET(widget->toolbar),FALSE,TRUE,0); |
51 | + gtk_box_pack_start(vBox,GTK_WIDGET(widget->notebook),TRUE,TRUE,0); | ||
46 | 52 | ||
47 | - gtk_container_add(GTK_CONTAINER(widget),GTK_WIDGET(widget->notebook)); | 53 | + gtk_container_add(GTK_CONTAINER(widget),GTK_WIDGET(vBox)); |
48 | gtk_widget_show_all(GTK_WIDGET(widget)); | 54 | gtk_widget_show_all(GTK_WIDGET(widget)); |
49 | 55 | ||
50 | } | 56 | } |
src/widgets/window/private.h
src/widgets/window/testprogram/testprogram.c
@@ -30,6 +30,7 @@ | @@ -30,6 +30,7 @@ | ||
30 | 30 | ||
31 | #include <config.h> | 31 | #include <config.h> |
32 | #include <pw3270/window.h> | 32 | #include <pw3270/window.h> |
33 | + #include <pw3270/toolbar.h> | ||
33 | #include <v3270.h> | 34 | #include <v3270.h> |
34 | #include <v3270/trace.h> | 35 | #include <v3270/trace.h> |
35 | #include <lib3270/log.h> | 36 | #include <lib3270/log.h> |
@@ -51,6 +52,39 @@ | @@ -51,6 +52,39 @@ | ||
51 | 52 | ||
52 | } | 53 | } |
53 | 54 | ||
55 | +GtkWidget * pw3270_toolbar_new(void) { | ||
56 | + | ||
57 | + static const struct _item { | ||
58 | + const gchar *icon; | ||
59 | + const gchar *label; | ||
60 | + } itens[] = { | ||
61 | + | ||
62 | + { | ||
63 | + "gtk-connect", | ||
64 | + "_Connect" | ||
65 | + }, | ||
66 | + | ||
67 | + { | ||
68 | + "gtk-disconnect", | ||
69 | + "_Disconnect" | ||
70 | + } | ||
71 | + | ||
72 | + }; | ||
73 | + | ||
74 | + GtkWidget * toolbar = gtk_toolbar_new(); | ||
75 | + size_t item; | ||
76 | + | ||
77 | + for(item = 0; item < G_N_ELEMENTS(itens); item++) { | ||
78 | + | ||
79 | + GtkToolItem * button = gtk_tool_button_new(gtk_image_new_from_icon_name(itens[item].icon,GTK_ICON_SIZE_LARGE_TOOLBAR),itens[item].label); | ||
80 | + gtk_tool_button_set_use_underline(GTK_TOOL_BUTTON(button),TRUE); | ||
81 | + gtk_toolbar_insert(GTK_TOOLBAR(toolbar), button, -1); | ||
82 | + | ||
83 | + } | ||
84 | + | ||
85 | + return toolbar; | ||
86 | +} | ||
87 | + | ||
54 | int main (int argc, char **argv) { | 88 | int main (int argc, char **argv) { |
55 | 89 | ||
56 | GtkApplication *app; | 90 | GtkApplication *app; |
src/widgets/window/window.cbp
@@ -39,6 +39,7 @@ | @@ -39,6 +39,7 @@ | ||
39 | <Add option="`pkg-config --libs gtk+-3.0 libv3270`" /> | 39 | <Add option="`pkg-config --libs gtk+-3.0 libv3270`" /> |
40 | </Linker> | 40 | </Linker> |
41 | <Unit filename="../../include/pw3270/actions.h" /> | 41 | <Unit filename="../../include/pw3270/actions.h" /> |
42 | + <Unit filename="../../include/pw3270/toolbar.h" /> | ||
42 | <Unit filename="../../include/pw3270/window.h" /> | 43 | <Unit filename="../../include/pw3270/window.h" /> |
43 | <Unit filename="init.c"> | 44 | <Unit filename="init.c"> |
44 | <Option compilerVar="CC" /> | 45 | <Option compilerVar="CC" /> |