*Fixed TArrow regression, introduced by latest winapi patch.

git-svn-id: trunk@11579 -
This commit is contained in:
zeljko 2007-07-19 18:25:45 +00:00
parent 27a0b1dee3
commit 0daf4ff929

View File

@ -89,98 +89,103 @@ var
APoints: Array [0..2] of TPoint;
ArrowType: Integer;
ARect: TRect;
Brush: QBrushH;
Pen: QPenH;
begin
DC := TQtDeviceContext.Create(TArrow(Arrow).Handle);
// TQtDeviceContext(TCanvas(Canvas).Handle);
DC := TQtDeviceContext(TCanvas(Canvas).Handle);
ARect := TControl(Arrow).ClientRect;
ArrowType := Ord(TArrow(Arrow).ArrowType);
try
case ArrowType of
0:{up}
begin
{$ifdef QT_USE_BIG_TARROW}
APoints[0].X := ARect.Right div 2;
APoints[0].Y := ARect.Bottom div 3;
APoints[1].X := (ARect.Right div 8);
APoints[1].Y := ARect.Bottom - (ARect.Bottom div 3);
APoints[2].X := ARect.Right - (ARect.Right div 8);
APoints[2].Y := ARect.Bottom - (ARect.Bottom div 3);
{$else}
APoints[0].X := ARect.Right div 2;
APoints[0].Y := ARect.Bottom div 4;
APoints[1].X := (ARect.Right div 4);
APoints[1].Y := ARect.Bottom - (ARect.Bottom div 4);
APoints[2].X := ARect.Right - (ARect.Right div 4);
APoints[2].Y := ARect.Bottom - (ARect.Bottom div 4);
{$endif}
end;
1:{down}
begin
{$ifdef QT_USE_BIG_TARROW}
APoints[0].X := ARect.Right div 8;
APoints[0].Y := ARect.Bottom div 3;
APoints[1].X := ARect.Right - (ARect.Right div 8);
APoints[1].Y := (ARect.Bottom div 3);
APoints[2].X := ARect.Right div 2;
APoints[2].Y := ARect.Bottom - (ARect.Bottom div 3);
{$else}
APoints[0].X := ARect.Right div 4;
APoints[0].Y := ARect.Bottom div 4;
APoints[1].X := ARect.Right - (ARect.Right div 4);
APoints[1].Y := (ARect.Bottom div 4);
APoints[2].X := ARect.Right div 2;
APoints[2].Y := ARect.Bottom - (ARect.Bottom div 4);
{$endif}
end;
2:{left}
begin
{$ifdef QT_USE_BIG_TARROW}
APoints[0].X := ARect.Right - (ARect.Right div 3);
APoints[0].Y := ARect.Bottom div 8;
APoints[1].X := ARect.Right - (ARect.Right div 3);
APoints[1].Y := ARect.Bottom - (ARect.Bottom div 8);
APoints[2].X := ARect.Right div 3;
APoints[2].Y := ARect.Bottom div 2;
{$else}
APoints[0].X := ARect.Right - (ARect.Right div 4);
APoints[0].Y := ARect.Bottom div 4;
APoints[1].X := ARect.Right - (ARect.Right div 4);
APoints[1].Y := ARect.Bottom - (ARect.Bottom div 4);
APoints[2].X := (ARect.Right div 4);
APoints[2].Y := ARect.Bottom div 2;
{$endif}
end;
3:{right}
begin
{$ifdef QT_USE_BIG_TARROW}
APoints[0].X := ARect.Right div 3;
APoints[0].Y := ARect.Bottom div 8;
APoints[1].X := ARect.Right div 3;
APoints[1].Y := ARect.Bottom - (ARect.Bottom div 8);
APoints[2].X := ARect.Right - (ARect.Right div 3);
APoints[2].Y := ARect.Bottom div 2;
{$else}
APoints[0].X := ARect.Right div 4;
APoints[0].Y := ARect.Bottom div 4;
APoints[1].X := ARect.Right div 4;
APoints[1].Y := ARect.Bottom - (ARect.Bottom div 4);
APoints[2].X := ARect.Right - (ARect.Right div 4);
APoints[2].Y := ARect.Bottom div 2;
{$endif}
end;
end;
if ArrowType in [0..3] then
case ArrowType of
0:{up}
begin
DC.brush.setStyle(QtSolidPattern);
QPainter_setRenderHint(DC.Widget, QPainterAntialiasing, True);
QPainter_setClipRect(DC.Widget, @ARect);
QPainter_drawPolygon(DC.Widget, @APoints, 3, QtWindingFill);
{$ifdef QT_USE_BIG_TARROW}
APoints[0].X := ARect.Right div 2;
APoints[0].Y := ARect.Bottom div 3;
APoints[1].X := (ARect.Right div 8);
APoints[1].Y := ARect.Bottom - (ARect.Bottom div 3);
APoints[2].X := ARect.Right - (ARect.Right div 8);
APoints[2].Y := ARect.Bottom - (ARect.Bottom div 3);
{$else}
APoints[0].X := ARect.Right div 2;
APoints[0].Y := ARect.Bottom div 4;
APoints[1].X := (ARect.Right div 4);
APoints[1].Y := ARect.Bottom - (ARect.Bottom div 4);
APoints[2].X := ARect.Right - (ARect.Right div 4);
APoints[2].Y := ARect.Bottom - (ARect.Bottom div 4);
{$endif}
end;
1:{down}
begin
{$ifdef QT_USE_BIG_TARROW}
APoints[0].X := ARect.Right div 8;
APoints[0].Y := ARect.Bottom div 3;
APoints[1].X := ARect.Right - (ARect.Right div 8);
APoints[1].Y := (ARect.Bottom div 3);
APoints[2].X := ARect.Right div 2;
APoints[2].Y := ARect.Bottom - (ARect.Bottom div 3);
{$else}
APoints[0].X := ARect.Right div 4;
APoints[0].Y := ARect.Bottom div 4;
APoints[1].X := ARect.Right - (ARect.Right div 4);
APoints[1].Y := (ARect.Bottom div 4);
APoints[2].X := ARect.Right div 2;
APoints[2].Y := ARect.Bottom - (ARect.Bottom div 4);
{$endif}
end;
2:{left}
begin
{$ifdef QT_USE_BIG_TARROW}
APoints[0].X := ARect.Right - (ARect.Right div 3);
APoints[0].Y := ARect.Bottom div 8;
APoints[1].X := ARect.Right - (ARect.Right div 3);
APoints[1].Y := ARect.Bottom - (ARect.Bottom div 8);
APoints[2].X := ARect.Right div 3;
APoints[2].Y := ARect.Bottom div 2;
{$else}
APoints[0].X := ARect.Right - (ARect.Right div 4);
APoints[0].Y := ARect.Bottom div 4;
APoints[1].X := ARect.Right - (ARect.Right div 4);
APoints[1].Y := ARect.Bottom - (ARect.Bottom div 4);
APoints[2].X := (ARect.Right div 4);
APoints[2].Y := ARect.Bottom div 2;
{$endif}
end;
3:{right}
begin
{$ifdef QT_USE_BIG_TARROW}
APoints[0].X := ARect.Right div 3;
APoints[0].Y := ARect.Bottom div 8;
APoints[1].X := ARect.Right div 3;
APoints[1].Y := ARect.Bottom - (ARect.Bottom div 8);
APoints[2].X := ARect.Right - (ARect.Right div 3);
APoints[2].Y := ARect.Bottom div 2;
{$else}
APoints[0].X := ARect.Right div 4;
APoints[0].Y := ARect.Bottom div 4;
APoints[1].X := ARect.Right div 4;
APoints[1].Y := ARect.Bottom - (ARect.Bottom div 4);
APoints[2].X := ARect.Right - (ARect.Right div 4);
APoints[2].Y := ARect.Bottom div 2;
{$endif}
end;
end;
if ArrowType in [0..3] then
begin
Brush := QBrush_create(QtBlack, QtSolidPattern);
Pen := QPen_create(Brush, 1);
try
QPainter_setBrush(DC.Widget, Brush);
QPainter_setPen(DC.Widget, Pen);
QPainter_setRenderHint(DC.Widget, QPainterAntialiasing, True);
QPainter_drawPolygon(DC.Widget, @APoints, 3, QtWindingFill);
finally
QPen_destroy(Pen);
QBrush_destroy(Brush);
end;
finally
DC.Free;
end;
end;