fixed ChildSizing spacing and Layout

git-svn-id: trunk@8639 -
This commit is contained in:
mattias 2006-01-27 21:51:58 +00:00
parent 9a738a013a
commit da5881ed7f
2 changed files with 12 additions and 5 deletions

View File

@ -1320,7 +1320,7 @@ type
TControlChildSizing = class(TPersistent) TControlChildSizing = class(TPersistent)
private private
FControl: TControl; FControl: TWinControl;
FControlsPerLine: integer; FControlsPerLine: integer;
FEnlargeHorizontal: TChildControlResizeStyle; FEnlargeHorizontal: TChildControlResizeStyle;
FEnlargeVertical: TChildControlResizeStyle; FEnlargeVertical: TChildControlResizeStyle;
@ -1345,12 +1345,12 @@ type
protected protected
procedure Change; dynamic; procedure Change; dynamic;
public public
constructor Create(OwnerControl: TControl); constructor Create(OwnerControl: TWinControl);
procedure Assign(Source: TPersistent); override; procedure Assign(Source: TPersistent); override;
procedure AssignTo(Dest: TPersistent); override; procedure AssignTo(Dest: TPersistent); override;
function IsEqual(Sizing: TControlChildSizing): boolean; function IsEqual(Sizing: TControlChildSizing): boolean;
public public
property Control: TControl read FControl; property Control: TWinControl read FControl;
property OnChange: TNotifyEvent read FOnChange write FOnChange; property OnChange: TNotifyEvent read FOnChange write FOnChange;
published published
property LeftRightSpacing: integer read FLeftRightSpacing write SetLeftRightSpacing; property LeftRightSpacing: integer read FLeftRightSpacing write SetLeftRightSpacing;
@ -2728,7 +2728,7 @@ begin
Change; Change;
end; end;
constructor TControlChildSizing.Create(OwnerControl: TControl); constructor TControlChildSizing.Create(OwnerControl: TWinControl);
begin begin
FControl:=OwnerControl; FControl:=OwnerControl;
inherited Create; inherited Create;
@ -2784,6 +2784,7 @@ end;
procedure TControlChildSizing.Change; procedure TControlChildSizing.Change;
begin begin
Control.DoChildSizingChange(Self);
if Assigned(FOnChange) then FOnChange(Self); if Assigned(FOnChange) then FOnChange(Self);
end; end;

View File

@ -333,7 +333,8 @@ begin
if ChildCount[Orientation]>0 then begin if ChildCount[Orientation]>0 then begin
for i:=0 to ChildCount[Orientation]-1 do begin for i:=0 to ChildCount[Orientation]-1 do begin
CurChild:=Childs[Orientation][i]; CurChild:=Childs[Orientation][i];
// add border
// add border in Orientation
CurBorder:=CurChild.BorderLeftTop[Orientation]; CurBorder:=CurChild.BorderLeftTop[Orientation];
if i>0 then if i>0 then
CurBorder:=Max(Childs[Orientation][i-1].BorderRightBottom[Orientation], CurBorder:=Max(Childs[Orientation][i-1].BorderRightBottom[Orientation],
@ -352,6 +353,7 @@ begin
end; end;
inc(MinimumSize[Orientation],CurChild.MinimumSize[Orientation]); inc(MinimumSize[Orientation],CurChild.MinimumSize[Orientation]);
inc(PreferredSize[Orientation],CurChild.PreferredSize[Orientation]); inc(PreferredSize[Orientation],CurChild.PreferredSize[Orientation]);
// maximize in Orthogonal // maximize in Orthogonal
if MaximumSize[Orthogonal]>0 then begin if MaximumSize[Orthogonal]>0 then begin
if CurChild.MaximumSize[Orthogonal]>0 then if CurChild.MaximumSize[Orthogonal]>0 then
@ -364,6 +366,10 @@ begin
CurChild.MinimumSize[Orthogonal]); CurChild.MinimumSize[Orthogonal]);
PreferredSize[Orthogonal]:=Max(PreferredSize[Orthogonal], PreferredSize[Orthogonal]:=Max(PreferredSize[Orthogonal],
CurChild.PreferredSize[Orthogonal]); CurChild.PreferredSize[Orthogonal]);
BorderLeftTop[Orthogonal]:=Max(BorderLeftTop[Orthogonal],
CurChild.BorderLeftTop[Orthogonal]);
BorderRightBottom[Orthogonal]:=Max(BorderRightBottom[Orthogonal],
CurChild.BorderRightBottom[Orthogonal]);
end; end;
// last border // last border