fix the changing of the theme on the fly

This commit is contained in:
Damien Churchill 2008-08-11 23:31:03 +00:00
parent 7f4b433e49
commit fd004a1d07
2 changed files with 23 additions and 5 deletions

View File

@ -57,7 +57,7 @@ Deluge.UI = {
window.addEvent('resize', this.bound.resized);
Deluge.UI.update();
$('overlay').destroy();
this.overlay = $('overlay').dispose();
},
initialize_grid: function() {
@ -146,11 +146,20 @@ Deluge.UI = {
},
setTheme: function(name, fn) {
if (this.overlay) {
this.overlay.inject(document.body);
}
this.theme = name;
if (this.themecss) this.themecss.destroy();
this.themecss = new Asset.css('/template/static/themes/' + name + '/style.css');
Cookie.write('theme', name);
if (this.vbox) this.vbox.refresh();
if (this.overlay) {
var temp = function() {
this.vbox.refresh();
this.vbox.calculatePositions();
this.overlay.dispose();
}.bind(this).delay(100);
};
},
run: function() {

View File

@ -366,10 +366,11 @@ Widgets.Base = new Class({
},
refresh: function() {
this.element.removeProperty('style');
this.width = (this.options.width) ? this.options.width : this.element.getStyle('width').toInt()
this.height = (this.options.height) ? this.options.height : this.element.getStyle('height').toInt()
this.getSizeModifiers();
if (this.calculatePositions) this.calculatePositions();
if (this.refreshChildren) this.refreshChildren();
},
expand: function() {
@ -959,8 +960,8 @@ Widgets.VBox = new Class({
box = $W(box)
box.boxinfo = (options) ? options : {fixed: false};
this.boxes.include(box);
this.element.grab(box)
box.element.setStyle('position', 'absolute')
this.element.grab(box);
box.element.setStyle('position', 'absolute');
},
calculatePositions: function() {
@ -990,6 +991,7 @@ Widgets.VBox = new Class({
boxinfo.width = size.x - box.element.modifiers.x
boxinfo.top = position.y
boxinfo.left = position.x
box.sets({
height: boxinfo.height,
width: boxinfo.width,
@ -998,6 +1000,13 @@ Widgets.VBox = new Class({
})
position.y += box.height + box.element.modifiers.y
}, this)
},
refreshChildren: function() {
this.boxes.each(function(box) {
box.refresh();
box.element.setStyle('position', 'absolute');
});
}
})
/*