mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-08-28 16:40:48 +02:00
Cocoa/TabControl: new TCocoaTabControl.attachAllTabs() added
This commit is contained in:
parent
d55f353980
commit
f7f153694c
@ -59,6 +59,9 @@ type
|
||||
|
||||
public
|
||||
currentIndex : Integer; // index of the current tab shown
|
||||
procedure attachAllTabs; message 'attachAllTabs';
|
||||
|
||||
public
|
||||
callback: ITabControlCallback;
|
||||
|
||||
fulltabs : NSMutableArray; // the full list of NSTabViewItems
|
||||
@ -440,6 +443,28 @@ end;
|
||||
|
||||
{ TCocoaTabControl }
|
||||
|
||||
// by ensuring that selectedTabViewItem cannot be removed
|
||||
// and tabView_didSelectTabViewItem is not triggered anymore
|
||||
procedure TCocoaTabControl.attachAllTabs;
|
||||
var
|
||||
i : integer;
|
||||
itm: NSTabViewItem;
|
||||
begin
|
||||
// only selectedItem reserved
|
||||
for itm{%H-} in tabViewItems do begin
|
||||
if itm <> selectedTabViewItem then
|
||||
removeTabViewItem( itm );
|
||||
end;
|
||||
|
||||
// insert all tabs in the order of fulltabs again
|
||||
i:= 0;
|
||||
for itm{%H-} in fulltabs do begin
|
||||
if itm <> selectedTabViewItem then
|
||||
insertTabViewItem_atIndex( itm, i );
|
||||
inc( i );
|
||||
end;
|
||||
end;
|
||||
|
||||
class function TCocoaTabControl.alloc: id;
|
||||
begin
|
||||
Result := inherited alloc;
|
||||
|
Loading…
Reference in New Issue
Block a user