-
Notifications
You must be signed in to change notification settings - Fork 0
/
data.c
executable file
·76 lines (46 loc) · 1.62 KB
/
data.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
#include "data.h"
/*struct tm *local;
time_t t;
t= time(NULL);
local=localtime(&t);
int dia,mes,ano,hora,min,seg;
dia=local->tm_mday;
mes=local->tm_mon+1;
ano=local->tm_year+1900;
hora = local->tm_hour;
min= local->tm_min;
seg=local->tm_sec;
printf("Data do Sistema: %d-%d-%d %d:%d:%d\n",ano,mes,dia,hora,min,seg); // Retorna a data
*/
void fechajaneladata(GtkWidget *widget,gpointer *poi){
//GtkWidget *widget,gpointer *poi
//gtk_widget_grab_focus(GTK_WIDGET(poi));
gtk_widget_destroy(GTK_WIDGET(calendar));
gtk_widget_destroy(GTK_WIDGET(wdata));
gtk_main_quit();
}
void selecionadata(GtkWidget *widget,gpointer *entry){
gint ano,mes,dia;
char data[11];
gtk_calendar_get_date(GTK_CALENDAR(calendar),&ano,&mes,&dia);
mes ++;
//g_print("%d/%d/%d",dia,mes,ano);
//gtk_entry_set_text
sprintf(data,"%d/%d/%d",dia,mes,ano);
gtk_entry_set_text(GTK_ENTRY(entry),data);
}
void janeladata(GtkWidget *widge,gpointer *poi){
gtk_init(0,0);
wdata = gtk_window_new(GTK_WINDOW_POPUP);
gtk_window_set_default_size(GTK_WINDOW(wdata), 230, 150);
gtk_window_set_modal(GTK_WINDOW(wdata),TRUE);
gtk_window_set_position(GTK_WINDOW(wdata), GTK_WIN_POS_CENTER);
calendar = gtk_calendar_new();
gtk_container_add(GTK_CONTAINER(wdata), calendar);
g_signal_connect_swapped(G_OBJECT(wdata), "destroy",G_CALLBACK(gtk_main_quit), NULL);
g_signal_connect(G_OBJECT(calendar),"day-selected-double-click",G_CALLBACK(fechajaneladata),poi);
g_signal_connect(G_OBJECT(calendar),"day-selected",G_CALLBACK(selecionadata),widge);
// g_signal_connect_swapped(G_OBJECT(windowpdv), "destroy",G_CALLBACK(gtk_main_quit), NULL);
gtk_widget_show_all(wdata);
gtk_main();
}