Sistema l'errore da me commesso in fase di conversione...
[bertos.git] / drv / lcd_lm44_qt.h
1 /**
2  * \file
3  * <!--
4  * Copyright 2006 Develer S.r.l. (http://www.develer.com/)
5  * Copyright 2000,2001 Bernardo Innocenti <bernie@codewiz.org>
6  * This file is part of DevLib - See README.devlib for information.
7  * -->
8  *
9  * \version $Id$
10  *
11  * \author Bernardo Innocenti <bernie@develer.com>
12  *
13  * \brief Custom Qt widget for emulating a graphics LCD display (implementation)
14  */
15
16 /*#*
17  *#* $Log$
18  *#* Revision 1.1  2006/01/16 03:51:35  bernie
19  *#* Add LCD Qt emulator.
20  *#*
21  *#*/
22
23 #ifndef EMULLCD_H
24 #define EMULLCD_H
25
26 #include <qframe.h>
27 #include <qfont.h>
28 #include <qcolor.h>
29
30 // fwd decls
31 class QSizePolicy;
32 class QPaintEvent;
33 class QResizeEvent;
34
35 /**
36  * Qt widget to emulate a dot-matrix LCD display.
37  */
38 class EmulLCD : public QFrame
39 {
40         Q_OBJECT
41
42 public:
43 // Attributes
44         enum { COLS = 20, ROWS = 4 };
45
46 // Construction
47         EmulLCD(QWidget *parent = 0, const char *name = 0);
48         virtual ~EmulLCD();
49
50 // Base class overrides
51 protected:
52         virtual QSizePolicy sizePolicy() const;
53         virtual QSize sizeHint() const;
54         virtual void drawContents(QPainter *p);
55
56 // Operations
57 public:
58         void MoveCursor         (int col, int row);
59         void ShowCursor         (bool show = true);
60         void PutChar            (unsigned char c);
61         char GetChar            ();
62         void Clear                      ();
63         void SetCGRamAddr       (unsigned char addr);
64
65 // Implementation
66 protected:
67         void SetPainter(QPainter & p);
68         void RedrawText(QPainter & p);
69         void PrintChar(QPainter & p, int row, int col);
70         void AdvanceCursor();
71
72         QFont lcd_font;                                 ///< Display character font
73         QColor fg_color, bg_color;              ///< LCD colors
74         int font_width, font_height;    ///< Font dimensions
75         int frame_width;                                ///< Frame width (and height)
76         int     cr_row, cr_col;                         ///< Cursor position
77         int cgramaddr;                                  ///< CGRAM Address (-1 disabled)
78         unsigned char ddram[ROWS][COLS];///< Display data RAM
79         unsigned char cgram[8*8];               ///< CGRAM
80         bool show_cursor;                               ///< Cursor enabled?
81 };
82
83 #endif // !defined(EMULLCD_H)
84