mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-04-15 11:49:55 +02:00
LCL: Move procedure UpdateAlignIndex from TControl to TWinControl because it deals with its private var FAlignOrder. Suggested by taazz.
git-svn-id: trunk@58449 -
This commit is contained in:
parent
9733fa84ab
commit
65bf99f425
@ -1303,7 +1303,6 @@ type
|
||||
procedure ScaleConstraints(Multiplier, Divider: Integer);
|
||||
procedure ChangeScale(Multiplier, Divider: Integer); virtual;
|
||||
function CanAutoSize(var NewWidth, NewHeight: Integer): Boolean; virtual;
|
||||
procedure UpdateAlignIndex;
|
||||
procedure SetBiDiMode(AValue: TBiDiMode); virtual;
|
||||
procedure SetParentBiDiMode(AValue: Boolean); virtual;
|
||||
function IsAParentAligning: boolean;
|
||||
@ -2048,14 +2047,15 @@ type
|
||||
procedure Remove(AControl: TControl);
|
||||
procedure AlignNonAlignedControls(ListOfControls: TFPList;
|
||||
var BoundsModified: Boolean);
|
||||
procedure CreateControlAlignList(TheAlign: TAlign;
|
||||
AlignList: TFPList; StartControl: TControl);
|
||||
procedure UpdateAlignIndex(aChild: TControl);
|
||||
protected
|
||||
FDoubleBuffered: Boolean;
|
||||
FWinControlFlags: TWinControlFlags;
|
||||
class procedure WSRegisterClass; override;
|
||||
procedure AdjustClientRect(var ARect: TRect); virtual;
|
||||
procedure GetAdjustedLogicalClientRect(out ARect: TRect);
|
||||
procedure CreateControlAlignList(TheAlign: TAlign;
|
||||
AlignList: TFPList; StartControl: TControl);
|
||||
procedure AlignControls(AControl: TControl;
|
||||
var RemainingClientRect: TRect); virtual;
|
||||
function CustomAlignInsertBefore(AControl1, AControl2: TControl): Boolean; virtual;
|
||||
|
@ -652,8 +652,8 @@ begin
|
||||
' KeepBase=',KeepBase]);
|
||||
//if (Parent=nil) and (Left>0) and (ALeft=0) then DumpStack; // This can happen if the interface has not yet moved the window and for some reason something applies the interface coords back to the LCL
|
||||
{$ENDIF}
|
||||
if not KeepBase then
|
||||
UpdateAlignIndex;
|
||||
if Assigned(Parent) and not KeepBase then
|
||||
Parent.UpdateAlignIndex(Self);
|
||||
|
||||
// constraint the size
|
||||
DoConstrainedResize(ALeft, ATop, AWidth, AHeight);
|
||||
@ -1805,25 +1805,6 @@ begin
|
||||
Result := True;
|
||||
end;
|
||||
|
||||
{------------------------------------------------------------------------------
|
||||
TControl UpdateAlignIndex
|
||||
|
||||
Move this control to position 0 of Parent.FAlignOrder
|
||||
------------------------------------------------------------------------------}
|
||||
procedure TControl.UpdateAlignIndex;
|
||||
var
|
||||
i: Integer;
|
||||
begin
|
||||
if Parent=nil then exit;
|
||||
if Parent.FAlignOrder=nil then
|
||||
Parent.FAlignOrder:=TFPList.Create;
|
||||
i:=Parent.FAlignOrder.IndexOf(Self);
|
||||
if i<0 then
|
||||
Parent.FAlignOrder.Insert(0,Self)
|
||||
else
|
||||
Parent.FAlignOrder.Move(i,0);
|
||||
end;
|
||||
|
||||
{------------------------------------------------------------------------------
|
||||
TControl Dragging
|
||||
------------------------------------------------------------------------------}
|
||||
|
@ -2530,6 +2530,20 @@ begin
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure TWinControl.UpdateAlignIndex(aChild: TControl);
|
||||
// Move child control to position 0 of FAlignOrder
|
||||
var
|
||||
i: Integer;
|
||||
begin
|
||||
if FAlignOrder=nil then
|
||||
FAlignOrder:=TFPList.Create;
|
||||
i:=FAlignOrder.IndexOf(aChild);
|
||||
if i<0 then
|
||||
FAlignOrder.Insert(0,aChild)
|
||||
else
|
||||
FAlignOrder.Move(i,0);
|
||||
end;
|
||||
|
||||
{------------------------------------------------------------------------------
|
||||
TWinControl AlignControls
|
||||
|
||||
@ -6322,7 +6336,8 @@ begin
|
||||
AControl.ValidateContainer(Self);
|
||||
Perform(CM_CONTROLLISTCHANGE, WParam(AControl), LParam(True));
|
||||
Insert(AControl,Index);
|
||||
AControl.UpdateAlignIndex;
|
||||
Assert(AControl.Parent = Self, 'TWinControl.InsertControl: AControl.Parent <> Self');
|
||||
UpdateAlignIndex(AControl);
|
||||
if not (csReading in AControl.ComponentState) then
|
||||
begin
|
||||
AControl.Perform(CM_PARENTCOLORCHANGED, 0, 0);
|
||||
|
Loading…
Reference in New Issue
Block a user