Changeset 1767

Show
Ignore:
Timestamp:
10/20/06 17:27:10 (2 years ago)
Author:
kinoshita
Message:

#198

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • spinelz/trunk/src/javascripts/spinelz/window.js

    r1754 r1767  
    106106      restriction: false, 
    107107      endDrag: Prototype.emptyFunction, 
    108       endResize: Prototype.emptyFunction 
     108      endResize: Prototype.emptyFunction, 
     109      addButton: Prototype.emptyFunction 
    109110    }, arguments[1] || {}); 
    110111     
     
    211212      Event.observe(minButton, 'click', this.minimize.bindAsEventListener(this)); 
    212213    } 
    213    
     214 
     215    if (this.options.addButton) { 
     216      var addButton = this.options.addButton; 
     217      if (addButton.constructor == Function) { 
     218        addButton(buttonHolder); 
     219      } else if (addButton.constructor == Array) { 
     220        var self = this; 
     221        var firstChild = buttonHolder.firstChild; 
     222        addButton.each(function(b) { 
     223          var button = Builder.node('div', {id: b.id, className: b.className}); 
     224          Event.observe(button, 'click', b.onclick.bindAsEventListener(self)); 
     225          if (b.first && firstChild) { 
     226            buttonHolder.insertBefore(button, firstChild); 
     227          } else { 
     228            buttonHolder.appendChild(button); 
     229          } 
     230        }); 
     231      } 
     232    } 
    214233  }, 
    215234   
    216235  buildBody: function(contents) { 
    217      
    218236    var bodyLeft = Builder.node('div', {className: Window.className.bodyLeft}); 
    219237    this.classNames.addClassNames(bodyLeft, 'bodyLeft'); 
  • spinelz/trunk/src/stylesheets/spinelz/window.css

    r1496 r1767  
    4646 
    4747.window_buttonHolder{ 
    48   width: 42px; 
     48  width: 48px; 
    4949  height: 12px; 
    5050  position: absolute; 
  • spinelz/trunk/test/window.html

    r1754 r1767  
    2424    width: 300px; 
    2525    height: 300px; 
     26  } 
     27 
     28  .test_button_class { 
     29    float:right; 
     30    border: 0px; 
     31    overflow: hidden; 
     32    cursor:pointer; 
     33    font-size: 5px; 
     34    width: 12px; 
     35    height:12px; 
     36    background-image: url('../src/images/spinelz/tabBox_close.gif'); 
     37    background-repeat: no-repeat; 
     38    background-position: 0 0; 
    2639  } 
    2740  </style> 
     
    115128  var win3 = new Window('window3',{modal:true, resize: false, maxButton: false}); 
    116129 
    117   var win4 = new Window('restrictionWindow',{restriction: true, width: 100, height: 100}); 
     130  var win4 = new Window('restrictionWindow', 
     131               { 
     132                 restriction: true, 
     133                 width: 100, 
     134                 height: 100, 
     135                 addButton: [ 
     136                   {id: 'test_button_id', className: 'test_button_class', onclick: function() {alert('click button!')}} 
     137                 ] 
     138               }); 
    118139  win4.open(); 
    119140