mirror of
https://github.com/brunoherbelin/vimix.git
synced 2025-12-11 18:34:58 +01:00
MultiLine text display
This commit is contained in:
@@ -1721,3 +1721,15 @@ bool ImGuiToolkit::InputTextMultiline(const char* label, std::string* str, const
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void ImGuiToolkit::ShowTextMultiline(const char* label, const std::string &str, float width)
|
||||||
|
{
|
||||||
|
size_t numlines = std::count(str.begin(), str.end(), '\n') + 1;
|
||||||
|
|
||||||
|
ImGuiContext& g = *GImGui;
|
||||||
|
ImVec2 size(width, numlines * (g.FontSize + g.Style.ItemSpacing.y) + g.Style.FramePadding.y * 2.0f);
|
||||||
|
|
||||||
|
ImGui::PushStyleColor(ImGuiCol_FrameBg, g.Style.Colors[ImGuiCol_FrameBgHovered]);
|
||||||
|
ImGui::InputTextMultiline(label, (char*)str.c_str(), str.capacity() + 1, size, ImGuiInputTextFlags_ReadOnly);
|
||||||
|
ImGui::PopStyleColor();
|
||||||
|
|
||||||
|
}
|
||||||
|
|||||||
@@ -69,6 +69,7 @@ namespace ImGuiToolkit
|
|||||||
// text input
|
// text input
|
||||||
bool InputText(const char* label, std::string* str);
|
bool InputText(const char* label, std::string* str);
|
||||||
bool InputTextMultiline(const char* label, std::string* str, const ImVec2& size = ImVec2(0, 0), int linesize = 0);
|
bool InputTextMultiline(const char* label, std::string* str, const ImVec2& size = ImVec2(0, 0), int linesize = 0);
|
||||||
|
void ShowTextMultiline(const char* label, const std::string &str, float width);
|
||||||
|
|
||||||
// accent color of UI
|
// accent color of UI
|
||||||
typedef enum {
|
typedef enum {
|
||||||
|
|||||||
Reference in New Issue
Block a user