WindowTabs Class
Public Functions
| WindowTabs(VApp & app) | |
| void | add(const std::string & tabPath, const std::string & panePath, const std::string & stateName) |
| bool | remove(const std::string & tabPath) |
| void | activate(std::string tabPath) |
| const std::string & | active() |
| const std::string & | previous() |
| bool | has(const std::string & tabPath) |
Detailed Description
Single-select controller for a window's tabs. At most one registered tab is
active: its pane is shown, every other registered pane is hidden, and the
active highlight is moved to it. It unifies STATIC titlebar tabs (registered
once at wire time — App, Settings) with DYNAMIC tabs spawned at runtime (the
left tabs: a node session and, later, the profiles opened within it), so they
share ONE selection — activating a left tab deselects App/Settings and
vice-versa. The framework's right tabs highlight with the Selected state;
left tabs use Active (their template's highlight) — hence the per-tab state
name. Created and pre-populated by wire_main_window_shell(), which returns it
so app code can register/close its own dynamic tabs.
Member Function Documentation
WindowTabs(VApp & app)
No description available.
void add(const std::string & tabPath, const std::string & panePath, const std::string & stateName)
Register a tab without activating it. tabPath is the tab button's node
path (the highlight stateName toggles here); panePath is the pane node
path (visibility toggles here). Re-adding the same tabPath updates its
pane/state.
bool remove(const std::string & tabPath)
Unregister a tab (e.g. a closed left tab): hides its pane and, if it was the active one, clears its highlight and the active selection (the caller then activates another tab). Returns true if it had been active.
void activate(std::string tabPath)
Make tabPath the active tab: move the highlight off the old active tab
onto it, show its pane, and hide every other registered pane. No-op if it
is already active or was never registered. Takes its argument BY VALUE:
callers pass previous() (the back chain's settings return), which aliases
a member this method overwrites mid-flight — a reference parameter would
silently change value halfway through.
const std::string & active()
The active tab's path, or "" if none.
const std::string & previous()
The tab that was active before the last activation, or "" if none yet. Lets a back chain return to "wherever the user was" (e.g. back from Settings goes to the tab Settings was opened from). It may name a tab that has since been removed — check has() before activating it.
bool has(const std::string & tabPath)
Whether tabPath is currently registered.