well, thanks for those explanations but i guess i should explain a bit more
the purpose of my questions,
in fact i am creating a graphic library with a common interface
encapsulating gtkmm on one side and QT on the other side,
that is why i need something more general to modify the widget properties,
without modifying the rc file directly.
In my toolkit, i want to create a so-called "palette" (that corresponds to a
Style or RcStyle in gtkmm),
modify the properties of the palette (palette->set_background(myColor) for
example)
then associate the palette to the widgets of my toolkit.
In Qt, thhis object is a QPalette. In the gtkmm implementation part, the
palette object is either a Style or a RcStyle,
for the moment it is a Style since, as I said, modifying the rcStyle doesn't
produce any effect.. (and I still don't understand exactly why... newbie
question?)

In the future, I will also have to investigate how to handle a common
configuration file using widget names, themes, states, ...
for Qt AND Gtk, so as to have a general apperance configuration










On Jan 22, 2008 2:08 PM, Paul Davis <[EMAIL PROTECTED]> wrote:

> On Tue, 2008-01-22 at 10:05 +0100, Yannick Barbeaux wrote:
> > Hello
> >
> > 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:
> >
> > e.g.:
> >
> > 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:
> >
> > mainWindow->modify_style(myRcStyle);
> > or
> > myPushButton->modify_style(myRcStyle);
>
> why not just use Widget::modify_fg() ?
>
> moreover, why do this in code at all? just name the widgets
> (Widget::set_name()), and load an app-specific RC file that defines the
> styles. that way you can modify the styles without a recompile.
>
>
> > then change the colors the same way e.g.:
> >
> > myStyle->set_bg(Gtk::STATE_NORMAL, anyGdkColor);
> >
> > then set the style to the widget ;
> >
> > main_window->set_style(myStyle);
> > or
> > myPushButton->set_style(myStyle);
>
> you are aware, i hope, that many widgets do not have their own window,
> and thus setting the bg for them has no effect - they just draw
> themselves on an existing bg.
>
> > 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?
>
> RcStyle represents the definition of a style taken from an RC file. it
> is held separately from a Style (the style as used by the widget) so as
> to (a) allow for slightly different representation based on its origin
> in the file (b) to allow heirarchical inheritance of RcStyles while
> compositing a particular widget's Style.
>
>
>
>
_______________________________________________
gtkmm-list mailing list
[email protected]
http://mail.gnome.org/mailman/listinfo/gtkmm-list

Reply via email to