Dockyard > Objective-C Classes > manager
Class Description
Stores essential information about a dock item, specifically its path, icon, and label.
Methods
- initWithPath:label:icon:type:
Method Detail
+ (NSImage *)defaultIconForPath:(NSString *)givenPath type:(enum DockyardItemType)itemType
Tries to locate an icon in five ways: First: Looks to see if there is a path, and assigns a default unknown icon if there isn't. Second: Checks the type of the path, and assigns a default icon for URLs. Third: Checks to see if the path is of a widget, and retrieves the widget's Icon.png file. Fourth: Assumes the path is a local file, and looks for its icon on the filesystem. Fifth: Gives up and assigns a default unknown icon.
See also: itemTypeForPath:, defaultLabelForPath:type:
+ (NSString *)defaultLabelForPath:(NSString *)path type:(enum DockyardItemType)itemType
Tries to create a label for path in four ways: First, checks to see if the item is a URL. If so, just returns the URL itself. Short of fetching the file, there's no way to check the page's real title. Dock data stores the label seperately, so this is usually not a problem. Second, checks to see if the item is the Dashboard icon. If so, retrieves a localized name from the Dock's application bundle. Third, checks to see if the item is a widget. If so, retrieves a localized name from its bundle. Fourth, assumes the item is a local file, and retrieves its display name using LaunchServices
See also: itemTypeForPath:, defaultIconForPath:type:
+ (enum DockyardItemType)itemTypeForPath:(NSString *)givenPath
Makes a guess about an item's type based on its path or URL. First, checks to see if the path is the location of Dashboard.app. Next, checks the extension is @"wdgt" or @"dock" (widgets or docklings). Then, checks the first character to see if it is a / or a ~ (beginnings of paths). Finally, tries to create an NSURL to check if the path is a valid URL. If nothing matches, returns DockyardUnknownType.
See also: defaultIconForPath:type:, defaultLabelForPath:type:
- (BOOL)exists
Returns YES if the item exists, NO otherwise. Always returns YES for the Dashboard icon and URLs.
- (BOOL)hasIcon
Returns YES if the item's icon was not automatically generated, NO otherwise.
- (BOOL)hasLabel
Returns YES if the item's label was not automatically generated, NO otherwise.
- (BOOL)hasType
Returns YES if the item's type was not automatically generated, NO otherwise.
- (id)initWithPath:(NSString *)givenPath
Initializes and returns an instance of DockItemInfo with the specified path.
See also: initWithPath:label:icon:type:
- (id)initWithPath:(NSString *)givenPath icon:(NSImage *)givenIcon
Initializes and returns an instance of DockItemInfo with the specified path and icon.
See also: initWithPath:label:icon:type:
- (id)initWithPath:(NSString *)givenPath icon:(NSImage *)givenIcon type:(enum DockyardItemType)givenType
Initializes and returns an instance of DockItemInfo with the specified path, icon, and item type.
See also: initWithPath:label:icon:type:
- (id)initWithPath:(NSString *)givenPath label:(NSString *)givenLabel
Initializes and returns an instance of DockItemInfo with the specified path and label.
See also: initWithPath:label:icon:type:
- (id)initWithPath:(NSString *)givenPath label:(NSString *)givenLabel icon:(NSImage *)givenIcon
Initializes and returns an instance of DockItemInfo with the specified path, label, and icon.
See also: initWithPath:label:icon:type:
- (id)initWithPath:(NSString *)givenPath label:(NSString *)givenLabel icon:(NSImage *)givenIcon type:(enum DockyardItemType)givenType
Initializes and returns an instance of DockItemInfo with the specified path, label, icon, and item type. This is the designated initializer for DockItemInfo.
- (id)initWithPath:(NSString *)givenPath label:(NSString *)givenLabel type:(enum DockyardItemType)givenType
Initializes and returns an instance of DockItemInfo with the specified path, label, and item type.
See also: initWithPath:label:icon:type:
- (id)initWithPath:(NSString *)givenPath type:(enum DockyardItemType)givenType
Initializes and returns an instance of DockItemInfo with the specified path and item type.
See also: initWithPath:label:icon:type:
- (NSString *)kindString
Returns the Finder kind string for this item, unless the item is a URL. In this case, returns a string of the form @"URL (scheme)", where scheme is the URL scheme (such as HTTP or FTP). Uses LaunchServices to find filesystem kind strings.
- (NSURL *)pathURL
Returns the URL representation of this item's path. This method uses lazy initialization, so if the URL is never asked for, it will never take up space. However, kindString also requires a URL.
- (id)representedData
Returns the data associated with this item, usually the raw dock data.
See also: setRepresentedData:
- (void)setIcon:(NSImage *)newIcon
Sets the item's label. If newIcon is nil, restores the cell's default icon, generated with defaultIconForPath:type:.
- (void)setItemType:(enum DockyardItemType)newType
Sets the item's type. If the label or icon was generated with defaultLabelForPath:type: or defaultIconForPath:type:, they will be regenerated.
- (void)setLabel:(NSString *)newLabel
Sets the item's label. If newLabel is nil, restores the cell's default label, generated with defaultLabelForPath:type:.
- (void)setPath:(NSString *)newPath
Sets the item's path. If the label, icon, or type was found using the class functions itemTypeForPath:, defaultIconForPath:type:, or defaultLabelForPath:, it will be regenerated.
- (void)setRepresentedData:(id)newData
Sets the data represented by this item. This is usually the raw dock data, but you can really store anything in here. This is not used by this class at all -- it is for your personal use.
See also: representedData
This page was generated with DocYouMeant, a program created by Belkadan Software