Added tooltips to the support painting gizmo. Used multi-line text for the label "Highlight overhang by angle".

This commit is contained in:
Lukáš Hejl 2021-10-18 10:57:25 +02:00
parent b2fc50c9d9
commit 6f3baf9262
3 changed files with 71 additions and 22 deletions

View file

@ -280,10 +280,10 @@ void ImGuiWrapper::render()
m_new_frame_open = false;
}
ImVec2 ImGuiWrapper::calc_text_size(const wxString &text)
ImVec2 ImGuiWrapper::calc_text_size(const wxString &text, float wrap_width)
{
auto text_utf8 = into_u8(text);
ImVec2 size = ImGui::CalcTextSize(text_utf8.c_str());
ImVec2 size = ImGui::CalcTextSize(text_utf8.c_str(), NULL, false, wrap_width);
/*#ifdef __linux__
size.x *= m_style_scaling;
@ -293,6 +293,13 @@ ImVec2 ImGuiWrapper::calc_text_size(const wxString &text)
return size;
}
float ImGuiWrapper::get_slider_float_height() const
{
const ImGuiContext& g = *GImGui;
const ImGuiStyle& style = g.Style;
return g.FontSize + style.FramePadding.y * 2.0f + style.ItemSpacing.y;
}
void ImGuiWrapper::set_next_window_pos(float x, float y, int flag, float pivot_x, float pivot_y)
{
ImGui::SetNextWindowPos(ImVec2(x, y), (ImGuiCond)flag, ImVec2(pivot_x, pivot_y));
@ -425,6 +432,24 @@ void ImGuiWrapper::text_colored(const ImVec4& color, const wxString& label)
this->text_colored(color, label_utf8.c_str());
}
void ImGuiWrapper::text_wrapped(const char *label, float wrap_width)
{
ImGui::PushTextWrapPos(ImGui::GetCursorPos().x + wrap_width);
this->text(label);
ImGui::PopTextWrapPos();
}
void ImGuiWrapper::text_wrapped(const std::string &label, float wrap_width)
{
this->text_wrapped(label.c_str(), wrap_width);
}
void ImGuiWrapper::text_wrapped(const wxString &label, float wrap_width)
{
auto label_utf8 = into_u8(label);
this->text_wrapped(label_utf8.c_str(), wrap_width);
}
void ImGuiWrapper::tooltip(const char *label, float wrap_width)
{
ImGui::BeginTooltip();