src/js/layout.js
branchpopcorn-port
changeset 111 df08c7f9535c
child 113 ebfd0d17e427
equal deleted inserted replaced
110:048125f1a167 111:df08c7f9535c
       
     1 /* layout.js - very basic layout management */
       
     2 
       
     3 /*
       
     4   a layout manager manages a div and the layout of objects
       
     5   inside it.
       
     6 */
       
     7 
       
     8 IriSP.LayoutManager = function(options) {
       
     9     this._Popcorn = null;
       
    10     this._widgets = [];
       
    11     
       
    12     this._div = "#LdtPlayer";
       
    13     this._width = 640;
       
    14     this._height = 480;
       
    15     
       
    16     if (options === undefined) {
       
    17       options = {};
       
    18       console.error("The options parameter is undefined.");
       
    19     };
       
    20     
       
    21     if (options.hasOwnProperty('divId')) {
       
    22       this._div = options.divId;
       
    23     }
       
    24 
       
    25     if (options.hasOwnProperty('width')) {
       
    26       this._width = options.width;
       
    27     }    
       
    28     
       
    29     if (options.hasOwnProperty('height')) {
       
    30       this._height = options.height;
       
    31     } 
       
    32     
       
    33     IriSP.jQuery(this._div).css("width", this._width);
       
    34     IriSP.jQuery(this._div).css("height", this._height);
       
    35 };
       
    36 
       
    37 /* we need this special setter because of a chicken and egg problem :
       
    38    we want the manager to use popcorn but the popcorn div will be managed
       
    39    by the manager. So we need a way to set the instance the manager uses
       
    40 */
       
    41    
       
    42 IriSP.LayoutManager.prototype.setPopcornInstance = function(popcorn) {
       
    43     this._Popcorn = popcorn;
       
    44     /* FIXME - don't forget to add the popcorn messages handlers there */
       
    45 }
       
    46