src/js/widgets.js
author hamidouk
Mon, 14 Nov 2011 17:19:26 +0100
branchrequire-js
changeset 238 6008172a0592
parent 170 5150ae56e0a6
permissions -rw-r--r--
converted all the source files to use the require.js syntax.
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
66
13013b9452af Added a new file to the build, widgets.js, to contain widget classes.
hamidouk
parents:
diff changeset
     1
/* the widget classes and definitions */
13013b9452af Added a new file to the build, widgets.js, to contain widget classes.
hamidouk
parents:
diff changeset
     2
238
6008172a0592 converted all the source files to use the require.js syntax.
hamidouk
parents: 170
diff changeset
     3
define(["IriSP"], function() {
6008172a0592 converted all the source files to use the require.js syntax.
hamidouk
parents: 170
diff changeset
     4
  IriSP.Widget = function(Popcorn, config, Serializer) {
114
eda061f1aa75 added a .selector object to all the widgets.
hamidouk
parents: 98
diff changeset
     5
238
6008172a0592 converted all the source files to use the require.js syntax.
hamidouk
parents: 170
diff changeset
     6
    if (config === undefined || config === null) {
6008172a0592 converted all the source files to use the require.js syntax.
hamidouk
parents: 170
diff changeset
     7
      config = {}
6008172a0592 converted all the source files to use the require.js syntax.
hamidouk
parents: 170
diff changeset
     8
    }
6008172a0592 converted all the source files to use the require.js syntax.
hamidouk
parents: 170
diff changeset
     9
    
6008172a0592 converted all the source files to use the require.js syntax.
hamidouk
parents: 170
diff changeset
    10
    this._Popcorn = Popcorn;
6008172a0592 converted all the source files to use the require.js syntax.
hamidouk
parents: 170
diff changeset
    11
    this._config = config;  
6008172a0592 converted all the source files to use the require.js syntax.
hamidouk
parents: 170
diff changeset
    12
    this._serializer = Serializer;
6008172a0592 converted all the source files to use the require.js syntax.
hamidouk
parents: 170
diff changeset
    13
    
6008172a0592 converted all the source files to use the require.js syntax.
hamidouk
parents: 170
diff changeset
    14
    if (config.hasOwnProperty("container")) {
6008172a0592 converted all the source files to use the require.js syntax.
hamidouk
parents: 170
diff changeset
    15
       this._id = config.container;
6008172a0592 converted all the source files to use the require.js syntax.
hamidouk
parents: 170
diff changeset
    16
       this.selector = IriSP.jQuery("#" + this._id);
6008172a0592 converted all the source files to use the require.js syntax.
hamidouk
parents: 170
diff changeset
    17
    }
124
2758dfb208b2 changed widget.js to add some properties to the widget. Widgets now only get the
hamidouk
parents: 122
diff changeset
    18
238
6008172a0592 converted all the source files to use the require.js syntax.
hamidouk
parents: 170
diff changeset
    19
    if (config.hasOwnProperty("width")) {
6008172a0592 converted all the source files to use the require.js syntax.
hamidouk
parents: 170
diff changeset
    20
       // this.width and not this._width because we consider it public.
6008172a0592 converted all the source files to use the require.js syntax.
hamidouk
parents: 170
diff changeset
    21
       this.width = config.width;     
6008172a0592 converted all the source files to use the require.js syntax.
hamidouk
parents: 170
diff changeset
    22
    }
6008172a0592 converted all the source files to use the require.js syntax.
hamidouk
parents: 170
diff changeset
    23
    
6008172a0592 converted all the source files to use the require.js syntax.
hamidouk
parents: 170
diff changeset
    24
    if (config.hasOwnProperty("height")) {    
6008172a0592 converted all the source files to use the require.js syntax.
hamidouk
parents: 170
diff changeset
    25
       this.height = config.height;     
6008172a0592 converted all the source files to use the require.js syntax.
hamidouk
parents: 170
diff changeset
    26
    }
6008172a0592 converted all the source files to use the require.js syntax.
hamidouk
parents: 170
diff changeset
    27
    
6008172a0592 converted all the source files to use the require.js syntax.
hamidouk
parents: 170
diff changeset
    28
    if (config.hasOwnProperty("heightmax")) {
6008172a0592 converted all the source files to use the require.js syntax.
hamidouk
parents: 170
diff changeset
    29
       this.heightmax = config.heightmax;     
6008172a0592 converted all the source files to use the require.js syntax.
hamidouk
parents: 170
diff changeset
    30
    }
170
5150ae56e0a6 added two new config values for a widget : heightmax and widthmax.
hamidouk
parents: 124
diff changeset
    31
238
6008172a0592 converted all the source files to use the require.js syntax.
hamidouk
parents: 170
diff changeset
    32
    if (config.hasOwnProperty("widthmax")) {
6008172a0592 converted all the source files to use the require.js syntax.
hamidouk
parents: 170
diff changeset
    33
       this.widthmax = config.widthmax;     
6008172a0592 converted all the source files to use the require.js syntax.
hamidouk
parents: 170
diff changeset
    34
    }
6008172a0592 converted all the source files to use the require.js syntax.
hamidouk
parents: 170
diff changeset
    35
    
6008172a0592 converted all the source files to use the require.js syntax.
hamidouk
parents: 170
diff changeset
    36
  };
66
13013b9452af Added a new file to the build, widgets.js, to contain widget classes.
hamidouk
parents:
diff changeset
    37
238
6008172a0592 converted all the source files to use the require.js syntax.
hamidouk
parents: 170
diff changeset
    38
  IriSP.Widget.prototype.draw = function() {
6008172a0592 converted all the source files to use the require.js syntax.
hamidouk
parents: 170
diff changeset
    39
    /* implemented by "sub-classes" */  
6008172a0592 converted all the source files to use the require.js syntax.
hamidouk
parents: 170
diff changeset
    40
  };
74
d7a7d7216371 lots of changes to the player widget...
hamidouk
parents: 66
diff changeset
    41
238
6008172a0592 converted all the source files to use the require.js syntax.
hamidouk
parents: 170
diff changeset
    42
  IriSP.Widget.prototype.redraw = function() {
6008172a0592 converted all the source files to use the require.js syntax.
hamidouk
parents: 170
diff changeset
    43
    /* implemented by "sub-classes" */  
6008172a0592 converted all the source files to use the require.js syntax.
hamidouk
parents: 170
diff changeset
    44
  };
6008172a0592 converted all the source files to use the require.js syntax.
hamidouk
parents: 170
diff changeset
    45
});