1{%MainUnit ../comctrls.pp}
2
3{******************************************************************************
4                                  TTabSheet
5 ******************************************************************************
6
7  Author: Mattias Gaertner
8
9 *****************************************************************************
10  This file is part of the Lazarus Component Library (LCL)
11
12  See the file COPYING.modifiedLGPL.txt, included in this distribution,
13  for details about the license.
14 *****************************************************************************
15}
16
17{ TTabSheet }
18
19function TTabSheet.GetTabIndex: Integer;
20var
21  i: Integer;
22begin
23  if not TabVisible then
24    Result := -1
25  else
26  begin
27    Result := 0;
28    for i := 0 to PageIndex - 1 do
29      if PageControl.Pages[i].TabVisible then
30        inc(Result);
31  end;
32end;
33
34function TTabSheet.GetPageControl: TPageControl;
35begin
36  if (Parent is TPageControl) then
37    Result := TPageControl(Parent)
38  else
39    Result := nil;
40end;
41
42procedure TTabSheet.SetPageControl(APageControl: TPageControl);
43begin
44  if PageControl=APageControl then exit;
45  Parent:=APageControl;
46end;
47
48class procedure TTabSheet.WSRegisterClass;
49begin
50  RegisterPropertyToSkip(TTabSheet, 'Visible', 'Use TabVisible instead.', '');
51  inherited WSRegisterClass;
52  RegisterTabSheet;
53end;
54
55constructor TTabSheet.Create(TheOwner: TComponent);
56begin
57  inherited Create(TheOwner);
58end;
59
60destructor TTabSheet.Destroy;
61begin
62  if (ControlCount = 1) and (Controls[0].HostDockSite <> nil) then
63    Controls[0].HostDockSite := nil;
64  inherited Destroy;
65end;
66
67// included by comctrls.pp
68