mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-08-18 23:59:10 +02:00
Cocoa/TabControl: TCocoaTabControl.exttabRemoveTabViewItem() improved
This commit is contained in:
parent
51f7942433
commit
62d199c399
@ -24,7 +24,7 @@ interface
|
|||||||
|
|
||||||
uses
|
uses
|
||||||
// rtl+ftl
|
// rtl+ftl
|
||||||
Types, Classes, SysUtils,
|
Types, Classes, SysUtils, Math,
|
||||||
CGGeometry,
|
CGGeometry,
|
||||||
// Libs
|
// Libs
|
||||||
MacOSAll, CocoaAll, CocoaUtils, //CocoaGDIObjects,
|
MacOSAll, CocoaAll, CocoaUtils, //CocoaGDIObjects,
|
||||||
@ -844,17 +844,20 @@ begin
|
|||||||
UpdateTabAndArrowVisibility( self );
|
UpdateTabAndArrowVisibility( self );
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TCocoaTabControl.exttabRemoveTabViewItem(lTabPage: NSTabViewItem);
|
procedure TCocoaTabControl.exttabRemoveTabViewItem( lTabPage: NSTabViewItem );
|
||||||
var
|
var
|
||||||
idx : NSInteger;
|
removedIndex: Integer;
|
||||||
begin
|
begin
|
||||||
idx := indexOfTabViewItem(lTabPage);
|
removedIndex := exttabIndexOfTabViewItem( lTabPage );
|
||||||
if (idx>=0) and (idx<>NSNotFound) then
|
fulltabs.removeObject( lTabPage );
|
||||||
removeTabViewItem(lTabPage);
|
if InRange(removedIndex, visibleLeftIndex, visibleRightIndex) then begin
|
||||||
|
removeTabViewItem( lTabPage );
|
||||||
fulltabs.removeObject(lTabPage);
|
leftKeepAmount:= currentIndex - visibleLeftIndex;
|
||||||
|
end else begin
|
||||||
UpdateTabAndArrowVisibility(self);
|
if removedIndex < currentIndex then
|
||||||
|
dec( currentIndex );
|
||||||
|
end;
|
||||||
|
UpdateTabAndArrowVisibility( self );
|
||||||
end;
|
end;
|
||||||
|
|
||||||
function TCocoaTabControl.exttabIndexOfTabViewItem(lTabPage: NSTabViewItem
|
function TCocoaTabControl.exttabIndexOfTabViewItem(lTabPage: NSTabViewItem
|
||||||
|
Loading…
Reference in New Issue
Block a user