// Copyright 2013-2020, University of Colorado Boulder

/**
 * This toggle button uses a boolean property and a trueNode and falseNode to display its content.
 */

import inherit from '../../../phet-core/js/inherit.js';
import merge from '../../../phet-core/js/merge.js';
import Tandem from '../../../tandem/js/Tandem.js';
import BooleanToggleNode from '../BooleanToggleNode.js';
import sun from '../sun.js';
import RectangularToggleButton from './RectangularToggleButton.js';

/**
 * @param {Node} trueNode
 * @param {Node} falseNode
 * @param {Property.<boolean>} booleanProperty
 * @param {Object} [options]
 * @constructor
 */
function BooleanRectangularToggleButton( trueNode, falseNode, booleanProperty, options ) {

  options = merge( { tandem: Tandem.REQUIRED }, options );

  assert && assert( !options.content, 'options.content cannot be set' );
  options.content = new BooleanToggleNode( trueNode, falseNode, booleanProperty );

  RectangularToggleButton.call( this, false, true, booleanProperty, options );

  // @private {function} - internally used disposal function
  this.disposeBooleanRectangularToggleButton = function() {
    options.content.dispose();
  };
}

sun.register( 'BooleanRectangularToggleButton', BooleanRectangularToggleButton );

inherit( RectangularToggleButton, BooleanRectangularToggleButton, {
  /**
   * @public
   */
  dispose: function() {
    this.disposeBooleanRectangularToggleButton();
    RectangularToggleButton.prototype.dispose.call( this );
  }
} );

export default BooleanRectangularToggleButton;
@@ -161,64 +161,8 @@
 */%0A%0A
-import inherit from '../../../phet-core/js/inherit.js';%0A
 impo
@@ -415,20 +415,96 @@
 n.js';%0A%0A
+class BooleanRectangularToggleButton extends RectangularToggleButton %7B%0A%0A  
 /**%0A
+  
  * @para
@@ -517,24 +517,26 @@
 e%7D trueNode%0A
+  
  * @param %7BN
@@ -550,16 +550,18 @@
 lseNode%0A
+  
  * @para
@@ -599,16 +599,18 @@
 roperty%0A
+  
  * @para
@@ -635,66 +635,26 @@
 s%5D%0A 
-* @constructor%0A */%0Afunction BooleanRectangularToggleButton
+  */%0A  constructor
 ( tr
@@ -702,16 +702,18 @@
 ns ) %7B%0A%0A
+  
   option
@@ -724,16 +724,22 @@
 merge( %7B
+%0A     
  tandem:
@@ -754,16 +754,20 @@
 REQUIRED
+%0A   
  %7D, opti
@@ -776,16 +776,18 @@
 s );%0A%0A  
+  
 assert &
@@ -849,16 +849,18 @@
 set' );%0A
+  
   option
@@ -941,43 +941,16 @@
 %0A%0A  
-RectangularToggleButton.call( this,
+  super(
  fal
@@ -988,16 +988,18 @@
 ons );%0A%0A
+  
   // @pr
@@ -1007,56 +1007,11 @@
 vate
- %7Bfunction%7D - internally used disposal function%0A
+%0A  
   th
@@ -1053,29 +1053,26 @@
 utton = 
-function() %7B%0A
+() =%3E %7B%0A  
     opti
@@ -1086,178 +1086,50 @@
 tent
-.dispose();%0A  %7D;%0A%7D%0A%0Asun.register( 'BooleanRectangularToggleButton', BooleanRectangularToggleButton );%0A%0Ainherit( RectangularToggleButton, BooleanRectangularToggleButton, %7B
+ && options.content.dispose();%0A    %7D;%0A  %7D%0A
 %0A  /
@@ -1144,16 +1144,31 @@
 @public%0A
+   * @override%0A
    */%0A  
@@ -1178,18 +1178,8 @@
 pose
-: function
 () %7B
@@ -1237,73 +1237,113 @@
     
-RectangularToggleButton.prototype.dispose.call( this );%0A  %7D%0A%7D );%0A
+super.dispose();%0A  %7D%0A%7D%0A%0Asun.register( 'BooleanRectangularToggleButton', BooleanRectangularToggleButton );
 %0Aexp

convert BooleanRectangularToggleButton and subclasses to ES6, https://github.com/phetsims/tasks/issues/1044