mirror of
https://github.com/cappuccino/cappuccino.git
synced 2026-11-26 00:15:52 +00:00
Merge branch 'master' of https://github.com/cappuccino/cappuccino
This commit is contained in:
commit
2f18218ce5
5 files changed
+29
-3
No files matched your search
@@ -855,6 +855,9 @@ var _CPMenuBarVisible = NO,
|
||||
|
||||
+ (void)popUpContextMenu:(CPMenu)aMenu withEvent:(CPEvent)anEvent forView:(CPView)aView withFont:(CPFont)aFont
|
||||
{
|
||||
// This is needed when we are making several rights click
|
||||
[[_CPMenuManager sharedMenuManager] cancelActiveMenu];
|
||||
|
||||
[aMenu _menuWillOpen];
|
||||
|
||||
if (!aFont)
|
||||
@@ -863,8 +866,6 @@ var _CPMenuBarVisible = NO,
|
||||
var theWindow = [aView window],
|
||||
menuWindow = [_CPMenuWindow menuWindowWithMenu:aMenu font:aFont];
|
||||
|
||||
[_CPMenuWindow poolMenuWindow:menuWindow];
|
||||
|
||||
[menuWindow setBackgroundStyle:_CPMenuWindowPopUpBackgroundStyle];
|
||||
|
||||
var constraintRect = [CPMenu _constraintRectForView:aView],
|
||||
|
||||
@@ -407,6 +407,15 @@ var STICKY_TIME_INTERVAL = 0.4,
|
||||
[menu cancelTracking];
|
||||
}
|
||||
|
||||
- (void)cancelActiveMenu
|
||||
{
|
||||
if (CPApp._activeMenu)
|
||||
{
|
||||
[self completeTracking];
|
||||
_menuContainerStack = [];
|
||||
}
|
||||
}
|
||||
|
||||
- (void)completeTracking
|
||||
{
|
||||
var trackingMenu = [self trackingMenu];
|
||||
|
||||
@@ -72,7 +72,8 @@ _CPMenuWindowAttachedMenuBackgroundStyle = 2;
|
||||
|
||||
+ (void)poolMenuWindow:(_CPMenuWindow)aMenuWindow
|
||||
{
|
||||
if (!aMenuWindow || _CPMenuWindowPool.length >= _CPMenuWindowPoolCapacity)
|
||||
// FIXME :the poolMenuWindow is called too many times somewhere....
|
||||
if (!aMenuWindow || _CPMenuWindowPool.length >= _CPMenuWindowPoolCapacity || [_CPMenuWindowPool containsObject:aMenuWindow])
|
||||
return;
|
||||
|
||||
_CPMenuWindowPool.push(aMenuWindow);
|
||||
|
||||
@@ -166,6 +166,9 @@ var CPMenuItemStringRepresentationDictionary = @{
|
||||
if (_isEnabled === isEnabled)
|
||||
return;
|
||||
|
||||
if (!isEnabled && [self isHighlighted])
|
||||
[_menu _highlightItemAtIndex:CPNotFound];
|
||||
|
||||
_isEnabled = !!isEnabled;
|
||||
|
||||
[_menuItemView setDirty];
|
||||
|
||||
@@ -129,6 +129,18 @@
|
||||
[self assertFalse:[[[anInstantiatedMenuItem _menuItemView] view] isHighlighted] message:@"Underlying view was still highlighted after removeItemAtIndex"];
|
||||
}
|
||||
|
||||
- (void)testSetEnabledHighlighting
|
||||
{
|
||||
[menu _highlightItemAtIndex:[menu indexOfItem:anInstantiatedMenuItem]];
|
||||
|
||||
[self assertTrue:[anInstantiatedMenuItem isHighlighted]];
|
||||
|
||||
[anInstantiatedMenuItem setEnabled:NO];
|
||||
|
||||
[self assertFalse:[anInstantiatedMenuItem isHighlighted]];
|
||||
[self assertFalse:[[[anInstantiatedMenuItem _menuItemView] view] isHighlighted] message:@"Underlying view was still highlighted after setEnabled:NO"];
|
||||
}
|
||||
|
||||
- (void)testKeyEquivalent
|
||||
{
|
||||
[self _retarget:menu];
|
||||
|
||||
Reference in new issue
Block a user