New: class method to BKThemeDescriptor that enables a view to inherit theme values of another view (#2916)

This commit is contained in:
Didier Korthoudt authored and GitHub committed 2020-10-02 12:31:22 +02:00
1 parent e13cebaa3a
commit 601d6f7c6c
2 files changed
+25

No files matched your search

@@ -325,6 +325,15 @@ var ItemSizes = { },
[self registerThemeValues:themeValues forView:aView];
}
+ (void)registerThemeValues:(CPArray)themeValues forView:(CPView)aView inheritFrom:(CPView)anotherView
{
if (anotherView)
// We take all theme attributes values from anotherView
[aView _addThemeAttributeDictionary:[anotherView _themeAttributeDictionary]];
[self registerThemeValues:themeValues forView:aView];
}
@end
function BKLabelFromIdentifier(anIdentifier)
+16
View File
@@ -300,6 +300,22 @@ var NULL_THEME = {};
return dictionary;
}
- (void)_addThemeAttributeDictionary:(CPDictionary)themeAttributeDictionary
{
if (!themeAttributeDictionary)
return;
var keys = [themeAttributeDictionary allKeys];
for (var i = 0, count = [keys count], key, value; i < count; i++)
{
key = keys[i];
value = [themeAttributeDictionary objectForKey:key];
_themeAttributes[key] = value;
}
}
- (void)setValue:(id)aValue forThemeAttribute:(CPString)aName inState:(ThemeState)aState
{
#if DEBUG