summaryrefslogtreecommitdiff
path: root/inputmethods/dasher/QtDasherScreen.h
Unidiff
Diffstat (limited to 'inputmethods/dasher/QtDasherScreen.h') (more/less context) (ignore whitespace changes)
-rw-r--r--inputmethods/dasher/QtDasherScreen.h117
1 files changed, 117 insertions, 0 deletions
diff --git a/inputmethods/dasher/QtDasherScreen.h b/inputmethods/dasher/QtDasherScreen.h
new file mode 100644
index 0000000..f359113
--- a/dev/null
+++ b/inputmethods/dasher/QtDasherScreen.h
@@ -0,0 +1,117 @@
1// QtDasherScreen.h
2// (c) 2003 Yann Dirson
3// Derived from GtkDasherCanvas.h
4// (c) 2002 Philip Cowans
5
6#ifndef QT_DASHER_SCREEN_H
7#define QT_DASHER_SCREEN_H
8
9#include <string>
10#include <sys/time.h>
11
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>
19
20#include "DasherScreen.h"
21#include "DashEdit.h"
22#include "DasherInterface.h"
23
24#include <iconv.h>
25
26using namespace Dasher;
27
28class QtDasherScreen : public QWidget, public Dasher::CDasherScreen
29
30{
31 Q_OBJECT
32 public:
33 QtDasherScreen (int _width, int _height,
34 CDasherInterface *_interface,
35 QWidget * _parent=0, Dasher::CDashEditbox* edit=0);
36 QtDasherScreen::~QtDasherScreen();
37
38 void SetFont(std::string Name)
39 { fontname = Name; /* set_the_font(); */ }
40
41 void SetFontSize(Dasher::Opts::FontSize fontsize)
42 {
43#warning QtDasherScreen::SetFontSize() not implemented
44 }
45 Dasher::Opts::FontSize GetFontSize()
46 {
47#warning QtDasherScreen::GetFontSize() not implemented
48 return (Dasher::Opts::Normal);
49 }
50
51 void TextSize(symbol Character, int* Width, int* Height, int Size) const
52 {
53 // should probably use QPainter::boundingRect()
54 *Width = *Height = Fonts[Size].pixelSize();
55
56 }
57 void DrawText(symbol Character, int x1, int y1, int Size) const
58 {
59 // QFont font = QFont (fontname.c_str(), Size);
60 // font.setPixelSize(Size);
61 QPoint point = QPoint(x1, y1+Size/2);
62
63 painter->setFont (Fonts[Size]);
64 painter->drawText (point,
65 QString(interface->GetDisplayText(Character).c_str()));
66 }
67
68 void DrawRectangle(int x1, int y1, int x2, int y2,
69 int Color, Opts::ColorSchemes ColorScheme) const;
70 void Polyline(point* Points, int Number) const;
71 void DrawPolygon(point* Points, int Number, int Color,
72 Opts::ColorSchemes ColorScheme) const;
73
74 std::vector<int> FontSizes;
75 std::vector<QFont> Fonts;
76
77 void Blank() const {
78 painter->begin(pixmap);
79 painter->setPen (NoPen);
80 painter->fillRect(0, 0, m_iWidth, m_iHeight,
81 QColor(255,255,255));
82 }
83 void Display() {
84 painter->end();
85 repaint();
86 }
87
88 void paintEvent( QPaintEvent * )
89 {
90 bitBlt(this, 0, 0, pixmap);
91 }
92
93 void mousePressEvent (QMouseEvent *e);
94 void mouseReleaseEvent (QMouseEvent *e);
95
96 protected:
97 QColor getColor(int Color, const Opts::ColorSchemes ColorScheme) const;
98
99 long QtDasherScreen::get_time();
100
101 CDasherInterface* interface;
102 Dasher::CDashEditbox* edit;
103
104 bool paused;
105
106 QPainter* painter;
107
108 QPixmap* pixmap;
109
110 std::string fontname;
111
112 protected slots:
113 void timer();
114
115};
116
117#endif