mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-08-17 04:49:19 +02:00
Revert "Cocoa: TCocoaContext.Frame3d() removed by a901a8e"
This reverts commit eb65e0684e
.
This commit is contained in:
parent
d4af394bac
commit
8a6d93c26e
@ -373,6 +373,7 @@ type
|
|||||||
FSize: TSize;
|
FSize: TSize;
|
||||||
FViewPortOfs: TPoint;
|
FViewPortOfs: TPoint;
|
||||||
FWindowOfs: TPoint;
|
FWindowOfs: TPoint;
|
||||||
|
boxview : NSBox; // the view is used to draw Frame3d
|
||||||
function GetFont: TCocoaFont;
|
function GetFont: TCocoaFont;
|
||||||
function GetTextColor: TColor;
|
function GetTextColor: TColor;
|
||||||
procedure SetBkColor(AValue: TColor);
|
procedure SetBkColor(AValue: TColor);
|
||||||
@ -428,6 +429,7 @@ type
|
|||||||
procedure Ellipse(X1, Y1, X2, Y2: Integer);
|
procedure Ellipse(X1, Y1, X2, Y2: Integer);
|
||||||
procedure TextOut(X, Y: Integer; Options: Longint; Rect: PRect; UTF8Chars: PChar; Count: Integer; CharsDelta: PInteger);
|
procedure TextOut(X, Y: Integer; Options: Longint; Rect: PRect; UTF8Chars: PChar; Count: Integer; CharsDelta: PInteger);
|
||||||
procedure Frame(const R: TRect);
|
procedure Frame(const R: TRect);
|
||||||
|
procedure Frame3d(var ARect: TRect; const FrameWidth: integer; const Style: TBevelCut);
|
||||||
procedure FrameRect(const ARect: TRect; const ABrush: TCocoaBrush);
|
procedure FrameRect(const ARect: TRect; const ABrush: TCocoaBrush);
|
||||||
procedure DrawBitmap(X, Y: Integer; ABitmap: TCocoaBitmap);
|
procedure DrawBitmap(X, Y: Integer; ABitmap: TCocoaBitmap);
|
||||||
function DrawImageRep(dstRect: NSRect; const srcRect: NSRect; ImageRep: NSBitmapImageRep): Boolean;
|
function DrawImageRep(dstRect: NSRect; const srcRect: NSRect; ImageRep: NSBitmapImageRep): Boolean;
|
||||||
@ -1488,6 +1490,7 @@ begin
|
|||||||
CGContextRestoreGState(CGContext());
|
CGContextRestoreGState(CGContext());
|
||||||
ctx.release;
|
ctx.release;
|
||||||
end;
|
end;
|
||||||
|
if Assigned(boxview) then boxview.release;
|
||||||
inherited Destroy;
|
inherited Destroy;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
@ -1992,6 +1995,49 @@ begin
|
|||||||
AttachedBitmap_SetModified();
|
AttachedBitmap_SetModified();
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
procedure TCocoaContext.Frame3d(var ARect: TRect; const FrameWidth: integer; const Style: TBevelCut);
|
||||||
|
var
|
||||||
|
dx,dy: integer;
|
||||||
|
ns : NSRect;
|
||||||
|
r : TRect;
|
||||||
|
yy : double;
|
||||||
|
begin
|
||||||
|
if Style = bvNone then Exit;
|
||||||
|
|
||||||
|
if (Style = bvRaised) or (Style = bvLowered) then
|
||||||
|
begin
|
||||||
|
if not Assigned(boxview) then
|
||||||
|
begin
|
||||||
|
boxview := NSBox.alloc.initWithFrame(NSMakeRect(0,0,0,0));
|
||||||
|
boxview.setTitle(NSString.string_);
|
||||||
|
boxview.setTitlePosition(NSNoTitle);
|
||||||
|
end;
|
||||||
|
|
||||||
|
dx:=3; // layout<->frame adjustement for the box
|
||||||
|
dy:=3; // (should be aquired using 10.7 apis)
|
||||||
|
if Style=bvRaised then
|
||||||
|
boxview.setBoxType(NSBoxPrimary)
|
||||||
|
else
|
||||||
|
boxview.setBoxType(NSBoxSecondary);
|
||||||
|
r:=ARect;
|
||||||
|
InflateRect(r, dx, dy);
|
||||||
|
ns := RectToNSRect(r);
|
||||||
|
// used for size only, position is ignored
|
||||||
|
boxview.setFrame(ns);
|
||||||
|
yy := ns.size.height+ns.origin.y+1;
|
||||||
|
CGContextTranslateCTM(ctx.lclCGContext, ns.origin.x, yy);
|
||||||
|
CGContextScaleCTM(ctx.lclCGContext, 1, -1);
|
||||||
|
|
||||||
|
boxview.displayRectIgnoringOpacity_inContext(
|
||||||
|
NSMakeRect(0,0,ns.size.width, ns.size.height)
|
||||||
|
, ctx);
|
||||||
|
|
||||||
|
CGContextScaleCTM(ctx.lclCGContext, 1, -1);
|
||||||
|
CGContextTranslateCTM(ctx.lclCGContext, -ns.origin.x,-yy);
|
||||||
|
end;
|
||||||
|
AttachedBitmap_SetModified();
|
||||||
|
end;
|
||||||
|
|
||||||
procedure TCocoaContext.FrameRect(const ARect: TRect; const ABrush: TCocoaBrush);
|
procedure TCocoaContext.FrameRect(const ARect: TRect; const ABrush: TCocoaBrush);
|
||||||
begin
|
begin
|
||||||
Rectangle(Arect.Left,ARect.Top,Arect.Right,ARect.Bottom, False, ABrush);
|
Rectangle(Arect.Left,ARect.Top,Arect.Right,ARect.Bottom, False, ABrush);
|
||||||
|
Loading…
Reference in New Issue
Block a user