-WXPixmap wxBitmap::GetLabelPixmap (WXWidget w)
-{
- if (M_BITMAPDATA->m_image == (WXPixmap) 0)
- return M_BITMAPDATA->m_pixmap;
-
- Display *dpy = (Display*) M_BITMAPDATA->m_display;
-
-#ifdef FOO
- /*
- If we do:
- if (labelPixmap) return labelPixmap;
- things can be wrong, because colors can have been changed.
-
- If we do:
- if (labelPixmap)
- XmDestroyPixmap(DefaultScreenOfDisplay(dpy),labelPixmap) ;
- we got BadDrawable if the pixmap is referenced by multiples widgets
-
- this is a catch22!!
-
- So, before doing thing really clean, I just do nothing; if the pixmap is
- referenced by many widgets, Motif performs caching functions.
- And if pixmap is referenced with multiples colors, we just have some
- memory leaks... I hope we can deal with them...
- */
- // Must be destroyed, because colours can have been changed!
- if (M_BITMAPDATA->m_labelPixmap)
- XmDestroyPixmap (DefaultScreenOfDisplay (dpy), M_BITMAPDATA->m_labelPixmap);
-#endif
-
- char tmp[128];
- sprintf (tmp, "Im%x", (unsigned int) M_BITMAPDATA->m_image);
-
- Pixel fg, bg;
- Widget widget = (Widget) w;
-
- while (XmIsGadget ( widget ))
- widget = XtParent (widget);
- XtVaGetValues (widget, XmNbackground, &bg, XmNforeground, &fg, NULL);
-
- M_BITMAPDATA->m_labelPixmap = (WXPixmap) XmGetPixmap (DefaultScreenOfDisplay (dpy), tmp, fg, bg);
-
- return M_BITMAPDATA->m_labelPixmap;
-}
-
-WXPixmap wxBitmap::GetArmPixmap (WXWidget w)
-{
- if (M_BITMAPDATA->m_image == (WXPixmap) 0)
- return M_BITMAPDATA->m_pixmap;
-
- Display *dpy = (Display*) M_BITMAPDATA->m_display;
-#ifdef FOO
- // See GetLabelPixmap () comment
-
- // Must be destroyed, because colours can have been changed!
- if (M_BITMAPDATA->m_armPixmap)
- XmDestroyPixmap (DefaultScreenOfDisplay (dpy), M_BITMAPDATA->m_armPixmap);
-#endif
-
- char tmp[128];
- sprintf (tmp, "Im%x", (unsigned int) M_BITMAPDATA->m_image);
-
- Pixel fg, bg;
- Widget widget = (Widget) w;
-
- XtVaGetValues (widget, XmNarmColor, &bg, NULL);
- while (XmIsGadget (widget))
- widget = XtParent (widget);
- XtVaGetValues (widget, XmNforeground, &fg, NULL);
-
- M_BITMAPDATA->m_armPixmap = (WXPixmap) XmGetPixmap (DefaultScreenOfDisplay (dpy), tmp, fg, bg);
-
- return M_BITMAPDATA->m_armPixmap;
-}
-
-WXPixmap wxBitmap::GetInsensPixmap (WXWidget w)
-{
- Display *dpy = (Display*) M_BITMAPDATA->m_display;
-
- if (M_BITMAPDATA->m_insensPixmap)
- return M_BITMAPDATA->m_insensPixmap;
-
- if (!w)
- {
- M_BITMAPDATA->m_insensPixmap = (WXPixmap) XCreateInsensitivePixmap(dpy, (Pixmap) M_BITMAPDATA->m_pixmap);
- if (M_BITMAPDATA->m_insensPixmap)
- return M_BITMAPDATA->m_insensPixmap;
- else
- return M_BITMAPDATA->m_pixmap;
- }
-
- if (M_BITMAPDATA->m_insensImage == (WXPixmap) 0)
- return M_BITMAPDATA->m_pixmap;
-
-#ifdef FOO
- See GetLabelPixmap () comment
- // Must be destroyed, because colours can have been changed!
- if (M_BITMAPDATA->m_insensPixmap)
- XmDestroyPixmap (DefaultScreenOfDisplay (dpy), (Pixmap) M_BITMAPDATA->m_insensPixmap);
-#endif
-
- char tmp[128];
- sprintf (tmp, "Not%x", (unsigned int) M_BITMAPDATA->m_insensImage);
-
- Pixel fg, bg;
- Widget widget = (Widget) w;
-
- while (XmIsGadget (widget))
- widget = XtParent (widget);
- XtVaGetValues (widget, XmNbackground, &bg, XmNforeground, &fg, NULL);
-
- M_BITMAPDATA->m_insensPixmap = (WXPixmap) XmGetPixmap (DefaultScreenOfDisplay (dpy), tmp, fg, bg);
-
- return M_BITMAPDATA->m_insensPixmap;
-}
-