Add handy functions for handling non recurrent timeouts.
[bertos.git] / bertos / drv / lcd_gfx_qt.h
index 7893dc7305079d634a19bfb02035bee6fe53ab9d..9840f24cd44817db4765c07619b514999eb62117 100644 (file)
  * invalidate any other reasons why the executable file might be covered by
  * the GNU General Public License.
  *
- * Copyright 2006 Develer S.r.l. (http://www.develer.com/)
+ * Copyright 2006, 2008 Develer S.r.l. (http://www.develer.com/)
  * All Rights Reserved.
  * -->
  *
- * \version $Id$
- *
- * \author Bernardo Innocenti <bernie@develer.com>
+ * \author Bernie Innocenti <bernie@codewiz.org>
  *
  * \brief Custom control for graphics LCD emulation (interface)
  */
 
-/*#*
- *#* $Log$
- *#* Revision 1.5  2006/05/28 12:17:57  bernie
- *#* Drop almost all the Qt3 cruft.
- *#*
- *#* Revision 1.4  2006/02/20 02:00:40  bernie
- *#* Port to Qt 4.1.
- *#*
- *#* Revision 1.3  2006/02/15 09:13:16  bernie
- *#* Switch to BITMAP_FMT_PLANAR_V_LSB.
- *#*
- *#* Revision 1.2  2006/02/10 12:33:51  bernie
- *#* Make emulator display a bit larger.
- *#*
- *#* Revision 1.1  2006/01/16 03:51:35  bernie
- *#* Add LCD Qt emulator.
- *#*
- *#*/
-
 #ifndef DRV_LCD_GFX_QT_H
 #define DRV_LCD_GFX_QT_H
 
+// uint8_t
+#include <gfx/gfx.h>
+#include <cfg/compiler.h>
+
 #include <QtGui/QColor>
 #include <QtGui/QFrame>
 
+#define LCD_WIDTH      128
+
 // fwd decls
 class QSizePolicy;
 class QPaintEvent;
 class QResizeEvent;
 
+#define CONFIG_EMULLCD_SCALE 1
 
 class EmulLCD : public QFrame
 {
@@ -77,15 +63,17 @@ public:
        enum { WIDTH = 128, HEIGHT = 64 };
 
 // Construction
-       EmulLCD(QWidget *parent = 0, const char *name = 0);
+       EmulLCD(QWidget *parent = 0);
        virtual ~EmulLCD();
 
 // Base class overrides
 protected:
-       virtual QSizePolicy sizePolicy() const;
-       virtual QSize sizeHint() const;
        virtual void paintEvent(QPaintEvent *event);
 
+       #if CONFIG_EMULLCD_SCALE
+               virtual int heightForWidth(int w) const;
+       #endif
+
 // Operations
 public:
        void writeRaster(uint8_t *raster);
@@ -95,11 +83,16 @@ protected:
        /// Frame thickness
        int frame_width;
 
-       /// LCD colors
-       QColor fg_color, bg_color;
+       /// Brushes for painting the LCD
+       QColor fg_color;
+       QBrush bg_brush;
 
        /// Pixel storage
-       unsigned char raster[(WIDTH * HEIGHT) / 8];
+       unsigned char raster[(WIDTH + 7 / 8) * HEIGHT];
 };
 
+
+void lcd_gfx_qt_init(Bitmap *lcd_bitmap);
+void lcd_gfx_qt_blitBitmap(const Bitmap *bm);
+
 #endif // DRV_LCD_GFX_QT_H