166 hilet lock = std::scoped_lock(_map_mutex);
172 return _sub_model_by_state[to_underlying(state)];
175 [[nodiscard]]
theme_sub_model const& operator[](theme_state state)
const noexcept
177 return _sub_model_by_state[to_underlying(state)];
180 [[nodiscard]]
theme_sub_model const& get_model(theme_delegate
auto const *delegate)
const noexcept
184 hilet selector = delegate->sub_theme_selector();
185 return (*
this)[selector.state];
192 hilet selector = delegate->sub_theme_selector();
193 hi_axiom(selector.scale < 0,
"scale must be negative so that negative points are converted to positive pixels");
195 return {(*this)[selector.state], selector.scale};
206 hilet[model, scale] = get_model_and_scale(delegate);
207 auto r = model.text_theme;
210 for (
auto &style: r) {
225 return get_model(delegate).background_color;
228 [[nodiscard]]
color fill_color(theme_delegate
auto const *delegate)
const noexcept
230 return get_model(delegate).fill_color;
233 [[nodiscard]] color caret_primary_color(theme_delegate
auto const *delegate)
const noexcept
235 return get_model(delegate).caret_primary_color;
238 [[nodiscard]] color caret_secondary_color(theme_delegate
auto const *delegate)
const noexcept
240 return get_model(delegate).caret_secondary_color;
243 [[nodiscard]] color caret_overwrite_color(theme_delegate
auto const *delegate)
const noexcept
245 return get_model(delegate).caret_overwrite_color;
248 [[nodiscard]] color caret_compose_color(theme_delegate
auto const *delegate)
const noexcept
250 return get_model(delegate).caret_compose_color;
253 [[nodiscard]] color selection_color(theme_delegate
auto const *delegate)
const noexcept
255 return get_model(delegate).selection_color;
258 [[nodiscard]] color border_color(theme_delegate
auto const *delegate)
const noexcept
260 return get_model(delegate).border_color;
263 [[nodiscard]]
int border_bottom_left_radius(theme_delegate
auto const *delegate)
const noexcept
265 hilet[model, scale] = get_model_and_scale(delegate);
266 return model.border_bottom_left_radius(scale);
269 [[nodiscard]]
int border_bottom_right_radius(theme_delegate
auto const *delegate)
const noexcept
271 hilet[model, scale] = get_model_and_scale(delegate);
272 return model.border_bottom_right_radius(scale);
275 [[nodiscard]]
int border_top_left_radius(theme_delegate
auto const *delegate)
const noexcept
277 hilet[model, scale] = get_model_and_scale(delegate);
278 return model.border_top_left_radius(scale);
281 [[nodiscard]]
int border_top_right_radius(theme_delegate
auto const *delegate)
const noexcept
283 hilet[model, scale] = get_model_and_scale(delegate);
284 return model.border_top_right_radius(scale);
287 [[nodiscard]] corner_radiii border_radius(theme_delegate
auto const *delegate)
const noexcept
290 border_bottom_left_radius(delegate),
291 border_bottom_right_radius(delegate),
292 border_top_left_radius(delegate),
293 border_top_right_radius(delegate)};
296 [[nodiscard]]
int border_width(theme_delegate
auto const *delegate)
const noexcept
298 hilet[model, scale] = get_model_and_scale(delegate);
299 return model.border_width(scale);
302 [[nodiscard]]
int width(theme_delegate
auto const *delegate)
const noexcept
304 hilet[model, scale] = get_model_and_scale(delegate);
305 return model.width(scale);
308 [[nodiscard]]
int height(theme_delegate
auto const *delegate)
const noexcept
310 hilet[model, scale] = get_model_and_scale(delegate);
311 return model.height(scale);
314 [[nodiscard]]
extent2i size(theme_delegate
auto const *delegate)
const noexcept
316 return {width(delegate), height(delegate)};
319 [[nodiscard]]
int margin_bottom(theme_delegate
auto const *delegate)
const noexcept
321 hilet[model, scale] = get_model_and_scale(delegate);
322 return model.margin_bottom(scale);
325 [[nodiscard]]
int margin_left(theme_delegate
auto const *delegate)
const noexcept
327 hilet[model, scale] = get_model_and_scale(delegate);
328 return model.margin_left(scale);
331 [[nodiscard]]
int margin_top(theme_delegate
auto const *delegate)
const noexcept
333 hilet[model, scale] = get_model_and_scale(delegate);
334 return model.margin_top(scale);
337 [[nodiscard]]
int margin_right(theme_delegate
auto const *delegate)
const noexcept
339 hilet[model, scale] = get_model_and_scale(delegate);
340 return model.margin_right(scale);
343 [[nodiscard]] marginsi margin(theme_delegate
auto const *delegate)
const noexcept
345 return {margin_left(delegate), margin_bottom(delegate), margin_right(delegate), margin_top(delegate)};
348 [[nodiscard]]
int spacing_vertical(theme_delegate
auto const *delegate)
const noexcept
350 hilet[model, scale] = get_model_and_scale(delegate);
351 return model.spacing_vertical(scale);
354 [[nodiscard]]
int spacing_horizontal(theme_delegate
auto const *delegate)
const noexcept
356 hilet[model, scale] = get_model_and_scale(delegate);
357 return model.spacing_horizontal(scale);
360 [[nodiscard]]
int font_x_height(theme_delegate
auto const *delegate)
const noexcept
362 hilet[model, scale] = get_model_and_scale(delegate);
363 return model.font_x_height(scale);
366 [[nodiscard]]
int font_cap_height(theme_delegate
auto const *delegate)
const noexcept
368 hilet[model, scale] = get_model_and_scale(delegate);
369 return model.font_cap_height(scale);
372 [[nodiscard]]
int font_line_height(theme_delegate
auto const *delegate)
const noexcept
374 hilet[model, scale] = get_model_and_scale(delegate);
375 return model.font_line_height(scale);
380 hilet lock = std::scoped_lock(_map_mutex);
384 for (
auto& [key, value] : _map) {
391 [[nodiscard]]
static theme_model_base& model_by_key(
std::string const& key)
noexcept
393 hilet lock = std::scoped_lock(_map_mutex);
394 auto it = _map.find(key);
397 auto *ptr = it->second;
407 inline static unfair_mutex _map_mutex;