X-Git-Url: http://git.ithinksw.org/extjs.git/blobdiff_plain/7a654f8d43fdb43d78b63d90528bed6e86b608cc..3789b528d8dd8aad4558e38e22d775bcab1cbd36:/docs/source/Menu2.html diff --git a/docs/source/Menu2.html b/docs/source/Menu2.html index cd93875d..cc28998b 100644 --- a/docs/source/Menu2.html +++ b/docs/source/Menu2.html @@ -1,4 +1,21 @@ -
/**
+
+
+
+
+ The source code
+
+
+
+
+
+
+ /**
* @class Ext.menu.Menu
* @extends Ext.panel.Panel
*
@@ -63,24 +80,24 @@ Ext.define('Ext.menu.Menu', {
'Ext.menu.Separator'
],
- /**
+ /**
* @cfg {Boolean} allowOtherMenus
* True to allow multiple menus to be displayed at the same time. Defaults to `false`.
* @markdown
*/
allowOtherMenus: false,
- /**
+ /**
* @cfg {String} ariaRole @hide
*/
ariaRole: 'menu',
- /**
+ /**
* @cfg {Boolean} autoRender @hide
* floating is true, so autoRender always happens
*/
- /**
+ /**
* @cfg {String} defaultAlign
* The default {@link Ext.core.Element#getAlignToXY Ext.core.Element#getAlignToXY} anchor position value for this menu
* relative to its element of origin. Defaults to `'tl-bl?'`.
@@ -88,7 +105,7 @@ Ext.define('Ext.menu.Menu', {
*/
defaultAlign: 'tl-bl?',
- /**
+ /**
* @cfg {Boolean} floating
* A Menu configured as `floating: true` (the default) will be rendered as an absolutely positioned,
* {@link Ext.Component#floating floating} {@link Ext.Component Component}. If configured as `floating: false`, the Menu may be
@@ -97,13 +114,13 @@ Ext.define('Ext.menu.Menu', {
*/
floating: true,
- /**
+ /**
* @cfg {Boolean} @hide
* Menu performs its own size changing constraining, so ensure Component's constraining is not applied
*/
constrain: false,
- /**
+ /**
* @cfg {Boolean} hidden
* True to initially render the Menu as hidden, requiring to be shown manually.
* Defaults to `true` when `floating: true`, and defaults to `false` when `floating: false`.
@@ -111,7 +128,7 @@ Ext.define('Ext.menu.Menu', {
*/
hidden: true,
- /**
+ /**
* @cfg {Boolean} ignoreParentClicks
* True to ignore clicks on any item in this menu that is a parent item (displays a submenu)
* so that the submenu is not dismissed when clicking the parent item. Defaults to `false`.
@@ -121,23 +138,23 @@ Ext.define('Ext.menu.Menu', {
isMenu: true,
- /**
+ /**
* @cfg {String/Object} layout @hide
*/
- /**
+ /**
* @cfg {Boolean} showSeparator True to show the icon separator. (defaults to true).
*/
showSeparator : true,
- /**
+ /**
* @cfg {Number} minWidth
* The minimum width of the Menu. Defaults to `120`.
* @markdown
*/
minWidth: 120,
- /**
+ /**
* @cfg {Boolean} plain
* True to remove the incised line down the left side of the menu and to not
* indent general Component items. Defaults to `false`.
@@ -146,10 +163,12 @@ Ext.define('Ext.menu.Menu', {
initComponent: function() {
var me = this,
- prefix = Ext.baseCSSPrefix;
+ prefix = Ext.baseCSSPrefix,
+ cls = [prefix + 'menu'],
+ bodyCls = me.bodyCls ? [me.bodyCls] : [];
me.addEvents(
- /**
+ /**
* @event click
* Fires when this menu is clicked
* @param {Ext.menu.Menu} menu The menu which has been clicked
@@ -159,7 +178,7 @@ Ext.define('Ext.menu.Menu', {
*/
'click',
- /**
+ /**
* @event mouseenter
* Fires when the mouse enters this menu
* @param {Ext.menu.Menu} menu The menu
@@ -168,7 +187,7 @@ Ext.define('Ext.menu.Menu', {
*/
'mouseenter',
- /**
+ /**
* @event mouseleave
* Fires when the mouse leaves this menu
* @param {Ext.menu.Menu} menu The menu
@@ -177,7 +196,7 @@ Ext.define('Ext.menu.Menu', {
*/
'mouseleave',
- /**
+ /**
* @event mouseover
* Fires when the mouse is hovering over this menu
* @param {Ext.menu.Menu} menu The menu
@@ -190,14 +209,12 @@ Ext.define('Ext.menu.Menu', {
Ext.menu.Manager.register(me);
// Menu classes
- var cls = [prefix + 'menu'];
if (me.plain) {
cls.push(prefix + 'menu-plain');
}
me.cls = cls.join(' ');
// Menu body classes
- var bodyCls = me.bodyCls ? [me.bodyCls] : [];
bodyCls.unshift(prefix + 'menu-body');
me.bodyCls = bodyCls.join(' ');
@@ -300,7 +317,7 @@ Ext.define('Ext.menu.Menu', {
}
},
- /**
+ /**
* Returns whether a menu item can be activated or not.
* @return {Boolean}
*/
@@ -308,7 +325,7 @@ Ext.define('Ext.menu.Menu', {
return item && !item.isDisabled() && item.isVisible() && (item.canActivate || item.getXTypes().indexOf('menuitem') < 0);
},
- /**
+ /**
* Deactivates the current active item on the menu, if one exists.
*/
deactivateActiveItem: function() {
@@ -363,7 +380,9 @@ Ext.define('Ext.menu.Menu', {
// private
lookupItemFromObject: function(cmp) {
var me = this,
- prefix = Ext.baseCSSPrefix;
+ prefix = Ext.baseCSSPrefix,
+ cls,
+ intercept;
if (!cmp.isComponent) {
if (!cmp.xtype) {
@@ -378,11 +397,8 @@ Ext.define('Ext.menu.Menu', {
}
if (!cmp.isMenuItem && !cmp.dock) {
- var cls = [
- prefix + 'menu-item',
- prefix + 'menu-item-cmp'
- ],
- intercept = Ext.Function.createInterceptor;
+ cls = [prefix + 'menu-item', prefix + 'menu-item-cmp'];
+ intercept = Ext.Function.createInterceptor;
// Wrap focus/blur to control component focus
cmp.focus = intercept(cmp.focus, function() {
@@ -516,7 +532,7 @@ Ext.define('Ext.menu.Menu', {
}
},
- /**
+ /**
* Shows the floating menu by the specified {@link Ext.Component Component} or {@link Ext.core.Element Element}.
* @param {Mixed component} The {@link Ext.Component} or {@link Ext.core.Element} to show the menu by.
* @param {String} position (optional) Alignment position as used by {@link Ext.core.Element#getAlignToXY Ext.core.Element.getAlignToXY}. Defaults to `{@link #defaultAlign}`.
@@ -525,7 +541,9 @@ Ext.define('Ext.menu.Menu', {
* @markdown
*/
showBy: function(cmp, pos, off) {
- var me = this;
+ var me = this,
+ xy,
+ region;
if (me.floating && cmp) {
me.layout.autoSize = true;
@@ -535,22 +553,30 @@ Ext.define('Ext.menu.Menu', {
cmp = cmp.el || cmp;
// Convert absolute to floatParent-relative coordinates if necessary.
- var xy = me.el.getAlignToXY(cmp, pos || me.defaultAlign, off);
+ xy = me.el.getAlignToXY(cmp, pos || me.defaultAlign, off);
if (me.floatParent) {
- var r = me.floatParent.getTargetEl().getViewRegion();
- xy[0] -= r.x;
- xy[1] -= r.y;
+ region = me.floatParent.getTargetEl().getViewRegion();
+ xy[0] -= region.x;
+ xy[1] -= region.y;
}
me.showAt(xy);
- me.doConstrain();
}
return me;
},
+
+ // inherit docs
+ showAt: function(){
+ this.callParent(arguments);
+ if (this.floating) {
+ this.doConstrain();
+ }
+ },
doConstrain : function() {
var me = this,
- y = this.el.getY(),
+ y = me.el.getY(),
max, full,
+ vector,
returnY = y, normalY, parentEl, scrollTop, viewHeight;
delete me.height;
@@ -586,6 +612,12 @@ Ext.define('Ext.menu.Menu', {
me.iconSepEl.setHeight(me.layout.getRenderTarget().dom.scrollHeight);
}
}
+ vector = me.getConstrainVector();
+ if (vector) {
+ me.setPosition(me.getPosition()[0] + vector[0]);
+ }
me.el.setY(returnY);
}
-});
\ No newline at end of file
+});
+
+