EditorWindowDock.txt 4.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465
  1. DockManager
  2. - DOCKING: When user drags a window, EditorWidgetContainer detects that and reacts accordingly
  3. - For title bar it draws the drop locations, and does the same for content
  4. - After the drop is done it just notifies the DockManager (if the drop was on contents) with addWidgetRelativeToMe(this, location, draggedWidget)
  5. - (If the drop was done on the title bar, then the EditorWidgetContainer can handle that internally)
  6. - Drop manager creates two new DockedWindowContainers
  7. - Existing a new widgets are moved into each. Existing container (for the existing widget) now becomes the parent of the two new containers.
  8. - Size of the new containers are adjusted (and containers internally adjust the size of their widgets, and/or their child containers)
  9. - A spacer widget is added between them, that may be used for resizing. DockedWindowContainers on both sides of the spacer and kept as a reference
  10. - Also, make sure to detect a case when there are no widgets in the dock manager
  11. - Resizing a DockedWindowContainer recursivelly resizes all child containers
  12. - UNDOCKING: If the last EditorWidget is removed from EditorWidgetContainer, DockManager is notified and it takes care of removing the relevant
  13. DockedWindowContainer and the spacer.
  14. TODO - Possibly add a way to have hidden widgets in the EditorWidgetContainer (like side-bars that pop on mouse over in Visual Studio)
  15. TODO - A way to persist window states
  16. - Also a way to reset all widgets to original locations
  17. ------------------------
  18. DockManager implementation plan:
  19. - DockManager main class
  20. - When empty make sure it has a GUIElement that covers its entire space so it can catch and drop events. Will likely need a special transparent GUIElement?
  21. - Has a reference to one DockContainer, which is initially empty
  22. - DockContainer can have two DockContainer children, or one EditorWidgetContainer child (maybe make a container base class? - optional)
  23. - DockContainer should probably contain a GUIElement which can receieve events
  24. - This would mean extending GUIManager so it can send events to top level elements, and if they don't process them, send them one level lower?
  25. - Resizing a DockContainer resizes all child DockContainers recursively (and EditorWidgetContainers)
  26. - If DockContainer has DockContainer children then it also contains a GUIElement resizer (just an empty space, in the direction of the split)
  27. - Moving the element allows you to resize the two child DockContainers
  28. - When last element is removed from EditorWidgetContainer make sure to notify the parent
  29. - Make main render window frameless
  30. - Implement MainEditorWindow from EditorWindowBase
  31. - Make sure MainEditorWindow holds a DockManager reference and resizes it with the window
  32. DockContainer biggest issues:
  33. - How do I draw the drag and drop overlay??
  34. - How do I detect mouse input yet still let it through to child widget
  35. FIRST CREATE DOCK CONTAINER WITHOUT DRAG AND DROP SUPPORT
  36. Add RenderTexture::create
  37. - Attempt creating one and attaching it to the primary camera
  38. - Test DX9/DX11/OpenGL
  39. - Figure out how to use it for display, and then create a GUIRenderTexture element.
  40. - Rendering from it should technically just involve setting it as a sprite texture and using ImageSprite
  41. Make sure to test everything thoroughly - right now I have tested very little
  42. Drag and drop manager currently ignores the provided icon, but it should use it as a cursor
  43. TODO - Prevent docking if available size is less than 20 pixels, otherwise there might be some weirdness
  44. ------------------------
  45. Some use cases:
  46. 1. User drags one of the tabs on EditorWindow and then drops it
  47. - If user drags for N pixels the draged tab (and its EditorWidget) is removed from the EditorWindow and added to DragAndDropManager
  48. - If user drops the window onto empty/unsupported element drag and drop manager "dropCallback" is executed and EditorWidget is restored in its own EditorWindow.
  49. - If user drags the window over a title bar, drop positions get highlighted on the title bar
  50. - If the user releases over the title bar, the window is added at the specified drop position
  51. - If the user drags over an EditorWidget content area, semi-transparent drop areas are shown, and current area is highlighted
  52. - Dropping the window in that area will split the available space between existng and new window contents
  53. 2. User organizes his windows and the quits and restarts the program
  54. - TODO