mirror of
https://github.com/cappuccino/cappuccino.git
synced 2026-09-01 16:33:35 +00:00
Fix for invisible toolbar items sending their associated menu item as the sender for their actions.
Reviewed by me.
This commit is contained in:
+15
-2
@@ -799,10 +799,11 @@ var _CPToolbarItemInfoMake = function(anIndex, aView, aLabel, aMinWidth)
|
||||
|
||||
hasNonSeparatorItem = YES;
|
||||
|
||||
var menuItem = [[CPMenuItem alloc] initWithTitle:[item label] action:[item action] keyEquivalent:nil];
|
||||
var menuItem = [[CPMenuItem alloc] initWithTitle:[item label] action:@selector(didSelectMenuItem:) keyEquivalent:nil];
|
||||
|
||||
[menuItem setRepresentedObject:item];
|
||||
[menuItem setImage:[item image]];
|
||||
[menuItem setTarget:[item target]];
|
||||
[menuItem setTarget:self];
|
||||
[menuItem setEnabled:[item isEnabled]];
|
||||
|
||||
[_additionalItemsButton addItem:menuItem];
|
||||
@@ -812,6 +813,18 @@ var _CPToolbarItemInfoMake = function(anIndex, aView, aLabel, aMinWidth)
|
||||
[_additionalItemsButton removeFromSuperview];
|
||||
}
|
||||
|
||||
/*
|
||||
Used privately.
|
||||
@ignore
|
||||
*/
|
||||
|
||||
- (void)didSelectMenuItem:(id)aSender
|
||||
{
|
||||
var toolbarItem = [aSender representedObject];
|
||||
|
||||
[CPApp sendAction:[toolbarItem action] to:[toolbarItem target] from:toolbarItem];
|
||||
}
|
||||
|
||||
- (void)reloadToolbarItems
|
||||
{
|
||||
// Get rid of all our current subviews.
|
||||
|
||||
Reference in New Issue
Block a user