src/js/layout.js
branchpopcorn-port
changeset 113 ebfd0d17e427
parent 111 df08c7f9535c
child 117 b0a699baf3f1
equal deleted inserted replaced
112:12b37d456341 113:ebfd0d17e427
     7 
     7 
     8 IriSP.LayoutManager = function(options) {
     8 IriSP.LayoutManager = function(options) {
     9     this._Popcorn = null;
     9     this._Popcorn = null;
    10     this._widgets = [];
    10     this._widgets = [];
    11     
    11     
    12     this._div = "#LdtPlayer";
    12     this._div = "LdtPlayer";
    13     this._width = 640;
    13     this._width = 640;
    14     this._height = 480;
    14     this._height = 480;
    15     
    15     
    16     if (options === undefined) {
    16     if (options === undefined) {
    17       options = {};
    17       options = {};
    28     
    28     
    29     if (options.hasOwnProperty('height')) {
    29     if (options.hasOwnProperty('height')) {
    30       this._height = options.height;
    30       this._height = options.height;
    31     } 
    31     } 
    32     
    32     
    33     IriSP.jQuery(this._div).css("width", this._width);
    33     /* this is a shortcut */
    34     IriSP.jQuery(this._div).css("height", this._height);
    34     this.selector = IriSP.jQuery("#" + this._div);
       
    35     
       
    36     this.selector.css("width", this._width);
       
    37     this.selector.css("height", this._height);
    35 };
    38 };
    36 
    39 
    37 /* we need this special setter because of a chicken and egg problem :
    40 /* 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
    41    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
    42    by the manager. So we need a way to set the instance the manager uses
    42 IriSP.LayoutManager.prototype.setPopcornInstance = function(popcorn) {
    45 IriSP.LayoutManager.prototype.setPopcornInstance = function(popcorn) {
    43     this._Popcorn = popcorn;
    46     this._Popcorn = popcorn;
    44     /* FIXME - don't forget to add the popcorn messages handlers there */
    47     /* FIXME - don't forget to add the popcorn messages handlers there */
    45 }
    48 }
    46 
    49 
       
    50 IriSP.LayoutManager.prototype.createDiv = function() {
       
    51     var newDiv = Popcorn.guid(this._div + "_widget_");
       
    52     this._widgets.push(newDiv);    
       
    53     this.selector.append("<div id='" + newDiv + "'></div");
       
    54     
       
    55     return newDiv;
       
    56 };