Header Panel Manager v1.0.60¶
Controls enabling / disabling of toolbar buttons and broadcasts clicks / state changes to the host UI. Usually managed internally by App; can also be created standalone via new HeaderPanelManager(config?).
Method¶
isEnabled / setEnabled¶
method
hpm.setEnabled(id: HeaderButtonId, enabled: boolean): void
setEnabled only emits "enable" / "disable" when the state actually changes.
enableAll / disableAll¶
method
hpm.disableAll(ids: HeaderButtonId[]): void
getEnabledMap¶
method
Returns a snapshot copy of the current enabled state.
applyConfig¶
method
Batch-sets button visibility according to IHeaderPanelConfig (legacy internal shape).
Special case for the scenario button
applyConfig only handles 9 buttons (excluding scenario). scenario is enabled by default at construction time and is not affected by applyConfig.
dispatchAction / dispatchStateChange¶
method
hpm.dispatchStateChange(id: HeaderButtonId, value?: any): void
Called by the UI to emit "click" / "stateChange" event respectively.
on¶
method
Event¶
event
Event names: "enable" / "disable" / "click" / "stateChange". Each detail is a HeaderPanelEventDetail: { buttonId, enabled, value? }.
"enable"/"disable"— fromsetEnabled(only on state change)"click"— fromdispatchAction"stateChange"— fromdispatchStateChange
Types¶
HeaderButtonId¶
type
type HeaderButtonId =
| "history"
| "favourites"
| "download"
| "channel_label"
| "legend"
| "grid"
| "tooltip"
| "highlight"
| "cursor"
| "scenario";
HeaderPanelEvent / HeaderPanelEventDetail / HeaderPanelListener¶
type
type HeaderPanelEvent = "enable" | "disable" | "click" | "stateChange";
interface HeaderPanelEventDetail {
/** The button that triggered the event. */
buttonId: HeaderButtonId;
/** Whether the button is currently enabled. */
enabled: boolean;
/** Any value returned by the button action (e.g. tooltip mode). */
value?: any;
}
type HeaderPanelListener = (
event: HeaderPanelEvent,
detail: HeaderPanelEventDetail,
) => void;