diff --git a/core/field_textdropdown.js b/core/field_textdropdown.js index 4e192a33f6..e2c7a094cd 100644 --- a/core/field_textdropdown.js +++ b/core/field_textdropdown.js @@ -72,6 +72,29 @@ Blockly.FieldTextDropdown.fromJson = function(element) { return field; }; +/** + * Horizontal distance that a checkmark overhangs the dropdown. + */ +Blockly.FieldTextDropdown.CHECKMARK_OVERHANG = Blockly.FieldDropdown.CHECKMARK_OVERHANG; + +/** + * Mouse cursor style when over the hotspot that initiates the editor. + */ +Blockly.FieldTextDropdown.prototype.CURSOR = Blockly.FieldTextInput.prototype.CURSOR; + +/** + * Closure menu item currently selected. + * @type {?goog.ui.MenuItem} + */ +Blockly.FieldTextDropdown.prototype.selectedItem = Blockly.FieldDropdown.prototype.selectedItem; + +/** + * Language-neutral currently selected string or image object. + * @type {string|!Object} + * @private + */ +Blockly.FieldTextDropdown.prototype.value_ = Blockly.FieldDropdown.prototype.value_; + /** * Install this text drop-down field on a block. */ @@ -106,18 +129,6 @@ Blockly.FieldTextDropdown.prototype.init = function() { this.disableColourChange_ = true; }; -/** - * Close the input widget if this input is being deleted. - */ -Blockly.FieldTextDropdown.prototype.dispose = function() { - if (this.mouseUpWrapper_) { - Blockly.unbindEvent_(this.mouseUpWrapper_); - this.mouseUpWrapper_ = null; - Blockly.Touch.clearTouchIdentifier(); - } - Blockly.FieldTextDropdown.superClass_.dispose.call(this); -}; - /** * If the drop-down isn't open, show the text editor. */ @@ -133,6 +144,18 @@ Blockly.FieldTextDropdown.prototype.showEditor_ = function() { } }; +/** + * Callback when the drop-down menu is hidden. + */ +Blockly.FieldTextDropdown.prototype.onHide = Blockly.FieldDropdown.prototype.onHide; + +/** + * Handle the selection of an item in the dropdown menu. + * @param {!goog.ui.Menu} menu The Menu component clicked. + * @param {!goog.ui.MenuItem} menuItem The MenuItem selected within menu. + */ +Blockly.FieldTextDropdown.prototype.onItemSelected = Blockly.FieldDropdown.prototype.onItemSelected; + /** * Return a list of the options for this dropdown. * See: Blockly.FieldDropDown.prototype.getOptions_. @@ -140,7 +163,25 @@ Blockly.FieldTextDropdown.prototype.showEditor_ = function() { * (human-readable text, language-neutral name). * @private */ -Blockly.FieldTextDropdown.prototype.getOptions_ = Blockly.FieldDropdown.prototype.getOptions_; +Blockly.FieldTextDropdown.prototype.getOptions = Blockly.FieldDropdown.prototype.getOptions; + +/** + * Get the language-neutral value from this dropdown menu. + * @return {string} Current text. + */ +Blockly.FieldTextDropdown.prototype.getValue = Blockly.FieldDropdown.prototype.getValue; + +/** + * Set the language-neutral value for this dropdown menu. + * @param {string} newValue New value to set. + */ +Blockly.FieldTextDropdown.prototype.setValue = Blockly.FieldDropdown.prototype.setValue; + +/** + * @return {boolean} True if the option list is generated by a function. + * Otherwise false. + */ +Blockly.FieldTextDropdown.prototype.isOptionListDynamic = Blockly.FieldDropdown.prototype.isOptionListDynamic; /** * Position a drop-down arrow at the appropriate location at render-time. @@ -157,8 +198,15 @@ Blockly.FieldTextDropdown.prototype.positionArrow = Blockly.FieldDropdown.protot Blockly.FieldTextDropdown.prototype.showDropdown_ = Blockly.FieldDropdown.prototype.showEditor_; /** - * Callback when the drop-down menu is hidden. + * Close the input widget if this input is being deleted. */ -Blockly.FieldTextDropdown.prototype.onHide = Blockly.FieldDropdown.prototype.onHide; +Blockly.FieldTextDropdown.prototype.dispose = function() { + if (this.mouseUpWrapper_) { + Blockly.unbindEvent_(this.mouseUpWrapper_); + this.mouseUpWrapper_ = null; + Blockly.Touch.clearTouchIdentifier(); + } + Blockly.FieldTextDropdown.superClass_.dispose.call(this); +}; Blockly.Field.register('field_textdropdown', Blockly.FieldTextDropdown);