Child widgets of GtkBox not resized until clicked
- From: Dan Vratil <dvratil redhat com>
- To: GTK Devel List <gtk-app-devel-list gnome org>
- Subject: Child widgets of GtkBox not resized until clicked
- Date: Mon, 12 Dec 2011 17:55:14 +0100
Hi,
I have this weird problem with layouts in Gtk and I hope you could push me in
the right direction:
I have GtkScrolledWindow with vertically-oriented GtkBox inside. Within this
box there are multiple GtkScrolledWindows.
For each of these embedded scrolled windows I have handler of vadjustment's
"changed" signal:
static void
inner_window_vadjustment_changed (GtkAdjustment* adjustment,
gpointer user_data)
{
GtkWidget *widget = user_data; /* the scrolled window */
gint height = gtk_adjustment_get_upper (adjustment);
gtk_widget_set_size_request (widget, -1, height);
gtk_widget_queue_resize (widget);
}
This actually expands the scrolled window to height of it's content, thus
hides the scrollbars (it's a workaround, GTK_POLICY_NEVER does not work, see
below).
This works pretty well, the correct values are assigned
(gtk_widget_get_size_request returns the new height), but the scrolled windows
are in fact not resized. When I click in the window the new height is applied
immediately and the scrolled window is resized correctly (but only the one I
clicked into, not the other ones). What can I do to make the scrolled windows
resize as soon as they receive gtk_widget_set_size_request()?
Thanks for any suggestions
Dan
PS: you may wonder why on Earth am I doing this such stupid way, so here's
some explanation: each GtkScrolledWindow contains a single WebKitWebView. I
can't embed the webviews directly to the GtkBox, because such webviews cannot
be resized (you can't shrink WebKitWebView which is not inside a scrolled
window). Other option would be to set GTK_POLICY_NEVER to disable vertical
scrolling, but webkit treats this policy as GTK_POLICY_AUTOMATIC [1]. I want
the "master" scrolled window to handle the scrolling of the entire layout, not
each of the embedded scrolled windows to have scroll bars on their own, so
that's why I'm using such workaround.
[1] http://webkitgtk.org/reference/WebKitWebFrame.html#WebKitWebFrame-
scrollbars-policy-changed
--
dvratil redhat com | Evolution developer
GPG Key: 0xC59D614F6F4AE348
Fingerprint: 4EC1 86E3 C54E 0B39 5FDD B5FB C59D 614F 6F4A E348
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]