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