mirror of
https://github.com/wxWidgets/wxWidgets.git
synced 2026-09-22 22:24:56 +08:00
Use native macOS API in wxBase in all GUI builds under Mac
Use the same wxBase library, using native API, regardless of whether native API (Cocoa) or wxGTK is used by wxCore when building under macOS. Add new and more clear and simpler to use preprocessor constants for testing for various builds on Apple hardware. Also fix compilation with older macOS versions and gcc (not clang). Closes #25919.
This commit is contained in:
committed by
Vadim Zeitlin
parent
ff040c0f4b
commit
bba463aac2
+149
-368
File diff suppressed because it is too large
Load Diff
+10
-58
@@ -85,22 +85,6 @@ IMPORTANT: please read docs/tech/tn0016.txt before modifying this file!
|
||||
wx/unix/fswatcher_kqueue.h
|
||||
</set>
|
||||
|
||||
<!--
|
||||
Files used on all Unix systems, including Darwin with any port but wxMac
|
||||
(this is really an aberration, we should also use these files for wxMac,
|
||||
it's not done because of some OS 9 support leftovers only now)
|
||||
-->
|
||||
<set var="BASE_UNIX_AND_DARWIN_NOTWXMAC_SRC" hints="files">
|
||||
$(BASE_UNIX_AND_DARWIN_SRC)
|
||||
src/unix/mimetype.cpp
|
||||
src/unix/uilocale.cpp
|
||||
</set>
|
||||
|
||||
<set var="BASE_UNIX_AND_DARWIN_NOTWXMAC_HDR" hints="files">
|
||||
$(BASE_UNIX_AND_DARWIN_HDR)
|
||||
wx/unix/mimetype.h
|
||||
</set>
|
||||
|
||||
<!--
|
||||
Files used on all non-Darwin Unix systems (because Darwin provides other,
|
||||
better, native equivalents of the functionality they implement (e.g.
|
||||
@@ -108,15 +92,18 @@ IMPORTANT: please read docs/tech/tn0016.txt before modifying this file!
|
||||
backtrace())
|
||||
-->
|
||||
<set var="BASE_UNIX_SRC" hints="files">
|
||||
$(BASE_UNIX_AND_DARWIN_NOTWXMAC_SRC)
|
||||
src/unix/fswatcher_inotify.cpp
|
||||
src/unix/stdpaths.cpp
|
||||
src/unix/secretstore.cpp
|
||||
$(BASE_UNIX_AND_DARWIN_SRC)
|
||||
src/unix/mimetype.cpp
|
||||
src/unix/uilocale.cpp
|
||||
</set>
|
||||
<set var="BASE_UNIX_HDR" hints="files">
|
||||
$(BASE_UNIX_AND_DARWIN_NOTWXMAC_HDR)
|
||||
wx/unix/fswatcher_inotify.h
|
||||
wx/unix/stdpaths.h
|
||||
wx/unix/mimetype.h
|
||||
$(BASE_UNIX_AND_DARWIN_HDR)
|
||||
</set>
|
||||
|
||||
<!-- =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=- -->
|
||||
@@ -185,6 +172,7 @@ IMPORTANT: please read docs/tech/tn0016.txt before modifying this file!
|
||||
src/osx/cocoa/utils_base.mm
|
||||
src/osx/core/secretstore.cpp
|
||||
src/osx/core/stdpaths.mm
|
||||
src/osx/volume.mm
|
||||
</set>
|
||||
<set var="BASE_COREFOUNDATION_HDR" hints="files">
|
||||
wx/osx/core/cfdataref.h
|
||||
@@ -206,14 +194,14 @@ IMPORTANT: please read docs/tech/tn0016.txt before modifying this file!
|
||||
</set>
|
||||
|
||||
<!-- Base files used by OS X ports (not Carbon) -->
|
||||
<set var="BASE_OSX_SHARED_SRC" hints="files">
|
||||
src/osx/core/mimetype.cpp
|
||||
<set var="BASE_OSX_SRC" hints="files">
|
||||
$(BASE_COREFOUNDATION_SRC)
|
||||
$(BASE_UNIX_AND_DARWIN_SRC)
|
||||
src/osx/fswatcher_fsevents.cpp
|
||||
src/osx/core/uilocale.mm
|
||||
src/osx/core/mimetype.cpp
|
||||
</set>
|
||||
<set var="BASE_OSX_SHARED_HDR" hints="files">
|
||||
<set var="BASE_OSX_HDR" hints="files">
|
||||
$(BASE_COREFOUNDATION_HDR)
|
||||
$(BASE_UNIX_AND_DARWIN_HDR)
|
||||
wx/osx/fswatcher_fsevents.h
|
||||
@@ -222,17 +210,6 @@ IMPORTANT: please read docs/tech/tn0016.txt before modifying this file!
|
||||
|
||||
<set var="BASE_AND_GUI_OSX_COCOA_SRC" hints="files">
|
||||
src/osx/cocoa/utils.mm
|
||||
src/osx/volume.mm
|
||||
</set>
|
||||
|
||||
<!-- Base files used by non-wxMac OS X builds -->
|
||||
<set var="BASE_OSX_NOTWXMAC_SRC" hints="files">
|
||||
$(BASE_UNIX_AND_DARWIN_NOTWXMAC_SRC)
|
||||
$(BASE_COREFOUNDATION_SRC)
|
||||
</set>
|
||||
<set var="BASE_OSX_NOTWXMAC_HDR" hints="files">
|
||||
$(BASE_UNIX_AND_DARWIN_NOTWXMAC_HDR)
|
||||
$(BASE_COREFOUNDATION_HDR)
|
||||
</set>
|
||||
|
||||
<!-- =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=- -->
|
||||
@@ -3215,23 +3192,10 @@ IMPORTANT: please read docs/tech/tn0016.txt before modifying this file!
|
||||
<!-- wxBase files: -->
|
||||
|
||||
<!-- Nested if would be nicer, but this works -->
|
||||
<!-- These are the files for PLATFORM_MACOSX -->
|
||||
<set var="BASE_OSX_SRC" hints="files">
|
||||
<if cond="TOOLKIT=='OSX_COCOA'">$(BASE_OSX_SHARED_SRC)</if>
|
||||
<if cond="TOOLKIT=='OSX_IPHONE'">$(BASE_OSX_SHARED_SRC)</if>
|
||||
<if cond="TOOLKIT=='COCOA'">$(BASE_OSX_NOTWXMAC_SRC)</if>
|
||||
<if cond="TOOLKIT=='GTK'">$(BASE_OSX_NOTWXMAC_SRC)</if>
|
||||
<if cond="TOOLKIT=='X11'">$(BASE_OSX_NOTWXMAC_SRC)</if>
|
||||
<!-- FIXME: TOOLKIT!='MAC' is what we really want -->
|
||||
|
||||
<!-- FIXME: a hack because there are two wxBase versions on
|
||||
Mac; once fixed, this would no longer be needed -->
|
||||
<if cond="TOOLKIT==''">$(BASE_OSX_NOTWXMAC_SRC)</if>
|
||||
</set>
|
||||
<set var="BASE_PLATFORM_SRC" hints="files">
|
||||
<if cond="PLATFORM_UNIX=='1'">$(BASE_UNIX_SRC)</if>
|
||||
<if cond="PLATFORM_WIN32=='1'">$(BASE_WIN32_SRC)</if>
|
||||
<if cond="PLATFORM_MACOSX=='1'">$(BASE_OSX_SHARED_SRC)</if>
|
||||
<if cond="PLATFORM_MACOSX=='1'">$(BASE_OSX_SRC)</if>
|
||||
</set>
|
||||
<set var="BASE_AND_GUI_TOOLKIT_SRC" hints="files">
|
||||
<if cond="TOOLKIT=='OSX_COCOA'">$(BASE_AND_GUI_OSX_COCOA_SRC)</if>
|
||||
@@ -3243,18 +3207,6 @@ IMPORTANT: please read docs/tech/tn0016.txt before modifying this file!
|
||||
</set>
|
||||
|
||||
<!-- Nested if would be nicer, but this works -->
|
||||
<!-- These are the files for PLATFORM_MACOSX -->
|
||||
<set var="BASE_OSX_HDR" hints="files">
|
||||
<if cond="TOOLKIT=='OSX_COCOA'">$(BASE_OSX_SHARED_HDR)</if>
|
||||
<if cond="TOOLKIT=='COCOA'">$(BASE_OSX_NOTWXMAC_HDR)</if>
|
||||
<if cond="TOOLKIT=='GTK'">$(BASE_OSX_NOTWXMAC_HDR)</if>
|
||||
<if cond="TOOLKIT=='X11'">$(BASE_OSX_NOTWXMAC_HDR)</if>
|
||||
<!-- FIXME: TOOLKIT!='MAC' is what we really want -->
|
||||
|
||||
<!-- FIXME: a hack because there are two wxBase versions on
|
||||
Mac; once fixed, this would no longer be needed -->
|
||||
<if cond="TOOLKIT==''">$(BASE_OSX_NOTWXMAC_HDR)</if>
|
||||
</set>
|
||||
<set var="BASE_PLATFORM_HDR" hints="files">
|
||||
<if cond="PLATFORM_UNIX=='1'">$(BASE_UNIX_HDR)</if>
|
||||
<if cond="PLATFORM_WIN32=='1'">$(BASE_WIN32_HDR)</if>
|
||||
|
||||
+10
-28
@@ -31,28 +31,20 @@ set(BASE_UNIX_AND_DARWIN_HDR
|
||||
wx/unix/fswatcher_kqueue.h
|
||||
)
|
||||
|
||||
set(BASE_UNIX_AND_DARWIN_NOTWXMAC_SRC
|
||||
set(BASE_UNIX_SRC
|
||||
src/unix/fswatcher_inotify.cpp
|
||||
src/unix/secretstore.cpp
|
||||
src/unix/stdpaths.cpp
|
||||
${BASE_UNIX_AND_DARWIN_SRC}
|
||||
src/unix/mimetype.cpp
|
||||
src/unix/uilocale.cpp
|
||||
)
|
||||
|
||||
set(BASE_UNIX_AND_DARWIN_NOTWXMAC_HDR
|
||||
${BASE_UNIX_AND_DARWIN_HDR}
|
||||
wx/unix/mimetype.h
|
||||
)
|
||||
|
||||
set(BASE_UNIX_SRC
|
||||
${BASE_UNIX_AND_DARWIN_NOTWXMAC_SRC}
|
||||
src/unix/fswatcher_inotify.cpp
|
||||
src/unix/secretstore.cpp
|
||||
src/unix/stdpaths.cpp
|
||||
)
|
||||
|
||||
set(BASE_UNIX_HDR
|
||||
${BASE_UNIX_AND_DARWIN_NOTWXMAC_HDR}
|
||||
wx/unix/fswatcher_inotify.h
|
||||
wx/unix/stdpaths.h
|
||||
${BASE_UNIX_AND_DARWIN_HDR}
|
||||
wx/unix/mimetype.h
|
||||
)
|
||||
|
||||
set(BASE_WIN32_SRC
|
||||
@@ -115,6 +107,7 @@ set(BASE_COREFOUNDATION_SRC
|
||||
src/osx/core/strconv_cf.cpp
|
||||
src/osx/cocoa/utils_base.mm
|
||||
src/osx/core/stdpaths.mm
|
||||
src/osx/volume.mm
|
||||
)
|
||||
|
||||
set(BASE_COREFOUNDATION_HDR
|
||||
@@ -136,15 +129,15 @@ set(BASE_COREFOUNDATION_HDR
|
||||
wx/osx/core/stdpaths.h
|
||||
)
|
||||
|
||||
set(BASE_OSX_SHARED_SRC
|
||||
src/osx/core/mimetype.cpp
|
||||
set(BASE_OSX_SRC
|
||||
src/osx/fswatcher_fsevents.cpp
|
||||
${BASE_COREFOUNDATION_SRC}
|
||||
${BASE_UNIX_AND_DARWIN_SRC}
|
||||
src/osx/core/uilocale.mm
|
||||
src/osx/core/mimetype.cpp
|
||||
)
|
||||
|
||||
set(BASE_OSX_SHARED_HDR
|
||||
set(BASE_OSX_HDR
|
||||
wx/osx/fswatcher_fsevents.h
|
||||
${BASE_COREFOUNDATION_HDR}
|
||||
${BASE_UNIX_AND_DARWIN_HDR}
|
||||
@@ -152,17 +145,6 @@ set(BASE_OSX_SHARED_HDR
|
||||
|
||||
set(BASE_AND_GUI_OSX_COCOA_SRC
|
||||
src/osx/cocoa/utils.mm
|
||||
src/osx/volume.mm
|
||||
)
|
||||
|
||||
set(BASE_OSX_NOTWXMAC_SRC
|
||||
${BASE_UNIX_AND_DARWIN_NOTWXMAC_SRC}
|
||||
${BASE_COREFOUNDATION_SRC}
|
||||
)
|
||||
|
||||
set(BASE_OSX_NOTWXMAC_HDR
|
||||
${BASE_UNIX_AND_DARWIN_NOTWXMAC_HDR}
|
||||
${BASE_COREFOUNDATION_HDR}
|
||||
)
|
||||
|
||||
set(QT_UNIX_SRC
|
||||
|
||||
@@ -430,6 +430,10 @@ function(wx_set_target_properties target_name)
|
||||
PUBLIC ${WIN32_LIBRARIES})
|
||||
endif()
|
||||
|
||||
if(wxTOOLKIT_LIBRARY_DIRS AND NOT wxTARGET_IS_BASE)
|
||||
target_link_directories(${target_name}
|
||||
PUBLIC ${wxTOOLKIT_LIBRARY_DIRS})
|
||||
endif()
|
||||
if(wxTOOLKIT_LIBRARIES AND NOT wxTARGET_IS_BASE)
|
||||
target_link_libraries(${target_name}
|
||||
PUBLIC ${wxTOOLKIT_LIBRARIES})
|
||||
|
||||
@@ -657,7 +657,7 @@ if(wxUSE_GUI)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
if(wxUSE_MEDIACTRL AND WXGTK AND NOT APPLE AND NOT WIN32)
|
||||
if(wxUSE_MEDIACTRL AND WXGTK AND NOT WIN32)
|
||||
find_package(GSTREAMER 1.0 COMPONENTS video)
|
||||
if(NOT GSTREAMER_FOUND)
|
||||
find_package(GSTREAMER 0.10 COMPONENTS interfaces)
|
||||
|
||||
@@ -14,13 +14,9 @@ if(WIN32)
|
||||
wx_append_sources(BASE_FILES BASE_WIN32)
|
||||
wx_append_sources(BASE_FILES BASE_AND_GUI_WIN32)
|
||||
elseif(APPLE)
|
||||
if(WXOSX_COCOA OR WXOSX_IPHONE)
|
||||
wx_append_sources(BASE_FILES BASE_OSX_SHARED)
|
||||
if(WXOSX_COCOA)
|
||||
wx_append_sources(BASE_FILES BASE_AND_GUI_OSX_COCOA)
|
||||
endif()
|
||||
else()
|
||||
wx_append_sources(BASE_FILES BASE_OSX_NOTWXMAC)
|
||||
wx_append_sources(BASE_FILES BASE_OSX)
|
||||
if(WXOSX_COCOA)
|
||||
wx_append_sources(BASE_FILES BASE_AND_GUI_OSX_COCOA)
|
||||
endif()
|
||||
elseif(UNIX)
|
||||
wx_append_sources(BASE_FILES BASE_UNIX)
|
||||
@@ -58,13 +54,24 @@ endif()
|
||||
|
||||
if(APPLE)
|
||||
wx_lib_link_libraries(wxbase
|
||||
PRIVATE
|
||||
"-framework Security"
|
||||
PUBLIC
|
||||
"-framework CoreFoundation"
|
||||
)
|
||||
if(WXOSX_IPHONE)
|
||||
wx_lib_link_libraries(wxbase
|
||||
PUBLIC
|
||||
"-framework UIKit"
|
||||
)
|
||||
else()
|
||||
wx_lib_link_libraries(wxbase
|
||||
PUBLIC
|
||||
"-framework AppKit"
|
||||
)
|
||||
endif()
|
||||
if(WXOSX_COCOA)
|
||||
wx_lib_link_libraries(wxbase
|
||||
PRIVATE
|
||||
"-framework Security"
|
||||
PUBLIC
|
||||
"-framework Carbon"
|
||||
"-framework Cocoa"
|
||||
|
||||
@@ -67,6 +67,7 @@ endif()
|
||||
if(wxUSE_GUI)
|
||||
set(wxTOOLKIT_INCLUDE_DIRS)
|
||||
set(wxTOOLKIT_LIBRARIES)
|
||||
set(wxTOOLKIT_LIBRARY_DIRS)
|
||||
set(wxTOOLKIT_VERSION)
|
||||
|
||||
if(WXGTK)
|
||||
@@ -81,6 +82,7 @@ if(WXGTK)
|
||||
find_package(${gtk_lib} REQUIRED)
|
||||
list(APPEND wxTOOLKIT_INCLUDE_DIRS ${${gtk_lib}_INCLUDE_DIRS})
|
||||
list(APPEND wxTOOLKIT_LIBRARIES ${${gtk_lib}_LIBRARIES})
|
||||
list(APPEND wxTOOLKIT_LIBRARY_DIRS ${${gtk_lib}_LIBRARY_DIRS})
|
||||
list(APPEND wxTOOLKIT_DEFINITIONS ${${gtk_lib}_DEFINITIONS})
|
||||
list(APPEND wxTOOLKIT_DEFINITIONS __WXGTK__)
|
||||
set(wxTOOLKIT_VERSION ${${gtk_lib}_VERSION})
|
||||
|
||||
+12
-31
@@ -50,31 +50,22 @@ BASE_UNIX_AND_DARWIN_HDR =
|
||||
wx/unix/stackwalk.h
|
||||
wx/unix/fswatcher_kqueue.h
|
||||
|
||||
# Files used on all Unix systems, including Darwin with any port but wxMac
|
||||
# (this is really an aberration, we should also use these files for wxMac,
|
||||
# it's not done because of some OS 9 support leftovers only now)
|
||||
BASE_UNIX_AND_DARWIN_NOTWXMAC_SRC =
|
||||
$(BASE_UNIX_AND_DARWIN_SRC)
|
||||
src/unix/mimetype.cpp
|
||||
src/unix/uilocale.cpp
|
||||
|
||||
BASE_UNIX_AND_DARWIN_NOTWXMAC_HDR =
|
||||
$(BASE_UNIX_AND_DARWIN_HDR)
|
||||
wx/unix/mimetype.h
|
||||
|
||||
# Files used on all non-Darwin Unix systems (because Darwin provides other,
|
||||
# better, native equivalents of the functionality they implement (e.g.
|
||||
# CFSocket instead of BSD sockets) or doesn't provide it at all (epoll,
|
||||
# backtrace())
|
||||
BASE_UNIX_SRC =
|
||||
$(BASE_UNIX_AND_DARWIN_NOTWXMAC_SRC)
|
||||
$(BASE_UNIX_AND_DARWIN_SRC)
|
||||
src/unix/fswatcher_inotify.cpp
|
||||
src/unix/mimetype.cpp
|
||||
src/unix/secretstore.cpp
|
||||
src/unix/stdpaths.cpp
|
||||
src/unix/uilocale.cpp
|
||||
|
||||
BASE_UNIX_HDR =
|
||||
$(BASE_UNIX_AND_DARWIN_NOTWXMAC_HDR)
|
||||
$(BASE_UNIX_AND_DARWIN_HDR)
|
||||
wx/unix/fswatcher_inotify.h
|
||||
wx/unix/mimetype.h
|
||||
wx/unix/stdpaths.h
|
||||
|
||||
|
||||
@@ -141,6 +132,7 @@ BASE_COREFOUNDATION_SRC =
|
||||
src/osx/core/stdpaths.mm
|
||||
src/osx/core/strconv_cf.cpp
|
||||
src/osx/cocoa/utils_base.mm
|
||||
src/osx/volume.mm
|
||||
|
||||
BASE_COREFOUNDATION_HDR =
|
||||
wx/osx/carbon/region.h
|
||||
@@ -161,32 +153,21 @@ BASE_COREFOUNDATION_HDR =
|
||||
wx/osx/core/stdpaths.h
|
||||
|
||||
# Base files used by OS X ports (not Carbon)
|
||||
BASE_OSX_SHARED_SRC =
|
||||
BASE_OSX_SRC =
|
||||
$(BASE_UNIX_AND_DARWIN_SRC)
|
||||
$(BASE_COREFOUNDATION_SRC)
|
||||
src/osx/core/mimetype.cpp
|
||||
src/osx/core/uilocale.mm
|
||||
src/osx/fswatcher_fsevents.cpp
|
||||
$(BASE_COREFOUNDATION_SRC)
|
||||
$(BASE_UNIX_AND_DARWIN_SRC)
|
||||
|
||||
BASE_OSX_SHARED_HDR =
|
||||
wx/osx/fswatcher_fsevents.h
|
||||
$(BASE_COREFOUNDATION_HDR)
|
||||
BASE_OSX_HDR =
|
||||
$(BASE_UNIX_AND_DARWIN_HDR)
|
||||
$(BASE_COREFOUNDATION_HDR)
|
||||
wx/osx/fswatcher_fsevents.h
|
||||
|
||||
# Base and GUI files used by OS X
|
||||
BASE_AND_GUI_OSX_COCOA_SRC =
|
||||
src/osx/cocoa/utils.mm
|
||||
src/osx/volume.mm
|
||||
|
||||
# files used by non-wxMac OS X builds
|
||||
BASE_OSX_NOTWXMAC_SRC =
|
||||
$(BASE_UNIX_AND_DARWIN_NOTWXMAC_SRC)
|
||||
$(BASE_COREFOUNDATION_SRC)
|
||||
|
||||
BASE_OSX_NOTWXMAC_HDR =
|
||||
$(BASE_UNIX_AND_DARWIN_NOTWXMAC_HDR)
|
||||
$(BASE_COREFOUNDATION_HDR)
|
||||
|
||||
|
||||
## Qt
|
||||
|
||||
|
||||
@@ -41299,7 +41299,7 @@ $as_echo "$wx_cv_target_x86_64" >&6; }
|
||||
fi
|
||||
fi
|
||||
if test "$USE_DARWIN" = 1 -a "$wxUSE_MAC" != 1 -a "$wxUSE_OLD_COCOA" != 1 ; then
|
||||
EXTRA_FRAMEWORKS="$EXTRA_FRAMEWORKS -framework IOKit -framework CoreServices -framework System -framework ApplicationServices -framework Foundation"
|
||||
EXTRA_FRAMEWORKS="$EXTRA_FRAMEWORKS -framework AppKit -framework IOKit -framework CoreServices -framework System -framework ApplicationServices -framework Foundation"
|
||||
fi
|
||||
|
||||
LDFLAGS="$LDFLAGS $EXTRA_FRAMEWORKS"
|
||||
|
||||
+1
-1
@@ -7737,7 +7737,7 @@ if test "$wxUSE_MAC" = 1 ; then
|
||||
fi
|
||||
fi
|
||||
if test "$USE_DARWIN" = 1 -a "$wxUSE_MAC" != 1 -a "$wxUSE_OLD_COCOA" != 1 ; then
|
||||
EXTRA_FRAMEWORKS="$EXTRA_FRAMEWORKS -framework IOKit -framework CoreServices -framework System -framework ApplicationServices -framework Foundation"
|
||||
EXTRA_FRAMEWORKS="$EXTRA_FRAMEWORKS -framework AppKit -framework IOKit -framework CoreServices -framework System -framework ApplicationServices -framework Foundation"
|
||||
fi
|
||||
|
||||
LDFLAGS="$LDFLAGS $EXTRA_FRAMEWORKS"
|
||||
|
||||
@@ -43,6 +43,9 @@ while <tt>\__WINDOWS__</tt> should be used for the platform tests.}
|
||||
@itemdef{\__WXOSX_IPHONE__, iPhone (UIKit)}
|
||||
@itemdef{\__WXOSX_COCOA__, macOS using Cocoa (AppKit)}
|
||||
@itemdef{\__WXOSX_MAC__, macOS (Cocoa)}
|
||||
@itemdef{\__WXDARWIN__, wxBase built on macOS or iPhone, synonym of <tt>\__DARWIN__</tt> (see below). This constant is available since wxWidgets 3.3.2.}
|
||||
@itemdef{\__WXDARWIN_OSX__, wxBase built on macOS (can be used for with Apple and non-Apple GUIs). This constant is available since wxWidgets 3.3.2.}
|
||||
@itemdef{\__WXDARWIN_IPHONE__, wxBase built on iPhone. This constant is available since wxWidgets 3.3.2.}
|
||||
@itemdef{\__WXPM__, OS/2 native Presentation Manager (not used any longer).}
|
||||
@itemdef{\__WXXT__, Xt; mutually exclusive with WX_MOTIF, not implemented in wxWidgets 2.x}
|
||||
@itemdef{\__WXX11__, wxX11 (<tt>\__WXUNIVERSAL__</tt> will be also defined)}
|
||||
|
||||
+30
-20
@@ -2754,22 +2754,44 @@ DECLARE_WXCOCOA_OBJC_CLASS(NSData);
|
||||
DECLARE_WXCOCOA_OBJC_CLASS(NSMutableArray);
|
||||
DECLARE_WXCOCOA_OBJC_CLASS(NSString);
|
||||
DECLARE_WXCOCOA_OBJC_CLASS(NSObject);
|
||||
DECLARE_WXCOCOA_OBJC_CLASS(NSSet);
|
||||
|
||||
#if wxOSX_USE_COCOA
|
||||
#ifdef __WXDARWIN_OSX__
|
||||
|
||||
DECLARE_WXCOCOA_OBJC_CLASS(NSBitmapImageRep);
|
||||
DECLARE_WXCOCOA_OBJC_CLASS(NSColor);
|
||||
DECLARE_WXCOCOA_OBJC_CLASS(NSFont);
|
||||
DECLARE_WXCOCOA_OBJC_CLASS(NSFontDescriptor);
|
||||
DECLARE_WXCOCOA_OBJC_CLASS(NSImage);
|
||||
DECLARE_WXCOCOA_OBJC_CLASS(NSSound);
|
||||
DECLARE_WXCOCOA_OBJC_CLASS(NSThread);
|
||||
|
||||
typedef WX_NSColor WXColor;
|
||||
typedef WX_NSImage WXImage;
|
||||
|
||||
#elif defined(__WXDARWIN_IPHONE__)
|
||||
|
||||
DECLARE_WXCOCOA_OBJC_CLASS(UIColor);
|
||||
DECLARE_WXCOCOA_OBJC_CLASS(UIImage);
|
||||
DECLARE_WXCOCOA_OBJC_CLASS(UIFont);
|
||||
|
||||
typedef WX_UIColor WXColor;
|
||||
typedef WX_UIImage WXImage;
|
||||
|
||||
#else
|
||||
|
||||
#endif
|
||||
|
||||
#ifdef __WXOSX_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);
|
||||
@@ -2778,14 +2800,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);
|
||||
@@ -2803,36 +2823,27 @@ DECLARE_WXCOCOA_OBJC_CLASS(WKWebView);
|
||||
typedef WX_NSWindow WXWindow;
|
||||
typedef WX_NSEvent WXEvent;
|
||||
typedef WX_NSView WXWidget;
|
||||
typedef WX_NSColor WXColor;
|
||||
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
|
||||
#elif defined(__WXOSX_IPHONE__)
|
||||
|
||||
DECLARE_WXCOCOA_OBJC_CLASS(UIColor);
|
||||
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(UIPress);
|
||||
DECLARE_WXCOCOA_OBJC_CLASS(UIKey);
|
||||
DECLARE_WXCOCOA_OBJC_CLASS(NSSet);
|
||||
DECLARE_WXCOCOA_OBJC_CLASS(EAGLContext);
|
||||
DECLARE_WXCOCOA_OBJC_CLASS(UIPasteboard);
|
||||
|
||||
typedef WX_UIWindow WXWindow;
|
||||
typedef WX_UIEvent WXEvent;
|
||||
typedef WX_UIView WXWidget;
|
||||
typedef WX_UIColor WXColor;
|
||||
typedef WX_UIImage WXImage;
|
||||
typedef WX_UIMenu WXHMENU;
|
||||
typedef WX_EAGLContext WXGLContext;
|
||||
typedef WX_NSString WXGLPixelFormat;
|
||||
@@ -2841,8 +2852,7 @@ typedef WX_UIPasteboard WXOSXPasteboard;
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
#endif /* __WXMAC__ */
|
||||
#endif /* __DARWIN__ */
|
||||
|
||||
/* ABX: check __WIN32__ instead of __WXMSW__ for the same MSWBase in any Win32 port */
|
||||
#if defined(__WIN32__)
|
||||
|
||||
@@ -12,10 +12,12 @@
|
||||
|
||||
#include "wx/defs.h"
|
||||
|
||||
#if defined(__UNIX__)
|
||||
#include "wx/unix/mimetype.h"
|
||||
#if defined(__DARWIN__)
|
||||
#include "wx/osx/mimetype.h"
|
||||
#elif defined(__UNIX__)
|
||||
#include "wx/unix/mimetype.h"
|
||||
#elif defined(__WINDOWS__)
|
||||
#include "wx/msw/mimetype.h"
|
||||
#include "wx/msw/mimetype.h"
|
||||
#endif
|
||||
|
||||
#if wxUSE_MIMETYPE
|
||||
@@ -23,7 +25,7 @@
|
||||
class WXDLLIMPEXP_CORE wxGTKMimeTypesManagerImpl : public wxMimeTypesManagerImpl
|
||||
{
|
||||
protected:
|
||||
#if defined(__UNIX__)
|
||||
#if defined(__UNIX__) && !defined(__DARWIN__)
|
||||
wxString GetIconFromMimeType(const wxString& mime) override;
|
||||
#endif
|
||||
};
|
||||
|
||||
@@ -39,7 +39,7 @@
|
||||
# endif
|
||||
#endif
|
||||
|
||||
#if ( !wxUSE_GUI && !wxOSX_USE_IPHONE ) || wxOSX_USE_COCOA_OR_CARBON
|
||||
#if ( !wxUSE_GUI && !defined(__WXOSX_IPHONE__) ) || defined(__WXOSX_COCOA__)
|
||||
|
||||
// Carbon functions are currently still used in wxOSX/Cocoa too (including
|
||||
// wxBase part of it).
|
||||
@@ -66,9 +66,9 @@ WXDLLIMPEXP_BASE NSString* wxNSStringWithWxString(const wxString &wxstring);
|
||||
|
||||
WXDLLIMPEXP_BASE CFURLRef wxOSXCreateURLFromFileSystemPath( const wxString& path);
|
||||
|
||||
#if wxUSE_GUI
|
||||
#if wxUSE_GUI && defined(__WXOSX__)
|
||||
|
||||
#if !wxOSX_USE_IPHONE
|
||||
#if !defined(__WXOSX_IPHONE__)
|
||||
#include <ApplicationServices/ApplicationServices.h>
|
||||
#endif
|
||||
|
||||
@@ -1050,15 +1050,19 @@ protected :
|
||||
wxDECLARE_ABSTRACT_CLASS(wxNonOwnedWindowImpl);
|
||||
};
|
||||
|
||||
#endif // wxUSE_GUI
|
||||
#endif // __WXOSX__
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
// cocoa bridging utilities
|
||||
//---------------------------------------------------------------------------
|
||||
|
||||
bool wxMacInitCocoa();
|
||||
#ifdef __WXDARWIN_OSX__
|
||||
|
||||
class WXDLLIMPEXP_CORE wxMacAutoreleasePool
|
||||
bool WXDLLIMPEXP_BASE wxMacInitCocoa();
|
||||
|
||||
#endif // __WXDARWIN_OSX__
|
||||
|
||||
class WXDLLIMPEXP_BASE wxMacAutoreleasePool
|
||||
{
|
||||
public :
|
||||
wxMacAutoreleasePool();
|
||||
@@ -1069,9 +1073,9 @@ private :
|
||||
|
||||
// NSObject
|
||||
|
||||
void wxMacCocoaRelease( void* obj );
|
||||
void wxMacCocoaAutorelease( void* obj );
|
||||
void* wxMacCocoaRetain( void* obj );
|
||||
void WXDLLIMPEXP_BASE wxMacCocoaRelease( void* obj );
|
||||
void WXDLLIMPEXP_BASE wxMacCocoaAutorelease( void* obj );
|
||||
void* WXDLLIMPEXP_BASE wxMacCocoaRetain( void* obj );
|
||||
|
||||
// shared_ptr like API for NSObject and subclasses
|
||||
template <class T>
|
||||
|
||||
@@ -3,12 +3,18 @@
|
||||
|
||||
#include "wx/osx/core/private.h"
|
||||
|
||||
#if wxOSX_USE_IPHONE
|
||||
#ifdef __WXOSX_IPHONE__
|
||||
#include "wx/osx/iphone/private.h"
|
||||
#elif wxOSX_USE_COCOA
|
||||
#elif defined(__WXOSX_COCOA__)
|
||||
#include "wx/osx/cocoa/private.h"
|
||||
#elif wxUSE_GUI
|
||||
#elif wxUSE_GUI && defined(__WXOSX__)
|
||||
#error "Must include wx/defs.h first"
|
||||
#else
|
||||
#include <ApplicationServices/ApplicationServices.h>
|
||||
|
||||
#ifdef __OBJC__
|
||||
#import <Cocoa/Cocoa.h>
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
@@ -191,9 +191,9 @@ public:
|
||||
private:
|
||||
WX_NSURLSession m_session = nullptr;
|
||||
WX_wxWebSessionDelegate m_delegate;
|
||||
#if !wxOSX_USE_IPHONE
|
||||
#ifdef __WXDARWIN_OSX__
|
||||
WX_NSURLComponents m_proxyURL = nullptr;
|
||||
#endif // !wxOSX_USE_IPHONE
|
||||
#endif // __WXDARWIN_OSX__
|
||||
bool m_persistentStorageEnabled = false;
|
||||
|
||||
wxDECLARE_NO_COPY_CLASS(wxWebSessionURLSession);
|
||||
|
||||
+10
-1
@@ -419,8 +419,17 @@
|
||||
# endif
|
||||
#endif
|
||||
|
||||
#ifdef __WXOSX_MAC__
|
||||
#ifdef __DARWIN__
|
||||
# if defined(__MACH__)
|
||||
# define __WXDARWIN__ 1
|
||||
# include <TargetConditionals.h>
|
||||
# if defined(TARGET_OS_IPHONE) && TARGET_OS_IPHONE
|
||||
/* this branch is also true for tv, catalyst, watch and vision */
|
||||
# define __WXDARWIN_IPHONE__ 1
|
||||
# elif defined(TARGET_OS_OSX) && TARGET_OS_OSX
|
||||
# define __WXDARWIN_OSX__ 1
|
||||
# endif
|
||||
|
||||
# include <Availability.h>
|
||||
# ifndef MAC_OS_X_VERSION_10_4
|
||||
# define MAC_OS_X_VERSION_10_4 1040
|
||||
|
||||
@@ -223,7 +223,7 @@ protected:
|
||||
#if defined(__WINDOWS__)
|
||||
#include "wx/msw/stdpaths.h"
|
||||
#define wxHAS_NATIVE_STDPATHS
|
||||
#elif defined(__DARWIN__) || defined(__WXOSX_IPHONE__)
|
||||
#elif defined(__DARWIN__)
|
||||
#include "wx/osx/core/stdpaths.h"
|
||||
#define wxHAS_NATIVE_STDPATHS
|
||||
#elif defined(__UNIX__)
|
||||
|
||||
@@ -24,7 +24,7 @@
|
||||
// Objective C++, but it's also still compiled by the makefiles directly as C++
|
||||
// source because we can't easily exclude it, so check for this and only
|
||||
// compile the rest of this file once
|
||||
#if !defined(__WXOSX_COCOA__) || defined(__OBJC__)
|
||||
#if !defined(__DARWIN__) || defined(__OBJC__)
|
||||
|
||||
// for all others, include the necessary headers
|
||||
#ifndef WX_PRECOMP
|
||||
|
||||
@@ -810,7 +810,7 @@ int wxCMPFUNC_CONV wxCmpNaturalGeneric(const wxString& s1, const wxString& s2)
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
// If native natural sort function isn't available, use the generic version.
|
||||
#if !(defined(__WINDOWS__) || defined(__DARWIN__) || defined(__WXOSX_IPHONE__))
|
||||
#if !(defined(__WINDOWS__) || defined(__DARWIN__))
|
||||
|
||||
int wxCMPFUNC_CONV wxCmpNatural(const wxString& s1, const wxString& s2)
|
||||
{
|
||||
|
||||
+4
-4
@@ -55,7 +55,7 @@
|
||||
|
||||
#ifdef __WIN32__
|
||||
#include "wx/msw/private/uilocale.h"
|
||||
#elif defined(__WXOSX__)
|
||||
#elif defined(__DARWIN__)
|
||||
#include "wx/osx/core/cfref.h"
|
||||
#include "wx/osx/core/cfstring.h"
|
||||
#include <CoreFoundation/CFLocale.h>
|
||||
@@ -535,7 +535,7 @@ wxString wxLocale::GetSystemEncodingName()
|
||||
default:
|
||||
encname.Printf(wxS("windows-%u"), codepage);
|
||||
}
|
||||
#elif defined(__WXMAC__)
|
||||
#elif defined(__DARWIN__)
|
||||
encname = wxCFStringRef::AsString(
|
||||
CFStringGetNameOfEncoding(CFStringGetSystemEncoding())
|
||||
);
|
||||
@@ -819,7 +819,7 @@ wxString wxLocale::GetHeaderValue(const wxString& header,
|
||||
// accessors for locale-dependent data
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
#if defined(__WINDOWS__) || defined(__WXOSX__)
|
||||
#if defined(__WINDOWS__) || defined(__DARWIN__)
|
||||
|
||||
namespace
|
||||
{
|
||||
@@ -1243,7 +1243,7 @@ wxString wxLocale::GetOSInfo(wxLocaleInfo index, wxLocaleCategory cat)
|
||||
return wxUILocale::GetCurrent().GetInfo(index, cat);
|
||||
}
|
||||
|
||||
#elif defined(__WXOSX__)
|
||||
#elif defined(__DARWIN__)
|
||||
|
||||
// This function is also used by wxUILocaleImpl, so don't make it private.
|
||||
extern wxString
|
||||
|
||||
@@ -509,7 +509,7 @@ wxString wxGetCurrentDir()
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
#ifdef __WXOSX__
|
||||
#if wxOSX_USE_COCOA_OR_CARBON
|
||||
#if defined(wxOSX_USE_COCOA_OR_CARBON) && wxOSX_USE_COCOA_OR_CARBON
|
||||
#include <crt_externs.h>
|
||||
#endif
|
||||
#endif
|
||||
@@ -531,7 +531,7 @@ bool wxGetEnvMap(wxEnvVariableHashMap *map)
|
||||
// TODO : should we do something with logicals?
|
||||
char **env=nullptr;
|
||||
#elif defined(__DARWIN__)
|
||||
#if wxOSX_USE_COCOA_OR_CARBON
|
||||
#if defined(wxOSX_USE_COCOA_OR_CARBON) && wxOSX_USE_COCOA_OR_CARBON
|
||||
// Under Mac shared libraries don't have access to the global environ
|
||||
// variable so use this Mac-specific function instead as advised by
|
||||
// environ(7) under Darwin
|
||||
@@ -1513,7 +1513,7 @@ wxWindowDisabler::wxWindowDisabler(bool disable)
|
||||
{
|
||||
DoDisable();
|
||||
|
||||
#if defined(__WXOSX__) && wxOSX_USE_COCOA
|
||||
#if defined(__WXOSX__) && defined(wxOSX_USE_COCOA) && wxOSX_USE_COCOA
|
||||
AfterDisable(nullptr);
|
||||
#endif
|
||||
}
|
||||
@@ -1530,7 +1530,7 @@ wxWindowDisabler::wxWindowDisabler(wxWindow *winToSkip, wxWindow *winToSkip2)
|
||||
|
||||
DoDisable();
|
||||
|
||||
#if defined(__WXOSX__) && wxOSX_USE_COCOA
|
||||
#if defined(__WXOSX__) && defined(wxOSX_USE_COCOA) && wxOSX_USE_COCOA
|
||||
AfterDisable(winToSkip);
|
||||
#endif
|
||||
}
|
||||
@@ -1563,7 +1563,7 @@ wxWindowDisabler::~wxWindowDisabler()
|
||||
if ( !m_disabled )
|
||||
return;
|
||||
|
||||
#if defined(__WXOSX__) && wxOSX_USE_COCOA
|
||||
#if defined(__WXOSX__) && defined(wxOSX_USE_COCOA) && wxOSX_USE_COCOA
|
||||
BeforeEnable();
|
||||
#endif
|
||||
|
||||
|
||||
@@ -18,7 +18,7 @@
|
||||
#include "wx/gtk/private/string.h"
|
||||
#include "wx/gtk/private/object.h"
|
||||
|
||||
#if defined(__UNIX__)
|
||||
#if defined(__UNIX__) && !defined(__DARWIN__)
|
||||
wxString wxGTKMimeTypesManagerImpl::GetIconFromMimeType(const wxString& mime)
|
||||
{
|
||||
wxString icon;
|
||||
|
||||
@@ -28,19 +28,6 @@
|
||||
#include "wx/fontutil.h"
|
||||
#include "wx/private/bmpbndl.h"
|
||||
|
||||
#ifdef __WXMAC__
|
||||
|
||||
wxMacAutoreleasePool::wxMacAutoreleasePool()
|
||||
{
|
||||
m_pool = [[NSAutoreleasePool alloc] init];
|
||||
}
|
||||
|
||||
wxMacAutoreleasePool::~wxMacAutoreleasePool()
|
||||
{
|
||||
[(NSAutoreleasePool*)m_pool release];
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
#if wxOSX_USE_COCOA
|
||||
|
||||
@@ -72,26 +59,6 @@ CGContextRef wxOSXGetContextFromCurrentContext()
|
||||
|
||||
#endif
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// NSObject Utils
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
void wxMacCocoaRelease( void* obj )
|
||||
{
|
||||
[(NSObject*)obj release];
|
||||
}
|
||||
|
||||
void wxMacCocoaAutorelease( void* obj )
|
||||
{
|
||||
[(NSObject*)obj autorelease];
|
||||
}
|
||||
|
||||
void* wxMacCocoaRetain( void* obj )
|
||||
{
|
||||
[(NSObject*)obj retain];
|
||||
return obj;
|
||||
}
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// NSFont Utils
|
||||
// ----------------------------------------------------------------------------
|
||||
@@ -699,20 +666,6 @@ wxPoint wxMacCocoaGetCursorHotSpot(WX_NSCursor cursor)
|
||||
}
|
||||
#endif
|
||||
|
||||
//---------------------------------------------------------
|
||||
// helper functions for NSString<->wxString conversion
|
||||
//---------------------------------------------------------
|
||||
|
||||
wxString wxStringWithNSString(NSString *nsstring)
|
||||
{
|
||||
return wxString([nsstring UTF8String], wxConvUTF8);
|
||||
}
|
||||
|
||||
NSString* wxNSStringWithWxString(const wxString &wxstring)
|
||||
{
|
||||
return [NSString stringWithUTF8String: wxstring.mb_str(wxConvUTF8)];
|
||||
}
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// helper class for getting the correct system colors according to the
|
||||
// appearance in effect
|
||||
|
||||
@@ -41,7 +41,7 @@ wxSocketManager *wxOSXSocketManagerCF = nullptr;
|
||||
// our OS version is the same in non GUI and GUI cases
|
||||
wxOperatingSystemId wxGetOsVersion(int *verMaj, int *verMin, int *verMicro)
|
||||
{
|
||||
#if wxHAS_NSPROCESSINFO
|
||||
#ifdef wxHAS_NSPROCESSINFO
|
||||
NSOperatingSystemVersion osVer = [NSProcessInfo processInfo].operatingSystemVersion;
|
||||
|
||||
if ( verMaj != nullptr )
|
||||
@@ -73,7 +73,7 @@ wxOperatingSystemId wxGetOsVersion(int *verMaj, int *verMin, int *verMicro)
|
||||
|
||||
bool wxCheckOsVersion(int majorVsn, int minorVsn, int microVsn)
|
||||
{
|
||||
#if wxHAS_NSPROCESSINFO
|
||||
#ifdef wxHAS_NSPROCESSINFO
|
||||
NSOperatingSystemVersion osVer;
|
||||
osVer.majorVersion = majorVsn;
|
||||
osVer.minorVersion = minorVsn;
|
||||
@@ -96,7 +96,7 @@ wxString wxGetOsDescription()
|
||||
int majorVer, minorVer;
|
||||
wxGetOsVersion(&majorVer, &minorVer);
|
||||
|
||||
#ifndef __WXOSX_IPHONE__
|
||||
#ifdef __WXDARWIN_OSX__
|
||||
// Notice that neither the OS name itself nor the code names seem to be
|
||||
// ever translated, OS X itself uses the English words even for the
|
||||
// languages not using Roman alphabet.
|
||||
@@ -197,7 +197,7 @@ bool wxDateTime::GetFirstWeekDay(wxDateTime::WeekDay *firstDay)
|
||||
}
|
||||
#endif // wxUSE_DATETIME
|
||||
|
||||
#ifndef __WXOSX_IPHONE__
|
||||
#ifdef __WXDARWIN_OSX__
|
||||
|
||||
#include <AppKit/AppKit.h>
|
||||
|
||||
@@ -278,11 +278,16 @@ bool wxCocoaLaunch(const char* const* argv, pid_t &pid)
|
||||
|
||||
NSRunningApplication *app = nil;
|
||||
|
||||
if ( [params count] > 0 )
|
||||
app = [ws openURLs:params withApplicationAtURL:url
|
||||
options:NSWorkspaceLaunchAsync
|
||||
configuration:[NSDictionary dictionary]
|
||||
error:&error];
|
||||
#if __MAC_OS_X_VERSION_MAX_ALLOWED >= 101000
|
||||
if ( WX_IS_MACOS_AVAILABLE(10, 10) )
|
||||
{
|
||||
if ( [params count] > 0 )
|
||||
app = [ws openURLs:params withApplicationAtURL:url
|
||||
options:NSWorkspaceLaunchAsync
|
||||
configuration:[NSDictionary dictionary]
|
||||
error:&error];
|
||||
}
|
||||
#endif
|
||||
|
||||
if ( app == nil )
|
||||
{
|
||||
@@ -325,3 +330,62 @@ int wxCMPFUNC_CONV wxCmpNatural(const wxString& s1, const wxString& s2)
|
||||
// expected return values of wxCmpNatural(), so we don't need to convert.
|
||||
return [wxCFStringRef(s1).AsNSString() localizedStandardCompare: wxCFStringRef(s2).AsNSString()];
|
||||
}
|
||||
|
||||
wxMacAutoreleasePool::wxMacAutoreleasePool()
|
||||
{
|
||||
m_pool = [[NSAutoreleasePool alloc] init];
|
||||
}
|
||||
|
||||
wxMacAutoreleasePool::~wxMacAutoreleasePool()
|
||||
{
|
||||
[(NSAutoreleasePool*)m_pool release];
|
||||
}
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// NSObject Utils
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
void wxMacCocoaRelease( void* obj )
|
||||
{
|
||||
[(NSObject*)obj release];
|
||||
}
|
||||
|
||||
void wxMacCocoaAutorelease( void* obj )
|
||||
{
|
||||
[(NSObject*)obj autorelease];
|
||||
}
|
||||
|
||||
void* wxMacCocoaRetain( void* obj )
|
||||
{
|
||||
[(NSObject*)obj retain];
|
||||
return obj;
|
||||
}
|
||||
|
||||
//---------------------------------------------------------
|
||||
// helper functions for NSString<->wxString conversion
|
||||
//---------------------------------------------------------
|
||||
|
||||
wxString wxStringWithNSString(NSString *nsstring)
|
||||
{
|
||||
return wxString([nsstring UTF8String], wxConvUTF8);
|
||||
}
|
||||
|
||||
NSString* wxNSStringWithWxString(const wxString &wxstring)
|
||||
{
|
||||
return [NSString stringWithUTF8String: wxstring.mb_str(wxConvUTF8)];
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
// helper when starting as a command line tool without an NSApp running at all
|
||||
//----------------------------------------------------------------------------
|
||||
|
||||
#ifdef __WXDARWIN_OSX__
|
||||
|
||||
bool wxMacInitCocoa()
|
||||
{
|
||||
bool cocoaLoaded = NSApplicationLoad();
|
||||
wxASSERT_MSG(cocoaLoaded,wxT("Couldn't load Cocoa Environment as console app")) ;
|
||||
return cocoaLoaded;
|
||||
}
|
||||
|
||||
#endif // __WXDARWIN_OSX__
|
||||
|
||||
@@ -426,7 +426,17 @@ void wxMimeTypesManagerImpl::LoadDisplayDataForUti(const wxString& uti)
|
||||
wxCFStringRef ext = UTTypeCopyPreferredTagWithClass( cfuti, kUTTagClassFilenameExtension );
|
||||
|
||||
// Look up the preferred application
|
||||
wxCFRef<CFURLRef> appUrl = LSCopyDefaultApplicationURLForContentType( cfuti, kLSRolesAll, nullptr);
|
||||
wxCFRef<CFURLRef> appUrl;
|
||||
#if MAC_OS_X_VERSION_MIN_REQUIRED < MAC_OS_X_VERSION_10_10
|
||||
CFURLRef aurl;
|
||||
// THIS FUNCTION, DESPITE ITS NAME, RETAINS THE URL REFERENCE ON BEHALF OF THE CALLER.
|
||||
OSStatus status = LSGetApplicationForInfo( kLSUnknownType, kLSUnknownCreator, ext, kLSRolesAll, nullptr, &aurl );
|
||||
if( status != noErr )
|
||||
return;
|
||||
appUrl.reset(aurl);
|
||||
#else
|
||||
appUrl.reset(LSCopyDefaultApplicationURLForContentType( cfuti, kLSRolesAll, nullptr));
|
||||
#endif
|
||||
|
||||
if( !appUrl )
|
||||
return;
|
||||
|
||||
+23
-17
@@ -43,7 +43,7 @@ NSLocale* wxGetCurrentNSLocale()
|
||||
{
|
||||
if (!gs_currentNSLocale)
|
||||
{
|
||||
static wxCFRef<NSLocale*> stdCLocale([[NSLocale localeWithLocaleIdentifier:@"en_US_POSIX"] retain]);
|
||||
static wxCFRef<NSLocale*> stdCLocale([[NSLocale alloc] initWithLocaleIdentifier:@"en_US_POSIX"]);
|
||||
gs_currentNSLocale = stdCLocale;
|
||||
}
|
||||
return gs_currentNSLocale;
|
||||
@@ -103,8 +103,11 @@ public:
|
||||
// completely invalid strings, so we need to check if the name is
|
||||
// actually in the list of the supported locales ourselves.
|
||||
bool isAvailable = false;
|
||||
for ( id nsLocId in [NSLocale availableLocaleIdentifiers] )
|
||||
NSArray* availableLocaleIds = [NSLocale availableLocaleIdentifiers];
|
||||
|
||||
for (NSUInteger i = 0; i < [availableLocaleIds count]; i++)
|
||||
{
|
||||
NSString* nsLocId = [availableLocaleIds objectAtIndex:i];
|
||||
// We can't simply compare the names here because the list returned
|
||||
// by NSLocale is incomplete and doesn't contain all synonyms, e.g.
|
||||
// it only contains "zh_Hant_TW" but not "zh_TW" itself, so we need
|
||||
@@ -146,10 +149,12 @@ public:
|
||||
return nullptr;
|
||||
|
||||
wxCFStringRef cfName(locId.GetName());
|
||||
auto nsloc = [NSLocale localeWithLocaleIdentifier: cfName.AsNSString()];
|
||||
NSLocale* nsloc = [[NSLocale alloc] initWithLocaleIdentifier:cfName.AsNSString()];
|
||||
if ( !nsloc )
|
||||
return nullptr;
|
||||
|
||||
[nsloc autorelease];
|
||||
|
||||
return new wxUILocaleImplCF(nsloc);
|
||||
}
|
||||
|
||||
@@ -239,17 +244,17 @@ wxUILocaleImplCF::GetLocalizedName(wxLocaleName name, wxLocaleForm form) const
|
||||
return wxString();
|
||||
}
|
||||
|
||||
NSString* str = nullptr;
|
||||
NSString* str = nil;
|
||||
switch (name)
|
||||
{
|
||||
case wxLOCALE_NAME_LOCALE:
|
||||
str = [convLocale localizedStringForLocaleIdentifier:[m_nsloc localeIdentifier]];
|
||||
str = [convLocale displayNameForKey:NSLocaleIdentifier value:[m_nsloc objectForKey:NSLocaleIdentifier]];
|
||||
break;
|
||||
case wxLOCALE_NAME_LANGUAGE:
|
||||
str = [convLocale localizedStringForLanguageCode:[m_nsloc languageCode]];
|
||||
str = [convLocale displayNameForKey:NSLocaleLanguageCode value:[m_nsloc objectForKey:NSLocaleLanguageCode]];
|
||||
break;
|
||||
case wxLOCALE_NAME_COUNTRY:
|
||||
str = [convLocale localizedStringForCountryCode:[m_nsloc countryCode]];
|
||||
str = [convLocale displayNameForKey:NSLocaleCountryCode value:[m_nsloc objectForKey:NSLocaleCountryCode]];
|
||||
break;
|
||||
}
|
||||
return wxCFStringRef::AsString(str);
|
||||
@@ -350,7 +355,7 @@ wxUILocaleImplCF::GetWeekDayName(wxDateTime::WeekDay weekday, wxDateTime::NameFo
|
||||
wxLayoutDirection
|
||||
wxUILocaleImplCF::GetLayoutDirection() const
|
||||
{
|
||||
NSLocaleLanguageDirection layoutDirection = [NSLocale characterDirectionForLanguage:[m_nsloc languageCode]];
|
||||
NSLocaleLanguageDirection layoutDirection = [NSLocale characterDirectionForLanguage:[m_nsloc objectForKey:NSLocaleLanguageCode]];
|
||||
if (layoutDirection == NSLocaleLanguageDirectionLeftToRight)
|
||||
return wxLayout_LeftToRight;
|
||||
else if (layoutDirection == NSLocaleLanguageDirectionRightToLeft)
|
||||
@@ -367,14 +372,14 @@ wxUILocaleImplCF::GetNumberFormatting() const
|
||||
wxString
|
||||
wxUILocaleImplCF::GetCurrencySymbol() const
|
||||
{
|
||||
NSString* str = [m_nsloc currencySymbol];
|
||||
NSString* str = [m_nsloc objectForKey:NSLocaleCurrencySymbol];
|
||||
return wxCFStringRef::AsString(str);
|
||||
}
|
||||
|
||||
wxString
|
||||
wxUILocaleImplCF::GetCurrencyCode() const
|
||||
{
|
||||
NSString* str = [m_nsloc currencyCode];
|
||||
NSString* str = [m_nsloc objectForKey:NSLocaleCurrencyCode];
|
||||
return wxCFStringRef::AsString(str);
|
||||
}
|
||||
|
||||
@@ -386,7 +391,7 @@ wxUILocaleImplCF::GetCurrencySymbolPosition() const
|
||||
formatter.locale = m_nsloc;
|
||||
formatter.numberStyle = NSNumberFormatterCurrencyStyle;
|
||||
|
||||
NSString* formatted = [formatter stringFromNumber:@123];
|
||||
NSString* formatted = [formatter stringFromNumber:[NSNumber numberWithInt:123]];
|
||||
NSString* symbol = formatter.currencySymbol;
|
||||
|
||||
NSRange symbolRange = [formatted rangeOfString:symbol];
|
||||
@@ -478,7 +483,7 @@ wxUILocaleImplCF::UsesMetricSystem() const
|
||||
{
|
||||
if ([m_nsloc respondsToSelector:@selector(usesMetricSystem)])
|
||||
{
|
||||
BOOL isMetric = [m_nsloc usesMetricSystem];
|
||||
BOOL isMetric = [(NSNumber*) [m_nsloc objectForKey:NSLocaleUsesMetricSystem] boolValue];
|
||||
return (isMetric) ? wxMeasurementSystem::Metric : wxMeasurementSystem::NonMetric;
|
||||
}
|
||||
return wxMeasurementSystem::Unknown;
|
||||
@@ -492,7 +497,7 @@ wxUILocaleImpl* wxUILocaleImpl::CreateStdC()
|
||||
// wouldn't be much better as we'd still need a hack for it in GetName()
|
||||
// because the locale names are always converted to lower case, while we
|
||||
// really want to return "C" rather than "c" as the name of this one.
|
||||
return new wxUILocaleImplCF([NSLocale localeWithLocaleIdentifier:@"en_US_POSIX"]);
|
||||
return new wxUILocaleImplCF([[[NSLocale alloc] initWithLocaleIdentifier:@"en_US_POSIX"] autorelease]);
|
||||
}
|
||||
|
||||
/* static */
|
||||
@@ -512,10 +517,11 @@ wxVector<wxString> wxUILocaleImpl::GetPreferredUILanguages()
|
||||
{
|
||||
wxVector<wxString> preferred;
|
||||
NSArray* preferredLangs = [NSLocale preferredLanguages];
|
||||
NSUInteger count = preferredLangs.count;
|
||||
|
||||
for (NSUInteger j = 0; j < count; ++j)
|
||||
preferred.push_back(wxCFStringRef::AsString(preferredLangs[j]));
|
||||
for (NSUInteger i = 0; i < [preferredLangs count]; i++) \
|
||||
{
|
||||
NSString* preferredLang = [preferredLangs objectAtIndex:i];
|
||||
preferred.push_back(wxCFStringRef::AsString(preferredLang));
|
||||
}
|
||||
|
||||
return preferred;
|
||||
}
|
||||
|
||||
+16
-6
@@ -35,13 +35,22 @@
|
||||
#import <Foundation/NSFileManager.h>
|
||||
#import <Foundation/NSURL.h>
|
||||
|
||||
#if __MAC_OS_X_VERSION_MAX_ALLOWED < MAC_OS_X_VERSION_10_7
|
||||
|
||||
#define NSURLVolumeLocalizedNameKey @"NSURLVolumeLocalizedNameKey"
|
||||
#define NSURLVolumeIsLocalKey @"NSURLVolumeIsLocalKey"
|
||||
#define NSURLVolumeIsReadOnlyKey @"NSURLVolumeIsReadOnlyKey"
|
||||
#define NSURLVolumeIsRemovableKey @"NSURLVolumeIsRemovableKey"
|
||||
|
||||
#endif
|
||||
|
||||
//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
|
||||
// wxFSVolume
|
||||
//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
|
||||
|
||||
wxArrayString wxFSVolumeBase::GetVolumes(int flagsSet, int flagsUnset)
|
||||
{
|
||||
auto nativeVolumes = [[NSFileManager defaultManager]
|
||||
NSArray* nativeVolumes = [[NSFileManager defaultManager]
|
||||
mountedVolumeURLsIncludingResourceValuesForKeys:nil
|
||||
options:NSVolumeEnumerationSkipHiddenVolumes];
|
||||
|
||||
@@ -56,9 +65,10 @@ wxArrayString wxFSVolumeBase::GetVolumes(int flagsSet, int flagsUnset)
|
||||
}
|
||||
else
|
||||
{
|
||||
for (NSURL* url in nativeVolumes)
|
||||
for (NSUInteger i = 0; i < [nativeVolumes count]; i++) \
|
||||
{
|
||||
wxFSVolumeBase volume(url.fileSystemRepresentation);
|
||||
NSURL* url = [nativeVolumes objectAtIndex:i];
|
||||
wxFSVolumeBase volume([[url path] fileSystemRepresentation]);
|
||||
int flags = volume.GetFlags();
|
||||
if ((flags & flagsSet) == flagsSet && !(flags & flagsUnset))
|
||||
volumePaths.push_back(volume.GetName());
|
||||
@@ -87,7 +97,7 @@ bool wxFSVolumeBase::Create(const wxString& name)
|
||||
m_volName = name;
|
||||
|
||||
NSURL* url = [NSURL fileURLWithPath:wxCFStringRef(name).AsNSString()];
|
||||
auto values = [url resourceValuesForKeys:@[NSURLVolumeLocalizedNameKey] error:nil];
|
||||
NSDictionary* values = [url resourceValuesForKeys:[NSArray arrayWithObjects: NSURLVolumeLocalizedNameKey, nil] error:nil];
|
||||
if (values)
|
||||
{
|
||||
m_isOk = true;
|
||||
@@ -105,7 +115,7 @@ bool wxFSVolumeBase::IsOk() const
|
||||
wxFSVolumeKind wxFSVolumeBase::GetKind() const
|
||||
{
|
||||
NSURL* url = [NSURL fileURLWithPath:wxCFStringRef(GetName()).AsNSString()];
|
||||
auto values = [url resourceValuesForKeys:@[NSURLVolumeIsLocalKey, NSURLVolumeIsReadOnlyKey] error:nil];
|
||||
NSDictionary* values = [url resourceValuesForKeys:[NSArray arrayWithObjects: NSURLVolumeIsLocalKey, NSURLVolumeIsReadOnlyKey, nil] error:nil];
|
||||
|
||||
// Assume disk for local volumes
|
||||
if ([(NSNumber*)[values objectForKey:NSURLVolumeIsLocalKey] boolValue])
|
||||
@@ -122,7 +132,7 @@ wxFSVolumeKind wxFSVolumeBase::GetKind() const
|
||||
int wxFSVolumeBase::GetFlags() const
|
||||
{
|
||||
NSURL* url = [NSURL fileURLWithPath:wxCFStringRef(GetName()).AsNSString()];
|
||||
auto values = [url resourceValuesForKeys:@[NSURLVolumeIsRemovableKey, NSURLVolumeIsLocalKey, NSURLVolumeIsReadOnlyKey] error:nil];
|
||||
NSDictionary* values = [url resourceValuesForKeys:[NSArray arrayWithObjects: NSURLVolumeIsRemovableKey, NSURLVolumeIsLocalKey, NSURLVolumeIsReadOnlyKey, nil] error:nil];
|
||||
if (values)
|
||||
{
|
||||
// mounted status cannot be determined, assume mounted
|
||||
|
||||
@@ -506,9 +506,9 @@ wxWebSessionURLSession::~wxWebSessionURLSession()
|
||||
{
|
||||
[m_session release];
|
||||
[m_delegate release];
|
||||
#if !wxOSX_USE_IPHONE
|
||||
#ifdef __WXDARWIN_OSX__
|
||||
[m_proxyURL release];
|
||||
#endif // !wxOSX_USE_IPHONE
|
||||
#endif // __WXDARWIN_OSX__
|
||||
}
|
||||
|
||||
wxWebRequestImplPtr
|
||||
@@ -542,10 +542,10 @@ wxVersionInfo wxWebSessionURLSession::GetLibraryVersionInfo() const
|
||||
|
||||
bool wxWebSessionURLSession::SetProxy(const wxWebProxy& proxy)
|
||||
{
|
||||
#if wxOSX_USE_IPHONE
|
||||
#ifndef __WXDARWIN_OSX__
|
||||
// Setting the proxy doesn't seem to be supported under iOS.
|
||||
return false;
|
||||
#else // !wxOSX_USE_IPHONE
|
||||
#else // !__WXDARWIN_OSX__
|
||||
wxCHECK_MSG( !m_session, false,
|
||||
"Proxy must be set before the first request is made" );
|
||||
|
||||
@@ -621,7 +621,7 @@ bool wxWebSessionURLSession::SetProxy(const wxWebProxy& proxy)
|
||||
}
|
||||
|
||||
return wxWebSessionImpl::SetProxy(proxy);
|
||||
#endif // wxOSX_USE_IPHONE/!wxOSX_USE_IPHONE
|
||||
#endif // __WXDARWIN_OSX__
|
||||
}
|
||||
|
||||
bool wxWebSessionURLSession::EnablePersistentStorage(bool enable)
|
||||
@@ -641,7 +641,7 @@ WX_NSURLSession wxWebSessionURLSession::GetSession()
|
||||
[NSURLSessionConfiguration defaultSessionConfiguration] :
|
||||
[NSURLSessionConfiguration ephemeralSessionConfiguration];
|
||||
|
||||
#if !wxOSX_USE_IPHONE
|
||||
#ifdef __WXDARWIN_OSX__
|
||||
switch ( GetProxy().GetType() )
|
||||
{
|
||||
case wxWebProxy::Type::URL:
|
||||
@@ -670,7 +670,7 @@ WX_NSURLSession wxWebSessionURLSession::GetSession()
|
||||
// Nothing to do, system proxy will be used by default.
|
||||
break;
|
||||
}
|
||||
#endif // !wxOSX_USE_IPHONE
|
||||
#endif // __WXDARWIN_OSX__
|
||||
|
||||
m_session = [[NSURLSession sessionWithConfiguration:config delegate:m_delegate delegateQueue:nil] retain];
|
||||
}
|
||||
|
||||
@@ -20,6 +20,10 @@
|
||||
#include "wx/private/fdiodispatcher.h"
|
||||
#include "wx/private/fdioeventloopsourcehandler.h"
|
||||
|
||||
#ifdef __DARWIN__
|
||||
#include "wx/osx/private.h"
|
||||
#endif
|
||||
|
||||
#include <signal.h>
|
||||
#include <unistd.h>
|
||||
|
||||
@@ -86,6 +90,14 @@ wxAppConsole::~wxAppConsole()
|
||||
// same names
|
||||
bool wxAppConsole::Initialize(int& argc_, wxChar** argv_)
|
||||
{
|
||||
#ifdef __DARWIN__
|
||||
// On command line apps on macOS we need to initialize Cocoa framework
|
||||
wxMacAutoreleasePool autoreleasepool;
|
||||
#ifdef __WXDARWIN_OSX__
|
||||
wxMacInitCocoa();
|
||||
#endif
|
||||
#endif // __DARWIN__
|
||||
|
||||
if ( !wxAppConsoleBase::Initialize(argc_, argv_) )
|
||||
return false;
|
||||
|
||||
|
||||
@@ -489,7 +489,7 @@ private:
|
||||
// wxExecute implementations
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
#if defined(__DARWIN__) && !defined(__WXOSX_IPHONE__)
|
||||
#ifdef __WXDARWIN_OSX__
|
||||
bool wxCocoaLaunch(const char* const* argv, pid_t &pid);
|
||||
#endif
|
||||
|
||||
@@ -610,7 +610,7 @@ long wxExecute(const char* const* argv, int flags, wxProcess* process,
|
||||
wxT("wxExecute() can be called only from the main thread") );
|
||||
#endif // wxUSE_THREADS
|
||||
pid_t pid;
|
||||
#if defined(__DARWIN__) && !defined(__WXOSX_IPHONE__)
|
||||
#ifdef __WXDARWIN_OSX__
|
||||
pid = -1;
|
||||
// wxCocoaLaunch() only executes app bundles and only does it asynchronously.
|
||||
// It returns false if the target is not an app bundle, thus falling
|
||||
|
||||
Reference in New Issue
Block a user