3 * Copyright(c) 2006-2011 Sencha Inc.
5 * http://www.sencha.com/license
8 Ext.define('Ext.ux.desktop.StartMenu', {
9 extend: 'Ext.panel.Panel',
18 cls: 'x-menu ux-start-menu',
20 defaultAlign: 'bl-tl',
28 // We have to hardcode a width because the internal Menu cannot drive our width.
29 // This is combined with changing the align property of the menu's layout from the
30 // typical 'stretchmax' to 'stretch' which allows the the items to fill the menu
34 initComponent: function() {
35 var me = this, menu = me.menu;
37 me.menu = new Ext.menu.Menu({
38 cls: 'ux-start-menu-body',
43 me.menu.layout.align = 'stretch';
48 Ext.menu.Manager.register(me);
50 // TODO - relay menu events
52 me.toolbar = new Ext.toolbar.Toolbar(Ext.apply({
54 cls: 'ux-start-menu-toolbar',
59 me.toolbar.layout.align = 'stretch';
60 me.addDocked(me.toolbar);
64 me.on('deactivate', function () {
69 addMenuItem: function() {
71 cmp.add.apply(cmp, arguments);
74 addToolItem: function() {
75 var cmp = this.toolbar;
76 cmp.add.apply(cmp, arguments);
79 showBy: function(cmp, pos, off) {
82 if (me.floating && cmp) {
83 me.layout.autoSize = true;
86 // Component or Element
89 // Convert absolute to floatParent-relative coordinates if necessary.
90 var xy = me.el.getAlignToXY(cmp, pos || me.defaultAlign, off);
92 var r = me.floatParent.getTargetEl().getViewRegion();