MCPcopy Create free account
hub / github.com/bluescan/tacentview / InputTextCallback

Function InputTextCallback

Contrib/imgui/misc/cpp/imgui_stdlib.cpp:17–36  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

15};
16
17static int InputTextCallback(ImGuiInputTextCallbackData* data)
18{
19 InputTextCallback_UserData* user_data = (InputTextCallback_UserData*)data->UserData;
20 if (data->EventFlag == ImGuiInputTextFlags_CallbackResize)
21 {
22 // Resize string callback
23 // If for some reason we refuse the new length (BufTextLen) and/or capacity (BufSize) we need to set them back to what we want.
24 std::string* str = user_data->Str;
25 IM_ASSERT(data->Buf == str->c_str());
26 str->resize(data->BufTextLen);
27 data->Buf = (char*)str->c_str();
28 }
29 else if (user_data->ChainCallback)
30 {
31 // Forward to user callback, if any
32 data->UserData = user_data->ChainCallbackUserData;
33 return user_data->ChainCallback(data);
34 }
35 return 0;
36}
37
38bool ImGui::InputText(const char* label, std::string* str, ImGuiInputTextFlags flags, ImGuiInputTextCallback callback, void* user_data)
39{

Callers

nothing calls this directly

Calls 1

c_strMethod · 0.80

Tested by

no test coverage detected