mirror of
https://github.com/SoftFever/OrcaSlicer.git
synced 2025-07-11 08:47:52 -06:00
ImGUI wrapper text and combo methods shall accept std::string
in UTF8 format.
This commit is contained in:
parent
dceaf73ff3
commit
bc65827499
2 changed files with 32 additions and 2 deletions
|
@ -239,10 +239,19 @@ bool ImGuiWrapper::checkbox(const wxString &label, bool &value)
|
|||
return ImGui::Checkbox(label_utf8.c_str(), &value);
|
||||
}
|
||||
|
||||
void ImGuiWrapper::text(const char *label)
|
||||
{
|
||||
ImGui::Text(label, NULL);
|
||||
}
|
||||
|
||||
void ImGuiWrapper::text(const std::string &label)
|
||||
{
|
||||
this->text(label.c_str());
|
||||
}
|
||||
|
||||
void ImGuiWrapper::text(const wxString &label)
|
||||
{
|
||||
auto label_utf8 = into_u8(label);
|
||||
ImGui::Text(label_utf8.c_str(), NULL);
|
||||
this->text(into_u8(label).c_str());
|
||||
}
|
||||
|
||||
|
||||
|
@ -267,6 +276,24 @@ bool ImGuiWrapper::combo(const wxString& label, const std::vector<wxString>& opt
|
|||
return false;
|
||||
}
|
||||
|
||||
bool ImGuiWrapper::combo(const wxString& label, const std::vector<std::string>& options, std::string& selection)
|
||||
{
|
||||
// this is to force the label to the left of the widget:
|
||||
text(label);
|
||||
ImGui::SameLine();
|
||||
|
||||
if (ImGui::BeginCombo("", selection.c_str())) {
|
||||
for (const std::string& option : options) {
|
||||
bool is_selected = (selection.empty()) ? false : (option == selection);
|
||||
if (ImGui::Selectable(option.c_str(), is_selected))
|
||||
selection = option;
|
||||
}
|
||||
ImGui::EndCombo();
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
void ImGuiWrapper::disabled_begin(bool disabled)
|
||||
{
|
||||
wxCHECK_RET(!m_disabled, "ImGUI: Unbalanced disabled_begin() call");
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue