// Contrary to STB_TEXTEDIT_INSERTCHARS() this is working in the UTF8 buffer, hence the midly similar code (until we remove the U16 buffer alltogether!)
IM_ASSERT(!((flags&ImGuiInputTextFlags_CallbackHistory)&&(flags&ImGuiInputTextFlags_Multiline)));// Can't use both together (they both use up/down keys)
IM_ASSERT(!((flags&ImGuiInputTextFlags_CallbackHistory)&&(flags&ImGuiInputTextFlags_Multiline)));// Can't use both together (they both use up/down keys)
IM_ASSERT(!((flags&ImGuiInputTextFlags_CallbackCompletion)&&(flags&ImGuiInputTextFlags_AllowTabInput)));// Can't use both together (they both use tab key)
IM_ASSERT(!((flags&ImGuiInputTextFlags_CallbackCompletion)&&(flags&ImGuiInputTextFlags_AllowTabInput)));// Can't use both together (they both use tab key)
// The callback function should return 0 by default.
// The callback function should return 0 by default.
// Special processing:
// Special processing:
// - ImGuiInputTextFlags_CallbackCharFilter: return 1 if the character is not allowed. You may also set 'EventChar=0' as any character replacement are allowed.
// - ImGuiInputTextFlags_CallbackCharFilter: return 1 if the character is not allowed. You may also set 'EventChar=0' as any character replacement are allowed.
// - ImGuiInputTextFlags_CallbackResize: BufTextLen is set to the new desired string length so you can allocate or update the size on your side of the fence. No need to initialize new characters or zero-terminator as InputText will do it.
// - ImGuiInputTextFlags_CallbackResize: notified by InputText() when the string is resized. BufTextLen is set to the new desired string length so you can update the string size on your side of the fence. You can also replace Buf pointer if your underlying data is reallocated. No need to initialize new characters or zero-terminator as InputText will do it right after the resize callback.
structImGuiInputTextCallbackData
structImGuiInputTextCallbackData
{
{
ImGuiInputTextFlagsEventFlag;// One ImGuiInputTextFlags_Callback* // Read-only
ImGuiInputTextFlagsEventFlag;// One ImGuiInputTextFlags_Callback* // Read-only
void*UserData;// What user passed to InputText() // Read-only
void*UserData;// What user passed to InputText() // Read-only
// Arguments for the different callback events
// Arguments for the different callback events
// (If you modify the 'buf' contents make sure you update 'BufTextLen' and set 'BufDirty' to true!)
// - To modify the text buffer in a callback, prefer using the InsertChars() / DeleteChars() function. InsertChars() will take care of calling the resize callback if necessary.
// - If you know your edits are not going to resize the underlying buffer allocation, you may modify the contents of 'Buf[]' directly. You need to update 'BufTextLen' accordingly (0 <= BufTextLen < BufSize) and set 'BufDirty'' to true so InputText can update its internal state.
ImWcharEventChar;// Character input // Read-write // [CharFilter] Replace character or set to zero. return 1 is equivalent to setting EventChar=0;
ImWcharEventChar;// Character input // Read-write // [CharFilter] Replace character or set to zero. return 1 is equivalent to setting EventChar=0;
char*Buf;// Text buffer // Read-write // [Resize] Can replace pointer / [Completion,History,Always] Only write to pointed data, don't replace the actual pointer!
char*Buf;// Text buffer // Read-write // [Resize] Can replace pointer / [Completion,History,Always] Only write to pointed data, don't replace the actual pointer!