* Adium is the legal property of its developers, whose names are listed in the copyright file included * with this source distribution. * This program is free software; you can redistribute it and/or modify it under the terms of the GNU * General Public License as published by the Free Software Foundation; either version 2 of the License, * or (at your option) any later version. * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even * the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General * Public License for more details. * You should have received a copy of the GNU General Public License along with this program; if not, * write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #import "AIDockBehaviorPlugin.h" #import "AIDockController.h" #import "ESDockAlertDetailPane.h" #import <AIUtilities/AIMenuAdditions.h> #import <Adium/AILocalizationTextField.h> @interface ESDockAlertDetailPane () - (NSMenuItem *)menuItemForBehavior:(AIDockBehavior)behavior withName:(NSString *)name; - (NSMenu *)behaviorListMenu; * @class ESDockAlertDetailPane * @brief Details pane for the Bounce Dock action @implementation ESDockAlertDetailPane return @"DockBehaviorContactAlert"; * @brief Configure the detail view [label_behavior setLocalizedString:AILocalizedString(@"Behavior","Dock behavior contact alert label")]; [popUp_actionDetails setMenu:[self behaviorListMenu]]; * @brief Configure for the action - (void)configureForActionDetails:(NSDictionary *)inDetails listObject:(AIListObject *)inObject NSInteger behaviorIndex = [popUp_actionDetails indexOfItemWithRepresentedObject:[inDetails objectForKey:KEY_DOCK_BEHAVIOR_TYPE]]; if (behaviorIndex >= 0 && behaviorIndex < [popUp_actionDetails numberOfItems]) { [popUp_actionDetails selectItemAtIndex:behaviorIndex]; * @brief Return our current configuration - (NSDictionary *)actionDetails NSString *behavior = [[popUp_actionDetails selectedItem] representedObject]; return [NSDictionary dictionaryWithObject:behavior forKey:KEY_DOCK_BEHAVIOR_TYPE]; * @brief The user selected a behavior - (IBAction)selectBehavior:(id)sender [self detailsForHeaderChanged]; * @brief Builds and returns a dock behavior list menu - (NSMenu *)behaviorListMenu NSMenu *behaviorMenu = [[[NSMenu allocWithZone:[NSMenu menuZone]] init] autorelease]; for (behavior = AIDockBehaviorBounceOnce; behavior <= AIDockBehaviorBounceDelay_OneMinute; behavior++) { NSString *name = [adium.dockController descriptionForBehavior:behavior]; [behaviorMenu addItem:[self menuItemForBehavior:behavior withName:name]]; [behaviorMenu setAutoenablesItems:NO]; * @brief Convenience behaviorListMenu method - (NSMenuItem *)menuItemForBehavior:(AIDockBehavior)behavior withName:(NSString *)name menuItem = [[[NSMenuItem allocWithZone:[NSMenu menuZone]] initWithTitle:name action:@selector(selectBehavior:) keyEquivalent:@""] autorelease]; [menuItem setRepresentedObject:[NSNumber numberWithInteger:behavior]];