From 8ad2966933957ac5d6ff8dcd5e732736fd5e4dc6 Mon Sep 17 00:00:00 2001 From: crupest Date: Sun, 15 May 2022 14:08:06 +0800 Subject: ... --- src/osx/gui/WindowPrivate.h | 118 -------------------------------------------- 1 file changed, 118 deletions(-) delete mode 100644 src/osx/gui/WindowPrivate.h (limited to 'src/osx/gui/WindowPrivate.h') diff --git a/src/osx/gui/WindowPrivate.h b/src/osx/gui/WindowPrivate.h deleted file mode 100644 index cdd34246..00000000 --- a/src/osx/gui/WindowPrivate.h +++ /dev/null @@ -1,118 +0,0 @@ -#pragma once -#include "cru/osx/gui/Window.h" - -#include "cru/common/Event.h" -#include "cru/osx/gui/Cursor.h" -#include "cru/platform/gui/TimerHelper.h" -#include "cru/platform/gui/Window.h" - -#import - -@interface CruWindowDelegate : NSObject -- (id)init:(cru::platform::gui::osx::details::OsxWindowPrivate*)p; -@end - -@interface CruWindow : NSWindow -- (instancetype)init:(cru::platform::gui::osx::details::OsxWindowPrivate*)p - contentRect:(NSRect)contentRect - style:(NSWindowStyleMask)style; -@end - -@interface CruView : NSView -- (instancetype)init:(cru::platform::gui::osx::details::OsxWindowPrivate*)p - input_context_p: - (cru::platform::gui::osx::details::OsxInputMethodContextPrivate*)input_context_p - frame:(cru::platform::Rect)frame; -@end - -namespace cru::platform::gui::osx { - -namespace details { -class OsxInputMethodContextPrivate; - -class OsxWindowPrivate { - friend OsxWindow; - friend OsxInputMethodContextPrivate; - - public: - explicit OsxWindowPrivate(OsxWindow* osx_window); - - CRU_DELETE_COPY(OsxWindowPrivate) - CRU_DELETE_MOVE(OsxWindowPrivate) - - ~OsxWindowPrivate(); - - public: - void OnMouseEnterLeave(MouseEnterLeaveType type); - void OnMouseMove(Point p); - void OnMouseDown(MouseButton button, Point p, KeyModifier key_modifier); - void OnMouseUp(MouseButton button, Point p, KeyModifier key_modifier); - void OnMouseWheel(float delta, Point p, KeyModifier key_modifier, bool horizontal); - void OnKeyDown(KeyCode key, KeyModifier key_modifier); - void OnKeyUp(KeyCode key, KeyModifier key_modifier); - - void OnWindowWillClose(); - void OnWindowDidExpose(); - void OnWindowDidUpdate(); - void OnWindowDidMove(); - void OnWindowDidResize(); - void OnBecomeKeyWindow(); - void OnResignKeyWindow(); - - CGLayerRef GetDrawLayer() { return draw_layer_; } - - OsxWindow* GetWindow() { return osx_window_; } - NSWindow* GetNSWindow() { return window_; } - - private: - Size GetScreenSize(); - - void CreateWindow(); - - void UpdateCursor(); - - Point TransformMousePoint(const Point& point); - - CGLayerRef CreateLayer(const CGSize& size); - - Rect RetrieveContentRect(); - - private: - OsxWindow* osx_window_; - - INativeWindow* parent_ = nullptr; - WindowStyleFlag style_flag_ = WindowStyleFlag{}; - - String title_; - - Rect content_rect_; - - NSWindow* window_ = nil; - CruWindowDelegate* window_delegate_ = nil; - - CGLayerRef draw_layer_ = nullptr; - - bool mouse_in_ = false; - - std::shared_ptr cursor_ = nullptr; - - std::unique_ptr input_method_context_; - - TimerAutoCanceler draw_timer_; - - Event create_event_; - Event destroy_event_; - Event paint_event_; - Event visibility_change_event_; - Event resize_event_; - Event focus_event_; - Event mouse_enter_leave_event_; - Event mouse_move_event_; - Event mouse_down_event_; - Event mouse_up_event_; - Event mouse_wheel_event_; - Event key_down_event_; - Event key_up_event_; -}; -} // namespace details -} // namespace cru::platform::gui::osx -- cgit v1.2.3