Files
ARMSX2/common/CocoaTools.h
T

46 lines
1.6 KiB
C++
Raw Normal View History

// SPDX-FileCopyrightText: 2002-2026 PCSX2 Dev Team
2024-07-30 13:42:36 +02:00
// SPDX-License-Identifier: GPL-3.0+
2022-05-25 16:43:11 -05:00
#ifdef __APPLE__
2022-12-05 00:55:17 -06:00
#include <string>
#include <optional>
2022-05-25 16:43:11 -05:00
struct WindowInfo;
/// Helper functions for things that need Objective-C
namespace CocoaTools
{
bool CreateMetalLayer(WindowInfo* wi);
void DestroyMetalLayer(WindowInfo* wi);
2024-05-23 23:35:34 +10:00
std::optional<float> GetViewRefreshRate(const WindowInfo& wi);
/// Mark an NSMenu as the help menu
void MarkHelpMenu(void* menu);
/// Returns the bundle path.
std::optional<std::string> GetBundlePath();
2022-12-05 00:55:17 -06:00
/// Get the bundle path to the actual application without any translocation fun
std::optional<std::string> GetNonTranslocatedBundlePath();
/// Move the given file to the trash, and return the path to its new location
std::optional<std::string> MoveToTrash(std::string_view file);
/// Launch the given application once this one quits
bool DelayedLaunch(std::string_view file);
2023-09-09 02:15:41 -05:00
/// Open a Finder window to the given URL
bool ShowInFinder(std::string_view file);
/// Get the path to the resources directory of the current application
std::optional<std::string> GetResourcePath();
2023-02-25 00:22:10 -06:00
/// Create a window
void* CreateWindow(std::string_view title, uint32_t width, uint32_t height);
/// Destroy a window
void DestroyWindow(void* window);
/// Make a WindowInfo from the given window
void GetWindowInfoFromWindow(WindowInfo* wi, void* window);
/// Run cocoa event loop
void RunCocoaEventLoop(bool wait_forever = false);
/// Posts an event to the main telling `RunCocoaEventLoop(true)` to exit
void StopMainThreadEventLoop();
} // namespace CocoaTools
2022-05-25 16:43:11 -05:00
#endif // __APPLE__