Class TabContainer
- Namespace
- Forma
- Assembly
- Forma.dll
Displays one child page at a time and provides tabs for switching the selected page.
public sealed class TabContainer : TemplatedControl, IAddChild<Control>, IAddChild, INotifyPropertyChanged, IDisposable
- Inheritance
-
TabContainer
- Implements
- Inherited Members
Constructors
TabContainer()
public TabContainer()
Properties
AccessibilityRole
public override AccessibilityRole AccessibilityRole { get; }
Property Value
ContentPadding
Insets the selected page from the tab body chrome.
public Thickness ContentPadding { get; set; }
Property Value
CurrentTab
public int CurrentTab { get; set; }
Property Value
DeselectEnabled
Allows CurrentTab to become -1, matching Godot's deselect_enabled property.
public bool DeselectEnabled { get; set; }
Property Value
DragToRearrangeEnabled
public bool DragToRearrangeEnabled { get; set; }
Property Value
Font
public SpriteFont Font { get; set; }
Property Value
- SpriteFont
MaxTabScroll
The largest useful TabScrollOffset: zero when every tab fits.
public int MaxTabScroll { get; }
Property Value
MaxTabWidth
A ceiling on any one tab's width, or zero for none. A long file name is truncated rather than pushing every other tab off the strip.
public int MaxTabWidth { get; set; }
Property Value
TabAlignment
Where the tabs sit when they do not fill the strip. Ignored when they do.
public TabBarAlignment TabAlignment { get; set; }
Property Value
TabHeight
Minimum tab-header height. The effective height grows to fit the active font with balanced vertical padding.
public float TabHeight { get; set; }
Property Value
TabScrollOffset
How far the tab strip is scrolled sideways, in pixels. Zero unless the tabs overflow.
public int TabScrollOffset { get; set; }
Property Value
Remarks
Tabs keep their natural width and the strip scrolls, rather than the tabs shrinking to fit: a strip of twenty documents squeezed into the window is a strip of twenty titles nobody can read. The tab clipped at the edge is what says there is more, which is what VS Code does and costs none of an already short strip's height.
TabSizing
Enables pointer drag reordering of tab pages, like Godot's TabContainer.
public TabBarSizingMode TabSizing { get; set; }
Property Value
Remarks
This used to be Justify with no way out: every tab took an equal share of the full width, so two tabs each took half the window however short their titles. TabBar has offered the choice since it was written, and a container that wraps the same idea should not answer differently.
The modes match TabSizing: fit to content, uniform at the widest tab's size, justify to fill regardless of content, or expand -- fit to content, then share out any leftover.
TabsRearrangeGroup
Optional group identifier reserved for compatibility with Godot tab-container rearrangement groups.
public int TabsRearrangeGroup { get; set; }
Property Value
UIFont
public UIFont UIFont { get; set; }
Property Value
Methods
ArrangeChildren()
protected override void ArrangeChildren()
GetCurrentTabControl()
Returns the currently selected page Control, or null when deselected, matching Godot's get_current_tab_control.
public Control GetCurrentTabControl()
Returns
GetDeselectEnabled()
public bool GetDeselectEnabled()
Returns
GetMinimumSize()
Matches Godot's TabContainer::_get_minimum_size: the tab-bar height plus (by default) only the CURRENT page's minimum size, not the max over every page - Godot only folds in every page when use_hidden_tabs_for_min_size is enabled, which this port doesn't model. The popup button, when attached, adds its width like Godot's popup_button branch.
public override Vector2 GetMinimumSize()
Returns
- Vector2
GetPopup()
Returns the popup attached with SetPopup(Popup), matching Godot's TabContainer::get_popup.
public Popup GetPopup()
Returns
GetPopupButtonRectangle()
Returns the header rectangle of the popup button, empty when no popup is attached.
public Rectangle GetPopupButtonRectangle()
Returns
- Rectangle
GetPreviousTab()
The tab selected immediately before the current one, matching Godot's get_previous_tab.
public int GetPreviousTab()
Returns
GetTabButtonIcon(int)
public Texture2D GetTabButtonIcon(int tab)
Parameters
tabint
Returns
- Texture2D
GetTabControl(int)
Returns the page Control at the given tab index, matching Godot's get_tab_control.
public Control GetTabControl(int tab)
Parameters
tabint
Returns
GetTabIcon(int)
public Texture2D GetTabIcon(int tab)
Parameters
tabint
Returns
- Texture2D
GetTabIconMaxWidth(int)
public int GetTabIconMaxWidth(int tab)
Parameters
tabint
Returns
GetTabMetadata(int)
public object GetTabMetadata(int tab)
Parameters
tabint
Returns
GetTabRect(int)
Where a tab is drawn, in global coordinates, or Microsoft.Xna.Framework.Rectangle.Empty when it is hidden or out of range. Public to match GetTabRect(int).
public Rectangle GetTabRect(int tab)
Parameters
tabint
Returns
- Rectangle
GetTabTitle(int)
public string GetTabTitle(int tab)
Parameters
tabint
Returns
GetTabTooltip(int)
public string GetTabTooltip(int tab)
Parameters
tabint
Returns
GetTooltip(Point)
Returns the tooltip at a global pointer position. Override to provide dynamic help text.
public override string GetTooltip(Point position)
Parameters
positionPoint
Returns
IsTabDisabled(int)
public bool IsTabDisabled(int tab)
Parameters
tabint
Returns
IsTabHidden(int)
public bool IsTabHidden(int tab)
Parameters
tabint
Returns
MoveTab(int, int)
Moves a tab page while preserving the selected page.
public void MoveTab(int from, int to)
Parameters
NextTab()
public void NextTab()
PointerMoved(Point)
The pointer moved over this control, in global coordinates.
protected override void PointerMoved(Point point)
Parameters
pointPoint
PointerPressed(Point)
A pointer press landed on this control, in global coordinates.
Protected as well as internal so a control defined outside this assembly can take part in pointer input. Without that, an app hosting its own drawing surface has to read raw mouse state instead, which bypasses hit-testing, modal gating and the injection side-channel — so such a surface cannot be driven by a test at all.
protected override void PointerPressed(Point point)
Parameters
pointPoint
PointerReleased(Point, bool)
The pointer was released, with whether it was still inside this control.
protected override void PointerReleased(Point point, bool isInside)
Parameters
pointPointisInsidebool
PreviousTab()
public void PreviousTab()
ScrollTabIntoView(int)
Scrolls until a tab is fully visible, if it is not already.
public void ScrollTabIntoView(int tab)
Parameters
tabint
Remarks
Selecting a tab you cannot see -- with Ctrl+Tab, by opening a document, or by closing the one in front -- has to bring it into view, or the strip shows one tab as active while a different one is on screen.
SelectNextAvailable()
Selects the nearest available tab after the current one, wrapping around; returns whether one was found, matching Godot's select_next_available.
public bool SelectNextAvailable()
Returns
SelectPreviousAvailable()
Selects the nearest available tab before the current one, wrapping around; returns whether one was found, matching Godot's select_previous_available.
public bool SelectPreviousAvailable()
Returns
SetDeselectEnabled(bool)
public void SetDeselectEnabled(bool enabled)
Parameters
enabledbool
SetPopup(Popup)
Attaches an arbitrary popup opened from a header button, matching Godot's TabContainer::set_popup.
public void SetPopup(Popup popup)
Parameters
popupPopup
SetTabButtonIcon(int, Texture2D)
public void SetTabButtonIcon(int tab, Texture2D icon)
Parameters
tabinticonTexture2D
SetTabDisabled(int, bool)
public void SetTabDisabled(int tab, bool disabled)
Parameters
SetTabHidden(int, bool)
public void SetTabHidden(int tab, bool hidden)
Parameters
SetTabIcon(int, Texture2D)
public void SetTabIcon(int tab, Texture2D icon)
Parameters
tabinticonTexture2D
SetTabIconMaxWidth(int, int)
public void SetTabIconMaxWidth(int tab, int width)
Parameters
SetTabMetadata(int, object)
public void SetTabMetadata(int tab, object metadata)
Parameters
SetTabTitle(int, string)
public void SetTabTitle(int tab, string title)
Parameters
SetTabTooltip(int, string)
public void SetTabTooltip(int tab, string tooltip)
Parameters
Events
ActiveTabRearranged
Raised while the selected tab page is moved through the header strip.
public event Action<TabContainer, int> ActiveTabRearranged
Event Type
PrePopupPressed
Raised immediately before the attached popup is shown, matching Godot's pre_popup_pressed signal.
public event EventHandler PrePopupPressed
Event Type
TabButtonPressed
Raised when a tab's configured button icon is pressed.
public event Action<TabContainer, int> TabButtonPressed
Event Type
TabChanged
public event Action<TabContainer, int> TabChanged
Event Type
TabClicked
Raised when a (non-disabled) tab is clicked, matching Godot's tab_clicked signal.
public event Action<TabContainer, int> TabClicked
Event Type
TabHovered
Raised when the pointer enters a tab header, matching Godot's tab_hovered signal.
public event Action<TabContainer, int> TabHovered
Event Type
TabSelected
Raised on every tab selection attempt, even reselecting the current tab, matching Godot's tab_selected signal (TabChanged only fires when the selection actually changes).
public event Action<TabContainer, int> TabSelected