imgui_impl_osx.h 2.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. // dear imgui: Platform Backend for OSX / Cocoa
  2. // This needs to be used along with a Renderer (e.g. OpenGL2, OpenGL3, Vulkan, Metal..)
  3. // - Not well tested. If you want a portable application, prefer using the GLFW or SDL platform Backends on Mac.
  4. // - Requires linking with the GameController framework ("-framework GameController").
  5. // Implemented features:
  6. // [X] Platform: Clipboard support is part of core Dear ImGui (no specific code in this backend).
  7. // [X] Platform: Mouse support. Can discriminate Mouse/Pen.
  8. // [X] Platform: Keyboard support. Since 1.87 we are using the io.AddKeyEvent() function. Pass ImGuiKey values to all key functions e.g. ImGui::IsKeyPressed(ImGuiKey_Space). [Legacy kVK_* values are obsolete since 1.87 and not supported since 1.91.5]
  9. // [X] Platform: Gamepad support.
  10. // [X] Platform: Mouse cursor shape and visibility (ImGuiBackendFlags_HasMouseCursors). Disable with 'io.ConfigFlags |= ImGuiConfigFlags_NoMouseCursorChange'.
  11. // [X] Platform: IME support.
  12. // You can use unmodified imgui_impl_* files in your project. See examples/ folder for examples of using this.
  13. // Prefer including the entire imgui/ repository into your project (either as a copy or as a submodule), and only build the backends you need.
  14. // Learn about Dear ImGui:
  15. // - FAQ https://dearimgui.com/faq
  16. // - Getting Started https://dearimgui.com/getting-started
  17. // - Documentation https://dearimgui.com/docs (same as your local docs/ folder).
  18. // - Introduction, links and more at the top of imgui.cpp
  19. #pragma once
  20. #include "imgui.h" // IMGUI_IMPL_API
  21. #ifndef IMGUI_DISABLE
  22. #ifdef __OBJC__
  23. @class NSEvent;
  24. @class NSView;
  25. // Follow "Getting Started" link and check examples/ folder to learn about using backends!
  26. IMGUI_IMPL_API bool ImGui_ImplOSX_Init(NSView* _Nonnull view);
  27. IMGUI_IMPL_API void ImGui_ImplOSX_Shutdown();
  28. IMGUI_IMPL_API void ImGui_ImplOSX_NewFrame(NSView* _Nullable view);
  29. #endif
  30. //-----------------------------------------------------------------------------
  31. // C++ API
  32. //-----------------------------------------------------------------------------
  33. #ifdef IMGUI_IMPL_METAL_CPP_EXTENSIONS
  34. // #include <AppKit/AppKit.hpp>
  35. #ifndef __OBJC__
  36. // Follow "Getting Started" link and check examples/ folder to learn about using backends!
  37. IMGUI_IMPL_API bool ImGui_ImplOSX_Init(void* _Nonnull view);
  38. IMGUI_IMPL_API void ImGui_ImplOSX_Shutdown();
  39. IMGUI_IMPL_API void ImGui_ImplOSX_NewFrame(void* _Nullable view);
  40. #endif
  41. #endif
  42. #endif // #ifndef IMGUI_DISABLE