mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-04-06 12:40:22 +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;
|
||||
|
||||
|
||||
if (TheMessage.Keys and MK_LButton) > 0 then begin
|
||||
// left button
|
||||
// -> check if a grabber was activated
|
||||
@ -2779,6 +2778,7 @@ function TDesigner.ComponentClassAtPos(const AClass: TComponentClass;
|
||||
if IgnoreHidden then
|
||||
Include(Flags,dmcapfOnlyVisible);
|
||||
Result:=Mediator.ComponentAtPos(APos,AClass,Flags);
|
||||
//DebugLn(['DoComponent ',dbgs(APos),' AClass=',DbgSName(AClass),' Result=',DbgSName(Result)]);
|
||||
end else begin
|
||||
for i := FLookupRoot.ComponentCount - 1 downto 0 do
|
||||
begin
|
||||
|
@ -52,6 +52,8 @@ type
|
||||
class function FormClass: TComponentClass; override;
|
||||
procedure GetBounds(AComponent: TComponent; out CurBounds: TRect); override;
|
||||
procedure SetBounds(AComponent: TComponent; NewBounds: TRect); override;
|
||||
procedure GetClientArea(AComponent: TComponent; out
|
||||
CurClientArea: TRect; out ScrollOffset: TPoint); override;
|
||||
procedure Paint; override;
|
||||
function ComponentIsIcon(AComponent: TComponent): boolean; override;
|
||||
function ParentAcceptsChild(Parent: TComponent;
|
||||
@ -127,6 +129,21 @@ begin
|
||||
inherited SetBounds(AComponent,NewBounds);
|
||||
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 PaintWidget(AWidget: TMyWidget);
|
||||
|
@ -469,10 +469,12 @@ begin
|
||||
Childs:=TFPList.Create;
|
||||
try
|
||||
GetChilds(Result,Childs);
|
||||
//DebugLn(['TDesignerMediator.ComponentAtPos Result=',DbgSName(Result),' ChildCount=',childs.Count,' ']);
|
||||
Found:=false;
|
||||
// iterate backwards (z-order)
|
||||
for i:=Childs.Count-1 downto 0 do begin
|
||||
Child:=TComponent(Childs[i]);
|
||||
//DebugLn(['TDesignerMediator.ComponentAtPos Child ',DbgSName(Child)]);
|
||||
if (MinClass<>nil) and (not Child.InheritsFrom(MinClass)) then
|
||||
continue;
|
||||
if (dmcapfOnlyVisible in Flags) and (not ComponentIsVisible(Child)) then
|
||||
|
Loading…
Reference in New Issue
Block a user