mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-08-28 21:00:43 +02: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 ShowHide(const AWinControl: TWinControl); override;
|
||||
class procedure Invalidate(const AWinControl: TWinControl); override;
|
||||
class procedure PaintTo(const AWinControl: TWinControl; ADC: HDC; X, Y: Integer); override;
|
||||
end;
|
||||
|
||||
{ TCocoaWSCustomControl }
|
||||
@ -1850,6 +1851,31 @@ begin
|
||||
NSObject(AWinControl.Handle).lclInvalidate;
|
||||
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 }
|
||||
|
||||
class function TCocoaWSCustomControl.CreateHandle(const AWinControl: TWinControl;
|
||||
|
Loading…
Reference in New Issue
Block a user