diff --git a/bricks/popup.js b/bricks/popup.js index cfc5d6d..53dc2cd 100644 --- a/bricks/popup.js +++ b/bricks/popup.js @@ -17,6 +17,7 @@ bricks.Popup = class extends bricks.VBox { this.issub = false; this.opened = false; this.set_css('popup'); + this.old_add_widget = super.add_widget.bind(this); const zindex = bricks.app.new_zindex(); this.set_style('zIndex', zindex); this.moving_w = this; @@ -61,7 +62,7 @@ bricks.Popup = class extends bricks.VBox { } } add_widget(w, index){ - super.add_widget(w, index); + this.old_add_widget(w, index); if (this.auto_open){ this.open(); } @@ -76,7 +77,6 @@ bricks.Popup = class extends bricks.VBox { left:l + 'px' } } - var _add_widget = super.add_widget; open(){ var rect; if (this.opened) { @@ -134,19 +134,21 @@ bricks.Popup = class extends bricks.VBox { bricks.PopupWindow = class extends bricks.Popup { constructor(opts){ super(opts); - this.title_bar = new bricks.HBox({cheight:1.5, width:100%}); + this.title_bar = new bricks.HBox({cheight:1, width:'100%'}); this.title_bar.set_css('titlebar') this.content_w = new bricks.Filler({}); this.auto_destroy = false; this.moving_w = this.title_bar; - super._add_widget(this.title_bar); - super._add_widget(this.content_w); + this.old_add_widget = bricks.Layout.prototype.add_widget.bind(this); + console.log(this.old_add_widget); + this.old_add_widget(this.title_bar); + this.old_add_widget(this.content_w); this.build_title_bar(); } build_title_bar(){ this.tb_w = new bricks.IconBar( { margin:'5px', - rate:1 + rate:1, tools:[ { name:'delete', @@ -168,7 +170,7 @@ bricks.PopupWindow = class extends bricks.Popup { } ] }); - this.title_bar_w.add_widget(this.tb_w); + this.title_bar.add_widget(this.tb_w); this.tb_w.bind('delete', this.destroy.bind(this)); this.tb_w.bind('minimax', this.dismiss.bind(this)); this.tb_w.bind('fullscreen', this.enter_fullscreen.bind(this));