This commit is contained in:
yumoqing 2024-03-01 11:07:42 +08:00
parent cc2e090c96
commit 1dfd882950
2 changed files with 9 additions and 16 deletions

View File

@ -25,15 +25,15 @@ bricks.BPopup = class extends bricks.VBox {
build(){
var tb = new bricks.HBox({height:'40px'});
tb.set_css('title');
VBox.prototype.add_widget.bind(this)(tb);
bricks.VBox.prototype.add_widget.bind(this)(tb);
var tit = new bricks.Text({otext:this.title, i18n:true});
this.content = new bricks.VBox({});
VBox.prototype.add_widget.bind(this)(this.content);
bricks.VBox.prototype.add_widget.bind(this)(this.content);
tb.add_widget(tit);
this.holder = Body;
this.holder = bricks.Body;
if (this.opts.holder){
if (type(this.opts.holder) == 'string'){
this.holder = getWidgetById(this.opts.holder, Body);
this.holder = getWidgetById(this.opts.holder, bricks.Body);
} else {
this.holder = this.opts.holder;
}

View File

@ -15,21 +15,15 @@ bricks.Toolbar = class extends bricks.Layout {
css:
}
event:
ready: after all the tools built, fire this event
command: after user click one of the tool will fire the event with params of the tools[i] object.
remove: after user delete a removable tool from the toolbar, will fire the event with its tool description object as params. the params can reach with event.params.
*/
constructor(options){
super(options);
this.toolList = [];
if (this.opts.orientation == 'vertical'){
this.bar = new bricks.VBox(options);
this.bar = new bricks.VScrollPanel(options);
this.dom_element.classList.add('vtoolbar')
} else {
this.bar = new bricks.HBox(options);
this.bar = new bricks.HScrollPanel(options);
this.dom_element.classList.add('htoolbar')
}
this.add_widget(this.bar);
@ -56,7 +50,6 @@ bricks.Toolbar = class extends bricks.Layout {
this.add_interval_box();
}
}
this.dispatch('ready');
}
createTool = async function(desc){
var options = {
@ -92,15 +85,15 @@ bricks.Toolbar = class extends bricks.Layout {
}
do_handle(tool, event){
// var tool = event.target;
console.log('Toolbar() onclock,target=', event.target, tool);
var e = new Event('command');
console.log('Toolbar() onclick,target=', event.target, tool);
var d = {};
bricks.extend(d, tool.tool_opts);
if (this.opts.target){
d.target = this.opts.target;
}
this.dispatch('command', d);
this.dispatch(tool.tool_opts.name, d);
console.log('event ', tool.tool_opts.name, ' fired ...')
if (this.clicked_btn){
this.clicked_btn.set_css(this.preffix_css + '-button-active', true);
}