Re: gtk_widget_set_style() and themes



Vlad,

I am attaching a short program to show the problem. In this program I create two
buttons and change the normal state color of the first one. As you can see, the theme
dissapears from the prelight and clicked states as well. This can be easily seen using
a theme like etheme, which puts a graded shadow on the button. I've tried it with
several other themes with the same behavior.

Cheers,

Omar.

Vlad Harchev wrote:

> On Wed, 2 Aug 2000, Omar Barneto wrote:
>
> > Thank you Vlad. The problem is as follows: I change the color for two states in
> > only one button. The rest of the buttons remain with their original theme
> > appearance. I would like that this button keeps its original appearance for the
> > other states, but instead it seems that  all the states of the button get the
> > colors changed. Those states for which I did not set the color apparently get
> > default colors. The theme dissapears in all the states. It looks like in the
> > sequence get_syle - modify style - set_style the theme is lost (but only in this
> > button). The question is how to avoid this and keep the original theme, at least
> > for the states for which I do not set new colors?
>
>  Please post a piece of code you use. Also, you didn't answer - do
> you run pixmap-based theme? Does your code works as expected if default gtk
> theme is used (i.e. light gray widgets with black text)?
>
> > Best regards,
> >
> > Omar.
> >
> > Vlad Harchev wrote:
> >
> > > On Tue, 1 Aug 2000, Omar Barneto wrote:
> > >
> > > > How can I change a button's selected and prelight color and keep the
> > > > original theme appearance for the normal color? What I'm doing is use
> > > > gtk_widget_get_style(), set the two colors on the style and then
> > > > gtk_widget_set_style(). When I do that, the three colors are apparently
> > > > set and the theme appearance is lost. I'm running under Enlightenment. I
> > >
> > >   You write that you set two colors, and then your write that 3 colors are
> > > set... The fact that you're running under E doesn't matter.
> > >
> > >   Do you mean that all buttons in your app changed the color or what? If yes,
> > >   you should use gtk_style_copy and modify the returned style. Also note, that
> > >   some themes use pixmaps for drawing widgets, so even if you've chnaged the
> > >   color in some states, appearance of the widget won't change (try your code
> > >   with brushedmetal theme for example).
> > >
> > > > found a few probably related functions like gtk_theme_engine_get() etc.,
> > > > but couldn't find any documentation on them. Is there any documentation
> > > > or examples available about how to use this themes API?
> > >
> > >   I don't know about documentation on this - but you can look at the gtk
> > > source and at the source of some theme engines (namely pixmap).
> > >
> > >   You cna also modify gtkrc for your application (you can name the buttons
> > > using gtk_widget_set_name and then bind particular style in your gtkrc to the
> > > widgets with that name), and then load modified gtkrc using
> > > gtk_rc_set_default_files or gtk_rc_add_default_file.
> > >
> > > > Thank you and regards,
> > > >
> > > > Omar.
> > > >
>
>  Best regards,
>   -Vlad
>
> _______________________________________________
> gtk-list mailing list
> gtk-list@gnome.org
> http://mail.gnome.org/mailman/listinfo/gtk-list

win6.cc



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