Re: question on GtkScrolledWindow
- From: Gregory Hosler <ghosler redhat com>
- To: Iago Rubio <iago iagorubio com>
- Cc: gtk-app-devel-list <gtk-app-devel-list gnome org>
- Subject: Re: question on GtkScrolledWindow
- Date: Sat, 02 Feb 2008 16:17:30 +0800
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
Iago Rubio wrote:
| Sorry, looks like the attachment got stripped.
|
| Here you've got the code.
|
ahhhh.
Many thanks.
- -Greg
|
|
| #include <gtk/gtk.h>
| // gcc `pkg-config --cflags --libs gtk+-2.0` test_w.c
|
| gboolean
| scroll_viewport (gpointer data)
| {
| GtkWidget *viewport = (GtkWidget*)data;
| GtkAdjustment *adj;
| gdouble upper;
|
| adj = gtk_viewport_get_hadjustment (GTK_VIEWPORT(viewport));
| g_object_get (adj, "upper", &upper, NULL);
| gtk_adjustment_set_value (adj, upper/2);
|
| return FALSE;
| }
|
| int
| main (int argc, char *argv[])
| {
| GtkWidget *window;
| GtkWidget *scrolledwindow;
| GtkWidget *viewport;
| GtkWidget *fixed;
| GtkWidget *image;
|
| gtk_set_locale ();
| gtk_init (&argc, &argv);
|
| window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
| gtk_window_set_default_size (GTK_WINDOW(window), 300, 100);
|
| scrolledwindow = gtk_scrolled_window_new (NULL, NULL);
| gtk_widget_show (scrolledwindow);
| gtk_container_add (GTK_CONTAINER (window), scrolledwindow);
|
| viewport = gtk_viewport_new (NULL, NULL);
| gtk_widget_show (viewport);
| gtk_container_add (GTK_CONTAINER (scrolledwindow), viewport);
|
| fixed = gtk_fixed_new ();
| gtk_widget_show (fixed);
| gtk_container_add (GTK_CONTAINER (viewport), fixed);
| gtk_widget_set_size_request (fixed, 3000, 45);
|
| image = gtk_image_new_from_stock (GTK_STOCK_OPEN,
| GTK_ICON_SIZE_DIALOG);
| gtk_widget_show (image);
| gtk_fixed_put (GTK_FIXED (fixed), image, 1600, 10);
| gtk_widget_set_size_request (image, 64, 64);
|
| g_signal_connect_swapped (window, "delete-event", gtk_main_quit,
| NULL);
| gtk_widget_show (window);
|
| g_idle_add (scroll_viewport, (gpointer)viewport);
|
| gtk_main ();
|
| return 0;
| }
|
|
|
|
| _______________________________________________
| gtk-app-devel-list mailing list
| gtk-app-devel-list gnome org
| http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list
- --
+---------------------------------------------------------------------+
Please also check the log file at "/dev/null" for additional information.
(from /var/log/Xorg.setup.log)
| Greg Hosler ghosler redhat com |
+---------------------------------------------------------------------+
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.7 (GNU/Linux)
iD8DBQFHpCcY404fl/0CV/QRAoO+AJ4v1qomi5qNVBu5dMAYBu9TSPoFDQCeO/w7
ahC/xZAuvM7FZe2E/kXGp/Y=
=g/86
-----END PGP SIGNATURE-----
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]