mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-08-18 17:59:22 +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 ScaleConstraints(Multiplier, Divider: Integer);
|
||||||
procedure ChangeScale(Multiplier, Divider: Integer); virtual;
|
procedure ChangeScale(Multiplier, Divider: Integer); virtual;
|
||||||
function CanAutoSize(var NewWidth, NewHeight: Integer): Boolean; virtual;
|
function CanAutoSize(var NewWidth, NewHeight: Integer): Boolean; virtual;
|
||||||
procedure UpdateAlignIndex;
|
|
||||||
procedure SetBiDiMode(AValue: TBiDiMode); virtual;
|
procedure SetBiDiMode(AValue: TBiDiMode); virtual;
|
||||||
procedure SetParentBiDiMode(AValue: Boolean); virtual;
|
procedure SetParentBiDiMode(AValue: Boolean); virtual;
|
||||||
function IsAParentAligning: boolean;
|
function IsAParentAligning: boolean;
|
||||||
@ -2048,14 +2047,15 @@ type
|
|||||||
procedure Remove(AControl: TControl);
|
procedure Remove(AControl: TControl);
|
||||||
procedure AlignNonAlignedControls(ListOfControls: TFPList;
|
procedure AlignNonAlignedControls(ListOfControls: TFPList;
|
||||||
var BoundsModified: Boolean);
|
var BoundsModified: Boolean);
|
||||||
|
procedure CreateControlAlignList(TheAlign: TAlign;
|
||||||
|
AlignList: TFPList; StartControl: TControl);
|
||||||
|
procedure UpdateAlignIndex(aChild: TControl);
|
||||||
protected
|
protected
|
||||||
FDoubleBuffered: Boolean;
|
FDoubleBuffered: Boolean;
|
||||||
FWinControlFlags: TWinControlFlags;
|
FWinControlFlags: TWinControlFlags;
|
||||||
class procedure WSRegisterClass; override;
|
class procedure WSRegisterClass; override;
|
||||||
procedure AdjustClientRect(var ARect: TRect); virtual;
|
procedure AdjustClientRect(var ARect: TRect); virtual;
|
||||||
procedure GetAdjustedLogicalClientRect(out ARect: TRect);
|
procedure GetAdjustedLogicalClientRect(out ARect: TRect);
|
||||||
procedure CreateControlAlignList(TheAlign: TAlign;
|
|
||||||
AlignList: TFPList; StartControl: TControl);
|
|
||||||
procedure AlignControls(AControl: TControl;
|
procedure AlignControls(AControl: TControl;
|
||||||
var RemainingClientRect: TRect); virtual;
|
var RemainingClientRect: TRect); virtual;
|
||||||
function CustomAlignInsertBefore(AControl1, AControl2: TControl): Boolean; virtual;
|
function CustomAlignInsertBefore(AControl1, AControl2: TControl): Boolean; virtual;
|
||||||
|
@ -652,8 +652,8 @@ begin
|
|||||||
' KeepBase=',KeepBase]);
|
' 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
|
//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}
|
{$ENDIF}
|
||||||
if not KeepBase then
|
if Assigned(Parent) and not KeepBase then
|
||||||
UpdateAlignIndex;
|
Parent.UpdateAlignIndex(Self);
|
||||||
|
|
||||||
// constraint the size
|
// constraint the size
|
||||||
DoConstrainedResize(ALeft, ATop, AWidth, AHeight);
|
DoConstrainedResize(ALeft, ATop, AWidth, AHeight);
|
||||||
@ -1805,25 +1805,6 @@ begin
|
|||||||
Result := True;
|
Result := True;
|
||||||
end;
|
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
|
TControl Dragging
|
||||||
------------------------------------------------------------------------------}
|
------------------------------------------------------------------------------}
|
||||||
|
@ -2530,6 +2530,20 @@ begin
|
|||||||
end;
|
end;
|
||||||
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
|
TWinControl AlignControls
|
||||||
|
|
||||||
@ -6322,7 +6336,8 @@ begin
|
|||||||
AControl.ValidateContainer(Self);
|
AControl.ValidateContainer(Self);
|
||||||
Perform(CM_CONTROLLISTCHANGE, WParam(AControl), LParam(True));
|
Perform(CM_CONTROLLISTCHANGE, WParam(AControl), LParam(True));
|
||||||
Insert(AControl,Index);
|
Insert(AControl,Index);
|
||||||
AControl.UpdateAlignIndex;
|
Assert(AControl.Parent = Self, 'TWinControl.InsertControl: AControl.Parent <> Self');
|
||||||
|
UpdateAlignIndex(AControl);
|
||||||
if not (csReading in AControl.ComponentState) then
|
if not (csReading in AControl.ComponentState) then
|
||||||
begin
|
begin
|
||||||
AControl.Perform(CM_PARENTCOLORCHANGED, 0, 0);
|
AControl.Perform(CM_PARENTCOLORCHANGED, 0, 0);
|
||||||
|
Loading…
Reference in New Issue
Block a user