00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020 #include <qgfx_qws.h>
00021 #include "canvasshapes.h"
00022
00023
00024 CanvasRoundRect::CanvasRoundRect(int x, int y, QCanvas *canvas) :
00025 QCanvasRectangle( x, y, ( qt_screen->deviceWidth() < 200 ) ? 20 : 23, ( qt_screen->deviceWidth() < 200 ) ? 27 : 36, canvas)
00026 {
00027 setZ(0);
00028 show();
00029 }
00030
00031
00032 void CanvasRoundRect::redraw()
00033 {
00034 hide();
00035 show();
00036 }
00037
00038
00039 void CanvasRoundRect::drawShape(QPainter &p)
00040 {
00041 if ( qt_screen->deviceWidth() < 200 )
00042 p.drawRoundRect( (int)x() + 1, (int)y() + 1, 18, 25);
00043 else
00044 p.drawRoundRect( (int)x(), (int)y(), 23, 36);
00045 }
00046
00047
00048 CanvasCircleOrCross::CanvasCircleOrCross(int x, int y, QCanvas *canvas) :
00049 QCanvasRectangle( x, y, 21, 21, canvas), circleShape(TRUE)
00050 {
00051 show();
00052 }
00053
00054
00055 void CanvasCircleOrCross::redraw()
00056 {
00057 hide();
00058 show();
00059 }
00060
00061
00062 void CanvasCircleOrCross::setCircle()
00063 {
00064 circleShape = TRUE;
00065 redraw();
00066 }
00067
00068
00069 void CanvasCircleOrCross::setCross()
00070 {
00071 circleShape = FALSE;
00072 redraw();
00073 }
00074
00075
00076 void CanvasCircleOrCross::drawShape(QPainter &p)
00077 {
00078 if ( qt_screen->deviceWidth() < 200 ) {
00079 int x1 = (int)x(), y1 = (int)y();
00080
00081 if (circleShape == TRUE) {
00082 p.setPen( QPen( QColor(0x10, 0xE0, 0x10), 1 ) );
00083 p.drawEllipse( x1 - 1, y1 - 1, 17, 17);
00084 p.drawEllipse( x1 - 1, y1 - 0, 17, 15);
00085 p.drawEllipse( x1 + 0, y1 + 0, 15, 15);
00086 p.drawEllipse( x1 + 1, y1 + 0, 13, 15);
00087 p.drawEllipse( x1 + 1, y1 + 1, 13, 13);
00088
00089 } else {
00090 p.setPen( QPen( QColor(0xE0, 0x10, 0x10), 4 ) );
00091 p.drawLine( x1, y1, x1 + 14, y1 + 14);
00092 p.drawLine( x1 + 14, y1, x1, y1 + 14);
00093 }
00094 } else {
00095 int x1 = (int)x(), y1 = (int)y();
00096
00097 if (circleShape == TRUE) {
00098 p.setPen( QPen( QColor(0x10, 0xE0, 0x10), 1 ) );
00099 p.drawEllipse( x1 - 1, y1 - 1, 21, 21);
00100 p.drawEllipse( x1 - 1, y1 - 0, 21, 19);
00101 p.drawEllipse( x1 + 0, y1 + 0, 19, 19);
00102 p.drawEllipse( x1 + 1, y1 + 0, 17, 19);
00103 p.drawEllipse( x1 + 1, y1 + 1, 17, 17);
00104
00105 } else {
00106 p.setPen( QPen( QColor(0xE0, 0x10, 0x10), 5 ) );
00107 p.drawLine( x1, y1, x1 + 20, y1 + 20);
00108 p.drawLine( x1 + 20, y1, x1, y1 + 20);
00109 }
00110 }
00111 }
00112