-
-
Notifications
You must be signed in to change notification settings - Fork 685
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
[widget Audit] toga.ScrollContainer #1969
Merged
Merged
Changes from all commits
Commits
Show all changes
46 commits
Select commit
Hold shift + click to select a range
40a7dd0
Update docs for ScrollContainer
freakboy3742 e256720
Update core API for ScrollContainer.
freakboy3742 6705fe9
Add changenote.
freakboy3742 e06281d
Initial fixes for Cocoa, plus cocoa test probe for scrollcontainer.
freakboy3742 d72cfe5
Tweaked scrollcontainer example.
freakboy3742 04619a9
Misc debug cleanups.
freakboy3742 b89f14a
Cocoa ScrollContainer at 100%, including container rework.
freakboy3742 73edde4
Correct CI failures by using frame, rather than contentView for the s…
freakboy3742 73e1d30
GTK ScrollContainer to 100%.
freakboy3742 bea23c1
Add a content handler to the cocoa container impl, matching GTK.
freakboy3742 ae3aa13
Refactor iOS to remove viewports.
freakboy3742 3f34595
Initial working implementation of iOS ScrollContainer.
freakboy3742 e317601
Normalize some implementation details between iOS and Cocoa.
freakboy3742 883f8fb
iOS ScrollContainer to 100% coverage.
freakboy3742 ceb26be
Updated core tests, cocoa and GTK to match iOS implementation.
freakboy3742 dac11fb
Remove unneeded dummy class.
freakboy3742 20ca03e
Minor docs cleanups.
freakboy3742 dee3253
Corrections to the handling of containers in the Dummy backend.
freakboy3742 78d521a
Merge branch 'main' into audit-scrollcontainer
freakboy3742 c967ad4
Correct some docs markup issues.
freakboy3742 f37a4df
Merge branch 'main' into audit-scrollcontainer
freakboy3742 20697de
Merge branch 'main' into audit-scrollcontainer
freakboy3742 17e4a87
Merge branch 'main' into audit-scrollcontainer
freakboy3742 17d4120
Merge branch 'main' into audit-scrollcontainer
freakboy3742 8b266b9
Add current / max position indicator to scrollbar example app
mhsmith ffefeac
Loosen error handling when horizontal/vertical scrolling is disabled.
freakboy3742 572b95e
Correct the GTK implementation of scrolling reset.
freakboy3742 e781c3c
Corrected edge case seen in CI.
freakboy3742 6887b26
Android WIP
mhsmith 2abfbf0
Merge branch 'audit-scrollcontainer' of github.com:freakboy3742/toga …
mhsmith 8f52e48
Android ScrollContainer at 100%, including container rework
mhsmith 0dff504
Fix CI failures
mhsmith fcd6260
Fix DPI and rounding issues
mhsmith e6c2cf2
Update widget support table
mhsmith 814a7a2
More rounding fixes
mhsmith 1eeb439
Further Android container refactoring, fixing padding on ScrollContai…
mhsmith ee52a10
Refactor Winforms container/viewport mechanism
mhsmith b6a470b
Fix "backend" tests on Winforms
mhsmith 07c4e37
Fix ImageView tests on Winforms with positive scale factor
mhsmith 0d21010
Miscellaneous cleanups
mhsmith 7bb9766
Initial Winforms implementation (not working)
mhsmith 2004cb8
Winforms to 100%
mhsmith 6f6516e
Add comments explaining scale_in and scale_out
mhsmith 1bf22d1
Remove redundant checks in GTK which are now covered by the interface…
mhsmith 096ac1f
Cleaned up 2 stray uncovered lines.
freakboy3742 0e1302a
Add a test for performing a layout with no content.
freakboy3742 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
from .libs.android.widget import RelativeLayout, RelativeLayout__LayoutParams | ||
|
||
|
||
class Container: | ||
def init_container(self, native_parent): | ||
self.width = self.height = 0 | ||
|
||
context = native_parent.getContext() | ||
self.native_content = RelativeLayout(context) | ||
native_parent.addView(self.native_content) | ||
|
||
self.dpi = context.getResources().getDisplayMetrics().densityDpi | ||
# Toga needs to know how the current DPI compares to the platform default, | ||
# which is 160: https://developer.android.com/training/multiscreen/screendensities | ||
self.baseline_dpi = 160 | ||
self.scale = self.dpi / self.baseline_dpi | ||
|
||
def set_content(self, widget): | ||
self.clear_content() | ||
if widget: | ||
widget.container = self | ||
|
||
def clear_content(self): | ||
if self.interface.content: | ||
self.interface.content._impl.container = None | ||
|
||
def resize_content(self, width, height): | ||
if (self.width, self.height) != (width, height): | ||
self.width, self.height = (width, height) | ||
if self.interface.content: | ||
self.interface.content.refresh() | ||
|
||
def refreshed(self): | ||
# We must use the correct LayoutParams class, but we don't know what that class | ||
# is, so reuse the existing object. Calling the constructor of type(lp) is also | ||
# an option, but would probably be less safe because a subclass might change the | ||
# meaning of the (int, int) constructor. | ||
lp = self.native_content.getLayoutParams() | ||
layout = self.interface.content.layout | ||
lp.width = max(self.width, layout.width) | ||
lp.height = max(self.height, layout.height) | ||
self.native_content.setLayoutParams(lp) | ||
|
||
def add_content(self, widget): | ||
self.native_content.addView(widget.native) | ||
|
||
def remove_content(self, widget): | ||
self.native_content.removeView(widget.native) | ||
|
||
def set_content_bounds(self, widget, x, y, width, height): | ||
lp = RelativeLayout__LayoutParams(width, height) | ||
lp.topMargin = y | ||
lp.leftMargin = x | ||
widget.native.setLayoutParams(lp) |
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
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
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
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
Oops, something went wrong.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A quick note for future explorers on which direction is "in" and "out" would be helpful here.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
OK, done.