pthom / imgui_bundle

Dear ImGui Bundle: an extensive set of Ready-to-use widgets and libraries, based on ImGui. Start your first app in 5 lines of code, or less. Whether you prefer Python or C++, this pack has your back!
https://pthom.github.io/imgui_bundle/
MIT License
592 stars 63 forks source link

imgui internal InputText #163

Closed dcnieho closed 5 months ago

dcnieho commented 6 months ago

Is it correct that some of the functions in this block, https://github.com/ocornut/imgui/blob/master/imgui_internal.h#L3350, are not wrapped? Specifically, i am looking to use TempInputIsActive and TempInputText as for a custom widget i want to replicate the functionality of e.g. DragScalar where when activated it changes to an input text.

I see that wrapping these is disabled here: https://github.com/pthom/imgui_bundle/blob/14faa5660067aa5ff474ebbec8f9ae735126ddc9/external/imgui/bindings/litgen_options_imgui.py#L308 Could you enable those or is there a problem with the signature taking a plain char*? If not, i guess InputTextEx could also be enabled (but note the callback, like in issue #160.

Thanks and all the best!

dcnieho commented 6 months ago

ok, my attempt wouldn't work anyway, i have instead devised another approach that doesn't need these functions. Still, I guess others may need them, so would still be good to make them available unless there is a reason not to.

pthom commented 6 months ago

The reason they are not wrapped is indeed the signature:

InputTextEx and TempInputText

bool InputTextEx(const char* label, const char* hint, char* buf, int buf_size, const ImVec2& size_arg, ImGuiInputTextFlags flags, ImGuiInputTextCallback callback = NULL, void* user_data = NULL);
bool          TempInputText(const ImRect& bb, ImGuiID id, const char* label, char* buf, int buf_size, ImGuiInputTextFlags flags);

imgui_stdlib.h does not provide a wrapper based on std::string, so that it needs to be implemented manually

TempInputScalar

TempInputScalar(const ImRect& bb, ImGuiID id, const char* label, ImGuiDataType data_type, void* p_data, const char* format, const void* p_clamp_min = NULL, const void* p_clamp_max = NULL);

With so many opaque values, this one cannot be wrapped.

dcnieho commented 6 months ago

If this is not actionable, just close it :)

pthom commented 5 months ago

Hi

I added InputTextEx & TempInputText

see: https://github.com/pthom/imgui_bundle/commit/f68abf6d404d0a1a1ca546729268428eeb8e5488