Gallery
gallery · Containers · interactive
One picture at a time, out of a set, with the rest along the bottom.
Import
cpp
#include "gbui/widgets/gallery.hpp"Example
cpp
GalleryResult gallery(Ui& ui, const Interaction& input, std::string_view id, const std::vector<GalleryItem>& items, GalleryState& state, const GalleryOptions& options = {});Draws the set and shows state.current. An empty set draws nothing at all, rather than an empty frame that looks like a picture failed to load.
API
GalleryOptions
| Option | Type | Default | What it does |
|---|---|---|---|
thumbnails | bool | true | The strip along the bottom, which is also how a reader jumps straight to one. Off leaves the arrows and the keyboard. |
thumbnailSize | float | 56.0f | How big one thumbnail is. Square, because a strip of mixed shapes is a strip whose targets move as the reader scrolls it. |
captions | bool | true | The line under the main picture. |
navigators | bool | true | The two arrows over the picture. |
loop | bool | false | Past the last picture is the first. |
fit | ImageFit | ImageFit::Contain | How the main picture meets a box that is not its shape. Contain, so nothing is cropped: a gallery is for looking at whole pictures. |
name | std::string_view | What the set is of — "Screenshots", "Site survey, March". | |
height | float | 320.0f | The main picture's box. The thumbnails and the caption are extra. |
width | float | kAuto | |
grow | float | 0.0f |