From 9244f8aaed370e7c0ad306a079e6857dafcef0bf Mon Sep 17 00:00:00 2001 From: Vadim Lopatin Date: Fri, 25 Aug 2017 17:11:57 +0300 Subject: [PATCH] trying to fix theme font changes apply --- src/dlangui/widgets/styles.d | 19 ++++++++++++++----- 1 file changed, 14 insertions(+), 5 deletions(-) diff --git a/src/dlangui/widgets/styles.d b/src/dlangui/widgets/styles.d index 359bbd1f..6091e4cf 100644 --- a/src/dlangui/widgets/styles.d +++ b/src/dlangui/widgets/styles.d @@ -342,6 +342,7 @@ protected: public: void onThemeChanged() { + _font.clear(); _backgroundDrawable.clear(); foreach(s; _substates) s.onThemeChanged(); @@ -458,6 +459,9 @@ public: return this; } + void clearCachedObjects() { + onThemeChanged(); + } //=================================================== // font properties @@ -701,32 +705,37 @@ public: } @property Style fontFace(string face) { + if (_fontFace != face) + clearCachedObjects(); _fontFace = face; - _font.clear(); return this; } @property Style fontFamily(FontFamily family) { + if (_fontFamily != family) + clearCachedObjects(); _fontFamily = family; - _font.clear(); return this; } @property Style fontStyle(ubyte style) { + if (_fontStyle != style) + clearCachedObjects(); _fontStyle = style; - _font.clear(); return this; } @property Style fontWeight(ushort weight) { + if (_fontWeight != weight) + clearCachedObjects(); _fontWeight = weight; - _font.clear(); return this; } @property Style fontSize(int size) { + if (_fontSize != size) + clearCachedObjects(); _fontSize = size; - _font.clear(); return this; }