Autodesk.Viewing.UI.ToolBar
Extends ControlGroup
new ToolBar(id,options)
Core class representing a toolbar UI.
It consists of ControlGroup that group controls by functionality.
Parameters
id* string | The id for this toolbar. |
options object | An optional dictionary of options. |
collapsible boolean | Whether this toolbar is collapsible. |
Methods
addClass(cssClass)
Inherits addClass
Adds a CSS class to this control.
Parameters
cssClass* string | The name of the CSS class. |
addControl(control,options)
Inherits addControl
Adds a control to this control group.
Parameters
control* | The control to add. |
options object | An option dictionary of options. |
index object | The index to insert the control at. |
Returns
Type | Description |
---|---|
boolean | True if the control was successfully added. |
getControl(controlId)
Inherits getControl
Returns the control with the corresponding ID if it is in this control group.
Parameters
controlId* string | The ID of the control. |
Returns
Type | Description |
---|---|
Control | The control or null if it doesn’t exist. |
getControlId(index)
Inherits getControlId
Returns the control ID with for corresponding index if it is in this control group.
Parameters
index* number | Index of the control. |
Returns
Type | Description |
---|---|
string | The ID of the control or null if it doesn’t exist. |
getDimensions()
Inherits getDimensions
Returns the dimensions of this control.
Returns
Type | Description |
---|---|
object | The width and height of the toolbar. |
getId()
Inherits getId
Gets this control’s ID.
Returns
Type | Description |
---|---|
string | The control’s ID. |
getNumberOfControls()
Inherits getNumberOfControls
Returns the number of controls in this control group.
Returns
Type | Description |
---|---|
number | The number of controls. |
getPosition()
Inherits getPosition
Returns the position of this control relative to the canvas.
Returns
Type | Description |
---|---|
object | The top and left values of the toolbar. |
getToolTip()
Inherits getToolTip
Returns the tooltip text for this control.
Returns
Type | Description |
---|---|
string | The tooltip text. Null if it’s not set. |
indexOf(control)
Inherits indexOf
Returns the index of a control in this group. -1 if the item isn’t found.
Parameters
control* string|Control | The control ID or control instance to find. |
Returns
Type | Description |
---|---|
number | Index of a successfully removed control, otherwise -1. |
isCollapsed()
Inherits isCollapsed
Gets the collapsed state of this control.
Returns
Type | Description |
---|---|
boolean | True if this control is collapsed. |
isCollapsible()
Inherits isCollapsible
Returns whether or not this control is collapsible.
Returns
Type | Description |
---|---|
boolean | True if this control can be collapsed. |
isVisible()
Inherits isVisible
Gets the visibility of this control.
Returns
Type | Description |
---|---|
boolean | True if the this control is visible. |
removeClass(cssClass)
Inherits removeClass
Removes a CSS class from this control.
Parameters
cssClass* string | The name of the CSS class. |
removeControl(control)
Inherits removeControl
Removes a control from this control group.
Parameters
control* string|Control | The control ID or control instance to remove. |
Returns
Type | Description |
---|---|
boolean | True if the control was successfully removed. |
setCollapsed(collapsed)
Inherits setCollapsed
Sets the collapsed state of this control group. Iterates over the child controls and calls child.setCollapsed(collapsed).
Parameters
collapsed* boolean | The collapsed value to set. |
Returns
Type | Description |
---|---|
boolean | True if at least one collapsible child’s state changes. |
setToolTip(toolTipText)
Inherits setToolTip
Sets the tooltip text for this control.
Parameters
toolTipText* string | The text for the tooltip. |
Returns
Type | Description |
---|---|
boolean | True if the tooltip was successfully set. |
setVisible(visible)
Inherits setVisible
Sets the visibility of this control.
Parameters
visible* boolean | The visibility value to set. |
Returns
Type | Description |
---|---|
boolean | True if the control’s visibility changed. |
Events
COLLAPSED_CHANGED
Event fired when the collapsed state of the control changes.
Properties
controlId string | The ID of the control that fired this event. |
isCollapsed boolean | True if the control is now collapsed. |
CONTROL_ADDED
Event fired a control is added to the control group.
Properties
control string | The control that was added. |
index number | The index at which the control was added. |
CONTROL_REMOVED
Event fired when a control is removed from the control group.
Properties
control string | The control that was removed. |
index number | The index at which the control was removed. |
SIZE_CHANGED
Event fired when the size of the control group changes.
Properties
childEvent object | The event that the child fired. |
VISIBILITY_CHANGED
Event fired when the visibility of the control changes.
Properties
controlId string | The ID of the control that fired this event. |
isVisible boolean | True if the control is now visible. |