src/js/layout.js
branchpopcorn-port
changeset 525 af5248f4d37e
parent 499 0a09ff3db7c2
child 539 3ba5b82aebb6
equal deleted inserted replaced
524:a06527b99f22 525:af5248f4d37e
     1 /* layout.js - very basic layout management */
     1 /* layout.js - very basic layout management */
     2 
     2 
     3 /*
     3 /**
     4   a layout manager manages a div and the layout of objects
     4   @class a layout manager manages a div and the layout of objects
     5   inside it.
     5   inside it.
     6 */
     6 */
     7 
       
     8 IriSP.LayoutManager = function(options) {
     7 IriSP.LayoutManager = function(options) {
     9     this._Popcorn = null;
     8     this._Popcorn = null;
    10     this._widgets = [];
     9     this._widgets = [];
    11     
    10     
    12     this._div = "LdtPlayer";
    11     this._div = "LdtPlayer";
    35     
    34     
    36     if (this._height !== undefined)
    35     if (this._height !== undefined)
    37       this.selector.css("height", this._height);
    36       this.selector.css("height", this._height);
    38 };
    37 };
    39 
    38 
    40 /* we need this special setter because of a chicken and egg problem :
    39 /** 
       
    40    Set the popcorn instance used by the manager.
       
    41    
       
    42    we need this special setter because of a chicken and egg problem :
    41    we want the manager to use popcorn but the popcorn div will be managed
    43    we want the manager to use popcorn but the popcorn div will be managed
    42    by the manager. So we need a way to set the instance the manager uses
    44    by the manager. So we need a way to set the instance the manager uses
    43 */
    45 */
    44    
    46    
    45 IriSP.LayoutManager.prototype.setPopcornInstance = function(popcorn) {
    47 IriSP.LayoutManager.prototype.setPopcornInstance = function(popcorn) {
    46     this._Popcorn = popcorn;
    48     this._Popcorn = popcorn;
    47 }
    49 }
    48 
    50 
    49 /* stem is a string to append to the id of the widget */
    51 /** create a subdiv with an unique id, and a spacer div as well.
       
    52     @param stem stem is a string to append to the id of the widget
       
    53     @return an array of the form [createdivId, spacerdivId].
       
    54 */
    50 IriSP.LayoutManager.prototype.createDiv = function(stem) {
    55 IriSP.LayoutManager.prototype.createDiv = function(stem) {
    51     if (typeof(stem) === "undefined")
    56     if (typeof(stem) === "undefined")
    52        stem = "";
    57        stem = "";
    53 
    58 
    54     var newDiv = IriSP.guid(this._div + "_widget_" + stem + "_");
    59     var newDiv = IriSP.guid(this._div + "_widget_" + stem + "_");