3 This file is part of Ext JS 4
5 Copyright (c) 2011 Sencha Inc
7 Contact: http://www.sencha.com/contact
9 GNU General Public License Usage
10 This file may be used under the terms of the GNU General Public License version 3.0 as published by the Free Software Foundation and appearing in the file LICENSE included in the packaging of this file. Please review the following information to ensure the GNU General Public License version 3.0 requirements will be met: http://www.gnu.org/copyleft/gpl.html.
12 If you are unsure which license is appropriate for your use, please contact the sales department at http://www.sencha.com/contact.
17 * Copyright(c) 2006-2011 Sencha Inc.
18 * licensing@sencha.com
19 * http://www.sencha.com/license
22 Ext.define('Ext.ux.desktop.StartMenu', {
23 extend: 'Ext.panel.Panel',
32 cls: 'x-menu ux-start-menu',
34 defaultAlign: 'bl-tl',
42 // We have to hardcode a width because the internal Menu cannot drive our width.
43 // This is combined with changing the align property of the menu's layout from the
44 // typical 'stretchmax' to 'stretch' which allows the the items to fill the menu
48 initComponent: function() {
49 var me = this, menu = me.menu;
51 me.menu = new Ext.menu.Menu({
52 cls: 'ux-start-menu-body',
57 me.menu.layout.align = 'stretch';
62 Ext.menu.Manager.register(me);
64 // TODO - relay menu events
66 me.toolbar = new Ext.toolbar.Toolbar(Ext.apply({
68 cls: 'ux-start-menu-toolbar',
73 me.toolbar.layout.align = 'stretch';
74 me.addDocked(me.toolbar);
78 me.on('deactivate', function () {
83 addMenuItem: function() {
85 cmp.add.apply(cmp, arguments);
88 addToolItem: function() {
89 var cmp = this.toolbar;
90 cmp.add.apply(cmp, arguments);
93 showBy: function(cmp, pos, off) {
96 if (me.floating && cmp) {
97 me.layout.autoSize = true;
100 // Component or Element
103 // Convert absolute to floatParent-relative coordinates if necessary.
104 var xy = me.el.getAlignToXY(cmp, pos || me.defaultAlign, off);
105 if (me.floatParent) {
106 var r = me.floatParent.getTargetEl().getViewRegion();