GTK+ Forums Forum Index GTK+ Forums
Discussion forum for GTK+ and Programming. Ask questions, troubleshoot problems, view and post example code, or express your opinions.
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Setting the window title so it fits in the title bar

 
Post new topic   Reply to topic    GTK+ Forums Forum Index -> GTK+ Programming
Author Message
erwinfletch



Joined: 23 Mar 2007
Posts: 1

PostPosted: Fri Mar 23, 2007 6:36 pm    Post subject: Setting the window title so it fits in the title bar Reply with quote

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?

Thanks!
Back to top
openldev
Never Seen the Sunlight


Joined: 21 Sep 2005
Posts: 376
Location: State College, Pennsylvania

PostPosted: Fri Mar 23, 2007 6:57 pm    Post subject: Reply with quote

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.
Back to top
Display posts from previous:   
Post new topic   Reply to topic    GTK+ Forums Forum Index -> GTK+ Programming All times are GMT
Page 1 of 1

 


Powered by phpBB © 2001, 2005 phpBB Group
CodeBB 1.0 Beta 2
Protected by Anti-Spam ACP