add selchanged signal to listbox
[enigma2.git] / lib / gui / epixmap.cpp
1 #include <lib/gui/epixmap.h>
2 #include <lib/gdi/epng.h>
3 #include <lib/gui/ewidgetdesktop.h>
4
5 ePixmap::ePixmap(eWidget *parent)
6         :eWidget(parent), m_alphatest(false)
7 {
8 }
9
10 void ePixmap::setAlphatest(bool alphatest)
11 {
12         m_alphatest = alphatest;
13 }
14
15 void ePixmap::setPixmap(gPixmap *pixmap)
16 {
17         m_pixmap = pixmap;
18         event(evtChangedPixmap);
19 }
20
21 void ePixmap::setPixmapFromFile(const char *filename)
22 {
23         loadPNG(m_pixmap, filename);
24                 
25                 // TODO
26         getDesktop()->makeCompatiblePixmap(*m_pixmap);
27         event(evtChangedPixmap);
28 }
29
30 int ePixmap::event(int event, void *data, void *data2)
31 {
32         switch (event)
33         {
34         case evtPaint:
35         {
36                 ePtr<eWindowStyle> style;
37                 
38                 getStyle(style);
39                 
40 //              eWidget::event(event, data, data2);
41                 
42                 gPainter &painter = *(gPainter*)data2;
43                 if (m_pixmap)
44                         painter.blit(m_pixmap, ePoint(0, 0), eRect(), m_alphatest?gPainter::BT_ALPHATEST:0);
45                 
46                 return 0;
47         }
48         case evtChangedPixmap:
49                 invalidate();
50                 return 0;
51         default:
52                 return eWidget::event(event, data, data2);
53         }
54 }