1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
//! GTK rasteriser for [`crate::ScrollView`].
//!
//! [`crate::ScrollView`] owns scroll-offset and visible-range state but
//! never touches a [`crate::Backend`] — painting is the host's job (see
//! that type's module doc). On GTK that job composes two pieces that are
//! already generic across every pixel backend, so this module adds no new
//! `Backend` trait method:
//!
//! - **scrollbar chrome** — [`crate::Backend::draw_scrollbar`] paints
//! whatever [`crate::Scrollbar`] [`ScrollView::scrollbar`] computes;
//! [`draw_scrollbar_for`] skips the call entirely when the content fits
//! (no scrollbar to draw).
//! - **content clipping** — [`crate::Backend::paint_surface`]'s
//! `surface_push_clip`/`surface_pop_clip` narrow child painting to the
//! viewport so content laid out past its edges doesn't bleed outside it;
//! [`paint_clipped`] wires the push/pop pairing so callers can't
//! mismatch them.
//!
//! Wheel scrolling and scrollbar-drag *event handling* stay out of this
//! module: [`ScrollView::handle_wheel`] and
//! [`crate::primitives::scrollbar::ThumbDrag`] are already backend-agnostic
//! — a host calls them directly from its [`crate::AppLogic::handle`], the
//! same way `examples/common/scroll_view_demo.rs` does.
use crate::;
/// Paint `view`'s scrollable child content clipped to its viewport.
///
/// Pushes a clip region matching `view.viewport` before running
/// `paint_content`, and pops it afterward. On a backend with no
/// [`crate::PaintSurface`] (TUI has no sub-cell clip concept — see that
/// trait's module doc), `paint_content` still runs, just unclipped, since
/// there is nothing to push.
Sized>