Skip to content

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?).

const hpm = renderer.headerPanelManager;

Method

isEnabled / setEnabled

method

hpm.isEnabled(id: HeaderButtonId): boolean
hpm.setEnabled(id: HeaderButtonId, enabled: boolean): void

setEnabled only emits "enable" / "disable" when the state actually changes.

enableAll / disableAll

method

hpm.enableAll(ids: HeaderButtonId[]): void
hpm.disableAll(ids: HeaderButtonId[]): void

getEnabledMap

method

hpm.getEnabledMap(): Record<HeaderButtonId, boolean>

Returns a snapshot copy of the current enabled state.

applyConfig

method

hpm.applyConfig(config: IHeaderPanelConfig): void

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.dispatchAction(id: HeaderButtonId, value?: any): void
hpm.dispatchStateChange(id: HeaderButtonId, value?: any): void

Called by the UI to emit "click" / "stateChange" event respectively.

on

method

hpm.on(listener: HeaderPanelListener): () => void

Event

event

Event names: "enable" / "disable" / "click" / "stateChange". Each detail is a HeaderPanelEventDetail: { buttonId, enabled, value? }.

  • "enable" / "disable" — from setEnabled (only on state change)
  • "click" — from dispatchAction
  • "stateChange" — from dispatchStateChange

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;