This commit is contained in:
yumoqing 2024-10-29 15:43:52 +08:00
parent 74f87faf01
commit 3f8caaae81

View File

@ -17,6 +17,7 @@ bricks.Popup = class extends bricks.VBox {
this.issub = false; this.issub = false;
this.opened = false; this.opened = false;
this.set_css('popup'); this.set_css('popup');
this.old_add_widget = super.add_widget.bind(this);
const zindex = bricks.app.new_zindex(); const zindex = bricks.app.new_zindex();
this.set_style('zIndex', zindex); this.set_style('zIndex', zindex);
this.moving_w = this; this.moving_w = this;
@ -61,7 +62,7 @@ bricks.Popup = class extends bricks.VBox {
} }
} }
add_widget(w, index){ add_widget(w, index){
super.add_widget(w, index); this.old_add_widget(w, index);
if (this.auto_open){ if (this.auto_open){
this.open(); this.open();
} }
@ -76,7 +77,6 @@ bricks.Popup = class extends bricks.VBox {
left:l + 'px' left:l + 'px'
} }
} }
var _add_widget = super.add_widget;
open(){ open(){
var rect; var rect;
if (this.opened) { if (this.opened) {
@ -134,19 +134,21 @@ bricks.Popup = class extends bricks.VBox {
bricks.PopupWindow = class extends bricks.Popup { bricks.PopupWindow = class extends bricks.Popup {
constructor(opts){ constructor(opts){
super(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.title_bar.set_css('titlebar')
this.content_w = new bricks.Filler({}); this.content_w = new bricks.Filler({});
this.auto_destroy = false; this.auto_destroy = false;
this.moving_w = this.title_bar; this.moving_w = this.title_bar;
super._add_widget(this.title_bar); this.old_add_widget = bricks.Layout.prototype.add_widget.bind(this);
super._add_widget(this.content_w); console.log(this.old_add_widget);
this.old_add_widget(this.title_bar);
this.old_add_widget(this.content_w);
this.build_title_bar(); this.build_title_bar();
} }
build_title_bar(){ build_title_bar(){
this.tb_w = new bricks.IconBar( { this.tb_w = new bricks.IconBar( {
margin:'5px', margin:'5px',
rate:1 rate:1,
tools:[ tools:[
{ {
name:'delete', 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('delete', this.destroy.bind(this));
this.tb_w.bind('minimax', this.dismiss.bind(this)); this.tb_w.bind('minimax', this.dismiss.bind(this));
this.tb_w.bind('fullscreen', this.enter_fullscreen.bind(this)); this.tb_w.bind('fullscreen', this.enter_fullscreen.bind(this));