mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-12-05 21:37:18 +01:00
cocoa: Implements PageControl.ShowTabs, TabPosition and BorderWidth
git-svn-id: trunk@48678 -
This commit is contained in:
parent
8ba395693c
commit
6fac29b917
@ -52,6 +52,8 @@ type
|
|||||||
{ TCocoaWSCustomTabControl }
|
{ TCocoaWSCustomTabControl }
|
||||||
|
|
||||||
TCocoaWSCustomTabControl = class(TWSCustomTabControl)
|
TCocoaWSCustomTabControl = class(TWSCustomTabControl)
|
||||||
|
private
|
||||||
|
class function LCLTabPosToNSTabStyle(AShowTabs: Boolean; ABorderWidth: Integer; ATabPos: TTabPosition): NSTabViewType;
|
||||||
published
|
published
|
||||||
class function CreateHandle(const AWinControl: TWinControl; const AParams: TCreateParams): TLCLIntfHandle; override;
|
class function CreateHandle(const AWinControl: TWinControl; const AParams: TCreateParams): TLCLIntfHandle; override;
|
||||||
|
|
||||||
@ -64,8 +66,8 @@ type
|
|||||||
//class function GetPageRealIndex(const ATabControl: TCustomTabControl; AIndex: Integer): Integer; override;
|
//class function GetPageRealIndex(const ATabControl: TCustomTabControl; AIndex: Integer): Integer; override;
|
||||||
class function GetTabIndexAtPos(const ATabControl: TCustomTabControl; const AClientPos: TPoint): integer; override;
|
class function GetTabIndexAtPos(const ATabControl: TCustomTabControl; const AClientPos: TPoint): integer; override;
|
||||||
class procedure SetPageIndex(const ATabControl: TCustomTabControl; const AIndex: integer); override;
|
class procedure SetPageIndex(const ATabControl: TCustomTabControl; const AIndex: integer); override;
|
||||||
//class procedure SetTabPosition(const ATabControl: TCustomTabControl; const ATabPosition: TTabPosition); override;
|
class procedure SetTabPosition(const ATabControl: TCustomTabControl; const ATabPosition: TTabPosition); override;
|
||||||
//class procedure ShowTabs(const ATabControl: TCustomTabControl; AShowTabs: boolean); override;
|
class procedure ShowTabs(const ATabControl: TCustomTabControl; AShowTabs: boolean); override;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
{ TCocoaWSPageControl }
|
{ TCocoaWSPageControl }
|
||||||
@ -330,11 +332,39 @@ end;
|
|||||||
|
|
||||||
{ TCocoaWSCustomTabControl }
|
{ TCocoaWSCustomTabControl }
|
||||||
|
|
||||||
|
class function TCocoaWSCustomTabControl.LCLTabPosToNSTabStyle(AShowTabs: Boolean; ABorderWidth: Integer; ATabPos: TTabPosition): NSTabViewType;
|
||||||
|
begin
|
||||||
|
Result := NSTopTabsBezelBorder;
|
||||||
|
if AShowTabs then
|
||||||
|
begin
|
||||||
|
case ATabPos of
|
||||||
|
tpTop: Result := NSTopTabsBezelBorder;
|
||||||
|
tpBottom: Result := NSBottomTabsBezelBorder;
|
||||||
|
tpLeft: Result := NSLeftTabsBezelBorder;
|
||||||
|
tpRight: Result := NSRightTabsBezelBorder;
|
||||||
|
end;
|
||||||
|
end
|
||||||
|
else
|
||||||
|
begin
|
||||||
|
if ABorderWidth = 0 then
|
||||||
|
Result := NSNoTabsNoBorder
|
||||||
|
else if ABorderWidth = 1 then
|
||||||
|
Result := NSNoTabsLineBorder
|
||||||
|
else
|
||||||
|
Result := NSNoTabsBezelBorder;
|
||||||
|
end;
|
||||||
|
end;
|
||||||
|
|
||||||
class function TCocoaWSCustomTabControl.CreateHandle(const AWinControl: TWinControl; const AParams: TCreateParams): TLCLIntfHandle;
|
class function TCocoaWSCustomTabControl.CreateHandle(const AWinControl: TWinControl; const AParams: TCreateParams): TLCLIntfHandle;
|
||||||
var
|
var
|
||||||
lControl: TCocoaTabControl;
|
lControl: TCocoaTabControl;
|
||||||
|
lTabControl: TCustomTabControl = nil;
|
||||||
|
lTabStyle: NSTabViewType = NSTopTabsBezelBorder;
|
||||||
begin
|
begin
|
||||||
|
lTabControl := TCustomTabControl(AWinControl);
|
||||||
lControl := TCocoaTabControl.alloc.lclInitWithCreateParams(AParams);
|
lControl := TCocoaTabControl.alloc.lclInitWithCreateParams(AParams);
|
||||||
|
lTabStyle := LCLTabPosToNSTabStyle(lTabControl.ShowTabs, lTabControl.BorderWidth, lTabControl.TabPosition);
|
||||||
|
lControl.setTabViewType(lTabStyle);
|
||||||
Result := TLCLIntfHandle(lControl);
|
Result := TLCLIntfHandle(lControl);
|
||||||
if Result <> 0 then
|
if Result <> 0 then
|
||||||
begin
|
begin
|
||||||
@ -428,6 +458,32 @@ begin
|
|||||||
lTabControl.selectTabViewItemAtIndex(AIndex);
|
lTabControl.selectTabViewItemAtIndex(AIndex);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
class procedure TCocoaWSCustomTabControl.SetTabPosition(const ATabControl: TCustomTabControl; const ATabPosition: TTabPosition);
|
||||||
|
var
|
||||||
|
lTabControl: TCocoaTabControl = nil;
|
||||||
|
lOldTabStyle, lTabStyle: NSTabViewType;
|
||||||
|
begin
|
||||||
|
if not Assigned(ATabControl) or not ATabControl.HandleAllocated then Exit;
|
||||||
|
lTabControl := TCocoaTabControl(ATabControl.Handle);
|
||||||
|
|
||||||
|
lOldTabStyle := lTabControl.tabViewType();
|
||||||
|
lTabStyle := LCLTabPosToNSTabStyle(ATabControl.ShowTabs, ATabControl.BorderWidth, ATabPosition);
|
||||||
|
lTabControl.setTabViewType(lTabStyle);
|
||||||
|
end;
|
||||||
|
|
||||||
|
class procedure TCocoaWSCustomTabControl.ShowTabs(const ATabControl: TCustomTabControl; AShowTabs: boolean);
|
||||||
|
var
|
||||||
|
lTabControl: TCocoaTabControl = nil;
|
||||||
|
lOldTabStyle, lTabStyle: NSTabViewType;
|
||||||
|
begin
|
||||||
|
if not Assigned(ATabControl) or not ATabControl.HandleAllocated then Exit;
|
||||||
|
lTabControl := TCocoaTabControl(ATabControl.Handle);
|
||||||
|
|
||||||
|
lOldTabStyle := lTabControl.tabViewType();
|
||||||
|
lTabStyle := LCLTabPosToNSTabStyle(AShowTabs, ATabControl.BorderWidth, ATabControl.TabPosition);
|
||||||
|
lTabControl.setTabViewType(lTabStyle);
|
||||||
|
end;
|
||||||
|
|
||||||
{ TCocoaWSCustomListView }
|
{ TCocoaWSCustomListView }
|
||||||
|
|
||||||
class function TCocoaWSCustomListView.CheckParams(
|
class function TCocoaWSCustomListView.CheckParams(
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user