From 8ad2966933957ac5d6ff8dcd5e732736fd5e4dc6 Mon Sep 17 00:00:00 2001 From: crupest Date: Sun, 15 May 2022 14:08:06 +0800 Subject: ... --- src/osx/gui/Cursor.mm | 93 --------------------------------------------------- 1 file changed, 93 deletions(-) delete mode 100644 src/osx/gui/Cursor.mm (limited to 'src/osx/gui/Cursor.mm') diff --git a/src/osx/gui/Cursor.mm b/src/osx/gui/Cursor.mm deleted file mode 100644 index 13bdc858..00000000 --- a/src/osx/gui/Cursor.mm +++ /dev/null @@ -1,93 +0,0 @@ -#include "cru/osx/gui/Cursor.h" -#include "CursorPrivate.h" - -#include "cru/osx/Exception.h" -#include "cru/osx/gui/Resource.h" -#include "cru/platform/gui/Cursor.h" -#include "cru/platform/gui/UiApplication.h" - -#include - -namespace cru::platform::gui::osx { -namespace details { -OsxCursorPrivate::OsxCursorPrivate(OsxCursor* cursor, SystemCursorType cursor_type) { - cursor_ = cursor; - - switch (cursor_type) { - case SystemCursorType::Arrow: - ns_cursor_ = [NSCursor arrowCursor]; - break; - case SystemCursorType::Hand: - ns_cursor_ = [NSCursor pointingHandCursor]; - break; - case SystemCursorType::IBeam: - ns_cursor_ = [NSCursor IBeamCursor]; - break; - default: - throw Exception(u"Unknown system cursor type."); - } -} - -OsxCursorPrivate::~OsxCursorPrivate() {} -} - -OsxCursor::OsxCursor(IUiApplication* ui_application, SystemCursorType cursor_type) - : OsxGuiResource(ui_application) { - p_ = std::make_unique(this, cursor_type); -} - -OsxCursor::~OsxCursor() {} - -namespace details { -class OsxCursorManagerPrivate { - friend OsxCursorManager; - - public: - explicit OsxCursorManagerPrivate(OsxCursorManager* cursor_manager); - - CRU_DELETE_COPY(OsxCursorManagerPrivate) - CRU_DELETE_MOVE(OsxCursorManagerPrivate) - - ~OsxCursorManagerPrivate(); - - private: - OsxCursorManager* cursor_manager_; - - std::shared_ptr arrow_cursor_; - std::shared_ptr hand_cursor_; - std::shared_ptr ibeam_cursor_; -}; - -OsxCursorManagerPrivate::OsxCursorManagerPrivate(OsxCursorManager* cursor_manager) { - cursor_manager_ = cursor_manager; - arrow_cursor_ = - std::make_shared(cursor_manager->GetUiApplication(), SystemCursorType::Arrow); - hand_cursor_ = - std::make_shared(cursor_manager->GetUiApplication(), SystemCursorType::Hand); - ibeam_cursor_ = - std::make_shared(cursor_manager->GetUiApplication(), SystemCursorType::IBeam); -} - -OsxCursorManagerPrivate::~OsxCursorManagerPrivate() {} -} - -OsxCursorManager::OsxCursorManager(IUiApplication* ui_application) - : OsxGuiResource(ui_application) { - p_ = std::make_unique(this); -} - -OsxCursorManager::~OsxCursorManager() {} - -std::shared_ptr OsxCursorManager::GetSystemCursor(SystemCursorType type) { - switch (type) { - case SystemCursorType::Arrow: - return p_->arrow_cursor_; - case SystemCursorType::Hand: - return p_->hand_cursor_; - case SystemCursorType::IBeam: - return p_->ibeam_cursor_; - default: - throw Exception(u"Unknown system cursor type."); - } -} -} -- cgit v1.2.3