5#include "qml_material/token/duration.hpp"
6#include "qml_material/export.hpp"
12namespace CarouselLayoutId
14constexpr int Uncontained = 0;
15constexpr int MultiBrowse = 1;
16constexpr int Hero = 2;
17constexpr int HeroCenter = 3;
18constexpr int FullScreen = 4;
19constexpr int UncontainedMultiAspect = 5;
23struct CarouselEngineDefaults {
24 static constexpr qreal min_peek_px = 16;
25 static constexpr qreal parallax_ratio = 0.35;
26 static constexpr qreal parallax_ratio_uncontained = 0.5;
27 static constexpr int snap_duration = int(token::Duration {}.medium4);
28 static constexpr qreal min_item_aspect = 9.0 / 16.0;
29 static constexpr qreal max_item_aspect = 16.0 / 9.0;
32struct CarouselItemGeometry {
38 qreal parallax_shift = 0;
42struct CarouselLayoutInput {
44 Qt::Orientation orientation = Qt::Horizontal;
45 qreal viewport_size = 0;
47 qreal scroll_offset = 0;
48 qreal item_extent = 180;
50 qreal small_item_min = 40;
51 qreal small_item_max = 56;
52 qreal content_padding_start = 0;
53 qreal content_padding_end = 0;
54 qreal content_padding_cross = 0;
55 qreal min_peek_px = 16;
56 qreal item_corner_radius = 28;
57 qreal parallax_ratio = 0.35;
58 qreal min_item_aspect = 9.0 / 16.0;
59 qreal max_item_aspect = 16.0 / 9.0;
61 bool reduce_motion =
false;
62 QVector<qreal> item_aspects;
65struct CarouselLayoutOutput {
66 QVector<CarouselItemGeometry> items;
68 QVector<qreal> snap_offsets;
69 qreal content_size = 0;
70 qreal max_scroll_offset = 0;
71 qreal end_snap_offset = 0;
72 qreal scroll_step = 0;
73 int leading_index = 0;
76class QML_MATERIAL_API CarouselStrategy {
78 static auto compute(
const CarouselLayoutInput& input) -> CarouselLayoutOutput;