34 #include "style_get_value.h"
41 typedef std::shared_ptr<Canvas>
CanvasPtr;
43 typedef std::shared_ptr<Font>
FontPtr;
46 #if defined(MICROSOFT_FINALLY_IMPLEMENTED_CONSTEXPR_TEN_YEARS_AFTER_EVERYONE_ELSE)
47 class PropertyNameConst
51 template<std::
size_t Length>
52 constexpr PropertyNameConst(
const char(&
text)[Length]) :
text(
text),
length(Length - 1) { }
54 constexpr
char operator[](std::size_t index)
const {
return index <
length ?
text[index] :
throw std::out_of_range(
"PropertyNameConst operator[] out of bounds"); }
55 constexpr std::size_t size()
const {
return length; }
56 constexpr std::size_t
hash()
const {
return hash(2166136261U, 0); }
59 constexpr std::size_t
hash(std::size_t value, std::size_t index)
const {
return index ==
length ? value :
hash((value ^ (std::size_t)
text[index]) * 16777619U, index + 1); }
61 const char *
const text;
109 int array_size(
const char *property_name)
const;
119 FontPtr
font()
const;
StyleCascade(std::vector< Style * > cascade, const StyleCascade *parent=nullptr)
Definition: style_cascade.h:71
Definition: view_geometry.h:38
StyleGetValue compute_frequency(const StyleGetValue &frequency) const
Convert frequency to Hz.
int array_size(const char *property_name) const
Value array size for the property.
StyleGetValue compute_time(const StyleGetValue &time) const
Convert time to seconds.
StyleGetValue compute_angle(const StyleGetValue &angle) const
Convert angle into radians.
std::vector< Style * > cascade
Property sets to be examined.
Definition: style_cascade.h:74
Style value resolver.
Definition: style_cascade.h:67
void render_border(const CanvasPtr &canvas, const ViewGeometry &geometry) const
Render styled border.
StyleGetValue compute_resolution(const StyleGetValue &resolution) const
Convert resolution to dots per px unit (pixel ratio scale)
void render_background(const CanvasPtr &canvas, const ViewGeometry &geometry) const
Render styled background.
FontPtr font() const
Font used by this style cascade.
StyleGetValue specified_value(const std::string &property_name) const
Definition: style_cascade.h:85
const StyleCascade * parent
Parent cascade used for inheritance.
Definition: style_cascade.h:77
StyleGetValue computed_value(const std::string &property_name) const
Definition: style_cascade.h:91
int array_size(const std::string &property_name) const
Definition: style_cascade.h:110
std::shared_ptr< Font > FontPtr
Definition: path.h:39
StyleGetValue specified_value(const char *property_name) const
Resolve any inheritance or initial values for the cascade value.
StyleGetValue cascade_value(const std::string &property_name) const
Definition: style_cascade.h:81
StyleGetValue cascade_value(const char *property_name) const
Find the first declared value in the cascade for the specified property.
StyleCascade()
Definition: style_cascade.h:70
StyleGetValue computed_value(const char *property_name) const
Style value returned by style classes.
Definition: style_get_value.h:39
StyleGetValue compute_length(const StyleGetValue &length) const
Convert length into px (device independent pixel) units.
std::shared_ptr< Canvas > CanvasPtr
Definition: canvas.h:126
Definition: Application/application.h:35