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
20 #include "DasherScreen.h"
22 #include "DasherInterface.h"
26 using namespace Dasher
;
28 class QtDasherScreen
:public QWidget
, public Dasher::CDasherScreen
{
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
;
71 void paintEvent(QPaintEvent
*) {
72 bitBlt(this, 0, 0, pixmap
);
75 void mousePressEvent(QMouseEvent
* e
);
76 void mouseReleaseEvent(QMouseEvent
* e
);
79 QColor
getColor(int Color
, const Opts::ColorSchemes ColorScheme
) const;
81 long QtDasherScreen::get_time();
83 CDasherInterface
*interface
;
84 Dasher::CDashEditbox
* edit
;
94 protected slots
: void timer();