Widgets - Part 4
More widget work this week, but it's shaping up reasonably well, so next week I might actually be moving on to something else.
TileGrid improvements
- TileGrid rendering is now pixel-perfect for the single-rectangle case, so thankfully that bug is gone.
- I've added configurable edge scrolling for TileGrids, so that by moving the mouse at the edge of the tile grid, the focal point is shifted towards that edge. The closer the cursor is to an edge, the bigger the adjustment. It can be seen in the video below
Widget cloning
Given a database of allocated, configured but inactive widgets, we should at any point be able to clone one and activate it, ready for use, for example when spawning floaters and modal widgets.
Floaters and Modal widgets
Floater and modal widget functionality is now implemented: handling focus, input, spawning and destruction.
Floaters do not get input or focus. In contrast, modal widgets get full focus: while a modal widget is active, no other widget may get input focus, unless it's under the modal widget's hierarchy. For example, a modal ok/cancel dialog widget would allow input+focus for its text and buttons, but not for any other widget. Example below:
Resizable widgets
Widget dimensions get finalized at activation time. If widget dimensions are set to 0 or under, then we can calculate optimal dimensions based on what the widget really is, e.g. a text widget would calculate the optimal dimensions for the text that it will display. For padding the optimal dimensions, negative dimensions are interpreted as amount of padding to add to the optimal. Example: A textbox widget with dimensions (100, -16) will calculate the optimal box height given a width of 100, and will add 16 to that height: that will be the final height of the box on activation.