      1 // ==========================================================================
      2 // Project:   The M-Project - Mobile HTML5 Application Framework
      3 // Copyright: (c) 2010 M-Way Solutions GmbH. All rights reserved.
      4 // Creator:   Dominik
      5 // Date:      04.11.2010
      6 // License:   Dual licensed under the MIT or GPL Version 2 licenses.
      7 //            http://github.com/mwaylabs/The-M-Project/blob/master/MIT-LICENSE
      8 //            http://github.com/mwaylabs/The-M-Project/blob/master/GPL-LICENSE
      9 // ==========================================================================
     10
     11 /**
     12  * @class
     13  *
     14  * The is the prototype of any image view. It basically renders a simple image and
     15  * can be styled using a css class.
     16  *
     17  * @extends M.View
     18  */
     19 M.ImageView = M.View.extend(
     20 /** @scope M.ImageView.prototype */ {
     21
     22     /**
     23      * The type of this object.
     24      *
     25      * @type String
     26      */
     27     type: 'M.ImageView',
     28
     29     /**
     30      * Renders an image view based on the specified layout.
     31      *
     32      * @private
     33      * @returns {String} The image view's html representation.
     34      */
     35     render: function() {
     36         this.html += '<img id="' + this.id + '" src="' + this.value + '"' + this.style() + '>';
     37         return this.html;
     38     },
     39
     40     /**
     41      * Applies some style-attributes to the image view.
     42      *
     43      * @private
     44      * @returns {String} The image view's styling as html representation.
     45      */
     46     style: function() {
     47         var html = '';
     48         if(this.cssClass) {
     49             html += ' class="' + this.cssClass + '"';
     50         }
     51         return html;
     52     }
     53
     54 });