-
Notifications
You must be signed in to change notification settings - Fork 247
Design: multi panel
One cool thing cursive doesn't currently supports is multiple joined panels with borders.
https://users.rust-lang.org/t/how-to-make-that-layout-using-cursive/55128
Here are some solutions to implement this:
- Add a
MultiPanel
view with a series of panels. Could be horizontal or vertical. Equivalent to adding borders toLinearLayout
(and a title). This can support the original request, but not much else. - Add a recursive
MultiPanel
view (or a recursive LinearLayout?), with a tree of subpanels (or leaf views). This can support the equivalent of nested linear layouts:
+-----------+
| |
+-----+-----+
| | |
+-----+-----+
- Finish the mythical GridView, and give it borders (and a title). This could support:
+-----+--+
| | |
+--+--+ |
| | | |
| +--+--+
| | |
+--+-----+
Overall, it feels like handling multiple panels is very similar to handling multiple views, just with borders. Could we split the responsibilities? Not sure. The very fact of having borders impacts the size views take. If we really wanted to split responsibilities, the MultiPanel view should only draw borders. We would have for example:
- multipanel view
- linear layout (vertical)
- content view
- delimiter
- content view
- multipanel view (but without side and bottom borders, those are handled by the parent multipanel already)
- linear layout
- content
- delimiter
- content
- linear layout
- linear layout (vertical)
Or we could have:
- multipanel view
- custom view (maybe grid view?) with fancy pattern of borders
Now to get
+-----+-----+
| A | B |
+-----+-----+
| C | D |
+-----+-----+
Is more tricky. The parent MultiPanel only cares about the outside border. To draw the center cross, it could be nested LinearLayouts, but we'd need something to be aware of the delimiters from each side. Doesn't seem to be easy from a delimiter in between both layouts.
Maybe instead, it would be easier to make LinearLayout logic more embeddable, so many views can be view groups. (Similarly to how we made scrolling logic separate from the ScrollView).