31 const std::function<
float(
const std::string&,
float)>& width_at);
66 s->active_popup =
nullptr;
75 items_ = std::move(
items);
78 const std::vector<std::string>&
items()
const {
return items_; }
113 bool flips_up()
const {
return dropdown_local_top() < 0.0f; }
154 void set_selected_impl(
int index,
Notify notify);
155 void open_dropdown();
156 void close_dropdown();
160 float dropdown_local_top()
const;
167 void dropdown_metrics(
float& top_local,
float&
height,
168 int& first_row,
int& visible_rows)
const;
175 void overlay_anchor_(
float& out_x,
float& out_y,
float& out_viewport_h,
176 float& out_viewport_w)
const;
177 void move_hover(
int delta);
178 void move_hover_to_edge(
bool last);
180 std::vector<std::string> items_;
182 int hover_index_ = -1;
183 int dropdown_scroll_ = 0;
189 static const std::string empty_string_;
203 const std::string&
text()
const {
return text_; }
214 float opacity()
const {
return opacity_.value(); }
244 int segment_at_(
Point pos)
const;
273 :
static_cast<double>(std::clamp(progress_, 0.0f, 1.0f));
292 label_ = std::move(
label);
299 float progress_ = 0.0f;
318 const std::string&
message()
const {
return message_; }
331 std::function<
void()> on_ok,
335 static std::unique_ptr<CallOutBox>
notify(
337 float duration_seconds = 3.0f);
343 std::string message_;
383 void add_tab(std::string title, std::unique_ptr<View> content);
390 int tab_count()
const {
return static_cast<int>(tabs_.size()); }
400 show_tab_bar_ = show;
417 std::vector<Tab> tabs_;
419 float tab_height_ = 32.0f;
420 bool show_tab_bar_ =
true;
452 if (selected_ >=
static_cast<int>(segments_.size())) selected_ = 0;
455 const std::vector<std::string>&
segments()
const {
return segments_; }
482 int segment_at_(
Point pos)
const;
484 std::vector<std::string> segments_;
487 bool designed_overlay_ =
false;
510 float scroll_x()
const {
return smooth_scroll_x_.value(); }
511 float scroll_y()
const {
return smooth_scroll_y_.value(); }
521 return smooth_scroll_x_.value();
524 return smooth_scroll_y_.value();
527 const float before_x = smooth_scroll_x_.value();
528 const float before_y = smooth_scroll_y_.value();
530 return smooth_scroll_x_.value() != before_x || smooth_scroll_y_.value() != before_y;
533 return smooth_scroll_x_.animating() || smooth_scroll_y_.animating();
592 static constexpr float kOverflowEpsilon = 1.0f;
594 void update_automatic_content_size();
595 void clamp_scroll_targets(
bool clamp_current =
false);
596 float max_scroll_x()
const;
597 float max_scroll_y()
const;
600 Size content_size_{0, 0};
601 bool automatic_content_size_ =
true;
602 float target_scroll_x_ = 0, target_scroll_y_ = 0;
604 ValueAnimation smooth_scroll_y_{0.0f};
605 ValueAnimation bar_opacity_{0.0f};
606 ValueAnimation bar_width_{4.0f};
609 bool dragging_v_bar_ =
false;
610 bool dragging_h_bar_ =
false;
611 float drag_offset_ = 0;
653 const std::vector<std::string>&
items()
const {
return items_; }
658 void set_icons(std::vector<std::string> icons) { icons_ = std::move(icons); }
689 std::vector<std::string> items_;
690 std::vector<std::string> icons_;
693 float row_height_ = 24.0f;
694 float scroll_offset_ = 0.0f;
Definition canvas.hpp:240
Interface for accessible values (sliders, knobs, progress bars).
Definition accessibility.hpp:16
virtual std::string get_value_string() const
Value as a human-readable string (e.g., "50%" or "-6 dB").
void set_message(std::string msg)
Definition ui_components.hpp:317
std::function< void()> on_cancel
Called when the user cancels (Cancel/No) or presses Escape.
Definition ui_components.hpp:323
static std::unique_ptr< CallOutBox > notify(const std::string &message, float duration_seconds=3.0f)
Create a notification that auto-dismisses.
const std::string & message() const
Definition ui_components.hpp:318
float auto_dismiss_seconds
Auto-dismiss after N seconds (0 = no auto-dismiss).
Definition ui_components.hpp:326
void paint(canvas::Canvas &canvas) override
bool on_key_event(const KeyEvent &event) override
Key event with modifiers and up/down state.
std::function< void()> on_confirm
Called when the user confirms (OK/Yes).
Definition ui_components.hpp:321
static std::unique_ptr< CallOutBox > confirm(const std::string &message, std::function< void()> on_ok, std::function< void()> on_cancel={})
Create a confirmation dialog with OK/Cancel buttons.
void on_text_input(const TextInputEvent &event) override
Text input from keyboard/IME (separate from key events).
View * hit_test(Point local_point) override
static void notify_global_click(View *target)
Called by the root view on any mouse click — closes popup if click is outside.
std::function< void(int index)> on_change
Called when selection changes.
Definition ui_components.hpp:93
void set_items(std::vector< std::string > items)
Publishes the currently-selected item into access_value: the selected text IS a combo box's accessibl...
Definition ui_components.hpp:74
float dropdown_width_hint() const
static ComboBox * active_popup_
Definition ui_components.hpp:187
void restore_open_state()
Reopen after a retained subtree move when the dropdown was active.
Definition ui_components.hpp:109
bool dropdown_window_rect(float &x, float &y, float &w, float &h) const
On-screen rect (root/overlay space) of the open dropdown menu — already flip-aware,...
bool is_open() const
Definition ui_components.hpp:106
bool flips_up() const
True when the menu currently renders ABOVE the field (it would spill past the viewport bottom).
Definition ui_components.hpp:113
void on_hover_move(Point local_pos) override
Pointer moved over this view with no button held, reported in this view's LOCAL coordinates.
void on_mouse_event(const MouseEvent &event) override
Mouse down with full event context.
~ComboBox() override
Definition ui_components.hpp:64
void set_selected(int index, Notify notify)
Notifying overload.
bool accepts_navigation_input() const override
Does this widget temporarily need host-delivered navigation keys?
Definition ui_components.hpp:99
void set_selected_silent(int index)
void paint(canvas::Canvas &canvas) override
void on_focus_changed(bool focused) override
Called when this view gains or loses focus.
static void abandon_active_popup(View &root) noexcept
Clear popup routing without invoking dismissal/change callbacks.
bool wants_mouse_input() const override
True if this widget handles mouse down/drag through virtual methods even when it does not expose JS p...
Definition ui_components.hpp:102
int selected() const
Definition ui_components.hpp:80
ComboBox()
Definition ui_components.hpp:49
int hovered_index() const
Index of the row painted with the hover/keyboard highlight (-1 = none).
Definition ui_components.hpp:115
static ComboBox * active_popup_in(View &scope)
The open dropdown that belongs to scope's own tree, or nullptr.
const std::vector< std::string > & items() const
Definition ui_components.hpp:78
const std::string & selected_text() const
static void close_active_popup(View &root)
Close only the active ComboBox owned by root.
bool on_key_event(const KeyEvent &event) override
Key event with modifiers and up/down state.
static void close_active_popup()
Close the process-global active ComboBox shim.
void set_selected(int index)
std::function< void(int index)> on_select
Called when an item is selected.
Definition ui_components.hpp:676
bool wants_mouse_input() const override
True if this widget handles mouse down/drag through virtual methods even when it does not expose JS p...
Definition ui_components.hpp:683
void set_icons(std::vector< std::string > icons)
Optional per-row leading icon glyphs (parallel to items()).
Definition ui_components.hpp:658
ListBox()
Definition ui_components.hpp:650
SelectionStyle selection_style() const
Definition ui_components.hpp:663
std::function< void(int index)> on_activate
Called when an item is double-clicked.
Definition ui_components.hpp:678
int selected() const
Definition ui_components.hpp:665
void set_row_height(float h)
Definition ui_components.hpp:673
SelectionStyle
Selected-row treatment.
Definition ui_components.hpp:645
@ accent
Definition ui_components.hpp:645
@ standard
Definition ui_components.hpp:645
void paint(canvas::Canvas &canvas) override
void on_mouse_event(const MouseEvent &event) override
Mouse down with full event context.
void set_items(std::vector< std::string > items)
Definition ui_components.hpp:652
void set_selected(int index, Notify notify=Notify::sync)
notify controls whether the selection change reaches on_select: Notify::sync (default) fires it,...
void ensure_visible(int index)
Scroll to make the given item index visible in the viewport.
bool on_key_event(const KeyEvent &event) override
Key event with modifiers and up/down state.
const std::vector< std::string > & items() const
Definition ui_components.hpp:653
float row_height() const
Definition ui_components.hpp:672
void set_selection_style(SelectionStyle s)
Select the selected-row treatment (see SelectionStyle).
Definition ui_components.hpp:662
void set_label(std::string label)
Optional label shown inside the bar.
Definition ui_components.hpp:291
std::string get_value_string() const override
Value as a human-readable string (e.g., "50%" or "-6 dB").
Definition ui_components.hpp:283
double get_maximum_value() const override
Maximum value.
Definition ui_components.hpp:282
bool is_indeterminate() const
True while progress() < 0 — the bar is animating an unknown-duration task.
Definition ui_components.hpp:268
ProgressBar()
Definition ui_components.hpp:260
void set_progress(float value)
Set progress value (0.0 to 1.0). Values < 0 show indeterminate state.
Definition ui_components.hpp:263
void set_current_value(double value) override
A progress bar is read-only (it advertises RangeValue, not Value), but the interface is bidirectional...
Definition ui_components.hpp:278
float progress() const
Definition ui_components.hpp:264
double get_minimum_value() const override
Minimum value.
Definition ui_components.hpp:281
double get_current_value() const override
Current value as a number.
Definition ui_components.hpp:271
void paint(canvas::Canvas &canvas) override
bool designed_overlay() const
Definition ui_components.hpp:473
bool on_key_event(const KeyEvent &event) override
Key event with modifiers and up/down state.
void set_selected(int index, Notify notify)
Notifying overload.
void set_designed_overlay(bool enabled)
Marks a browser-captured control as a live replacement.
Definition ui_components.hpp:472
SegmentedControl()
Definition ui_components.hpp:445
const std::vector< std::string > & segments() const
Definition ui_components.hpp:455
void set_selected(int index)
clamps + notifies on_change
void set_segments(std::vector< std::string > segments)
Definition ui_components.hpp:450
void paint(canvas::Canvas &canvas) override
float intrinsic_height() const override
Definition ui_components.hpp:479
int selected() const
Definition ui_components.hpp:457
int hovered_segment() const
for tests; -1 = none
Definition ui_components.hpp:469
bool wants_mouse_input() const override
True if this widget handles mouse down/drag through virtual methods even when it does not expose JS p...
Definition ui_components.hpp:478
void on_mouse_event(const MouseEvent &event) override
Mouse down with full event context.
std::function< void(int index)> on_change
Called when the selected segment changes (user click or set_selected).
Definition ui_components.hpp:467
void set_selected_silent(int index)
clamps, no callback
void add_tab(std::string title, std::unique_ptr< View > content)
TabBarStyle
Visual treatment of the tab bar.
Definition ui_components.hpp:370
@ underline
Definition ui_components.hpp:370
@ filled
Definition ui_components.hpp:370
void on_mouse_event(const MouseEvent &event) override
Mouse down with full event context.
bool set_active_tab(std::string_view title, Notify notify=Notify::sync)
int active_tab() const
Definition ui_components.hpp:389
int find_tab(std::string_view title) const
TabPanel()
Definition ui_components.hpp:379
void set_show_tab_bar(bool show)
Hide the tab bar and use the panel purely as a navigable card stack (the active tab is shown; switch ...
Definition ui_components.hpp:399
void set_active_tab(int index, Notify notify=Notify::sync)
notify controls whether the switch reaches on_tab_change: Notify::sync (default) fires it,...
std::string_view tab_title(int index) const
void paint(canvas::Canvas &canvas) override
std::function< void(int index)> on_tab_change
Called when the active tab changes.
Definition ui_components.hpp:410
bool wants_mouse_input() const override
True if this widget handles mouse down/drag through virtual methods even when it does not expose JS p...
Definition ui_components.hpp:414
int tab_count() const
Definition ui_components.hpp:390
void set_tab_bar_style(TabBarStyle style)
Select the tab-bar visual treatment (see TabBarStyle).
Definition ui_components.hpp:406
TabBarStyle tab_bar_style() const
Definition ui_components.hpp:407
void on_mouse_event(const MouseEvent &event) override
Mouse down with full event context.
void paint(canvas::Canvas &canvas) override
ThemeMode mode() const
Definition ui_components.hpp:235
float intrinsic_height() const override
Definition ui_components.hpp:242
void set_mode(ThemeMode m)
Definition ui_components.hpp:234
int hovered_segment() const
for tests; -1 none
Definition ui_components.hpp:237
ThemeModeControl()
Definition ui_components.hpp:233
void on_mouse_down(Point pos) override
bool wants_mouse_input() const override
True if this widget handles mouse down/drag through virtual methods even when it does not expose JS p...
Definition ui_components.hpp:241
std::function< void(ThemeMode)> on_mode_change
Definition ui_components.hpp:236
Lightweight, embeddable value animator for widget members.
Definition animation.hpp:293
void set_overlay_trigger(bool is_trigger)
Mark this view as a control that OPENS an overlay — a dropdown field, a menu button,...
Definition view.hpp:1701
Position position() const
Definition view.hpp:1767
void request_repaint()
Request that this view's host invalidate and schedule a repaint.
void set_visible(bool v)
Show or hide this view.
Definition view.hpp:343
RootInteractionState * existing_interaction()
Resolved interaction state WITHOUT lazily allocating — the root's slot if one exists,...
@ label
Definition view.hpp:989
@ group
Definition view.hpp:989
@ progress_bar
Definition view.hpp:992
@ combo_box
Definition view.hpp:990
void set_access_value(std::string value)
Definition view.hpp:1036
void set_derived_access_label(std::string label)
The CONTENT-DERIVED accessible name: a widget's visible text (Label::set_text, Knob/Fader/Toggleset_l...
Definition view.hpp:1020
void mark_runtime_view_kind(RuntimeViewKind kind)
Definition view.hpp:2379
int animate(std::function< void(float)> apply, float from, float to, float duration_s, std::function< float(float)> ease={}, std::function< void()> on_done={}, const std::string &tag={})
FlexStyle & flex()
Definition view.hpp:91
void set_access_role(AccessRole role)
Definition view.hpp:995
bool enabled() const
CSS :disabled equivalent — blocks input, reduces opacity.
Definition view.hpp:715
void set_focusable(bool f)
Definition view.hpp:669
@ sticky
Definition view.hpp:1753
Definition affine_transform.hpp:24
Hover-cursor tracking for platform window hosts.
Definition fwd.hpp:27
@ text
Plain text (default color).
Definition code_editor_tokenizer.hpp:37
float fit_combo_label(std::string &text, float avail, float base, float min, const std::function< float(const std::string &, float)> &width_at)
ThemeMode
User-facing theme preference.
Definition appearance_tracker.hpp:17
@ system
Definition appearance_tracker.hpp:17
Notify
Whether a value write notifies listeners, and when.
Definition slider_core.hpp:60
@ sync
fire listeners before returning
Definition slider_core.hpp:62
@ value
the widget's primary value (Knob, Fader, RangeSlider, Toggle, ProgressBar)
Definition binding_diagnostics.hpp:19
@ scope
a block of samples for a SpectrumView / WaveformView
Definition binding_diagnostics.hpp:21
@ s
Definition input_events.hpp:41
@ h
Definition input_events.hpp:39
@ y
Definition input_events.hpp:42
@ m
Definition input_events.hpp:40
@ d
Definition input_events.hpp:39
@ x
Definition input_events.hpp:41
@ w
Definition input_events.hpp:41
View * find_wheel_scroll_view_at(View &root, Point root_point)
Find the deepest view that participates in native wheel scrolling.
@ scroll
Definition view.hpp:47
@ height
Definition css_animation.hpp:128
ScrollView * find_scroll_view_at(View &root, Point root_point)
Find the deepest ScrollView whose bounds contain root_point (a point in root's local coordinate space...
The value engine shared by Pulp's continuous controls.
float padding_top
Per-side padding (-1 = use uniform padding).
Definition geometry.hpp:476
Rich key event with key code, modifiers, and repeat state.
Definition input_events.hpp:193
Rich mouse/pointer event with position, modifiers, button state, pointer ID, and stylus properties.
Definition input_events.hpp:104
Definition geometry.hpp:20
Definition geometry.hpp:28
Definition ui_components.hpp:358
std::string title
Definition ui_components.hpp:359
std::unique_ptr< View > content
Definition ui_components.hpp:360
Text input from IME or keyboard composition (separate from KeyEvent).
Definition input_events.hpp:210
ComboBox * active_popup
Definition view.hpp:1626