Scrolling beyound the viewport bounds
- From: douwe vos <dmvos2000 yahoo com>
- To: gtk-list gnome org
- Subject: Scrolling beyound the viewport bounds
- Date: Tue, 22 Jul 2008 06:53:56 -0700 (PDT)
Hi,
I created an application using the gtk_scrolled_window to display the content of a gtk_drawing_area. See initialisation below:
canvas = gtk_drawing_area_new();
g_signal_connect(G_OBJECT(canvas), "expose-event", G_CALLBACK(CFrame::paint), NULL);
GtkWidget *scrolled_window = gtk_scrolled_window_new(NULL, NULL);
gtk_scrolled_window_add_with_viewport (GTK_SCROLLED_WINDOW (scrolled_window), canvas);
gtk_widget_set_size_request(canvas, 500, 8000);
The paint callback function expects a certain space where it can draw and then tries to clean the rest of the view if not used using a call to cairo_rectangle followed bij a cairo_fill. I.e if the application only needs the space to the vertical position 7000, the viewport is at the vertical location 6900 and the viewport height is 500 then the application will fill up from vertical 7000 to 7400. This works all fine as long as I stay inside the range of the canvas size (in the example 500 x 8000). If I set the vertical position of the viewport to lets say 7700 (as in the code below), the application needs the space till 7900 and the height is still 500 then the application will try to fill from 7900 to 8200 but instead of filling that it only fills from 7900 to 8000. Apparently their is a clip set while calling my expose-calllback function. I'm fine with a clip but i'm not happy that the other region stays dirty and is not cleaned. I could probably
remove the clip but this is not realy nice I think. Is their another solution so that the dirty part gets cleaned ??
GtkAdjustment *vadj = gtk_viewport_get_vadjustment((GtkViewport *) canvas->parent);
gtk_adjustment_set_value(vadj, 7700);
Douwe
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]