Portals0.7.0 · dev (544a5c68c72e · 2026-11-28 UTC)
Loading...
Searching...
No Matches
combo_box.hpp
1// Copyright (c) 2026 ttldtor.
2// SPDX-License-Identifier: BSL-1.0
3#pragma once
4
5#include <portals/controls.hpp>
6#include <portals/search.hpp>
7
8namespace portals {
9class LineEdit;
10class Dialog;
11
12namespace detail {
13struct ChoiceRecord;
14struct ChoiceValue;
15struct ChoiceAccess;
16} // namespace detail
17
19class ChoiceSelection {
20public:
21 ChoiceSelection() = default;
23 explicit operator bool() const noexcept;
25 RowId rowId() const noexcept;
27 std::uint64_t index() const noexcept;
29 std::string_view text() const noexcept;
31 std::uint64_t sourceRevision() const noexcept;
32
33private:
34 friend struct detail::ChoiceAccess;
35 std::shared_ptr<const detail::ChoiceValue> value_;
36};
37
39class ComboBox : public Row {
40public:
47 ~ComboBox() override;
54
55private:
56 friend struct detail::ChoiceAccess;
57 std::shared_ptr<detail::ChoiceRecord> record_;
58};
59
61class DropDown : public ComboBox {
62public:
65};
66} // namespace portals
Owning accepted row identity and bounded label, independent of editor draft and source lifetime.
Definition combo_box.hpp:19
std::uint64_t sourceRevision() const noexcept
std::uint64_t index() const noexcept
std::string_view text() const noexcept
RowId rowId() const noexcept
ChoiceSelection selection() const
ComboBox(LinearOptions layout={}, SizePolicy policy=DEFAULT_FLEX_WIDTH_POLICY)
Create an empty retained choice container; declarative recipes attach its editor and source.
Node< Dialog > popup() const
Node< LineEdit > editor() const
~ComboBox() override
Cancel main-control work; scene retirement releases any surviving popup.
Full-host structural root containing at most one visible opaque panel. This is deliberately not a Siz...
Definition dialog.hpp:102
Read-only main display with complete model-backed popup browsing.
Definition combo_box.hpp:61
ComboBox(LinearOptions layout={}, SizePolicy policy=DEFAULT_FLEX_WIDTH_POLICY)
Create an empty retained choice container; declarative recipes attach its editor and source.
UI-owned Unicode draft; mutate only through its scoped binding between frames. Cursor/anchor are UTF-...
Definition line_edit.hpp:205
Copyable typed observer; never owns or exposes an unchecked widget pointer.
Definition widget.hpp:92
Row(LinearOptions options={}, SizePolicy policy={})
Own settings and policies.
Public Portals API.
Definition action.hpp:8
constexpr SizePolicy DEFAULT_FLEX_WIDTH_POLICY
Fill available width from a zero flex basis while retaining content height.
Definition layout.hpp:47
Owning linear container options.
Definition layout.hpp:193
Provider-assigned row identity, independent of position; increment generation on reuse.
Definition row_id.hpp:9
Owning independent policies for width and height.
Definition layout.hpp:35