1 #include "wmwidget.h"
2 #include "xwrapper.h"
3 
4 #ifndef _WMIMAGE_H
5 #define _WMIMAGE_H
6 
7 // WMImage: a widget that displays a picture in Xpm format
8 class WMImage : public virtual WMWidget {
9  private:
10   WMPixmap		wIcon;
11   WMPixmap *		wIconPtr;
12 
13  protected:
14   Color			wBGColor;
15   virtual void 		real_display();
16   WMPixmap *		p_icon();
17 
18  public:
19   WMImage(const WMPixmap * pm = 0);
20   WMImage(const WMPixmap & pm);
21   WMImage(char *xpm[]);
22   virtual ~WMImage();
23 
24   void seticon(bool dodisplay = true); //make an empty icon
25   void seticon(const WMPixmap *, bool dodisplay = true);
26   void seticon(const WMPixmap &, bool dodisplay = true);
27   void seticon(char *xpm[], bool dodisplay = true);
28   void setbgcolor(Color, bool dodisplay = true);
29   Color bgcolor() const;
30   const WMPixmap * icon() const;
31 };
32 
33 // inline functions for WMImage ------------------------------------------
34 
35 inline void
seticon(const WMPixmap * pm,bool dodisplay)36 WMImage::seticon(const WMPixmap *pm, bool dodisplay)
37 { if (pm) seticon(*pm, dodisplay); else wIconPtr = 0; }
38 
39 inline void
setbgcolor(Color c,bool dodisplay)40 WMImage::setbgcolor(Color c, bool dodisplay)
41 { wBGColor = c; if (dodisplay) display(); }
42 
43 inline Color
bgcolor()44 WMImage::bgcolor() const { return wBGColor; }
45 
46 inline WMPixmap *
p_icon()47 WMImage::p_icon() { return wIconPtr; }
48 
49 inline const WMPixmap *
icon()50 WMImage::icon() const { return wIconPtr; }
51 
52 #endif
53