Update Brazilian Portuguese translation
[dasher.git] / Src / Qt / QtDasherScreen.h
blobd249a761e8da884e8909c8057e48f50c9056762c
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 Polygon(point * Points, int Number, int fillColor, int outlineColor, int lineWidth) const;
60 void SetColourScheme(const Dasher::CCustomColours * scheme) {
63 std::vector < int >FontSizes;
64 std::vector < QFont > Fonts;
66 void Display() {
67 painter->end();
68 repaint();
71 void paintEvent(QPaintEvent *) {
72 bitBlt(this, 0, 0, pixmap);
75 void mousePressEvent(QMouseEvent * e);
76 void mouseReleaseEvent(QMouseEvent * e);
78 protected:
79 QColor getColor(int Color, const Opts::ColorSchemes ColorScheme) const;
81 long QtDasherScreen::get_time();
83 CDasherInterface *interface;
84 Dasher::CDashEditbox * edit;
86 bool paused;
88 QPainter *painter;
90 QPixmap *pixmap;
92 std::string fontname;
94 protected slots: void timer();
98 #endif