sizeGroup in a table...
- From: z pekar gmail com
- To: gtk-list gnome org
- Subject: sizeGroup in a table...
- Date: Mon, 17 Nov 2008 17:59:22 +0200
Hi,
I have problems packing widgets into a table using sizeGroup. Here I
try to pack 2 gtkRulers around a scrolled window, so that rulers cover
only scrolled window's container and not the scrollbars (like in
gimp), I try to achieve this by putting rulers in the same sizeGroup
with scrolled window's container. But it doesn't seem to work -
instead rulers "cover" also the scrollbars :( what do I do wrong?
here is how it looks like:
http://img32.picoodle.com/img/img32/3/11/17/f_rulersm_837aa19.png
and here is how I would like it to be (gimp):
http://img26.picoodle.com/img/img26/3/11/17/f_gimpm_582c25a.png
(pay attention on top-right/bottom-left corners)
I struggle with it for several days already without progress :(
thank you in advance
table = gtk_table_new (3, 3, FALSE);
gtk_widget_set_events (canvas, GDK_POINTER_MOTION_MASK |
GDK_POINTER_MOTION_HINT_MASK);
hRuler = gtk_hruler_new ();
g_ptr_array_add (s->getGui()->parametersPage.imageEntry.hRuler, hRuler);
gtk_ruler_set_metric (GTK_RULER (hRuler), GTK_PIXELS);
g_signal_connect_swapped (G_OBJECT (canvas), "motion_notify_event",
G_CALLBACK (EVENT_METHOD (hRuler, motion_notify_event)),
G_OBJECT (hRuler));
gtk_table_attach (GTK_TABLE (table), hRuler, 1, 2, 0, 1,
(GtkAttachOptions)(GTK_EXPAND|GTK_SHRINK|GTK_FILL),
GTK_FILL, 0, 0);
vRuler = gtk_vruler_new ();
g_ptr_array_add (s->getGui()->parametersPage.imageEntry.vRuler, vRuler);
gtk_ruler_set_metric (GTK_RULER (vRuler), GTK_PIXELS);
g_signal_connect_swapped (G_OBJECT (canvas), "motion_notify_event",
G_CALLBACK (EVENT_METHOD (vRuler, motion_notify_event)),
G_OBJECT (vRuler));
gtk_table_attach (GTK_TABLE (table), vRuler, 0, 1, 1, 2,
GTK_FILL,
(GtkAttachOptions)(GTK_EXPAND|GTK_SHRINK|GTK_FILL),
0, 0);
scrolledWin = gtk_scrolled_window_new (NULL, NULL);
gtk_container_add(GTK_CONTAINER(scrolledWin), canvas);
g_ptr_array_add (s->getGui()->parametersPage.imageEntry.hAdj,
gtk_scrolled_window_get_hadjustment(GTK_SCROLLED_WINDOW(scrolledWin)));
g_signal_connect(gtk_scrolled_window_get_hadjustment(GTK_SCROLLED_WINDOW(scrolledWin)),
"changed", GtkSignalFunc(horz_scroller_cb), s);
g_signal_connect(gtk_scrolled_window_get_hadjustment(GTK_SCROLLED_WINDOW(scrolledWin)),
"value-changed", GtkSignalFunc(horz_scroller_cb), s);
g_ptr_array_add (s->getGui()->parametersPage.imageEntry.vAdj,
gtk_scrolled_window_get_vadjustment(GTK_SCROLLED_WINDOW(scrolledWin)));
g_signal_connect(gtk_scrolled_window_get_vadjustment(GTK_SCROLLED_WINDOW(scrolledWin)),
"changed", GtkSignalFunc(vert_scroller_cb), s);
g_signal_connect(gtk_scrolled_window_get_vadjustment(GTK_SCROLLED_WINDOW(scrolledWin)),
"value-changed", GtkSignalFunc(vert_scroller_cb), s);
gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (scrolledWin),
GTK_POLICY_AUTOMATIC,
GTK_POLICY_AUTOMATIC);
// so the hRuler do not "cover" the vert. scroller
hSizeGroup = gtk_size_group_new(GTK_SIZE_GROUP_HORIZONTAL);
gtk_size_group_add_widget (hSizeGroup, gtk_bin_get_child (GTK_BIN
(scrolledWin)));
gtk_size_group_add_widget (hSizeGroup, hRuler);
// g_object_unref(hSizeGroup);
// so the vRuler do not "cover" the horz. scroller
vSizeGroup = gtk_size_group_new(GTK_SIZE_GROUP_VERTICAL);
gtk_size_group_add_widget (vSizeGroup, gtk_bin_get_child (GTK_BIN
(scrolledWin)));
gtk_size_group_add_widget (vSizeGroup, vRuler);
// g_object_unref(vSizeGroup);
gtk_table_attach (GTK_TABLE (table), scrolledWin, 1, 3, 1, 3,
(GtkAttachOptions)(GTK_EXPAND|GTK_FILL),
(GtkAttachOptions)(GTK_EXPAND|GTK_FILL), 0, 0);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]