Aurore
A Switch-like interface for your app, on every screen
Loading...
Searching...
No Matches
cadran_icon.hpp
Go to the documentation of this file.
1// CadranIcon — Cadran's icons, drawn as nanovg paths from
2// the design boards' 24-unit SVG strokes (no SVG loader in Aurore):
3// today, timer, activity, shield, lock, globe, settings, tools, info, plus,
4// stop, eye, check, moon, pause, list, lines, download, chevron-down, chevron-left,
5// chevron-right, caret-up, caret-down, and "mark", the app's logo
6// (ui::hooks' mark, else Aurore's); for the other screens, in the same strokes: key,
7// unlock, phone, trash, server, pin, refresh, history, restore, save, upload,
8// language, contrast, home, bolt, sparkle, bell, chip, code, heart, folder,
9// file, flag, gamepad, calendar, alert, pencil, pencil-off, tag, user, sun, tv,
10// text-normal, text-large, text-largest; for the palettes (theme files' `icon`): snowflake,
11// lantern, blossom, wave, leaf, pumpkin, tree, firework, gem, dune, palette.
12// A theme replaces "mark" with its `logo`, and any other icon with its
13// `icon.<name>` picture, drawn as is or as a mask in the icon's colour
14// (docs/themes.md, "Logos and images").
15// Copyright (C) 2026 JigSawFr. GPLv3-or-later (see LICENSE.GPL).
16#pragma once
17
18#include <memory>
19#include <string>
20#include <vector>
21#include <aurore.hpp>
23
27{
28 public:
30
31 void setIcon(const std::string& name);
32 void setColor(NVGcolor color);
34 bool getStyleProperty(const std::string& name, aurore::StyleValue* value) override;
35 bool setStyleProperty(const std::string& name, const aurore::StyleValue& value) override;
39 void pop();
40
41 void draw(NVGcontext* vg, float x, float y, float width, float height,
42 aurore::Style style, aurore::FrameContext* ctx) override;
43
45
51 static bool glyph(NVGcontext* vg, const std::string& name, NVGcolor color, float width, float height);
52
54 static const std::vector<std::string>& names();
55
56 private:
57 std::string icon = "today";
58 NVGcolor color;
59 aurore::Time pop_since = 0;
60};
61
73{
74 public:
75 struct Colors
76 {
77 NVGcolor background;
78 NVGcolor ring;
79 NVGcolor ink;
80 std::string motif;
81 std::string picture;
82 };
83
84 explicit CadranSwatch(Colors colors);
85
86 void draw(NVGcontext* vg, float x, float y, float width, float height,
87 aurore::Style style, aurore::FrameContext* ctx) override;
88
89 private:
90 Colors colors;
91 std::shared_ptr<aurore::ThemeImage> preview;
92};
Definition cadran_icon.hpp:27
void pop()
void setIcon(const std::string &name)
bool getStyleProperty(const std::string &name, aurore::StyleValue *value) override
"color" (setThemeColor, XML color="@theme/…")
void setColor(NVGcolor color)
static bool glyph(NVGcontext *vg, const std::string &name, NVGcolor color, float width, float height)
static const std::vector< std::string > & names()
Every icon's name but "mark" (what a theme's icon.<name> may replace).
void draw(NVGcontext *vg, float x, float y, float width, float height, aurore::Style style, aurore::FrameContext *ctx) override
static aurore::View * create()
bool setStyleProperty(const std::string &name, const aurore::StyleValue &value) override
Definition cadran_icon.hpp:73
CadranSwatch(Colors colors)
void draw(NVGcontext *vg, float x, float y, float width, float height, aurore::Style style, aurore::FrameContext *ctx) override
Definition frame_context.hpp:30
Simple wrapper around StyleValues for the array operator.
Definition style.hpp:115
Definition view.hpp:232
retro_time_t Time
Definition time.hpp:31
Definition cadran_icon.hpp:76
NVGcolor ink
Definition cadran_icon.hpp:79
std::string motif
Definition cadran_icon.hpp:80
NVGcolor ring
Definition cadran_icon.hpp:78
std::string picture
"": the colours
Definition cadran_icon.hpp:81
NVGcolor background
Definition cadran_icon.hpp:77
Definition view_style.hpp:41