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 Aug 25, 2016 11:27 am

All times are UTC

Post new topic Reply to topic  [ 2 posts ] 
Author Message
 Post subject: Setting the window title so it fits in the title bar
PostPosted: Fri Mar 23, 2007 6:36 pm 

Joined: Fri Mar 23, 2007 6:30 pm
Posts: 1
I am trying to set the title of the window dialog, however sometimes the title does not fit into the window title bar and gets cut off at the end. Is there a way to test if the string I'm going to set the title to will actually fit in the window?


 Post subject:
PostPosted: Fri Mar 23, 2007 6:57 pm 
Never Seen the Sunlight

Joined: Wed Sep 21, 2005 3:07 am
Posts: 384
Location: Fairfax, Virginia
The rendering of the title is handled by the window manager. To check this, you would have to know how the particular theme renders the title, if it actually renders the title in the window, the size of the window title font, the available title space, etc. Then, you would use this information to create a PangoLayout object out of the string and retrieve the width of that layout. Then, compare that value to the available title space.

You should be able to see by now that this really isn't easy to do, and I don't even know where to start to get some of this data. I would recommend that you just place the title in the window and accept that it may be ellipsed or not viewed in some window managers.

Andrew Krause

Foundations of GTK+ Development: Buy now for only $31.49!

Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 2 posts ] 

All times are UTC

Who is online

Users browsing this forum: Google [Bot], Yahoo [Bot] and 2 guests

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