# Yahoo! UI Library

### editor 2.8.2r1

Yahoo! UI Library > editor > YAHOO.widget.ToolbarButton
Search:
Filters
Show Private Show Protected Show Deprecated

## Class YAHOO.widget.ToolbarButton - extends YAHOO.util.Element

Creates a basic custom Toolbar Button. Primarily used with the Rich Text Editor's Toolbar

Provides a toolbar button based on the button and menu widgets, <select> elements are used in place of menu's.

### Constructor

YAHOO.widget.ToolbarButton `( el , attrs )`

Parameters:
  `el <String/HTMLElement>` The element to turn into a button.
  `attrs <Object>` Object liternal containing configuration parameters.

### Properties

#### buttonType - `private object`

Tells if the Button is a Rich Button or a Simple Button

#### Properties inherited from YAHOO.util.Element:

`DOM_EVENTS`

#### Properties inherited from YAHOO.util.AttributeProvider:

`_configs`

#### Properties inherited from YAHOO.util.EventProvider:

`__yui_events, __yui_subscribers`

### Methods

#### _handleMouseOut

`private void _handleMouseOut ( )`
Removes classes from the button elements on mouseout (hover)

#### _handleMouseOver

`private void _handleMouseOver ( )`
Adds classes to the button elements on mouseover (hover)

#### _handleSelect

`private void _handleSelect ( ev )`
The event fired when a change event gets fired on a select element

Parameters:
  `ev <Event>` The change event.

#### checkValue

`void checkValue ( value )`
Select an option by value

Parameters:
  `value <String>` The value of the option that we want to mark as selected

#### destroy

`void destroy ( )`
Destroy the button

#### fireEvent

`void fireEvent ( )`
Overridden fireEvent method to prevent DOM events from firing if the button is disabled.

#### getMenu

`void getMenu ( )`
A stub function to mimic YAHOO.widget.Button's getMenu method

#### init

`void init ( )`
The ToolbarButton class's initialization method

#### initAttributes

`void initAttributes ( attr )`
Initializes all of the configuration attributes used to create the toolbar.

Parameters:
  `attr <Object>` Object literal specifying a set of configuration attributes used to create the toolbar.

#### toString

`String toString ( )`
Returns a string representing the toolbar.

#### Methods inherited from YAHOO.util.Element:

`_setHTMLAttrConfig, addClass, addListener, appendChild, appendTo, delegate, fireQueue, getElementsByClassName, getElementsByTagName, getStyle, hasChildNodes, hasClass, initAttributes, insertBefore, on, removeChild, removeClass, removeDelegate, removeListener, replaceChild, replaceClass, setStyle, subscribe`

#### Methods inherited from YAHOO.util.AttributeProvider:

`configureAttribute, fireBeforeChangeEvent, fireChangeEvent, get, getAttributeConfig, getAttributeKeys, refresh, register, resetAttributeConfig, resetValue, set, setAttributeConfig, setAttributes`

#### Methods inherited from YAHOO.util.EventProvider:

`createEvent, fireEvent, hasEvent, subscribe, unsubscribe, unsubscribeAll`

### Events

#### beforeDisabledChange

`beforeDisabledChange ( event )`
Fires before the value for the configuration attribute 'disabled' changes. Return false to cancel the attribute change.

Parameters:
  `event <{oldValue: any, newValue: any}>` An object containing the previous attribute value and the new value.

#### beforeLabelChange

`beforeLabelChange ( event )`
Fires before the value for the configuration attribute 'label' changes. Return false to cancel the attribute change.

Parameters:
  `event <{oldValue: any, newValue: any}>` An object containing the previous attribute value and the new value.

#### beforeMenuChange

`beforeMenuChange ( event )`
Fires before the value for the configuration attribute 'menu' changes. Return false to cancel the attribute change.

Parameters:
  `event <{oldValue: any, newValue: any}>` An object containing the previous attribute value and the new value.

#### beforeTitleChange

`beforeTitleChange ( event )`
Fires before the value for the configuration attribute 'title' changes. Return false to cancel the attribute change.

Parameters:
  `event <{oldValue: any, newValue: any}>` An object containing the previous attribute value and the new value.

#### beforeTypeChange

`beforeTypeChange ( event )`
Fires before the value for the configuration attribute 'type' changes. Return false to cancel the attribute change.

Parameters:
  `event <{oldValue: any, newValue: any}>` An object containing the previous attribute value and the new value.

#### beforeValueChange

`beforeValueChange ( event )`
Fires before the value for the configuration attribute 'value' changes. Return false to cancel the attribute change.

Parameters:
  `event <{oldValue: any, newValue: any}>` An object containing the previous attribute value and the new value.

#### disabledChange

`disabledChange ( event )`
Fires when the value for the configuration attribute 'disabled' changes.

Parameters:
  `event <{oldValue: any, newValue: any}>` An object containing the previous attribute value and the new value.

#### labelChange

`labelChange ( event )`
Fires when the value for the configuration attribute 'label' changes.

Parameters:
  `event <{oldValue: any, newValue: any}>` An object containing the previous attribute value and the new value.

#### menuChange

`menuChange ( event )`
Fires when the value for the configuration attribute 'menu' changes.

Parameters:
  `event <{oldValue: any, newValue: any}>` An object containing the previous attribute value and the new value.

#### titleChange

`titleChange ( event )`
Fires when the value for the configuration attribute 'title' changes.

Parameters:
  `event <{oldValue: any, newValue: any}>` An object containing the previous attribute value and the new value.

#### typeChange

`typeChange ( event )`
Fires when the value for the configuration attribute 'type' changes.

Parameters:
  `event <{oldValue: any, newValue: any}>` An object containing the previous attribute value and the new value.

#### valueChange

`valueChange ( event )`
Fires when the value for the configuration attribute 'value' changes.

Parameters:
  `event <{oldValue: any, newValue: any}>` An object containing the previous attribute value and the new value.

#### Events inherited from YAHOO.util.Element:

`appendTo, available, beforeAppendTo, beforeElementChange, contentReady, elementChange,`

### Configuration Attributes

#### container `- String`

The container that the button is rendered to, handled by Toolbar

#### disabled `- String`

Set the button into a disabled state

#### label `- String`

The text label for the button

#### menu `- Object`

The menu attribute, see YAHOO.widget.Button

#### title `- String`

The title of the button

#### type `- String`

The type of button to create: push, menu, color, select, spin

#### value `- String`

The value of the button

#### Configuration attributes inherited from YAHOO.util.Element:

`element`

Copyright © 2010 Yahoo! Inc. All rights reserved.