-
Notifications
You must be signed in to change notification settings - Fork 25
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
Layout::layout method and layout visitor, make_layout macro #259
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Test in examples/counter; this is currently quite hacky
Rationale 1: one less field needed in custom structs. Rationale 2: allows simpler layout visitor construction? Benchmarks: run examples/data-list with various numbers of entries, timing layout::sizer::apply_rect. Debug results: negligible change. Release results: 2-5% increase in time. Release after removing alignment tokens: <2% increase.
Tested on ListView
Unused and confusing (also call f on self)
This allows using the layout visitor
Also some tweaks to examples/clock
This is not really desirable but not too problematic. Motivation: layout visitor can now generate draw.
These are not (x, y) coordinates, so it's better to take inspiration from reading order (big endian) and intuition. We already had row-before-column more often than not!
position and alignment specifiers within child #[widget] attributes.
This is more consistent with other widgets
Manual implementations: -3 +4 At least the default is more likely to behave as expected and there is a warning when this is not the case.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Continues revisions from #258, this time adding a new
Layout::layout
method which can be used to replace all other layout method impls (excepting possiblydraw
), most of the time. Incomplete (spatial_nav
, for which it makes sense to updateWidgetId
first).It is very likely that some renaming will happen a little later (since it's inconvenient having two things called
Layout
).Layout::layout
does not makesize_rules
,set_rect
etc. redundant; some special cases will continue to implement these directly (e.g.ListView
).Unknown: whether the visitor system should allow user extension. So far this doesn't look sufficiently useful (since most special cases affect only a single widget, and then one can make a widget for this special case).