Split apple clipboard helpers

This commit is contained in:
2026-06-13 19:36:30 +02:00
parent 3f4d3b38b0
commit 3d999225f3
3 changed files with 56 additions and 25 deletions

View File

@@ -52,6 +52,30 @@ std::vector<std::string> AppleDocumentPlatformServices::document_browse_roots(
return platform_document_browse_roots(family_, work_path, data_path);
}
std::string AppleDocumentPlatformServices::clipboard_text() const
{
#if defined(__IOS__)
return [App::I->ios_view clipboard_get_string];
#elif defined(__OSX__)
return [App::I->osx_view clipboard_get_string];
#else
return {};
#endif
}
bool AppleDocumentPlatformServices::set_clipboard_text(std::string_view text) const
{
const std::string value(text);
#if defined(__IOS__)
return [App::I->ios_view clipboard_set_string:value];
#elif defined(__OSX__)
return [App::I->osx_view clipboard_set_string:value];
#else
(void)value;
return false;
#endif
}
void AppleDocumentPlatformServices::pick_image(PickedPathCallback callback) const
{
if (family_ == PlatformFamily::ios)
@@ -130,31 +154,6 @@ std::string AppleDocumentPlatformServices::format_working_directory_path(std::st
return std::string(path);
}
std::string AppleDocumentPlatformServices::clipboard_text() const
{
const std::string empty;
#if defined(__IOS__)
return [App::I->ios_view clipboard_get_string];
#elif defined(__OSX__)
return [App::I->osx_view clipboard_get_string];
#else
return empty;
#endif
}
bool AppleDocumentPlatformServices::set_clipboard_text(std::string_view text) const
{
const std::string value(text);
#if defined(__IOS__)
return [App::I->ios_view clipboard_set_string:value];
#elif defined(__OSX__)
return [App::I->osx_view clipboard_set_string:value];
#else
(void)value;
return false;
#endif
}
void AppleDocumentPlatformServices::display_file(std::string_view path) const
{
const std::string value(path);