WLAN: fix inversed logic for WPA2 vs. WPA/WPA2
[enigma2.git] / lib / gui / ecanvas.cpp
1 #include <lib/gui/ecanvas.h>
2
3 eCanvas::eCanvas(eWidget *parent): ePixmap(parent)
4 {
5 }
6
7 void eCanvas::setSize(eSize size)
8 {
9         setPixmap(new gPixmap(size, 32)); /* TODO: do we need 8bit surfaces? */
10 }
11
12 void eCanvas::clear(gRGB color)
13 {
14         if (!m_pixmap)
15                 return;
16
17         ePtr<gDC> d = new gDC(m_pixmap);
18         gPainter p(d, eRect());
19         p.resetClip(eRect(ePoint(0,0), m_pixmap->size()));
20         p.setBackgroundColor(color);
21         p.clear();
22
23         invalidate();
24 }
25
26 void eCanvas::fillRect(eRect rect, gRGB color)
27 {
28         if (!m_pixmap)
29                 return;
30
31         ePtr<gDC> dc = new gDC(m_pixmap);
32
33         gPainter p(dc);
34         p.resetClip(eRect(ePoint(0,0), m_pixmap->size()));
35         p.setForegroundColor(color);
36         p.fill(rect);
37
38         invalidate(rect);
39 }
40
41 void eCanvas::writeText(eRect rect, gRGB fg, gRGB bg, gFont *font, const char *string, int flags)
42 {
43         ePtr<gDC> dc = new gDC(m_pixmap);
44
45         gPainter p(dc);
46         p.setFont(font);
47         p.resetClip(eRect(ePoint(0,0), m_pixmap->size()));
48         p.setForegroundColor(fg);
49         p.setBackgroundColor(bg);
50         p.renderText(rect, string, flags);
51
52         invalidate(rect);
53 }