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

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

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



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


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


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


org.apache.royale.html.ImageButton.prototype.get__src = function() {
  return this.model.url;
};


org.apache.royale.html.ImageButton.prototype.set__src = function(url) {
  this.model.url = url;
  
  var /** @type {string} */ inner = '';
  if (url)
    inner = "<img src='" + url + "'/>";
  this.element.innerHTML = inner;
  this.dispatchEvent(new org.apache.royale.events.Event("srcChanged"));
};


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


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



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