GtkWidget * create_paths_page (void) { GtkWidget *vbox, *hbox, *w, *scrolled_win, *canvas; vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 4); gtk_widget_show (vbox); hbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 4); gtk_box_pack_start (GTK_BOX (vbox), hbox, FALSE, FALSE); gtk_widget_show (hbox); scrolled_win = gtk_scrolled_window_new (NULL, NULL); gtk_scrolled_window_set_shadow_type (GTK_SCROLLED_WINDOW (scrolled_win), GTK_SHADOW_IN); gtk_widget_show (scrolled_win); gtk_box_pack_start (GTK_BOX (vbox), scrolled_win, TRUE, TRUE); canvas = goo_canvas_new (); gtk_widget_set_size_request (canvas, 600, 450); goo_canvas_set_bounds (GOO_CANVAS (canvas), 0, 0, 1000, 1000); gtk_widget_show (canvas); gtk_container_add (GTK_CONTAINER (scrolled_win), canvas); setup_canvas (canvas); w = gtk_button_new_with_label ("Move Path"); gtk_box_pack_start (GTK_BOX (hbox), w, FALSE, FALSE); gtk_widget_show (w); g_signal_connect (w, "clicked", G_CALLBACK (move_path_clicked), canvas); return vbox; }
GtkWidget * create_clipping_page (void) { GtkWidget *vbox, *scrolled_win, *canvas; vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 4); g_object_set (vbox, "margin", 4, NULL); gtk_widget_show (vbox); scrolled_win = gtk_scrolled_window_new (NULL, NULL); gtk_scrolled_window_set_shadow_type (GTK_SCROLLED_WINDOW (scrolled_win), GTK_SHADOW_IN); gtk_widget_show (scrolled_win); gtk_box_pack_start (GTK_BOX (vbox), scrolled_win); gtk_widget_set_halign (scrolled_win, GTK_ALIGN_FILL); gtk_widget_set_valign (scrolled_win, GTK_ALIGN_FILL); gtk_widget_set_hexpand (scrolled_win, TRUE); gtk_widget_set_vexpand (scrolled_win, TRUE); canvas = goo_canvas_new (); gtk_widget_set_size_request (canvas, 600, 450); goo_canvas_set_bounds (GOO_CANVAS (canvas), 0, 0, 1000, 1000); gtk_widget_show (canvas); gtk_container_add (GTK_CONTAINER (scrolled_win), canvas); setup_canvas (GOO_CANVAS (canvas)); return vbox; }
GtkWidget * create_focus_page (void) { GtkWidget *vbox, *label, *scrolled_win, *canvas; vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 4); gtk_container_set_border_width (GTK_CONTAINER (vbox), 4); gtk_widget_show (vbox); label = gtk_label_new ("Use Tab, Shift+Tab or the arrow keys to move the keyboard focus between the canvas items."); gtk_box_pack_start (GTK_BOX (vbox), label, FALSE, FALSE, 0); gtk_widget_show (label); scrolled_win = gtk_scrolled_window_new (NULL, NULL); gtk_scrolled_window_set_shadow_type (GTK_SCROLLED_WINDOW (scrolled_win), GTK_SHADOW_IN); gtk_widget_show (scrolled_win); gtk_box_pack_start (GTK_BOX (vbox), scrolled_win, TRUE, TRUE, 0); canvas = goo_canvas_new (); gtk_widget_set_can_focus (canvas, TRUE); gtk_widget_set_size_request (canvas, 600, 450); goo_canvas_set_bounds (GOO_CANVAS (canvas), 0, 0, 1000, 1000); gtk_widget_show (canvas); gtk_container_add (GTK_CONTAINER (scrolled_win), canvas); g_signal_connect (canvas, "item_created", G_CALLBACK (on_item_created), NULL); setup_canvas (canvas); return vbox; }
void Visit(const AirspacePolygon& airspace) { setup_canvas(airspace); draw(airspace.GetPoints()); }
void Visit(const AirspaceCircle& airspace) { setup_canvas(airspace); circle(airspace.GetCenter(), airspace.GetRadius()); }
int main (int argc, char *argv[]) { GtkWidget *window, *vbox, *label, *scrolled_win, *canvas; /* Initialize GTK+. */ gtk_set_locale (); gtk_init (&argc, &argv); /* Create the window and widgets. */ window = gtk_window_new (GTK_WINDOW_TOPLEVEL); gtk_window_set_default_size (GTK_WINDOW (window), 640, 600); gtk_widget_show (window); g_signal_connect (window, "delete_event", G_CALLBACK (on_delete_event), NULL); vbox = gtk_vbox_new (FALSE, 4); gtk_container_set_border_width (GTK_CONTAINER (vbox), 4); gtk_widget_show (vbox); gtk_container_add (GTK_CONTAINER (window), vbox); label = gtk_label_new ("Normal Layout"); gtk_widget_show (label); gtk_box_pack_start (GTK_BOX (vbox), label, FALSE, FALSE, 0); /* Create top canvas. */ scrolled_win = gtk_scrolled_window_new (NULL, NULL); gtk_scrolled_window_set_shadow_type (GTK_SCROLLED_WINDOW (scrolled_win), GTK_SHADOW_IN); gtk_widget_show (scrolled_win); gtk_box_pack_start (GTK_BOX (vbox), scrolled_win, FALSE, FALSE, 0); canvas = goo_canvas_new (); gtk_widget_set_size_request (canvas, 600, 250); goo_canvas_set_bounds (GOO_CANVAS (canvas), 0, 0, 1000, 1000); gtk_widget_show (canvas); gtk_container_add (GTK_CONTAINER (scrolled_win), canvas); g_print ("\n\nNormal Canvas...\n"); setup_canvas (canvas); label = gtk_label_new ("Integer Layout"); gtk_widget_show (label); gtk_box_pack_start (GTK_BOX (vbox), label, FALSE, FALSE, 0); /* Create bottom canvas. */ scrolled_win = gtk_scrolled_window_new (NULL, NULL); gtk_scrolled_window_set_shadow_type (GTK_SCROLLED_WINDOW (scrolled_win), GTK_SHADOW_IN); gtk_widget_show (scrolled_win); gtk_box_pack_start (GTK_BOX (vbox), scrolled_win, FALSE, FALSE, 0); canvas = goo_canvas_new (); g_object_set (canvas, "integer-layout", TRUE, NULL); gtk_widget_set_size_request (canvas, 600, 250); goo_canvas_set_bounds (GOO_CANVAS (canvas), 0, 0, 1000, 1000); gtk_widget_show (canvas); gtk_container_add (GTK_CONTAINER (scrolled_win), canvas); g_print ("\n\nInteger Layout Canvas...\n"); setup_canvas (canvas); gtk_main (); return 0; }