<commit_before>// Copyright 2018, University of Colorado Boulder

/**
 * A checkbox that is labeled with text, with an optional icon to the right of the text.
 * This also provides consistent font and textNode.maxWidth for all checkboxes in the sim.
 *
 * @author <NAME> (PixelZoom, Inc.)
 */
define( require => {
  'use strict';

  // modules
  const Checkbox = require( 'SUN/Checkbox' );
  const GQConstants = require( 'GRAPHING_QUADRATICS/common/GQConstants' );
  const HBox = require( 'SCENERY/nodes/HBox' );
  const graphingQuadratics = require( 'GRAPHING_QUADRATICS/graphingQuadratics' );
  const PhetFont = require( 'SCENERY_PHET/PhetFont' );
  const RichText = require( 'SCENERY/nodes/RichText' );

  class GQCheckbox extends Checkbox {

    /**
     * @param {string} text - supports RichText
     * @param {BooleanProperty} booleanProperty
     * @param {Object} [options]
     */
    constructor( text, booleanProperty, options ) {

      options = _.extend( {
        textFill: 'black',
        icon: null // {Node|null} optional icon, to the right of text
      }, options );

      const textNode = new RichText( text, {
        fill: options.textFill,
        font: new PhetFont( GQConstants.CHECKBOX_LABEL_FONT_SIZE ),
        maxWidth: GQConstants.CHECKBOX_TEXT_MAX_WIDTH
      } );

      let content = null;
      if ( options.icon ) {
        content = new HBox( {
          align: 'center',
          spacing: GQConstants.CHECKBOX_ICON_SPACING,
          children: [ textNode, options.icon ]
        } );
      }
      else {
        content = textNode;
      }

      super( content, booleanProperty, options );
    }
  }

  return graphingQuadratics.register( 'GQCheckbox', GQCheckbox );
} );<commit_msg>Tandem.required in GQCheckbox base class, #64<commit_after>// Copyright 2018, University of Colorado Boulder

/**
 * A checkbox that is labeled with text, with an optional icon to the right of the text.
 * This also provides consistent font and textNode.maxWidth for all checkboxes in the sim.
 *
 * @author <NAME> (PixelZoom, Inc.)
 */
define( require => {
  'use strict';

  // modules
  const Checkbox = require( 'SUN/Checkbox' );
  const GQConstants = require( 'GRAPHING_QUADRATICS/common/GQConstants' );
  const HBox = require( 'SCENERY/nodes/HBox' );
  const graphingQuadratics = require( 'GRAPHING_QUADRATICS/graphingQuadratics' );
  const PhetFont = require( 'SCENERY_PHET/PhetFont' );
  const RichText = require( 'SCENERY/nodes/RichText' );
  const Tandem = require( 'TANDEM/Tandem' );

  class GQCheckbox extends Checkbox {

    /**
     * @param {string} text - supports RichText
     * @param {BooleanProperty} booleanProperty
     * @param {Object} [options]
     */
    constructor( text, booleanProperty, options ) {

      options = _.extend( {
        textFill: 'black',
        icon: null, // {Node|null} optional icon, to the right of text
        tandem: Tandem.required // {Tandem} all Checkboxes in this sim must be instrumented
      }, options );

      const textNode = new RichText( text, {
        fill: options.textFill,
        font: new PhetFont( GQConstants.CHECKBOX_LABEL_FONT_SIZE ),
        maxWidth: GQConstants.CHECKBOX_TEXT_MAX_WIDTH
      } );

      let content = null;
      if ( options.icon ) {
        content = new HBox( {
          align: 'center',
          spacing: GQConstants.CHECKBOX_ICON_SPACING,
          children: [ textNode, options.icon ]
        } );
      }
      else {
        content = textNode;
      }

      super( content, booleanProperty, options );
    }
  }

  return graphingQuadratics.register( 'GQCheckbox', GQCheckbox );
} );
{'fraction_non_alphanumeric': 0.10844370860927152, 'fraction_numerical': 0.0027593818984547464, 'mean_word_length': 2.8117770767613037, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 7, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5974362', 'n_tokens_mistral': 1145, 'n_tokens_neox': 1108, 'n_words': 306}