Skip to content

[#2771] Implement GuiScrollContainer, a scrolling GuiContainer#2775

Open
oznogon wants to merge 4 commits intodaid:masterfrom
oznogon:generic-scrolling-guicontainer
Open

[#2771] Implement GuiScrollContainer, a scrolling GuiContainer#2775
oznogon wants to merge 4 commits intodaid:masterfrom
oznogon:generic-scrolling-guicontainer

Conversation

@oznogon
Copy link
Contributor

@oznogon oznogon commented Mar 9, 2026

Implements #2771. Requires daid/SeriousProton#300.

Add GuiScrollContainer, a subclass of GuiElement that further modifies its drawing functions to support clipping and vertical scrolling.

  • Add static helper functions for subclass access to protected GuiContainer members related to this purpose (ownership, hover/focus, drawing, clicking, and scroll behavior).
    • Update GuiContainer style and formatting for consistency.
  • Add a GuiScrollContainer subclass of GuiElement.

This also modifies GuiSelector to apply scroll translation to the popup generated by GuiSelector, which is created outside of the tree.

@oznogon
Copy link
Contributor Author

oznogon commented Mar 9, 2026

I've been using this implementation for a while in a branch focused on expanding ECS GM tweaks. This also has implications for the HotkeyMenu, and I've also tested replacing the bespoke scrolling and text/image clipping code in GuiListbox by using GuiScrollContainer as a parent. This can likely also be applied to the scrolling and clipping code in text boxes. Will file additional PRs for the HotkeyMenu and GuiListbox (#2777) to demonstrate the behavior.

oznogon and others added 3 commits March 12, 2026 01:11
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
Increase the default scrollbar click_change on GuiScrollContainer
to 50, matching mousewheel scroll increments.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant