src/js/widgets.js
branchrequire-js
changeset 238 6008172a0592
parent 170 5150ae56e0a6
equal deleted inserted replaced
237:8f99b0df3278 238:6008172a0592
     1 /* the widget classes and definitions */
     1 /* the widget classes and definitions */
     2 
     2 
     3 IriSP.Widget = function(Popcorn, config, Serializer) {
     3 define(["IriSP"], function() {
       
     4   IriSP.Widget = function(Popcorn, config, Serializer) {
     4 
     5 
     5   if (config === undefined || config === null) {
     6     if (config === undefined || config === null) {
     6     config = {}
     7       config = {}
     7   }
     8     }
     8   
     9     
     9   this._Popcorn = Popcorn;
    10     this._Popcorn = Popcorn;
    10   this._config = config;  
    11     this._config = config;  
    11   this._serializer = Serializer;
    12     this._serializer = Serializer;
    12   
    13     
    13   if (config.hasOwnProperty("container")) {
    14     if (config.hasOwnProperty("container")) {
    14      this._id = config.container;
    15        this._id = config.container;
    15      this.selector = IriSP.jQuery("#" + this._id);
    16        this.selector = IriSP.jQuery("#" + this._id);
    16   }
    17     }
    17 
    18 
    18   if (config.hasOwnProperty("width")) {
    19     if (config.hasOwnProperty("width")) {
    19      // this.width and not this._width because we consider it public.
    20        // this.width and not this._width because we consider it public.
    20      this.width = config.width;     
    21        this.width = config.width;     
    21   }
    22     }
    22   
    23     
    23   if (config.hasOwnProperty("height")) {    
    24     if (config.hasOwnProperty("height")) {    
    24      this.height = config.height;     
    25        this.height = config.height;     
    25   }
    26     }
    26   
    27     
    27   if (config.hasOwnProperty("heightmax")) {
    28     if (config.hasOwnProperty("heightmax")) {
    28      this.heightmax = config.heightmax;     
    29        this.heightmax = config.heightmax;     
    29   }
    30     }
    30 
    31 
    31   if (config.hasOwnProperty("widthmax")) {
    32     if (config.hasOwnProperty("widthmax")) {
    32      this.widthmax = config.widthmax;     
    33        this.widthmax = config.widthmax;     
    33   }
    34     }
    34   
    35     
    35 };
    36   };
    36 
    37 
    37 IriSP.Widget.prototype.draw = function() {
    38   IriSP.Widget.prototype.draw = function() {
    38   /* implemented by "sub-classes" */  
    39     /* implemented by "sub-classes" */  
    39 };
    40   };
    40 
    41 
    41 IriSP.Widget.prototype.redraw = function() {
    42   IriSP.Widget.prototype.redraw = function() {
    42   /* implemented by "sub-classes" */  
    43     /* implemented by "sub-classes" */  
    43 };
    44   };
       
    45 });