diff options
author | FireForge <67974470+fire-forge@users.noreply.github.com> | 2022-04-24 11:55:51 -0500 |
---|---|---|
committer | FireForge <67974470+fire-forge@users.noreply.github.com> | 2022-05-25 19:18:23 -0500 |
commit | a65404e6ac088e9f4584e99320d0cff467f597e9 (patch) | |
tree | f283ff84c1a5b398a751c6194fecc95409c8ad90 /editor/editor_help.cpp | |
parent | 20a1b8558970fb93404b2b37cb8625950f5b70df (diff) |
Add type icon to documentation page header
Diffstat (limited to 'editor/editor_help.cpp')
-rw-r--r-- | editor/editor_help.cpp | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/editor/editor_help.cpp b/editor/editor_help.cpp index dba0864fcb..57dd0cd249 100644 --- a/editor/editor_help.cpp +++ b/editor/editor_help.cpp @@ -512,11 +512,22 @@ void EditorHelp::_update_doc() { DocData::ClassDoc cd = doc->class_list[edited_class]; // Make a copy, so we can sort without worrying. + Ref<Texture2D> icon; + if (has_theme_icon(edited_class, SNAME("EditorIcons"))) { + icon = get_theme_icon(edited_class, SNAME("EditorIcons")); + } else if (ClassDB::class_exists(edited_class) && ClassDB::is_parent_class(edited_class, "Object")) { + icon = get_theme_icon(SNAME("Object"), SNAME("EditorIcons")); + } else { + icon = get_theme_icon(SNAME("ArrowRight"), SNAME("EditorIcons")); + } + // Class name section_line.push_back(Pair<String, int>(TTR("Top"), 0)); class_desc->push_font(doc_title_font); class_desc->push_color(title_color); class_desc->add_text(TTR("Class:") + " "); + class_desc->add_image(icon, icon->get_width(), icon->get_height()); + class_desc->add_text(" "); class_desc->push_color(headline_color); _add_text(edited_class); class_desc->pop(); |