Gtk / Cairo Question



Gentle People:

I am planning a graphical application for plotting Stock Market related price
and volume data and I have been experimenting with GTk and Cairo.

I have been going through the tutorials on both the GTK and Cairo Web sites
which have been very helpful with the basics. Thank You for these tutorials.

I found an interesting example of how to draw with Cairo inside a basic GTK
Window. However I would like to use a GTK Scrolled Window. Such that I can
plot larger amounts of data and scroll the window vertically and horizontally!
Is there any way to do this? Can you forward a short example?

    The application will require a substantial amount of menus and such,
so I am favoring a GTK window so that I can use the GTK Facilities for Buttons
and Menus.

   The code shown is cut from a GTK Scrolled window example and is based on
gtk_dialog_new which from my experiments dose NOT allow Cairo drawing.

From GTK Scrolled Window Example:
gtk_init (&argc, &argv);
/* Create a new dialog window for the scrolled window to be * packed into. */
window = gtk_dialog_new ();
g_signal_connect (window, "destroy", G_CALLBACK (destroy), NULL);
gtk_window_set_title (GTK_WINDOW (window), "GtkScrolledWindow example");
gtk_container_set_border_width (GTK_CONTAINER (window), 0);
gtk_widget_set_size_request (window, 300, 300);
/* create a new scrolled window. */
scrolled_window = gtk_scrolled_window_new (NULL, NULL);
gtk_container_set_border_width (GTK_CONTAINER (scrolled_window), 10);
/* the policy is one of GTK_POLICY AUTOMATIC, or GTK_POLICY_ALWAYS.
* GTK_POLICY_AUTOMATIC will automatically decide whether you need *
scrollbars, whereas GTK_POLICY_ALWAYS will always leave the scrollbars *
there. The first one is the horizontal scrollbar, the second, * the vertical. */ gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (scrolled_window), GTK_POLICY_AUTOMATIC, GTK_POLICY_ALWAYS);
/* The dialog window is created with a vbox packed into it. */
gtk_box_pack_start (GTK_BOX (GTK_DIALOG(window)->vbox), scrolled_window, TRUE, TRUE, 0);
gtk_widget_show (scrolled_window);

Thank You
Thomas Dineen




[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]