TreeView.txt 2.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. TreeView
  2. - internally I store TreeElements in a hierarchy. Each has a:
  3. - isExpanded
  4. - modifying this value will update GUIElements of all the child values (add or remove them)
  5. - adding/removing a child to/from an element should add or remove the foldout button
  6. - call markContentAsDirty
  7. - updateLayoutInternal
  8. - goes through all TreeElements and updates their positions
  9. - Name editing
  10. - Detect mouse input in TreeView and if I double click over a GUILabel start rename
  11. - Or if I select it and hit F2 also start rename
  12. - Has callbacks with which it notifies TreeView of actual changes
  13. - Selecting
  14. - Clicking on a row of TreeView sets a flag that item is selected, and a GUIElement is created.
  15. - Element is positioned in updateLayoutInternal and it shows a different colored background
  16. - Deleting
  17. - Simply track currently selected element and Delete event
  18. Implementation steps:
  19. - Get just labels with indenting rendering
  20. - Test if SceneObject add/remove/rename works and updates data properly
  21. - Add expand buttons
  22. - Test if expanding/closing works properly
  23. - Selection
  24. - Clicking on element selects it, delete removes it, F2 renames is. Slow double click renames it.
  25. - Rename implementation to follow, just set up an empty method for now
  26. - Callback on selection
  27. - Rename implementation
  28. - When rename is initiated hide the objects label and replace it with an input-box with the same text as a label
  29. - Rename ends when user hits enter or click anywhere else but the rename box
  30. - Drag and drop
  31. - If a mouse drag is detected DragAndDropManager is activated
  32. - Element is not removed from its original position until drag is complete
  33. - Dragging over an element will make a highlight box appear around it
  34. - Dragging between elements will make a thick line appear between them
  35. - Releasing the drag changes the element parents
  36. - Auto scroll
  37. - Sliding over top or bottom of the tree view while dragging an element will search GUIElement parents to find a ScrollArea. If it finds one it will attempt to scroll up or down.
  38. Detecting external clicks:
  39. - LostFocus event?
  40. - Triggered when I click on another control within my own windows, or when controls parent window loses the focus himself
  41. - Each GUIElement can implement acceptsMouseFocus event. If it does, then mouse click will cause a ReceivedFocus event.
  42. - Mouse click on any other element, or window losing focus will trigger LostFocus events
  43. - I can replace clumsy Selective Input with this approach
  44. - DropDownBox can also use the same approach although I will likely need to convert DropDownBox to a GUIElement - DO THIS AFTER TreeView implementation is working