Skip to content
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

Better tab controls #336

Merged
merged 6 commits into from
Oct 29, 2024
Merged

Better tab controls #336

merged 6 commits into from
Oct 29, 2024

Conversation

DaleStan
Copy link
Collaborator

This is a continuation of the bare-bones tooling added by #332; the layout and rendering of a tab control is now encapsulated into a TabControl class. That class takes care of rendering all the tabs and drawing only the correct tab content, as long as you give it string for each title and a GuiBuilder to render each tab body.

For testing, I declared various sets of tabs, changed the TabControl properties, and made sure the tabs rendered and reacted as expected. Eventually I ended up with this monstrosity:

    private readonly TabControl tabControl = new(("General", DrawGeneral), ("Progression", DrawProgression), ("Tab 1", null), ("Tab 2", null), ("Tab 3", null), ("Tab 4", null), ("Tab 5's title text causes fewer problems", null), ("Tab 6", null), ("Tab 7", null), ("Tab 8 has an obscenely long title text for the purpose of causing as many problems as physically possible", null), ("Tab 9 wants three lines\nin its text, but\nthat doesn't work", null));

I expected Tab 9's title to render on three lines of text, but it only renders on one line. I decided to leave multi-line tab titles as an project for another time.

@shpaass
Copy link
Owner

shpaass commented Oct 28, 2024

Mother of god, that's some tab control alright. Great stuff!

@shpaass shpaass force-pushed the better-tab-controls branch from 435ba1c to d798a0a Compare October 29, 2024 10:57
@shpaass
Copy link
Owner

shpaass commented Oct 29, 2024

Rebased on fresh master

@shpaass shpaass force-pushed the better-tab-controls branch from d798a0a to 6733564 Compare October 29, 2024 11:09
@shpaass
Copy link
Owner

shpaass commented Oct 29, 2024

Rebased once more due to another PR being merged

@shpaass shpaass merged commit 9e96d3e into shpaass:master Oct 29, 2024
1 check passed
@DaleStan DaleStan deleted the better-tab-controls branch October 29, 2024 11:19
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.

2 participants