Pulp 1.88.0
Cross-platform audio plugin framework
Loading...
Searching...
No Matches
preferences_panel.hpp File Reference

PreferencesPanel — sidebar-of-pages container for app preferences. More...

#include <algorithm>
#include <functional>
#include <memory>
#include <optional>
#include <string>
#include <vector>
#include <pulp/state/properties_file.hpp>
#include <pulp/view/view.hpp>

Go to the source code of this file.

Classes

class  pulp::view::PreferencesPanel
struct  pulp::view::PreferencesPanel::Page

Namespaces

namespace  pulp
namespace  pulp::view
 Hover-cursor tracking for platform window hosts.

Detailed Description

PreferencesPanel — sidebar-of-pages container for app preferences.

PreferencesPanel is a View subclass that hosts a sidebar of named "pages". Each page is a (title, icon, content) tuple; the panel shows the sidebar entries on the left and the active page's content view filling the rest. Setting the active page is one of:

  • set_active_page(index) — programmatic switch.
  • set_active_page(title) — switch by title (no-op if not found).
  • clicking a sidebar row (drives the same switch via the host's mouse routing; tests can call simulate_select(index) instead).

Persistence: a PreferencesPanel can be bound to a pulp::state::PropertiesFile (typically the user lane of ApplicationProperties) so the last-selected page survives across runs. The persistence key defaults to "preferences.active_page" and is configurable via set_persistence_key. bind_persistence() does a one-shot read of the stored title and selects the matching page (no-op if the page is gone). Subsequent set_active_page calls write back.

Headless-friendly: pages register View content but PreferencesPanel never paints in tests — it just owns the registry + active-index state.

License-lineage note: the name is Pulp-native.