| Class TLayoutPanel (unit LOPanel) |
TPanel
| Constructors |
constructor Create(AOwner: TComponent);| Functions |
destructor Destroy;
procedure DisableLayout;TLayoutPanel.
procedure EnableLayout;
function GetChildLayoutMetrics( child : TControl; var metrics : TLayoutMetrics) : Boolean;
function GetControlByName(const AName: string): TControl;
function IsChildControl( child : Pointer ) : integer;
procedure Layout;TLayoutPanel.
function RemoveChildLayoutMetrics( child : TControl ) : Boolean;
procedure SetChildLayoutMetrics( child : TControl; var metrics : TLayoutMetrics );
procedure AlignControls(AControl: TControl; var Rect: TRect);
procedure DefineProperties( Filer: TFiler );
function GetRelControlByNum( N : integer ) : TControl;
function GetRelControlNum( var Control : TControl ) : integer;
procedure RemoveFoundChildLayoutMetrics( chldMetrics : TChildMetrics );
procedure RemoveSuperfluousMetrics;
procedure SetRelWinLayoutMetrics( var constraint : TLayoutConstraint );
procedure AddConstraint( metrics : TChildMetrics;
c : PLayoutConstraint;
whichConstraint : TWhichConstraint );
procedure BuildConstraints( chldMetrics : TChildMetrics );
procedure BuildPlan;
procedure ClearPlan;
procedure Empty( m : TList);
function EqualConstraints( var c1, c2: TLayoutConstraint ): boolean;
function EqualMetrics( Panel: TLayoutPanel ): boolean;
procedure ExecutePlan;
function GetChildMetrics(Index: Integer): TChildMetrics;
function GetChildMetricsByChild( child : TControl) : TChildMetrics;
function GetChildMetricsCount : integer;
function GetChildMetricsIndexByChild( child : TControl) : integer;
function GetConstraint(Index: Integer): TConstraint;
procedure GetFontHeight;
function GetPlanItem(Index: Integer): TConstraint;
function HasData( Filer : TFiler ): boolean;
function IsLayoutEnabled : boolean;
function LayoutUnitsToPixels( units : integer ) : integer;
procedure ReadMetrics(Reader: TReader);
procedure RemoveAllConstraints;
procedure RemoveConstraints( chldMetrics : TChildMetrics );
procedure SetLayoutEnabled( en : boolean );
procedure SetVacantPointers;
function WereAsIsMoved : boolean;
procedure WriteMetrics(Writer: TWriter);| Properties |
property AfterLayout : TNotifyEvent
property BeforeLayout : TNotifyEvent
property LayoutEnabled : boolean
property Metrics : TList
property ChildMetrics : TChildMetrics
property ChildMetricsCount : Integer
property PlanIsDirty : Boolean
property Constraints : TConstraint
property Plan : TConstraint| Events |
| Variables |
FAfterLayout : TNotifyEvent;
FBeforeLayout : TNotifyEvent;
FConstraints : TList;
FFirstAfterRead : boolean;
FFontHeight : integer;
FLayoutLevel : integer;
FMetrics : TList;
FPlan : TList;
FPlanIsDirty : Boolean;
FVariables : TEdgeVariables;| Constructors |
constructor Create(AOwner: TComponent);TConstraint.NumActualInputs } { TLayoutPanel class implementation } {--------------------------------------- TLayoutPanel.Create } { Initialize variables
| Functions |
destructor Destroy;TLayoutPanel.Create} {--------------------------------------- TLayoutPanel.Destroy } { Destroy all lists that were created
procedure DisableLayout;Pair of functions incrementing or decrementing Layout level
TLayoutPanel.Empty } {--------------------------------------- TLayoutPanel.DisableLayout } { Increment Layout level to disable layout
procedure EnableLayout;TLayoutPanel.DisableLayout } {--------------------------------------- TLayoutPanel.EnableLayout } { Decrement Layout level to enable layout
function GetChildLayoutMetrics( child : TControl; var metrics : TLayoutMetrics) : Boolean;TLayoutPanel.GetChildMetricsIndexByChild } {--------------------------------------- TLayoutPanel.GetChildLayoutMetrics } { Return layout metrics corresponding to the control If metrics is not found return false
function GetControlByName(const AName: string): TControl;TLayoutPanel.IsLayoutEnabled } {--------------------------------------- TLayoutPanel.GetControlByName } { Get control by name
function IsChildControl( child : Pointer ) : integer;TLayoutPanel.RemoveFoundChildLayoutMetrics } {--------------------------------------- TLayoutPanel.IsChildControl } { Check if a pointer is child control. Returns control index or -1 if not found
procedure Layout;causes the receiver to size/position its children according to the specified layout metrics if you change the layout metrics for a child window call Layout to have the changes take effect
TLayoutPanel.WereAsIsMoved } {--------------------------------------- TLayoutPanel.Layout } causes the receiver to size/position its children according to the specified layout metrics if you change the layout metrics for a child window call Layout to have the changes take effect
function RemoveChildLayoutMetrics( child : TControl ) : Boolean;TLayoutPanel.SetRelWinLayoutMetrics } {--------------------------------------- TLayoutPanel.RemoveChildLayoutMetrics } { Remove child (layout) metrics for a given child (if found) and update other children as necessary
procedure SetChildLayoutMetrics( child : TControl; var metrics : TLayoutMetrics );TLayoutPanel.RemoveSuperfluousMetrics} {--------------------------------------- TLayoutPanel.SetChildLayoutMetrics } { Set layout metrics for control
procedure AlignControls(AControl: TControl; var Rect: TRect);TLayoutPanel.Destroy } {--------------------------------------- TLayoutPanel.AlignControls } { Some controls could be removed since the last call This can happen when AControl = nil
procedure DefineProperties( Filer: TFiler );TLayoutPanel.GetRelControlNum } { Procedures for storing and reading Metrics } {--------------------------------------- TLayoutPanel.DefineProperties } { Define function for reading and writing
function GetRelControlByNum( N : integer ) : TControl;TLayoutPanel.GetControlByName} {--------------------------------------- TLayoutPanel.GetRelControlByNum } { Get relative control by index (lmParent - maximal or =ParentNum) This index is not a control number but coresponding metrics number All messing in this code comes from working with old storing format (one without controls' names)
function GetRelControlNum( var Control : TControl ) : integer;TLayoutPanel.GetRelControlByNum } {--------------------------------------- TLayoutPanel.GetRelControlNum } { Get index of relative control (lmParent = ParentNum) This index is not a control number but coresponding metrics number All messing in this code comes from working with old storing format (one without controls' names)
procedure RemoveFoundChildLayoutMetrics( chldMetrics : TChildMetrics );TLayoutPanel.RemoveChildLayoutMetrics} {--------------------------------------- TLayoutPanel.RemoveFoundChildLayoutMetrics } { Remove child (layout) metrics (that exists) and update other children as necessary
procedure RemoveSuperfluousMetrics;TLayoutPanel.AlignControls} {--------------------------------------- TLayoutPanel.RemoveSuperfluousMetrics } { If metrics has no corresponding control remove it
procedure SetRelWinLayoutMetrics( var constraint : TLayoutConstraint );TLayoutPanel.SetChildLayoutMetrics } {--------------------------------------- TLayoutPanel.SetRelWinLayoutMetrics } { Set AsIs metrics for any relative that has no metrics yet
procedure AddConstraint( metrics : TChildMetrics;
c : PLayoutConstraint;
whichConstraint : TWhichConstraint );SetOutputAndMatch } {--------------------------------------- TLayoutPanel.AddConstraint } { Add a consraint by metrics and type of consraint
procedure BuildConstraints( chldMetrics : TChildMetrics );TLayoutPanel.RemoveAllConstraints} {--------------------------------------- TLayoutPanel.BuildConstraint } { Build constraints for a gien child metrics
procedure BuildPlan;TLayoutPanel.ClearPlan} {--------------------------------------- TLayoutPanel.BuildPlan } { Try to resolve more and more variables
procedure ClearPlan;TLayoutPanel.ExecutePlan} {--------------------------------------- TLayoutPanel.ClearPlan } { Clear plan that was built before
procedure Empty( m : TList);TLayoutPanel.GetChildMetricsCount } {--------------------------------------- TLayoutPanel.Empty } { To publish a property
function EqualConstraints( var c1, c2: TLayoutConstraint ): boolean;TLayoutPanel.HasData } {--------------------------------------- TLayoutPanel.EqualConstraints } { Compare constraints
function EqualMetrics( Panel: TLayoutPanel ): boolean;TLayoutPanel.HasData } {--------------------------------------- TLayoutPanel.EqualMetrics } { This procedure is used for comparison Ancestor's metrics to native metrics. Children with equal names are considered to be equal
procedure ExecutePlan;TLayoutPanel.LayoutUnitsToPixels } {--------------------------------------- TLayoutPanel.ExecutePlan } { Execute plan that was built before
function GetChildMetrics(Index: Integer): TChildMetrics;TLayoutPanel.SetVacantPointers } {--------------------------------------- TLayoutPanel.GetChildMetrics } { Get child metrics by index
function GetChildMetricsByChild( child : TControl) : TChildMetrics;TLayoutPanel.IsChildControl } {--------------------------------------- TLayoutPanel.GetChildMetricsByChild } { Return child metrics corresponding to the control If metrics is not found return nil
function GetChildMetricsCount : integer;TLayoutPanel.GetPlanItem } {--------------------------------------- TLayoutPanel.GetChildMetricsCount } { Returns child metrics count
function GetChildMetricsIndexByChild( child : TControl) : integer;TLayoutPanel.GetChildMetricsByChild } {--------------------------------------- TLayoutPanel.GetChildMetricsIndexByChild } { Return child metrics index corresponding to the control If metrics is not found return nil
function GetConstraint(Index: Integer): TConstraint;TLayoutPanel.ChildMetrics } {--------------------------------------- TLayoutPanel.GetConstraint } { Get constraint by index
procedure GetFontHeight;TLayoutPanel.BuildConstraints} {--------------------------------------- TLayoutPanel.GetFontHeight } { Get current font height
function GetPlanItem(Index: Integer): TConstraint;TLayoutPanel.GetConstraint } {--------------------------------------- TLayoutPanel.GetPlanItem } { Get constraint of plan by index
function HasData( Filer : TFiler ): boolean;TLayoutPanel.ReadMetrics } {--------------------------------------- TLayoutPanel.HasData } { Determines at run time whether the ChildMetrics property has data to store. Differs for Delphi16 and Delphi32. In Delphi32 compares the Ancesor's (if any) ChildMetrics with native one and returns True if there are some differences between them
function IsLayoutEnabled : boolean;TLayoutPanel.SetLayoutEnabled } {--------------------------------------- TLayoutPanel.IsLayoutEnabled } { Is layout enabled ?
function LayoutUnitsToPixels( units : integer ) : integer;TLayoutPanel.GetChildLayoutMetrics } {--------------------------------------- TLayoutPanel.LayoutUnitsToPixels } { Calculate pixels value by layout units
procedure ReadMetrics(Reader: TReader);TLayoutPanel.DefineProperties } {--------------------------------------- TLayoutPanel.ReadMetrics } { Read metrics from stream
procedure RemoveAllConstraints;TLayoutPanel.RemoveConstraints} {--------------------------------------- TLayoutPanel.RemoveAllConstraints } { Remove all constraints
procedure RemoveConstraints( chldMetrics : TChildMetrics );TLayoutPanel.AddConstraint } {--------------------------------------- TLayoutPanel.RemoveConstraint } { Remove constraints for a given child metrics
procedure SetLayoutEnabled( en : boolean );TLayoutPanel.EnableLayout } {--------------------------------------- TLayoutPanel.SetLayoutEnabled } { Set enable to true or false and force rebuilding constraints and layout State can be written directly only at design time
procedure SetVacantPointers;TLayoutPanel.Layout } {--------------------------------------- TLayoutPanel.SetVacantPointers } { If any child metrics has Child field = nil then try to set it to the correspondent control
function WereAsIsMoved : boolean;TLayoutPanel.GetFontHeight } {--------------------------------------- TLayoutPanel.WereAsIsMoved } { Check if edges having AsIs constraints were moved since last building a plan
procedure WriteMetrics(Writer: TWriter);TLayoutPanel.ReadMetrics } {--------------------------------------- TLayoutPanel.WriteMetrics } { Write metrics to stream
| Properties |
property AfterLayout : TNotifyEvent
property BeforeLayout : TNotifyEvent
property LayoutEnabled : boolean
property Metrics : TList
property ChildMetrics : TChildMetrics
property ChildMetricsCount : Integer
property PlanIsDirty : Boolean
property Constraints : TConstraint
property Plan : TConstraint| Events |
| Variables |
FAfterLayout : TNotifyEvent;
FBeforeLayout : TNotifyEvent;
FConstraints : TList;
FFirstAfterRead : boolean;
FFontHeight : integer;
FLayoutLevel : integer;
FMetrics : TList;
FPlan : TList;
FPlanIsDirty : Boolean;
FVariables : TEdgeVariables;