mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-08-14 06:39:12 +02:00
MG: added GetDCOffset
git-svn-id: trunk@911 -
This commit is contained in:
parent
37205ef5c5
commit
12d3cf70cb
@ -29,7 +29,7 @@
|
|||||||
{------------------------------------------------------------------------------
|
{------------------------------------------------------------------------------
|
||||||
function WidgetIsDestroyingHandle(Widget: PGtkWidget): boolean;
|
function WidgetIsDestroyingHandle(Widget: PGtkWidget): boolean;
|
||||||
|
|
||||||
Tets if Destruction Mark is set.
|
Tests if Destruction Mark is set.
|
||||||
------------------------------------------------------------------------------}
|
------------------------------------------------------------------------------}
|
||||||
function WidgetIsDestroyingHandle(Widget: PGtkWidget): boolean;
|
function WidgetIsDestroyingHandle(Widget: PGtkWidget): boolean;
|
||||||
begin
|
begin
|
||||||
@ -141,7 +141,6 @@ begin
|
|||||||
Result:=-1;
|
Result:=-1;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
|
||||||
{------------------------------------------------------------------------------
|
{------------------------------------------------------------------------------
|
||||||
function GtkWidgetIsA(Widget: PGtkWidget; AType: TGtkType): boolean;
|
function GtkWidgetIsA(Widget: PGtkWidget; AType: TGtkType): boolean;
|
||||||
|
|
||||||
@ -157,6 +156,27 @@ begin
|
|||||||
AType);
|
AType);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
{------------------------------------------------------------------------------
|
||||||
|
function GetDCOffset(DC: PDeviceContext): TPoint;
|
||||||
|
|
||||||
|
Returns the DC offset for the DC Origin.
|
||||||
|
------------------------------------------------------------------------------}
|
||||||
|
function GetDCOffset(DC: PDeviceContext): TPoint;
|
||||||
|
begin
|
||||||
|
if (DC<>nil) then begin
|
||||||
|
Result:=DC^.Origin;
|
||||||
|
if (DC^.SpecialOrigin) and (DC^.hWnd<>0) then begin
|
||||||
|
if GtkWidgetIsA(PGtkWidget(DC^.hWnd),GTK_LAYOUT_GET_TYPE) then begin
|
||||||
|
// ToDo: add code to offset scrolled left, top
|
||||||
|
|
||||||
|
end;
|
||||||
|
end;
|
||||||
|
end else begin
|
||||||
|
Result.X:=0;
|
||||||
|
Result.Y:=0;
|
||||||
|
end;
|
||||||
|
end;
|
||||||
|
|
||||||
{------------------------------------------------------------------------------
|
{------------------------------------------------------------------------------
|
||||||
Function: NewGDIRawImage
|
Function: NewGDIRawImage
|
||||||
Params: Width, Height: Size of the image
|
Params: Width, Height: Size of the image
|
||||||
@ -225,6 +245,7 @@ begin
|
|||||||
GC := gdk_gc_new_with_values(Drawable, @GCValues, 3 { $3FF});
|
GC := gdk_gc_new_with_values(Drawable, @GCValues, 3 { $3FF});
|
||||||
end;
|
end;
|
||||||
Origin := SourceDC^.Origin;
|
Origin := SourceDC^.Origin;
|
||||||
|
SpecialOrigin := SourceDC^.SpecialOrigin;
|
||||||
PenPos := SourceDC^.PenPos;
|
PenPos := SourceDC^.PenPos;
|
||||||
CurrentBitmap := SourceDC^.CurrentBitmap;
|
CurrentBitmap := SourceDC^.CurrentBitmap;
|
||||||
CurrentFont := SourceDC^.CurrentFont;
|
CurrentFont := SourceDC^.CurrentFont;
|
||||||
@ -248,6 +269,7 @@ end;
|
|||||||
Procedure SelectGDIRegion(const DC: HDC);
|
Procedure SelectGDIRegion(const DC: HDC);
|
||||||
var
|
var
|
||||||
Region: PGdiObject;
|
Region: PGdiObject;
|
||||||
|
DCOrigin: TPoint;
|
||||||
begin
|
begin
|
||||||
with PDeviceContext(DC)^ do
|
with PDeviceContext(DC)^ do
|
||||||
begin
|
begin
|
||||||
@ -255,11 +277,12 @@ begin
|
|||||||
gdk_gc_set_clip_rectangle (gc, nil);
|
gdk_gc_set_clip_rectangle (gc, nil);
|
||||||
If ClipRegion <> 0 then begin
|
If ClipRegion <> 0 then begin
|
||||||
Region:=PGDIObject(ClipRegion);
|
Region:=PGDIObject(ClipRegion);
|
||||||
if (Origin.X<>0) or (Origin.X<>0) then
|
DCOrigin:=GetDCOffset(PDeviceContext(DC));
|
||||||
gdk_region_offset(Region^.GDIRegionObject,Origin.X,Origin.Y);
|
if (DCOrigin.X<>0) or (DCOrigin.X<>0) then
|
||||||
|
gdk_region_offset(Region^.GDIRegionObject,DCOrigin.X,DCOrigin.Y);
|
||||||
gdk_gc_set_clip_region(gc, PGDIObject(ClipRegion)^.GDIRegionObject);
|
gdk_gc_set_clip_region(gc, PGDIObject(ClipRegion)^.GDIRegionObject);
|
||||||
if (Origin.X<>0) or (Origin.X<>0) then
|
if (DCOrigin.X<>0) or (DCOrigin.X<>0) then
|
||||||
gdk_region_offset(Region^.GDIRegionObject,-Origin.X,-Origin.Y);
|
gdk_region_offset(Region^.GDIRegionObject,-DCOrigin.X,-DCOrigin.Y);
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
@ -2734,6 +2757,9 @@ end;
|
|||||||
{ =============================================================================
|
{ =============================================================================
|
||||||
|
|
||||||
$Log$
|
$Log$
|
||||||
|
Revision 1.90 2002/09/06 16:38:25 lazarus
|
||||||
|
MG: added GetDCOffset
|
||||||
|
|
||||||
Revision 1.89 2002/09/06 15:57:36 lazarus
|
Revision 1.89 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
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user