osu-framework icon indicating copy to clipboard operation
osu-framework copied to clipboard

Add `BorderLayoutContainer`

Open minetoblend opened this issue 5 months ago • 3 comments

I've copy-pasted this class into nearly 10 projects at this point so I figured it might make a good fit for osu-framework. Adds a BorderLayoutContainer (inspired by java swing's BorderLayout) which will layout it's children along each edge.

https://github.com/user-attachments/assets/2aa85c37-ffe4-4f6b-ac10-65321f6ec73f

minetoblend avatar Jun 28 '25 12:06 minetoblend

This looks like something which could replace some of our usage of grid / flow containers.

One area that I'm not sure about is currently if you set any of the side containers to relative sizing in their direction-towards-main-container everything falls apart. At very least, this should be guarded against.

peppy avatar Jun 29 '25 16:06 peppy

This looks like something which could replace some of our usage of grid / flow containers.

That's the main use case I had in mind for it, one other notable thing that comes to mind is stuff like the editor class which kinda does the same setup as this class but manually for positioning the top/bottom bars & the content in-between.

One area that I'm not sure about is currently if you set any of the side containers to relative sizing in their direction-towards-main-container everything falls apart. At very least, this should be guarded against.

Having relative sizes work with this be very handy but I can't quite figure out a good way of making that work, so I guess guarding against it like you said is probably the best option. Should such a guard be a simple runtime check that throws like how FillFlowContainer does in regards to automatic sizing & anchor/origin?

minetoblend avatar Jun 30 '25 06:06 minetoblend

Runtime check is the best we can do, so I think it's fine as a starting point.

peppy avatar Jun 30 '25 06:06 peppy