Add ThemeDB, expose previously static Theme methods
This commit is contained in:
parent
c8ef12a03a
commit
6320a0fc18
25 changed files with 589 additions and 311 deletions
|
|
@ -35,6 +35,7 @@
|
|||
#include "default_theme_icons.gen.h"
|
||||
#include "scene/resources/font.h"
|
||||
#include "scene/resources/theme.h"
|
||||
#include "scene/theme/theme_db.h"
|
||||
#include "servers/text_server.h"
|
||||
|
||||
#include "modules/modules_enabled.gen.h" // For svg.
|
||||
|
|
@ -1101,18 +1102,11 @@ void make_default_theme(float p_scale, Ref<Font> p_font, TextServer::SubpixelPos
|
|||
|
||||
fill_default_theme(t, default_font, bold_font, bold_italics_font, italics_font, default_icon, default_style, default_scale);
|
||||
|
||||
Theme::set_default(t);
|
||||
Theme::set_fallback_base_scale(default_scale);
|
||||
Theme::set_fallback_icon(default_icon);
|
||||
Theme::set_fallback_style(default_style);
|
||||
Theme::set_fallback_font(default_font);
|
||||
Theme::set_fallback_font_size(default_font_size * default_scale);
|
||||
}
|
||||
ThemeDB::get_singleton()->set_default_theme(t);
|
||||
|
||||
void clear_default_theme() {
|
||||
Theme::set_project_default(nullptr);
|
||||
Theme::set_default(nullptr);
|
||||
Theme::set_fallback_icon(nullptr);
|
||||
Theme::set_fallback_style(nullptr);
|
||||
Theme::set_fallback_font(nullptr);
|
||||
ThemeDB::get_singleton()->set_fallback_base_scale(default_scale);
|
||||
ThemeDB::get_singleton()->set_fallback_icon(default_icon);
|
||||
ThemeDB::get_singleton()->set_fallback_stylebox(default_style);
|
||||
ThemeDB::get_singleton()->set_fallback_font(default_font);
|
||||
ThemeDB::get_singleton()->set_fallback_font_size(default_font_size * default_scale);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -37,6 +37,5 @@ const int default_font_size = 16;
|
|||
|
||||
void fill_default_theme(Ref<Theme> &theme, const Ref<Font> &default_font, const Ref<Font> &bold_font, const Ref<Font> &bold_italics_font, const Ref<Font> &italics_font, Ref<Texture2D> &default_icon, Ref<StyleBox> &default_style, float p_scale);
|
||||
void make_default_theme(float p_scale, Ref<Font> p_font, TextServer::SubpixelPositioning p_font_subpixel = TextServer::SUBPIXEL_POSITIONING_AUTO, TextServer::Hinting p_font_hinting = TextServer::HINTING_LIGHT, TextServer::FontAntialiasing p_font_antialiased = TextServer::FONT_ANTIALIASING_GRAY, bool p_font_msdf = false, bool p_font_generate_mipmaps = false);
|
||||
void clear_default_theme();
|
||||
|
||||
#endif // DEFAULT_THEME_H
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue