diff --git a/bricks/message.js b/bricks/message.js index 3e434f5..4f9e6e9 100644 --- a/bricks/message.js +++ b/bricks/message.js @@ -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; } diff --git a/bricks/toolbar.js b/bricks/toolbar.js index 7a1a97b..2b46a20 100755 --- a/bricks/toolbar.js +++ b/bricks/toolbar.js @@ -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); }