mirror of
https://github.com/cappuccino/cappuccino.git
synced 2026-11-09 16:38:45 +00:00
New: class method to BKThemeDescriptor that enables a view to inherit theme values of another view (#2916)
This commit is contained in:
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)
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in new issue
Block a user