mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-08-12 17:18:25 +02:00
IDEIntf: designer mediator: fixed example GetClientArea
git-svn-id: trunk@21643 -
This commit is contained in:
parent
1c90131396
commit
696ab5f46c
@ -1385,7 +1385,6 @@ begin
|
|||||||
|
|
||||||
SelectedCompClass := GetSelectedComponentClass;
|
SelectedCompClass := GetSelectedComponentClass;
|
||||||
|
|
||||||
|
|
||||||
if (TheMessage.Keys and MK_LButton) > 0 then begin
|
if (TheMessage.Keys and MK_LButton) > 0 then begin
|
||||||
// left button
|
// left button
|
||||||
// -> check if a grabber was activated
|
// -> check if a grabber was activated
|
||||||
@ -2779,6 +2778,7 @@ function TDesigner.ComponentClassAtPos(const AClass: TComponentClass;
|
|||||||
if IgnoreHidden then
|
if IgnoreHidden then
|
||||||
Include(Flags,dmcapfOnlyVisible);
|
Include(Flags,dmcapfOnlyVisible);
|
||||||
Result:=Mediator.ComponentAtPos(APos,AClass,Flags);
|
Result:=Mediator.ComponentAtPos(APos,AClass,Flags);
|
||||||
|
//DebugLn(['DoComponent ',dbgs(APos),' AClass=',DbgSName(AClass),' Result=',DbgSName(Result)]);
|
||||||
end else begin
|
end else begin
|
||||||
for i := FLookupRoot.ComponentCount - 1 downto 0 do
|
for i := FLookupRoot.ComponentCount - 1 downto 0 do
|
||||||
begin
|
begin
|
||||||
|
@ -52,6 +52,8 @@ type
|
|||||||
class function FormClass: TComponentClass; override;
|
class function FormClass: TComponentClass; override;
|
||||||
procedure GetBounds(AComponent: TComponent; out CurBounds: TRect); override;
|
procedure GetBounds(AComponent: TComponent; out CurBounds: TRect); override;
|
||||||
procedure SetBounds(AComponent: TComponent; NewBounds: TRect); override;
|
procedure SetBounds(AComponent: TComponent; NewBounds: TRect); override;
|
||||||
|
procedure GetClientArea(AComponent: TComponent; out
|
||||||
|
CurClientArea: TRect; out ScrollOffset: TPoint); override;
|
||||||
procedure Paint; override;
|
procedure Paint; override;
|
||||||
function ComponentIsIcon(AComponent: TComponent): boolean; override;
|
function ComponentIsIcon(AComponent: TComponent): boolean; override;
|
||||||
function ParentAcceptsChild(Parent: TComponent;
|
function ParentAcceptsChild(Parent: TComponent;
|
||||||
@ -127,6 +129,21 @@ begin
|
|||||||
inherited SetBounds(AComponent,NewBounds);
|
inherited SetBounds(AComponent,NewBounds);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
procedure TMyWidgetMediator.GetClientArea(AComponent: TComponent; out
|
||||||
|
CurClientArea: TRect; out ScrollOffset: TPoint);
|
||||||
|
var
|
||||||
|
Widget: TMyWidget;
|
||||||
|
begin
|
||||||
|
if AComponent is TMyWidget then begin
|
||||||
|
Widget:=TMyWidget(AComponent);
|
||||||
|
CurClientArea:=Rect(Widget.BorderLeft,Widget.BorderTop,
|
||||||
|
Widget.Width-Widget.BorderRight,
|
||||||
|
Widget.Height-Widget.BorderBottom);
|
||||||
|
ScrollOffset:=Point(0,0);
|
||||||
|
end else
|
||||||
|
inherited GetClientArea(AComponent, CurClientArea, ScrollOffset);
|
||||||
|
end;
|
||||||
|
|
||||||
procedure TMyWidgetMediator.Paint;
|
procedure TMyWidgetMediator.Paint;
|
||||||
|
|
||||||
procedure PaintWidget(AWidget: TMyWidget);
|
procedure PaintWidget(AWidget: TMyWidget);
|
||||||
|
@ -469,10 +469,12 @@ begin
|
|||||||
Childs:=TFPList.Create;
|
Childs:=TFPList.Create;
|
||||||
try
|
try
|
||||||
GetChilds(Result,Childs);
|
GetChilds(Result,Childs);
|
||||||
|
//DebugLn(['TDesignerMediator.ComponentAtPos Result=',DbgSName(Result),' ChildCount=',childs.Count,' ']);
|
||||||
Found:=false;
|
Found:=false;
|
||||||
// iterate backwards (z-order)
|
// iterate backwards (z-order)
|
||||||
for i:=Childs.Count-1 downto 0 do begin
|
for i:=Childs.Count-1 downto 0 do begin
|
||||||
Child:=TComponent(Childs[i]);
|
Child:=TComponent(Childs[i]);
|
||||||
|
//DebugLn(['TDesignerMediator.ComponentAtPos Child ',DbgSName(Child)]);
|
||||||
if (MinClass<>nil) and (not Child.InheritsFrom(MinClass)) then
|
if (MinClass<>nil) and (not Child.InheritsFrom(MinClass)) then
|
||||||
continue;
|
continue;
|
||||||
if (dmcapfOnlyVisible in Flags) and (not ComponentIsVisible(Child)) then
|
if (dmcapfOnlyVisible in Flags) and (not ComponentIsVisible(Child)) then
|
||||||
|
Loading…
Reference in New Issue
Block a user