/***************************************************************\
| |\  /|                                                We Put  |
| | >< Hypercosm       toolbar_toggle_button.js         3d      |
| |/  \|                                                To Work |
|***************************************************************|
|                                                               |
|        This file defines the Javascript behaviors of an       |
|        abstract, generalized SketchUp toggle button.          |
|                                                               |
|***************************************************************|
|                Copyright (c) 2007 Hypercosm, LLC.             |
\***************************************************************/


//
// "class" constructor
//


function toolbarToggleButton(element, parent) {
	
  // call superclass constructor
  //
  toggleButton.call(this, element, parent);
  
  // set attributes
  //
  this.helpMessage = "";
  
  return this;
}    // toolbarToggleButton


// inherit prototype from "superclass"
//
toolbarToggleButton.prototype = new toggleButton();


//
// selection event handling methods
//


toolbarToggleButton.prototype.onSelect = function() {
  toggleButton.prototype.onSelect.call(this);
};    // onSelect


toolbarToggleButton.prototype.onDeselect = function() {
  toggleButton.prototype.onDeselect.call(this);
};    // onDeselect


//
// mouse event handling methods
//


toolbarToggleButton.prototype.onMouseOver = function() {
  if (this.parent.parent.standardToolbar)
    if (this.parent.parent.standardToolbar.helpButton)
      if (this.parent.parent.standardToolbar.helpButton.selected)
        return;
  toggleButton.prototype.onMouseOver.call(this);
};    // onMouseOver


toolbarToggleButton.prototype.onMouseOut = function() {
  if (this.parent.parent.standardToolbar)
    if (this.parent.parent.standardToolbar.helpButton)
      if (this.parent.parent.standardToolbar.helpButton.selected)
        return;
  toggleButton.prototype.onMouseOut.call(this);
};    // onMouseOut


toolbarToggleButton.prototype.onMouseDown = function() {
  if (this.parent.parent.standardToolbar)
    if (this.parent.parent.standardToolbar.helpButton)
      if (this.parent.parent.standardToolbar.helpButton.selected) {
        this.parent.parent.standardToolbar.helpButton.showHelp(this.helpMessage);
		return;
	  }
  toggleButton.prototype.onMouseDown.call(this);
};    // onMouseDown


toolbarToggleButton.prototype.onMouseUp = function() {
  if (this.parent.parent.standardToolbar)
    if (this.parent.parent.standardToolbar.helpButton)
      if (this.parent.parent.standardToolbar.helpButton.selected)
        return;
  toggleButton.prototype.onMouseUp.call(this);
};    // onMouseUp

