Initial port of Brim ear gizmo

Cherry-picked from bambulab/BambuStudio@92c85a13d0

Co-authored-by: Mack <yongfang.bian@bambulab.com>
This commit is contained in:
Noisyfox 2025-02-16 18:22:08 +08:00
parent 830c1ac928
commit 185fb3cb26
28 changed files with 1595 additions and 65 deletions

View file

@ -416,7 +416,7 @@ void ImGuiWrapper::set_language(const std::string &language)
}
else if (lang == "en") {
ranges = ImGui::GetIO().Fonts->GetGlyphRangesEnglish(); // Basic Latin
}
}
else{
ranges = ImGui::GetIO().Fonts->GetGlyphRangesOthers();
}
@ -560,6 +560,15 @@ ImVec2 ImGuiWrapper::calc_text_size(const wxString &text,
return size;
}
float ImGuiWrapper::find_widest_text(std::vector<wxString> &text_list)
{
float width = .0f;
for(const wxString &text : text_list) {
width = std::max(width, this->calc_text_size(text).x);
}
return width;
}
ImVec2 ImGuiWrapper::calc_button_size(const wxString &text, const ImVec2 &button_size) const
{
const ImVec2 text_size = this->calc_text_size(text);
@ -1598,9 +1607,9 @@ bool begin_menu(const char *label, bool enabled)
return menu_is_open;
}
void end_menu()
{
ImGui::EndMenu();
void end_menu()
{
ImGui::EndMenu();
}
bool menu_item_with_icon(const char *label, const char *shortcut, ImVec2 icon_size /* = ImVec2(0, 0)*/, ImU32 icon_color /* = 0*/, bool selected /* = false*/, bool enabled /* = true*/, bool* hovered/* = nullptr*/)