mirror of https://github.com/buggins/dlangui.git
fix theme change handling - close buggins/dlangide#132
This commit is contained in:
parent
8d5c118922
commit
c9896d9cb4
|
@ -213,6 +213,7 @@ class ImageWidget : Widget {
|
||||||
|
|
||||||
/// handle theme change: e.g. reload some themed resources
|
/// handle theme change: e.g. reload some themed resources
|
||||||
override void onThemeChanged() {
|
override void onThemeChanged() {
|
||||||
|
super.onThemeChanged();
|
||||||
if (_drawableId !is null)
|
if (_drawableId !is null)
|
||||||
_drawable.clear(); // remove cached drawable
|
_drawable.clear(); // remove cached drawable
|
||||||
}
|
}
|
||||||
|
|
|
@ -886,6 +886,16 @@ class ListWidget : WidgetGroup, OnScrollHandler, OnAdapterChangeHandler {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// handle theme change: e.g. reload some themed resources
|
||||||
|
override void onThemeChanged() {
|
||||||
|
super.onThemeChanged();
|
||||||
|
_scrollbar.onThemeChanged();
|
||||||
|
for (int i = 0; i < itemCount; i++) {
|
||||||
|
Widget w = itemWidget(i);
|
||||||
|
w.onThemeChanged();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/// Measure widget according to desired width and height constraints. (Step 1 of two phase layout).
|
/// Measure widget according to desired width and height constraints. (Step 1 of two phase layout).
|
||||||
override void measure(int parentWidth, int parentHeight) {
|
override void measure(int parentWidth, int parentHeight) {
|
||||||
if (visibility == Visibility.Gone) {
|
if (visibility == Visibility.Gone) {
|
||||||
|
|
|
@ -255,13 +255,15 @@ public:
|
||||||
|
|
||||||
/// handle theme change: e.g. reload some themed resources
|
/// handle theme change: e.g. reload some themed resources
|
||||||
void onThemeChanged() {
|
void onThemeChanged() {
|
||||||
_cachedStyle = currentTheme.get(_styleId);
|
|
||||||
// default implementation: call recursive for children
|
// default implementation: call recursive for children
|
||||||
for (int i = 0; i < childCount; i++)
|
for (int i = 0; i < childCount; i++)
|
||||||
child(i).onThemeChanged();
|
child(i).onThemeChanged();
|
||||||
if (_ownStyle) {
|
if (_ownStyle) {
|
||||||
_ownStyle.onThemeChanged();
|
_ownStyle.onThemeChanged();
|
||||||
}
|
}
|
||||||
|
if (_cachedStyle) {
|
||||||
|
_cachedStyle = currentTheme.get(_styleId);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// returns widget id, null if not set
|
/// returns widget id, null if not set
|
||||||
|
|
Loading…
Reference in New Issue