diff --git a/bricks/conform.js b/bricks/conform.js new file mode 100644 index 0000000..cfb8efb --- /dev/null +++ b/bricks/conform.js @@ -0,0 +1,40 @@ +var bricks = window.bricks || {}; +bricks.Conform = class extends bricks.BMessage { + constructor(opts){ + opts.auto_dismiss = false; + super(opts); + this.create_btns(); + } + create_tooolbar(){ + desc = { + tools:[ + bricks.extend({ + "name":"conform", + "icon":bricks_resource('imgs/conform.png'), + "label":'Conform' + }, this.opts.conform||{}), + bricks.extend({ + "name":"cancel", + "icon":bricks_resource('imgs/cancel.png'), + "label":"Discard" + }, this.opts.discard||{}) + ] + } + w = new bricks.IconTextBar(desc); + w.bind('conform', this.conform_hndl.bind(this)); + w.bind('discard', this.discard_hndl.bind(this)); + if (!w) return; + this.message_w.add_widget(w); + } + conform_hndl(event){ + this.dismiss(); + this.dispatch('conform'); + } + discard_hndl(event){ + this.dismiss(); + this.dispatch('discard'); + } +} + +bricks.Factory.register('Conform', bricks.Conform); +