00001
00002
00003
00004
00005
00006 #ifndef QT_DASHER_SCREEN_H
00007 #define QT_DASHER_SCREEN_H
00008
00009 #include <string>
00010 #include <sys/time.h>
00011
00012 #include <qwidget.h>
00013 #include <qpainter.h>
00014 #include <qfont.h>
00015 #include <qstring.h>
00016 #include <qpixmap.h>
00017 #include <qtimer.h>
00018 #include <qcursor.h>
00019
00020 #include "DasherScreen.h"
00021 #include "DashEdit.h"
00022 #include "DasherInterface.h"
00023
00024 using namespace Dasher;
00025
00026 class QtDasherScreen : public QWidget, public Dasher::CDasherScreen
00027
00028 {
00029 Q_OBJECT
00030 public:
00031 QtDasherScreen (int _width, int _height,
00032 CDasherInterface *_interface,
00033 QWidget * _parent=0, Dasher::CDashEditbox* edit=0);
00034 QtDasherScreen::~QtDasherScreen();
00035
00036 void SetFont(std::string Name)
00037 { fontname = Name; }
00038
00039 void SetFontSize(Dasher::Opts::FontSize )
00040 {
00041 #warning QtDasherScreen::SetFontSize() not implemented
00042 }
00043 Dasher::Opts::FontSize GetFontSize()
00044 {
00045 #warning QtDasherScreen::GetFontSize() not implemented
00046 return (Dasher::Opts::Normal);
00047 }
00048
00049 void TextSize(symbol , int* Width, int* Height, int ) const
00050 {
00051
00052 *Width = *Height = font.pixelSize();
00053
00054 }
00055 void DrawText(symbol Character, int x1, int y1, int Size) const
00056 {
00057
00058
00059 QPoint point = QPoint(x1, y1+Size/2);
00060
00061 painter->setFont (font);
00062 painter->drawText (point,
00063 QString(interface->GetDisplayText(Character).c_str()));
00064 }
00065
00066 void DrawRectangle(int x1, int y1, int x2, int y2,
00067 int Color, Opts::ColorSchemes ColorScheme) const;
00068 void Polyline(point* Points, int Number) const;
00069 void DrawPolygon(point* Points, int Number, int Color,
00070 Opts::ColorSchemes ColorScheme) const;
00071
00072 std::vector<int> FontSizes;
00073 std::vector<QFont> Fonts;
00074 QFont font;
00075 int fontsize;
00076 void Blank() const {
00077 painter->begin(pixmap);
00078 painter->setPen (NoPen);
00079 painter->fillRect(0, 0, m_iWidth, m_iHeight,
00080 QColor(255,255,255));
00081 }
00082 void Display() {
00083 painter->end();
00084 repaint();
00085 }
00086
00087 void paintEvent( QPaintEvent * )
00088 {
00089 bitBlt(this, 0, 0, pixmap);
00090 }
00091
00092 void mousePressEvent (QMouseEvent *e);
00093 void mouseReleaseEvent (QMouseEvent *e);
00094
00095 protected:
00096 QColor getColor(int Color, const Opts::ColorSchemes ColorScheme) const;
00097
00098 long QtDasherScreen::get_time();
00099
00100 CDasherInterface* interface;
00101 Dasher::CDashEditbox* edit;
00102
00103 bool paused;
00104
00105 QPainter* painter;
00106
00107 QPixmap* pixmap;
00108
00109 std::string fontname;
00110
00111 protected slots:
00112 void timer();
00113
00114 };
00115
00116 #endif