Skip to content

Commit 2954719

Browse files
committed
Add clipboard methods
1 parent cd0d0f7 commit 2954719

File tree

2 files changed

+12
-3
lines changed

2 files changed

+12
-3
lines changed

imgui-binding/src/main/java/imgui/ImGui.java

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4521,6 +4521,16 @@ public static ImDrawList GetForegroundDrawList() {
45214521
ImGui::CaptureMouseFromApp(want_capture_mouse_value);
45224522
*/
45234523

4524+
// Clipboard Utilities (also see the LogToClipboard() function to capture or output text data to the clipboard)
4525+
4526+
public static native String GetClipboardText(); /*
4527+
return env->NewStringUTF(ImGui::GetClipboardText());
4528+
*/
4529+
4530+
public static native void SetClipboardText(String text); /*
4531+
ImGui::SetClipboardText(text);
4532+
*/
4533+
45244534
// Settings/.Ini Utilities
45254535
// - The disk functions are automatically called if io.IniFilename != NULL (default is "imgui.ini").
45264536
// - Set io.IniFilename to NULL to load/save manually. Read io.WantSaveIniSettings description about handling .ini saving manually.

imgui-lwjgl3/src/test/java/ImGuiGlfwExample.java

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -317,9 +317,8 @@ private void showUi() {
317317
ImGui.SetMouseCursor(ImGuiMouseCursor.TextInput);
318318
}
319319
ImGui.SameLine();
320-
ImGui.Text("(?)");
321-
if (ImGui.IsItemHovered()) {
322-
ImGui.SetTooltip("You can copy and paste this link to browser");
320+
if (ImGui.Button("Copy")) {
321+
ImGui.SetClipboardText(imguiDemoLink.get());
323322
}
324323
}
325324

0 commit comments

Comments
 (0)