Class: ContinuousCategory
Defined in: plugins/continuous-toolbox/src/ContinuousCategory.ts:14
Toolbox category for continuous toolbox.
Extends
ToolboxCategory
Properties index
| Property | Description |
|---|---|
| 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_ | - |
| borderWidth | The width in pixels of the strip of colour next to each category. |
| defaultBackgroundColour | The default colour of the category. This is used as the background colour of the category when it is selected. |
| nestedPadding | The number of pixels to move the category over at each nested level. |
| registrationName | Name used for registering a toolbox category. |
Methods index
| Method | Description |
|---|---|
| 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. |
| canBeFocused | See 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. |
| dispose | Dispose of this toolbox item. No-op by default. |
| getClickTarget | 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. |
| getColour_ | Gets either the colour or the style for a category. |
| getContents | Gets the contents of the category. These are items that are meant to be displayed in the flyout. |
| getDiv | Gets the div for the toolbox item. |
| getFocusableElement | See IFocusableNode.getFocusableElement. |
| getFocusableTree | See IFocusableNode.getFocusableTree. |
| getId | Gets a unique identifier for this toolbox item. |
| getName | Gets the name of the category. Used for emitting events. |
| getParent | Gets the parent if the toolbox item is nested. |
| getParentToolbox | Returns the toolbox this toolbox item belongs to. |
| hide | Hide the category. |
| init | 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. |
| isCollapsible | Whether the toolbox item is collapsible. |
| isSelectable | Whether the toolbox item is selectable. |
| isVisible | Whether 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. |
| onClick | Handles when the toolbox item is clicked. |
| onNodeBlur | See IFocusableNode.onNodeBlur. |
| onNodeFocus | Handles 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. |
| refreshTheme | Updates the colour for this category. |
| setDisabled | Sets whether the category is disabled. |
| setSelected | Sets 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. |
| show | Show the category. Category will only appear if its parent category is also expanded. |
| updateFlyoutContents | 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. |
Constructors
Constructor
new ContinuousCategory(
categoryDef,
parentToolbox,
opt_parent?
): ContinuousCategory;
Parameters
| Parameter | Type | Description |
|---|---|---|
categoryDef | CategoryInfo | The information needed to create a category in the toolbox. |
parentToolbox | IToolbox | The parent toolbox for the category. |
opt_parent? | ICollapsibleToolboxItem | The 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
| Parameter | Type | Description |
|---|---|---|
iconDiv | Element | null | The 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
| Parameter | Type | Description |
|---|---|---|
name | string | The 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
| Parameter | Type | Description |
|---|---|---|
categoryDef | CategoryInfo | The 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
| Parameter | Type | Description |
|---|---|---|
_e | Event | Click 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
| Parameter | Type | Description |
|---|---|---|
iconDiv | Element | null | The 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
| Parameter | Type | Description |
|---|---|---|
categoryDef | CategoryInfo | The 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
| Parameter | Type | Description |
|---|---|---|
categoryDef | CategoryInfo | The 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
| Parameter | Type | Description |
|---|---|---|
isDisabled | boolean | True 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
| Parameter | Type | Description |
|---|---|---|
isSelected | boolean | True 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
| Parameter | Type | Description |
|---|---|---|
isVisible | boolean | True 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
| Parameter | Type | Description |
|---|---|---|
contents | string | FlyoutDefinition | The contents to be displayed in the flyout. A string can be supplied to create a dynamic category. |
Returns
void
Inherited from
Blockly.ToolboxCategory.updateFlyoutContents