MG: added GetDCOffset

git-svn-id: trunk@1878 -
This commit is contained in:
lazarus 2002-08-17 23:39:30 +00:00
parent d014f48d44
commit 037d82dbfb

View File

@ -58,6 +58,8 @@ const
------------------------------------------------------------------------------} ------------------------------------------------------------------------------}
function TgtkObject.Arc(DC: HDC; function TgtkObject.Arc(DC: HDC;
x,y,width,height,angle1,angle2 : Integer): Boolean; x,y,width,height,angle1,angle2 : Integer): Boolean;
var
DCOrigin: TPoint;
begin begin
Result := IsValidDC(DC); Result := IsValidDC(DC);
if Result if Result
@ -71,8 +73,9 @@ begin
else begin else begin
// Draw outline // Draw outline
SelectGDKPenProps(DC); SelectGDKPenProps(DC);
inc(X,Origin.X); DCOrigin:=GetDCOffset(PDeviceContext(DC));
inc(Y,Origin.Y); inc(X,DCOrigin.X);
inc(Y,DCOrigin.Y);
gdk_draw_arc(Drawable, GC, 0, X, Y, Width, Height, gdk_draw_arc(Drawable, GC, 0, X, Y, Width, Height,
Angle1 shl 2, Angle2 shl 2); Angle1 shl 2, Angle2 shl 2);
Result := True; Result := True;
@ -1736,6 +1739,7 @@ var
Shadow: TGtkShadowType; Shadow: TGtkShadowType;
aStyle : PGTKStyle; aStyle : PGTKStyle;
pDC: PDeviceContext; pDC: PDeviceContext;
DCOrigin: TPoint;
begin begin
if Widget<>nil then begin if Widget<>nil then begin
@ -1788,6 +1792,7 @@ var
State := GTK_STATE_ACTIVE; State := GTK_STATE_ACTIVE;
pDC:=PDeviceContext(DC); pDC:=PDeviceContext(DC);
DCOrigin:=GetDCOffset(pDC);
Case Shadow of Case Shadow of
GTK_SHADOW_NONE: GTK_SHADOW_NONE:
@ -1797,7 +1802,7 @@ var
nil, nil,
Widget, Widget,
'button', 'button',
Rect.Left+pDC^.Origin.X,Rect.Top+pDC^.Origin.Y, Rect.Left+DCOrigin.X,Rect.Top+DCOrigin.Y,
Rect.Right-Rect.Left,Rect.Bottom-Rect.Top); Rect.Right-Rect.Left,Rect.Bottom-Rect.Top);
else else
gtk_paint_box(aStyle,Widget^.Window, gtk_paint_box(aStyle,Widget^.Window,
@ -1806,7 +1811,7 @@ var
nil, nil,
Widget, Widget,
'button', 'button',
Rect.Left+pDC^.Origin.X,Rect.Top+pDC^.Origin.Y, Rect.Left+DCOrigin.X,Rect.Top+DCOrigin.Y,
Rect.Right-Rect.Left,Rect.Bottom-Rect.Top); Rect.Right-Rect.Left,Rect.Bottom-Rect.Top);
end; end;
@ -1912,6 +1917,7 @@ Var
BInner, BOuter: Boolean; BInner, BOuter: Boolean;
Width, Height: Integer; Width, Height: Integer;
R: TRect; R: TRect;
DCOrigin: TPoint;
begin begin
Assert(False, Format('trace:> [TgtkObject.DrawEdge] DC:0x%x, Rect = %d,%d,%d,%d', [DC, Rect.Left, Rect.Top,Rect.Right, Rect.Bottom])); Assert(False, Format('trace:> [TgtkObject.DrawEdge] DC:0x%x, Rect = %d,%d,%d,%d', [DC, Rect.Left, Rect.Top,Rect.Right, Rect.Bottom]));
Result := IsValidDC(DC); Result := IsValidDC(DC);
@ -2017,7 +2023,8 @@ begin
Width := R.Right - R.Left + 1; Width := R.Right - R.Left + 1;
Height := R.Bottom - R.Top + 1; Height := R.Bottom - R.Top + 1;
SelectGDKBrushProps(DC); SelectGDKBrushProps(DC);
gdk_draw_rectangle(Drawable, GC, 1, R.Left+Origin.X, R.Top+Origin.Y, DCOrigin:=GetDCOffset(PDeviceContext(DC));
gdk_draw_rectangle(Drawable, GC, 1, R.Left+DCOrigin.X, R.Top+DCOrigin.Y,
Width, Height); Width, Height);
end; end;
@ -2124,7 +2131,9 @@ end;
------------------------------------------------------------------------------} ------------------------------------------------------------------------------}
function TgtkObject.Ellipse(DC: HDC; function TgtkObject.Ellipse(DC: HDC;
x1,y1,x2,y2: Integer): Boolean; x1,y1,x2,y2: Integer): Boolean;
var x,y,width,height: integer; var
x,y,width,height: integer;
DCOrigin: TPoint;
begin begin
Result := IsValidDC(DC); Result := IsValidDC(DC);
if Result if Result
@ -2146,11 +2155,12 @@ begin
height:=height shr 1; height:=height shr 1;
// first draw interior in brush color // first draw interior in brush color
SelectGDKBrushProps(DC); SelectGDKBrushProps(DC);
gdk_draw_arc(Drawable, GC, 1, x+Origin.X, y+Origin.Y, Width, Height, DCOrigin:=GetDCOffset(PDeviceContext(DC));
gdk_draw_arc(Drawable, GC, 1, x+DCOrigin.X, y+DCOrigin.Y, Width, Height,
0, 360 shl 6); 0, 360 shl 6);
// Draw outline // Draw outline
SelectGDKPenProps(DC); SelectGDKPenProps(DC);
gdk_draw_arc(Drawable, GC, 0, x+Origin.X, y+Origin.Y, Width, Height, gdk_draw_arc(Drawable, GC, 0, x+DCOrigin.X, y+DCOrigin.Y, Width, Height,
0, 360 shl 6); 0, 360 shl 6);
Result := True; Result := True;
end; end;
@ -2210,6 +2220,7 @@ var
//ADC : hDC; //ADC : hDC;
UseFont : PGDKFont; UseFont : PGDKFont;
UnRef : Boolean; UnRef : Boolean;
DCOrigin: TPoint;
begin begin
Assert(False, Format('trace:> [TgtkObject.ExtTextOut] DC:0x%x, X:%d, Y:%d, Options:%d, Str:''%s'', Count: %d', [DC, X, Y, Options, Str, Count])); Assert(False, Format('trace:> [TgtkObject.ExtTextOut] DC:0x%x, X:%d, Y:%d, Options:%d, Str:''%s'', Count: %d', [DC, X, Y, Options, Str, Count]));
Result := IsValidDC(DC); Result := IsValidDC(DC);
@ -2238,6 +2249,7 @@ begin
else begin else begin
// TODO: implement other parameters. // TODO: implement other parameters.
//ADC := SaveDC(DC); //ADC := SaveDC(DC);
DCOrigin:=GetDCOffset(PDeviceContext(DC));
if (Options and ETO_OPAQUE) <> 0 then if (Options and ETO_OPAQUE) <> 0 then
begin begin
Width := Rect^.Right - Rect^.Left; Width := Rect^.Right - Rect^.Left;
@ -2245,7 +2257,7 @@ begin
gdk_gc_set_fill(GC, GDK_SOLID); gdk_gc_set_fill(GC, GDK_SOLID);
gdk_gc_set_foreground(GC, @CurrentBackColor); gdk_gc_set_foreground(GC, @CurrentBackColor);
gdk_draw_rectangle(Drawable, GC, 1, gdk_draw_rectangle(Drawable, GC, 1,
Rect^.Left+Origin.X, Rect^.Top+Origin.Y, Rect^.Left+DCOrigin.X, Rect^.Top+DCOrigin.Y,
Width, Height); Width, Height);
end; end;
if (Options and ETO_CLIPPED) <> 0 then if (Options and ETO_CLIPPED) <> 0 then
@ -2268,7 +2280,7 @@ begin
if Num < 0 then begin if Num < 0 then begin
if Count> 0 then if Count> 0 then
gdk_draw_text(Drawable, UseFont, GC, gdk_draw_text(Drawable, UseFont, GC,
TxtPt.X+Origin.X, TxtPt.Y+Origin.Y, Str, Count); TxtPt.X+DCOrigin.X, TxtPt.Y+DCOrigin.Y, Str, Count);
end else end else
Begin //write multiple lines Begin //write multiple lines
LineStart:=Str; LineStart:=Str;
@ -2277,7 +2289,7 @@ begin
LineEnd:=LineStart+Num; LineEnd:=LineStart+Num;
if Num>0 then if Num>0 then
gdk_draw_text(Drawable, UseFont, GC, gdk_draw_text(Drawable, UseFont, GC,
TxtPt.X+Origin.X, TxtPt.Y+Origin.Y, LineStart, Num); TxtPt.X+DCOrigin.X, TxtPt.Y+DCOrigin.Y, LineStart, Num);
AY := TxtPt.Y; AY := TxtPt.Y;
{$IfDef Win32} {$IfDef Win32}
TxtPt.Y := AY + TM.tmHeight div 2; TxtPt.Y := AY + TM.tmHeight div 2;
@ -2315,6 +2327,7 @@ function TgtkObject.FillRect(DC: HDC; const Rect: TRect; Brush: HBRUSH): Boolean
var var
Width, Height: Integer; Width, Height: Integer;
OldCurrentBrush: PGdiObject; OldCurrentBrush: PGdiObject;
DCOrigin: TPoint;
begin begin
Assert(False, Format('trace:> [TgtkObject.FillRect] DC:0x%x; Rect: ((%d,%d)(%d,%d)); brush: %x', [Integer(DC), Rect.left, rect.top, rect.right, rect.bottom, brush])); Assert(False, Format('trace:> [TgtkObject.FillRect] DC:0x%x; Rect: ((%d,%d)(%d,%d)); brush: %x', [Integer(DC), Rect.left, rect.top, rect.right, rect.bottom, brush]));
Result := IsValidDC(DC) and IsValidGDIObject(Brush); Result := IsValidDC(DC) and IsValidGDIObject(Brush);
@ -2334,7 +2347,9 @@ begin
OldCurrentBrush := CurrentBrush; OldCurrentBrush := CurrentBrush;
CurrentBrush := PGdiObject(Brush); CurrentBrush := PGdiObject(Brush);
SelectGDKBrushProps(DC); SelectGDKBrushProps(DC);
gdk_draw_rectangle(Drawable, GC, 1, Rect.Left+Origin.X, Rect.Top+Origin.Y, DCOrigin:=GetDCOffset(PDeviceContext(DC));
gdk_draw_rectangle(Drawable, GC, 1,
Rect.Left+DCOrigin.X, Rect.Top+DCOrigin.Y,
Width, Height); Width, Height);
// Restore current brush // Restore current brush
CurrentBrush := OldCurrentBrush; CurrentBrush := OldCurrentBrush;
@ -2358,8 +2373,10 @@ function TGtkObject.Frame3d(DC : HDC; var Rect : TRect;
const GTKShadowType: array[TBevelCut] of integer = const GTKShadowType: array[TBevelCut] of integer =
(GTK_SHADOW_NONE, GTK_SHADOW_IN, GTK_SHADOW_OUT); (GTK_SHADOW_NONE, GTK_SHADOW_IN, GTK_SHADOW_OUT);
var Widget, ClientWidget: PGtkWidget; var
i : integer; Widget, ClientWidget: PGtkWidget;
i : integer;
DCOrigin: TPoint;
begin begin
Result := IsValidDC(DC); Result := IsValidDC(DC);
if Result then if Result then
@ -2373,11 +2390,12 @@ begin
ClientWidget:=GetFixedWidget(Widget); ClientWidget:=GetFixedWidget(Widget);
if ClientWidget=nil then if ClientWidget=nil then
ClientWidget:=Widget; ClientWidget:=Widget;
DCOrigin:=GetDCOffset(PDeviceContext(DC));
for i:= 1 to FrameWidth do begin for i:= 1 to FrameWidth do begin
gtk_draw_shadow(ClientWidget^.thestyle, gtk_draw_shadow(ClientWidget^.thestyle,
ClientWidget^.window, GTK_STATE_NORMAL, ClientWidget^.window, GTK_STATE_NORMAL,
GtkShadowType[Style], GtkShadowType[Style],
Rect.Left+Origin.X, Rect.Top+Origin.Y, Rect.Left+DCOrigin.X, Rect.Top+DCOrigin.Y,
Rect.Right - Rect.Left-1, Rect.Bottom - Rect.Top-1); Rect.Right - Rect.Left-1, Rect.Bottom - Rect.Top-1);
InflateRect(Rect, -1, -1); InflateRect(Rect, -1, -1);
end; end;
@ -2569,6 +2587,7 @@ Function TGTKObject.GetClipBox(DC : hDC; lpRect : PRect) : Longint;
var var
CRect : TGDKRectangle; CRect : TGDKRectangle;
X, Y : Longint; X, Y : Longint;
DCOrigin: Tpoint;
begin begin
If not IsValidDC(DC) then If not IsValidDC(DC) then
Result := ERROR; Result := ERROR;
@ -2577,9 +2596,10 @@ begin
if Result <> ERROR if Result <> ERROR
then with PDeviceContext(DC)^ do then with PDeviceContext(DC)^ do
begin begin
DCOrigin:=GetDCOffset(PDeviceContext(DC));
If Not IsValidGDIObject(ClipRegion) then begin If Not IsValidGDIObject(ClipRegion) then begin
gdk_window_get_size(Drawable, @X, @Y); gdk_window_get_size(Drawable, @X, @Y);
lpRect^ := Rect(-Origin.X, -Origin.Y, X, Y); lpRect^ := Rect(-DCOrigin.X, -DCOrigin.Y, X, Y);
Result := SIMPLEREGION; Result := SIMPLEREGION;
end end
else begin else begin
@ -2587,8 +2607,8 @@ begin
gdk_region_get_clipbox(PGDIObject(ClipRegion)^.GDIRegionObject, gdk_region_get_clipbox(PGDIObject(ClipRegion)^.GDIRegionObject,
@CRect); @CRect);
With lpRect^,CRect do begin With lpRect^,CRect do begin
Left := X-Origin.X; Left := X-DCOrigin.X;
Top := Y-Origin.Y; Top := Y-DCOrigin.Y;
Right := Left + Width; Right := Left + Width;
Bottom := Top + Height; Bottom := Top + Height;
end; end;
@ -3584,6 +3604,8 @@ end;
specified device context. specified device context.
------------------------------------------------------------------------------} ------------------------------------------------------------------------------}
function TgtkObject.GetWindowOrgEx(dc : hdc; var P : TPoint): Integer; function TgtkObject.GetWindowOrgEx(dc : hdc; var P : TPoint): Integer;
var
DCOrigin: TPoint;
begin begin
// gdk_window_get_deskrelative_origin(pgtkwidget(PdeviceContext(dc)^.hwnd)^.window, @P.X, @P.Y); // gdk_window_get_deskrelative_origin(pgtkwidget(PdeviceContext(dc)^.hwnd)^.window, @P.X, @P.Y);
//write('[TgtkObject.GetWindowOrgEx] ',p.x,' ',p.y); //write('[TgtkObject.GetWindowOrgEx] ',p.x,' ',p.y);
@ -3594,10 +3616,11 @@ begin
// ToDo: fix this, when Designer is ready // ToDo: fix this, when Designer is ready
If IsValidDC(DC) then If IsValidDC(DC) then
with PDeviceContext(DC)^ do begin with PDeviceContext(DC)^ do begin
DCOrigin:=GetDCOffset(PDeviceContext(DC));
if Drawable<>nil then begin if Drawable<>nil then begin
gdk_window_get_origin(PGdkWindow(Drawable), @P.X, @P.Y); gdk_window_get_origin(PGdkWindow(Drawable), @P.X, @P.Y);
inc(P.X,Origin.X); inc(P.X,DCOrigin.X);
inc(P.Y,Origin.Y); inc(P.Y,DCOrigin.Y);
Result := 1; Result := 1;
end else begin end else begin
writeln('TgtkObject.GetWindowOrgEx:', writeln('TgtkObject.GetWindowOrgEx:',
@ -3803,6 +3826,8 @@ end;
------------------------------------------------------------------------------} ------------------------------------------------------------------------------}
function TgtkObject.LineTo(DC: HDC; X, Y: Integer): Boolean; function TgtkObject.LineTo(DC: HDC; X, Y: Integer): Boolean;
var
DCOrigin: TPoint;
begin begin
Assert(False, Format('trace:> [TgtkObject.LineTo] DC:0x%x, X:%d, Y:%d', [DC, X, Y])); Assert(False, Format('trace:> [TgtkObject.LineTo] DC:0x%x, X:%d, Y:%d', [DC, X, Y]));
Result := IsValidDC(DC); Result := IsValidDC(DC);
@ -3815,9 +3840,10 @@ begin
Result := False; Result := False;
end end
else begin else begin
DCOrigin:=GetDCOffset(PDeviceContext(DC));
SelectGDKPenProps(DC); SelectGDKPenProps(DC);
gdk_draw_line(Drawable, GC, PenPos.X+Origin.X, PenPos.Y+Origin.Y, gdk_draw_line(Drawable, GC, PenPos.X+DCOrigin.X, PenPos.Y+DCOrigin.Y,
X+Origin.X, Y+Origin.Y); X+DCOrigin.X, Y+DCOrigin.Y);
PenPos:= Point(X, Y); PenPos:= Point(X, Y);
Result := True; Result := True;
end; end;
@ -4127,6 +4153,7 @@ var
PointArray: PGDKPoint; PointArray: PGDKPoint;
Tmp, RGN : hRGN; Tmp, RGN : hRGN;
ClipRect : TRect; ClipRect : TRect;
DCOrigin: Tpoint;
begin begin
Result := IsValidDC(DC); Result := IsValidDC(DC);
if Result if Result
@ -4138,11 +4165,12 @@ begin
Result := False; Result := False;
end end
else begin else begin
DCOrigin:=GetDCOffset(PDeviceContext(DC));
if NumPts<=0 then exit; if NumPts<=0 then exit;
GetMem(PointArray,SizeOf(TGdkPoint)*NumPts); GetMem(PointArray,SizeOf(TGdkPoint)*NumPts);
for i:=0 to NumPts-1 do begin for i:=0 to NumPts-1 do begin
PointArray[i].x:=Points[i].x+Origin.X; PointArray[i].x:=Points[i].x+DCOrigin.X;
PointArray[i].y:=Points[i].y+Origin.Y; PointArray[i].y:=Points[i].y+DCOrigin.Y;
end; end;
If (Points[NumPts-1].X <> Points[0].X) or If (Points[NumPts-1].X <> Points[0].X) or
@ -4150,8 +4178,8 @@ begin
then begin then begin
Inc(NumPts); Inc(NumPts);
ReallocMem(PointArray,SizeOf(TGdkPoint)*NumPts); ReallocMem(PointArray,SizeOf(TGdkPoint)*NumPts);
PointArray[NumPts - 1].x:=Points[0].x+Origin.X; PointArray[NumPts - 1].x:=Points[0].x+DCOrigin.X;
PointArray[NumPts - 1].y:=Points[0].y+Origin.Y; PointArray[NumPts - 1].y:=Points[0].y+DCOrigin.Y;
end; end;
// first draw interior in brush color // first draw interior in brush color
@ -4185,6 +4213,7 @@ end;
function TgtkObject.Polyline(DC: HDC; Points: PPoint; NumPts: Integer): boolean; function TgtkObject.Polyline(DC: HDC; Points: PPoint; NumPts: Integer): boolean;
var i: integer; var i: integer;
PointArray: PGDKPoint; PointArray: PGDKPoint;
DCOrigin: TPoint;
begin begin
Result := IsValidDC(DC); Result := IsValidDC(DC);
if Result if Result
@ -4197,10 +4226,11 @@ begin
end end
else begin else begin
if NumPts<=0 then exit; if NumPts<=0 then exit;
DCOrigin:=GetDCOffset(PDeviceContext(DC));
GetMem(PointArray,SizeOf(TGdkPoint)*NumPts); GetMem(PointArray,SizeOf(TGdkPoint)*NumPts);
for i:=0 to NumPts-1 do begin for i:=0 to NumPts-1 do begin
PointArray[i].x:=Points[i].x+Origin.X; PointArray[i].x:=Points[i].x+DCOrigin.X;
PointArray[i].y:=Points[i].y+Origin.Y; PointArray[i].y:=Points[i].y+DCOrigin.Y;
end; end;
// draw outline // draw outline
@ -4423,6 +4453,7 @@ end;
function TgtkObject.Rectangle(DC: HDC; X1, Y1, X2, Y2: Integer): Boolean; function TgtkObject.Rectangle(DC: HDC; X1, Y1, X2, Y2: Integer): Boolean;
var var
Width, Height: Integer; Width, Height: Integer;
DCOrigin: TPoint;
begin begin
Assert(False, Format('trace:> [TgtkObject.Rectangle] DC:0x%x, X1:%d, Y1:%d, X2:%d, Y2:%d', [DC, X1, Y1, X2, Y2])); Assert(False, Format('trace:> [TgtkObject.Rectangle] DC:0x%x, X1:%d, Y1:%d, X2:%d, Y2:%d', [DC, X1, Y1, X2, Y2]));
Result := IsValidDC(DC); Result := IsValidDC(DC);
@ -4439,12 +4470,13 @@ begin
Height := Y2 - Y1; Height := Y2 - Y1;
// first draw interior in brush color // first draw interior in brush color
SelectGDKBrushProps(DC); SelectGDKBrushProps(DC);
gdk_draw_rectangle(Drawable, GC, 1, X1+Origin.X, Y1+Origin.Y, DCOrigin:=GetDCOffset(PDeviceContext(DC));
gdk_draw_rectangle(Drawable, GC, 1, X1+DCOrigin.X, Y1+DCOrigin.Y,
Width, Height); Width, Height);
// Draw outline // Draw outline
SelectGDKPenProps(DC); SelectGDKPenProps(DC);
gdk_draw_rectangle(Drawable, GC, 0, X1+Origin.X, Y1+Origin.Y, gdk_draw_rectangle(Drawable, GC, 0, X1+DCOrigin.X, Y1+DCOrigin.Y,
Width, Height); Width, Height);
Result := True; Result := True;
end; end;
@ -6021,18 +6053,21 @@ const // FROM TO
(@DrawableToNoDrawable, @DrawableToDrawable) (@DrawableToNoDrawable, @DrawableToDrawable)
); );
var DCOrigin: TPoint;
begin begin
Assert(True, Format('trace:> [TgtkObject.StretchBlt] DestDC:0x%x; X:%d, Y:%d, Width:%d, Height:%d; SrcDC:0x%x; XSrc:%d, YSrc:%d, SrcWidth:%d, SrcHeight:%d; Rop:0x%x', [DestDC, X, Y, Width, Height, SrcDC, XSrc, YSrc, SrcWidth, SrcHeight, Rop])); Assert(True, Format('trace:> [TgtkObject.StretchBlt] DestDC:0x%x; X:%d, Y:%d, Width:%d, Height:%d; SrcDC:0x%x; XSrc:%d, YSrc:%d, SrcWidth:%d, SrcHeight:%d; Rop:0x%x', [DestDC, X, Y, Width, Height, SrcDC, XSrc, YSrc, SrcWidth, SrcHeight, Rop]));
Result := IsValidDC(DestDC) and IsValidDC(SrcDC); Result := IsValidDC(DestDC) and IsValidDC(SrcDC);
if Result if Result
then begin then begin
with PDeviceContext(DestDC)^ do begin with PDeviceContext(DestDC)^ do begin
Inc(X,Origin.X); DCOrigin:=GetDCOffset(PDeviceContext(DestDC));
Inc(Y,Origin.Y); Inc(X,DCOrigin.X);
Inc(Y,DCOrigin.Y);
end; end;
with PDeviceContext(SrcDC)^ do begin with PDeviceContext(SrcDC)^ do begin
Inc(XSrc,Origin.X); DCOrigin:=GetDCOffset(PDeviceContext(SrcDC));
Inc(YSrc,Origin.Y); Inc(XSrc,DCOrigin.X);
Inc(YSrc,DCOrigin.Y);
end; end;
//writeln('TgtkObject.StretchBlt X=',X,' Y=',Y,' Width=',Width,' Height=',Height, //writeln('TgtkObject.StretchBlt X=',X,' Y=',Y,' Width=',Width,' Height=',Height,
@ -6099,6 +6134,7 @@ var
TM : TTextMetric; TM : TTextMetric;
UseFont : PGDKFont; UseFont : PGDKFont;
UnRef : Boolean; UnRef : Boolean;
DCOrigin: TPoint;
begin begin
Result := IsValidDC(DC); Result := IsValidDC(DC);
if Result if Result
@ -6121,8 +6157,9 @@ begin
If UseFont = nil then If UseFont = nil then
WriteLn('WARNING: [TgtkObject.TextOut] Missing Font') WriteLn('WARNING: [TgtkObject.TextOut] Missing Font')
else begin else begin
DCOrigin:=GetDCOffset(PDeviceContext(DC));
GetTextExtentPoint(DC, Str, Count, Sz); GetTextExtentPoint(DC, Str, Count, Sz);
aRect := Rect(X+Origin.X,Y+Origin.Y,X + Sz.CX, Sz.CY); aRect := Rect(X+DCOrigin.X,Y+DCOrigin.Y,X + Sz.CX, Sz.CY);
FillRect(DC,aRect,hBrush(CurrentBrush)); FillRect(DC,aRect,hBrush(CurrentBrush));
GetTextMetrics(DC, TM); GetTextMetrics(DC, TM);
TxtPt.X := X; TxtPt.X := X;
@ -6133,7 +6170,7 @@ begin
{$EndIf} {$EndIf}
SelectGDKTextProps(DC); SelectGDKTextProps(DC);
gdk_draw_text(Drawable, UseFont, gdk_draw_text(Drawable, UseFont,
GC, TxtPt.X+Origin.X, TxtPt.Y+Origin.Y, Str, Count); GC, TxtPt.X+DCOrigin.X, TxtPt.Y+DCOrigin.Y, Str, Count);
Result := True; Result := True;
If UnRef then If UnRef then
GDK_Font_UnRef(UseFont); GDK_Font_UnRef(UseFont);
@ -6323,6 +6360,9 @@ end;
{ ============================================================================= { =============================================================================
$Log$ $Log$
Revision 1.122 2002/09/06 16:38:25 lazarus
MG: added GetDCOffset
Revision 1.121 2002/09/06 15:57:36 lazarus Revision 1.121 2002/09/06 15:57:36 lazarus
MG: fixed notebook client area, send messages and minor bugs MG: fixed notebook client area, send messages and minor bugs