imgui_impl_osx.h 2.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  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. // [x] Platform: Multi-viewport / platform windows.
  13. // Missing features or Issues:
  14. // [ ] Multi-viewport: Window size not correctly reported when enabling io.ConfigViewportsNoDecoration
  15. // [ ] Multi-viewport: ParentViewportID not honored, and so io.ConfigViewportsNoDefaultParent has no effect (minor).
  16. // You can use unmodified imgui_impl_* files in your project. See examples/ folder for examples of using this.
  17. // Prefer including the entire imgui/ repository into your project (either as a copy or as a submodule), and only build the backends you need.
  18. // Learn about Dear ImGui:
  19. // - FAQ https://dearimgui.com/faq
  20. // - Getting Started https://dearimgui.com/getting-started
  21. // - Documentation https://dearimgui.com/docs (same as your local docs/ folder).
  22. // - Introduction, links and more at the top of imgui.cpp
  23. #pragma once
  24. #include "imgui.h" // IMGUI_IMPL_API
  25. #ifndef IMGUI_DISABLE
  26. #ifdef __OBJC__
  27. @class NSEvent;
  28. @class NSView;
  29. // Follow "Getting Started" link and check examples/ folder to learn about using backends!
  30. IMGUI_IMPL_API bool ImGui_ImplOSX_Init(NSView* _Nonnull view);
  31. IMGUI_IMPL_API void ImGui_ImplOSX_Shutdown();
  32. IMGUI_IMPL_API void ImGui_ImplOSX_NewFrame(NSView* _Nullable view);
  33. #endif
  34. //-----------------------------------------------------------------------------
  35. // C++ API
  36. //-----------------------------------------------------------------------------
  37. #ifdef IMGUI_IMPL_METAL_CPP_EXTENSIONS
  38. // #include <AppKit/AppKit.hpp>
  39. #ifndef __OBJC__
  40. // Follow "Getting Started" link and check examples/ folder to learn about using backends!
  41. IMGUI_IMPL_API bool ImGui_ImplOSX_Init(void* _Nonnull view);
  42. IMGUI_IMPL_API void ImGui_ImplOSX_Shutdown();
  43. IMGUI_IMPL_API void ImGui_ImplOSX_NewFrame(void* _Nullable view);
  44. #endif
  45. #endif
  46. #endif // #ifndef IMGUI_DISABLE