1. Brandon Walkin
  2. BWToolkit


Brandon Walkin  committed ed171fd

Added a notification to BWSelectableToolbar that tells you when a toolbar icon has been clicked

  • Participants
  • Parent commits 2b3df1e
  • Branches default

Comments (0)

Files changed (2)

File BWSelectableToolbar.h

View file
 @class BWSelectableToolbarHelper;
+// Notification that gets sent when a toolbar item has been clicked. You can get the button that was clicked by getting the object
+// for the key @"BWClickedItem" in the supplied userInfo dictionary.
+extern NSString * const BWSelectableToolbarItemClickedNotification;
 @interface BWSelectableToolbar : NSToolbar 
 	BWSelectableToolbarHelper *helper;

File BWSelectableToolbar.m

View file
 #import "BWSelectableToolbarHelper.h"
 #import "NSWindow+BWAdditions.h"
+NSString * const BWSelectableToolbarItemClickedNotification = @"BWSelectableToolbarItemClicked";
 static BWSelectableToolbar *documentToolbar;
 static NSToolbar *editableToolbar;
 	selectedIndex = [itemIdentifiers indexOfObject:identifier];
+	[[NSNotificationCenter defaultCenter] postNotificationName:BWSelectableToolbarItemClickedNotification object:self userInfo:[NSDictionary dictionaryWithObject:sender forKey:@"BWClickedItem"]];
 	[self switchToItemAtIndex:selectedIndex animate:YES];