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 

Cairo, GTK default font and widget state

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



Joined: 05 Jun 2007
Posts: 4

PostPosted: Tue Jun 05, 2007 12:45 pm    Post subject: Cairo, GTK default font and widget state Reply with quote

Hello,

I have implemented a GtkTreeView with my custom cell rendered.

Now, I would like to render the treeview items taking into account:
- the current widget state (disabled, selected, etc)
- the default font for widgets.

The colors and the font may change when a new theme is applied, for exemple. How can I retreive these values?

Notice that I use Cairo to render the item text, so I need to have a Cairo description of the default font...

Thank you

Guilhem
Back to top
openldev
Never Seen the Sunlight


Joined: 21 Sep 2005
Posts: 387
Location: Fairfax, Virginia

PostPosted: Tue Jun 05, 2007 6:59 pm    Post subject: Reply with quote

You can get the current widget state with GtkStateType. You can retrieve information about the default colors of the text for the state from the GtkTreeView's style at GTK_WIDGET(treeview)->style. This is a GtkStyle object.

As for the font, the style structure includes a PangoFontDescription member called font_desc. You can get information about the font such as style, size, and family from the font description. From this information, you can set the Cairo font. Check out: http://developer.gnome.org/doc/API/2.0/pango/pango-Fonts.html
Back to top
gdw



Joined: 05 Jun 2007
Posts: 4

PostPosted: Thu Jun 07, 2007 1:18 pm    Post subject: Reply with quote

thank you, i will try this now!
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