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

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

goog.require('org.apache.royale.core.WrappedHTMLElement');
goog.require('org.apache.royale.html.TextButton');
goog.require('org.apache.royale.html.beads.models.ImageAndTextModel');
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.TextButton}
 */
org.apache.royale.html.ImageAndTextButton = function() {
  org.apache.royale.html.ImageAndTextButton.base(this, 'constructor');
};
goog.inherits(org.apache.royale.html.ImageAndTextButton, org.apache.royale.html.TextButton);


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


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


/**
 * @protected
 */
org.apache.royale.html.ImageAndTextButton.prototype.setInnerHTML = function() {
  var /** @type {string} */ inner = '';
  if (this.image != null)
    inner += "<img src='" + this.image + "'/>";
  inner += '&nbsp;';
  inner += this.text;
  this.element.innerHTML = inner;
};


org.apache.royale.html.ImageAndTextButton.prototype.get__text = function() {
  return this.model.text;
};


org.apache.royale.html.ImageAndTextButton.prototype.set__text = function(value) {
  this.model.text = value;
  this.setInnerHTML();
};


org.apache.royale.html.ImageAndTextButton.prototype.get__image = function() {
  return this.model.image;
};


org.apache.royale.html.ImageAndTextButton.prototype.set__image = function(value) {
  this.model.image = value;
  this.setInnerHTML();
};


Object.defineProperties(org.apache.royale.html.ImageAndTextButton.prototype, /** @lends {org.apache.royale.html.ImageAndTextButton.prototype} */ {
/**
  * @export
  * @type {string} */
text: {
get: org.apache.royale.html.ImageAndTextButton.prototype.get__text,
set: org.apache.royale.html.ImageAndTextButton.prototype.set__text},
/**
  * @export
  * @type {string} */
image: {
get: org.apache.royale.html.ImageAndTextButton.prototype.get__image,
set: org.apache.royale.html.ImageAndTextButton.prototype.set__image}}
);


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



/**
 * Reflection
 *
 * @return {Object.<string, Function>}
 */
org.apache.royale.html.ImageAndTextButton.prototype.ROYALE_REFLECTION_INFO = function () {
  return {
    variables: function () {return {};},
    accessors: function () {
      return {
        'text': { type: 'String', access: 'readwrite', declaredBy: 'org.apache.royale.html.ImageAndTextButton'},
        'image': { type: 'String', access: 'readwrite', declaredBy: 'org.apache.royale.html.ImageAndTextButton'}
      };
    },
    methods: function () {
      return {
        'ImageAndTextButton': { type: '', declaredBy: 'org.apache.royale.html.ImageAndTextButton'}
      };
    }
  };
};