HikoGUI
A low latency retained GUI
Loading...
Searching...
No Matches
theme_book.hpp
1// Copyright Take Vos 2020.
2// Distributed under the Boost Software License, Version 1.0.
3// (See accompanying file LICENSE_1_0.txt or copy at https://www.boost.org/LICENSE_1_0.txt)
4
5#pragma once
6
7#include "theme_mode.hpp"
8#include "theme.hpp"
9#include <limits>
10#include <vector>
11#include <new>
12
13
14namespace tt {
15
21public:
23 theme_book(theme_book const &) = delete;
24 theme_book(theme_book &&) = delete;
25 theme_book &operator=(theme_book const &) = delete;
26 theme_book &operator=(theme_book &&) = delete;
27
28 theme_book(std::vector<URL> const &theme_directories) noexcept;
29
30 [[nodiscard]] std::vector<std::string> theme_names() const noexcept;
31
32 [[nodiscard]] tt::theme_mode current_theme_mode() const noexcept;
33
34 void set_current_theme_mode(tt::theme_mode theme_mode) noexcept;
35
36 [[nodiscard]] std::string current_theme_name() const noexcept;
37
38 void set_current_theme_name(std::string const &themeName) noexcept;
39
40 static theme_book &global() noexcept
41 {
42 return *start_subsystem_or_terminate(_global, nullptr, subsystem_init, subsystem_deinit);
43 }
44
45private:
46 static inline std::atomic<theme_book *>_global = nullptr;
47
49 std::string _current_theme_name;
50 tt::theme_mode _current_theme_mode;
51
52 static inline char const *_default_theme_name = "TTauri";
53
54 [[nodiscard]] static theme_book *subsystem_init() noexcept;
55 static void subsystem_deinit() noexcept;
56
59 void update_theme() noexcept;
60};
61
62}
theme_book keeps track of multiple themes.
Definition theme_book.hpp:20