Port to Qt 4.1.
[bertos.git] / drv / lcd_gfx_qt.h
1 /**
2  * \file
3  * <!--
4  * Copyright 2006 Develer S.r.l. (http://www.develer.com/)
5  * All Rights Reserved.
6  * -->
7  *
8  * \version $Id$
9  *
10  * \author Bernardo Innocenti <bernie@develer.com>
11  *
12  * \brief Custom control for graphics LCD emulation (interface)
13  */
14
15 /*#*
16  *#* $Log$
17  *#* Revision 1.4  2006/02/20 02:00:40  bernie
18  *#* Port to Qt 4.1.
19  *#*
20  *#* Revision 1.3  2006/02/15 09:13:16  bernie
21  *#* Switch to BITMAP_FMT_PLANAR_V_LSB.
22  *#*
23  *#* Revision 1.2  2006/02/10 12:33:51  bernie
24  *#* Make emulator display a bit larger.
25  *#*
26  *#* Revision 1.1  2006/01/16 03:51:35  bernie
27  *#* Add LCD Qt emulator.
28  *#*
29  *#*/
30
31 #ifndef DRV_LCD_GFX_QT_H
32 #define DRV_LCD_GFX_QT_H
33
34 #if _QT < 4
35         #include <qframe.h>
36         #include <qcolor.h>
37 #else
38         #include <QtGui/QColor>
39         #include <QtGui/QFrame>
40 #endif
41
42 // fwd decls
43 class QSizePolicy;
44 class QPaintEvent;
45 class QResizeEvent;
46
47
48 class EmulLCD : public QFrame
49 {
50         Q_OBJECT
51
52 public:
53 // Attributes
54         enum { WIDTH = 128, HEIGHT = 64 };
55
56 // Construction
57         EmulLCD(QWidget *parent = 0, const char *name = 0);
58         virtual ~EmulLCD();
59
60 // Base class overrides
61 protected:
62         virtual QSizePolicy sizePolicy() const;
63         virtual QSize sizeHint() const;
64         virtual void paintEvent(QPaintEvent *event);
65
66 // Operations
67 public:
68         void writeRaster(uint8_t *raster);
69
70 // Implementation
71 protected:
72         /// Frame thickness
73         int frame_width;
74
75         /// LCD colors
76         QColor fg_color, bg_color;
77
78         /// Pixel storage
79         unsigned char raster[(WIDTH * HEIGHT) / 8];
80 };
81
82 #endif // DRV_LCD_GFX_QT_H