tagging release
[dasher.git] / trunk / Src / Qt / QtDasherScreen.h
blob5972ee7ace8fcca66024594200a6c1d74d8838f1
1 // QtDasherScreen.h
2 // (c) 2003 Yann Dirson
3 // Derived from GtkDasherCanvas.h
4 // (c) 2002 Philip Cowans
6 #ifndef QT_DASHER_SCREEN_H
7 #define QT_DASHER_SCREEN_H
9 #include <string>
10 #include <sys/time.h>
12 #include <qwidget.h>
13 #include <qpainter.h>
14 #include <qfont.h>
15 #include <qstring.h>
16 #include <qpixmap.h>
17 #include <qtimer.h>
18 #include <qcursor.h>
20 #include "DasherScreen.h"
21 #include "DashEdit.h"
22 #include "DasherInterface.h"
24 #include <iconv.h>
26 using namespace Dasher;
28 class QtDasherScreen:public QWidget, public Dasher::CDasherScreen {
29 Q_OBJECT public:
30 QtDasherScreen(int _width, int _height, CDasherInterface * _interface, QWidget * _parent = 0, Dasher::CDashEditbox * edit = 0);
31 QtDasherScreen::~QtDasherScreen();
33 void SetFont(std::string Name) {
34 fontname = Name; /* set_the_font(); */
35 } void SetFontSize(Dasher::Opts::FontSize fontsize) {
36 #warning QtDasherScreen::SetFontSize() not implemented
38 Dasher::Opts::FontSize GetFontSize()const {
39 #warning QtDasherScreen::GetFontSize() not implemented
40 return (Dasher::Opts::Normal);
41 } void TextSize(symbol Character, int *Width, int *Height, int Size) const {
42 // should probably use QPainter::boundingRect()
43 *Width = *Height = Fonts[Size].pixelSize();
45 } void DrawText(symbol Character, int x1, int y1, int Size) const {
46 // QFont font = QFont (fontname.c_str(), Size);
47 // font.setPixelSize(Size);
48 QPoint point = QPoint(x1, y1 + Size / 2);
50 painter->setFont(Fonts[Size]);
51 painter->drawText(point, QString(interface->GetDisplayText(Character).c_str()));
52 } void DrawText(std::string String, int x1, int y1, int Size) const {
54 void DrawRectangle(int x1, int y1, int x2, int y2, int Color, Opts::ColorSchemes ColorScheme) const;
55 void Polyline(point * Points, int Number) const;
56 void Polyline(point * Points, int Number, int Color) const {
57 Polyline(Points, Number, Color);
59 void DrawPolygon(point * Points, int Number, int Color, Opts::ColorSchemes ColorScheme) const;
60 void SetColourScheme(const Dasher::CCustomColours * scheme) {
63 std::vector < int >FontSizes;
64 std::vector < QFont > Fonts;
66 void Blank() const {
67 painter->begin(pixmap);
68 painter->setPen(NoPen);
69 painter->fillRect(0, 0, m_iWidth, m_iHeight, QColor(255, 255, 255));
70 } void Display() {
71 painter->end();
72 repaint();
75 void paintEvent(QPaintEvent *) {
76 bitBlt(this, 0, 0, pixmap);
79 void mousePressEvent(QMouseEvent * e);
80 void mouseReleaseEvent(QMouseEvent * e);
82 protected:
83 QColor getColor(int Color, const Opts::ColorSchemes ColorScheme) const;
85 long QtDasherScreen::get_time();
87 CDasherInterface *interface;
88 Dasher::CDashEditbox * edit;
90 bool paused;
92 QPainter *painter;
94 QPixmap *pixmap;
96 std::string fontname;
98 protected slots: void timer();
102 #endif