gtk_widget_set_style a cestina

Karel Zak zakkr na zf.jcu.cz
Úterý Únor 26 10:05:57 CET 2002


On Tue, Feb 26, 2002 at 08:49:00AM +0100, Martin Zúber wrote:

> narazil jsem na drobnou chybku pri zmene stylu v GTK, se kterou si nevim
> rady. Vytvoril jsem si projekt v Glade jako jazyk jsem pouzil C a
> vygeneroval zdrojaky. Po prekladu mam vsechna okna v cestine, cestina mi
> chodi i pro zadavani do entries - vsechno ok.
> 
> Abych uzivateli naznacil, ze ma nejakou polozku vyplnit, rozhodl jsem se, ze
> prislusnou GTK_ENTRY obarvim na zluto. Takze jsem provedl pred zobrazeni
> okna:
> 
> ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> entry = lookup_widget(GTK_WIDGET(okno), "entry1");
> styl = gtk_widget_get_style(GTK_WIDGET(entry));
> 
> // ozlutime pozadi objektu
> styl->bg[0].red = 65535;
> styl->bg[0].green = 65535;
> styl->bg[0].blue = 0;
> 
> gtk_widget_set_style(GTK_WIDGET(entry), styl);
> 
> ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> 
> V momente, kdy tohle provedu a okno zobrazim, tak se zmeni font a misto
> cestiny tam mam znaky z jine sady (zjevne ISO 1). Pro xfs jsem v konfiguraku


 Zdrojaky GTK 1.3.14:

 * gtk_widget_set_style:
 * @widget: a #GtkWidget
 * @style: a #GtkStyle, or %NULL to remove the effect of a previous
 *         gtk_widget_set_style() and go back to the default style
 *
 * Sets the #GtkStyle for a widget (@widget->style). You probably don't
                                                     ^^^^^^^^^^^^^^^^^^
 * want to use this function; it interacts badly with themes, because
 * themes work by replacing the #GtkStyle. Instead, use
 * gtk_widget_modify_style().


 A komentar k gtk_widget_modify_style():

 * Note that modifications made with this function are not cumulative
 * with previous calls to gtk_widget_modify_style() or with such
 * functions as gtk_widget_modify_fg(). If you wish to retain
 * previous values, you must first call gtk_widget_get_modifier_style(),
 * make your modifications to the returned style, then call
 * gtk_widget_modify_style() with that style. On the other hand,
 * if you first call gtk_widget_modify_style(), subsequent calls
 * to such functions gtk_widget_modify_fg() will have a cumulative
 * effect with the initial modifications.


 Pokusil bych se pouzit funkci:

   void        gtk_widget_modify_bg            (GtkWidget *widget,
                                                GtkStateType state,
                                                GdkColor *color);

   Sets the background color for a widget in a particular state. All other
   style values are left untouched. See also gtk_widget_modify_style().

         widget :  a GtkWidget.
          state :  the state for which to set the background color.
          color :  the color to assign (does not need to be allocated).



 Vice viz: http://docs.linux.cz/gtk-2.0/gtkwidget.html nebo zdrojaky 
 GTK :-)

        Karel

-- 
 Karel Zak  <zakkr na zf.jcu.cz>
 http://home.zf.jcu.cz/~zakkr/
 
 C, PostgreSQL, PHP, WWW, http://docs.linux.cz, http://mape.jcu.cz


Další informace o konferenci Linux