lcd_lm44_qt.h

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