/**
 * Generated by Apache Royale Compiler from org\apache\royale\jewel\ImageButton.as
 * org.apache.royale.jewel.ImageButton
 *
 * @fileoverview
 *
 * @suppress {checkTypes|accessControls}
 */

goog.provide('org.apache.royale.jewel.ImageButton');

goog.require('org.apache.royale.core.WrappedHTMLElement');
goog.require('org.apache.royale.events.Event');
goog.require('org.apache.royale.html.util.addElementToWrapper');
goog.require('org.apache.royale.jewel.Button');
goog.require('org.apache.royale.jewel.beads.models.ImageModel');
goog.require('org.apache.royale.utils.Language');



/**
 *  Constructor.
 *
 *  @langversion 3.0
 *  @playerversion Flash 10.2
 *  @playerversion AIR 2.6
 *  @productversion Royale 0.0
 * @constructor
 * @extends {org.apache.royale.jewel.Button}
 */
org.apache.royale.jewel.ImageButton = function() {
  org.apache.royale.jewel.ImageButton.base(this, 'constructor');
  this.typeNames = "jewel imagebutton";
};
goog.inherits(org.apache.royale.jewel.ImageButton, org.apache.royale.jewel.Button);


/**
 * Prevent renaming of class. Needed for reflection.
 */
goog.exportSymbol('org.apache.royale.jewel.ImageButton', org.apache.royale.jewel.ImageButton);


/**
 * @royaleignorecoercion org.apache.royale.core.WrappedHTMLElement
 * @protected
 * @override
 */
org.apache.royale.jewel.ImageButton.prototype.createElement = function() {
  org.apache.royale.html.util.addElementToWrapper(this, 'input');
  this.element.setAttribute('type', 'image');
  this.positioner = this.element;
  return this.element;
};


org.apache.royale.jewel.ImageButton.prototype.get__src = function() {
  return org.apache.royale.utils.Language.as(this.model, org.apache.royale.jewel.beads.models.ImageModel, true).url;
};


org.apache.royale.jewel.ImageButton.prototype.set__src = function(url) {
  org.apache.royale.utils.Language.as(this.model, org.apache.royale.jewel.beads.models.ImageModel, true).url = url;
  
  if (url) {
    org.apache.royale.utils.Language.as(this.element, HTMLInputElement).src = url;
  }
  this.dispatchEvent(new org.apache.royale.events.Event("srcChanged"));
};


Object.defineProperties(org.apache.royale.jewel.ImageButton.prototype, /** @lends {org.apache.royale.jewel.ImageButton.prototype} */ {
/**
  * @export
  * @type {string} */
src: {
get: org.apache.royale.jewel.ImageButton.prototype.get__src,
set: org.apache.royale.jewel.ImageButton.prototype.set__src}}
);


/**
 * Metadata
 *
 * @type {Object.<string, Array.<Object>>}
 */
org.apache.royale.jewel.ImageButton.prototype.ROYALE_CLASS_INFO = { names: [{ name: 'ImageButton', qName: 'org.apache.royale.jewel.ImageButton', kind: 'class' }] };



/**
 * Reflection
 *
 * @return {Object.<string, Function>}
 */
org.apache.royale.jewel.ImageButton.prototype.ROYALE_REFLECTION_INFO = function () {
  return {
    variables: function () {return {};},
    accessors: function () {
      return {
        'src': { type: 'String', access: 'readwrite', declaredBy: 'org.apache.royale.jewel.ImageButton', metadata: function () { return [ { name: 'Bindable', args: [ { key: '', value: 'srcChanged' } ] } ]; }}
      };
    },
    methods: function () {
      return {
        'ImageButton': { type: '', declaredBy: 'org.apache.royale.jewel.ImageButton'}
      };
    }
  };
};