diff options
author | crupest <crupest@outlook.com> | 2021-09-18 16:13:40 +0800 |
---|---|---|
committer | crupest <crupest@outlook.com> | 2021-09-18 16:13:40 +0800 |
commit | 9a42f6fd709feaa9e9e3cc4530c67e2a237d5bee (patch) | |
tree | b063fadfa6197947b975195f967898ee9b926f2d | |
parent | e5b3502b03bdbdbecbd2e8b328e0f874499b452b (diff) | |
download | cru-9a42f6fd709feaa9e9e3cc4530c67e2a237d5bee.tar.gz cru-9a42f6fd709feaa9e9e3cc4530c67e2a237d5bee.tar.bz2 cru-9a42f6fd709feaa9e9e3cc4530c67e2a237d5bee.zip |
...
-rw-r--r-- | include/cru/osx/gui/Resource.hpp | 24 | ||||
-rw-r--r-- | include/cru/osx/gui/UiApplication.hpp | 0 | ||||
-rw-r--r-- | include/cru/osx/gui/Window.hpp | 18 | ||||
-rw-r--r-- | src/osx/CMakeLists.txt | 1 | ||||
-rw-r--r-- | src/osx/graphics/quartz/CMakeLists.txt | 7 | ||||
-rw-r--r-- | src/osx/gui/CMakeLists.txt | 15 | ||||
-rw-r--r-- | src/osx/gui/Resource.cpp | 6 | ||||
-rw-r--r-- | src/osx/gui/UiApplication.cpp | 0 | ||||
-rw-r--r-- | src/osx/gui/Window.cpp | 0 |
9 files changed, 69 insertions, 2 deletions
diff --git a/include/cru/osx/gui/Resource.hpp b/include/cru/osx/gui/Resource.hpp new file mode 100644 index 00000000..3e44bb9b --- /dev/null +++ b/include/cru/osx/gui/Resource.hpp @@ -0,0 +1,24 @@ +#pragma once +#include "../Resource.hpp" + +#include "cru/platform/gui/Base.hpp" + +namespace cru::platform::gui::osx { +class OsxGuiResource : public platform::osx::OsxResource { + public: + explicit OsxGuiResource(IUiApplication* ui_application); + + CRU_DELETE_COPY(OsxGuiResource) + CRU_DELETE_MOVE(OsxGuiResource) + + ~OsxGuiResource() override = default; + + public: + String GetPlatformId() const override { return u"OSX GUI"; } + + IUiApplication* GetUiApplication() const { return ui_application_; } + + private: + IUiApplication* ui_application_; +}; +} // namespace cru::platform::gui::osx diff --git a/include/cru/osx/gui/UiApplication.hpp b/include/cru/osx/gui/UiApplication.hpp new file mode 100644 index 00000000..e69de29b --- /dev/null +++ b/include/cru/osx/gui/UiApplication.hpp diff --git a/include/cru/osx/gui/Window.hpp b/include/cru/osx/gui/Window.hpp new file mode 100644 index 00000000..14ad05ad --- /dev/null +++ b/include/cru/osx/gui/Window.hpp @@ -0,0 +1,18 @@ +#pragma once +#include "Resource.hpp" +#include "cru/platform/gui/Base.hpp" +#include "cru/platform/gui/Window.hpp" + +namespace cru::platform::gui::osx { +class OsxWindow : public OsxGuiResource, public virtual INativeWindow { + public: + OsxWindow(); + + CRU_DELETE_COPY(OsxWindow) + CRU_DELETE_MOVE(OsxWindow) + + ~OsxWindow() override; + + private: +}; +} // namespace cru::platform::gui::osx diff --git a/src/osx/CMakeLists.txt b/src/osx/CMakeLists.txt index 0957050a..cb6c2b1a 100644 --- a/src/osx/CMakeLists.txt +++ b/src/osx/CMakeLists.txt @@ -13,3 +13,4 @@ target_sources(cru_osx_base PUBLIC target_link_libraries(cru_osx_base PUBLIC cru_platform_base) add_subdirectory(graphics) +add_subdirectory(gui) diff --git a/src/osx/graphics/quartz/CMakeLists.txt b/src/osx/graphics/quartz/CMakeLists.txt index 868a3ee2..bd75f30b 100644 --- a/src/osx/graphics/quartz/CMakeLists.txt +++ b/src/osx/graphics/quartz/CMakeLists.txt @@ -20,6 +20,9 @@ target_sources(cru_osx_graphics_quartz PUBLIC ${CRU_OSX_GRAPHICS_NATIVE_INCLUDE_DIR}/Resource.hpp ${CRU_OSX_GRAPHICS_NATIVE_INCLUDE_DIR}/TextLayout.hpp ) -target_link_libraries(cru_osx_graphics_quartz PUBLIC quartz) -target_link_libraries(cru_osx_graphics_quartz PUBLIC cru_osx_base cru_platform_graphics) +find_library(CORE_GRAPHICS CoreGraphics REQUIRED) +find_library(CORE_TEXT CoreText REQUIRED) + +target_link_libraries(cru_osx_graphics_quartz PUBLIC ${CORE_GRAPHICS} ${CORE_TEXT}) +target_link_libraries(cru_osx_graphics_quartz PUBLIC cru_osx_base cru_platform_graphics) diff --git a/src/osx/gui/CMakeLists.txt b/src/osx/gui/CMakeLists.txt new file mode 100644 index 00000000..26191655 --- /dev/null +++ b/src/osx/gui/CMakeLists.txt @@ -0,0 +1,15 @@ +set(CRU_OSX_GUI_INCLUDE_DIR ${CRU_INCLUDE_DIR}/cru/osx/gui) + +add_library(cru_osx_gui SHARED + Resource.cpp + UiApplication.cpp + Window.cpp +) + +target_sources(cru_osx_gui PUBLIC + ${CRU_OSX_GUI_INCLUDE_DIR}/Resource.hpp + ${CRU_OSX_GUI_INCLUDE_DIR}/UiApplication.hpp + ${CRU_OSX_GUI_INCLUDE_DIR}/Window.hpp +) + +target_link_libraries(cru_osx_gui PUBLIC cru_platform_gui cru_osx_graphics_quartz) diff --git a/src/osx/gui/Resource.cpp b/src/osx/gui/Resource.cpp new file mode 100644 index 00000000..3e9782e2 --- /dev/null +++ b/src/osx/gui/Resource.cpp @@ -0,0 +1,6 @@ +#include "cru/osx/gui/Resource.hpp" + +namespace cru::platform::gui::osx { +OsxGuiResource::OsxGuiResource(IUiApplication* ui_application) + : ui_application_(ui_application) {} +} // namespace cru::platform::gui::osx diff --git a/src/osx/gui/UiApplication.cpp b/src/osx/gui/UiApplication.cpp new file mode 100644 index 00000000..e69de29b --- /dev/null +++ b/src/osx/gui/UiApplication.cpp diff --git a/src/osx/gui/Window.cpp b/src/osx/gui/Window.cpp new file mode 100644 index 00000000..e69de29b --- /dev/null +++ b/src/osx/gui/Window.cpp |