Jazz2::UI::Menu::WidgetSection class

Base class of a declarative menu section.

Hosts a single root Widget (typically a StackLayout) and an optional title, and implements the section update, draw, clip and touch callbacks by driving that widget tree. Subclasses only build their content in MenuSection::OnShow via SetTitle and SetContent, replacing the per-section frame/title drawing, item layout, navigation and touch handling with a few declarative calls.

Base classes

class MenuSection
Base class of a menu section.

Derived classes

class ControlsOptionsSection
Controls options menu section.
class CreateLocalGameOptionsSection
Local splitscreen game options menu section.
class EpisodeSelectSection
Episode selection menu section.
class FirstRunSection
First run menu section.
class GameplayEnhancementsSection
Gameplay enhancements menu section.
class GameplayOptionsSection
Gameplay options menu section.
class GraphicsOptionsSection
Graphics options menu section.
class HighscoresSection
Highscores menu section.
class LanguageSelectSection
Language selection menu section.
class MultiplayerGameModeSelectSection
Multiplayer game mode selection menu section.
class OptionsSection
Options menu section.
class PlayMultiplayerSection
Play multiplayer menu section.
class RemapControlsSection
Remap controls menu section.
class RescaleModeSection
Rescale mode selection menu section.
class SoundsOptionsSection
Sounds options menu section.
class UserProfileOptionsSection
User profile options menu section.

Constructors, destructors, conversion operators

WidgetSection()

Public functions

auto GetClipRectangle(const Recti& contentBounds) -> Recti override
Allows to override clip rectangle of the middle layer.
void OnUpdate(float timeMult) override
Called when the section should be updated.
void OnDraw(Canvas* canvas) override
Called when the section should be drawn — the bottom background layer.
void OnDrawClipped(Canvas* canvas) override
Called when the section should be drawn — the middle clipped layer.
void OnTouchEvent(const nCine::TouchEvent& event, Vector2i viewSize) override
Called when a touch event is triggered.
void OnKeyPressed(const nCine::KeyboardEvent& event) override
Called when a key is pressed.
void OnTextInput(const nCine::TextInputEvent& event) override
Called when a text input is detected.
auto GetNavigationFlags() const -> NavigationFlags override
Allows to override navigation behavior.

Protected functions

void SetTitle(StringView title)
Sets the section title drawn above the top divider line.
void SetContent(std::unique_ptr<Widget> content)
Sets the root widget that fills the clipped content area.
auto GetContent() const -> Widget*
Returns the root widget, or nullptr.
void OnBackPressed() virtual
Called when the back button is pressed; leaves the section by default.