Skip to main content

Class: ContinuousCategory

Defined in: plugins/continuous-toolbox/src/ContinuousCategory.ts:14

Toolbox category for continuous toolbox.

Extends​

  • ToolboxCategory

Properties index​

PropertyDescription
colour_The colour of the category.
cssConfig_-
flyoutItems_The flyout items for this category.
htmlDiv_The HTML container for the category.
iconDom_The HTML element for the toolbox icon.
id_-
isDisabled_True if this category is disabled, false otherwise.
isHidden_True if the category is meant to be hidden, false otherwise.
labelDom_The HTML element for the toolbox label.
level_-
name_The name that will be displayed on the category.
parent_-
parentToolbox_The toolbox this category belongs to.
rowContents_The HTML element that holds children elements of the category row.
rowDiv_The HTML element for the category row.
toolboxItemDef_-
workspace_-
borderWidthThe width in pixels of the strip of colour next to each category.
defaultBackgroundColourThe default colour of the category. This is used as the background colour of the category when it is selected.
nestedPaddingThe number of pixels to move the category over at each nested level.
registrationNameName used for registering a toolbox category.

Methods index​

MethodDescription
addColourBorder_Adds a color indicator to the toolbox category. Intentionally a no-op.
allAncestorsExpanded_Whether all ancestors of a category (parent and parent's parent, etc.) are expanded.
canBeFocusedSee IFocusableNode.canBeFocused.
closeIcon_Adds appropriate classes to display a closed icon.
createContainer_Creates the container that holds the row and any subcategories.
createDom_Creates the DOM for the category.
createIconDom_Creates a DOM element to display the category's icon. This category uses color swatches instead of graphical icons.
createLabelDom_Creates a DOM element to display the category's label.
createRowContainer_Creates the parent of the contents container. All clicks will happen on this div.
createRowContentsContainer_Creates the container for the label and icon. This is necessary so we can set all subcategory pointer events to none.
disposeDispose of this toolbox item. No-op by default.
getClickTargetGets the HTML element that is clickable. The parent toolbox element receives clicks. The parent toolbox will add an ID to this element so it can pass the onClick event to the correct toolboxItem.
getColour_Gets either the colour or the style for a category.
getContentsGets the contents of the category. These are items that are meant to be displayed in the flyout.
getDivGets the div for the toolbox item.
getFocusableElementSee IFocusableNode.getFocusableElement.
getFocusableTreeSee IFocusableNode.getFocusableTree.
getIdGets a unique identifier for this toolbox item.
getNameGets the name of the category. Used for emitting events.
getParentGets the parent if the toolbox item is nested.
getParentToolboxReturns the toolbox this toolbox item belongs to.
hideHide the category.
initInitializes the toolbox item. This includes creating the DOM and updating the state of any items based on the info object. Init should be called immediately after the construction of the toolbox item, to ensure that the category contents are properly parsed.
isCollapsibleWhether the toolbox item is collapsible.
isSelectableWhether the toolbox item is selectable.
isVisibleWhether the category is visible. A category is only visible if all of its ancestors are expanded and isHidden_ is false.
makeDefaultCssConfig_Creates an object holding the default classes for a category.
onClickHandles when the toolbox item is clicked.
onNodeBlurSee IFocusableNode.onNodeBlur.
onNodeFocusHandles this toolbox category gaining focus by informing its parent toolbox that it has been selected.
openIcon_Adds appropriate classes to display an open icon.
parseCategoryDef_Parses the non-contents parts of the category def.
parseContents_Parses the contents array depending on if the category is a dynamic category, or if its contents are meant to be shown in the flyout.
refreshThemeUpdates the colour for this category.
setDisabledSets whether the category is disabled.
setSelectedSets whether or not this category is selected in the toolbox.
setVisible_Sets whether the category is visible or not. For a category to be visible its parent category must also be expanded.
showShow the category. Category will only appear if its parent category is also expanded.
updateFlyoutContentsUpdates the contents to be displayed in the flyout. If the flyout is open when the contents are updated, refreshSelection on the toolbox must also be called.

Constructors​

Constructor​

new ContinuousCategory(
categoryDef,
parentToolbox,
opt_parent?
): ContinuousCategory;

Parameters​

ParameterTypeDescription
categoryDefCategoryInfoThe information needed to create a category in the toolbox.
parentToolboxIToolboxThe parent toolbox for the category.
opt_parent?ICollapsibleToolboxItemThe parent category or null if the category does not have a parent.

Returns​

ContinuousCategory

Inherited from​

Blockly.ToolboxCategory.constructor

Properties​

colour_​

protected colour_: string;

The colour of the category.

Inherited from​

Blockly.ToolboxCategory.colour_


cssConfig_​

protected cssConfig_: CssConfig;

Inherited from​

Blockly.ToolboxCategory.cssConfig_


flyoutItems_​

protected flyoutItems_: string | FlyoutItemInfoArray;

The flyout items for this category.

Inherited from​

Blockly.ToolboxCategory.flyoutItems_


htmlDiv_​

protected htmlDiv_: HTMLDivElement | null;

The HTML container for the category.

Inherited from​

Blockly.ToolboxCategory.htmlDiv_


iconDom_​

protected iconDom_: Element | null;

The HTML element for the toolbox icon.

Inherited from​

Blockly.ToolboxCategory.iconDom_


id_​

protected id_: string;

Inherited from​

Blockly.ToolboxCategory.id_


isDisabled_​

protected isDisabled_: boolean;

True if this category is disabled, false otherwise.

Inherited from​

Blockly.ToolboxCategory.isDisabled_


isHidden_​

protected isHidden_: boolean;

True if the category is meant to be hidden, false otherwise.

Inherited from​

Blockly.ToolboxCategory.isHidden_


labelDom_​

protected labelDom_: Element | null;

The HTML element for the toolbox label.

Inherited from​

Blockly.ToolboxCategory.labelDom_


level_​

protected level_: number;

Inherited from​

Blockly.ToolboxCategory.level_


name_​

protected name_: string;

The name that will be displayed on the category.

Inherited from​

Blockly.ToolboxCategory.name_


parent_​

protected parent_: ICollapsibleToolboxItem | null;

Inherited from​

Blockly.ToolboxCategory.parent_


parentToolbox_​

protected readonly parentToolbox_: IToolbox;

The toolbox this category belongs to.

Inherited from​

Blockly.ToolboxCategory.parentToolbox_


rowContents_​

protected rowContents_: HTMLDivElement | null;

The HTML element that holds children elements of the category row.

Inherited from​

Blockly.ToolboxCategory.rowContents_


rowDiv_​

protected rowDiv_: HTMLDivElement | null;

The HTML element for the category row.

Inherited from​

Blockly.ToolboxCategory.rowDiv_


toolboxItemDef_​

toolboxItemDef_: CategoryInfo;

Inherited from​

Blockly.ToolboxCategory.toolboxItemDef_


workspace_​

protected workspace_: WorkspaceSvg;

Inherited from​

Blockly.ToolboxCategory.workspace_


borderWidth​

static borderWidth: number;

The width in pixels of the strip of colour next to each category.

Inherited from​

Blockly.ToolboxCategory.borderWidth


defaultBackgroundColour​

static defaultBackgroundColour: string;

The default colour of the category. This is used as the background colour of the category when it is selected.

Inherited from​

Blockly.ToolboxCategory.defaultBackgroundColour


nestedPadding​

static nestedPadding: number;

The number of pixels to move the category over at each nested level.

Inherited from​

Blockly.ToolboxCategory.nestedPadding


registrationName​

static registrationName: string;

Name used for registering a toolbox category.

Inherited from​

Blockly.ToolboxCategory.registrationName

Methods​

addColourBorder_()​

addColourBorder_(): void;

Defined in: plugins/continuous-toolbox/src/ContinuousCategory.ts:48

Adds a color indicator to the toolbox category. Intentionally a no-op.

Returns​

void

Overrides​

Blockly.ToolboxCategory.addColourBorder_


allAncestorsExpanded_()​

protected allAncestorsExpanded_(): boolean;

Whether all ancestors of a category (parent and parent's parent, etc.) are expanded.

Returns​

boolean

True only if every ancestor is expanded

Inherited from​

Blockly.ToolboxCategory.allAncestorsExpanded_


canBeFocused()​

canBeFocused(): boolean;

See IFocusableNode.canBeFocused.

Returns​

boolean

Inherited from​

Blockly.ToolboxCategory.canBeFocused


closeIcon_()​

protected closeIcon_(iconDiv): void;

Adds appropriate classes to display a closed icon.

Parameters​

ParameterTypeDescription
iconDivElement | nullThe div that holds the icon.

Returns​

void

Inherited from​

Blockly.ToolboxCategory.closeIcon_


createContainer_()​

protected createContainer_(): HTMLDivElement;

Creates the container that holds the row and any subcategories.

Returns​

HTMLDivElement

The div that holds the icon and the label.

Inherited from​

Blockly.ToolboxCategory.createContainer_


createDom_()​

protected createDom_(): HTMLDivElement;

Creates the DOM for the category.

Returns​

HTMLDivElement

The parent element for the category.

Inherited from​

Blockly.ToolboxCategory.createDom_


createIconDom_()​

createIconDom_(): Element;

Defined in: plugins/continuous-toolbox/src/ContinuousCategory.ts:37

Creates a DOM element to display the category's icon. This category uses color swatches instead of graphical icons.

Returns​

Element

The newly created category icon DOM element.

Overrides​

Blockly.ToolboxCategory.createIconDom_


createLabelDom_()​

createLabelDom_(name): Element;

Defined in: plugins/continuous-toolbox/src/ContinuousCategory.ts:22

Creates a DOM element to display the category's label.

Parameters​

ParameterTypeDescription
namestringThe name of this category.

Returns​

Element

The newly created category label DOM element.

Overrides​

Blockly.ToolboxCategory.createLabelDom_


createRowContainer_()​

protected createRowContainer_(): HTMLDivElement;

Creates the parent of the contents container. All clicks will happen on this div.

Returns​

HTMLDivElement

The div that holds the contents container.

Inherited from​

Blockly.ToolboxCategory.createRowContainer_


createRowContentsContainer_()​

protected createRowContentsContainer_(): HTMLDivElement;

Creates the container for the label and icon. This is necessary so we can set all subcategory pointer events to none.

Returns​

HTMLDivElement

The div that holds the icon and the label.

Inherited from​

Blockly.ToolboxCategory.createRowContentsContainer_


dispose()​

dispose(): void;

Dispose of this toolbox item. No-op by default.

Returns​

void

Inherited from​

Blockly.ToolboxCategory.dispose


getClickTarget()​

getClickTarget(): Element;

Gets the HTML element that is clickable. The parent toolbox element receives clicks. The parent toolbox will add an ID to this element so it can pass the onClick event to the correct toolboxItem.

Returns​

Element

The HTML element that receives clicks.

Inherited from​

Blockly.ToolboxCategory.getClickTarget


getColour_()​

protected getColour_(categoryDef): string;

Gets either the colour or the style for a category.

Parameters​

ParameterTypeDescription
categoryDefCategoryInfoThe object holding information on the category.

Returns​

string

The hex colour for the category.

Inherited from​

Blockly.ToolboxCategory.getColour_


getContents()​

getContents(): string | FlyoutItemInfoArray;

Gets the contents of the category. These are items that are meant to be displayed in the flyout.

Returns​

string | FlyoutItemInfoArray

The definition of items to be displayed in the flyout.

Inherited from​

Blockly.ToolboxCategory.getContents


getDiv()​

getDiv(): HTMLDivElement | null;

Gets the div for the toolbox item.

Returns​

HTMLDivElement | null

The div for the toolbox item.

Inherited from​

Blockly.ToolboxCategory.getDiv


getFocusableElement()​

getFocusableElement(): HTMLElement | SVGElement;

See IFocusableNode.getFocusableElement.

Returns​

HTMLElement | SVGElement

Inherited from​

Blockly.ToolboxCategory.getFocusableElement


getFocusableTree()​

getFocusableTree(): IFocusableTree;

See IFocusableNode.getFocusableTree.

Returns​

IFocusableTree

Inherited from​

Blockly.ToolboxCategory.getFocusableTree


getId()​

getId(): string;

Gets a unique identifier for this toolbox item.

Returns​

string

The ID for the toolbox item.

Inherited from​

Blockly.ToolboxCategory.getId


getName()​

getName(): string;

Gets the name of the category. Used for emitting events.

Returns​

string

The name of the toolbox item.

Inherited from​

Blockly.ToolboxCategory.getName


getParent()​

getParent(): ICollapsibleToolboxItem | null;

Gets the parent if the toolbox item is nested.

Returns​

ICollapsibleToolboxItem | null

The parent toolbox item, or null if this toolbox item is not nested.

Inherited from​

Blockly.ToolboxCategory.getParent


getParentToolbox()​

getParentToolbox(): IToolbox;

Returns the toolbox this toolbox item belongs to.

Returns​

IToolbox

Inherited from​

Blockly.ToolboxCategory.getParentToolbox


hide()​

hide(): void;

Hide the category.

Returns​

void

Inherited from​

Blockly.ToolboxCategory.hide


init()​

init(): void;

Initializes the toolbox item. This includes creating the DOM and updating the state of any items based on the info object. Init should be called immediately after the construction of the toolbox item, to ensure that the category contents are properly parsed.

Returns​

void

Inherited from​

Blockly.ToolboxCategory.init


isCollapsible()​

isCollapsible(): boolean;

Whether the toolbox item is collapsible.

Returns​

boolean

True if the toolbox item is collapsible.

Inherited from​

Blockly.ToolboxCategory.isCollapsible


isSelectable()​

isSelectable(): boolean;

Whether the toolbox item is selectable.

Returns​

boolean

True if the toolbox item can be selected.

Inherited from​

Blockly.ToolboxCategory.isSelectable


isVisible()​

isVisible(): boolean;

Whether the category is visible. A category is only visible if all of its ancestors are expanded and isHidden_ is false.

Returns​

boolean

True if the category is visible, false otherwise.

Inherited from​

Blockly.ToolboxCategory.isVisible


makeDefaultCssConfig_()​

protected makeDefaultCssConfig_(): CssConfig;

Creates an object holding the default classes for a category.

Returns​

CssConfig

The configuration object holding all the CSS classes for a category.

Inherited from​

Blockly.ToolboxCategory.makeDefaultCssConfig_


onClick()​

onClick(_e): void;

Handles when the toolbox item is clicked.

Parameters​

ParameterTypeDescription
_eEventClick event to handle.

Returns​

void

Inherited from​

Blockly.ToolboxCategory.onClick


onNodeBlur()​

onNodeBlur(): void;

See IFocusableNode.onNodeBlur.

Returns​

void

Inherited from​

Blockly.ToolboxCategory.onNodeBlur


onNodeFocus()​

onNodeFocus(): void;

Handles this toolbox category gaining focus by informing its parent toolbox that it has been selected.

Returns​

void

Inherited from​

Blockly.ToolboxCategory.onNodeFocus


openIcon_()​

protected openIcon_(iconDiv): void;

Adds appropriate classes to display an open icon.

Parameters​

ParameterTypeDescription
iconDivElement | nullThe div that holds the icon.

Returns​

void

Inherited from​

Blockly.ToolboxCategory.openIcon_


parseCategoryDef_()​

protected parseCategoryDef_(categoryDef): void;

Parses the non-contents parts of the category def.

Parameters​

ParameterTypeDescription
categoryDefCategoryInfoThe information needed to create a category.

Returns​

void

Inherited from​

Blockly.ToolboxCategory.parseCategoryDef_


parseContents_()​

protected parseContents_(categoryDef): void;

Parses the contents array depending on if the category is a dynamic category, or if its contents are meant to be shown in the flyout.

Parameters​

ParameterTypeDescription
categoryDefCategoryInfoThe information needed to create a category.

Returns​

void

Inherited from​

Blockly.ToolboxCategory.parseContents_


refreshTheme()​

refreshTheme(): void;

Updates the colour for this category.

Returns​

void

Inherited from​

Blockly.ToolboxCategory.refreshTheme


setDisabled()​

setDisabled(isDisabled): void;

Sets whether the category is disabled.

Parameters​

ParameterTypeDescription
isDisabledbooleanTrue to disable the category, false otherwise.

Returns​

void

Inherited from​

Blockly.ToolboxCategory.setDisabled


setSelected()​

setSelected(isSelected): void;

Defined in: plugins/continuous-toolbox/src/ContinuousCategory.ts:57

Sets whether or not this category is selected in the toolbox.

Parameters​

ParameterTypeDescription
isSelectedbooleanTrue if this category is selected, otherwise false.

Returns​

void

Overrides​

Blockly.ToolboxCategory.setSelected


setVisible_()​

setVisible_(isVisible): void;

Sets whether the category is visible or not. For a category to be visible its parent category must also be expanded.

Parameters​

ParameterTypeDescription
isVisiblebooleanTrue if category should be visible.

Returns​

void

Inherited from​

Blockly.ToolboxCategory.setVisible_


show()​

show(): void;

Show the category. Category will only appear if its parent category is also expanded.

Returns​

void

Inherited from​

Blockly.ToolboxCategory.show


updateFlyoutContents()​

updateFlyoutContents(contents): void;

Updates the contents to be displayed in the flyout. If the flyout is open when the contents are updated, refreshSelection on the toolbox must also be called.

Parameters​

ParameterTypeDescription
contentsstring | FlyoutDefinitionThe contents to be displayed in the flyout. A string can be supplied to create a dynamic category.

Returns​

void

Inherited from​

Blockly.ToolboxCategory.updateFlyoutContents