manager

Dockyard > Objective-C Classes > manager

manager

Class Description

Stores essential information about a dock item, specifically its path, icon, and label.

Methods

+ defaultIconForPath:type:

+ defaultLabelForPath:type:

- exists

- hasIcon

- hasLabel

- hasType

- icon

- initWithPath:

- initWithPath:icon:

- initWithPath:icon:type:

- initWithPath:label:

- initWithPath:label:icon:

- initWithPath:label:icon:type:

- initWithPath:label:type:

- initWithPath:type:

- itemType

+ itemTypeForPath:

- kindString

- label

- path

- pathURL

- representedData

- setIcon:

- setItemType:

- setLabel:

- setPath:

- setRepresentedData:

Method Detail

defaultIconForPath:type:

+ (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:

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:

itemTypeForPath:

+ (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:

exists

- (BOOL)exists

Returns `YES` if the item exists, `NO` otherwise. Always returns `YES` for the Dashboard icon and URLs.

hasIcon

- (BOOL)hasIcon

Returns `YES` if the item's icon was not automatically generated, `NO` otherwise.

See also: icon, hasLabel, hasType

hasLabel

- (BOOL)hasLabel

Returns `YES` if the item's label was not automatically generated, `NO` otherwise.

See also: label, hasIcon, hasType

hasType

- (BOOL)hasType

Returns `YES` if the item's type was not automatically generated, `NO` otherwise.

See also: itemType, hasLabel, hasIcon

icon

- (NSImage *)icon

Returns the item's icon.

See also: setIcon:, hasIcon

initWithPath:

- (id)initWithPath:(NSString *)givenPath

Initializes and returns an instance of `DockItemInfo` with the specified path.

See also: initWithPath:label:icon:type:

initWithPath:icon:

- (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:

initWithPath: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:

initWithPath:label:

- (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:

initWithPath:label:icon:

- (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:

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.

initWithPath:label:type:

- (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:

initWithPath: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:

itemType

- (enum DockyardItemType)itemType

Returns the item's type.

See also: setItemType:, hasType

kindString

- (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.

label

- (NSString *)label

Returns the item's label.

See also: setLabel:, hasLabel

path

- (NSString *)path

Returns the item's path.

See also: setPath:, pathURL

pathURL

- (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.

See also: path, setPath:

representedData

- (id)representedData

Returns the data associated with this item, usually the raw dock data.

See also: setRepresentedData:

setIcon:

- (void)setIcon:(NSImage *)newIcon

Sets the item's label. If `newIcon` is `nil`, restores the cell's default icon, generated with `defaultIconForPath:type:`.

See also: icon, hasIcon

setItemType:

- (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.

See also: itemType, hasType

setLabel:

- (void)setLabel:(NSString *)newLabel

Sets the item's label. If `newLabel` is `nil`, restores the cell's default label, generated with `defaultLabelForPath:type:`.

See also: label, hasLabel

setPath:

- (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.

See also: path, pathURL

setRepresentedData:

- (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