From 3c352c0647538a0975b442734ce4a3518329b856 Mon Sep 17 00:00:00 2001 From: Sergey Fedorov Date: Mon, 1 Dec 2025 15:51:23 +0800 Subject: [PATCH 6/6] Fix Cocoa stuff --- include/wx/defs.h | 46 +++++++++++----------------------------- include/wx/osx/private.h | 8 ++++++- 2 files changed, 19 insertions(+), 35 deletions(-) diff --git a/include/wx/defs.h b/include/wx/defs.h index 86eb04b194..560f54ea4a 100644 --- a/include/wx/defs.h +++ b/include/wx/defs.h @@ -2941,7 +2941,7 @@ typedef HIShapeRef WXHRGN; #endif // __WXMAC__ -#if defined(__WXMAC__) +#ifdef __DARWIN__ /* Objective-C type declarations. * These are to be used in public headers in lieu of NSSomething* because @@ -2982,26 +2982,30 @@ typedef struct objc_object *WX_##klass #endif /* (defined(__GNUC__) && defined(__APPLE__)) */ DECLARE_WXCOCOA_OBJC_CLASS(NSArray); +DECLARE_WXCOCOA_OBJC_CLASS(NSBitmapImageRep); +DECLARE_WXCOCOA_OBJC_CLASS(NSColor); DECLARE_WXCOCOA_OBJC_CLASS(NSData); +DECLARE_WXCOCOA_OBJC_CLASS(NSFont); +DECLARE_WXCOCOA_OBJC_CLASS(NSFontDescriptor); +DECLARE_WXCOCOA_OBJC_CLASS(NSImage); DECLARE_WXCOCOA_OBJC_CLASS(NSMutableArray); -DECLARE_WXCOCOA_OBJC_CLASS(NSString); DECLARE_WXCOCOA_OBJC_CLASS(NSObject); +DECLARE_WXCOCOA_OBJC_CLASS(NSSound); +DECLARE_WXCOCOA_OBJC_CLASS(NSString); +DECLARE_WXCOCOA_OBJC_CLASS(NSThread); + +typedef WX_NSImage WXImage; #if wxOSX_USE_COCOA DECLARE_WXCOCOA_OBJC_CLASS(NSApplication); -DECLARE_WXCOCOA_OBJC_CLASS(NSBitmapImageRep); DECLARE_WXCOCOA_OBJC_CLASS(NSBox); DECLARE_WXCOCOA_OBJC_CLASS(NSButton); -DECLARE_WXCOCOA_OBJC_CLASS(NSColor); DECLARE_WXCOCOA_OBJC_CLASS(NSColorPanel); DECLARE_WXCOCOA_OBJC_CLASS(NSControl); DECLARE_WXCOCOA_OBJC_CLASS(NSCursor); DECLARE_WXCOCOA_OBJC_CLASS(NSEvent); -DECLARE_WXCOCOA_OBJC_CLASS(NSFont); -DECLARE_WXCOCOA_OBJC_CLASS(NSFontDescriptor); DECLARE_WXCOCOA_OBJC_CLASS(NSFontPanel); -DECLARE_WXCOCOA_OBJC_CLASS(NSImage); DECLARE_WXCOCOA_OBJC_CLASS(NSLayoutManager); DECLARE_WXCOCOA_OBJC_CLASS(NSMenu); DECLARE_WXCOCOA_OBJC_CLASS(NSMenuExtra); @@ -3010,14 +3014,12 @@ DECLARE_WXCOCOA_OBJC_CLASS(NSNotification); DECLARE_WXCOCOA_OBJC_CLASS(NSPanel); DECLARE_WXCOCOA_OBJC_CLASS(NSResponder); DECLARE_WXCOCOA_OBJC_CLASS(NSScrollView); -DECLARE_WXCOCOA_OBJC_CLASS(NSSound); DECLARE_WXCOCOA_OBJC_CLASS(NSStatusItem); DECLARE_WXCOCOA_OBJC_CLASS(NSTableColumn); DECLARE_WXCOCOA_OBJC_CLASS(NSTableView); DECLARE_WXCOCOA_OBJC_CLASS(NSTextContainer); DECLARE_WXCOCOA_OBJC_CLASS(NSTextField); DECLARE_WXCOCOA_OBJC_CLASS(NSTextStorage); -DECLARE_WXCOCOA_OBJC_CLASS(NSThread); DECLARE_WXCOCOA_OBJC_CLASS(NSWindow); DECLARE_WXCOCOA_OBJC_CLASS(NSView); DECLARE_WXCOCOA_OBJC_CLASS(NSOpenGLContext); @@ -3034,41 +3036,17 @@ DECLARE_WXCOCOA_OBJC_CLASS(WKWebView); typedef WX_NSWindow WXWindow; typedef WX_NSView WXWidget; -typedef WX_NSImage WXImage; typedef WX_NSMenu WXHMENU; typedef WX_NSOpenGLPixelFormat WXGLPixelFormat; typedef WX_NSOpenGLContext WXGLContext; typedef WX_NSPasteboard OSXPasteboard; typedef WX_WKWebView OSXWebViewPtr; -#elif wxOSX_USE_IPHONE - -DECLARE_WXCOCOA_OBJC_CLASS(UIMenu); -DECLARE_WXCOCOA_OBJC_CLASS(UIMenuItem); -DECLARE_WXCOCOA_OBJC_CLASS(UIWindow); -DECLARE_WXCOCOA_OBJC_CLASS(UImage); -DECLARE_WXCOCOA_OBJC_CLASS(UIView); -DECLARE_WXCOCOA_OBJC_CLASS(UIFont); -DECLARE_WXCOCOA_OBJC_CLASS(UIImage); -DECLARE_WXCOCOA_OBJC_CLASS(UIEvent); -DECLARE_WXCOCOA_OBJC_CLASS(NSSet); -DECLARE_WXCOCOA_OBJC_CLASS(EAGLContext); -DECLARE_WXCOCOA_OBJC_CLASS(UIPasteboard); - -typedef WX_UIWindow WXWindow; -typedef WX_UIView WXWidget; -typedef WX_UIImage WXImage; -typedef WX_UIMenu WXHMENU; -typedef WX_EAGLContext WXGLContext; -typedef WX_NSString WXGLPixelFormat; -typedef WX_UIPasteboard WXOSXPasteboard; - #endif +#endif /* __DARWIN__ */ -#endif /* __WXMAC__ */ - /* ABX: check __WIN32__ instead of __WXMSW__ for the same MSWBase in any Win32 port */ #if defined(__WIN32__) diff --git a/include/wx/osx/private.h b/include/wx/osx/private.h index 23fd0025fb..af32d8564a 100644 --- a/include/wx/osx/private.h +++ b/include/wx/osx/private.h @@ -7,8 +7,14 @@ #include "wx/osx/iphone/private.h" #elif wxOSX_USE_COCOA #include "wx/osx/cocoa/private.h" -#elif wxUSE_GUI +#elif wxUSE_GUI && defined(__WXOSX__) #error "Must include wx/defs.h first" +#else + #include + + #ifdef __OBJC__ + #import + #endif #endif #endif -- 2.24.3 (Apple Git-128)