Merge branch 'osx-no-iconref'

Switch to using CGBitmapContext instead of IconRef for wxBitmap
implementation in wxOSX.

Closes https://github.com/wxWidgets/wxWidgets/pull/925
This commit is contained in:
Vadim Zeitlin
2018-09-24 00:14:28 +02:00
20 changed files with 937 additions and 679 deletions

View File

@@ -3305,7 +3305,6 @@ COND_TOOLKIT_OSX_COCOA_GUI_HDR = \
wx/osx/fontdlg.h \
wx/osx/frame.h \
wx/osx/gauge.h \
wx/osx/icon.h \
wx/osx/imaglist.h \
wx/osx/listbox.h \
wx/osx/listctrl.h \
@@ -3359,6 +3358,7 @@ COND_TOOLKIT_OSX_COCOA_GUI_HDR = \
wx/generic/prntdlgg.h \
wx/generic/statusbr.h \
wx/osx/appprogress.h \
wx/generic/icon.h \
wx/osx/cocoa/chkconf.h \
wx/osx/cocoa/evtloop.h \
wx/osx/cocoa/private.h \
@@ -3415,7 +3415,6 @@ COND_TOOLKIT_OSX_IPHONE_GUI_HDR = \
wx/osx/fontdlg.h \
wx/osx/frame.h \
wx/osx/gauge.h \
wx/osx/icon.h \
wx/osx/imaglist.h \
wx/osx/listbox.h \
wx/osx/listctrl.h \
@@ -3469,6 +3468,7 @@ COND_TOOLKIT_OSX_IPHONE_GUI_HDR = \
wx/generic/prntdlgg.h \
wx/generic/statusbr.h \
wx/osx/appprogress.h \
wx/generic/icon.h \
wx/osx/iphone/chkconf.h \
wx/osx/iphone/evtloop.h \
wx/osx/iphone/private.h \
@@ -5610,7 +5610,6 @@ COND_TOOLKIT_OSX_COCOA___GUI_SRC_OBJECTS = \
COND_TOOLKIT_OSX_IPHONE___GUI_SRC_OBJECTS = \
$(__OSX_COMMON_SRC_OBJECTS) \
monodll_regiong.o \
monodll_generic_icon.o \
monodll_iphone_anybutton.o \
monodll_iphone_button.o \
monodll_iphone_checkbox.o \
@@ -7574,7 +7573,6 @@ COND_TOOLKIT_OSX_COCOA___GUI_SRC_OBJECTS_1 = \
COND_TOOLKIT_OSX_IPHONE___GUI_SRC_OBJECTS_1 = \
$(__OSX_COMMON_SRC_OBJECTS_0) \
monolib_regiong.o \
monolib_generic_icon.o \
monolib_iphone_anybutton.o \
monolib_iphone_button.o \
monolib_iphone_checkbox.o \
@@ -9685,7 +9683,6 @@ COND_TOOLKIT_OSX_COCOA___GUI_SRC_OBJECTS_2 = \
COND_TOOLKIT_OSX_IPHONE___GUI_SRC_OBJECTS_2 = \
$(__OSX_COMMON_SRC_OBJECTS_8) \
coredll_regiong.o \
coredll_generic_icon.o \
coredll_iphone_anybutton.o \
coredll_iphone_button.o \
coredll_iphone_checkbox.o \
@@ -11391,7 +11388,6 @@ COND_TOOLKIT_OSX_COCOA___GUI_SRC_OBJECTS_3 = \
COND_TOOLKIT_OSX_IPHONE___GUI_SRC_OBJECTS_3 = \
$(__OSX_COMMON_SRC_OBJECTS_9) \
corelib_regiong.o \
corelib_generic_icon.o \
corelib_iphone_anybutton.o \
corelib_iphone_button.o \
corelib_iphone_checkbox.o \
@@ -13093,7 +13089,6 @@ COND_PLATFORM_MACOSX_1___OSX_COMMON_SRC_OBJECTS = \
monodll_carbon_cursor.o \
monodll_carbon_fontdlg.o \
monodll_carbon_gdiobj.o \
monodll_carbon_icon.o \
monodll_carbon_app.o \
monodll_carbon_control.o \
monodll_carbon_dataobj.o \
@@ -13123,7 +13118,8 @@ COND_PLATFORM_MACOSX_1___OSX_COMMON_SRC_OBJECTS = \
monodll_generic_listctrl.o \
monodll_prntdlgg.o \
monodll_generic_statusbr.o \
monodll_generic_textmeasure.o
monodll_generic_textmeasure.o \
monodll_generic_icon.o
@COND_PLATFORM_MACOSX_1@__OSX_COMMON_SRC_OBJECTS = $(COND_PLATFORM_MACOSX_1___OSX_COMMON_SRC_OBJECTS)
COND_PLATFORM_MACOSX_1___GTK_PLATFORM_SRC_OBJECTS = \
monodll_generic_caret.o \
@@ -13236,7 +13232,6 @@ COND_PLATFORM_MACOSX_1___OSX_COMMON_SRC_OBJECTS_0 = \
monolib_carbon_cursor.o \
monolib_carbon_fontdlg.o \
monolib_carbon_gdiobj.o \
monolib_carbon_icon.o \
monolib_carbon_app.o \
monolib_carbon_control.o \
monolib_carbon_dataobj.o \
@@ -13266,7 +13261,8 @@ COND_PLATFORM_MACOSX_1___OSX_COMMON_SRC_OBJECTS_0 = \
monolib_generic_listctrl.o \
monolib_prntdlgg.o \
monolib_generic_statusbr.o \
monolib_generic_textmeasure.o
monolib_generic_textmeasure.o \
monolib_generic_icon.o
@COND_PLATFORM_MACOSX_1@__OSX_COMMON_SRC_OBJECTS_0 = $(COND_PLATFORM_MACOSX_1___OSX_COMMON_SRC_OBJECTS_0)
COND_PLATFORM_MACOSX_1___GTK_PLATFORM_SRC_OBJECTS_27 = \
monolib_generic_caret.o \
@@ -13379,7 +13375,6 @@ COND_PLATFORM_MACOSX_1___OSX_COMMON_SRC_OBJECTS_8 = \
coredll_carbon_cursor.o \
coredll_carbon_fontdlg.o \
coredll_carbon_gdiobj.o \
coredll_carbon_icon.o \
coredll_carbon_app.o \
coredll_carbon_control.o \
coredll_carbon_dataobj.o \
@@ -13409,7 +13404,8 @@ COND_PLATFORM_MACOSX_1___OSX_COMMON_SRC_OBJECTS_8 = \
coredll_generic_listctrl.o \
coredll_prntdlgg.o \
coredll_generic_statusbr.o \
coredll_generic_textmeasure.o
coredll_generic_textmeasure.o \
coredll_generic_icon.o
@COND_PLATFORM_MACOSX_1@__OSX_COMMON_SRC_OBJECTS_8 = $(COND_PLATFORM_MACOSX_1___OSX_COMMON_SRC_OBJECTS_8)
COND_PLATFORM_MACOSX_1___GTK_PLATFORM_SRC_OBJECTS_1_4 = \
coredll_generic_caret.o \
@@ -13519,7 +13515,6 @@ COND_PLATFORM_MACOSX_1___OSX_COMMON_SRC_OBJECTS_9 = \
corelib_carbon_cursor.o \
corelib_carbon_fontdlg.o \
corelib_carbon_gdiobj.o \
corelib_carbon_icon.o \
corelib_carbon_app.o \
corelib_carbon_control.o \
corelib_carbon_dataobj.o \
@@ -13549,7 +13544,8 @@ COND_PLATFORM_MACOSX_1___OSX_COMMON_SRC_OBJECTS_9 = \
corelib_generic_listctrl.o \
corelib_prntdlgg.o \
corelib_generic_statusbr.o \
corelib_generic_textmeasure.o
corelib_generic_textmeasure.o \
corelib_generic_icon.o
@COND_PLATFORM_MACOSX_1@__OSX_COMMON_SRC_OBJECTS_9 = $(COND_PLATFORM_MACOSX_1___OSX_COMMON_SRC_OBJECTS_9)
COND_PLATFORM_MACOSX_1___GTK_PLATFORM_SRC_OBJECTS_2_2 = \
corelib_generic_caret.o \
@@ -17981,8 +17977,11 @@ monodll_sound_sdl.o: $(srcdir)/src/unix/sound_sdl.cpp $(MONODLL_ODEP)
@COND_TOOLKIT_MSW_USE_GUI_1@monodll_msw_joystick.o: $(srcdir)/src/msw/joystick.cpp $(MONODLL_ODEP)
@COND_TOOLKIT_MSW_USE_GUI_1@ $(CXXC) -c -o $@ $(MONODLL_CXXFLAGS) $(srcdir)/src/msw/joystick.cpp
@COND_TOOLKIT_OSX_IPHONE_USE_GUI_1_WXUNIV_0@monodll_generic_icon.o: $(srcdir)/src/generic/icon.cpp $(MONODLL_ODEP)
@COND_TOOLKIT_OSX_IPHONE_USE_GUI_1_WXUNIV_0@ $(CXXC) -c -o $@ $(MONODLL_CXXFLAGS) $(srcdir)/src/generic/icon.cpp
@COND_PLATFORM_MACOSX_1_TOOLKIT_OSX_COCOA_USE_GUI_1_WXUNIV_0@monodll_generic_icon.o: $(srcdir)/src/generic/icon.cpp $(MONODLL_ODEP)
@COND_PLATFORM_MACOSX_1_TOOLKIT_OSX_COCOA_USE_GUI_1_WXUNIV_0@ $(CXXC) -c -o $@ $(MONODLL_CXXFLAGS) $(srcdir)/src/generic/icon.cpp
@COND_PLATFORM_MACOSX_1_TOOLKIT_OSX_IPHONE_USE_GUI_1_WXUNIV_0@monodll_generic_icon.o: $(srcdir)/src/generic/icon.cpp $(MONODLL_ODEP)
@COND_PLATFORM_MACOSX_1_TOOLKIT_OSX_IPHONE_USE_GUI_1_WXUNIV_0@ $(CXXC) -c -o $@ $(MONODLL_CXXFLAGS) $(srcdir)/src/generic/icon.cpp
@COND_TOOLKIT_QT_USE_GUI_1_WXUNIV_0@monodll_generic_icon.o: $(srcdir)/src/generic/icon.cpp $(MONODLL_ODEP)
@COND_TOOLKIT_QT_USE_GUI_1_WXUNIV_0@ $(CXXC) -c -o $@ $(MONODLL_CXXFLAGS) $(srcdir)/src/generic/icon.cpp
@@ -19922,12 +19921,6 @@ monodll_sound_sdl.o: $(srcdir)/src/unix/sound_sdl.cpp $(MONODLL_ODEP)
@COND_PLATFORM_MACOSX_1_TOOLKIT_OSX_IPHONE_USE_GUI_1_WXUNIV_0@monodll_carbon_gdiobj.o: $(srcdir)/src/osx/carbon/gdiobj.cpp $(MONODLL_ODEP)
@COND_PLATFORM_MACOSX_1_TOOLKIT_OSX_IPHONE_USE_GUI_1_WXUNIV_0@ $(CXXC) -c -o $@ $(MONODLL_CXXFLAGS) $(srcdir)/src/osx/carbon/gdiobj.cpp
@COND_PLATFORM_MACOSX_1_TOOLKIT_OSX_COCOA_USE_GUI_1_WXUNIV_0@monodll_carbon_icon.o: $(srcdir)/src/osx/carbon/icon.cpp $(MONODLL_ODEP)
@COND_PLATFORM_MACOSX_1_TOOLKIT_OSX_COCOA_USE_GUI_1_WXUNIV_0@ $(CXXC) -c -o $@ $(MONODLL_CXXFLAGS) $(srcdir)/src/osx/carbon/icon.cpp
@COND_PLATFORM_MACOSX_1_TOOLKIT_OSX_IPHONE_USE_GUI_1_WXUNIV_0@monodll_carbon_icon.o: $(srcdir)/src/osx/carbon/icon.cpp $(MONODLL_ODEP)
@COND_PLATFORM_MACOSX_1_TOOLKIT_OSX_IPHONE_USE_GUI_1_WXUNIV_0@ $(CXXC) -c -o $@ $(MONODLL_CXXFLAGS) $(srcdir)/src/osx/carbon/icon.cpp
@COND_PLATFORM_MACOSX_1_TOOLKIT_OSX_COCOA_USE_GUI_1_WXUNIV_0@monodll_carbon_app.o: $(srcdir)/src/osx/carbon/app.cpp $(MONODLL_ODEP)
@COND_PLATFORM_MACOSX_1_TOOLKIT_OSX_COCOA_USE_GUI_1_WXUNIV_0@ $(CXXC) -c -o $@ $(MONODLL_CXXFLAGS) $(srcdir)/src/osx/carbon/app.cpp
@@ -23222,8 +23215,11 @@ monolib_sound_sdl.o: $(srcdir)/src/unix/sound_sdl.cpp $(MONOLIB_ODEP)
@COND_TOOLKIT_MSW_USE_GUI_1@monolib_msw_joystick.o: $(srcdir)/src/msw/joystick.cpp $(MONOLIB_ODEP)
@COND_TOOLKIT_MSW_USE_GUI_1@ $(CXXC) -c -o $@ $(MONOLIB_CXXFLAGS) $(srcdir)/src/msw/joystick.cpp
@COND_TOOLKIT_OSX_IPHONE_USE_GUI_1_WXUNIV_0@monolib_generic_icon.o: $(srcdir)/src/generic/icon.cpp $(MONOLIB_ODEP)
@COND_TOOLKIT_OSX_IPHONE_USE_GUI_1_WXUNIV_0@ $(CXXC) -c -o $@ $(MONOLIB_CXXFLAGS) $(srcdir)/src/generic/icon.cpp
@COND_PLATFORM_MACOSX_1_TOOLKIT_OSX_COCOA_USE_GUI_1_WXUNIV_0@monolib_generic_icon.o: $(srcdir)/src/generic/icon.cpp $(MONOLIB_ODEP)
@COND_PLATFORM_MACOSX_1_TOOLKIT_OSX_COCOA_USE_GUI_1_WXUNIV_0@ $(CXXC) -c -o $@ $(MONOLIB_CXXFLAGS) $(srcdir)/src/generic/icon.cpp
@COND_PLATFORM_MACOSX_1_TOOLKIT_OSX_IPHONE_USE_GUI_1_WXUNIV_0@monolib_generic_icon.o: $(srcdir)/src/generic/icon.cpp $(MONOLIB_ODEP)
@COND_PLATFORM_MACOSX_1_TOOLKIT_OSX_IPHONE_USE_GUI_1_WXUNIV_0@ $(CXXC) -c -o $@ $(MONOLIB_CXXFLAGS) $(srcdir)/src/generic/icon.cpp
@COND_TOOLKIT_QT_USE_GUI_1_WXUNIV_0@monolib_generic_icon.o: $(srcdir)/src/generic/icon.cpp $(MONOLIB_ODEP)
@COND_TOOLKIT_QT_USE_GUI_1_WXUNIV_0@ $(CXXC) -c -o $@ $(MONOLIB_CXXFLAGS) $(srcdir)/src/generic/icon.cpp
@@ -25163,12 +25159,6 @@ monolib_sound_sdl.o: $(srcdir)/src/unix/sound_sdl.cpp $(MONOLIB_ODEP)
@COND_PLATFORM_MACOSX_1_TOOLKIT_OSX_IPHONE_USE_GUI_1_WXUNIV_0@monolib_carbon_gdiobj.o: $(srcdir)/src/osx/carbon/gdiobj.cpp $(MONOLIB_ODEP)
@COND_PLATFORM_MACOSX_1_TOOLKIT_OSX_IPHONE_USE_GUI_1_WXUNIV_0@ $(CXXC) -c -o $@ $(MONOLIB_CXXFLAGS) $(srcdir)/src/osx/carbon/gdiobj.cpp
@COND_PLATFORM_MACOSX_1_TOOLKIT_OSX_COCOA_USE_GUI_1_WXUNIV_0@monolib_carbon_icon.o: $(srcdir)/src/osx/carbon/icon.cpp $(MONOLIB_ODEP)
@COND_PLATFORM_MACOSX_1_TOOLKIT_OSX_COCOA_USE_GUI_1_WXUNIV_0@ $(CXXC) -c -o $@ $(MONOLIB_CXXFLAGS) $(srcdir)/src/osx/carbon/icon.cpp
@COND_PLATFORM_MACOSX_1_TOOLKIT_OSX_IPHONE_USE_GUI_1_WXUNIV_0@monolib_carbon_icon.o: $(srcdir)/src/osx/carbon/icon.cpp $(MONOLIB_ODEP)
@COND_PLATFORM_MACOSX_1_TOOLKIT_OSX_IPHONE_USE_GUI_1_WXUNIV_0@ $(CXXC) -c -o $@ $(MONOLIB_CXXFLAGS) $(srcdir)/src/osx/carbon/icon.cpp
@COND_PLATFORM_MACOSX_1_TOOLKIT_OSX_COCOA_USE_GUI_1_WXUNIV_0@monolib_carbon_app.o: $(srcdir)/src/osx/carbon/app.cpp $(MONOLIB_ODEP)
@COND_PLATFORM_MACOSX_1_TOOLKIT_OSX_COCOA_USE_GUI_1_WXUNIV_0@ $(CXXC) -c -o $@ $(MONOLIB_CXXFLAGS) $(srcdir)/src/osx/carbon/app.cpp
@@ -28556,8 +28546,11 @@ coredll_sound_sdl.o: $(srcdir)/src/unix/sound_sdl.cpp $(COREDLL_ODEP)
@COND_TOOLKIT_MSW_USE_GUI_1@coredll_msw_joystick.o: $(srcdir)/src/msw/joystick.cpp $(COREDLL_ODEP)
@COND_TOOLKIT_MSW_USE_GUI_1@ $(CXXC) -c -o $@ $(COREDLL_CXXFLAGS) $(srcdir)/src/msw/joystick.cpp
@COND_TOOLKIT_OSX_IPHONE_USE_GUI_1_WXUNIV_0@coredll_generic_icon.o: $(srcdir)/src/generic/icon.cpp $(COREDLL_ODEP)
@COND_TOOLKIT_OSX_IPHONE_USE_GUI_1_WXUNIV_0@ $(CXXC) -c -o $@ $(COREDLL_CXXFLAGS) $(srcdir)/src/generic/icon.cpp
@COND_PLATFORM_MACOSX_1_TOOLKIT_OSX_COCOA_USE_GUI_1_WXUNIV_0@coredll_generic_icon.o: $(srcdir)/src/generic/icon.cpp $(COREDLL_ODEP)
@COND_PLATFORM_MACOSX_1_TOOLKIT_OSX_COCOA_USE_GUI_1_WXUNIV_0@ $(CXXC) -c -o $@ $(COREDLL_CXXFLAGS) $(srcdir)/src/generic/icon.cpp
@COND_PLATFORM_MACOSX_1_TOOLKIT_OSX_IPHONE_USE_GUI_1_WXUNIV_0@coredll_generic_icon.o: $(srcdir)/src/generic/icon.cpp $(COREDLL_ODEP)
@COND_PLATFORM_MACOSX_1_TOOLKIT_OSX_IPHONE_USE_GUI_1_WXUNIV_0@ $(CXXC) -c -o $@ $(COREDLL_CXXFLAGS) $(srcdir)/src/generic/icon.cpp
@COND_TOOLKIT_QT_USE_GUI_1_WXUNIV_0@coredll_generic_icon.o: $(srcdir)/src/generic/icon.cpp $(COREDLL_ODEP)
@COND_TOOLKIT_QT_USE_GUI_1_WXUNIV_0@ $(CXXC) -c -o $@ $(COREDLL_CXXFLAGS) $(srcdir)/src/generic/icon.cpp
@@ -30497,12 +30490,6 @@ coredll_sound_sdl.o: $(srcdir)/src/unix/sound_sdl.cpp $(COREDLL_ODEP)
@COND_PLATFORM_MACOSX_1_TOOLKIT_OSX_IPHONE_USE_GUI_1_WXUNIV_0@coredll_carbon_gdiobj.o: $(srcdir)/src/osx/carbon/gdiobj.cpp $(COREDLL_ODEP)
@COND_PLATFORM_MACOSX_1_TOOLKIT_OSX_IPHONE_USE_GUI_1_WXUNIV_0@ $(CXXC) -c -o $@ $(COREDLL_CXXFLAGS) $(srcdir)/src/osx/carbon/gdiobj.cpp
@COND_PLATFORM_MACOSX_1_TOOLKIT_OSX_COCOA_USE_GUI_1_WXUNIV_0@coredll_carbon_icon.o: $(srcdir)/src/osx/carbon/icon.cpp $(COREDLL_ODEP)
@COND_PLATFORM_MACOSX_1_TOOLKIT_OSX_COCOA_USE_GUI_1_WXUNIV_0@ $(CXXC) -c -o $@ $(COREDLL_CXXFLAGS) $(srcdir)/src/osx/carbon/icon.cpp
@COND_PLATFORM_MACOSX_1_TOOLKIT_OSX_IPHONE_USE_GUI_1_WXUNIV_0@coredll_carbon_icon.o: $(srcdir)/src/osx/carbon/icon.cpp $(COREDLL_ODEP)
@COND_PLATFORM_MACOSX_1_TOOLKIT_OSX_IPHONE_USE_GUI_1_WXUNIV_0@ $(CXXC) -c -o $@ $(COREDLL_CXXFLAGS) $(srcdir)/src/osx/carbon/icon.cpp
@COND_PLATFORM_MACOSX_1_TOOLKIT_OSX_COCOA_USE_GUI_1_WXUNIV_0@coredll_carbon_app.o: $(srcdir)/src/osx/carbon/app.cpp $(COREDLL_ODEP)
@COND_PLATFORM_MACOSX_1_TOOLKIT_OSX_COCOA_USE_GUI_1_WXUNIV_0@ $(CXXC) -c -o $@ $(COREDLL_CXXFLAGS) $(srcdir)/src/osx/carbon/app.cpp
@@ -32792,8 +32779,11 @@ corelib_sound_sdl.o: $(srcdir)/src/unix/sound_sdl.cpp $(CORELIB_ODEP)
@COND_TOOLKIT_MSW_USE_GUI_1@corelib_msw_joystick.o: $(srcdir)/src/msw/joystick.cpp $(CORELIB_ODEP)
@COND_TOOLKIT_MSW_USE_GUI_1@ $(CXXC) -c -o $@ $(CORELIB_CXXFLAGS) $(srcdir)/src/msw/joystick.cpp
@COND_TOOLKIT_OSX_IPHONE_USE_GUI_1_WXUNIV_0@corelib_generic_icon.o: $(srcdir)/src/generic/icon.cpp $(CORELIB_ODEP)
@COND_TOOLKIT_OSX_IPHONE_USE_GUI_1_WXUNIV_0@ $(CXXC) -c -o $@ $(CORELIB_CXXFLAGS) $(srcdir)/src/generic/icon.cpp
@COND_PLATFORM_MACOSX_1_TOOLKIT_OSX_COCOA_USE_GUI_1_WXUNIV_0@corelib_generic_icon.o: $(srcdir)/src/generic/icon.cpp $(CORELIB_ODEP)
@COND_PLATFORM_MACOSX_1_TOOLKIT_OSX_COCOA_USE_GUI_1_WXUNIV_0@ $(CXXC) -c -o $@ $(CORELIB_CXXFLAGS) $(srcdir)/src/generic/icon.cpp
@COND_PLATFORM_MACOSX_1_TOOLKIT_OSX_IPHONE_USE_GUI_1_WXUNIV_0@corelib_generic_icon.o: $(srcdir)/src/generic/icon.cpp $(CORELIB_ODEP)
@COND_PLATFORM_MACOSX_1_TOOLKIT_OSX_IPHONE_USE_GUI_1_WXUNIV_0@ $(CXXC) -c -o $@ $(CORELIB_CXXFLAGS) $(srcdir)/src/generic/icon.cpp
@COND_TOOLKIT_QT_USE_GUI_1_WXUNIV_0@corelib_generic_icon.o: $(srcdir)/src/generic/icon.cpp $(CORELIB_ODEP)
@COND_TOOLKIT_QT_USE_GUI_1_WXUNIV_0@ $(CXXC) -c -o $@ $(CORELIB_CXXFLAGS) $(srcdir)/src/generic/icon.cpp
@@ -34733,12 +34723,6 @@ corelib_sound_sdl.o: $(srcdir)/src/unix/sound_sdl.cpp $(CORELIB_ODEP)
@COND_PLATFORM_MACOSX_1_TOOLKIT_OSX_IPHONE_USE_GUI_1_WXUNIV_0@corelib_carbon_gdiobj.o: $(srcdir)/src/osx/carbon/gdiobj.cpp $(CORELIB_ODEP)
@COND_PLATFORM_MACOSX_1_TOOLKIT_OSX_IPHONE_USE_GUI_1_WXUNIV_0@ $(CXXC) -c -o $@ $(CORELIB_CXXFLAGS) $(srcdir)/src/osx/carbon/gdiobj.cpp
@COND_PLATFORM_MACOSX_1_TOOLKIT_OSX_COCOA_USE_GUI_1_WXUNIV_0@corelib_carbon_icon.o: $(srcdir)/src/osx/carbon/icon.cpp $(CORELIB_ODEP)
@COND_PLATFORM_MACOSX_1_TOOLKIT_OSX_COCOA_USE_GUI_1_WXUNIV_0@ $(CXXC) -c -o $@ $(CORELIB_CXXFLAGS) $(srcdir)/src/osx/carbon/icon.cpp
@COND_PLATFORM_MACOSX_1_TOOLKIT_OSX_IPHONE_USE_GUI_1_WXUNIV_0@corelib_carbon_icon.o: $(srcdir)/src/osx/carbon/icon.cpp $(CORELIB_ODEP)
@COND_PLATFORM_MACOSX_1_TOOLKIT_OSX_IPHONE_USE_GUI_1_WXUNIV_0@ $(CXXC) -c -o $@ $(CORELIB_CXXFLAGS) $(srcdir)/src/osx/carbon/icon.cpp
@COND_PLATFORM_MACOSX_1_TOOLKIT_OSX_COCOA_USE_GUI_1_WXUNIV_0@corelib_carbon_app.o: $(srcdir)/src/osx/carbon/app.cpp $(CORELIB_ODEP)
@COND_PLATFORM_MACOSX_1_TOOLKIT_OSX_COCOA_USE_GUI_1_WXUNIV_0@ $(CXXC) -c -o $@ $(CORELIB_CXXFLAGS) $(srcdir)/src/osx/carbon/app.cpp

View File

@@ -2435,7 +2435,6 @@ IMPORTANT: please read docs/tech/tn0016.txt before modifying this file!
src/osx/carbon/cursor.cpp
src/osx/carbon/fontdlg.cpp
src/osx/carbon/gdiobj.cpp
src/osx/carbon/icon.cpp
src/osx/carbon/app.cpp
src/osx/carbon/control.cpp
src/osx/carbon/dataobj.cpp
@@ -2468,6 +2467,7 @@ IMPORTANT: please read docs/tech/tn0016.txt before modifying this file!
src/generic/prntdlgg.cpp
src/generic/statusbr.cpp
src/generic/textmeasure.cpp
src/generic/icon.cpp
</if>
</set>
@@ -2511,7 +2511,6 @@ IMPORTANT: please read docs/tech/tn0016.txt before modifying this file!
wx/osx/fontdlg.h
wx/osx/frame.h
wx/osx/gauge.h
wx/osx/icon.h
wx/osx/imaglist.h
wx/osx/listbox.h
wx/osx/listctrl.h
@@ -2566,6 +2565,7 @@ IMPORTANT: please read docs/tech/tn0016.txt before modifying this file!
wx/generic/prntdlgg.h
wx/generic/statusbr.h
wx/osx/appprogress.h
wx/generic/icon.h
</set>
<!-- ====================================================================== -->
@@ -2656,7 +2656,6 @@ IMPORTANT: please read docs/tech/tn0016.txt before modifying this file!
<set var="OSX_IPHONE_SRC" hints="files">
$(OSX_COMMON_SRC)
src/generic/regiong.cpp
src/generic/icon.cpp
<!-- iphone files -->
src/osx/iphone/anybutton.mm
src/osx/iphone/button.mm

View File

@@ -2312,7 +2312,6 @@ set(OSX_COMMON_SRC
src/osx/carbon/cursor.cpp
src/osx/carbon/fontdlg.cpp
src/osx/carbon/gdiobj.cpp
src/osx/carbon/icon.cpp
src/osx/carbon/app.cpp
src/osx/carbon/control.cpp
src/osx/carbon/dataobj.cpp
@@ -2345,6 +2344,7 @@ set(OSX_COMMON_SRC
src/generic/prntdlgg.cpp
src/generic/statusbr.cpp
src/generic/textmeasure.cpp
src/generic/icon.cpp
#TODO: </if>
)
@@ -2387,7 +2387,6 @@ set(OSX_SHARED_HDR
wx/osx/fontdlg.h
wx/osx/frame.h
wx/osx/gauge.h
wx/osx/icon.h
wx/osx/imaglist.h
wx/osx/listbox.h
wx/osx/listctrl.h
@@ -2442,6 +2441,7 @@ set(OSX_SHARED_HDR
wx/generic/prntdlgg.h
wx/generic/statusbr.h
wx/osx/appprogress.h
wx/generic/icon.h
)
set(OSX_COCOA_SRC
@@ -2525,7 +2525,6 @@ set(OSX_COCOA_HDR
set(OSX_IPHONE_SRC
${OSX_COMMON_SRC}
src/generic/regiong.cpp
src/generic/icon.cpp
src/osx/cocoa/stdpaths.mm
# iphone files
src/osx/iphone/anybutton.mm

View File

@@ -2296,7 +2296,6 @@ OSX_COMMON_SRC =
src/osx/carbon/cursor.cpp
src/osx/carbon/fontdlg.cpp
src/osx/carbon/gdiobj.cpp
src/osx/carbon/icon.cpp
src/osx/carbon/app.cpp
src/osx/carbon/control.cpp
src/osx/carbon/dataobj.cpp
@@ -2325,6 +2324,7 @@ OSX_COMMON_SRC =
src/generic/filepickerg.cpp
src/generic/fontdlgg.cpp
src/generic/fontpickerg.cpp
src/generic/icon.cpp
src/generic/listctrl.cpp
src/generic/prntdlgg.cpp
src/generic/statusbr.cpp
@@ -2371,7 +2371,6 @@ OSX_SHARED_HDR =
wx/osx/fontdlg.h
wx/osx/frame.h
wx/osx/gauge.h
wx/osx/icon.h
wx/osx/imaglist.h
wx/osx/listbox.h
wx/osx/listctrl.h
@@ -2422,6 +2421,7 @@ OSX_SHARED_HDR =
wx/generic/filepickerg.h
wx/generic/fontdlgg.h
wx/generic/fontpickerg.h
wx/generic/icon.h
wx/generic/listctrl.h
wx/generic/prntdlgg.h
wx/generic/statusbr.h
@@ -2511,7 +2511,6 @@ OSX_COCOA_HDR =
OSX_IPHONE_SRC =
$(OSX_COMMON_SRC)
src/generic/animateg.cpp
src/generic/icon.cpp
src/generic/regiong.cpp
src/osx/cocoa/stdpaths.mm
src/osx/core/sound.cpp

View File

@@ -4754,7 +4754,7 @@
F4B85051B7C835A8BF4E3EE1 /* xh_panel.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; name = xh_panel.cpp; path = ../../src/xrc/xh_panel.cpp; sourceTree = "<group>"; };
F4C72C5C61A6335C8B418BA1 /* LexMetapost.cxx */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; name = LexMetapost.cxx; path = ../../src/stc/scintilla/lexers/LexMetapost.cxx; sourceTree = "<group>"; };
F52DCBC0442233738B39138E /* CaseFolder.cxx */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; name = CaseFolder.cxx; path = ../../src/stc/scintilla/src/CaseFolder.cxx; sourceTree = "<group>"; };
F5DAF1F49F0F3F41A427A21D /* icon.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; name = icon.cpp; path = ../../src/osx/carbon/icon.cpp; sourceTree = "<group>"; };
F5DAF1F49F0F3F41A427A21D /* icon.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; name = icon.cpp; path = ../../src/generic/icon.cpp; sourceTree = "<group>"; };
F6EA240B3DB93D398A990FAD /* tif_dirread.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; name = tif_dirread.c; path = ../../src/tiff/libtiff/tif_dirread.c; sourceTree = "<group>"; };
F6F01A84F4DE3C9FB9849004 /* tif_jbig.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; name = tif_jbig.c; path = ../../src/tiff/libtiff/tif_jbig.c; sourceTree = "<group>"; };
F7332A03D93D3DABB050615D /* dir.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; name = dir.cpp; path = ../../src/unix/dir.cpp; sourceTree = "<group>"; };

View File

@@ -224,9 +224,12 @@ public:
virtual bool CopyFromIcon(const wxIcon& icon) = 0;
// implementation:
#if WXWIN_COMPATIBILITY_3_0
// deprecated
virtual void SetHeight(int height) = 0;
virtual void SetWidth(int width) = 0;
virtual void SetDepth(int depth) = 0;
#endif
// Format handling
static inline wxList& GetHandlers() { return sm_handlers; }

View File

@@ -2584,7 +2584,6 @@ typedef int (* LINKAGEMODE wxListIterateFunction)(void *current);
#define WX_OPAQUE_TYPE( name ) struct wxOpaque##name
typedef void* WXHBITMAP;
typedef void* WXHCURSOR;
typedef void* WXRECTPTR;
typedef void* WXPOINTPTR;
@@ -2628,6 +2627,7 @@ DECLARE_WXOSX_OPAQUE_CGREF( CGFont )
typedef CGColorRef WXCOLORREF;
typedef CGImageRef WXCGIMAGEREF;
typedef CGContextRef WXHDC;
typedef CGContextRef WXHBITMAP;
/*
* carbon
@@ -2764,6 +2764,7 @@ DECLARE_WXCOCOA_OBJC_CLASS(NSString);
typedef WX_NSWindow WXWindow;
typedef WX_NSView WXWidget;
typedef WX_NSImage WXImage;
typedef WX_NSMenu WXHMENU;
typedef WX_NSOpenGLPixelFormat WXGLPixelFormat;
typedef WX_NSOpenGLContext WXGLContext;
@@ -2771,6 +2772,7 @@ typedef WX_NSOpenGLContext WXGLContext;
#elif wxOSX_USE_IPHONE
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);
@@ -2781,6 +2783,7 @@ DECLARE_WXCOCOA_OBJC_CLASS(UIWebView);
typedef WX_UIWindow WXWindow;
typedef WX_UIView WXWidget;
typedef WX_UIImage WXImage;
typedef WX_EAGLContext WXGLContext;
typedef WX_NSString WXGLPixelFormat;
typedef WX_UIWebView OSXWebViewPtr;

View File

@@ -47,8 +47,9 @@
#elif defined(__WXMAC__)
#if wxOSX_USE_COCOA_OR_CARBON
#define wxICON_DEFAULT_TYPE wxBITMAP_TYPE_ICON_RESOURCE
#include "wx/osx/icon.h"
#include "wx/generic/icon.h"
#else
// iOS and others
#define wxICON_DEFAULT_TYPE wxBITMAP_TYPE_PNG_RESOURCE
#include "wx/generic/icon.h"
#endif

View File

@@ -30,7 +30,7 @@ class WXDLLIMPEXP_FWD_CORE wxPixelDataBase;
// 8 bit is chosen only for performance reasons, note also that this is the inverse value range
// from alpha, where 0 = invisible , 255 = fully drawn
class WXDLLIMPEXP_CORE wxMask: public wxObject
class WXDLLIMPEXP_CORE wxMask: public wxMaskBase
{
wxDECLARE_DYNAMIC_CLASS(wxMask);
@@ -52,8 +52,6 @@ public:
virtual ~wxMask();
bool Create(const wxBitmap& bitmap, const wxColour& colour);
bool Create(const wxBitmap& bitmap);
bool Create(const wxMemoryBuffer& buf, int width , int height , int bytesPerRow ) ;
wxBitmap GetBitmap() const;
@@ -64,20 +62,30 @@ public:
// a 8 bit depth mask
void* GetRawAccess() const;
int GetBytesPerRow() const { return m_bytesPerRow ; }
int GetBytesPerRow() const;
int GetWidth() const;
int GetHeight() const;
// renders/updates native representation when necessary
void RealizeNative() ;
WXHBITMAP GetHBITMAP() const ;
protected:
// this function is called from Create() to free the existing mask data
virtual void FreeData() wxOVERRIDE;
// these functions must be overridden to implement the corresponding public
// Create() methods, they shouldn't call FreeData() as it's already called
// by the public wrappers
virtual bool InitFromColour(const wxBitmap& bitmap,
const wxColour& colour) wxOVERRIDE;
virtual bool InitFromMonoBitmap(const wxBitmap& bitmap) wxOVERRIDE;
private:
wxMemoryBuffer m_memBuf ;
int m_bytesPerRow ;
int m_width ;
int m_height ;
void DoCreateMaskBitmap(int width, int height, int bytesPerRow = -1);
WXHBITMAP m_maskBitmap ;
wxCFRef<CGContextRef> m_maskBitmap ;
};
@@ -104,7 +112,7 @@ public:
// creates an bitmap from the native image format
wxBitmap(CGImageRef image, double scale = 1.0);
wxBitmap(WX_NSImage image);
wxBitmap(WXImage image);
wxBitmap(CGContextRef bitmapcontext);
// Create a bitmap compatible with the given DC
@@ -133,7 +141,7 @@ public:
virtual bool Create(const void* data, wxBitmapType type, int width, int height, int depth = 1);
bool Create( CGImageRef image, double scale = 1.0 );
bool Create( WX_NSImage image );
bool Create( WXImage image );
bool Create( CGContextRef bitmapcontext);
// Create a bitmap compatible with the given DC, inheriting its magnification factor
@@ -146,7 +154,10 @@ public:
virtual bool LoadFile(const wxString& name, wxBitmapType type = wxBITMAP_DEFAULT_TYPE);
virtual bool SaveFile(const wxString& name, wxBitmapType type, const wxPalette *cmap = NULL) const;
wxBitmapRefData *GetBitmapData() const
const wxBitmapRefData *GetBitmapData() const
{ return (const wxBitmapRefData *)m_refData; }
wxBitmapRefData *GetBitmapData()
{ return (wxBitmapRefData *)m_refData; }
// copies the contents and mask of the given (colour) icon to the bitmap
@@ -155,10 +166,15 @@ public:
int GetWidth() const;
int GetHeight() const;
int GetDepth() const;
void SetWidth(int w);
void SetHeight(int h);
void SetDepth(int d);
void SetOk(bool isOk);
#if WXWIN_COMPATIBILITY_3_0
wxDEPRECATED_MSG("this value is determined during creation, this method could lead to inconsistencies")
void SetWidth(int width);
wxDEPRECATED_MSG("this value is determined during creation, this method could lead to inconsistencies")
void SetHeight(int height);
wxDEPRECATED_MSG("this value is determined during creation, this method could lead to inconsistencies")
void SetDepth(int depth);
#endif
#if wxUSE_PALETTE
wxPalette* GetPalette() const;
@@ -185,26 +201,45 @@ public:
// returns a CGImageRef which must released after usage with CGImageRelease
CGImageRef CreateCGImage() const ;
WXImage GetImage() const;
#if wxOSX_USE_COCOA
// returns an autoreleased version of the image
WX_NSImage GetNSImage() const;
WX_NSImage GetNSImage() const
{ return GetImage(); }
#endif
#if wxOSX_USE_IPHONE
// returns an autoreleased version of the image
WX_UIImage GetUIImage() const;
WX_UIImage GetUIImage() const
{ return GetImage(); }
#endif
#if WXWIN_COMPATIBILITY_3_0
#if wxOSX_USE_ICONREF
// returns a IconRef which must be retained before and released after usage
wxDEPRECATED_MSG("IconRefs are deprecated, this will be removed in the future")
IconRef GetIconRef() const;
// returns a IconRef which must be released after usage
wxDEPRECATED_MSG("IconRefs are deprecated, this will be removed in the future")
IconRef CreateIconRef() const;
#endif
// get read only access to the underlying buffer
void *GetRawAccess() const ;
wxDEPRECATED_MSG("use GetRawData for accessing the buffer")
const void *GetRawAccess() const;
// brackets to the underlying OS structure for read/write access
// makes sure that no cached images will be constructed until terminated
void *BeginRawAccess() ;
void EndRawAccess() ;
wxDEPRECATED_MSG("use GetRawData for accessing the buffer")
void *BeginRawAccess();
wxDEPRECATED_MSG("use GetRawData for accessing the buffer")
void EndRawAccess();
#endif
double GetScaleFactor() const;
void SetSelectedInto(wxDC *dc);
wxDC *GetSelectedInto() const;
protected:
virtual wxGDIRefData *CreateGDIRefData() const;
virtual wxGDIRefData *CloneGDIRefData(const wxGDIRefData *data) const;

View File

@@ -32,12 +32,16 @@ OSStatus WXDLLIMPEXP_CORE wxMacDrawCGImage(
CGContextRef inContext,
const CGRect * inBounds,
CGImageRef inImage) ;
void WXDLLIMPEXP_CORE wxOSXDrawNSImage(
CGContextRef inContext,
const CGRect * inBounds,
WX_NSImage inImage) ;
WX_NSImage WXDLLIMPEXP_CORE wxOSXGetSystemImage(const wxString& name);
WX_NSImage WXDLLIMPEXP_CORE wxOSXGetNSImageFromCGImage( CGImageRef image, double scale = 1.0, bool isTemplate = false);
WX_NSImage WXDLLIMPEXP_CORE wxOSXGetNSImageFromIconRef( WXHICON iconref );
CGImageRef WXDLLIMPEXP_CORE wxOSXCreateCGImageFromNSImage( WX_NSImage nsimage, double *scale = NULL );
CGImageRef WXDLLIMPEXP_CORE wxOSXGetCGImageFromNSImage( WX_NSImage nsimage, CGRect* r, CGContextRef cg);
CGContextRef WXDLLIMPEXP_CORE wxOSXCreateBitmapContextFromNSImage( WX_NSImage nsimage, bool *isTemplate = NULL);
WX_NSImage WXDLLIMPEXP_CORE wxOSXGetIconForType(OSType type );
void WXDLLIMPEXP_CORE wxOSXSetImageSize(WX_NSImage image, CGFloat width, CGFloat height);
double WXDLLIMPEXP_CORE wxOSXGetImageScaleFactor(WXImage image);
wxBitmap WXDLLIMPEXP_CORE wxOSXCreateSystemBitmap(const wxString& id, const wxString &client, const wxSize& size);
WXWindow WXDLLIMPEXP_CORE wxOSXGetMainWindow();
WXWindow WXDLLIMPEXP_CORE wxOSXGetKeyWindow();

View File

@@ -104,8 +104,6 @@ protected :
// Quartz
WXDLLIMPEXP_CORE CGImageRef wxMacCreateCGImageFromBitmap( const wxBitmap& bitmap );
WXDLLIMPEXP_CORE CGDataProviderRef wxMacCGDataProviderCreateWithCFData( CFDataRef data );
WXDLLIMPEXP_CORE CGDataConsumerRef wxMacCGDataConsumerCreateWithCFData( CFMutableDataRef data );
WXDLLIMPEXP_CORE CGDataProviderRef wxMacCGDataProviderCreateWithMemoryBuffer( const wxMemoryBuffer& buf );
@@ -114,6 +112,15 @@ WXDLLIMPEXP_CORE CGColorSpaceRef wxMacGetGenericRGBColorSpace(void);
WXDLLIMPEXP_CORE double wxOSXGetMainScreenContentScaleFactor();
// UI
CGSize WXDLLIMPEXP_CORE wxOSXGetImageSize(WXImage image);
CGImageRef WXDLLIMPEXP_CORE wxOSXCreateCGImageFromImage( WXImage nsimage, double *scale = NULL );
CGImageRef WXDLLIMPEXP_CORE wxOSXGetCGImageFromImage( WXImage nsimage, CGRect* r, CGContextRef cg);
CGContextRef WXDLLIMPEXP_CORE wxOSXCreateBitmapContextFromImage( WXImage nsimage, bool *isTemplate = NULL);
WXImage WXDLLIMPEXP_CORE wxOSXGetImageFromCGImage( CGImageRef image, double scale = 1.0, bool isTemplate = false);
class wxWindowMac;
// to
extern wxWindow* g_MacLastWindow;

View File

@@ -44,14 +44,20 @@ public:
int GetWidth() const;
int GetHeight() const;
int GetDepth() const;
void SetWidth(int w);
void SetHeight(int h);
void SetDepth(int d);
void SetOk(bool isOk);
#if WXWIN_COMPATIBILITY_3_0
wxDEPRECATED_MSG("this value is determined during creation, this method could lead to inconsistencies")
void SetWidth(int width);
wxDEPRECATED_MSG("this value is determined during creation, this method could lead to inconsistencies")
void SetHeight(int height);
wxDEPRECATED_MSG("this value is determined during creation, this method could lead to inconsistencies")
void SetDepth(int depth);
#endif
wxSize GetSize() const { return wxSize(GetWidth(), GetHeight()); }
#if wxOSX_USE_ICONREF
WXHICON GetHICON() const;
#endif
#if wxOSX_USE_COCOA
WX_NSImage GetNSImage() const ;

View File

@@ -1622,6 +1622,13 @@
// make sure we have the proper dispatcher for the console event loop
#define wxUSE_SELECT_DISPATCHER 1
#define wxUSE_EPOLL_DISPATCHER 0
// set to 1 if you have older code that still needs icon refs
#define wxOSX_USE_ICONREF 0
// set to 0 if you have code that has problems with the new bitmap implementation
#define wxOSX_BITMAP_NATIVE_ACCESS 1
/* --- end OSX options --- */
#endif

View File

@@ -707,6 +707,9 @@ public:
const wxPalette* palette = NULL) const;
/**
@deprecated This function is deprecated since version 3.1.2, dimensions
and depth can only be set at construction time.
Sets the depth member (does not affect the bitmap data).
@todo since these functions do not affect the bitmap data,
@@ -714,10 +717,14 @@ public:
@param depth
Bitmap depth.
*/
virtual void SetDepth(int depth);
/**
@deprecated This function is deprecated since version 3.1.2, dimensions
and depth can only be set at construction time.
Sets the height member (does not affect the bitmap data).
@param height
@@ -745,6 +752,9 @@ public:
virtual void SetPalette(const wxPalette& palette);
/**
@deprecated This function is deprecated since version 3.1.2, dimensions
and depth can only be set at construction time.
Sets the width member (does not affect the bitmap data).
@param width

View File

@@ -256,7 +256,7 @@ void wxCursor::CreateFromImage(const wxImage & image)
int hotSpotY = image.GetOptionInt(wxIMAGE_OPTION_CUR_HOTSPOT_Y);
#if wxOSX_USE_COCOA
wxBitmap bmp( image );
CGImageRef cgimage = wxMacCreateCGImageFromBitmap(bmp);
CGImageRef cgimage = bmp.CreateCGImage();
if ( cgimage )
{
M_CURSORDATA->m_hCursor = wxMacCocoaCreateCursorFromCGImage( cgimage, hotSpotX, hotSpotY );

View File

@@ -2159,8 +2159,15 @@ void wxMacCoreGraphicsContext::Rotate( wxDouble angle )
void wxMacCoreGraphicsContext::DrawBitmap( const wxBitmap &bmp, wxDouble x, wxDouble y, wxDouble w, wxDouble h )
{
#if wxOSX_USE_COCOA
{
CGRect r = CGRectMake( (CGFloat) x , (CGFloat) y , (CGFloat) w , (CGFloat) h );
wxOSXDrawNSImage( m_cgContext, &r, bmp.GetImage());
}
#else
wxGraphicsBitmap bitmap = GetRenderer()->CreateBitmap(bmp);
DrawBitmap(bitmap, x, y, w, h);
#endif
}
void wxMacCoreGraphicsContext::DrawBitmap( const wxGraphicsBitmap &bmp, wxDouble x, wxDouble y, wxDouble w, wxDouble h )
@@ -2218,10 +2225,7 @@ void wxMacCoreGraphicsContext::DrawIcon( const wxIcon &icon, wxDouble x, wxDoubl
#if wxOSX_USE_COCOA
{
CGRect r = CGRectMake( (CGFloat) x , (CGFloat) y , (CGFloat) w , (CGFloat) h );
const WX_NSImage nsImage = icon.GetNSImage();
CGImageRef cgImage = wxOSXGetCGImageFromNSImage( nsImage , &r, m_cgContext );
wxMacDrawCGImage( m_cgContext, &r, cgImage);
wxOSXDrawNSImage( m_cgContext, &r, icon.GetImage());
}
#endif

View File

@@ -24,6 +24,87 @@ wxIMPLEMENT_DYNAMIC_CLASS(wxIcon, wxGDIObject);
#define M_ICONDATA ((wxIconRefData *)m_refData)
#define wxOSX_ICON_USE_NSIMAGE wxOSX_BITMAP_NATIVE_ACCESS
#if wxOSX_ICON_USE_NSIMAGE
// implementation based on NSImage
class WXDLLEXPORT wxIconRefData : public wxGDIRefData
{
public:
wxIconRefData() { Init(); }
wxIconRefData( WX_NSImage image, int desiredWidth, int desiredHeight );
wxIconRefData( WXHICON iconref, int desiredWidth, int desiredHeight );
virtual ~wxIconRefData() { Free(); }
virtual bool IsOk() const wxOVERRIDE { return m_nsImage != NULL; }
virtual void Free();
int GetWidth() const { return (int) wxOSXGetImageSize(m_nsImage).width; }
int GetHeight() const { return (int) wxOSXGetImageSize(m_nsImage).height; }
WX_NSImage GetImage() const;
private:
void Init();
void Create( NSImage* icon, int desiredWidth, int desiredHeight );
NSImage* m_nsImage;
// We can (easily) copy m_iconRef so we don't implement the copy ctor.
wxDECLARE_NO_COPY_CLASS(wxIconRefData);
};
wxIconRefData::wxIconRefData( NSImage* icon, int desiredWidth, int desiredHeight )
{
Init();
Create(icon, desiredWidth, desiredHeight);
}
wxIconRefData::wxIconRefData( WXHICON iconref, int desiredWidth, int desiredHeight )
{
Init();
Create(wxOSXGetNSImageFromIconRef(iconref), desiredWidth, desiredHeight);
ReleaseIconRef(iconref);
}
void wxIconRefData::Create( NSImage* icon, int WXUNUSED(desiredWidth), int WXUNUSED(desiredHeight) )
{
if ( icon )
{
m_nsImage = icon;
wxMacCocoaRetain(icon);
}
}
void wxIconRefData::Init()
{
m_nsImage = NULL;
}
void wxIconRefData::Free()
{
if ( m_nsImage )
{
wxMacCocoaRelease(m_nsImage);
}
}
WX_NSImage wxIconRefData::GetImage() const
{
wxASSERT( IsOk() );
return m_nsImage;
}
#else // !wxOSX_ICON_USE_NSIMAGE
// implementation based on IconRef
class WXDLLEXPORT wxIconRefData : public wxGDIRefData
{
public:
@@ -32,7 +113,6 @@ public:
virtual ~wxIconRefData() { Free(); }
virtual bool IsOk() const wxOVERRIDE { return m_iconRef != NULL; }
virtual void Free();
void SetWidth( int width ) { m_width = width; }
@@ -42,17 +122,16 @@ public:
int GetHeight() const { return m_height; }
WXHICON GetHICON() const { return (WXHICON) m_iconRef; }
#if wxOSX_USE_COCOA
WX_NSImage GetNSImage() const;
#endif
WX_NSImage GetImage() const;
private:
void Init();
IconRef m_iconRef;
#if wxOSX_USE_COCOA
mutable NSImage* m_nsImage;
#endif
int m_width;
int m_height;
@@ -60,7 +139,6 @@ private:
wxDECLARE_NO_COPY_CLASS(wxIconRefData);
};
wxIconRefData::wxIconRefData( WXHICON icon, int desiredWidth, int desiredHeight )
{
Init();
@@ -74,9 +152,8 @@ wxIconRefData::wxIconRefData( WXHICON icon, int desiredWidth, int desiredHeight
void wxIconRefData::Init()
{
m_iconRef = NULL ;
#if wxOSX_USE_COCOA
m_nsImage = NULL;
#endif
m_width =
m_height = 0;
}
@@ -89,16 +166,13 @@ void wxIconRefData::Free()
m_iconRef = NULL ;
}
#if wxOSX_USE_COCOA
if ( m_nsImage )
{
CFRelease(m_nsImage);
wxMacCocoaRelease(m_nsImage);
}
#endif
}
#if wxOSX_USE_COCOA
WX_NSImage wxIconRefData::GetNSImage() const
WX_NSImage wxIconRefData::GetImage() const
{
wxASSERT( IsOk() );
@@ -110,6 +184,7 @@ WX_NSImage wxIconRefData::GetNSImage() const
return m_nsImage;
}
#endif
//
@@ -139,6 +214,7 @@ wxIcon::wxIcon(
LoadFile( icon_file, flags, desiredWidth, desiredHeight );
}
#if wxOSX_USE_ICONREF
wxIcon::wxIcon(WXHICON icon, const wxSize& size)
: wxGDIObject()
{
@@ -149,6 +225,14 @@ wxIcon::wxIcon(WXHICON icon, const wxSize& size)
m_refData = new wxIconRefData( icon, size.x, size.y ) ;
}
WXHICON wxIcon::GetHICON() const
{
wxASSERT( IsOk() ) ;
return (WXHICON) ((wxIconRefData*)m_refData)->GetHICON() ;
}
#endif
wxIcon::~wxIcon()
{
}
@@ -166,13 +250,6 @@ wxIcon::CloneGDIRefData(const wxGDIRefData * WXUNUSED(data)) const
return new wxIconRefData;
}
WXHICON wxIcon::GetHICON() const
{
wxASSERT( IsOk() ) ;
return (WXHICON) ((wxIconRefData*)m_refData)->GetHICON() ;
}
int wxIcon::GetWidth() const
{
wxCHECK_MSG( IsOk(), -1, wxT("invalid icon") );
@@ -192,15 +269,14 @@ int wxIcon::GetDepth() const
return 32;
}
#if wxOSX_USE_COCOA
WX_NSImage wxIcon::GetNSImage() const
WX_NSImage wxIcon::GetImage() const
{
wxCHECK_MSG( IsOk(), NULL, wxT("invalid icon") );
return M_ICONDATA->GetNSImage() ;
return M_ICONDATA->GetImage() ;
}
#endif
#if WXWIN_COMPATIBILITY_3_0
void wxIcon::SetDepth( int WXUNUSED(depth) )
{
}
@@ -212,6 +288,7 @@ void wxIcon::SetWidth( int WXUNUSED(width) )
void wxIcon::SetHeight( int WXUNUSED(height) )
{
}
#endif
// Load an icon based on resource name or filel name
// Return true on success, false otherwise
@@ -330,13 +407,10 @@ bool wxIcon::LoadIconFromSystemResource(const wxString& resourceName, int desire
IconRef iconRef = NULL ;
__Verify_noErr(GetIconRef( kOnSystemDisk, kSystemIconsCreator, theId, &iconRef )) ;
if ( iconRef )
{
m_refData = new wxIconRefData( (WXHICON) iconRef, desiredWidth, desiredHeight ) ;
return true ;
}
}
return false;
return IsOk();
}
// Load an icon of type 'icns' by resource by name
@@ -347,6 +421,7 @@ bool wxIcon::LoadIconFromBundleResource(const wxString& resourceName, int desire
{
UnRef();
#if wxOSX_USE_ICONREF
IconRef iconRef = NULL ;
// first look in the resource fork
@@ -395,7 +470,7 @@ bool wxIcon::LoadIconFromBundleResource(const wxString& resourceName, int desire
m_refData = new wxIconRefData( (WXHICON) iconRef, desiredWidth, desiredHeight );
return true;
}
#endif
return false;
}
@@ -406,9 +481,10 @@ bool wxIcon::LoadIconFromFile(const wxString& filename, int desiredWidth, int de
{
UnRef();
OSStatus err;
bool result = false;
#if wxOSX_USE_ICONREF
OSStatus err;
// Get a file system reference
FSRef fsRef;
err = FSPathMakeRef( (const wxUint8*)filename.utf8_str().data(), &fsRef, NULL );
@@ -436,6 +512,7 @@ bool wxIcon::LoadIconFromFile(const wxString& filename, int desiredWidth, int de
// Release the iconFamily before returning
ReleaseResource( (Handle) iconFamily );
#endif
return result;
}
@@ -487,6 +564,9 @@ void wxIcon::CopyFromBitmap( const wxBitmap& bmp )
{
UnRef() ;
#if wxOSX_ICON_USE_NSIMAGE
m_refData = new wxIconRefData( bmp.GetImage() , bmp.GetWidth(), bmp.GetHeight() ) ;
#else
// as the bitmap owns that ref, we have to acquire it as well
int w = bmp.GetWidth() ;
@@ -502,7 +582,7 @@ void wxIcon::CopyFromBitmap( const wxBitmap& bmp )
{
m_refData = new wxIconRefData( (WXHICON) bmp.CreateIconRef() , bmp.GetWidth(), bmp.GetHeight() ) ;
}
#endif
}
wxIMPLEMENT_DYNAMIC_CLASS(wxICONResourceHandler, wxBitmapHandler);

View File

@@ -165,11 +165,6 @@ WXWindow wxOSXGetKeyWindow()
#if wxOSX_USE_IPHONE
WX_UIImage wxOSXGetUIImageFromCGImage( CGImageRef image )
{
return [UIImage imageWithCGImage:image];
}
wxBitmap wxOSXCreateSystemBitmap(const wxString& name, const wxString &client, const wxSize& size)
{
#if 1
@@ -181,66 +176,70 @@ wxBitmap wxOSXCreateSystemBitmap(const wxString& name, const wxString &client, c
#endif
}
double wxOSXGetMainScreenContentScaleFactor()
{
double scale;
#if __IPHONE_OS_VERSION_MAX_ALLOWED >= 40000
if ([[UIScreen mainScreen] respondsToSelector:@selector(scale)])
{
scale=[[UIScreen mainScreen] scale];
}
else
#endif
{
scale=1.0;
}
return scale;
}
#endif
#if wxOSX_USE_COCOA
wxBitmap wxOSXCreateSystemBitmap(const wxString& name, const wxString &WXUNUSED(client), const wxSize& WXUNUSED(size))
WXImage wxOSXGetSystemImage(const wxString& name)
{
wxCFStringRef cfname(name);
return wxBitmap( [NSImage imageNamed:cfname.AsNSString()] );
NSImage* nsimage = [NSImage imageNamed:cfname.AsNSString()];
return nsimage;
}
WX_NSImage wxOSXGetNSImageFromCGImage( CGImageRef image, double scaleFactor, bool isTemplate )
wxBitmap wxOSXCreateSystemBitmap(const wxString& name, const wxString &client, const wxSize& sizeHint)
{
NSRect imageRect = NSMakeRect(0.0, 0.0, 0.0, 0.0);
NSImage* nsimage = wxOSXGetSystemImage(name);
if ( nsimage )
{
// if ( sizeHint != wxDefaultSize )
// [nsimage setSize:NSMakeSize(sizeHint.GetHeight(), sizeHint.GetWidth())];
return wxBitmap( nsimage );
}
return wxNullBitmap;
}
// Get the image dimensions.
imageRect.size.height = CGImageGetHeight(image)/scaleFactor;
imageRect.size.width = CGImageGetWidth(image)/scaleFactor;
#endif
NSImage* newImage = [[NSImage alloc] initWithCGImage:image size:imageRect.size];
WXImage wxOSXGetImageFromCGImage( CGImageRef image, double scaleFactor, bool isTemplate )
{
#if wxOSX_USE_COCOA
NSSize sz;
sz.height = CGImageGetHeight(image)/scaleFactor;
sz.width = CGImageGetWidth(image)/scaleFactor;
NSImage* newImage = [[NSImage alloc] initWithCGImage:image size:sz];
[newImage setTemplate:isTemplate];
[newImage autorelease];
return( newImage );
#else
return [UIImage imageWithCGImage:image scale:scaleFactor orientation:UIImageOrientationUp];
#endif
}
WX_NSImage WXDLLIMPEXP_CORE wxOSXGetNSImageFromIconRef( WXHICON iconref )
#if wxOSX_USE_ICONREF
WXImage WXDLLIMPEXP_CORE wxOSXGetNSImageFromIconRef( WXHICON iconref )
{
NSImage *newImage = [[NSImage alloc] initWithIconRef:iconref];
[newImage autorelease];
return( newImage );
}
#endif
CGImageRef WXDLLIMPEXP_CORE wxOSXGetCGImageFromNSImage( WX_NSImage nsimage, CGRect* r, CGContextRef cg)
CGImageRef WXDLLIMPEXP_CORE wxOSXGetCGImageFromImage( WXImage nsimage, CGRect* r, CGContextRef cg)
{
#if wxOSX_USE_COCOA
NSRect nsRect = NSRectFromCGRect(*r);
return [nsimage CGImageForProposedRect:&nsRect
context:[NSGraphicsContext graphicsContextWithGraphicsPort:cg flipped:YES]
hints:nil];
#else
return [nsimage CGImage];
#endif
}
CGContextRef WXDLLIMPEXP_CORE wxOSXCreateBitmapContextFromNSImage( WX_NSImage nsimage, bool *isTemplate)
CGContextRef WXDLLIMPEXP_CORE wxOSXCreateBitmapContextFromImage( WXImage nsimage, bool *isTemplate)
{
// based on http://www.mail-archive.com/cocoa-dev@lists.apple.com/msg18065.html
@@ -249,49 +248,119 @@ CGContextRef WXDLLIMPEXP_CORE wxOSXCreateBitmapContextFromNSImage( WX_NSImage ns
{
double scale = wxOSXGetMainScreenContentScaleFactor();
NSSize imageSize = [nsimage size];
CGSize imageSize = wxOSXGetImageSize(nsimage);
hbitmap = CGBitmapContextCreate(NULL, imageSize.width*scale, imageSize.height*scale, 8, 0, wxMacGetGenericRGBColorSpace(), kCGImageAlphaPremultipliedFirst);
CGContextScaleCTM( hbitmap, scale, scale );
CGContextClearRect(hbitmap,CGRectMake(0, 0, imageSize.width, imageSize.height));
#if wxOSX_USE_COCOA
NSGraphicsContext *previousContext = [NSGraphicsContext currentContext];
NSGraphicsContext *nsGraphicsContext = [NSGraphicsContext graphicsContextWithGraphicsPort:hbitmap flipped:NO];
[NSGraphicsContext saveGraphicsState];
[NSGraphicsContext setCurrentContext:nsGraphicsContext];
[[NSColor whiteColor] setFill];
NSRectFill(NSMakeRect(0.0, 0.0, imageSize.width, imageSize.height));
[nsimage drawAtPoint:NSZeroPoint fromRect:NSZeroRect operation:NSCompositeCopy fraction:1.0];
[NSGraphicsContext setCurrentContext:previousContext];
if (isTemplate)
*isTemplate = [nsimage isTemplate];
#else
wxUnusedVar(isTemplate);
CGContextDrawImage(hbitmap,CGRectMake(0, 0, imageSize.width, imageSize.height),[nsimage CGImage]);
#endif
}
return hbitmap;
}
double wxOSXGetMainScreenContentScaleFactor()
void WXDLLIMPEXP_CORE wxOSXDrawNSImage(
CGContextRef inContext,
const CGRect * inBounds,
WXImage inImage)
{
return [[NSScreen mainScreen] backingScaleFactor];
if (inImage != nil)
{
CGContextSaveGState(inContext);
CGContextTranslateCTM(inContext, inBounds->origin.x, inBounds->origin.y + inBounds->size.height);
CGRect r = *inBounds;
r.origin.x = r.origin.y = 0;
CGContextScaleCTM(inContext, 1, -1);
#if wxOSX_USE_COCOA
NSGraphicsContext *previousContext = [NSGraphicsContext currentContext];
NSGraphicsContext *nsGraphicsContext = [NSGraphicsContext graphicsContextWithGraphicsPort:inContext flipped:NO];
[NSGraphicsContext setCurrentContext:nsGraphicsContext];
[inImage drawInRect:NSRectFromCGRect(r) fromRect:NSZeroRect operation:NSCompositeSourceOver fraction:1.0];
[NSGraphicsContext setCurrentContext:previousContext];
#else
CGContextDrawImage(inContext, *inBounds, [inImage CGImage]);
#endif
CGContextRestoreGState(inContext);
}
}
CGImageRef wxOSXCreateCGImageFromNSImage( WX_NSImage nsimage, double *scaleptr )
double wxOSXGetMainScreenContentScaleFactor()
{
// based on http://www.mail-archive.com/cocoa-dev@lists.apple.com/msg18065.html
#if wxOSX_USE_COCOA
return [[NSScreen mainScreen] backingScaleFactor];
#else
return [[UIScreen mainScreen] scale];
#endif
}
WXImage wxOSXGetIconForType(OSType type )
{
#if wxOSX_USE_COCOA
return [[NSWorkspace sharedWorkspace] iconForFileType: NSFileTypeForHFSTypeCode(type)];
#else
return NULL;
#endif
}
void wxOSXSetImageSize(WXImage image, CGFloat width, CGFloat height)
{
#if wxOSX_USE_COCOA
[image setSize:NSMakeSize(width, height)];
#else
// TODO
#endif
}
double wxOSXGetImageScaleFactor(WXImage image)
{
#if wxOSX_USE_COCOA
NSSize imagesize = [image size];
int width = [[image bestRepresentationForRect:NSMakeRect(0, 0, imagesize.width, imagesize.height) context:nil hints:nil] pixelsWide];
if ( width == 0 ) // there are multi-res representations which return 0 for the pixel dimensions
return wxOSXGetMainScreenContentScaleFactor();
return width / [image size].width;
#else
return [image scale];
#endif
}
CGSize wxOSXGetImageSize(WXImage image)
{
#if wxOSX_USE_COCOA
return NSSizeToCGSize([image size]);
#else
return [image size];
#endif
}
CGImageRef wxOSXCreateCGImageFromImage( WXImage nsimage, double *scaleptr )
{
CGImageRef image = NULL;
if (nsimage != nil)
{
CGContextRef context = wxOSXCreateBitmapContextFromNSImage(nsimage);
#if wxOSX_USE_COCOA
image = [nsimage CGImageForProposedRect:nil context:nil hints:nil];
#else
image = [nsimage CGImage];
#endif
CFRetain(image);
if ( scaleptr )
{
// determine content scale
CGRect userrect = CGRectMake(0, 0, 10, 10);
CGRect devicerect;
devicerect = CGContextConvertRectToDeviceSpace(context, userrect);
*scaleptr = devicerect.size.height / userrect.size.height;
}
image = CGBitmapContextCreateImage(context);
CFRelease(context);
*scaleptr = CGImageGetWidth(image)/[nsimage size].width;
}
return image;
}
@@ -302,6 +371,8 @@ CGImageRef wxOSXCreateCGImageFromNSImage( WX_NSImage nsimage, double *scaleptr )
// copied from cursor.mm
#if wxOSX_USE_COCOA
static NSCursor* wxGetStockCursor( short sIndex )
{
ClassicCursor* pCursor = &gMacCursors[sIndex];
@@ -499,7 +570,7 @@ WX_NSCursor wxMacCocoaCreateCursorFromCGImage( CGImageRef cgImageRef, float hot
firstTime = NO;
}
NSImage *nsImage = wxOSXGetNSImageFromCGImage( cgImageRef );
NSImage *nsImage = wxOSXGetImageFromCGImage( cgImageRef );
NSCursor *cursor = [[NSCursor alloc] initWithImage:nsImage hotSpot:NSMakePoint( hotSpotX, hotSpotY )];
return cursor;
@@ -519,6 +590,7 @@ void wxMacCocoaShowCursor()
{
[NSCursor unhide];
}
#endif
//---------------------------------------------------------
// helper functions for NSString<->wxString conversion
@@ -547,6 +619,8 @@ NSString* wxNSStringWithWxString(const wxString &wxstring)
// appearance in effect
// ----------------------------------------------------------------------------
#if wxOSX_USE_COCOA
wxOSXEffectiveAppearanceSetter::wxOSXEffectiveAppearanceSetter()
{
#if MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_14

File diff suppressed because it is too large Load Diff

View File

@@ -56,7 +56,7 @@ wxMemoryDCImpl::~wxMemoryDCImpl()
{
if ( m_selected.IsOk() )
{
m_selected.EndRawAccess() ;
m_selected.SetSelectedInto(NULL);
wxDELETE(m_graphicContext);
}
}
@@ -65,14 +65,18 @@ void wxMemoryDCImpl::DoSelect( const wxBitmap& bitmap )
{
if ( m_selected.IsOk() )
{
m_selected.EndRawAccess() ;
m_selected.SetSelectedInto(NULL);
wxDELETE(m_graphicContext);
}
m_selected = bitmap;
if (m_selected.IsOk())
{
m_selected.BeginRawAccess() ;
wxASSERT_MSG( !bitmap.GetSelectedInto() ||
(bitmap.GetSelectedInto() == GetOwner()),
"Bitmap is selected in another wxMemoryDC, delete the first wxMemoryDC or use SelectObject(NULL)" );
m_selected.SetSelectedInto(GetOwner());
m_width = bitmap.GetScaledWidth();
m_height = bitmap.GetScaledHeight();
m_contentScaleFactor = bitmap.GetScaleFactor();