MCPcopy Create free account
hub / github.com/Aegel5/SimpleSwitcher / InputTextCallback

Function InputTextCallback

imgui_tiny_app/imgui/misc/cpp/imgui_stdlib.cpp:39–58  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

37};
38
39static int InputTextCallback(ImGuiInputTextCallbackData* data)
40{
41 InputTextCallback_UserData* user_data = (InputTextCallback_UserData*)data->UserData;
42 if (data->EventFlag == ImGuiInputTextFlags_CallbackResize)
43 {
44 // Resize string callback
45 // If for some reason we refuse the new length (BufTextLen) and/or capacity (BufSize) we need to set them back to what we want.
46 std::string* str = user_data->Str;
47 IM_ASSERT(data->Buf == str->c_str());
48 str->resize(data->BufTextLen);
49 data->Buf = (char*)str->c_str();
50 }
51 else if (user_data->ChainCallback)
52 {
53 // Forward to user callback, if any
54 data->UserData = user_data->ChainCallbackUserData;
55 return user_data->ChainCallback(data);
56 }
57 return 0;
58}
59
60bool ImGui::InputText(const char* label, std::string* str, ImGuiInputTextFlags flags, ImGuiInputTextCallback callback, void* user_data)
61{

Callers

nothing calls this directly

Calls 2

c_strMethod · 0.80
resizeMethod · 0.45

Tested by

no test coverage detected