Repository navigation
Let controls live outside GUIApplication, starting with dialogs - #354
Merged
Merged
Conversation
…gs (#350) A library of controls on top of gui_controls keeps its state per application in an AppExtension (app.Extension<T>()), with hooks for theme loads, the frame and cleanup. Its controls are free functions that take the app. Dialogs are the first: message dialogs, toasts, banners, BusyButton and the progress controls move into gui_dialogs (TachyonUI::gui_dialogs). Their state leaves GUIApplication, their styles leave GUITheme (GetDialogStyles), and callers pass the app first: ShowToast(app, desc).
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.
Part of #350
The third step of splitting
gui_controls: a way for controls to live in libraries of their own, and dialogs as the first one.Extensions
A library on top of
gui_controlscan't add members toGUIApplication. Its controls are free functions that take the app, and what they keep per app lives in anAppExtension(gui_controls/gui_app_extension.h).app.Extension<T>()makes the app'sTon first use and keeps it untilCleanup. Each type has a slot number, so it's an index, not a search.OnStylesLoaded(after each theme load, and when made after one),OnPostConstruct,OnEndFrame,OnCleanup.gui_application.h:ScheduleFrameAt,CloseOnPressOutside,RetireWindow,AppColorStyle,ButtonGroupItemStyle/NoteButtonGroupItem(Button uses them too),LastStatusBar; andGUITheme::VariableColor.Dialogs:
gui_dialogsBusyButtonand the progress controls moved tosrc/gui_dialogs, a library of their own (TachyonUI::gui_dialogs, installed and exported).GUIApplicationinto the extension.GUIThemeintoGetDialogStyles(app), looked up by CSS class after each load. The built-in CSS defines every one.CloseRequestedand the status bar stay ingui_controls: they belong to windows.Breaking change for apps
Apps that use these controls link
TachyonUI::gui_dialogs, include<gui_dialogs/gui_dialogs.h>, and pass the app first:ShowToast(desc)ShowToast(*this, desc)ProgressBar(0.5f)ProgressBar(*this, 0.5f)theme.progressBarSmallStyleRefGetDialogStyles(*this).progressBarSmallStyleRefWhat they draw and how they behave is unchanged. The showcase, tests and docs are updated; apps that don't use them don't link the library.
Tests
app_extension_test.cpp: one object per type and app, made on first use with the styles loaded (or getting them when they load), run with each frame, cleaned up and destroyed with the app.Docs: the build guide lists the library, the dialog sections say how to link and call them, and writing-controls has a new section on controls outside GUIApplication. CHANGELOG updated.