Re: font size gtk_*_new_with_label [SOLVED]
- From: Luis Ariel Lecca <ariel_xxii yahoo com ar>
- To: gtk-app-devel-list gnome org
- Subject: Re: font size gtk_*_new_with_label [SOLVED]
- Date: Mon, 14 Jul 2008 10:50:20 -0700 (PDT)
thanks to the 3 guys who gave me a hand with this...
Here one function in C to resolve this:
gint8   GuiUtils_Font_Change( GtkWidget *pCtrl, c8 *C8pname, PangoFontDescription *pfont )
{       
        gint8   S8retval = -1;
        
  if( C8pname && pfont )
        {       
                if( GTK_IS_WINDOW(pCtrl)/*||GTK_IS_LIST_ITEM(pCtrl)*/ )
                {       
                        pCtrl = lookup_widget( pCtrl/*GTK_WIDGET(pCtrl)*/, C8pname );
                }       
                
                if( pCtrl )
                {       
                        if( !GTK_IS_LABEL(pCtrl) )
                        {       
                                if( GTK_IS_BUTTON(pCtrl)||GTK_IS_ITEM(pCtrl) )
                                {       
                                        pCtrl = gtk_bin_get_child( GTK_BIN(pCtrl) );
                                }       
                                else if( GTK_IS_STATUSBAR(pCtrl) )
                                {       
                                        pCtrl = GTK_WIDGET((GTK_STATUSBAR(pCtrl)->label) );
                                }       
                                else if( GTK_IS_FRAME(pCtrl) )
                                {       
                                        pCtrl = GTK_WIDGET((GTK_FRAME(pCtrl)->label_widget) );
                                }       
                                else if( GTK_IS_ENTRY(pCtrl) )
                                {       
                                        pCtrl = lookup_widget( &((GTK_ENTRY(pCtrl)->widget)), C8pname );
                                }       
                        }       
                        
                        if( pCtrl )
                        {       
                                gtk_widget_modify_font( pCtrl, pfont );
                                S8retval = 0;
                        }       
                }       
        }       
        
        return S8retval;
}       
--- El dom 13-jul-08, Tomas Carnecky <tom dbservice com> escribió:
De: Tomas Carnecky <tom dbservice com>
Asunto: Re: font size gtk_*_new_with_label
Para: ariel_xxii yahoo com ar
Cc: gtk-app-devel-list gnome org
Fecha: domingo, 13 de julio de 2008, 9:39 am
Luis Ariel Lecca wrote:
Hi All ! I will appreciate very much any help :)
I'm using 
gtk_widget_modify_font()  and 
style = gtk_rc_style_new();
pango_font_description_free( style->font_desc );
style->font_desc = pfont;
gtk_widget_modify_style( widget, style );
to change the font size of my labels, but I can't
do it on created
buttons with gtk_*_new_with_label() and neither in my
statusbar.
I couldn't find any example on the net. I
understand that I dont have the reference to the labels...
, but when gtk refresh the screen needs the reference to
the labels...
So how to get the reference pointer or directly how to
change the font size on these objects ?
I have custom labels with my widgets...
Now, I'd rather change as less as possible the
Glade code (Glade use _with_label in generation code).
I think that would be better using with_label than a
custom button (I'm not completetly sure about it on
gtk).
Could any body give me some help about this problem? I
need to solve it
Why don't you use pango markup?
button = gtk_button_new();
label = gtk_label_new();
gtk_label_set_markup(GTK_LABEL(label), "<span
size='large'>A</span>");
gtk_container_add(GTK_CONTAINER (button), label);
tom
      ____________________________________________________________________________________
¡Buscá desde tu celular!
Yahoo! oneSEARCH ahora está en Claro
http://ar.mobile.yahoo.com/onesearch
[
Date Prev][
Date Next]   [
Thread Prev][
Thread Next]   
[
Thread Index]
[
Date Index]
[
Author Index]