/*******************************************************************************
 Copyright (c) 2004-2006 Jordy Rose
 
 Permission is hereby granted, free of charge, to any person obtaining a copy
 of this software and associated documentation files (the "Software"), to deal
 in the Software without restriction, including without limitation the rights
 to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
 copies of the Software, and to permit persons to whom the Software is
 furnished to do so, subject to the following conditions:
 
 The above copyright notice and this permission notice shall be included in
 all copies or substantial portions of the Software.
 
 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
 IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
 FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
 AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
 LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
 OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
 SOFTWARE.
 
 Except as contained in this notice, the name(s) of the above copyright holders
 shall not be used in advertising or otherwise to promote the sale, use or other
 dealings in this Software without prior authorization.
*******************************************************************************/

#import <Cocoa/Cocoa.h>

#import "SystemUIPlugin.h"

#import "DockyardPreferences.h"
#import "NSIndexSetEnumerator.h"

#import "DockyardWindowController.h"

@class	ComBelkadanDockyard_DeleteDockController,	ComBelkadanDockyard_NewDockController,
		ComBelkadanDockyard_RearrangeController,	ComBelkadanDockyard_RenameDockController,
		ComBelkadanDockyard_AboutController;

/*!
 * Returns <code>YES</code> if the given type is from the Dock, <code>NO</code> if not.
 *
 * @see DockyardItemType
 */
#define DOCKYARD_TYPE_IS_FROM_DOCK(x) (((x) >= DockyardFileType) && ((x) <= DockyardDocklingType))

/*!
 * @enum DockyardItemType
 * @discussion Used to identify the type of items in the dock. This is not the same as the item
 * set the items are in. 
 * @constant DockyardUnknownType Represents an unknown item. Currently treated similar to a
 * <code>DockyardFileType</code> item.
 * @constant DockyardFileType Represents a file or application, accessible through the filesystem.
 * @constant DockyardURLType Represents an internet location, including a protocol and address.
 * @constant DockyardDashboardType Represents the special Dashboard icon in the dock, which is
 * always on and merely opens the Dashboard when clicked.
 * @constant DockyardDocklingType Represents the deprecated dock applications, or docklings.
 * Similar to <code>DockyardFileType</code> for these purposes.
 * @constant DockyardWidgetType Represents a widget on the Dashboard (not in the Dock). Currently
 * unused by the menu extra.
 * @see DockyardItemSet
 */
enum DockyardItemType {
	DockyardUnknownType = -1,
	DockyardFileType,
	DockyardURLType,
	DockyardDashboardType,
	DockyardDocklingType,
	DockyardWidgetType
};

#define DockyardMenuExtra ComBelkadanDockyard_MenuExtra

@interface DockyardMenuExtra : NSMenuExtra {
	DockyardPreferences *preferences;
	
	NSImage *colorIcon;
	NSImage *blackWhiteIcon;
	NSImage *blackWhiteAltIcon;
	BOOL shouldUseBWIcon;
	
//	NSString *currentDock;
//	NSString *prefPath;
//	NSString *bundleIdentifier;
//	NSString *dockIdentifier;

//	NSMutableDictionary *docks;
//	NSMutableArray *names;
//	BOOL isDoneEditing;
//	IBOutlet NSArrayController *namesController;
	
/*	IBOutlet NSPanel *aboutPanel;
	IBOutlet NSPanel *newDockWindow;
	IBOutlet NSPanel *deleteDockWindow;
	IBOutlet NSPanel *renameDockWindow;
	IBOutlet NSPanel *rearrangeWindow; */
	
	DockyardWindowController *aboutController;
	DockyardWindowController *newController;
	DockyardWindowController *deleteController;
	DockyardWindowController *renameController;
	DockyardWindowController *reorderController;
}
-(IBAction)showAbout:(NSMenuItem *)menuItem;
-(IBAction)showNew:(NSMenuItem *)menuItem;
-(IBAction)showDelete:(NSMenuItem *)menuItem;
-(IBAction)showRename:(NSMenuItem *)menuItem;
-(IBAction)showReorder:(NSMenuItem *)menuItem;
-(IBAction)changeDockCommand:(NSMenuItem *)menuItem;
-(IBAction)openFile:(NSMenuItem *)sender;

- (DockyardPreferences *)preferences;
- (void)shouldUseBWIconChanged:(NSNotification *)note;

-(NSMenu *)menuForDockNamed:(NSString *)dockName;
-(enum DockyardItemType)typeForDockItemData:(NSDictionary *)itemData rawType:(NSString *)rawType; 
-(NSMenuItem *)menuItemWithDockItemData:(NSDictionary *)itemData type:(enum DockyardItemType)type;
-(NSString *)labelForDockItemData:(NSDictionary *)itemData type:(enum DockyardItemType)type;
-(NSString *)pathForDockItemData:(NSDictionary *)itemData type:(enum DockyardItemType)type;
-(NSImage *)iconForDockItemPath:(NSString *)path type:(enum DockyardItemType)type;
@end
