ZenitUI
Retained-mode C++20 UI framework
Loading...
Searching...
No Matches
Theme.hpp File Reference

Global stylesheet storage and rule matching. More...

#include "Common.hpp"
#include "Style.hpp"
#include "AnimPrimitives.hpp"
#include "Media.hpp"

Go to the source code of this file.

Classes

struct  ZenitUI::Specificity
 CSS-style specificity triple used to sort matching rules. More...
struct  ZenitUI::ThemeRule
 A single selector-plus-declarations entry in the stylesheet. More...
class  ZenitUI::Theme
 Per-context stylesheet: rules, keyframes, and root style. More...
struct  ZenitUI::Theme::SymbolKey
 Key for rulesByLastSymbol: the last selector component. More...
struct  ZenitUI::Theme::SymbolKeyHash
 Hash for SymbolKey. More...

Functions

Specificity ZenitUI::computeNegatedItemSpecificity (const SimpleSelector::NegatedItem &item)
Specificity ZenitUI::computeSpecificity (const std::vector< SimpleSelector > &chain)
 Compute the specificity of a full selector chain.

Detailed Description

Global stylesheet storage and rule matching.

A Theme holds:

  • the parsed rule list, indexed by tag / last symbol for fast lookup;
  • the :root style used as fallback for inherited properties;
  • the @keyframes registry, keyed by animation name;
  • a monotonically increasing version used to invalidate caches.

StyleParser populates a Theme via addRule / addKeyframes. The StyleResolver and AnimationPlayer read the active context's UIContext::theme to compute per-node styles and evaluate @keyframes.