mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-08-30 17:30:21 +02:00
Cocoa: both 3d style and box style supported in TCocoaWidgetSet.Frame3d() by csParentBackground
This commit is contained in:
parent
8a6d93c26e
commit
f49aedaf1f
@ -347,6 +347,7 @@ type
|
||||
TCocoaBitmapContext = class;
|
||||
TCocoaContext = class(TObject)
|
||||
private
|
||||
FControl: TWinControl;
|
||||
FBkBrush: TCocoaBrush;
|
||||
FBkColor: TColor;
|
||||
FBkMode: Integer;
|
||||
@ -448,6 +449,8 @@ type
|
||||
function SetClipRegion(AClipRegion: TCocoaRegion; Mode: TCocoaCombine): TCocoaRegionType;
|
||||
function CopyClipRegion(ADstRegion: TCocoaRegion): TCocoaRegionType;
|
||||
|
||||
property Control: TWinControl read FControl write FControl;
|
||||
|
||||
property Clipped: Boolean read FClipped;
|
||||
property Flipped: Boolean read FFlipped;
|
||||
property PenPos: TPoint read FPenPos write FPenPos;
|
||||
|
@ -966,14 +966,35 @@ const
|
||||
var
|
||||
I: Integer;
|
||||
rect: TRect;
|
||||
ctx: TCocoaContext;
|
||||
control: TWinControl;
|
||||
is3dStyle: Boolean;
|
||||
begin
|
||||
Result := FrameWidth > 0;
|
||||
if not Result then exit;
|
||||
rect:= ARect;
|
||||
for I := 0 to FrameWidth - 1 do
|
||||
ctx := CheckDC(DC);
|
||||
if not Assigned(ctx) then
|
||||
exit;
|
||||
|
||||
control := ctx.control;
|
||||
if Assigned(control) then
|
||||
is3dStyle := csParentBackground in control.ControlStyle
|
||||
else
|
||||
is3dStyle := true;
|
||||
|
||||
if is3dStyle then
|
||||
begin
|
||||
Result := Boolean(DrawEdge(DC, rect, Edge[Style], BF_RECT or BF_ADJUST));
|
||||
InflateRect(rect,-1,-1);
|
||||
Result := FrameWidth > 0;
|
||||
if not Result then exit;
|
||||
rect:= ARect;
|
||||
for I := 0 to FrameWidth - 1 do
|
||||
begin
|
||||
Result := Boolean(DrawEdge(DC, rect, Edge[Style], BF_RECT or BF_ADJUST));
|
||||
InflateRect(rect,-1,-1);
|
||||
end;
|
||||
end
|
||||
else
|
||||
begin
|
||||
if FrameWidth > 0 then
|
||||
ctx.Frame3d(ARect, FrameWidth, Style);
|
||||
end;
|
||||
end;
|
||||
|
||||
|
@ -1563,6 +1563,7 @@ begin
|
||||
if Assigned(FContext) then
|
||||
Exit;
|
||||
FContext := TCocoaContext.Create(ControlContext);
|
||||
FContext.Control := FTarget;
|
||||
FContext.isControlDC := True;
|
||||
try
|
||||
// debugln('Draw '+Target.name+' bounds='+Dbgs(NSRectToRect(bounds))+' dirty='+Dbgs(NSRectToRect(dirty)));
|
||||
|
Loading…
Reference in New Issue
Block a user