DockManager

Dockyard > Objective-C Classes > DockManager

DockManager

Class Description

Provides data for the dock names table in Dockyard Manager. Also supports a number of Dock-related commands, such as duplication and deletion, most of which allow Undo operations.

Methods

- addDocksWithNames:dockData:dashboardData:

- cancelCreate:

- cancelDelete:

- changeDock:

- changeDockMenuCommand:

- confirmCreate:

- confirmDelete:

- createNewDock:

- delete:

- duplicateDock:

- numberOfRowsInTableView:

- numberOfSelectedDocks

- paste:

- removeDocksAtIndexes:select:

- rename:to:selectedRows:

- renameDock:

- selectedDock

- setDockNames:oldNames:newSelection:oldSelection:

- tableView:objectValueForTableColumn:row:

- tableView:setObjectValue:forTableColumn:row:

- tableView:shouldEditTableColumn:row:

- tableView:willDisplayCell:forTableColumn:row:

- tableViewSelectionDidChange:

- tableViewSelectionWillChange:

- validateMenuItem:

Method Detail

addDocksWithNames:dockData:dashboardData:

- (void)addDocksWithNames:(NSArray *)names dockData:(NSArray *)dockData dashboardData:(NSArray *)dashboardData

Creates docks with the specified names, using the data from `dockData`, and, if provided, the dashboard data from `dashboardData`. There must be the same number of items in all three arrays. Docks without dashboard data should use an instance of NSNull as a placeholder. Make sure that each data dictionary element is in the same format as the Apple defaults domains "com.apple.dock" or "com.apple.dashboard". Selects the newly created docks. This method should only be used to undo a deletion.

See also: DockyardPreferences.createDocksWithNames:data:dashboardData:

cancelCreate:

- (IBAction)cancelCreate:(id)sender

Closes the panel used to create new docks. Does not create a dock.

See also: createNewDock:, confirmCreate:

cancelDelete:

- (IBAction)cancelDelete:(id)sender

Ends the sheet displayed when the user tries to delete the current dock. Cancels the deletion.

See also: delete:, confirmDelete:

changeDock:

- (IBAction)changeDock:(id)sender

Switches to the selected dock in the table view, signaling the switch with a beep.

See also: changeDockMenuCommand:, DockyardPreferences.changeDock:

changeDockMenuCommand:

- (IBAction)changeDockMenuCommand:(NSMenuItem *)sender

Switches to the dock represented by `sender`, which is not necessarily the one selected in the table view. The switch is signified with a beep.

See also: changeDock:, DockyardPreferences.changeDock:

confirmCreate:

- (IBAction)confirmCreate:(id)sender

Closes the panel used to create new docks. This function is mostly a call to DockyardPreferences, but includes a switch statement to decide where to find the dock's plist file. The choices are Apple's default dock, an empty dock, the selected dock, and the current dock. The same choices are given for the system. Also, if the name chosen is invalid, the window will not close, but will dock's Dashboard contents on a 10.4 or later instead erase the name and wait for a different one.

See also: createNewDock:, cancelCreate:, DockyardPreferences.createDockWithName:fromFile:dashboardFile:

confirmDelete:

- (IBAction)confirmDelete:(id)sender

Ends the sheet displayed when the user tries to delete the current dock. Switches to the user's choice of dock, then deletes all of the docks selected in the table view.

See also: delete:, cancelDelete:

createNewDock:

- (IBAction)createNewDock:(id)sender

Displays the dock creation panel in a model window, loading the proper nib if necessary.

See also: confirmCreate:, cancelCreate:

delete:

- (IBAction)delete:(id)sender

Called when the user tries to delete the docks selected in the table. If all of the docks are selected, just beeps. If the current dock is selected, runs a sheet asking which dock to switch to before deletion. Otherwise, deletes the selected docks without running the sheet.

See also: confirmDelete:, cancelDelete:, DockyardPreferences.deleteDocksAtIndexes:

duplicateDock:

- (IBAction)duplicateDock:(id)sender

Duplicates the selected docks. The new dock names have the form @"Name Copy" in English. Other languages may substitute another pattern.

See also: DockyardPreferences.createDocksWithNames:data:dashboardData:

numberOfRowsInTableView:

- (int)numberOfRowsInTableView:(NSTableView *)aTableView

Returns the number of docks.

numberOfSelectedDocks

- (unsigned)numberOfSelectedDocks

Returns the number of docks currently selected.

See also: selectedDock:

paste:

- (IBAction)paste:(id)sender

If a single dock is selected, forwards the action to the next view in the key view loop. This is assumed to be the table with the contents of the selected dock, but really could be anything.

removeDocksAtIndexes:select:

- (void)removeDocksAtIndexes:(NSIndexSet *)indexes select:(NSIndexSet *)selectionIndexes

Removes the dock at `indexes`, then selects the docks at `selectionIndexes`. This method should only be used to undo a creation.

See also: DockyardPreferences.deleteDocksAtIndexes:

rename:to:selectedRows:

- (void)rename:(NSString *)oldName to:(NSString *)newName selectedRows:(NSIndexSet *)rows

Renames the dock named `oldName` to `newName`. No two docks can have the same name. Also selects the docks at `rows`. This method should only be used to undo a renaming.

See also: DockyardPreferences.renameDock:to:

renameDock:

- (IBAction)renameDock:(id)sender

Tells the table view to edit the selected row. This method merely begins editing a dock name. Any method that programmatically begins editing a dock name should call this method, instead of going through the NSTableView containing the docks.

See also: tableView:shouldEditTableColumn:row:

selectedDock

- (NSString *)selectedDock

Returns the name of the currently selected dock. If there are no docks selected, or if there are multiple docks selected, returns `nil`.

See also: numberOfSelectedDocks

setDockNames:oldNames:newSelection:oldSelection:

- (void)setDockNames:(NSArray *)newNames oldNames:(NSArray *)oldNames newSelection:(NSIndexSet *)newSelection oldSelection:(NSIndexSet *)oldSelection

Sets the list of dock names to `newNames` and selects `newSelection`. `oldSelection` and `oldNames` are passed in for undo purposes. This method should only be used to undo a reorder or a deletion.

See also: DockyardPreferences.setDockNames:

tableView:objectValueForTableColumn:row:

- (id)tableView:(NSTableView *)aTableView objectValueForTableColumn:(NSTableColumn *)aTableColumn row:(int)rowIndex

Returns the dock name at `rowIndex`.

tableView:setObjectValue:forTableColumn:row:

- (void)tableView:(NSTableView *)editTable setObjectValue:(NSString *)newName forTableColumn:(NSTableColumn *)aTableColumn row:(int)rowIndex

Sets the dock name at `rowIndex` to `newName`. If there is already a dock with the same name, the computer will beep and no change will occur.

See also: renameDock:, tableView:shouldEditTableColumn:row:

tableView:shouldEditTableColumn:row:

- (BOOL)tableView:(NSTableView *)editTable shouldEditTableColumn:(NSTableColumn *)tableColumn row:(int)rowIndex

Called when the user double-clicks on a table cell. If the click occured within the cell's image, returns `NOYES`, which begins a renaming action.

See also: tableView:setObjectValue:forTableColumn:row:

tableView:willDisplayCell:forTableColumn:row:

- (void)tableView:(NSTableView *)tableView willDisplayCell:(NSCell *)cell forTableColumn:(NSTableColumn *)column row:(int)row

If the cell being displayed represents the current dock, displays a 16 by 16 icon of the Dock next to it. Otherwise, makes sure the cell has no icon before displaying it.

tableViewSelectionDidChange:

- (void)tableViewSelectionDidChange:(NSNotification *)note

Informs observers that the number of selected docks and the name of the selected dock just changed. Also sets the title of the "Switch To" menu item to the localized form of `@"Switch to Dock Name"`.

tableViewSelectionWillChange:

- (void)tableViewSelectionWillChange:(NSNotification *)note

Warns any observers that the number of selected docks and the name of the selected dock are about to change.

validateMenuItem:

- (BOOL)validateMenuItem:(NSMenuItem *)menuItem

Only allows a `paste:` action if one dock is selected and it is not the current one. This action is passed along to the table view's next key view anyway, which is assumed to be the table containing dock contents.

See also: DockContentsDataSource.paste:

This page was generated with DocYouMeant, a program created by Belkadan Software