mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-06-09 19:58:45 +02:00
LCL: Call GetPageClass when adding a TTabSheet in PageControl. Eliminate PageClass variable. Issue #34886.
git-svn-id: trunk@62136 -
This commit is contained in:
parent
6bb1d0f3da
commit
b13519cc85
@ -427,7 +427,6 @@ type
|
|||||||
AWidth: Integer; AReferenceHandle: TLCLHandle);
|
AWidth: Integer; AReferenceHandle: TLCLHandle);
|
||||||
procedure SetImageListAsync(Data: PtrInt);
|
procedure SetImageListAsync(Data: PtrInt);
|
||||||
protected
|
protected
|
||||||
PageClass: TCustomPageClass;
|
|
||||||
procedure DoAutoAdjustLayout(const AMode: TLayoutAdjustmentPolicy;
|
procedure DoAutoAdjustLayout(const AMode: TLayoutAdjustmentPolicy;
|
||||||
const AXProportion, AYProportion: Double); override;
|
const AXProportion, AYProportion: Double); override;
|
||||||
function GetPageClass: TCustomPageClass; virtual;
|
function GetPageClass: TCustomPageClass; virtual;
|
||||||
|
@ -150,7 +150,7 @@ begin
|
|||||||
NewOwner := FNotebook.Owner;
|
NewOwner := FNotebook.Owner;
|
||||||
if NewOwner = nil then
|
if NewOwner = nil then
|
||||||
NewOwner := FNotebook;
|
NewOwner := FNotebook;
|
||||||
NewPage := FNotebook.PageClass.Create(NewOwner);
|
NewPage := FNotebook.GetPageClass.Create(NewOwner);
|
||||||
with NewPage do
|
with NewPage do
|
||||||
Caption := S;
|
Caption := S;
|
||||||
|
|
||||||
@ -240,20 +240,13 @@ end;
|
|||||||
------------------------------------------------------------------------------}
|
------------------------------------------------------------------------------}
|
||||||
constructor TCustomTabControl.Create(TheOwner: TComponent);
|
constructor TCustomTabControl.Create(TheOwner: TComponent);
|
||||||
begin
|
begin
|
||||||
if PageClass=nil then PageClass := GetPageClass;
|
|
||||||
|
|
||||||
inherited Create(TheOwner);
|
inherited Create(TheOwner);
|
||||||
|
|
||||||
fCompStyle := csNoteBook;
|
fCompStyle := csNoteBook;
|
||||||
|
|
||||||
FAccess := GetListClass.Create(Self);
|
FAccess := GetListClass.Create(Self);
|
||||||
|
|
||||||
FImageListChangeLink := TChangeLink.Create;
|
FImageListChangeLink := TChangeLink.Create;
|
||||||
FImageListChangeLink.OnChange := @DoImageListChange;
|
FImageListChangeLink.OnChange := @DoImageListChange;
|
||||||
FImageListChangeLink.OnDestroyResolutionHandle := @DoImageListDestroyResolutionHandle;
|
FImageListChangeLink.OnDestroyResolutionHandle := @DoImageListDestroyResolutionHandle;
|
||||||
|
|
||||||
FPageIndex := -1;
|
FPageIndex := -1;
|
||||||
|
|
||||||
ControlStyle := []; // do not add csAcceptsControls
|
ControlStyle := []; // do not add csAcceptsControls
|
||||||
TabPosition := tpTop;
|
TabPosition := tpTop;
|
||||||
TabStop := true;
|
TabStop := true;
|
||||||
|
@ -112,7 +112,7 @@ end;
|
|||||||
|
|
||||||
function TPageControl.ChildClassAllowed(ChildClass: TClass): boolean;
|
function TPageControl.ChildClassAllowed(ChildClass: TClass): boolean;
|
||||||
begin
|
begin
|
||||||
Result:=(ChildClass<>nil) and (ChildClass.InheritsFrom(PageClass));
|
Result:=(ChildClass<>nil) and (ChildClass.InheritsFrom(GetPageClass));
|
||||||
if Widgetset.GetLCLCapability(lcAllowChildControlsInNativeControls) = LCL_CAPABILITY_YES then Result := True;
|
if Widgetset.GetLCLCapability(lcAllowChildControlsInNativeControls) = LCL_CAPABILITY_YES then Result := True;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
@ -189,7 +189,7 @@ end;
|
|||||||
// A Lazarus addition
|
// A Lazarus addition
|
||||||
function TPageControl.AddTabSheet: TTabSheet;
|
function TPageControl.AddTabSheet: TTabSheet;
|
||||||
begin
|
begin
|
||||||
Result := TTabSheet.Create(Self);
|
Result := GetPageClass.Create(Self) as TTabSheet;
|
||||||
Result.PageControl := Self;
|
Result.PageControl := Self;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
@ -170,9 +170,9 @@ type
|
|||||||
procedure SetActiveNotebookPageComponent(const AValue: TLazDockPage);
|
procedure SetActiveNotebookPageComponent(const AValue: TLazDockPage);
|
||||||
protected
|
protected
|
||||||
function GetFloatingDockSiteClass: TWinControlClass; override;
|
function GetFloatingDockSiteClass: TWinControlClass; override;
|
||||||
|
function GetPageClass: TCustomPageClass; override;
|
||||||
procedure Change; override;
|
procedure Change; override;
|
||||||
public
|
public
|
||||||
constructor Create(TheOwner: TComponent); override;
|
|
||||||
property Page[Index: Integer]: TLazDockPage read GetNoteBookPage;
|
property Page[Index: Integer]: TLazDockPage read GetNoteBookPage;
|
||||||
property ActivePageComponent: TLazDockPage read GetActiveNotebookPageComponent
|
property ActivePageComponent: TLazDockPage read GetActiveNotebookPageComponent
|
||||||
write SetActiveNotebookPageComponent;
|
write SetActiveNotebookPageComponent;
|
||||||
@ -766,8 +766,7 @@ begin
|
|||||||
Result:=TLazDockPage(inherited Page[Index]);
|
Result:=TLazDockPage(inherited Page[Index]);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TLazDockPages.SetActiveNotebookPageComponent(
|
procedure TLazDockPages.SetActiveNotebookPageComponent(const AValue: TLazDockPage);
|
||||||
const AValue: TLazDockPage);
|
|
||||||
begin
|
begin
|
||||||
ActivePageComponent:=AValue;
|
ActivePageComponent:=AValue;
|
||||||
end;
|
end;
|
||||||
@ -777,18 +776,17 @@ begin
|
|||||||
Result:=TLazDockForm;
|
Result:=TLazDockForm;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
function TLazDockPages.GetPageClass: TCustomPageClass;
|
||||||
|
begin
|
||||||
|
Result:=TLazDockPage;
|
||||||
|
end;
|
||||||
|
|
||||||
procedure TLazDockPages.Change;
|
procedure TLazDockPages.Change;
|
||||||
begin
|
begin
|
||||||
inherited Change;
|
inherited Change;
|
||||||
TLazDockForm.UpdateMainControlInParents(Self);
|
TLazDockForm.UpdateMainControlInParents(Self);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
constructor TLazDockPages.Create(TheOwner: TComponent);
|
|
||||||
begin
|
|
||||||
PageClass := TLazDockPage;
|
|
||||||
inherited Create(TheOwner);
|
|
||||||
end;
|
|
||||||
|
|
||||||
{ TLazDockTree }
|
{ TLazDockTree }
|
||||||
|
|
||||||
procedure TLazDockTree.UndockControlForDocking(AControl: TControl);
|
procedure TLazDockTree.UndockControlForDocking(AControl: TControl);
|
||||||
|
Loading…
Reference in New Issue
Block a user