gershwin-os / dock

GNU General Public License v3.0
0 stars 0 forks source link

Drag and Drop Icon Management #4

Open dszidi opened 1 month ago

dszidi commented 1 month ago

Allow users to add/remove icons via drag and drop.

dszidi commented 3 weeks ago

Planned Implementation Notes

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

DockGroup base class

Features

DockGroup Instances

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.

FileManagerIconView

DockedIconsView

UndockedIconsView

PlacesView

TrashIconView

All 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

dszidi commented 1 week ago

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.

dszidi commented 1 week ago

It seems switching to using NSDockTile requires more refactoring than I would like for this issue. I will address it as a separate task.