7 Roo.bootstrap.menu = Roo.bootstrap.menu || {};
10 * @class Roo.bootstrap.menu.Menu
11 * @extends Roo.bootstrap.Component
12 * Bootstrap Menu class - container for MenuItems
13 * @cfg {String} html Text of the menu
14 * @cfg {String} weight (default | primary | success | info | warning | danger | inverse)
18 * @param {Object} config The config object
22 Roo.bootstrap.menu.Menu = function(config){
23 Roo.bootstrap.menu.Menu.superclass.constructor.call(this, config);
27 // * @event beforeshow
28 // * Fires before this menu is displayed
29 // * @param {Roo.menu.Menu} this
33 // * @event beforehide
34 // * Fires before this menu is hidden
35 // * @param {Roo.menu.Menu} this
40 // * Fires after this menu is displayed
41 // * @param {Roo.menu.Menu} this
46 // * Fires after this menu is hidden
47 // * @param {Roo.menu.Menu} this
52 // * Fires when this menu is clicked (or when the enter key is pressed while it is active)
53 // * @param {Roo.menu.Menu} this
54 // * @param {Roo.menu.Item} menuItem The menu item that was clicked
55 // * @param {Roo.EventObject} e
60 // * Fires when the mouse is hovering over this menu
61 // * @param {Roo.menu.Menu} this
62 // * @param {Roo.EventObject} e
63 // * @param {Roo.menu.Item} menuItem The menu item that was clicked
68 // * Fires when the mouse exits this menu
69 // * @param {Roo.menu.Menu} this
70 // * @param {Roo.EventObject} e
71 // * @param {Roo.menu.Item} menuItem The menu item that was clicked
76 // * Fires when a menu item contained in this menu is clicked
77 // * @param {Roo.menu.BaseItem} baseItem The BaseItem that was clicked
78 // * @param {Roo.EventObject} e
85 Roo.extend(Roo.bootstrap.menu.Menu, Roo.bootstrap.Component, {
91 getChildContainer : function() {
92 return this.el.select('ul.dropdown-menu', true).first();
95 getAutoCreate : function()
103 cls : 'btn btn-' + this.weight,
108 cls : 'dropdown-toggle btn btn-' + this.weight,
118 cls : 'dropdown-menu'
127 initEvents : function() {
129 this.triggerEl = this.el.select('button.dropdown-toggle', true).first();
130 this.triggerEl.on('click', this.onTriggerPress, this);
134 onTriggerPress : function(e)
136 Roo.log('trigger press');
138 if (this.isVisible()) {
147 isVisible : function(){
154 this.el.addClass('open');
156 Roo.get(document).on("mousedown", this.onMouseDown, this);
163 this.el.removeClass('open');;
166 onMouseDown : function()
168 Roo.log('onMouseDown');