From a5c895f7914cd3b1ce67051ad300b0cb959480ce Mon Sep 17 00:00:00 2001 From: ocornut Date: Mon, 12 Oct 2015 12:20:01 +0200 Subject: [PATCH] Added SetClipboardText / GetClipboardText helper shortcuts to match MemAlloc / MemFree --- imgui.cpp | 11 +++++++++++ imgui.h | 4 +++- 2 files changed, 14 insertions(+), 1 deletion(-) diff --git a/imgui.cpp b/imgui.cpp index 5db642f0..0e7add76 100644 --- a/imgui.cpp +++ b/imgui.cpp @@ -1761,6 +1761,17 @@ void ImGui::MemFree(void* ptr) return GImGui->IO.MemFreeFn(ptr); } +const char* ImGui::GetClipboardText() +{ + return GImGui->IO.GetClipboardTextFn ? GImGui->IO.GetClipboardTextFn() : ""; +} + +void ImGui::SetClipboardText(const char* text) +{ + if (GImGui->IO.SetClipboardTextFn) + GImGui->IO.SetClipboardTextFn(text); +} + const char* ImGui::GetVersion() { return IMGUI_VERSION; diff --git a/imgui.h b/imgui.h index 8434f27c..29ad4756 100644 --- a/imgui.h +++ b/imgui.h @@ -416,9 +416,11 @@ namespace ImGui IMGUI_API void CaptureKeyboardFromApp(); // manually enforce imgui setting the io.WantCaptureKeyboard flag next frame (your application needs to handle it). e.g. capture keyboard when your widget is being hovered. IMGUI_API void CaptureMouseFromApp(); // manually enforce imgui setting the io.WantCaptureMouse flag next frame (your application needs to handle it). - // Helpers functions to access the MemAllocFn/MemFreeFn pointers in ImGui::GetIO() + // Helpers functions to access functions pointers in ImGui::GetIO() IMGUI_API void* MemAlloc(size_t sz); IMGUI_API void MemFree(void* ptr); + IMGUI_API const char* GetClipboardText(); + IMGUI_API void SetClipboardText(const char* text); // Internal state/context access - if you want to use multiple ImGui context, or share context between modules (e.g. DLL), or allocate the memory yourself IMGUI_API const char* GetVersion();