[gtkmm] problems setting a background image for Gtk::Frame
- From: My Self <anotherusername1 yahoo com>
- To: gtkmm-list gnome org
- Subject: [gtkmm] problems setting a background image for Gtk::Frame
- Date: Sun, 20 Jun 2004 23:24:22 -0700 (PDT)
Hello,
I'm using gtkmm2 for an application that I'm coding
and am having trouble setting a background image on
different widgets. The code I'm using is:
//Gtk::Frame m_Frame defined elsewhere
Glib::RefPtr < Gdk::Colormap > colormap;
colormap = get_default_colormap();
const std::string &fname = "../myimage.xpm";
const Glib::RefPtr<const Gdk::Drawable> drawable =
get_window();
const Gdk::Color transparent =
Gtk::Widget::get_default_style()->get_bg(Gtk::STATE_NORMAL);
Glib::RefPtr<Gdk::Bitmap> mask;
const Glib::RefPtr<Gdk::Pixmap> pixmap =
Gdk::Pixmap::create_from_xpm(drawable, mask,
transparent, fname);
m_Frame.modify_bg_pixmap(Gtk::STATE_NORMAL,
"pixmap");//also tried with "<pixmap>" since there was
an example with "<none>"
m_Frame.modify_bg_pixmap(Gtk::STATE_ACTIVE,
"pixmap");
m_Frame.modify_bg_pixmap(Gtk::STATE_PRELIGHT,
"pixmap");
m_Frame.modify_bg_pixmap(Gtk::STATE_SELECTED,
"pixmap");
m_Frame.modify_bg_pixmap(Gtk::STATE_INSENSITIVE,
"pixmap");
When I use the above code I get "Gdk-CRITICAL **: file
gdkpixmap.c: line 563
(gdk_pixmap_colormap_create_from_xpm): assertion
`drawable != NULL || colormap != NULL' failed" and no
background image displays. When I use
const Glib::RefPtr<Gdk::Pixmap> pixmap =
Gdk::Pixmap::create_from_xpm(drawable, mask, colormap,
transparent, fname)
in the above code no background image is displayed,
but the Gdk-CRITICAL message doesn't appear. How
should I modify this code to set the background image?
Also, I will be dragging and dropping other widgets
over the background. Will it automatically refresh?
It would be easier for me to use png images instead of
the xpm (converted with the GIMP this time), how would
I do this? I have looked at several examples and was
not able to get this part fo my program working.
Thanks.
__________________________________
Do you Yahoo!?
Yahoo! Mail Address AutoComplete - You start. We finish.
http://promotions.yahoo.com/new_mail
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]