GTK+ Forums

Discussion forum for GTK+ and Programming. Ask questions, troubleshoot problems, view and post example code, or express your opinions.
It is currently Thu Apr 24, 2014 5:55 am

All times are UTC




Post new topic Reply to topic  [ 4 posts ] 
Author Message
 Post subject: Scrolling GtkDrawingArea
PostPosted: Sun Jan 08, 2012 6:03 pm 
Offline
Familiar Face

Joined: Thu Dec 29, 2011 11:45 am
Posts: 5
I have GtkScrollWindow with viewport and GtkDrawingArea in it. I'd like to be able to scroll the drawing area's contents, but I need the main window's size to remain unchanged (only scrollbars to appear over drawing area). When I change the scroll window's size with gtk_widget_set_size_request function, the whole window resizes (what's more, it can't be resized by user to any smaller size than set then). How to adjust the scroll window to make it work properly?


Top
 Profile  
 
 Post subject: Re: Scrolling GtkDrawingArea
PostPosted: Sun Jan 08, 2012 10:07 pm 
Offline
Never Seen the Sunlight

Joined: Thu Mar 24, 2011 2:10 pm
Posts: 328
Location: Sydney, Australia
Well of course the window will change size if its contents are changing size. Take a look at the documenttion: http://developer.gnome.org/gtk/2.24/GtkWidget.html#gtk-widget-set-size-request set_size_request will specify the minimum dimension for a widget so you won't be able to shrink it below this, which is generally undesirable.
If you want to have independent control over the sizing of the whole window and sections therein then the HPaned and VPaned layout widgets can be useful. You can set the sizing of the two panes programmatically and still have user control to adjust it how they might like.


Top
 Profile  
 
 Post subject: Re: Scrolling GtkDrawingArea
PostPosted: Fri Jan 13, 2012 10:44 am 
Offline
Never Seen the Sunlight

Joined: Wed Jul 23, 2008 10:31 am
Posts: 2406
Location: Slovenia
Hi.

tnetennba wrote:
I have GtkScrollWindow with viewport and GtkDrawingArea in it. I'd like to be able to scroll the drawing area's contents, but I need the main window's size to remain unchanged (only scrollbars to appear over drawing area). When I change the scroll window's size with gtk_widget_set_size_request function, the whole window resizes (what's more, it can't be resized by user to any smaller size than set then). How to adjust the scroll window to make it work properly?


You probably want to resize underlying GtkDrawingArea, not GtkScrolledWindow. When drawing area will get too big for scrolled window, scrollbars will appear while main window will retain it's size.

Cheers.
Tadej


Top
 Profile  
 
 Post subject: Re: Scrolling GtkDrawingArea
PostPosted: Wed Jun 20, 2012 6:10 am 
Offline
GTK+ Guru

Joined: Fri Mar 25, 2011 5:16 pm
Posts: 176
Location: USA
If your trying to do this with gtk+3 the documentation says both gtk_hpaned_new and gtk_vpaned_new have been phase out since version 3.2 and to use gtk_paned_new instead.

http://developer.gnome.org/gtk3/3.4/GtkHPaned.html
http://developer.gnome.org/gtk3/3.4/GtkVPaned.html

There's an example of a scrolling drawing area using GTK+3 with CSS for styling in the tutorials section.
http://www.gtkforums.com/viewtopic.php?f=3&t=988&p=195381=Drawing+with+Cairo+in+GTK3#p195381


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 4 posts ] 

All times are UTC


Who is online

Users browsing this forum: Google [Bot] and 1 guest


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group