RcStyle::set_bg_pixmap_name() working only for some classes
- From: "Matt Hoosier" <matt hoosier gmail com>
- To: gtkmm-list gnome org
- Subject: RcStyle::set_bg_pixmap_name() working only for some classes
- Date: Tue, 17 Oct 2006 15:26:05 -0500
I'd like to install a pixmap (not known until runtime) as the
background image for a widget.
Using a custom RcStyle with the "bg_pixmap" property set seems like it
ought to do the chore:
Gtk::Widget w = ...;
const Glib::RefPtr<Gtk::RcStyle> style = Gtk::RcStyle::create ();
style->set_bg_pixmap_name (Gtk::STATE_NORMAL, "/path/to/image.png");
w.modify_style (style);
This only seems to work for those classes (and not their derived
classes) which are not GTK_WIDGET_NO_WINDOW. That is, it works for
Gtk::DrawingArea, Gtk::EventBox, and a couple of others.
If I try to instantiate "w" above as an instance of the following class:
class DerivedEventBox : public Gtk::EventBox
{
public:
DerivedEventBox () : Gtk::EventBox () {}
virtual ~DerivedEventBox() {}
};
the background PNG does not appear. Yet if I do a trivial
GObject-based subclass of GtkEventBox and use the result of
Glib::wrap() as the value of "w" above, the pixmap appears [as
expected?].
Is there some subtlety to the way that the GType inheritance works in
parallel with the C++ inheritance?
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]