Abstract Class: HardwareUiControl<E, P>
Defined in: src/sdk/components/controls/HardwareUiControl.tsx:134
An abstract implementation of a component that forms the base of a Garmin-like UI control system. Subclasses should
implement an appropriate event handler interface (using the utility type UiControlEventHandlers<Events>
) and have
their props implement the corresponding prop event handler interface (using the utility type
UiControlPropEventHandlers<Events>
).
Extends
Extended by
Type Parameters
Type Parameter | Default type | Description |
---|---|---|
E extends Record <string , any > | Record <string , any > | An event definition type for events supported by this control. |
P extends HardwareUiControlProps | HardwareUiControlProps | The component prop type for this control. |
Constructors
Constructor
new HardwareUiControl<
E
,P
>(props
):HardwareUiControl
<E
,P
>
Defined in: src/sdk/components/controls/HardwareUiControl.tsx:155
Creates an instance of a HardwareUiControl.
Parameters
Parameter | Type | Description |
---|---|---|
props | P | The props for this component. |
Returns
HardwareUiControl
<E
, P
>
Overrides
Properties
context?
optional
context: [] =undefined
Defined in: src/sdk/components/FSComponent.ts:64
The context on this component, if any.
Inherited from
contextType?
readonly
optional
contextType: readonly [] =undefined
Defined in: src/sdk/components/FSComponent.ts:67
The type of context for this component, if any.
Inherited from
focusedIndex
protected
focusedIndex:number
=-1
Defined in: src/sdk/components/controls/HardwareUiControl.tsx:139
props
props:
P
&ComponentProps
Defined in: src/sdk/components/FSComponent.ts:61
The properties of the component.
Inherited from
registeredControls
protected
registeredControls:undefined
|HardwareUiControl
<E
,HardwareUiControlProps
>[]
Defined in: src/sdk/components/controls/HardwareUiControl.tsx:137
Accessors
isDisabled
Get Signature
get isDisabled():
boolean
Defined in: src/sdk/components/controls/HardwareUiControl.tsx:177
Gets whether or not the control is currently disabled.
Returns
boolean
True if disabled, false otherwise.
isFocused
Get Signature
get isFocused():
boolean
Defined in: src/sdk/components/controls/HardwareUiControl.tsx:185
Gets whether or not the control is currently focused.
Returns
boolean
True if disabled, false otherwise.
isIsolated
Get Signature
get isIsolated():
boolean
Defined in: src/sdk/components/controls/HardwareUiControl.tsx:193
Gets whether or not the control is currently in scroll isolation.
Returns
boolean
True if currently in scroll isolation, false otherwise.
length
Get Signature
get length():
number
Defined in: src/sdk/components/controls/HardwareUiControl.tsx:165
Gets the current number of registered child controls.
Returns
number
The current number of registered child controls.
Methods
blur()
blur():
void
Defined in: src/sdk/components/controls/HardwareUiControl.tsx:593
Blurs, or removes focus, from the component.
Returns
void
clearRegistered()
clearRegistered():
void
Defined in: src/sdk/components/controls/HardwareUiControl.tsx:793
Clears the list of registered components.
Returns
void
destroy()
destroy():
void
Defined in: src/sdk/components/controls/HardwareUiControl.tsx:923
Destroys this component.
Returns
void
Overrides
focus()
focus(
focusPosition
):boolean
Defined in: src/sdk/components/controls/HardwareUiControl.tsx:410
Brings focus to the control. Focusing the control will also blur the currently focused control, if any.
Parameters
Parameter | Type | Description |
---|---|---|
focusPosition | FocusPosition | The focus position to activate for descendents of this control. |
Returns
boolean
Whether this control was successfully focused.
getChild()
getChild(
index
):undefined
|HardwareUiControl
<E
,HardwareUiControlProps
>
Defined in: src/sdk/components/controls/HardwareUiControl.tsx:859
Gets a child control at the specified index.
Parameters
Parameter | Type | Description |
---|---|---|
index | number | The index of the child control to get. |
Returns
undefined
| HardwareUiControl
<E
, HardwareUiControlProps
>
The specified child control.
getContext()
protected
getContext(context
):never
Defined in: src/sdk/components/FSComponent.ts:106
Gets a context data subscription from the context collection.
Parameters
Parameter | Type | Description |
---|---|---|
context | never | The context to get the subscription for. |
Returns
never
The requested context.
Throws
An error if no data for the specified context type could be found.
Inherited from
getFocusedIndex()
getFocusedIndex():
number
Defined in: src/sdk/components/controls/HardwareUiControl.tsx:824
Gets the current focused index in the registered controls collection.
Returns
number
The index of the focused control in the collection of registered controls.
getFocusPositionOnScroll()
protected
getFocusPositionOnScroll(direction
):FocusPosition
Defined in: src/sdk/components/controls/HardwareUiControl.tsx:250
Gets the focus position to apply when this control is focused from a scroll.
Parameters
Parameter | Type | Description |
---|---|---|
direction | ScrollDirection | The direction of the scroll. |
Returns
The focus position to apply when this control is focused from a scroll.
getMostRecentFocusedIndex()
getMostRecentFocusedIndex():
number
Defined in: src/sdk/components/controls/HardwareUiControl.tsx:833
Gets the most recent focused index (including the current focused index, if one exists) in the registered controls collection.
Returns
number
The index of the most recently focused control in the collection of registered controls.
indexOf()
indexOf(
child
):number
Defined in: src/sdk/components/controls/HardwareUiControl.tsx:873
Gets the index of a specified child control within the registered child controls collection.
Parameters
Parameter | Type | Description |
---|---|---|
child | HardwareUiControl <E > | The child to get the index of. |
Returns
number
The index of the child, or -1 if not found.
onAfterRender()
onAfterRender(
thisNode
):void
Defined in: src/sdk/components/controls/HardwareUiControl.tsx:900
A callback that is called after the component is rendered.
Parameters
Parameter | Type | Description |
---|---|---|
thisNode | VNode | The component's VNode. |
Returns
void
Overrides
DisplayComponent
.onAfterRender
onAfterScroll()
protected
onAfterScroll(control
,index
):void
Defined in: src/sdk/components/controls/HardwareUiControl.tsx:284
An event called when a scroll operation has completed.
Parameters
Parameter | Type | Description |
---|---|---|
control | HardwareUiControl <E > | The control that was scrolled to. |
index | number | The index of the control in the collection of registered controls. |
Returns
void
onBeforeRender()
onBeforeRender():
void
Defined in: src/sdk/components/FSComponent.ts:80
A callback that is called before the component is rendered.
Returns
void
Inherited from
DisplayComponent
.onBeforeRender
onBlurred()
protected
onBlurred(source
):void
Defined in: src/sdk/components/controls/HardwareUiControl.tsx:209
An event called when the control is blurred.
Parameters
Parameter | Type | Description |
---|---|---|
source | HardwareUiControl <E > | The control that emitted this event. |
Returns
void
onDisabled()
protected
onDisabled(source
):void
Defined in: src/sdk/components/controls/HardwareUiControl.tsx:225
An event called when the control is disabled.
Parameters
Parameter | Type | Description |
---|---|---|
source | HardwareUiControl <E > | The control that emitted this event. |
Returns
void
onEnabled()
protected
onEnabled(source
):void
Defined in: src/sdk/components/controls/HardwareUiControl.tsx:217
An event called when the control is enabled.
Parameters
Parameter | Type | Description |
---|---|---|
source | HardwareUiControl <E > | The control that emitted this event. |
Returns
void
onFocused()
protected
onFocused(source
):void
Defined in: src/sdk/components/controls/HardwareUiControl.tsx:201
An event called when the control receives focus.
Parameters
Parameter | Type | Description |
---|---|---|
source | HardwareUiControl <E > | The control that emitted this event. |
Returns
void
onInteractionEvent()
abstract
onInteractionEvent(event
):boolean
Defined in: src/sdk/components/controls/HardwareUiControl.tsx:337
A method which is called when this control receives an interaction event.
Parameters
Parameter | Type | Description |
---|---|---|
event | keyof E | The event. |
Returns
boolean
True if the event was handled, false otherwise.
onRegistered()
protected
onRegistered(source
):void
Defined in: src/sdk/components/controls/HardwareUiControl.tsx:233
An event called when a control is registered with this control.
Parameters
Parameter | Type | Description |
---|---|---|
source | HardwareUiControl <E > | The control that emitted this event. |
Returns
void
onScroll()
protected
onScroll(direction
):boolean
Defined in: src/sdk/components/controls/HardwareUiControl.tsx:263
An event called when the control is scrolled.
Parameters
Parameter | Type | Description |
---|---|---|
direction | ScrollDirection | The direction that is being requested to scroll. |
Returns
boolean
True if this control handled this event, false otherwise.
onUnregistered()
protected
onUnregistered(source
):void
Defined in: src/sdk/components/controls/HardwareUiControl.tsx:241
An event called when a control is unregistered from this control.
Parameters
Parameter | Type | Description |
---|---|---|
source | HardwareUiControl <E > | The control that emitted this event. |
Returns
void
reconcileChildBlur()
protected
reconcileChildBlur(index
,child
):number
|BlurReconciliation
Defined in: src/sdk/components/controls/HardwareUiControl.tsx:688
Reconciles the focus state of this control's children when this control is focused with no focused children after a child has been blurred.
Parameters
Parameter | Type | Description |
---|---|---|
index | number | The index of the child control that was blurred. If the child is no longer registered, then this is the index of the child prior to being unregistered. |
child | HardwareUiControl <E > | The child control that was blurred. |
Returns
number
| BlurReconciliation
The index of the child control to focus.
register()
register(
control
,index?
):void
Defined in: src/sdk/components/controls/HardwareUiControl.tsx:722
Registers a child control with this control.
Parameters
Parameter | Type | Description |
---|---|---|
control | HardwareUiControl <E > | The control to register. |
index? | number | The index at which to register the control. If none is provided, the control will be registered at the end of the collection of child controls. |
Returns
void
render()
render():
VNode
Defined in: src/sdk/components/controls/HardwareUiControl.tsx:916
Renders the control.
Returns
The component VNode.
Overrides
scroll()
scroll(
direction
):boolean
Defined in: src/sdk/components/controls/HardwareUiControl.tsx:293
Scrolls the currently focused control in the supplied direction.
Parameters
Parameter | Type | Description |
---|---|---|
direction | ScrollDirection | The direction that is being requested to scroll. |
Returns
boolean
True if propagation should be stopped, false otherwise.
setDisabled()
setDisabled(
isDisabled
):void
Defined in: src/sdk/components/controls/HardwareUiControl.tsx:705
Sets the component to be disabled, removing the ability for the component to scroll. Setting a component to disabled will also blur the component and its children, if necessary.
Parameters
Parameter | Type | Description |
---|---|---|
isDisabled | boolean | Whether or not the component is disabled. |
Returns
void
setFocusedIndex()
setFocusedIndex(
index
,focusPosition
):void
Defined in: src/sdk/components/controls/HardwareUiControl.tsx:843
Sets the current most recently focused child control index. If this control is focused and has children that have focus, this will also switch child focus to the new index.
Parameters
Parameter | Type | Default value | Description |
---|---|---|---|
index | number | undefined | The index of the child control to set most recent focus for. |
focusPosition | FocusPosition | FocusPosition.MostRecent | The focus position to focus the child for, if required. |
Returns
void
setIsolated()
setIsolated(
isolated
):void
Defined in: src/sdk/components/controls/HardwareUiControl.tsx:895
Sets whether or not this control is in scroll isolation. While scroll isolation is enabled, scroll events will not propagate to the control's parent when the control has focus.
Parameters
Parameter | Type | Description |
---|---|---|
isolated | boolean | Whether or not the control is isolated. |
Returns
void
setParent()
setParent(
parent
):void
Defined in: src/sdk/components/controls/HardwareUiControl.tsx:885
Sets the parent of this control.
Parameters
Parameter | Type | Description |
---|---|---|
parent | HardwareUiControl <E > | The parent to set. |
Returns
void
triggerEvent()
triggerEvent(
event
,source
, ...args
):boolean
Defined in: src/sdk/components/controls/HardwareUiControl.tsx:348
Triggers an event on this control. The event will first be routed to the deepest focused descendent of this control and will propagate up the control tree until it is handled or there are no more controls to which to propagate.
Parameters
Parameter | Type | Description |
---|---|---|
event | keyof E | The event to trigger. |
source | HardwareUiControl | The source of the event. Defaults to this if not supplied. |
...args | any [] | Additional arguments to pass to the event handler. |
Returns
boolean
True if the event was handled, false otherwise.
unregister()
unregister(
item
):void
Defined in: src/sdk/components/controls/HardwareUiControl.tsx:748
Unregisters a child control with this control.
Parameters
Parameter | Type | Description |
---|---|---|
item | number | HardwareUiControl <E , HardwareUiControlProps > | The child control or index of a child control to unregister. If a child control is provided, it will attempt to be located in the control's child registry and then removed. If an index is provided, the child control at that registered index will be removed. |
Returns
void