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
| int main(int argc, char **argv)
{
pthread_t id;
GtkWidget *pWindow1;
GtkWidget *pTable;
GtkWidget *pFrame;
int ret;
g_thread_init(NULL);
gdk_threads_init();
gdk_threads_enter();
gtk_init(&argc, &argv);
for(int i = 0;i<2000;i++)curve[i] =0;
pWindow1 = gtk_window_new(GTK_WINDOW_TOPLEVEL);
pWindow2 = gtk_window_new(GTK_WINDOW_TOPLEVEL);
//gtk_window_set_default_size(GTK_WINDOW(pWindow2), 50, 150);
pTable = gtk_vbox_new(TRUE, 0);
pFrame = gtk_frame_new("Informations:");
//pLabel = gtk_label_new("None");
pLabel1 = gtk_label_new(" ");
pLabel2 = gtk_label_new(" ");
pLabel3 = gtk_label_new(" ");
gtk_container_add(GTK_CONTAINER(pWindow2), pFrame);
gtk_container_add(GTK_CONTAINER(pFrame), pTable);
gtk_box_pack_start(GTK_BOX(pTable), pLabel1, TRUE, FALSE, 0);
gtk_box_pack_start(GTK_BOX(pTable), pLabel2, TRUE, FALSE, 0);
gtk_box_pack_start(GTK_BOX(pTable), pLabel3, TRUE, FALSE, 0);
gtk_label_set_justify(GTK_LABEL(pLabel3), GTK_JUSTIFY_LEFT);
//gtk_label_set_justify(GTK_LABEL(pLabel2), GTK_JUSTIFY_CENTER);
gtk_window_set_resizable(GTK_WINDOW(pWindow2), FALSE);
gtk_window_set_default_size(GTK_WINDOW(pWindow1),905, 305);
gtk_window_set_default_size(GTK_WINDOW(pWindow2),350, 100);
gtk_window_set_position(GTK_WINDOW(pWindow2), GTK_WIN_POS_NONE);
gtk_window_set_position(GTK_WINDOW(pWindow1), GTK_WIN_POS_CENTER_ALWAYS);
g_signal_connect(G_OBJECT(pWindow1), "destroy", G_CALLBACK(gtk_main_quit), NULL);
g_signal_connect(G_OBJECT(pWindow1), "expose-event", G_CALLBACK(Expo_Evnt), pWindow1);
//gtk_widget_set_events(pWindow1, GDK_EXPOSURE_MASK);
//§§gtk_widget_set_events(pWindow2, GDK_EXPOSURE_MASK);
gtk_widget_show_all(pWindow2);
gtk_widget_show_all(pWindow1);
pthread_create(&id, NULL, LoopReceive, pWindow1);
pthread_create(&id, NULL, LoopSend, NULL);
gtk_main();
gdk_threads_leave();
} |
Partager