Add additional methods for has_theme_item to check for font and font size
This commit is contained in:
committed by
danielgsilva
parent
aa65940a85
commit
94a7dfeae1
@@ -513,6 +513,10 @@ bool Theme::has_font(const StringName &p_name, const StringName &p_theme_type) c
|
||||
return ((font_map.has(p_theme_type) && font_map[p_theme_type].has(p_name) && font_map[p_theme_type][p_name].is_valid()) || has_default_font());
|
||||
}
|
||||
|
||||
bool Theme::has_font_no_default(const StringName &p_name, const StringName &p_theme_type) const {
|
||||
return (font_map.has(p_theme_type) && font_map[p_theme_type].has(p_name) && font_map[p_theme_type][p_name].is_valid());
|
||||
}
|
||||
|
||||
bool Theme::has_font_nocheck(const StringName &p_name, const StringName &p_theme_type) const {
|
||||
return (font_map.has(p_theme_type) && font_map[p_theme_type].has(p_name));
|
||||
}
|
||||
@@ -616,6 +620,10 @@ bool Theme::has_font_size(const StringName &p_name, const StringName &p_theme_ty
|
||||
return ((font_size_map.has(p_theme_type) && font_size_map[p_theme_type].has(p_name) && (font_size_map[p_theme_type][p_name] > 0)) || has_default_font_size());
|
||||
}
|
||||
|
||||
bool Theme::has_font_size_no_default(const StringName &p_name, const StringName &p_theme_type) const {
|
||||
return (font_size_map.has(p_theme_type) && font_size_map[p_theme_type].has(p_name) && (font_size_map[p_theme_type][p_name] > 0));
|
||||
}
|
||||
|
||||
bool Theme::has_font_size_nocheck(const StringName &p_name, const StringName &p_theme_type) const {
|
||||
return (font_size_map.has(p_theme_type) && font_size_map[p_theme_type].has(p_name));
|
||||
}
|
||||
@@ -923,9 +931,17 @@ bool Theme::has_theme_item(DataType p_data_type, const StringName &p_name, const
|
||||
case DATA_TYPE_CONSTANT:
|
||||
return has_constant(p_name, p_theme_type);
|
||||
case DATA_TYPE_FONT:
|
||||
return has_font(p_name, p_theme_type);
|
||||
if (!variation_map.has(p_theme_type)) {
|
||||
return has_font(p_name, p_theme_type);
|
||||
} else {
|
||||
return has_font_no_default(p_name, p_theme_type);
|
||||
}
|
||||
case DATA_TYPE_FONT_SIZE:
|
||||
return has_font_size(p_name, p_theme_type);
|
||||
if (!variation_map.has(p_theme_type)) {
|
||||
return has_font_size(p_name, p_theme_type);
|
||||
} else {
|
||||
return has_font_size_no_default(p_name, p_theme_type);
|
||||
}
|
||||
case DATA_TYPE_ICON:
|
||||
return has_icon(p_name, p_theme_type);
|
||||
case DATA_TYPE_STYLEBOX:
|
||||
|
||||
Reference in New Issue
Block a user