mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-12-12 20:40:31 +01:00
cocoa: basic implementation of PaintTo for CocoaWS. bug #36092
git-svn-id: trunk@63330 -
This commit is contained in:
parent
77e76e66b8
commit
4fc42c5a77
@ -139,6 +139,7 @@ type
|
|||||||
class procedure SetChildZPosition(const AWinControl, AChild: TWinControl; const AOldPos, ANewPos: Integer; const AChildren: TFPList); override;
|
class procedure SetChildZPosition(const AWinControl, AChild: TWinControl; const AOldPos, ANewPos: Integer; const AChildren: TFPList); override;
|
||||||
class procedure ShowHide(const AWinControl: TWinControl); override;
|
class procedure ShowHide(const AWinControl: TWinControl); override;
|
||||||
class procedure Invalidate(const AWinControl: TWinControl); override;
|
class procedure Invalidate(const AWinControl: TWinControl); override;
|
||||||
|
class procedure PaintTo(const AWinControl: TWinControl; ADC: HDC; X, Y: Integer); override;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
{ TCocoaWSCustomControl }
|
{ TCocoaWSCustomControl }
|
||||||
@ -1850,6 +1851,31 @@ begin
|
|||||||
NSObject(AWinControl.Handle).lclInvalidate;
|
NSObject(AWinControl.Handle).lclInvalidate;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
class procedure TCocoaWSWinControl.PaintTo(const AWinControl: TWinControl;
|
||||||
|
ADC: HDC; X, Y: Integer);
|
||||||
|
var
|
||||||
|
bc : TCocoaBitmapContext;
|
||||||
|
v : NSView;
|
||||||
|
b : NSBitmapImageRep;
|
||||||
|
obj : NSObject;
|
||||||
|
f : NSRect;
|
||||||
|
begin
|
||||||
|
if not (TObject(ADC) is TCocoaBitmapContext) then Exit;
|
||||||
|
if not NSObject(AWinControl.Handle).isKindOfClass(NSView) then Exit;
|
||||||
|
bc := TCocoaBitmapContext(ADC);
|
||||||
|
v := NSView(AWinControl.Handle);
|
||||||
|
f := v.frame;
|
||||||
|
f.origin.x := 0;
|
||||||
|
f.origin.y := 0;
|
||||||
|
|
||||||
|
b := v.bitmapImageRepForCachingDisplayInRect(f);
|
||||||
|
|
||||||
|
v.cacheDisplayInRect_toBitmapImageRep(f, b);
|
||||||
|
bc.DrawImageRep(
|
||||||
|
NSMakeRect(0,0, f.size.width, f.size.height),
|
||||||
|
f, b);
|
||||||
|
end;
|
||||||
|
|
||||||
{ TCocoaWSCustomControl }
|
{ TCocoaWSCustomControl }
|
||||||
|
|
||||||
class function TCocoaWSCustomControl.CreateHandle(const AWinControl: TWinControl;
|
class function TCocoaWSCustomControl.CreateHandle(const AWinControl: TWinControl;
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user