IDE: change PageComponent type from TComponent to TCustomPage. Eliminate type-casts etc.

git-svn-id: trunk@42731 -
This commit is contained in:
juha 2013-09-11 06:21:22 +00:00
parent 7377ec04d1
commit e9417175c1
2 changed files with 6 additions and 18 deletions

View File

@ -23,7 +23,7 @@ unit ComponentReg;
interface
uses
Classes, SysUtils, typinfo, Controls, LazarusPackageIntf, LCLProc;
Classes, SysUtils, typinfo, Controls, ComCtrls, LazarusPackageIntf, LCLProc;
type
TComponentPriorityCategory = (
@ -91,7 +91,7 @@ type
TBaseComponentPage = class
private
FItems: TList; // list of TRegisteredComponent
FPageComponent: TComponent;
FPageComponent: TCustomPage;
FPageName: string;
FPalette: TBaseComponentPalette;
FPriority: TComponentPriority;
@ -119,7 +119,7 @@ type
property PageName: string read FPageName;
property Palette: TBaseComponentPalette read FPalette;
property Priority: TComponentPriority read FPriority write FPriority;
property PageComponent: TComponent read FPageComponent write FPageComponent;
property PageComponent: TCustomPage read FPageComponent write FPageComponent;
property SelectButton: TComponent read FSelectButton write FSelectButton;
property Visible: boolean read FVisible write SetVisible;
end;

View File

@ -644,11 +644,7 @@ var
SortedCompList.Insert(i+1, aComponent);
end;
{$IFDEF NEW_MAIN_IDE_TABS}
procedure RemoveUnneededPage(aSheet: TCustomPage);
{$ELSE}
procedure RemoveUnneededPage(aSheet: TTabSheet);
{$ENDIF}
var
PageIndex: Integer;
CurPage: TBaseComponentPage;
@ -690,19 +686,11 @@ var
BorderWidth := 0;
HorzScrollBar.Visible := false;
VertScrollBar.Increment := ComponentPaletteBtnHeight;
{$IFDEF NEW_MAIN_IDE_TABS}
Parent := TCustomPage(aCompPage.PageComponent);
{$ELSE}
Parent := TTabSheet(aCompPage.PageComponent);
{$ENDIF}
Parent := aCompPage.PageComponent;
end;
end else begin
// move to the right position
{$IFDEF NEW_MAIN_IDE_TABS}
CurPageIndex := TCustomPage(aCompPage.PageComponent).PageIndex;
{$ELSE}
CurPageIndex := TTabSheet(aCompPage.PageComponent).PageIndex;
{$ENDIF}
CurPageIndex := aCompPage.PageComponent.PageIndex;
if CurPageIndex<>aVisPageIndex then
TCustomTabControl(FPageControl).Pages.Move(CurPageIndex, aVisPageIndex);
end;
@ -783,7 +771,7 @@ var
CurScrollBox: TScrollBox;
begin
if aCompPage.Visible then begin
CurNoteBookPage := aCompPage.PageComponent as TCustomPage;
CurNoteBookPage := aCompPage.PageComponent;
CurNoteBookPage.OnResize := @OnPageResize;
CurScrollBox := CurNoteBookPage.Components[0] as TScrollBox;
//DebugLn(['TComponentPalette.UpdateNoteBookButtons PAGE=',aCompPage.PageName,' PageIndex=',CurNoteBookPage.PageIndex]);