customdrawn: Many small pagecontrol fixes

git-svn-id: trunk@33263 -
This commit is contained in:
sekelsenmat 2011-11-03 13:44:24 +00:00
parent 0abff19f7a
commit 9a0bc7076f
2 changed files with 17 additions and 4 deletions

View File

@ -381,7 +381,8 @@ type
destructor Destroy; override;
function InsertPage(aIndex: integer; S: string): TCDTabSheet;
procedure RemovePage(aIndex: integer);
function AddPage(S: string): TCDTabSheet;
function AddPage(S: string): TCDTabSheet; overload;
procedure AddPage(APage: TCDTabSheet); overload;
function GetPage(aIndex: integer): TCDTabSheet;
property PageCount: integer read GetPageCount;
// Used by the property editor in customdrawnextras
@ -1268,7 +1269,11 @@ end;
procedure TCDTabSheet.SetParent(NewParent: TWinControl);
begin
inherited SetParent(NewParent);
CDTabControl := NewParent as TCDCustomTabControl;
if (NewParent <> nil) and (NewParent is TCDPageControl) then
begin
CDTabControl := NewParent as TCDCustomTabControl;
TCDPageControl(CDTabControl).AddPage(Self);
end;
end;
constructor TCDTabSheet.Create(AOwner: TComponent);
@ -1342,6 +1347,14 @@ begin
Result := NewPage;
end;
procedure TCDPageControl.AddPage(APage: TCDTabSheet);
begin
APage.CDTabControl := Self;
PositionTabSheet(APage);
FTabs.AddObject(APage.Caption, APage);
SetActivePage(APage);
end;
function TCDPageControl.GetPage(AIndex: integer): TCDTabSheet;
begin
if (AIndex >= 0) and (AIndex < FTabs.Count) then
@ -1503,9 +1516,10 @@ procedure TCDPageControl.PositionTabSheet(ATabSheet: TCDTabSheet);
var
lTabHeight, lIndex: Integer;
begin
// ATabSheet.SetBounds(1, 32 + 1, Width - 3, Height - 32 - 4);
lIndex := FTabs.IndexOfObject(ATabSheet);
FTabCState.TabIndex := lIndex;
PrepareControlState;
PrepareControlStateEx;
lTabHeight := FDrawer.GetMeasuresEx(Canvas, TCDCTABCONTROL_TAB_HEIGHT, FState, FStateEx);
ATabSheet.BorderSpacing.Top := lTabHeight;
ATabSheet.BorderSpacing.Left := 2;

View File

@ -25,7 +25,6 @@ procedure GradCenterFill(Canvas: TFPCustomCanvas; aRect: TRect;
procedure DrawAndroidButton(Canvas: TCanvas; Color: TColor);
procedure DrawXPTaskbarButton(Canvas: TCanvas; Color: TColor);
procedure FPImgCloneRect(IntfImg1, IntfImg2: TLazIntfImage; lRect: TRect; Fast: boolean);
function GetUniqueName(const Name: string; PControl: TComponent): string;
procedure DrawArrow(aDest: TFPCustomCanvas; aRect: TRect; R: boolean);
procedure DrawCDButtonDown(Canvas: TCanvas; ABackgroundColor: TColor);