1
0
Fork 0
mirror of https://github.com/beefytech/Beef.git synced 2025-06-13 22:04:09 +02:00

Should work for all tabs now.

This commit is contained in:
blat-blatnik 2021-12-01 00:21:12 +01:00
parent 318cb6524d
commit 0e0a989e8e
3 changed files with 5 additions and 5 deletions

View file

@ -398,12 +398,12 @@ namespace Beefy.theme.dark
func(mRightTab); func(mRightTab);
} }
public override TabButton AddTab(String label, float width, Widget content, bool ownsContent) public override TabButton AddTab(String label, float width, Widget content, bool ownsContent, int insertIdx)
{ {
float useWidth = width; float useWidth = width;
if (useWidth == 0) if (useWidth == 0)
useWidth = DarkTheme.sDarkTheme.mSmallFont.GetWidth(label) + GS!(30); useWidth = DarkTheme.sDarkTheme.mSmallFont.GetWidth(label) + GS!(30);
return base.AddTab(label, useWidth, content, ownsContent); return base.AddTab(label, useWidth, content, ownsContent, insertIdx);
} }
public override void RemoveTab(TabButton tabButton, bool deleteTab = true) public override void RemoveTab(TabButton tabButton, bool deleteTab = true)

View file

@ -472,7 +472,7 @@ namespace Beefy.widgets
return activeTab; return activeTab;
} }
public virtual TabButton AddTab(String label, float width, Widget content, bool ownsContent) public virtual TabButton AddTab(String label, float width, Widget content, bool ownsContent, int insertIdx)
{ {
TabButton aTabButton = CreateTabButton(); TabButton aTabButton = CreateTabButton();
aTabButton.mTabbedView = this; aTabButton.mTabbedView = this;
@ -481,7 +481,7 @@ namespace Beefy.widgets
aTabButton.mWantWidth = width; aTabButton.mWantWidth = width;
aTabButton.mHeight = mTabHeight; aTabButton.mHeight = mTabHeight;
aTabButton.mContent = content; aTabButton.mContent = content;
AddTab(aTabButton, 0); AddTab(aTabButton, insertIdx);
return aTabButton; return aTabButton;
} }

View file

@ -5807,7 +5807,7 @@ namespace IDE
TabbedView.TabButton SetupTab(TabbedView tabView, String name, float width, Widget content, bool ownsContent) // 2 TabbedView.TabButton SetupTab(TabbedView tabView, String name, float width, Widget content, bool ownsContent) // 2
{ {
TabbedView.TabButton tabButton = tabView.AddTab(name, width, content, ownsContent); TabbedView.TabButton tabButton = tabView.AddTab(name, width, content, ownsContent, GetTabInsertIndex(tabView));
if ((var panel = content as Panel) && (var darkTabButton = tabButton as DarkTabbedView.DarkTabButton)) if ((var panel = content as Panel) && (var darkTabButton = tabButton as DarkTabbedView.DarkTabButton))
{ {
darkTabButton.mTabWidthOffset = panel.TabWidthOffset; darkTabButton.mTabWidthOffset = panel.TabWidthOffset;