LCL: Changes for Carbon:

- Painting non-visual components for docked design form
    - Selection and moving visual controls with mouse like TMemo

git-svn-id: trunk@50422 -
This commit is contained in:
juha 2015-11-19 13:55:43 +00:00
parent 6e0ef7b037
commit a3553d9e5a
3 changed files with 43 additions and 7 deletions

View File

@ -262,6 +262,8 @@ type
procedure CreateWidget(const AParams: TCreateParams); override;
procedure DestroyWidget; override;
public
procedure AddToWidget(AParent: TCarbonWidget); override;
procedure ControlAdded; override;
procedure BoundsChanged; override;
@ -581,6 +583,30 @@ begin
inherited;
end;
{------------------------------------------------------------------------------
Method: TCarbonDesignWindow.AddToWidget
Override to perform docked design window
------------------------------------------------------------------------------}
procedure TCarbonDesignWindow.AddToWidget(AParent: TCarbonWidget);
begin
inherited AddToWidget(AParent);
if not Assigned(fWindowRef) then
begin
HIViewRemoveFromSuperview(FDesignControl);
OSError(HIViewAddSubview(HIViewGetFirstSubview(FScrollView), FDesignControl),
Self, 'AddToWidget', SViewAddView);
BringDesignerToFront;
end else
begin
HIViewRemoveFromSuperview(FDesignControl);
OSError(HIViewAddSubview(fWinContent, FDesignControl), Self, 'AddToWidget',
SViewAddView);
BringDesignerToFront;
end;
end;
{------------------------------------------------------------------------------
Method: TCarbonDesignWindow.ControlAdded
@ -602,7 +628,11 @@ var
begin
inherited;
GetClientRect(R{%H-});
if Assigned(FWindowRef) then
GetClientRect(R{%H-})
else
GetScreenBounds(R{%H-});
OffsetRect(R, -R.Left, -R.Top);
OSError(HIViewSetFrame(FDesignControl, RectToCGRect(R)),
Self, SSetBounds, SViewFrame);

View File

@ -1581,7 +1581,7 @@ end;
------------------------------------------------------------------------------}
function TCarbonWindow.GetScreenBounds(var ARect: TRect): Boolean;
begin
if Window <> nil then
if Assigned(FWindowRef) then
Result := GetBounds(ARect)
else
Result := inherited GetScreenBounds(ARect);

View File

@ -1420,11 +1420,17 @@ begin
Result := CheckDC(PaintDC, 'GetDCOriginRelativeToWindow');
if Result then
begin
DC := TCarbonDeviceContext(PaintDC);
affine := CGContextGetCTM(DC.CGContext);
TCarbonWidget(WindowHandle).GetBounds(r{%H-});
OriginDiff.x := Round(affine.tx);
OriginDiff.y := Round((r.Bottom - r.Top) - affine.ty);
if TCarbonWindow(WindowHandle).Window <> nil then
begin
DC := TCarbonDeviceContext(PaintDC);
affine := CGContextGetCTM(DC.CGContext);
TCarbonWidget(WindowHandle).GetBounds(r{%H-});
OriginDiff.x := Round(affine.tx);
OriginDiff.y := Round((r.Bottom - r.Top) - affine.ty);
end
else // for docked window
OriginDiff := Classes.Point(0, 0);
Result := true;
end;
end;