Re: [gtkmm] How to use themes?



On Saturday 26 July 2003 4:05 pm, Alex wrote:
> Hi,
>
> I'm trying to change the layout of my program via the gtkrc config file. My
> ~/.gtkrc file is used by GTK, but I can't set specific styles for specific
> widgets.
>
> ~/.gtkrc
> -----------------
> style "my-labels"
> {
>   font="-monotype-Arial-medium-r-normal-*-18-*-*-*-*-*-iso8859-1"
> }
>
> widget "*MYLabel*" style "my-labels"
> -----------------
>
> code:
> --------------
> labelWidget.set_name( "MYLabel" );
>
> Glib::RefPtr<Gtk::Style> labelStyle = Gtk::RC::get_style( labelWidget );
> labelWidget.set_style( labelStyle );
> --------------
>
> The gtk label is displayed fine, but the font can't be controlled via the
> gtkrc file. It is always set to the default font size for labels.
>
> How can I "load" the settings for specific widgets from a gtkrc file?

In Gtk+-2 you would do:

{
  font_name = "Sans 18"
}

or something similar (you could also pick Arial 18, but a more generic and 
theme-consistent solution is to use the current Sans Serif font).  In 
particular, in Gtk+2 you need to set "font_name", not "font".

Chris.





[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]