1
0
Fork 0
mirror of https://github.com/beefytech/Beef.git synced 2025-06-29 12:55:59 +02:00

Right-click close options for tabs

This commit is contained in:
Brian Fiete 2020-09-11 23:26:59 -07:00
parent 578e513196
commit c04778ec5a
3 changed files with 44 additions and 34 deletions

View file

@ -390,6 +390,37 @@ namespace Beefy.widgets
return ThemeFactory.mDefault.CreateTabbedView(sharedData);
}
public void CloseTabs(bool autoClose, bool closeCurrent)
{
let prevAutoClose = mAutoClose;
mAutoClose = autoClose;
var tabs = scope List<TabButton>();
for (var tab in mTabs)
tabs.Add(tab);
if (tabs.IsEmpty)
{
if (autoClose)
{
if (var dockingFrame = mParent as DockingFrame)
{
dockingFrame.RemoveDockedWidget(this);
BFApp.sApp.DeferDelete(this);
}
}
}
else
{
for (var tab in tabs)
{
if ((!closeCurrent) && (tab.mIsActive))
continue;
tab.mCloseClickedEvent();
}
}
mAutoClose = prevAutoClose;
}
public void Closed()
{
mSharedData.mTabbedViewClosed(this);