trying to fix theme font changes apply

This commit is contained in:
Vadim Lopatin 2017-08-25 17:11:57 +03:00
parent e2dc679dac
commit 9244f8aaed
1 changed files with 14 additions and 5 deletions

View File

@ -342,6 +342,7 @@ protected:
public: public:
void onThemeChanged() { void onThemeChanged() {
_font.clear();
_backgroundDrawable.clear(); _backgroundDrawable.clear();
foreach(s; _substates) foreach(s; _substates)
s.onThemeChanged(); s.onThemeChanged();
@ -458,6 +459,9 @@ public:
return this; return this;
} }
void clearCachedObjects() {
onThemeChanged();
}
//=================================================== //===================================================
// font properties // font properties
@ -701,32 +705,37 @@ public:
} }
@property Style fontFace(string face) { @property Style fontFace(string face) {
if (_fontFace != face)
clearCachedObjects();
_fontFace = face; _fontFace = face;
_font.clear();
return this; return this;
} }
@property Style fontFamily(FontFamily family) { @property Style fontFamily(FontFamily family) {
if (_fontFamily != family)
clearCachedObjects();
_fontFamily = family; _fontFamily = family;
_font.clear();
return this; return this;
} }
@property Style fontStyle(ubyte style) { @property Style fontStyle(ubyte style) {
if (_fontStyle != style)
clearCachedObjects();
_fontStyle = style; _fontStyle = style;
_font.clear();
return this; return this;
} }
@property Style fontWeight(ushort weight) { @property Style fontWeight(ushort weight) {
if (_fontWeight != weight)
clearCachedObjects();
_fontWeight = weight; _fontWeight = weight;
_font.clear();
return this; return this;
} }
@property Style fontSize(int size) { @property Style fontSize(int size) {
if (_fontSize != size)
clearCachedObjects();
_fontSize = size; _fontSize = size;
_font.clear();
return this; return this;
} }