master
ブランチ master
ShaderPlayground / deps / imgui / imgui / misc / cpp / imgui_stdlib.h
1.6 KB、37行 生 Blame 履歴
1// dear imgui: wrappers for C++ standard library (STL) types (std::string, etc.)
2
3// This is also an example of how you may wrap your own similar types.
4// TL;DR; this is using the ImGuiInputTextFlags_CallbackResize facility,
5// which also demonstrated in 'Dear ImGui Demo->Widgets->Text Input->Resize Callback'.
6
7// Changelog:
8// - v0.10: Initial version. Added InputText() / InputTextMultiline() calls with std::string
9
10// Usage:
11// {
12// #include "misc/cpp/imgui_stdlib.h"
13// #include "misc/cpp/imgui_stdlib.cpp" // <-- If you want to include implementation without messing with your project/build.
14// [...]
15// std::string my_string;
16// ImGui::InputText("my string", &my_string);
17// }
18
19// See more C++ related extension (fmt, RAII, syntaxis sugar) on Wiki:
20// https://github.com/ocornut/imgui/wiki/Useful-Extensions#cness
21
22#pragma once
23
24#ifndef IMGUI_DISABLE
25
26#include <string>
27
28namespace ImGui
29{
30 // ImGui::InputText() with std::string
31 // Because text input needs dynamic resizing, we need to setup a callback to grow the capacity
32 IMGUI_API bool InputText(const char* label, std::string* str, ImGuiInputTextFlags flags = 0, ImGuiInputTextCallback callback = nullptr, void* user_data = nullptr);
33 IMGUI_API bool InputTextMultiline(const char* label, std::string* str, const ImVec2& size = ImVec2(0, 0), ImGuiInputTextFlags flags = 0, ImGuiInputTextCallback callback = nullptr, void* user_data = nullptr);
34 IMGUI_API bool InputTextWithHint(const char* label, const char* hint, std::string* str, ImGuiInputTextFlags flags = 0, ImGuiInputTextCallback callback = nullptr, void* user_data = nullptr);
35}
36
37#endif // #ifndef IMGUI_DISABLE