12#include "imgui_stdlib.h"
16#pragma clang diagnostic push
17#pragma clang diagnostic ignored "-Wsign-conversion"
27static int InputTextCallback(ImGuiInputTextCallbackData* data)
30 if (data->EventFlag == ImGuiInputTextFlags_CallbackResize)
34 std::string* str = user_data->
Str;
35 IM_ASSERT(data->Buf == str->c_str());
36 str->resize(data->BufTextLen);
37 data->Buf = (
char*)str->c_str();
48bool ImGui::InputText(
const char* label, std::string* str, ImGuiInputTextFlags flags, ImGuiInputTextCallback callback,
void* user_data)
50 IM_ASSERT((flags & ImGuiInputTextFlags_CallbackResize) == 0);
51 flags |= ImGuiInputTextFlags_CallbackResize;
54 cb_user_data.
Str = str;
57 return InputText(label, (
char*)str->c_str(), str->capacity() + 1, flags, InputTextCallback, &cb_user_data);
60bool ImGui::InputTextMultiline(
const char* label, std::string* str,
const ImVec2& size, ImGuiInputTextFlags flags, ImGuiInputTextCallback callback,
void* user_data)
62 IM_ASSERT((flags & ImGuiInputTextFlags_CallbackResize) == 0);
63 flags |= ImGuiInputTextFlags_CallbackResize;
66 cb_user_data.
Str = str;
69 return InputTextMultiline(label, (
char*)str->c_str(), str->capacity() + 1, size, flags, InputTextCallback, &cb_user_data);
72bool ImGui::InputTextWithHint(
const char* label,
const char* hint, std::string* str, ImGuiInputTextFlags flags, ImGuiInputTextCallback callback,
void* user_data)
74 IM_ASSERT((flags & ImGuiInputTextFlags_CallbackResize) == 0);
75 flags |= ImGuiInputTextFlags_CallbackResize;
78 cb_user_data.
Str = str;
81 return InputTextWithHint(label, hint, (
char*)str->c_str(), str->capacity() + 1, flags, InputTextCallback, &cb_user_data);
85#pragma clang diagnostic pop
bool InputText(Setting &setting)
void * ChainCallbackUserData
ImGuiInputTextCallback ChainCallback