23 bool is_predefined()
const;
26 void set_value(
float val, css_units units);
28 css_units units()
const;
29 int calc_percent(
int width)
const;
30 void fromString(
const tstring& str,
const tstring& predefs = _t(
""),
int defValue = 0);
35 inline css_length::css_length()
39 m_units = css_units_none;
40 m_is_predefined =
false;
43 inline css_length::css_length(
const css_length& val)
45 if(val.is_predefined())
47 m_predef = val.m_predef;
50 m_value = val.m_value;
52 m_units = val.m_units;
53 m_is_predefined = val.m_is_predefined;
56 inline css_length& css_length::operator=(
const css_length& val)
58 if(val.is_predefined())
60 m_predef = val.m_predef;
63 m_value = val.m_value;
65 m_units = val.m_units;
66 m_is_predefined = val.m_is_predefined;
70 inline css_length& css_length::operator=(
float val)
73 m_units = css_units_px;
74 m_is_predefined =
false;
78 inline bool css_length::is_predefined()
const
80 return m_is_predefined;
83 inline void css_length::predef(
int val)
86 m_is_predefined =
true;
89 inline int css_length::predef()
const
98 inline void css_length::set_value(
float val, css_units units)
101 m_is_predefined =
false;
105 inline float css_length::val()
const
114 inline css_units css_length::units()
const
119 inline int css_length::calc_percent(
int width)
const
123 if(units() == css_units_percentage)
125 return (
int) ((double) width * (
double) m_value / 100.0);