-
Notifications
You must be signed in to change notification settings - Fork 0
/
layout.c
executable file
·124 lines (84 loc) · 3.35 KB
/
layout.c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
#include <gtk/gtk.h>
#include "lay_lista_cli.h"
#include "lay_pdv.h"
#include "caixavendas.h"
#include "produtos.h"
//principal
GtkWidget *vbox;
GtkWidget *fixed;
GtkWidget *window;
GtkWidget *toolbar;
GtkToolItem *botaocliente;
GtkToolItem *btproduto;
GtkToolItem *bpdv;
GtkToolItem *save;
GtkToolItem *vendastotal;
GtkToolItem *sep;
GtkToolItem *exi;
////////////////////////
void barraprincipal(void)
{
vbox = gtk_vbox_new(FALSE, 0);
gtk_container_add(GTK_CONTAINER(window), vbox);
toolbar = gtk_toolbar_new();
gtk_toolbar_set_style(GTK_TOOLBAR(toolbar), GTK_TOOLBAR_ICONS);
gtk_container_set_border_width(GTK_CONTAINER(toolbar), 2);
GtkWidget *icon_new,*icon_pdv,*icon_produto;
icon_new = gtk_image_new_from_file("imagens/kdmconfig.png");
botaocliente = gtk_tool_button_new(icon_new, NULL);
//new = gtk_tool_button_new_from_stock(GTK_STOCK_NEW);
gtk_toolbar_insert(GTK_TOOLBAR(toolbar),botaocliente, -1);
icon_produto = gtk_image_new_from_file("imagens/produtos.png");
btproduto = gtk_tool_button_new(icon_produto,NULL);
gtk_toolbar_insert(GTK_TOOLBAR(toolbar),btproduto,-1);
icon_pdv = gtk_image_new_from_file("imagens/buy_32.png");
bpdv= gtk_tool_button_new(icon_pdv, NULL);
gtk_toolbar_insert(GTK_TOOLBAR(toolbar), bpdv, -1);
// save = gtk_tool_button_new_from_stock(GTK_STOCK_SAVE);
// gtk_toolbar_insert(GTK_TOOLBAR(toolbar), save, -1);
GtkWidget *icon_vendastotal;
icon_vendastotal = gtk_image_new_from_file("imagens/moneycalculator.png");
vendastotal = gtk_tool_button_new(icon_vendastotal, NULL);
gtk_toolbar_insert(GTK_TOOLBAR(toolbar),vendastotal, -1);
sep = gtk_separator_tool_item_new();
gtk_toolbar_insert(GTK_TOOLBAR(toolbar), sep, -1);
exi = gtk_tool_button_new_from_stock(GTK_STOCK_QUIT);
gtk_toolbar_insert(GTK_TOOLBAR(toolbar), exi, -1);
gtk_box_pack_start(GTK_BOX(vbox), toolbar, FALSE, FALSE, 5);
g_signal_connect(G_OBJECT(exi), "clicked",
G_CALLBACK(gtk_main_quit), NULL);
g_signal_connect_swapped(G_OBJECT(window), "destroy",
G_CALLBACK(gtk_main_quit), NULL);
g_signal_connect_swapped(G_OBJECT(botaocliente), "clicked",G_CALLBACK(telacliente),NULL);
g_signal_connect_swapped(G_OBJECT(bpdv), "clicked",G_CALLBACK(windowpdvc),NULL);
g_signal_connect_swapped(G_OBJECT(vendastotal), "clicked",G_CALLBACK(telatotalvendas),NULL);
g_signal_connect_swapped(G_OBJECT(btproduto),"clicked",G_CALLBACK(telaprodutos),NULL);
fixed = gtk_fixed_new();
gtk_box_pack_start(GTK_BOX(vbox),fixed,FALSE,FALSE,1);
gtk_widget_show_all(window);
return ;
}
GdkPixbuf *create_pixbuf(const gchar * filename){
//gera o icone para aplicacao
GdkPixbuf *pixbuf;
GError *error = NULL;
pixbuf = gdk_pixbuf_new_from_file(filename, &error);
if(!pixbuf) {
fprintf(stderr, "%s\n", error->message);
g_error_free(error);
}
return pixbuf;
}
void windowmain( gint argc, gchar *argv[]){
gtk_init(&argc, &argv);
window = gtk_window_new(GTK_WINDOW_TOPLEVEL);
gtk_window_set_title(GTK_WINDOW(window), "piubol 0.10");
gtk_window_set_default_size(GTK_WINDOW(window), 1280, 750);
gtk_window_set_position(GTK_WINDOW(window), GTK_WIN_POS_CENTER);
gtk_window_set_icon(GTK_WINDOW(window), create_pixbuf("imagens/smile.png"));
gtk_widget_show(window);
g_signal_connect_swapped(G_OBJECT(window), "destroy",G_CALLBACK(gtk_main_quit), NULL);
barraprincipal();
gtk_main();
return;
}