# Yahoo! UI Library

### editor 2.5.2

Yahoo! UI Library > editor > YAHOO.widget.ToolbarButton

Show Private Show Protected

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

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

### 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

#### Dom `- private object`

#### 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)

Returns: `void`

#### _handleMouseOver

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

Returns: `void`

#### _handleSelect

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

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

Returns: `void`

#### checkValue

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

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

Returns: `void`

#### destroy

`void destroy ( )`
Destroy the button

Returns: `void`

#### fireEvent

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

Returns: `void`

#### getMenu

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

Returns: `void`

#### init

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

Returns: `void`

#### 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.

Returns: `void`

#### toString

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

Returns: `String`

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

`_registerHTMLAttr, addClass, addListener, appendChild, appendTo, fireQueue, getElementsByClassName, getElementsByTagName, getStyle, hasChildNodes, hasClass, initAttributes, insertBefore, on, removeChild, removeClass, 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 ( eventInfo )`
Fires before the value for the configuration attribute 'disabled' changes. Return false to cancel the attribute change.

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

#### beforeLabelChange

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

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

#### beforeMenuChange

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

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

#### beforeTitleChange

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

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

#### beforeTypeChange

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

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

#### beforeValueChange

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

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

#### disabledChange

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

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

#### labelChange

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

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

#### menuChange

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

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

#### titleChange

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

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

#### typeChange

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

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

#### valueChange

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

Parameters:
  `eventInfo <{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 © 2007 Yahoo! Inc. All rights reserved.