 |
GTK+ Forums Discussion forum for GTK+ and Programming. Ask questions, troubleshoot problems, view and post example code, or express your opinions.
|
|
|
| Author |
Message |
|
|
erwinfletch
Joined: 23 Mar 2007 Posts: 1
|
Posted: Fri Mar 23, 2007 6:36 pm Post subject: Setting the window title so it fits in the title bar |
|
|
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: 372 Location: State College, Pennsylvania
|
Posted: Fri Mar 23, 2007 6:57 pm Post subject: |
|
|
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 |
|
 |
|
Powered by phpBB © 2001, 2005 phpBB Group CodeBB 1.0 Beta 2
|