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
20
class
ScrollView
:
public
aurore::ScrollingFrame
21
{
22
public
:
23
ScrollView
();
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
;
29
aurore::View
*
getNextFocus
(
aurore::FocusDirection
direction,
aurore::View
* currentView)
override
;
30
aurore::View
*
getDefaultFocus
()
override
;
31
void
onFocusLost
()
override
;
32
33
static
aurore::View
*
create
();
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
};
aurore.hpp
ScrollView
Definition
scroll_view.hpp:21
ScrollView::reveal_focused
static void reveal_focused()
ScrollView::draw
void draw(NVGcontext *vg, float x, float y, float width, float height, aurore::Style style, aurore::FrameContext *ctx) override
ScrollView::onChildFocusGained
void onChildFocusGained(aurore::View *directChild, aurore::View *focusedView) override
ScrollView::getNextFocus
aurore::View * getNextFocus(aurore::FocusDirection direction, aurore::View *currentView) override
ScrollView::willAppear
void willAppear(bool resetState) override
ScrollView::onFocusLost
void onFocusLost() override
ScrollView::getDefaultFocus
aurore::View * getDefaultFocus() override
ScrollView::create
static aurore::View * create()
ScrollView::ScrollView
ScrollView()
aurore::FrameContext
Definition
frame_context.hpp:30
aurore::ScrollingFrame
Definition
scrolling_frame.hpp:45
aurore::Style
Simple wrapper around StyleValues for the array operator.
Definition
style.hpp:115
aurore::View
Definition
view.hpp:232
aurore::FocusDirection
FocusDirection
Focus direction when navigating.
Definition
view.hpp:96
aurore
cadran
view
scroll_view.hpp
Generated by
1.9.8