Skip to content

Refactor GuiSelector, implement GuiScrollContainer in popups#2783

Draft
oznogon wants to merge 14 commits intodaid:masterfrom
oznogon:guiscrollcontainer-guiselector-popup
Draft

Refactor GuiSelector, implement GuiScrollContainer in popups#2783
oznogon wants to merge 14 commits intodaid:masterfrom
oznogon:guiscrollcontainer-guiselector-popup

Conversation

@oznogon
Copy link
Contributor

@oznogon oznogon commented Mar 12, 2026

This draft demonstrates usage of #2775 and stacks on that PR. 2775 requires daid/SeriousProton#300, and CI will fail without SP 300.

Limit GuiSelector popup lists to 10 items (500 virtual px) in GuiScrollContainer, and make popups that exceed that length scrollable. Adjust popup closing behavior accordingly to allow clicking on the scrollbar to navigate the list.

This also implements methods to set the popup's width to a value larger than the GuiSelector's for text-fitting purposes, and clips value text to the GuiSelector's bounds.

Fixes #2646.

@oznogon oznogon changed the title Guiscrollcontainer guiselector popup Refactor GuiSelector, implement GuiScrollContainer in popups Mar 12, 2026
oznogon and others added 5 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.
Limit GuiSelector popup lists to 10 visible items and scroll the
list if necessary.
@oznogon oznogon force-pushed the guiscrollcontainer-guiselector-popup branch from 8da57b1 to 9dc6670 Compare March 12, 2026 08:46
oznogon added 2 commits March 12, 2026 02:57
Reparent CustomShipFunctions to GuiScrollContainer and tailor the
element height to the default UI on most crew screens.
@oznogon oznogon force-pushed the guiscrollcontainer-guiselector-popup branch from 9dc6670 to 4ec0c58 Compare March 13, 2026 01:59
oznogon and others added 7 commits March 22, 2026 23:19
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.
- Hide scrollbar if ScrollMode is None.
- Use pragma once guard
- Internal consistency in formatting
- Expand terse varnames
- Remove redundant public/protected sections in the header
Remove use of SP-based translation/reprojection and implement
scrolling by recursively manipulating descendant rects.

- Add GuiContainer::offsetElementRect() to recursively apply the
  given positional offset.
- Replace SP translation methods in GuiScrollContainer with
  GuiContainer::offsetElementRect().
- Update GuiSelector popup handling.
Remove offsetElementRect() (which recursively loops child elements)
and instead move elements by scroll_offset in updateLayout() (which
already recursively loops child elements).
@oznogon oznogon force-pushed the guiscrollcontainer-guiselector-popup branch from 49f25f5 to 0bbe4a5 Compare March 23, 2026 07:09
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.

[Bug] Beam and shield frequencies < 460THz aren't accessible in GuiSelector popup on non-vertical displays

1 participant