- extending QT ExtTextOut support

git-svn-id: trunk@11456 -
This commit is contained in:
paul 2007-07-10 08:07:35 +00:00
parent 3862347c8a
commit c73f4c6b4d
2 changed files with 34 additions and 10 deletions

View File

@ -223,6 +223,10 @@ type
procedure DrawText(x,y,w,h,flags: Integer; s:PWideString); overload;
procedure drawLine(x1: Integer; y1: Integer; x2: Integer; y2: Integer);
procedure drawEllipse(x: Integer; y: Integer; w: Integer; h: Integer);
procedure fillRect(ARect: PRect; ABrush: QBrushH); overload;
procedure fillRect(x, y, w, h: Integer; ABrush: QBrushH); overload;
procedure fillRect(x, y, w, h: Integer); overload;
procedure setBrushOrigin(x, y: Integer);
procedure brushOrigin(retval: PPoint);
function font: TQtFont;
@ -1139,6 +1143,21 @@ begin
QPainter_drawEllipse(Widget, x, y, w, h);
end;
procedure TQtDeviceContext.fillRect(ARect: PRect; ABrush: QBrushH);
begin
QPainter_fillRect(Widget, ARect, ABrush);
end;
procedure TQtDeviceContext.fillRect(x, y, w, h: Integer; ABrush: QBrushH);
begin
QPainter_fillRect(Widget, x, y, w, h, ABrush);
end;
procedure TQtDeviceContext.fillRect(x, y, w, h: Integer);
begin
fillRect(x, y, w, h, BackgroundBrush.Widget);
end;
{------------------------------------------------------------------------------
Function: TQtDeviceContext.drawPoint
Params: x1,y1 : Integer

View File

@ -816,6 +816,7 @@ function TQtWidgetSet.ExtTextOut(DC: HDC; X, Y: Integer; Options: Longint;
Rect: PRect; Str: PChar; Count: Longint; Dx: PInteger): Boolean;
var
WideStr: WideString;
QtDC: TQtDeviceContext absolute DC;
begin
{$ifdef VerboseQtWinAPI}
WriteLn('[WinAPI ExtTextOut]');
@ -823,11 +824,21 @@ begin
Result := False;
if ((Options and (ETO_OPAQUE + ETO_CLIPPED)) <> 0) and (Rect = nil) then
exit;
if not IsValidDC(DC) then Exit;
WideStr := UTF8Decode(Str);
if ((Options and ETO_OPAQUE) <> 0) then
QtDC.fillRect(Rect^.Left, Rect^.Top, Rect^.Right - Rect^.Left, Rect^.Bottom - Rect^.Top);
TQtDeviceContext(DC).drawText(X, Y, @WideStr);
if Str <> nil then
begin
WideStr := UTF8Decode(Str);
QtDC.drawText(X, Y, @WideStr);
end;
Result := True;
end;
@ -839,9 +850,6 @@ end;
------------------------------------------------------------------------------}
function TQtWidgetSet.FillRect(DC: HDC; const Rect: TRect; Brush: HBRUSH): Boolean;
var
Painter: QPainterH;
ABrush: QBrushH;
begin
result:=false;
@ -854,11 +862,8 @@ begin
if not IsValidGdiObject(Brush) then
exit;
Painter:= TQTDeviceContext(DC).Widget;
ABrush := TQTBrush(Brush).Widget;
QPainter_FillRect(Painter, @Rect, ABrush);
TQTDeviceContext(DC).fillRect(@Rect, TQTBrush(Brush).Widget);
result := true;
end;