|
@@ -1015,7 +1015,7 @@ CODE
|
|
|
#endif
|
|
|
|
|
|
// [Windows] OS specific includes (optional)
|
|
|
-#if defined(_WIN32) && defined(IMGUI_DISABLE_DEFAULT_FILE_FUNCTIONS) && defined(IMGUI_DISABLE_WIN32_DEFAULT_CLIPBOARD_FUNCTIONS) && defined(IMGUI_DISABLE_WIN32_DEFAULT_IME_FUNCTIONS) && !defined(IMGUI_DISABLE_WIN32_FUNCTIONS)
|
|
|
+#if defined(_WIN32) && defined(IMGUI_DISABLE_DEFAULT_FILE_FUNCTIONS) && defined(IMGUI_DISABLE_WIN32_DEFAULT_CLIPBOARD_FUNCTIONS) && defined(IMGUI_DISABLE_WIN32_DEFAULT_IME_FUNCTIONS) && defined(IMGUI_DISABLE_DEFAULT_SHELL_FUNCTIONS) && !defined(IMGUI_DISABLE_WIN32_FUNCTIONS)
|
|
|
#define IMGUI_DISABLE_WIN32_FUNCTIONS
|
|
|
#endif
|
|
|
#if defined(_WIN32) && !defined(IMGUI_DISABLE_WIN32_FUNCTIONS)
|
|
@@ -1034,6 +1034,7 @@ CODE
|
|
|
// The UWP and GDK Win32 API subsets don't support clipboard nor IME functions
|
|
|
#define IMGUI_DISABLE_WIN32_DEFAULT_CLIPBOARD_FUNCTIONS
|
|
|
#define IMGUI_DISABLE_WIN32_DEFAULT_IME_FUNCTIONS
|
|
|
+#define IMGUI_DISABLE_DEFAULT_SHELL_FUNCTIONS
|
|
|
#endif
|
|
|
#endif
|
|
|
|
|
@@ -1124,6 +1125,7 @@ static void WindowSettingsHandler_WriteAll(ImGuiContext*, ImGuiSetti
|
|
|
static const char* GetClipboardTextFn_DefaultImpl(void* user_data_ctx);
|
|
|
static void SetClipboardTextFn_DefaultImpl(void* user_data_ctx, const char* text);
|
|
|
static void SetPlatformImeDataFn_DefaultImpl(ImGuiViewport* viewport, ImGuiPlatformImeData* data);
|
|
|
+static void PlatformOpenInShellFn_DefaultImpl(ImGuiContext* ctx, const char* path);
|
|
|
|
|
|
namespace ImGui
|
|
|
{
|
|
@@ -1369,6 +1371,7 @@ ImGuiIO::ImGuiIO()
|
|
|
// Note: Initialize() will setup default clipboard/ime handlers.
|
|
|
BackendPlatformName = BackendRendererName = NULL;
|
|
|
BackendPlatformUserData = BackendRendererUserData = BackendLanguageUserData = NULL;
|
|
|
+ PlatformOpenInShellUserData = NULL;
|
|
|
PlatformLocaleDecimalPoint = '.';
|
|
|
|
|
|
// Input (NB: we already have memset zero the entire structure!)
|
|
@@ -3712,6 +3715,7 @@ void ImGui::Initialize()
|
|
|
g.IO.GetClipboardTextFn = GetClipboardTextFn_DefaultImpl; // Platform dependent default implementations
|
|
|
g.IO.SetClipboardTextFn = SetClipboardTextFn_DefaultImpl;
|
|
|
g.IO.ClipboardUserData = (void*)&g; // Default implementation use the ImGuiContext as user data (ideally those would be arguments to the function)
|
|
|
+ g.IO.PlatformOpenInShellFn = PlatformOpenInShellFn_DefaultImpl;
|
|
|
g.IO.SetPlatformImeDataFn = SetPlatformImeDataFn_DefaultImpl;
|
|
|
|
|
|
// Create default viewport
|
|
@@ -14200,6 +14204,10 @@ static void ImGui::UpdateViewportsNewFrame()
|
|
|
//-----------------------------------------------------------------------------
|
|
|
// [SECTION] PLATFORM DEPENDENT HELPERS
|
|
|
//-----------------------------------------------------------------------------
|
|
|
+// - Default clipboard handlers
|
|
|
+// - Default shell function handlers
|
|
|
+// - Default IME handlers
|
|
|
+//-----------------------------------------------------------------------------
|
|
|
|
|
|
#if defined(_WIN32) && !defined(IMGUI_DISABLE_WIN32_FUNCTIONS) && !defined(IMGUI_DISABLE_WIN32_DEFAULT_CLIPBOARD_FUNCTIONS)
|
|
|
|
|
@@ -14325,7 +14333,36 @@ static void SetClipboardTextFn_DefaultImpl(void* user_data_ctx, const char* text
|
|
|
g.ClipboardHandlerData[(int)(text_end - text)] = 0;
|
|
|
}
|
|
|
|
|
|
+#endif // Default clipboard handlers
|
|
|
+
|
|
|
+//-----------------------------------------------------------------------------
|
|
|
+
|
|
|
+#if defined(_WIN32) && !defined(IMGUI_DISABLE_WIN32_FUNCTIONS) && !defined(IMGUI_DISABLE_DEFAULT_SHELL_FUNCTIONS)
|
|
|
+#include <shellapi.h> // ShellExecuteA()
|
|
|
+#ifdef _MSC_VER
|
|
|
+#pragma comment(lib, "shell32")
|
|
|
#endif
|
|
|
+static void PlatformOpenInShellFn_DefaultImpl(ImGuiContext*, const char* path)
|
|
|
+{
|
|
|
+ ::ShellExecuteA(NULL, "open", path, NULL, NULL, SW_SHOWDEFAULT);
|
|
|
+}
|
|
|
+#elif !defined(IMGUI_DISABLE_DEFAULT_SHELL_FUNCTIONS))
|
|
|
+static void PlatformOpenInShellFn_DefaultImpl(ImGuiContext*, const char* path)
|
|
|
+{
|
|
|
+#if __APPLE__
|
|
|
+ const char* open_executable = "open";
|
|
|
+#else
|
|
|
+ const char* open_executable = "xdg-open";
|
|
|
+#endif
|
|
|
+ ImGuiTextBuffer buf;
|
|
|
+ buf.appendf("%s \"%s\"", open_executable, path);
|
|
|
+ system(buf.c_str());
|
|
|
+}
|
|
|
+#else
|
|
|
+static void PlatformOpenInShellFn_DefaultImpl(ImGuiContext*, const char*) {}
|
|
|
+#endif // Default shell handlers
|
|
|
+
|
|
|
+//-----------------------------------------------------------------------------
|
|
|
|
|
|
// Win32 API IME support (for Asian languages, etc.)
|
|
|
#if defined(_WIN32) && !defined(IMGUI_DISABLE_WIN32_FUNCTIONS) && !defined(IMGUI_DISABLE_WIN32_DEFAULT_IME_FUNCTIONS)
|
|
@@ -14363,7 +14400,7 @@ static void SetPlatformImeDataFn_DefaultImpl(ImGuiViewport* viewport, ImGuiPlatf
|
|
|
|
|
|
static void SetPlatformImeDataFn_DefaultImpl(ImGuiViewport*, ImGuiPlatformImeData*) {}
|
|
|
|
|
|
-#endif
|
|
|
+#endif // Default IME handlers
|
|
|
|
|
|
//-----------------------------------------------------------------------------
|
|
|
// [SECTION] METRICS/DEBUGGER WINDOW
|