lcd_lm44_qt.h
Go to the documentation of this file.00001
00041 #ifndef EMULLCD_H
00042 #define EMULLCD_H
00043
00044 #include <qframe.h>
00045 #include <qfont.h>
00046 #include <qcolor.h>
00047
00048
00049 class QSizePolicy;
00050 class QPaintEvent;
00051 class QResizeEvent;
00052
00056 class EmulLCD : public QFrame
00057 {
00058 Q_OBJECT
00059
00060 public:
00061
00062 enum { COLS = 20, ROWS = 4 };
00063
00064
00065 EmulLCD(QWidget *parent = 0, const char *name = 0);
00066 virtual ~EmulLCD();
00067
00068
00069 protected:
00070 virtual QSizePolicy sizePolicy() const;
00071 virtual QSize sizeHint() const;
00072 virtual void drawContents(QPainter *p);
00073
00074
00075 public:
00076 void MoveCursor (int col, int row);
00077 void ShowCursor (bool show = true);
00078 void PutChar (unsigned char c);
00079 char GetChar ();
00080 void Clear ();
00081 void SetCGRamAddr (unsigned char addr);
00082
00083
00084 protected:
00085 void SetPainter(QPainter & p);
00086 void RedrawText(QPainter & p);
00087 void PrintChar(QPainter & p, int row, int col);
00088 void AdvanceCursor();
00089
00090 QFont lcd_font;
00091 QColor fg_color, bg_color;
00092 int font_width, font_height;
00093 int frame_width;
00094 int cr_row, cr_col;
00095 int cgramaddr;
00096 unsigned char ddram[ROWS][COLS];
00097 unsigned char cgram[8*8];
00098 bool show_cursor;
00099 };
00100
00101 #endif // !defined(EMULLCD_H)
00102