-
Notifications
You must be signed in to change notification settings - Fork 3
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add Border Widget #10
Comments
The big question that comes to mind when thinking about a border widget is "what do you do if the widget is allocated more space than it requested?". In some cases, you want the border to be drawn tight around some fixed-size content, so extra space should appear as 'margin' outside of the border. In other cases, you want the border to surround all of the allocated space to portion it off from other surrounding widgets, leaving extra 'padding' between the content and the border. The solutions I came up with are:
Blindly drawing the border is simple, but requires potentially two envelope widgets to properly manage margin and padding. Combining some envelope functionality is tempting to avoid making tons of widgets. I got it working in this commit, but it still required one envelope to work properly (basically eliminating one envelope from the two required for margin and padding). While it works, that solution flies in the face of the 'combination over capabilities' strategy of this library. My next attempt will be a simple border widget that draws its frame around the outside of the allotted area, then passes the internal frame area to the content. However, I will separately add a 'composite widget' class to include two envelopes and a border which allows framing content similarly to the CSS Box Model |
The only final question is what kind of restrictions or freedoms should the user have for determining the border thickness. The options I see are:
My first inclination is to allow 4 independent border thicknesses, because why not? However because of the way centering and aligning works it seems unlikely anyone will ever need asymmetric borders. If they do, they can just stack lines in a Rows/Columns widget. Supporting different horizontal/vertical thicknesses just to mirror the envelope functionality seems like a good compromise, but a constructor that only requires a uniform thickness to be specified is a must. |
Simple UIBorder widget that draws a border around the outside of its allocated space
Simple UIBorder widget that draws a border around the outside of its allocated space
The text was updated successfully, but these errors were encountered: