Fix for #354 - wrongly calculated widget sizes. #379
Merged
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.
This PR improve DlangUI widgets measure and window content support. Now it's possible to do something like this:
Widget measure
This can't be done without change some widget measure behavior. Now widgets are increasing when has FILL_PARENT flags - not shrinking to window size. We must measure widget size not content size for some of widgets like
Grid
,TreeView
,EditBox
,EditLine
. Most of this widgets need optimizations - content size can be measured only when content is changed. I don't do that in this PR.ScrollWidgetBase and inherited
I added
minimumVisibleContentSize()
which is used to get minimal sensible size.EditLine
I deliberated long time how to do it. And I think the best way is to get width and height of some standard text. I used "aaaaa" but there is
_textToSetWidgetSize
and in the future we can add property to set it to something else. Using string gives certainty that changing font will make widget enough big.That fixes not only getting minimal size but also widget don't grow when you write letters in some cases (for example when there are 2 widgets in horizontal layout with
FILL_PARENT
flag in one line).EditBox
Analogous to
EditLine
but it uses "aaaaa/naaaaa". There should be minimum 2 lines of text.ListWidget
This is a little tricky because it is used for menu. First measure returns 100,100 second measure returns real size (only because of menu).
WindowOrContentResizeMode enum
I not found better name, maybe someone gives something shorter.
There are three algorithms:
shrinkWidgets
- something like in previous version of DlangUIresizeWindow
- window is resized to fit content (not working in X11 now becauseWindow.windowResize()
is not implemented in X11scrollWindow
- now default, if widgets are bigger than window adds scrollbars to windowWarnings
Extra fixes
Fixed theme change on X11.