mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-08-17 04:29:28 +02:00
Cocoa/TabControl: #40050 Merge branch 'cocoa/tabcontrol', scrolling is supported when TabPosition:=tpBottom
This commit is contained in:
parent
748351eb53
commit
71e85eb4d5
@ -67,6 +67,7 @@ type
|
|||||||
class function alloc: id; override;
|
class function alloc: id; override;
|
||||||
procedure dealloc; override;
|
procedure dealloc; override;
|
||||||
procedure setFrame(aframe: NSRect); override;
|
procedure setFrame(aframe: NSRect); override;
|
||||||
|
procedure setTabViewType(newValue: NSTabViewType); override;
|
||||||
// lcl
|
// lcl
|
||||||
function lclIsEnabled: Boolean; override;
|
function lclIsEnabled: Boolean; override;
|
||||||
procedure lclSetEnabled(AEnabled: Boolean); override;
|
procedure lclSetEnabled(AEnabled: Boolean); override;
|
||||||
@ -191,8 +192,15 @@ var
|
|||||||
begin
|
begin
|
||||||
if not assigned(abtn) then Exit;
|
if not assigned(abtn) then Exit;
|
||||||
|
|
||||||
if isPrev then org:=NSMakePoint(arrow_hofs, arrow_vofs)
|
if dst.tabViewType = NSTopTabsBezelBorder then
|
||||||
else org:=NSMakePoint(dst.frame.size.width - abtn.frame.size.width - arrow_hofs , arrow_vofs);
|
org.y := arrow_vofs
|
||||||
|
else
|
||||||
|
org.y := dst.frame.size.height - abtn.frame.size.height - arrow_vofs;
|
||||||
|
|
||||||
|
if isPrev then
|
||||||
|
org.x := arrow_hofs
|
||||||
|
else
|
||||||
|
org.x := dst.frame.size.width - abtn.frame.size.width - arrow_hofs;
|
||||||
|
|
||||||
abtn.setFrameOrigin(org);
|
abtn.setFrameOrigin(org);
|
||||||
end;
|
end;
|
||||||
@ -208,10 +216,6 @@ begin
|
|||||||
aview.prevarr.setAction( ObjCSelector('extTabPrevButtonClick:'));
|
aview.prevarr.setAction( ObjCSelector('extTabPrevButtonClick:'));
|
||||||
aview.nextarr.setTarget(aview);
|
aview.nextarr.setTarget(aview);
|
||||||
aview.nextarr.setAction( ObjCSelector('extTabNextButtonClick:'));
|
aview.nextarr.setAction( ObjCSelector('extTabNextButtonClick:'));
|
||||||
|
|
||||||
|
|
||||||
PlaceButton(true, aview.prevarr, aview);
|
|
||||||
PlaceButton(false, aview.nextarr, aview);
|
|
||||||
end;
|
end;
|
||||||
|
|
||||||
// only missing ViewItems inserted, RemoveAllTabs() is no longer needed,
|
// only missing ViewItems inserted, RemoveAllTabs() is no longer needed,
|
||||||
@ -260,6 +264,9 @@ begin
|
|||||||
ShowPrev := false;
|
ShowPrev := false;
|
||||||
ShowNext := false;
|
ShowNext := false;
|
||||||
|
|
||||||
|
// ReviseTabs() supports tpTop and tpBottom only
|
||||||
|
if (aview.tabViewType=NSLeftTabsBezelBorder) or (aview.tabViewType=NSRightTabsBezelBorder) then exit;
|
||||||
|
|
||||||
if aview.fulltabs.count=0 then exit;
|
if aview.fulltabs.count=0 then exit;
|
||||||
|
|
||||||
// AttachAllTabs() has been modified to not remove the selectedTabViewItem first,
|
// AttachAllTabs() has been modified to not remove the selectedTabViewItem first,
|
||||||
@ -330,17 +337,23 @@ var
|
|||||||
begin
|
begin
|
||||||
ReviseTabs(aview, showPrev, showNExt);
|
ReviseTabs(aview, showPrev, showNExt);
|
||||||
if Assigned(aview.prevarr) then
|
if Assigned(aview.prevarr) then
|
||||||
|
begin
|
||||||
|
PlaceButton(true, aview.prevarr, aview);
|
||||||
{$ifdef BOOLFIX}
|
{$ifdef BOOLFIX}
|
||||||
aview.prevarr.setHidden_(Ord(not showPrev));
|
aview.prevarr.setHidden_(Ord(not showPrev));
|
||||||
{$else}
|
{$else}
|
||||||
aview.prevarr.setHidden(not showPrev);
|
aview.prevarr.setHidden(not showPrev);
|
||||||
{$endif}
|
{$endif}
|
||||||
|
end;
|
||||||
if Assigned(aview.nextarr) then
|
if Assigned(aview.nextarr) then
|
||||||
|
begin
|
||||||
|
PlaceButton(false, aview.nextarr, aview);
|
||||||
{$ifdef BOOLFIX}
|
{$ifdef BOOLFIX}
|
||||||
aview.nextarr.setHidden_(Ord(not showNext));
|
aview.nextarr.setHidden_(Ord(not showNext));
|
||||||
{$else}
|
{$else}
|
||||||
aview.nextarr.setHidden(not showNext);
|
aview.nextarr.setHidden(not showNext);
|
||||||
{$endif}
|
{$endif}
|
||||||
|
end;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
function IndexOfTab(ahost: TCocoaTabControl; atab: NSTabViewItem): Integer;
|
function IndexOfTab(ahost: TCocoaTabControl; atab: NSTabViewItem): Integer;
|
||||||
@ -440,6 +453,12 @@ begin
|
|||||||
UpdateTabAndArrowVisibility(self);
|
UpdateTabAndArrowVisibility(self);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
procedure TCocoaTabControl.setTabViewType(newValue: NSTabViewType);
|
||||||
|
begin
|
||||||
|
Inherited;
|
||||||
|
UpdateTabAndArrowVisibility(self);
|
||||||
|
end;
|
||||||
|
|
||||||
procedure TCocoaTabControl.extselectTabViewItemAtIndex(index: NSInteger);
|
procedure TCocoaTabControl.extselectTabViewItemAtIndex(index: NSInteger);
|
||||||
var
|
var
|
||||||
idx : integer;
|
idx : integer;
|
||||||
|
@ -911,12 +911,11 @@ end;
|
|||||||
class procedure TCocoaWSCustomTabControl.SetTabPosition(const ATabControl: TCustomTabControl; const ATabPosition: TTabPosition);
|
class procedure TCocoaWSCustomTabControl.SetTabPosition(const ATabControl: TCustomTabControl; const ATabPosition: TTabPosition);
|
||||||
var
|
var
|
||||||
lTabControl: TCocoaTabControl = nil;
|
lTabControl: TCocoaTabControl = nil;
|
||||||
lOldTabStyle, lTabStyle: NSTabViewType;
|
lTabStyle: NSTabViewType;
|
||||||
begin
|
begin
|
||||||
if not Assigned(ATabControl) or not ATabControl.HandleAllocated then Exit;
|
if not Assigned(ATabControl) or not ATabControl.HandleAllocated then Exit;
|
||||||
lTabControl := TCocoaTabControl(ATabControl.Handle);
|
lTabControl := TCocoaTabControl(ATabControl.Handle);
|
||||||
|
|
||||||
lOldTabStyle := lTabControl.tabViewType();
|
|
||||||
lTabStyle := LCLTabPosToNSTabStyle(ATabControl.ShowTabs, ATabControl.BorderWidth, ATabPosition);
|
lTabStyle := LCLTabPosToNSTabStyle(ATabControl.ShowTabs, ATabControl.BorderWidth, ATabPosition);
|
||||||
lTabControl.setTabViewType(lTabStyle);
|
lTabControl.setTabViewType(lTabStyle);
|
||||||
end;
|
end;
|
||||||
|
Loading…
Reference in New Issue
Block a user