Refactor GuiListbox to use GuiToggleButton and GuiScrollContainer#2777
Draft
oznogon wants to merge 5 commits intodaid:masterfrom
Draft
Refactor GuiListbox to use GuiToggleButton and GuiScrollContainer#2777oznogon wants to merge 5 commits intodaid:masterfrom
oznogon wants to merge 5 commits intodaid:masterfrom
Conversation
Add GuiScrollContainer, a subclass of GuiContainer to support arbitrary and nested scrolling elements. This relies on changes in SeriousProton to implement GL_SCISSOR_TEST in RenderTarget. Child element positions and click/hover handling are translated relative to the scroll position. These containers can be nested, and mousewheel and scroll events are passed down the tree. This container element can also replace the bespoke scrolling behaviors in other element types, such as GuiListbox. - Pass focus, text input through GuiScrollContainer. - Position nested GuiSelector popups relative to scroll translation - Add scrollToOffset() function to allow other elements to control scroll position. - Handle layout padding in scissor rects.
- Use pragma once guard - Internal consistency in formatting - Expand terse varnames - Remove redundant public/protected sections in the header
2c14af6 to
b63d472
Compare
Increase the default scrollbar click_change on GuiScrollContainer to 50, matching mousewheel scroll increments.
- Replace bespoke button rendering and audio management with GuiToggleButtons. This aligns audio sfx with GuiButton, and aligns icon and text positioning in listboxes that use icons with GuiButton. - Replace bespoke theme application with GuiButton->setStyle(). - Replace bespoke clipping/scrolling implementation with GuiScrollContainer. - Document functions.
b63d472 to
116b9d8
Compare
This file contains hidden or 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
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.
This draft demonstrates usage of #2775 and stacks on that PR. 2775 requires daid/SeriousProton#300, and CI will fail without SP 300.
Replace the bespoke audio, rendering, theming, clipping, and scrolling behaviors in
GuiListboxwithGuiToggleButton(audio, rendering, theming) andGuiScrollContainer(clipping, scrolling).This changes the appearance and sfx of
GuiListboxbuttons to align withGuiToggleButton. To accommodate icons,GuiButtonis also extended to allow customizing its icon size factor (setIconSize()), which is otherwise hardcoded to0.8vs.GuiListbox's default of0.6.If the old
GuiListbox's different layout when using icons (centered text, some left pad on the icon) is preferred overGuiToggleButton's defaults, additional customization functions forGuiButtonmight be useful.Theme styles defined for
listboxare still used, but are now applied viaGuiButton->setStyle()instead of using its own theme application logic.Before (left) and after:
This also fixes disappearing icons in
GuiListboxwhen a button is partially clipped.Before:
After: