Open dszidi opened 1 month ago
Current implementation has an NSWindow created in controller and then DockIcon instances added as subviews to the window. This is an overly simplistic approach and will require an extra layer of abstraction to get the drag and drop functionality to work. Changing to the new hierarchy will also have other benefits later on.
New hierarchy should use a new base class DockGroup (inherits from NSView) for the icon groups. The DockGroup views get added to the NSWindow and serve specific functions.
NSWindow
Features
NSView <NSDraggingSource, NSDraggingDestination>
acceptedType
property can be either an application or directory but not bothacceptsIcons
propertycanDragReorder
propertycanDragRemove
propertycanDragMove
propertyscreenEdge
property (Bottom | Left | Right)First and last icons of the dock are actually in their own locked down groups and are hard coded to file manager first position and trash can in last position. Doing this will keep the logic of the DockGroup class simpler without logic to accommodate the edge cases.
acceptedType
set to applicationacceptsIcons
set to NOcanDragReorder
set to NOcanDragRemove
set to NOcanDragMove
set to NOscreenEdge
set by DockAppControlleracceptedType
set to applicationacceptsIcons
set to YEScanDragReorder
set to YEScanDragRemove
set to YEScanDragMove
set to YESscreenEdge
set by DockAppControlleracceptedType
set to applicationacceptsIcons
set to NOcanDragReorder
set to NOcanDragRemove
set to NOcanDragMove
set to YES (so you can add it to DockedIconsView)screenEdge
set by DockAppControlleracceptedType
set to directoryacceptsIcons
set to YEScanDragReorder
propertycanDragRemove
propertycanDragMove
set to YESscreenEdge
set by DockAppControlleracceptedType
set to applicationacceptsIcons
set to NOcanDragReorder
set to NOcanDragRemove
set to NOcanDragMove
set to NOscreenEdge
set by DockAppControllerAll of these DockGroups will be added to the NSWindow as subviews. DockIcon instances will be added to these DockGroups as subviews. This will leave us with a hierarchy that looks like this...
NSWindow -> DockGroup -> DockIcon
Update:
It seems I completely missed NSDockTile. I have made a bunch of progress on this project already but will need to leverage NSDockTile as it provides much expected functionality. This is not only good for Gershwin development, but any porting of Mac apps to our GNUstep based environment will likely require NSDockTile to get all the dock related features of the application.
It seems switching to using NSDockTile requires more refactoring than I would like for this issue. I will address it as a separate task.
Allow users to add/remove icons via drag and drop.