Aurore
A Switch-like interface for your app, on every screen
Loading...
Searching...
No Matches
scroll_view.hpp
Go to the documentation of this file.
1// ScrollView — the scrolling frame of every Cadran screen (<ScrollView> in
2// the XML, with aurore:ScrollingFrame's attributes).
3//
4// Aurore's default ("natural") scrolling moves a frame's worth of pixels per
5// D-pad press once the next line is partly off screen, so a short press barely
6// scrolls and the focus can sit on the frame itself, with no highlight; its
7// "centered" mode keeps the focused line mid-screen, which hides a section's
8// header and the notes under its last line. Here each press moves the focus to
9// the next line and scrolls just enough to show it with the text around it
10// (the header above, the notes below, the top or the end of the screen), and a
11// text taller than the screen is scrolled half a screen per press before the
12// focus moves on.
13// Copyright (C) 2026 JigSawFr. GPLv3-or-later (see LICENSE.GPL).
14#pragma once
15
16#include <aurore.hpp>
17
21{
22 public:
24
25 void draw(NVGcontext* vg, float x, float y, float width, float height,
26 aurore::Style style, aurore::FrameContext* ctx) override;
27 void willAppear(bool resetState) override;
28 void onChildFocusGained(aurore::View* directChild, aurore::View* focusedView) override;
31 void onFocusLost() override;
32
34
37 static void reveal_focused();
38
39 private:
41 struct Span
42 {
43 float top, bottom;
44 float height() const { return bottom - top; }
45 };
46
47 bool reveal_pending = false;
48 bool parked = false;
49
50 bool owns(aurore::View* view) const;
51 Span span_of(aurore::View* view) const;
52 Span context_of(aurore::View* view) const;
53 aurore::View* neighbour(aurore::FocusDirection direction) const;
54 float bottom_limit();
55 aurore::View* visible_line(bool first);
56 void reveal(aurore::View* view, bool animated);
57 bool step(aurore::FocusDirection direction);
58};
Definition scroll_view.hpp:21
static void reveal_focused()
void draw(NVGcontext *vg, float x, float y, float width, float height, aurore::Style style, aurore::FrameContext *ctx) override
void onChildFocusGained(aurore::View *directChild, aurore::View *focusedView) override
aurore::View * getNextFocus(aurore::FocusDirection direction, aurore::View *currentView) override
void willAppear(bool resetState) override
void onFocusLost() override
aurore::View * getDefaultFocus() override
static aurore::View * create()
Definition frame_context.hpp:30
Definition scrolling_frame.hpp:45
Simple wrapper around StyleValues for the array operator.
Definition style.hpp:115
Definition view.hpp:232
FocusDirection
Focus direction when navigating.
Definition view.hpp:96