modify_style(Gtk::rcStyle) --VS-- set_style(Gtk::Style)


i am working with gtkmm 2.4 and i am trying to modify the colors of given widgets in my application,
the gtkmm documentation advices to use
widget->modify_style(Gtk::RcStyle myRcStyle)
function instead of
widget->set_style(Gtk::Style myStyle)
(because "it interacts badly with themes"?)

the strange behaviour I found out is that using the modify_style has no effects in my application:


I create a new rcStyle with the static create function:

Glib::RefPtr<Gtk::RcStyle> myRcStyle = Gtk::RcStyle::create();

then change the colors e.g.:

myRcStyle->set_bg(Gtk::STATE_NORMAL, anyGdkColor);

then set the style to the main window or any widget:


========> this has absolutely no effect at all

if I do the same with the set_style function :
create new style with the static 'create' function,

Glib::RefPtr<Gtk::Style> myStyle = Gtk::Style::create();

then change the colors the same way e.g.:

myStyle->set_bg(Gtk::STATE_NORMAL, anyGdkColor);

then set the style to the widget ;


=======> that works fine

The only visible change i get when using the modify_style(RcStyle)
is when i change the background image of a widget or a window:

set_bg_pixmap_name (Gtk::STATE_NORMAL, "myPixmap.xpm")

Can anyone explain me this strange behaviour?

And to be more general, why do exist two classes Style and RcStyle with many common functions?
What is the specific use of each class? is there a correspondance between those 2 classes?

Thanks for your precious help.

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