5#include <Common/assertion.h>
6#include <Utility/TSpan.h>
7#include <Math/TVector2.h>
8#include <Math/TVector4.h>
20 ImTextureID textureID,
21 const math::Vector2F& sizePx,
22 const math::Vector4F& tintColorRGBA = math::Vector4F(1, 1, 1, 1),
23 const math::Vector4F& borderColorRGBA = math::Vector4F(0, 0, 0, 0));
27 ImTextureID textureID,
28 const math::Vector2F& sizePx,
29 const math::Vector4F& backgroundColorRGBA = math::Vector4F(0, 0, 0, 0),
30 const math::Vector4F& tintColorRGBA = math::Vector4F(1, 1, 1, 1));
35void copy_to(TSpan<char> dstBuffer, std::string_view srcStr);
46 void fixedCopy(TSpanView<char> inputContent);
54 ImGuiInputTextFlags flags = 0);
58 TSpanView<char> inputContent,
59 ImGuiInputTextFlags flags = 0);
70 TSpanView<char>
getData()
const;
89 std::vector<char> m_cache;
94 PH_ASSERT(!m_cache.empty());
95 m_cache.front() =
'\0';
110 return m_cache.data();
115 return m_cache.data();
120 return !m_cache.empty() && m_cache.front() !=
'\0';
std::string text
Definition ImguiEditorLog.cpp:23
Definition imgui_helpers.h:38
void clear()
Make the cache empty.
Definition imgui_helpers.h:92
bool inputText(const char *idName, ImGuiInputTextFlags flags=0)
Definition imgui_helpers.cpp:103
void resizableCopy(TSpanView< char > inputContent)
Fully copy inputContent into cache. Resize the cache if needed.
Definition imgui_helpers.cpp:92
void fixedCopy(TSpanView< char > inputContent)
Copy inputContent into cache without changing the cache's size. The resulting content may get truncat...
Definition imgui_helpers.cpp:87
TSpan< char > getData()
Get cached data. The resulting span is over the full cache and multiple null terminators may present.
Definition imgui_helpers.h:98
StringCache()
Definition imgui_helpers.cpp:79
char * getContent()
Get the string in cache. The result should always be null terminated.
Definition imgui_helpers.h:108
bool isEmpty() const
Definition imgui_helpers.h:118
Definition imgui_helpers.cpp:7
void text_unformatted(std::string_view text)
Definition imgui_helpers.cpp:9
bool image_button_with_fallback(const char *strId, ImTextureID textureID, const math::Vector2F &sizePx, const math::Vector4F &backgroundColorRGBA, const math::Vector4F &tintColorRGBA)
Definition imgui_helpers.cpp:36
void copy_to(TSpan< char > dstBuffer, std::string_view srcStr)
Copy string to a buffer. The result is always null-terminated.
Definition imgui_helpers.cpp:60
void image_with_fallback(ImTextureID textureID, const math::Vector2F &sizePx, const math::Vector4F &tintColorRGBA, const math::Vector4F &borderColorRGBA)
Definition imgui_helpers.cpp:14