Portals0.7.0 · dev (544a5c68c72e · 2026-11-28 UTC)
Loading...
Searching...
No Matches
status_bar.hpp
1// Copyright (c) 2026 ttldtor.
2// SPDX-License-Identifier: BSL-1.0
3#pragma once
4
5#include <portals/controls.hpp>
6
7namespace portals {
8
10inline constexpr SizePolicy DEFAULT_STATUS_BAR_POLICY{.width = {.preferred = 0, .mode = SizeMode::FLEX},
11 .height = {.preferred = 1, .mode = SizeMode::FIXED}};
12
18class StatusBar : public Row {
19public:
24 explicit StatusBar(LinearOptions options = {}, ControlStyle style = {},
25 SizePolicy policy = DEFAULT_STATUS_BAR_POLICY);
26
30 std::expected<void, TreeError> arrange(CellRect local) override;
34 std::expected<void, TreeError> paint(PaintContext &context) override;
36 ComputedStyle styleDefaults() const override;
37
38private:
39 friend std::expected<void, TreeError> syncStatusBar(WidgetTree &, Node<StatusBar>);
40 ControlStyle style_;
41 CellRect bounds_;
42 bool enabled_{true};
43};
44
50std::expected<void, TreeError> syncStatusBar(WidgetTree &tree, Node<StatusBar> node);
51
52} // namespace portals
An owning, invariant-preserving half-open cell rectangle.
Definition geometry.hpp:81
LinearOptions options() const
Owning copy; no invalidation.
Copyable typed observer; never owns or exposes an unchecked widget pointer.
Definition widget.hpp:92
Borrowed synchronous command sink supplied by the frame owner. submit must consume commands immediate...
Definition widget_types.hpp:66
Row(LinearOptions options={}, SizePolicy policy={})
Own settings and policies.
friend std::expected< void, TreeError > syncStatusBar(WidgetTree &, Node< StatusBar >)
Synchronize the bar's own disabled appearance between frames on UI.
std::expected< void, TreeError > arrange(CellRect local) override
ComputedStyle styleDefaults() const override
StatusBar(LinearOptions options={}, ControlStyle style={}, SizePolicy policy=DEFAULT_STATUS_BAR_POLICY)
std::expected< void, TreeError > paint(PaintContext &context) override
Exclusive parent/child ownership on Scheduler's UI thread. Scheduler must outlive this object....
Definition widget.hpp:179
Public Portals API.
Definition action.hpp:8
std::expected< void, TreeError > syncStatusBar(WidgetTree &tree, Node< StatusBar > node)
Synchronize the bar's own disabled appearance between frames on UI.
@ FIXED
Keep the bounded preferred/intrinsic extent even when it overflows the available space.
Definition layout.hpp:14
@ FLEX
Share spare main-axis cells by weight; allow shrinking towards minimum.
Definition layout.hpp:15
constexpr SizePolicy DEFAULT_STATUS_BAR_POLICY
Fill offered width and request one fixed row; explicit sizing remains authoritative.
Definition status_bar.hpp:10
Owning resolved presentation; no actions or model state are encoded.
Definition style_types.hpp:169
Owning paint values; no theme engine or behavior is encoded here.
Definition controls.hpp:24
Owning linear container options.
Definition layout.hpp:193
Owning independent policies for width and height.
Definition layout.hpp:35