Pulp 1.88.0
Cross-platform audio plugin framework
Loading...
Searching...
No Matches
pulp::view::ThemeManager Class Reference

Manages the connection between AppearanceTracker and Theme switching. More...

#include <appearance_tracker.hpp>

Public Member Functions

 ThemeManager ()
void set_theme_pair (Theme light_theme, Theme dark_theme)
 Set the theme pair for automatic appearance-based switching.
const Theme & active_theme () const
 Get the active theme based on current appearance (or locked theme).
void lock_theme (Theme theme)
 Lock to a specific theme, ignoring appearance tracking.
void lock_appearance (Appearance appearance)
 Lock to an appearance (light/dark) but still use the theme pair.
void unlock ()
 Unlock and resume automatic theme switching.
void set_mode (ThemeMode m)
 User-facing theme preference.
ThemeMode mode () const
bool is_locked () const
 Check if a specific theme is locked.
AppearanceTracker & tracker ()
 Access the underlying tracker for direct appearance queries.
const AppearanceTracker & tracker () const
bool poll ()
 Poll for changes. Returns true if the active theme changed.
void on_theme_changed (std::function< void(const Theme &)> callback)
 Register a callback for when the active theme changes.

Detailed Description

Manages the connection between AppearanceTracker and Theme switching.

Holds a light theme, dark theme, and optional locked theme.

Constructor & Destructor Documentation

◆ ThemeManager()

pulp::view::ThemeManager::ThemeManager ( )

Member Function Documentation

◆ active_theme()

const Theme & pulp::view::ThemeManager::active_theme ( ) const

Get the active theme based on current appearance (or locked theme).

◆ is_locked()

bool pulp::view::ThemeManager::is_locked ( ) const
inline

Check if a specific theme is locked.

◆ lock_appearance()

void pulp::view::ThemeManager::lock_appearance ( Appearance appearance)

Lock to an appearance (light/dark) but still use the theme pair.

◆ lock_theme()

void pulp::view::ThemeManager::lock_theme ( Theme theme)

Lock to a specific theme, ignoring appearance tracking.

◆ mode()

ThemeMode pulp::view::ThemeManager::mode ( ) const

◆ on_theme_changed()

void pulp::view::ThemeManager::on_theme_changed ( std::function< void(const Theme &)> callback)

Register a callback for when the active theme changes.

◆ poll()

bool pulp::view::ThemeManager::poll ( )

Poll for changes. Returns true if the active theme changed.

◆ set_mode()

void pulp::view::ThemeManager::set_mode ( ThemeMode m)

User-facing theme preference.

set_mode(system) resumes OS tracking; light/dark pin the corresponding theme from the pair. This is the recommended surface — it maps onto lock_appearance()/unlock() so the system/light/dark choice round-trips cleanly via mode().

◆ set_theme_pair()

void pulp::view::ThemeManager::set_theme_pair ( Theme light_theme,
Theme dark_theme )

Set the theme pair for automatic appearance-based switching.

◆ tracker() [1/2]

AppearanceTracker & pulp::view::ThemeManager::tracker ( )
inline

Access the underlying tracker for direct appearance queries.

◆ tracker() [2/2]

const AppearanceTracker & pulp::view::ThemeManager::tracker ( ) const
inline

◆ unlock()

void pulp::view::ThemeManager::unlock ( )

Unlock and resume automatic theme switching.


The documentation for this class was generated from the following file: