Merge branch 'bitmap-bundle'

Add wxBitmapBundle and use it in wxToolBar.

See https://github.com/wxWidgets/wxWidgets/pull/2535
This commit is contained in:
Vadim Zeitlin
2021-10-05 18:58:18 +02:00
60 changed files with 2733 additions and 288 deletions

4
.gitmodules vendored
View File

@@ -26,3 +26,7 @@
path = 3rdparty/pcre
url = https://github.com/wxWidgets/pcre
branch = wx
[submodule "3rdparty/nanosvg"]
path = 3rdparty/nanosvg
url = https://github.com/wxWidgets/nanosvg
branch = wx

1
3rdparty/nanosvg vendored Submodule

Submodule 3rdparty/nanosvg added at ccdb199513

View File

@@ -4051,6 +4051,7 @@ COND_USE_GUI_1_ALL_GUI_HEADERS = \
wx/propdlg.h \
wx/generic/creddlgg.h \
wx/creddlg.h \
wx/bmpbndl.h \
$(LOWLEVEL_HDR) \
$(GUI_CORE_HEADERS) \
wx/mediactrl.h \
@@ -4712,7 +4713,9 @@ COND_USE_GUI_1_WXUNIV_0___CORE_SRC_OBJECTS = \
monodll_laywin.o \
monodll_calctrlg.o \
monodll_creddlgg.o \
monodll_rowheightcache.o
monodll_rowheightcache.o \
monodll_common_bmpbndl.o \
monodll_bmpsvg.o
@COND_USE_GUI_1_WXUNIV_0@__CORE_SRC_OBJECTS = $(COND_USE_GUI_1_WXUNIV_0___CORE_SRC_OBJECTS)
COND_USE_GUI_1_WXUNIV_1___CORE_SRC_OBJECTS = \
$(__LOWLEVEL_SRC_OBJECTS_1) \
@@ -4974,7 +4977,9 @@ COND_USE_GUI_1_WXUNIV_1___CORE_SRC_OBJECTS = \
monodll_laywin.o \
monodll_calctrlg.o \
monodll_creddlgg.o \
monodll_rowheightcache.o
monodll_rowheightcache.o \
monodll_common_bmpbndl.o \
monodll_bmpsvg.o
@COND_USE_GUI_1_WXUNIV_1@__CORE_SRC_OBJECTS = $(COND_USE_GUI_1_WXUNIV_1___CORE_SRC_OBJECTS)
COND_TOOLKIT_DFB___LOWLEVEL_SRC_OBJECTS = \
monodll_fontmgrcmn.o \
@@ -5257,7 +5262,8 @@ COND_TOOLKIT_MSW___LOWLEVEL_SRC_OBJECTS = \
monodll_notifmsgrt.o \
monodll_uuid.o \
monodll_msw_evtloop.o \
monodll_access.o
monodll_access.o \
monodll_msw_bmpbndl.o
@COND_TOOLKIT_MSW@__LOWLEVEL_SRC_OBJECTS = $(COND_TOOLKIT_MSW___LOWLEVEL_SRC_OBJECTS)
@COND_TOOLKIT_OSX_COCOA@__LOWLEVEL_SRC_OBJECTS = \
@COND_TOOLKIT_OSX_COCOA@ $(__OSX_LOWLEVEL_SRC_OBJECTS)
@@ -6164,7 +6170,8 @@ COND_TOOLKIT_MSW___LOWLEVEL_SRC_OBJECTS_1 = \
monodll_notifmsgrt.o \
monodll_uuid.o \
monodll_msw_evtloop.o \
monodll_access.o
monodll_access.o \
monodll_msw_bmpbndl.o
@COND_TOOLKIT_MSW@__LOWLEVEL_SRC_OBJECTS_1 = $(COND_TOOLKIT_MSW___LOWLEVEL_SRC_OBJECTS_1)
@COND_TOOLKIT_OSX_COCOA@__LOWLEVEL_SRC_OBJECTS_1 = \
@COND_TOOLKIT_OSX_COCOA@ $(__OSX_LOWLEVEL_SRC_OBJECTS)
@@ -6709,7 +6716,9 @@ COND_USE_GUI_1_WXUNIV_0___CORE_SRC_OBJECTS_1 = \
monolib_laywin.o \
monolib_calctrlg.o \
monolib_creddlgg.o \
monolib_rowheightcache.o
monolib_rowheightcache.o \
monolib_common_bmpbndl.o \
monolib_bmpsvg.o
@COND_USE_GUI_1_WXUNIV_0@__CORE_SRC_OBJECTS_1 = $(COND_USE_GUI_1_WXUNIV_0___CORE_SRC_OBJECTS_1)
COND_USE_GUI_1_WXUNIV_1___CORE_SRC_OBJECTS_1 = \
$(__LOWLEVEL_SRC_OBJECTS_3) \
@@ -6971,7 +6980,9 @@ COND_USE_GUI_1_WXUNIV_1___CORE_SRC_OBJECTS_1 = \
monolib_laywin.o \
monolib_calctrlg.o \
monolib_creddlgg.o \
monolib_rowheightcache.o
monolib_rowheightcache.o \
monolib_common_bmpbndl.o \
monolib_bmpsvg.o
@COND_USE_GUI_1_WXUNIV_1@__CORE_SRC_OBJECTS_1 = $(COND_USE_GUI_1_WXUNIV_1___CORE_SRC_OBJECTS_1)
COND_TOOLKIT_DFB___LOWLEVEL_SRC_OBJECTS_2 = \
monolib_fontmgrcmn.o \
@@ -7254,7 +7265,8 @@ COND_TOOLKIT_MSW___LOWLEVEL_SRC_OBJECTS_2 = \
monolib_notifmsgrt.o \
monolib_uuid.o \
monolib_msw_evtloop.o \
monolib_access.o
monolib_access.o \
monolib_msw_bmpbndl.o
@COND_TOOLKIT_MSW@__LOWLEVEL_SRC_OBJECTS_2 = $(COND_TOOLKIT_MSW___LOWLEVEL_SRC_OBJECTS_2)
@COND_TOOLKIT_OSX_COCOA@__LOWLEVEL_SRC_OBJECTS_2 = \
@COND_TOOLKIT_OSX_COCOA@ $(__OSX_LOWLEVEL_SRC_OBJECTS_17)
@@ -8161,7 +8173,8 @@ COND_TOOLKIT_MSW___LOWLEVEL_SRC_OBJECTS_3 = \
monolib_notifmsgrt.o \
monolib_uuid.o \
monolib_msw_evtloop.o \
monolib_access.o
monolib_access.o \
monolib_msw_bmpbndl.o
@COND_TOOLKIT_MSW@__LOWLEVEL_SRC_OBJECTS_3 = $(COND_TOOLKIT_MSW___LOWLEVEL_SRC_OBJECTS_3)
@COND_TOOLKIT_OSX_COCOA@__LOWLEVEL_SRC_OBJECTS_3 = \
@COND_TOOLKIT_OSX_COCOA@ $(__OSX_LOWLEVEL_SRC_OBJECTS_17)
@@ -8859,7 +8872,9 @@ COND_USE_GUI_1_WXUNIV_0___CORE_SRC_OBJECTS_2 = \
coredll_laywin.o \
coredll_calctrlg.o \
coredll_creddlgg.o \
coredll_rowheightcache.o
coredll_rowheightcache.o \
coredll_common_bmpbndl.o \
coredll_bmpsvg.o
@COND_USE_GUI_1_WXUNIV_0@__CORE_SRC_OBJECTS_2 = $(COND_USE_GUI_1_WXUNIV_0___CORE_SRC_OBJECTS_2)
COND_USE_GUI_1_WXUNIV_1___CORE_SRC_OBJECTS_2 = \
$(__LOWLEVEL_SRC_OBJECTS_5) \
@@ -9121,7 +9136,9 @@ COND_USE_GUI_1_WXUNIV_1___CORE_SRC_OBJECTS_2 = \
coredll_laywin.o \
coredll_calctrlg.o \
coredll_creddlgg.o \
coredll_rowheightcache.o
coredll_rowheightcache.o \
coredll_common_bmpbndl.o \
coredll_bmpsvg.o
@COND_USE_GUI_1_WXUNIV_1@__CORE_SRC_OBJECTS_2 = $(COND_USE_GUI_1_WXUNIV_1___CORE_SRC_OBJECTS_2)
COND_TOOLKIT_DFB___LOWLEVEL_SRC_OBJECTS_4 = \
coredll_fontmgrcmn.o \
@@ -9404,7 +9421,8 @@ COND_TOOLKIT_MSW___LOWLEVEL_SRC_OBJECTS_4 = \
coredll_notifmsgrt.o \
coredll_uuid.o \
coredll_msw_evtloop.o \
coredll_access.o
coredll_access.o \
coredll_msw_bmpbndl.o
@COND_TOOLKIT_MSW@__LOWLEVEL_SRC_OBJECTS_4 = $(COND_TOOLKIT_MSW___LOWLEVEL_SRC_OBJECTS_4)
@COND_TOOLKIT_OSX_COCOA@__LOWLEVEL_SRC_OBJECTS_4 = \
@COND_TOOLKIT_OSX_COCOA@ $(__OSX_LOWLEVEL_SRC_OBJECTS_1_1)
@@ -10311,7 +10329,8 @@ COND_TOOLKIT_MSW___LOWLEVEL_SRC_OBJECTS_5 = \
coredll_notifmsgrt.o \
coredll_uuid.o \
coredll_msw_evtloop.o \
coredll_access.o
coredll_access.o \
coredll_msw_bmpbndl.o
@COND_TOOLKIT_MSW@__LOWLEVEL_SRC_OBJECTS_5 = $(COND_TOOLKIT_MSW___LOWLEVEL_SRC_OBJECTS_5)
@COND_TOOLKIT_OSX_COCOA@__LOWLEVEL_SRC_OBJECTS_5 = \
@COND_TOOLKIT_OSX_COCOA@ $(__OSX_LOWLEVEL_SRC_OBJECTS_1_1)
@@ -10584,7 +10603,9 @@ COND_USE_GUI_1_WXUNIV_0___CORE_SRC_OBJECTS_3 = \
corelib_laywin.o \
corelib_calctrlg.o \
corelib_creddlgg.o \
corelib_rowheightcache.o
corelib_rowheightcache.o \
corelib_common_bmpbndl.o \
corelib_bmpsvg.o
@COND_USE_GUI_1_WXUNIV_0@__CORE_SRC_OBJECTS_3 = $(COND_USE_GUI_1_WXUNIV_0___CORE_SRC_OBJECTS_3)
COND_USE_GUI_1_WXUNIV_1___CORE_SRC_OBJECTS_3 = \
$(__LOWLEVEL_SRC_OBJECTS_7) \
@@ -10846,7 +10867,9 @@ COND_USE_GUI_1_WXUNIV_1___CORE_SRC_OBJECTS_3 = \
corelib_laywin.o \
corelib_calctrlg.o \
corelib_creddlgg.o \
corelib_rowheightcache.o
corelib_rowheightcache.o \
corelib_common_bmpbndl.o \
corelib_bmpsvg.o
@COND_USE_GUI_1_WXUNIV_1@__CORE_SRC_OBJECTS_3 = $(COND_USE_GUI_1_WXUNIV_1___CORE_SRC_OBJECTS_3)
COND_TOOLKIT_DFB___LOWLEVEL_SRC_OBJECTS_6 = \
corelib_fontmgrcmn.o \
@@ -11129,7 +11152,8 @@ COND_TOOLKIT_MSW___LOWLEVEL_SRC_OBJECTS_6 = \
corelib_notifmsgrt.o \
corelib_uuid.o \
corelib_msw_evtloop.o \
corelib_access.o
corelib_access.o \
corelib_msw_bmpbndl.o
@COND_TOOLKIT_MSW@__LOWLEVEL_SRC_OBJECTS_6 = $(COND_TOOLKIT_MSW___LOWLEVEL_SRC_OBJECTS_6)
@COND_TOOLKIT_OSX_COCOA@__LOWLEVEL_SRC_OBJECTS_6 = \
@COND_TOOLKIT_OSX_COCOA@ $(__OSX_LOWLEVEL_SRC_OBJECTS_1_4)
@@ -12036,7 +12060,8 @@ COND_TOOLKIT_MSW___LOWLEVEL_SRC_OBJECTS_7 = \
corelib_notifmsgrt.o \
corelib_uuid.o \
corelib_msw_evtloop.o \
corelib_access.o
corelib_access.o \
corelib_msw_bmpbndl.o
@COND_TOOLKIT_MSW@__LOWLEVEL_SRC_OBJECTS_7 = $(COND_TOOLKIT_MSW___LOWLEVEL_SRC_OBJECTS_7)
@COND_TOOLKIT_OSX_COCOA@__LOWLEVEL_SRC_OBJECTS_7 = \
@COND_TOOLKIT_OSX_COCOA@ $(__OSX_LOWLEVEL_SRC_OBJECTS_1_4)
@@ -13452,7 +13477,8 @@ COND_PLATFORM_MACOSX_1___OSX_LOWLEVEL_SRC_OBJECTS = \
monodll_hid.o \
monodll_printmac.o \
monodll_core_timer.o \
monodll_utilsexc_cf.o
monodll_utilsexc_cf.o \
monodll_core_bmpbndl.o
@COND_PLATFORM_MACOSX_1@__OSX_LOWLEVEL_SRC_OBJECTS = $(COND_PLATFORM_MACOSX_1___OSX_LOWLEVEL_SRC_OBJECTS)
@COND_PLATFORM_MACOSX_1@__PLATFORM_SRC_OBJECTS_0 = monolib_unix_apptraits.o
@COND_PLATFORM_UNIX_1@__PLATFORM_SRC_OBJECTS_0 = monolib_unix_apptraits.o
@@ -13589,7 +13615,8 @@ COND_PLATFORM_MACOSX_1___OSX_LOWLEVEL_SRC_OBJECTS_17 = \
monolib_hid.o \
monolib_printmac.o \
monolib_core_timer.o \
monolib_utilsexc_cf.o
monolib_utilsexc_cf.o \
monolib_core_bmpbndl.o
@COND_PLATFORM_MACOSX_1@__OSX_LOWLEVEL_SRC_OBJECTS_17 = $(COND_PLATFORM_MACOSX_1___OSX_LOWLEVEL_SRC_OBJECTS_17)
@COND_PLATFORM_MACOSX_1@__PLATFORM_SRC_OBJECTS_8 = coredll_unix_apptraits.o
@COND_PLATFORM_UNIX_1@__PLATFORM_SRC_OBJECTS_8 = coredll_unix_apptraits.o
@@ -13726,7 +13753,8 @@ COND_PLATFORM_MACOSX_1___OSX_LOWLEVEL_SRC_OBJECTS_1_1 = \
coredll_hid.o \
coredll_printmac.o \
coredll_core_timer.o \
coredll_utilsexc_cf.o
coredll_utilsexc_cf.o \
coredll_core_bmpbndl.o
@COND_PLATFORM_MACOSX_1@__OSX_LOWLEVEL_SRC_OBJECTS_1_1 = $(COND_PLATFORM_MACOSX_1___OSX_LOWLEVEL_SRC_OBJECTS_1_1)
@COND_PLATFORM_MACOSX_1@__PLATFORM_SRC_OBJECTS_9 = corelib_unix_apptraits.o
@COND_PLATFORM_UNIX_1@__PLATFORM_SRC_OBJECTS_9 = corelib_unix_apptraits.o
@@ -13863,7 +13891,8 @@ COND_PLATFORM_MACOSX_1___OSX_LOWLEVEL_SRC_OBJECTS_1_4 = \
corelib_hid.o \
corelib_printmac.o \
corelib_core_timer.o \
corelib_utilsexc_cf.o
corelib_utilsexc_cf.o \
corelib_core_bmpbndl.o
@COND_PLATFORM_MACOSX_1@__OSX_LOWLEVEL_SRC_OBJECTS_1_4 = $(COND_PLATFORM_MACOSX_1___OSX_LOWLEVEL_SRC_OBJECTS_1_4)
@COND_TOOLKIT_MSW@__webview_additional_include_wrl_p = \
@COND_TOOLKIT_MSW@ -I$(top_srcdir)/include/wx/msw/wrl
@@ -19033,6 +19062,9 @@ monodll_sound_sdl.o: $(srcdir)/src/unix/sound_sdl.cpp $(MONODLL_ODEP)
@COND_TOOLKIT_MSW_USE_GUI_1@monodll_access.o: $(srcdir)/src/msw/ole/access.cpp $(MONODLL_ODEP)
@COND_TOOLKIT_MSW_USE_GUI_1@ $(CXXC) -c -o $@ $(MONODLL_CXXFLAGS) $(srcdir)/src/msw/ole/access.cpp
@COND_TOOLKIT_MSW_USE_GUI_1@monodll_msw_bmpbndl.o: $(srcdir)/src/msw/bmpbndl.cpp $(MONODLL_ODEP)
@COND_TOOLKIT_MSW_USE_GUI_1@ $(CXXC) -c -o $@ $(MONODLL_CXXFLAGS) $(srcdir)/src/msw/bmpbndl.cpp
@COND_PLATFORM_MACOSX_1_TOOLKIT_OSX_COCOA_USE_GUI_1@monodll_artmac.o: $(srcdir)/src/osx/artmac.cpp $(MONODLL_ODEP)
@COND_PLATFORM_MACOSX_1_TOOLKIT_OSX_COCOA_USE_GUI_1@ $(CXXC) -c -o $@ $(MONODLL_CXXFLAGS) $(srcdir)/src/osx/artmac.cpp
@@ -19153,6 +19185,12 @@ monodll_sound_sdl.o: $(srcdir)/src/unix/sound_sdl.cpp $(MONODLL_ODEP)
@COND_PLATFORM_MACOSX_1_TOOLKIT_OSX_IPHONE_USE_GUI_1@monodll_utilsexc_cf.o: $(srcdir)/src/osx/core/utilsexc_cf.cpp $(MONODLL_ODEP)
@COND_PLATFORM_MACOSX_1_TOOLKIT_OSX_IPHONE_USE_GUI_1@ $(CXXC) -c -o $@ $(MONODLL_CXXFLAGS) $(srcdir)/src/osx/core/utilsexc_cf.cpp
@COND_PLATFORM_MACOSX_1_TOOLKIT_OSX_COCOA_USE_GUI_1@monodll_core_bmpbndl.o: $(srcdir)/src/osx/core/bmpbndl.mm $(MONODLL_ODEP)
@COND_PLATFORM_MACOSX_1_TOOLKIT_OSX_COCOA_USE_GUI_1@ $(CXXC) -c -o $@ $(MONODLL_OBJCXXFLAGS) $(srcdir)/src/osx/core/bmpbndl.mm
@COND_PLATFORM_MACOSX_1_TOOLKIT_OSX_IPHONE_USE_GUI_1@monodll_core_bmpbndl.o: $(srcdir)/src/osx/core/bmpbndl.mm $(MONODLL_ODEP)
@COND_PLATFORM_MACOSX_1_TOOLKIT_OSX_IPHONE_USE_GUI_1@ $(CXXC) -c -o $@ $(MONODLL_OBJCXXFLAGS) $(srcdir)/src/osx/core/bmpbndl.mm
@COND_TOOLKIT_X11_USE_GUI_1@monodll_generic_timer.o: $(srcdir)/src/generic/timer.cpp $(MONODLL_ODEP)
@COND_TOOLKIT_X11_USE_GUI_1@ $(CXXC) -c -o $@ $(MONODLL_CXXFLAGS) $(srcdir)/src/generic/timer.cpp
@@ -21022,6 +21060,12 @@ monodll_sound_sdl.o: $(srcdir)/src/unix/sound_sdl.cpp $(MONODLL_ODEP)
@COND_USE_GUI_1@monodll_rowheightcache.o: $(srcdir)/src/generic/rowheightcache.cpp $(MONODLL_ODEP)
@COND_USE_GUI_1@ $(CXXC) -c -o $@ $(MONODLL_CXXFLAGS) $(srcdir)/src/generic/rowheightcache.cpp
@COND_USE_GUI_1@monodll_common_bmpbndl.o: $(srcdir)/src/common/bmpbndl.cpp $(MONODLL_ODEP)
@COND_USE_GUI_1@ $(CXXC) -c -o $@ $(MONODLL_CXXFLAGS) $(srcdir)/src/common/bmpbndl.cpp
@COND_USE_GUI_1@monodll_bmpsvg.o: $(srcdir)/src/generic/bmpsvg.cpp $(MONODLL_ODEP)
@COND_USE_GUI_1@ $(CXXC) -c -o $@ $(MONODLL_CXXFLAGS) $(srcdir)/src/generic/bmpsvg.cpp
@COND_TOOLKIT_OSX_COCOA_USE_GUI_1@monodll_osx_cocoa_mediactrl.o: $(srcdir)/src/osx/cocoa/mediactrl.mm $(MONODLL_ODEP)
@COND_TOOLKIT_OSX_COCOA_USE_GUI_1@ $(CXXC) -c -o $@ $(MONODLL_OBJCXXFLAGS) $(srcdir)/src/osx/cocoa/mediactrl.mm
@@ -24325,6 +24369,9 @@ monolib_sound_sdl.o: $(srcdir)/src/unix/sound_sdl.cpp $(MONOLIB_ODEP)
@COND_TOOLKIT_MSW_USE_GUI_1@monolib_access.o: $(srcdir)/src/msw/ole/access.cpp $(MONOLIB_ODEP)
@COND_TOOLKIT_MSW_USE_GUI_1@ $(CXXC) -c -o $@ $(MONOLIB_CXXFLAGS) $(srcdir)/src/msw/ole/access.cpp
@COND_TOOLKIT_MSW_USE_GUI_1@monolib_msw_bmpbndl.o: $(srcdir)/src/msw/bmpbndl.cpp $(MONOLIB_ODEP)
@COND_TOOLKIT_MSW_USE_GUI_1@ $(CXXC) -c -o $@ $(MONOLIB_CXXFLAGS) $(srcdir)/src/msw/bmpbndl.cpp
@COND_PLATFORM_MACOSX_1_TOOLKIT_OSX_COCOA_USE_GUI_1@monolib_artmac.o: $(srcdir)/src/osx/artmac.cpp $(MONOLIB_ODEP)
@COND_PLATFORM_MACOSX_1_TOOLKIT_OSX_COCOA_USE_GUI_1@ $(CXXC) -c -o $@ $(MONOLIB_CXXFLAGS) $(srcdir)/src/osx/artmac.cpp
@@ -24445,6 +24492,12 @@ monolib_sound_sdl.o: $(srcdir)/src/unix/sound_sdl.cpp $(MONOLIB_ODEP)
@COND_PLATFORM_MACOSX_1_TOOLKIT_OSX_IPHONE_USE_GUI_1@monolib_utilsexc_cf.o: $(srcdir)/src/osx/core/utilsexc_cf.cpp $(MONOLIB_ODEP)
@COND_PLATFORM_MACOSX_1_TOOLKIT_OSX_IPHONE_USE_GUI_1@ $(CXXC) -c -o $@ $(MONOLIB_CXXFLAGS) $(srcdir)/src/osx/core/utilsexc_cf.cpp
@COND_PLATFORM_MACOSX_1_TOOLKIT_OSX_COCOA_USE_GUI_1@monolib_core_bmpbndl.o: $(srcdir)/src/osx/core/bmpbndl.mm $(MONOLIB_ODEP)
@COND_PLATFORM_MACOSX_1_TOOLKIT_OSX_COCOA_USE_GUI_1@ $(CXXC) -c -o $@ $(MONOLIB_OBJCXXFLAGS) $(srcdir)/src/osx/core/bmpbndl.mm
@COND_PLATFORM_MACOSX_1_TOOLKIT_OSX_IPHONE_USE_GUI_1@monolib_core_bmpbndl.o: $(srcdir)/src/osx/core/bmpbndl.mm $(MONOLIB_ODEP)
@COND_PLATFORM_MACOSX_1_TOOLKIT_OSX_IPHONE_USE_GUI_1@ $(CXXC) -c -o $@ $(MONOLIB_OBJCXXFLAGS) $(srcdir)/src/osx/core/bmpbndl.mm
@COND_TOOLKIT_X11_USE_GUI_1@monolib_generic_timer.o: $(srcdir)/src/generic/timer.cpp $(MONOLIB_ODEP)
@COND_TOOLKIT_X11_USE_GUI_1@ $(CXXC) -c -o $@ $(MONOLIB_CXXFLAGS) $(srcdir)/src/generic/timer.cpp
@@ -26314,6 +26367,12 @@ monolib_sound_sdl.o: $(srcdir)/src/unix/sound_sdl.cpp $(MONOLIB_ODEP)
@COND_USE_GUI_1@monolib_rowheightcache.o: $(srcdir)/src/generic/rowheightcache.cpp $(MONOLIB_ODEP)
@COND_USE_GUI_1@ $(CXXC) -c -o $@ $(MONOLIB_CXXFLAGS) $(srcdir)/src/generic/rowheightcache.cpp
@COND_USE_GUI_1@monolib_common_bmpbndl.o: $(srcdir)/src/common/bmpbndl.cpp $(MONOLIB_ODEP)
@COND_USE_GUI_1@ $(CXXC) -c -o $@ $(MONOLIB_CXXFLAGS) $(srcdir)/src/common/bmpbndl.cpp
@COND_USE_GUI_1@monolib_bmpsvg.o: $(srcdir)/src/generic/bmpsvg.cpp $(MONOLIB_ODEP)
@COND_USE_GUI_1@ $(CXXC) -c -o $@ $(MONOLIB_CXXFLAGS) $(srcdir)/src/generic/bmpsvg.cpp
@COND_TOOLKIT_OSX_COCOA_USE_GUI_1@monolib_osx_cocoa_mediactrl.o: $(srcdir)/src/osx/cocoa/mediactrl.mm $(MONOLIB_ODEP)
@COND_TOOLKIT_OSX_COCOA_USE_GUI_1@ $(CXXC) -c -o $@ $(MONOLIB_OBJCXXFLAGS) $(srcdir)/src/osx/cocoa/mediactrl.mm
@@ -29719,6 +29778,9 @@ coredll_sound_sdl.o: $(srcdir)/src/unix/sound_sdl.cpp $(COREDLL_ODEP)
@COND_TOOLKIT_MSW_USE_GUI_1@coredll_access.o: $(srcdir)/src/msw/ole/access.cpp $(COREDLL_ODEP)
@COND_TOOLKIT_MSW_USE_GUI_1@ $(CXXC) -c -o $@ $(COREDLL_CXXFLAGS) $(srcdir)/src/msw/ole/access.cpp
@COND_TOOLKIT_MSW_USE_GUI_1@coredll_msw_bmpbndl.o: $(srcdir)/src/msw/bmpbndl.cpp $(COREDLL_ODEP)
@COND_TOOLKIT_MSW_USE_GUI_1@ $(CXXC) -c -o $@ $(COREDLL_CXXFLAGS) $(srcdir)/src/msw/bmpbndl.cpp
@COND_PLATFORM_MACOSX_1_TOOLKIT_OSX_COCOA_USE_GUI_1@coredll_artmac.o: $(srcdir)/src/osx/artmac.cpp $(COREDLL_ODEP)
@COND_PLATFORM_MACOSX_1_TOOLKIT_OSX_COCOA_USE_GUI_1@ $(CXXC) -c -o $@ $(COREDLL_CXXFLAGS) $(srcdir)/src/osx/artmac.cpp
@@ -29839,6 +29901,12 @@ coredll_sound_sdl.o: $(srcdir)/src/unix/sound_sdl.cpp $(COREDLL_ODEP)
@COND_PLATFORM_MACOSX_1_TOOLKIT_OSX_IPHONE_USE_GUI_1@coredll_utilsexc_cf.o: $(srcdir)/src/osx/core/utilsexc_cf.cpp $(COREDLL_ODEP)
@COND_PLATFORM_MACOSX_1_TOOLKIT_OSX_IPHONE_USE_GUI_1@ $(CXXC) -c -o $@ $(COREDLL_CXXFLAGS) $(srcdir)/src/osx/core/utilsexc_cf.cpp
@COND_PLATFORM_MACOSX_1_TOOLKIT_OSX_COCOA_USE_GUI_1@coredll_core_bmpbndl.o: $(srcdir)/src/osx/core/bmpbndl.mm $(COREDLL_ODEP)
@COND_PLATFORM_MACOSX_1_TOOLKIT_OSX_COCOA_USE_GUI_1@ $(CXXC) -c -o $@ $(COREDLL_OBJCXXFLAGS) $(srcdir)/src/osx/core/bmpbndl.mm
@COND_PLATFORM_MACOSX_1_TOOLKIT_OSX_IPHONE_USE_GUI_1@coredll_core_bmpbndl.o: $(srcdir)/src/osx/core/bmpbndl.mm $(COREDLL_ODEP)
@COND_PLATFORM_MACOSX_1_TOOLKIT_OSX_IPHONE_USE_GUI_1@ $(CXXC) -c -o $@ $(COREDLL_OBJCXXFLAGS) $(srcdir)/src/osx/core/bmpbndl.mm
@COND_TOOLKIT_X11_USE_GUI_1@coredll_generic_timer.o: $(srcdir)/src/generic/timer.cpp $(COREDLL_ODEP)
@COND_TOOLKIT_X11_USE_GUI_1@ $(CXXC) -c -o $@ $(COREDLL_CXXFLAGS) $(srcdir)/src/generic/timer.cpp
@@ -31708,6 +31776,12 @@ coredll_sound_sdl.o: $(srcdir)/src/unix/sound_sdl.cpp $(COREDLL_ODEP)
@COND_USE_GUI_1@coredll_rowheightcache.o: $(srcdir)/src/generic/rowheightcache.cpp $(COREDLL_ODEP)
@COND_USE_GUI_1@ $(CXXC) -c -o $@ $(COREDLL_CXXFLAGS) $(srcdir)/src/generic/rowheightcache.cpp
@COND_USE_GUI_1@coredll_common_bmpbndl.o: $(srcdir)/src/common/bmpbndl.cpp $(COREDLL_ODEP)
@COND_USE_GUI_1@ $(CXXC) -c -o $@ $(COREDLL_CXXFLAGS) $(srcdir)/src/common/bmpbndl.cpp
@COND_USE_GUI_1@coredll_bmpsvg.o: $(srcdir)/src/generic/bmpsvg.cpp $(COREDLL_ODEP)
@COND_USE_GUI_1@ $(CXXC) -c -o $@ $(COREDLL_CXXFLAGS) $(srcdir)/src/generic/bmpsvg.cpp
corelib_event.o: $(srcdir)/src/common/event.cpp $(CORELIB_ODEP)
$(CXXC) -c -o $@ $(CORELIB_CXXFLAGS) $(srcdir)/src/common/event.cpp
@@ -33973,6 +34047,9 @@ corelib_sound_sdl.o: $(srcdir)/src/unix/sound_sdl.cpp $(CORELIB_ODEP)
@COND_TOOLKIT_MSW_USE_GUI_1@corelib_access.o: $(srcdir)/src/msw/ole/access.cpp $(CORELIB_ODEP)
@COND_TOOLKIT_MSW_USE_GUI_1@ $(CXXC) -c -o $@ $(CORELIB_CXXFLAGS) $(srcdir)/src/msw/ole/access.cpp
@COND_TOOLKIT_MSW_USE_GUI_1@corelib_msw_bmpbndl.o: $(srcdir)/src/msw/bmpbndl.cpp $(CORELIB_ODEP)
@COND_TOOLKIT_MSW_USE_GUI_1@ $(CXXC) -c -o $@ $(CORELIB_CXXFLAGS) $(srcdir)/src/msw/bmpbndl.cpp
@COND_PLATFORM_MACOSX_1_TOOLKIT_OSX_COCOA_USE_GUI_1@corelib_artmac.o: $(srcdir)/src/osx/artmac.cpp $(CORELIB_ODEP)
@COND_PLATFORM_MACOSX_1_TOOLKIT_OSX_COCOA_USE_GUI_1@ $(CXXC) -c -o $@ $(CORELIB_CXXFLAGS) $(srcdir)/src/osx/artmac.cpp
@@ -34093,6 +34170,12 @@ corelib_sound_sdl.o: $(srcdir)/src/unix/sound_sdl.cpp $(CORELIB_ODEP)
@COND_PLATFORM_MACOSX_1_TOOLKIT_OSX_IPHONE_USE_GUI_1@corelib_utilsexc_cf.o: $(srcdir)/src/osx/core/utilsexc_cf.cpp $(CORELIB_ODEP)
@COND_PLATFORM_MACOSX_1_TOOLKIT_OSX_IPHONE_USE_GUI_1@ $(CXXC) -c -o $@ $(CORELIB_CXXFLAGS) $(srcdir)/src/osx/core/utilsexc_cf.cpp
@COND_PLATFORM_MACOSX_1_TOOLKIT_OSX_COCOA_USE_GUI_1@corelib_core_bmpbndl.o: $(srcdir)/src/osx/core/bmpbndl.mm $(CORELIB_ODEP)
@COND_PLATFORM_MACOSX_1_TOOLKIT_OSX_COCOA_USE_GUI_1@ $(CXXC) -c -o $@ $(CORELIB_OBJCXXFLAGS) $(srcdir)/src/osx/core/bmpbndl.mm
@COND_PLATFORM_MACOSX_1_TOOLKIT_OSX_IPHONE_USE_GUI_1@corelib_core_bmpbndl.o: $(srcdir)/src/osx/core/bmpbndl.mm $(CORELIB_ODEP)
@COND_PLATFORM_MACOSX_1_TOOLKIT_OSX_IPHONE_USE_GUI_1@ $(CXXC) -c -o $@ $(CORELIB_OBJCXXFLAGS) $(srcdir)/src/osx/core/bmpbndl.mm
@COND_TOOLKIT_X11_USE_GUI_1@corelib_generic_timer.o: $(srcdir)/src/generic/timer.cpp $(CORELIB_ODEP)
@COND_TOOLKIT_X11_USE_GUI_1@ $(CXXC) -c -o $@ $(CORELIB_CXXFLAGS) $(srcdir)/src/generic/timer.cpp
@@ -35962,6 +36045,12 @@ corelib_sound_sdl.o: $(srcdir)/src/unix/sound_sdl.cpp $(CORELIB_ODEP)
@COND_USE_GUI_1@corelib_rowheightcache.o: $(srcdir)/src/generic/rowheightcache.cpp $(CORELIB_ODEP)
@COND_USE_GUI_1@ $(CXXC) -c -o $@ $(CORELIB_CXXFLAGS) $(srcdir)/src/generic/rowheightcache.cpp
@COND_USE_GUI_1@corelib_common_bmpbndl.o: $(srcdir)/src/common/bmpbndl.cpp $(CORELIB_ODEP)
@COND_USE_GUI_1@ $(CXXC) -c -o $@ $(CORELIB_CXXFLAGS) $(srcdir)/src/common/bmpbndl.cpp
@COND_USE_GUI_1@corelib_bmpsvg.o: $(srcdir)/src/generic/bmpsvg.cpp $(CORELIB_ODEP)
@COND_USE_GUI_1@ $(CXXC) -c -o $@ $(CORELIB_CXXFLAGS) $(srcdir)/src/generic/bmpsvg.cpp
advdll_version_rc.o: $(srcdir)/src/msw/version.rc $(ADVDLL_ODEP)
$(WINDRES) -i$< -o$@ $(__INC_TIFF_BUILD_p_54) $(__INC_TIFF_p_54) $(__INC_JPEG_p_54) $(__INC_PNG_p_53) $(__INC_ZLIB_p_67) $(__INC_REGEX_p_65) $(__INC_EXPAT_p_65) --define __WX$(TOOLKIT)__ $(__WXUNIV_DEFINE_p_66) $(__DEBUG_DEFINE_p_66) $(__EXCEPTIONS_DEFINE_p_65) $(__RTTI_DEFINE_p_65) $(__THREAD_DEFINE_p_65) --define WXBUILDING --define WXDLLNAME=$(WXDLLNAMEPREFIXGUI)$(WXUNICODEFLAG)$(WXDEBUGFLAG)$(WX_LIB_FLAVOUR)_adv$(WXCOMPILER)$(VENDORTAG)$(WXDLLVERSIONTAG) $(__RCDEFDIR_p) --include-dir $(top_srcdir)/include --define WXUSINGDLL --define WXMAKINGDLL_ADV

View File

@@ -1015,6 +1015,8 @@ IMPORTANT: please read docs/tech/tn0016.txt before modifying this file!
src/generic/calctrlg.cpp
src/generic/creddlgg.cpp
src/generic/rowheightcache.cpp
src/common/bmpbndl.cpp
src/generic/bmpsvg.cpp
</set>
<set var="GUI_CMN_HDR" hints="files">
wx/affinematrix2dbase.h
@@ -1306,6 +1308,7 @@ IMPORTANT: please read docs/tech/tn0016.txt before modifying this file!
wx/propdlg.h
wx/generic/creddlgg.h
wx/creddlg.h
wx/bmpbndl.h
</set>
<!-- ====================================================================== -->
@@ -2087,6 +2090,7 @@ IMPORTANT: please read docs/tech/tn0016.txt before modifying this file!
src/msw/ole/uuid.cpp
src/msw/evtloop.cpp
src/msw/ole/access.cpp
src/msw/bmpbndl.cpp
</set>
<set var="MSW_LOWLEVEL_HDR" hints="files">
wx/msw/nonownedwnd.h
@@ -2420,6 +2424,7 @@ IMPORTANT: please read docs/tech/tn0016.txt before modifying this file!
src/osx/core/printmac.cpp
src/osx/core/timer.cpp
src/osx/core/utilsexc_cf.cpp
src/osx/core/bmpbndl.mm
</if>
</set>

View File

@@ -918,6 +918,8 @@ set(GUI_CMN_SRC
src/generic/creddlgg.cpp
src/generic/rowheightcache.cpp
src/generic/animateg.cpp
src/common/bmpbndl.cpp
src/generic/bmpsvg.cpp
)
set(GUI_CMN_HDR
@@ -1209,6 +1211,7 @@ set(GUI_CMN_HDR
wx/creddlg.h
wx/generic/creddlgg.h
wx/generic/animate.h
wx/bmpbndl.h
)
set(UNIX_SRC
@@ -1961,6 +1964,7 @@ set(MSW_LOWLEVEL_SRC
src/msw/richtooltip.cpp
src/msw/evtloop.cpp
src/msw/ole/access.cpp
src/msw/bmpbndl.cpp
)
set(MSW_LOWLEVEL_HDR
@@ -2298,6 +2302,7 @@ set(OSX_LOWLEVEL_SRC
src/osx/core/timer.cpp
src/osx/core/utilsexc_cf.cpp
#TODO: </if>
src/osx/core/bmpbndl.mm
)
set(OSX_LOWLEVEL_HDR

View File

@@ -741,6 +741,7 @@ GUI_CMN_SRC =
src/common/artstd.cpp
src/common/arttango.cpp
src/common/bmpbase.cpp
src/common/bmpbndl.cpp
src/common/bmpbtncmn.cpp
src/common/bmpcboxcmn.cpp
src/common/bookctrl.cpp
@@ -871,6 +872,7 @@ GUI_CMN_SRC =
src/generic/animateg.cpp
src/generic/bannerwindow.cpp
src/generic/bmpcboxg.cpp
src/generic/bmpsvg.cpp
src/generic/busyinfo.cpp
src/generic/buttonbar.cpp
src/generic/calctrlg.cpp
@@ -950,6 +952,7 @@ GUI_CMN_HDR =
wx/artprov.h
wx/bannerwindow.h
wx/bitmap.h
wx/bmpbndl.h
wx/bmpbuttn.h
wx/bmpcbox.h
wx/bookctrl.h
@@ -1901,6 +1904,7 @@ MSW_LOWLEVEL_SRC =
src/msw/aboutdlg.cpp
src/msw/app.cpp
src/msw/bitmap.cpp
src/msw/bmpbndl.cpp
src/msw/brush.cpp
src/msw/caret.cpp
src/msw/clipbrd.cpp
@@ -2276,6 +2280,7 @@ OSX_LOWLEVEL_SRC =
src/osx/window_osx.cpp
src/osx/core/bitmap.cpp
src/osx/core/bmpbndl.mm
src/osx/core/colour.cpp
src/osx/core/dcmemory.cpp
src/osx/core/fontenum.cpp

View File

@@ -1931,6 +1931,7 @@ ____CORE_SRC_FILENAMES_OBJECTS = \
$(OBJS)\monodll_uuid.o \
$(OBJS)\monodll_evtloop.o \
$(OBJS)\monodll_access.o \
$(OBJS)\monodll_msw_bmpbndl.o \
$(OBJS)\monodll_clrpickerg.o \
$(OBJS)\monodll_collpaneg.o \
$(OBJS)\monodll_filepickerg.o \
@@ -2203,7 +2204,9 @@ ____CORE_SRC_FILENAMES_OBJECTS = \
$(OBJS)\monodll_laywin.o \
$(OBJS)\monodll_calctrlg.o \
$(OBJS)\monodll_creddlgg.o \
$(OBJS)\monodll_rowheightcache.o
$(OBJS)\monodll_rowheightcache.o \
$(OBJS)\monodll_common_bmpbndl.o \
$(OBJS)\monodll_bmpsvg.o
endif
endif
ifeq ($(USE_GUI),1)
@@ -2276,6 +2279,7 @@ ____CORE_SRC_FILENAMES_OBJECTS = \
$(OBJS)\monodll_uuid.o \
$(OBJS)\monodll_evtloop.o \
$(OBJS)\monodll_access.o \
$(OBJS)\monodll_msw_bmpbndl.o \
$(OBJS)\monodll_generic_accel.o \
$(OBJS)\monodll_clrpickerg.o \
$(OBJS)\monodll_collpaneg.o \
@@ -2533,7 +2537,9 @@ ____CORE_SRC_FILENAMES_OBJECTS = \
$(OBJS)\monodll_laywin.o \
$(OBJS)\monodll_calctrlg.o \
$(OBJS)\monodll_creddlgg.o \
$(OBJS)\monodll_rowheightcache.o
$(OBJS)\monodll_rowheightcache.o \
$(OBJS)\monodll_common_bmpbndl.o \
$(OBJS)\monodll_bmpsvg.o
endif
endif
ifeq ($(USE_STC),1)
@@ -2774,6 +2780,7 @@ ____CORE_SRC_FILENAMES_1_OBJECTS = \
$(OBJS)\monolib_uuid.o \
$(OBJS)\monolib_evtloop.o \
$(OBJS)\monolib_access.o \
$(OBJS)\monolib_msw_bmpbndl.o \
$(OBJS)\monolib_clrpickerg.o \
$(OBJS)\monolib_collpaneg.o \
$(OBJS)\monolib_filepickerg.o \
@@ -3046,7 +3053,9 @@ ____CORE_SRC_FILENAMES_1_OBJECTS = \
$(OBJS)\monolib_laywin.o \
$(OBJS)\monolib_calctrlg.o \
$(OBJS)\monolib_creddlgg.o \
$(OBJS)\monolib_rowheightcache.o
$(OBJS)\monolib_rowheightcache.o \
$(OBJS)\monolib_common_bmpbndl.o \
$(OBJS)\monolib_bmpsvg.o
endif
endif
ifeq ($(USE_GUI),1)
@@ -3119,6 +3128,7 @@ ____CORE_SRC_FILENAMES_1_OBJECTS = \
$(OBJS)\monolib_uuid.o \
$(OBJS)\monolib_evtloop.o \
$(OBJS)\monolib_access.o \
$(OBJS)\monolib_msw_bmpbndl.o \
$(OBJS)\monolib_generic_accel.o \
$(OBJS)\monolib_clrpickerg.o \
$(OBJS)\monolib_collpaneg.o \
@@ -3376,7 +3386,9 @@ ____CORE_SRC_FILENAMES_1_OBJECTS = \
$(OBJS)\monolib_laywin.o \
$(OBJS)\monolib_calctrlg.o \
$(OBJS)\monolib_creddlgg.o \
$(OBJS)\monolib_rowheightcache.o
$(OBJS)\monolib_rowheightcache.o \
$(OBJS)\monolib_common_bmpbndl.o \
$(OBJS)\monolib_bmpsvg.o
endif
endif
ifeq ($(USE_STC),1)
@@ -3500,6 +3512,7 @@ ____CORE_SRC_FILENAMES_2_OBJECTS = \
$(OBJS)\coredll_uuid.o \
$(OBJS)\coredll_evtloop.o \
$(OBJS)\coredll_access.o \
$(OBJS)\coredll_msw_bmpbndl.o \
$(OBJS)\coredll_clrpickerg.o \
$(OBJS)\coredll_collpaneg.o \
$(OBJS)\coredll_filepickerg.o \
@@ -3772,7 +3785,9 @@ ____CORE_SRC_FILENAMES_2_OBJECTS = \
$(OBJS)\coredll_laywin.o \
$(OBJS)\coredll_calctrlg.o \
$(OBJS)\coredll_creddlgg.o \
$(OBJS)\coredll_rowheightcache.o
$(OBJS)\coredll_rowheightcache.o \
$(OBJS)\coredll_common_bmpbndl.o \
$(OBJS)\coredll_bmpsvg.o
endif
endif
ifeq ($(USE_GUI),1)
@@ -3845,6 +3860,7 @@ ____CORE_SRC_FILENAMES_2_OBJECTS = \
$(OBJS)\coredll_uuid.o \
$(OBJS)\coredll_evtloop.o \
$(OBJS)\coredll_access.o \
$(OBJS)\coredll_msw_bmpbndl.o \
$(OBJS)\coredll_generic_accel.o \
$(OBJS)\coredll_clrpickerg.o \
$(OBJS)\coredll_collpaneg.o \
@@ -4102,7 +4118,9 @@ ____CORE_SRC_FILENAMES_2_OBJECTS = \
$(OBJS)\coredll_laywin.o \
$(OBJS)\coredll_calctrlg.o \
$(OBJS)\coredll_creddlgg.o \
$(OBJS)\coredll_rowheightcache.o
$(OBJS)\coredll_rowheightcache.o \
$(OBJS)\coredll_common_bmpbndl.o \
$(OBJS)\coredll_bmpsvg.o
endif
endif
ifeq ($(MONOLITHIC),0)
@@ -4183,6 +4201,7 @@ ____CORE_SRC_FILENAMES_3_OBJECTS = \
$(OBJS)\corelib_uuid.o \
$(OBJS)\corelib_evtloop.o \
$(OBJS)\corelib_access.o \
$(OBJS)\corelib_msw_bmpbndl.o \
$(OBJS)\corelib_clrpickerg.o \
$(OBJS)\corelib_collpaneg.o \
$(OBJS)\corelib_filepickerg.o \
@@ -4455,7 +4474,9 @@ ____CORE_SRC_FILENAMES_3_OBJECTS = \
$(OBJS)\corelib_laywin.o \
$(OBJS)\corelib_calctrlg.o \
$(OBJS)\corelib_creddlgg.o \
$(OBJS)\corelib_rowheightcache.o
$(OBJS)\corelib_rowheightcache.o \
$(OBJS)\corelib_common_bmpbndl.o \
$(OBJS)\corelib_bmpsvg.o
endif
endif
ifeq ($(USE_GUI),1)
@@ -4528,6 +4549,7 @@ ____CORE_SRC_FILENAMES_3_OBJECTS = \
$(OBJS)\corelib_uuid.o \
$(OBJS)\corelib_evtloop.o \
$(OBJS)\corelib_access.o \
$(OBJS)\corelib_msw_bmpbndl.o \
$(OBJS)\corelib_generic_accel.o \
$(OBJS)\corelib_clrpickerg.o \
$(OBJS)\corelib_collpaneg.o \
@@ -4785,7 +4807,9 @@ ____CORE_SRC_FILENAMES_3_OBJECTS = \
$(OBJS)\corelib_laywin.o \
$(OBJS)\corelib_calctrlg.o \
$(OBJS)\corelib_creddlgg.o \
$(OBJS)\corelib_rowheightcache.o
$(OBJS)\corelib_rowheightcache.o \
$(OBJS)\corelib_common_bmpbndl.o \
$(OBJS)\corelib_bmpsvg.o
endif
endif
ifeq ($(SHARED),1)
@@ -8418,6 +8442,11 @@ $(OBJS)\monodll_access.o: ../../src/msw/ole/access.cpp
$(CXX) -c -o $@ $(MONODLL_CXXFLAGS) $(CPPDEPS) $<
endif
ifeq ($(USE_GUI),1)
$(OBJS)\monodll_msw_bmpbndl.o: ../../src/msw/bmpbndl.cpp
$(CXX) -c -o $@ $(MONODLL_CXXFLAGS) $(CPPDEPS) $<
endif
ifeq ($(USE_GUI),1)
$(OBJS)\monodll_clrpickerg.o: ../../src/generic/clrpickerg.cpp
$(CXX) -c -o $@ $(MONODLL_CXXFLAGS) $(CPPDEPS) $<
@@ -9463,6 +9492,16 @@ $(OBJS)\monodll_rowheightcache.o: ../../src/generic/rowheightcache.cpp
$(CXX) -c -o $@ $(MONODLL_CXXFLAGS) $(CPPDEPS) $<
endif
ifeq ($(USE_GUI),1)
$(OBJS)\monodll_common_bmpbndl.o: ../../src/common/bmpbndl.cpp
$(CXX) -c -o $@ $(MONODLL_CXXFLAGS) $(CPPDEPS) $<
endif
ifeq ($(USE_GUI),1)
$(OBJS)\monodll_bmpsvg.o: ../../src/generic/bmpsvg.cpp
$(CXX) -c -o $@ $(MONODLL_CXXFLAGS) $(CPPDEPS) $<
endif
$(OBJS)\monodll_version_rc.o: ../../src/msw/version.rc
$(WINDRES) -i$< -o$@ --include-dir ../../src/tiff/libtiff --include-dir ../../src/jpeg --include-dir ../../src/png --include-dir ../../src/zlib --include-dir ../../3rdparty/pcre/src/wx --include-dir ../../src/expat/expat/lib --define __WXMSW__ $(__WXUNIV_DEFINE_p_66) $(__DEBUG_DEFINE_p_66) $(__NDEBUG_DEFINE_p_65) $(__EXCEPTIONS_DEFINE_p_65) $(__RTTI_DEFINE_p_65) $(__THREAD_DEFINE_p_65) $(__UNICODE_DEFINE_p_67) --include-dir $(SETUPHDIR) --include-dir ../../include $(__CAIRO_INCLUDEDIR_p) --define WXBUILDING --define WXDLLNAME=wx$(PORTNAME)$(WXUNIVNAME)$(WX_VERSION_NODOT)$(WXUNICODEFLAG)$(WXDEBUGFLAG)$(WX_LIB_FLAVOUR)$(WXCOMPILER)$(VENDORTAG) --include-dir ../../src/stc/scintilla/include --include-dir ../../src/stc/scintilla/lexlib --include-dir ../../src/stc/scintilla/src --define __WX__ --define SCI_LEXER --define NO_CXX11_REGEX --define LINK_LEXERS --define wxUSE_BASE=1 --define WXMAKINGDLL
@@ -10995,6 +11034,11 @@ $(OBJS)\monolib_access.o: ../../src/msw/ole/access.cpp
$(CXX) -c -o $@ $(MONOLIB_CXXFLAGS) $(CPPDEPS) $<
endif
ifeq ($(USE_GUI),1)
$(OBJS)\monolib_msw_bmpbndl.o: ../../src/msw/bmpbndl.cpp
$(CXX) -c -o $@ $(MONOLIB_CXXFLAGS) $(CPPDEPS) $<
endif
ifeq ($(USE_GUI),1)
$(OBJS)\monolib_clrpickerg.o: ../../src/generic/clrpickerg.cpp
$(CXX) -c -o $@ $(MONOLIB_CXXFLAGS) $(CPPDEPS) $<
@@ -12040,6 +12084,16 @@ $(OBJS)\monolib_rowheightcache.o: ../../src/generic/rowheightcache.cpp
$(CXX) -c -o $@ $(MONOLIB_CXXFLAGS) $(CPPDEPS) $<
endif
ifeq ($(USE_GUI),1)
$(OBJS)\monolib_common_bmpbndl.o: ../../src/common/bmpbndl.cpp
$(CXX) -c -o $@ $(MONOLIB_CXXFLAGS) $(CPPDEPS) $<
endif
ifeq ($(USE_GUI),1)
$(OBJS)\monolib_bmpsvg.o: ../../src/generic/bmpsvg.cpp
$(CXX) -c -o $@ $(MONOLIB_CXXFLAGS) $(CPPDEPS) $<
endif
$(OBJS)\basedll_dummy.o: ../../src/common/dummy.cpp
$(CXX) -c -o $@ $(BASEDLL_CXXFLAGS) $(CPPDEPS) $<
@@ -13542,6 +13596,11 @@ $(OBJS)\coredll_access.o: ../../src/msw/ole/access.cpp
$(CXX) -c -o $@ $(COREDLL_CXXFLAGS) $(CPPDEPS) $<
endif
ifeq ($(USE_GUI),1)
$(OBJS)\coredll_msw_bmpbndl.o: ../../src/msw/bmpbndl.cpp
$(CXX) -c -o $@ $(COREDLL_CXXFLAGS) $(CPPDEPS) $<
endif
ifeq ($(USE_GUI),1)
$(OBJS)\coredll_clrpickerg.o: ../../src/generic/clrpickerg.cpp
$(CXX) -c -o $@ $(COREDLL_CXXFLAGS) $(CPPDEPS) $<
@@ -14587,6 +14646,16 @@ $(OBJS)\coredll_rowheightcache.o: ../../src/generic/rowheightcache.cpp
$(CXX) -c -o $@ $(COREDLL_CXXFLAGS) $(CPPDEPS) $<
endif
ifeq ($(USE_GUI),1)
$(OBJS)\coredll_common_bmpbndl.o: ../../src/common/bmpbndl.cpp
$(CXX) -c -o $@ $(COREDLL_CXXFLAGS) $(CPPDEPS) $<
endif
ifeq ($(USE_GUI),1)
$(OBJS)\coredll_bmpsvg.o: ../../src/generic/bmpsvg.cpp
$(CXX) -c -o $@ $(COREDLL_CXXFLAGS) $(CPPDEPS) $<
endif
$(OBJS)\corelib_dummy.o: ../../src/common/dummy.cpp
$(CXX) -c -o $@ $(CORELIB_CXXFLAGS) $(CPPDEPS) $<
@@ -15282,6 +15351,11 @@ $(OBJS)\corelib_access.o: ../../src/msw/ole/access.cpp
$(CXX) -c -o $@ $(CORELIB_CXXFLAGS) $(CPPDEPS) $<
endif
ifeq ($(USE_GUI),1)
$(OBJS)\corelib_msw_bmpbndl.o: ../../src/msw/bmpbndl.cpp
$(CXX) -c -o $@ $(CORELIB_CXXFLAGS) $(CPPDEPS) $<
endif
ifeq ($(USE_GUI),1)
$(OBJS)\corelib_clrpickerg.o: ../../src/generic/clrpickerg.cpp
$(CXX) -c -o $@ $(CORELIB_CXXFLAGS) $(CPPDEPS) $<
@@ -16327,6 +16401,16 @@ $(OBJS)\corelib_rowheightcache.o: ../../src/generic/rowheightcache.cpp
$(CXX) -c -o $@ $(CORELIB_CXXFLAGS) $(CPPDEPS) $<
endif
ifeq ($(USE_GUI),1)
$(OBJS)\corelib_common_bmpbndl.o: ../../src/common/bmpbndl.cpp
$(CXX) -c -o $@ $(CORELIB_CXXFLAGS) $(CPPDEPS) $<
endif
ifeq ($(USE_GUI),1)
$(OBJS)\corelib_bmpsvg.o: ../../src/generic/bmpsvg.cpp
$(CXX) -c -o $@ $(CORELIB_CXXFLAGS) $(CPPDEPS) $<
endif
$(OBJS)\advdll_dummy.o: ../../src/common/dummy.cpp
$(CXX) -c -o $@ $(ADVDLL_CXXFLAGS) $(CPPDEPS) $<

View File

@@ -2261,6 +2261,7 @@ ____CORE_SRC_FILENAMES_OBJECTS = \
$(OBJS)\monodll_uuid.obj \
$(OBJS)\monodll_evtloop.obj \
$(OBJS)\monodll_access.obj \
$(OBJS)\monodll_msw_bmpbndl.obj \
$(OBJS)\monodll_clrpickerg.obj \
$(OBJS)\monodll_collpaneg.obj \
$(OBJS)\monodll_filepickerg.obj \
@@ -2533,7 +2534,9 @@ ____CORE_SRC_FILENAMES_OBJECTS = \
$(OBJS)\monodll_laywin.obj \
$(OBJS)\monodll_calctrlg.obj \
$(OBJS)\monodll_creddlgg.obj \
$(OBJS)\monodll_rowheightcache.obj
$(OBJS)\monodll_rowheightcache.obj \
$(OBJS)\monodll_common_bmpbndl.obj \
$(OBJS)\monodll_bmpsvg.obj
!endif
!if "$(USE_GUI)" == "1" && "$(WXUNIV)" == "1"
____CORE_SRC_FILENAMES_OBJECTS = \
@@ -2604,6 +2607,7 @@ ____CORE_SRC_FILENAMES_OBJECTS = \
$(OBJS)\monodll_uuid.obj \
$(OBJS)\monodll_evtloop.obj \
$(OBJS)\monodll_access.obj \
$(OBJS)\monodll_msw_bmpbndl.obj \
$(OBJS)\monodll_generic_accel.obj \
$(OBJS)\monodll_clrpickerg.obj \
$(OBJS)\monodll_collpaneg.obj \
@@ -2861,7 +2865,9 @@ ____CORE_SRC_FILENAMES_OBJECTS = \
$(OBJS)\monodll_laywin.obj \
$(OBJS)\monodll_calctrlg.obj \
$(OBJS)\monodll_creddlgg.obj \
$(OBJS)\monodll_rowheightcache.obj
$(OBJS)\monodll_rowheightcache.obj \
$(OBJS)\monodll_common_bmpbndl.obj \
$(OBJS)\monodll_bmpsvg.obj
!endif
!if "$(USE_STC)" == "1"
____MONOLIB_STC_SRC_FILENAMES_OBJECTS = \
@@ -3104,6 +3110,7 @@ ____CORE_SRC_FILENAMES_1_OBJECTS = \
$(OBJS)\monolib_uuid.obj \
$(OBJS)\monolib_evtloop.obj \
$(OBJS)\monolib_access.obj \
$(OBJS)\monolib_msw_bmpbndl.obj \
$(OBJS)\monolib_clrpickerg.obj \
$(OBJS)\monolib_collpaneg.obj \
$(OBJS)\monolib_filepickerg.obj \
@@ -3376,7 +3383,9 @@ ____CORE_SRC_FILENAMES_1_OBJECTS = \
$(OBJS)\monolib_laywin.obj \
$(OBJS)\monolib_calctrlg.obj \
$(OBJS)\monolib_creddlgg.obj \
$(OBJS)\monolib_rowheightcache.obj
$(OBJS)\monolib_rowheightcache.obj \
$(OBJS)\monolib_common_bmpbndl.obj \
$(OBJS)\monolib_bmpsvg.obj
!endif
!if "$(USE_GUI)" == "1" && "$(WXUNIV)" == "1"
____CORE_SRC_FILENAMES_1_OBJECTS = \
@@ -3447,6 +3456,7 @@ ____CORE_SRC_FILENAMES_1_OBJECTS = \
$(OBJS)\monolib_uuid.obj \
$(OBJS)\monolib_evtloop.obj \
$(OBJS)\monolib_access.obj \
$(OBJS)\monolib_msw_bmpbndl.obj \
$(OBJS)\monolib_generic_accel.obj \
$(OBJS)\monolib_clrpickerg.obj \
$(OBJS)\monolib_collpaneg.obj \
@@ -3704,7 +3714,9 @@ ____CORE_SRC_FILENAMES_1_OBJECTS = \
$(OBJS)\monolib_laywin.obj \
$(OBJS)\monolib_calctrlg.obj \
$(OBJS)\monolib_creddlgg.obj \
$(OBJS)\monolib_rowheightcache.obj
$(OBJS)\monolib_rowheightcache.obj \
$(OBJS)\monolib_common_bmpbndl.obj \
$(OBJS)\monolib_bmpsvg.obj
!endif
!if "$(USE_STC)" == "1"
____MONOLIB_STC_SRC_FILENAMES_1_OBJECTS = \
@@ -3880,6 +3892,7 @@ ____CORE_SRC_FILENAMES_2_OBJECTS = \
$(OBJS)\coredll_uuid.obj \
$(OBJS)\coredll_evtloop.obj \
$(OBJS)\coredll_access.obj \
$(OBJS)\coredll_msw_bmpbndl.obj \
$(OBJS)\coredll_clrpickerg.obj \
$(OBJS)\coredll_collpaneg.obj \
$(OBJS)\coredll_filepickerg.obj \
@@ -4152,7 +4165,9 @@ ____CORE_SRC_FILENAMES_2_OBJECTS = \
$(OBJS)\coredll_laywin.obj \
$(OBJS)\coredll_calctrlg.obj \
$(OBJS)\coredll_creddlgg.obj \
$(OBJS)\coredll_rowheightcache.obj
$(OBJS)\coredll_rowheightcache.obj \
$(OBJS)\coredll_common_bmpbndl.obj \
$(OBJS)\coredll_bmpsvg.obj
!endif
!if "$(USE_GUI)" == "1" && "$(WXUNIV)" == "1"
____CORE_SRC_FILENAMES_2_OBJECTS = \
@@ -4223,6 +4238,7 @@ ____CORE_SRC_FILENAMES_2_OBJECTS = \
$(OBJS)\coredll_uuid.obj \
$(OBJS)\coredll_evtloop.obj \
$(OBJS)\coredll_access.obj \
$(OBJS)\coredll_msw_bmpbndl.obj \
$(OBJS)\coredll_generic_accel.obj \
$(OBJS)\coredll_clrpickerg.obj \
$(OBJS)\coredll_collpaneg.obj \
@@ -4480,7 +4496,9 @@ ____CORE_SRC_FILENAMES_2_OBJECTS = \
$(OBJS)\coredll_laywin.obj \
$(OBJS)\coredll_calctrlg.obj \
$(OBJS)\coredll_creddlgg.obj \
$(OBJS)\coredll_rowheightcache.obj
$(OBJS)\coredll_rowheightcache.obj \
$(OBJS)\coredll_common_bmpbndl.obj \
$(OBJS)\coredll_bmpsvg.obj
!endif
!if "$(MONOLITHIC)" == "0" && "$(SHARED)" == "0" && "$(USE_GUI)" == "1"
__corelib___depname = \
@@ -4561,6 +4579,7 @@ ____CORE_SRC_FILENAMES_3_OBJECTS = \
$(OBJS)\corelib_uuid.obj \
$(OBJS)\corelib_evtloop.obj \
$(OBJS)\corelib_access.obj \
$(OBJS)\corelib_msw_bmpbndl.obj \
$(OBJS)\corelib_clrpickerg.obj \
$(OBJS)\corelib_collpaneg.obj \
$(OBJS)\corelib_filepickerg.obj \
@@ -4833,7 +4852,9 @@ ____CORE_SRC_FILENAMES_3_OBJECTS = \
$(OBJS)\corelib_laywin.obj \
$(OBJS)\corelib_calctrlg.obj \
$(OBJS)\corelib_creddlgg.obj \
$(OBJS)\corelib_rowheightcache.obj
$(OBJS)\corelib_rowheightcache.obj \
$(OBJS)\corelib_common_bmpbndl.obj \
$(OBJS)\corelib_bmpsvg.obj
!endif
!if "$(USE_GUI)" == "1" && "$(WXUNIV)" == "1"
____CORE_SRC_FILENAMES_3_OBJECTS = \
@@ -4904,6 +4925,7 @@ ____CORE_SRC_FILENAMES_3_OBJECTS = \
$(OBJS)\corelib_uuid.obj \
$(OBJS)\corelib_evtloop.obj \
$(OBJS)\corelib_access.obj \
$(OBJS)\corelib_msw_bmpbndl.obj \
$(OBJS)\corelib_generic_accel.obj \
$(OBJS)\corelib_clrpickerg.obj \
$(OBJS)\corelib_collpaneg.obj \
@@ -5161,7 +5183,9 @@ ____CORE_SRC_FILENAMES_3_OBJECTS = \
$(OBJS)\corelib_laywin.obj \
$(OBJS)\corelib_calctrlg.obj \
$(OBJS)\corelib_creddlgg.obj \
$(OBJS)\corelib_rowheightcache.obj
$(OBJS)\corelib_rowheightcache.obj \
$(OBJS)\corelib_common_bmpbndl.obj \
$(OBJS)\corelib_bmpsvg.obj
!endif
!if "$(SHARED)" == "1"
____wxcore_namedll_DEP = $(__coredll___depname)
@@ -8849,6 +8873,11 @@ $(OBJS)\monodll_access.obj: ..\..\src\msw\ole\access.cpp
$(CXX) /c /nologo /TP /Fo$@ $(MONODLL_CXXFLAGS) ..\..\src\msw\ole\access.cpp
!endif
!if "$(USE_GUI)" == "1"
$(OBJS)\monodll_msw_bmpbndl.obj: ..\..\src\msw\bmpbndl.cpp
$(CXX) /c /nologo /TP /Fo$@ $(MONODLL_CXXFLAGS) ..\..\src\msw\bmpbndl.cpp
!endif
!if "$(USE_GUI)" == "1"
$(OBJS)\monodll_clrpickerg.obj: ..\..\src\generic\clrpickerg.cpp
$(CXX) /c /nologo /TP /Fo$@ $(MONODLL_CXXFLAGS) ..\..\src\generic\clrpickerg.cpp
@@ -9894,6 +9923,16 @@ $(OBJS)\monodll_rowheightcache.obj: ..\..\src\generic\rowheightcache.cpp
$(CXX) /c /nologo /TP /Fo$@ $(MONODLL_CXXFLAGS) ..\..\src\generic\rowheightcache.cpp
!endif
!if "$(USE_GUI)" == "1"
$(OBJS)\monodll_common_bmpbndl.obj: ..\..\src\common\bmpbndl.cpp
$(CXX) /c /nologo /TP /Fo$@ $(MONODLL_CXXFLAGS) ..\..\src\common\bmpbndl.cpp
!endif
!if "$(USE_GUI)" == "1"
$(OBJS)\monodll_bmpsvg.obj: ..\..\src\generic\bmpsvg.cpp
$(CXX) /c /nologo /TP /Fo$@ $(MONODLL_CXXFLAGS) ..\..\src\generic\bmpsvg.cpp
!endif
$(OBJS)\monodll_version.res: ..\..\src\msw\version.rc
rc /fo$@ /d WIN32 /i ..\..\src\tiff\libtiff /i ..\..\src\jpeg /i ..\..\src\png /i ..\..\src\zlib /i ..\..\3rdparty\pcre\src\wx /i ..\..\src\expat\expat\lib $(____DEBUGRUNTIME_6) /d _CRT_SECURE_NO_DEPRECATE=1 /d _CRT_NON_CONFORMING_SWPRINTFS=1 /d _SCL_SECURE_NO_WARNINGS=1 $(__NO_VC_CRTDBG_p_72) $(__TARGET_CPU_COMPFLAG_p_72) /d __WXMSW__ $(__WXUNIV_DEFINE_p_66) $(__DEBUG_DEFINE_p_66) $(__NDEBUG_DEFINE_p_65) $(__EXCEPTIONS_DEFINE_p_65) $(__RTTI_DEFINE_p_65) $(__THREAD_DEFINE_p_65) $(__UNICODE_DEFINE_p_67) /i $(SETUPHDIR) /i ..\..\include $(____CAIRO_INCLUDEDIR_FILENAMES_4) /d WXBUILDING /d WXDLLNAME=wx$(PORTNAME)$(WXUNIVNAME)$(WX_VERSION_NODOT)$(WXUNICODEFLAG)$(WXDEBUGFLAG)$(WX_LIB_FLAVOUR)$(WXCOMPILER)$(VENDORTAG) /i ..\..\src\stc\scintilla\include /i ..\..\src\stc\scintilla\lexlib /i ..\..\src\stc\scintilla\src /d __WX__ /d SCI_LEXER /d NO_CXX11_REGEX /d LINK_LEXERS /d wxUSE_BASE=1 /d WXMAKINGDLL ..\..\src\msw\version.rc
@@ -11426,6 +11465,11 @@ $(OBJS)\monolib_access.obj: ..\..\src\msw\ole\access.cpp
$(CXX) /c /nologo /TP /Fo$@ $(MONOLIB_CXXFLAGS) ..\..\src\msw\ole\access.cpp
!endif
!if "$(USE_GUI)" == "1"
$(OBJS)\monolib_msw_bmpbndl.obj: ..\..\src\msw\bmpbndl.cpp
$(CXX) /c /nologo /TP /Fo$@ $(MONOLIB_CXXFLAGS) ..\..\src\msw\bmpbndl.cpp
!endif
!if "$(USE_GUI)" == "1"
$(OBJS)\monolib_clrpickerg.obj: ..\..\src\generic\clrpickerg.cpp
$(CXX) /c /nologo /TP /Fo$@ $(MONOLIB_CXXFLAGS) ..\..\src\generic\clrpickerg.cpp
@@ -12471,6 +12515,16 @@ $(OBJS)\monolib_rowheightcache.obj: ..\..\src\generic\rowheightcache.cpp
$(CXX) /c /nologo /TP /Fo$@ $(MONOLIB_CXXFLAGS) ..\..\src\generic\rowheightcache.cpp
!endif
!if "$(USE_GUI)" == "1"
$(OBJS)\monolib_common_bmpbndl.obj: ..\..\src\common\bmpbndl.cpp
$(CXX) /c /nologo /TP /Fo$@ $(MONOLIB_CXXFLAGS) ..\..\src\common\bmpbndl.cpp
!endif
!if "$(USE_GUI)" == "1"
$(OBJS)\monolib_bmpsvg.obj: ..\..\src\generic\bmpsvg.cpp
$(CXX) /c /nologo /TP /Fo$@ $(MONOLIB_CXXFLAGS) ..\..\src\generic\bmpsvg.cpp
!endif
$(OBJS)\basedll_dummy.obj: ..\..\src\common\dummy.cpp
$(CXX) /c /nologo /TP /Fo$@ $(BASEDLL_CXXFLAGS) /Ycwx/wxprec.h ..\..\src\common\dummy.cpp
@@ -13973,6 +14027,11 @@ $(OBJS)\coredll_access.obj: ..\..\src\msw\ole\access.cpp
$(CXX) /c /nologo /TP /Fo$@ $(COREDLL_CXXFLAGS) ..\..\src\msw\ole\access.cpp
!endif
!if "$(USE_GUI)" == "1"
$(OBJS)\coredll_msw_bmpbndl.obj: ..\..\src\msw\bmpbndl.cpp
$(CXX) /c /nologo /TP /Fo$@ $(COREDLL_CXXFLAGS) ..\..\src\msw\bmpbndl.cpp
!endif
!if "$(USE_GUI)" == "1"
$(OBJS)\coredll_clrpickerg.obj: ..\..\src\generic\clrpickerg.cpp
$(CXX) /c /nologo /TP /Fo$@ $(COREDLL_CXXFLAGS) ..\..\src\generic\clrpickerg.cpp
@@ -15018,6 +15077,16 @@ $(OBJS)\coredll_rowheightcache.obj: ..\..\src\generic\rowheightcache.cpp
$(CXX) /c /nologo /TP /Fo$@ $(COREDLL_CXXFLAGS) ..\..\src\generic\rowheightcache.cpp
!endif
!if "$(USE_GUI)" == "1"
$(OBJS)\coredll_common_bmpbndl.obj: ..\..\src\common\bmpbndl.cpp
$(CXX) /c /nologo /TP /Fo$@ $(COREDLL_CXXFLAGS) ..\..\src\common\bmpbndl.cpp
!endif
!if "$(USE_GUI)" == "1"
$(OBJS)\coredll_bmpsvg.obj: ..\..\src\generic\bmpsvg.cpp
$(CXX) /c /nologo /TP /Fo$@ $(COREDLL_CXXFLAGS) ..\..\src\generic\bmpsvg.cpp
!endif
$(OBJS)\corelib_dummy.obj: ..\..\src\common\dummy.cpp
$(CXX) /c /nologo /TP /Fo$@ $(CORELIB_CXXFLAGS) /Ycwx/wxprec.h ..\..\src\common\dummy.cpp
@@ -15713,6 +15782,11 @@ $(OBJS)\corelib_access.obj: ..\..\src\msw\ole\access.cpp
$(CXX) /c /nologo /TP /Fo$@ $(CORELIB_CXXFLAGS) ..\..\src\msw\ole\access.cpp
!endif
!if "$(USE_GUI)" == "1"
$(OBJS)\corelib_msw_bmpbndl.obj: ..\..\src\msw\bmpbndl.cpp
$(CXX) /c /nologo /TP /Fo$@ $(CORELIB_CXXFLAGS) ..\..\src\msw\bmpbndl.cpp
!endif
!if "$(USE_GUI)" == "1"
$(OBJS)\corelib_clrpickerg.obj: ..\..\src\generic\clrpickerg.cpp
$(CXX) /c /nologo /TP /Fo$@ $(CORELIB_CXXFLAGS) ..\..\src\generic\clrpickerg.cpp
@@ -16758,6 +16832,16 @@ $(OBJS)\corelib_rowheightcache.obj: ..\..\src\generic\rowheightcache.cpp
$(CXX) /c /nologo /TP /Fo$@ $(CORELIB_CXXFLAGS) ..\..\src\generic\rowheightcache.cpp
!endif
!if "$(USE_GUI)" == "1"
$(OBJS)\corelib_common_bmpbndl.obj: ..\..\src\common\bmpbndl.cpp
$(CXX) /c /nologo /TP /Fo$@ $(CORELIB_CXXFLAGS) ..\..\src\common\bmpbndl.cpp
!endif
!if "$(USE_GUI)" == "1"
$(OBJS)\corelib_bmpsvg.obj: ..\..\src\generic\bmpsvg.cpp
$(CXX) /c /nologo /TP /Fo$@ $(CORELIB_CXXFLAGS) ..\..\src\generic\bmpsvg.cpp
!endif
$(OBJS)\advdll_dummy.obj: ..\..\src\common\dummy.cpp
$(CXX) /c /nologo /TP /Fo$@ $(ADVDLL_CXXFLAGS) /Ycwx/wxprec.h ..\..\src\common\dummy.cpp

View File

@@ -459,6 +459,7 @@
<ClCompile Include="..\..\src\common\artstd.cpp" />
<ClCompile Include="..\..\src\common\arttango.cpp" />
<ClCompile Include="..\..\src\common\bmpbase.cpp" />
<ClCompile Include="..\..\src\common\bmpbndl.cpp" />
<ClCompile Include="..\..\src\common\bmpbtncmn.cpp" />
<ClCompile Include="..\..\src\common\bookctrl.cpp" />
<ClCompile Include="..\..\src\common\btncmn.cpp" />
@@ -591,6 +592,7 @@
<ClCompile Include="..\..\src\common\windowid.cpp" />
<ClCompile Include="..\..\src\common\wrapsizer.cpp" />
<ClCompile Include="..\..\src\common\xpmdecod.cpp" />
<ClCompile Include="..\..\src\generic\bmpsvg.cpp" />
<ClCompile Include="..\..\src\generic\preferencesg.cpp" />
<ClCompile Include="..\..\src\msw\accel.cpp">
<ObjectFileName Condition="'$(Configuration)|$(Platform)'=='DLL Release|Win32'">$(IntDir)msw_%(Filename).obj</ObjectFileName>
@@ -602,6 +604,16 @@
<ObjectFileName Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">$(IntDir)msw_%(Filename).obj</ObjectFileName>
<ObjectFileName Condition="'$(Configuration)|$(Platform)'=='Release|x64'">$(IntDir)msw_%(Filename).obj</ObjectFileName>
</ClCompile>
<ClCompile Include="..\..\src\msw\bmpbndl.cpp">
<ObjectFileName Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(IntDir)msw_%(Filename).obj</ObjectFileName>
<ObjectFileName Condition="'$(Configuration)|$(Platform)'=='DLL Debug|Win32'">$(IntDir)msw_%(Filename).obj</ObjectFileName>
<ObjectFileName Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(IntDir)msw_%(Filename).obj</ObjectFileName>
<ObjectFileName Condition="'$(Configuration)|$(Platform)'=='DLL Release|Win32'">$(IntDir)msw_%(Filename).obj</ObjectFileName>
<ObjectFileName Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">$(IntDir)msw_%(Filename).obj</ObjectFileName>
<ObjectFileName Condition="'$(Configuration)|$(Platform)'=='DLL Debug|x64'">$(IntDir)msw_%(Filename).obj</ObjectFileName>
<ObjectFileName Condition="'$(Configuration)|$(Platform)'=='Release|x64'">$(IntDir)msw_%(Filename).obj</ObjectFileName>
<ObjectFileName Condition="'$(Configuration)|$(Platform)'=='DLL Release|x64'">$(IntDir)msw_%(Filename).obj</ObjectFileName>
</ClCompile>
<ClCompile Include="..\..\src\msw\graphicsd2d.cpp" />
<ClCompile Include="..\..\src\msw\ole\access.cpp" />
<ClCompile Include="..\..\src\msw\ole\activex.cpp" />
@@ -1087,6 +1099,7 @@
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|x64'">true</ExcludedFromBuild>
</CustomBuild>
<ClInclude Include="..\..\include\wx\bmpbndl.h" />
<ClInclude Include="..\..\include\wx\msw\accel.h" />
<ClInclude Include="..\..\include\wx\msw\appprogress.h" />
<ClInclude Include="..\..\include\wx\msw\ole\access.h" />
@@ -1509,4 +1522,4 @@
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
<ImportGroup Label="ExtensionTargets">
</ImportGroup>
</Project>
</Project>

View File

@@ -1068,6 +1068,15 @@
<ClCompile Include="..\..\src\xrc\xmlreshandler.cpp">
<Filter>Common Sources</Filter>
</ClCompile>
<ClCompile Include="..\..\src\common\bmpbndl.cpp">
<Filter>Common Sources</Filter>
</ClCompile>
<ClCompile Include="..\..\src\msw\bmpbndl.cpp">
<Filter>MSW Sources</Filter>
</ClCompile>
<ClCompile Include="..\..\src\generic\bmpsvg.cpp">
<Filter>Generic Sources</Filter>
</ClCompile>
</ItemGroup>
<ItemGroup>
<ResourceCompile Include="..\..\src\msw\version.rc">
@@ -2299,6 +2308,9 @@
<ClInclude Include="..\..\include\wx\xrc\xmlreshandler.h">
<Filter>Common Headers</Filter>
</ClInclude>
<ClInclude Include="..\..\include\wx\bmpbndl.h">
<Filter>Common Headers</Filter>
</ClInclude>
</ItemGroup>
<ItemGroup>
<CustomBuild Include="..\..\include\wx\msw\setup.h">

View File

@@ -785,6 +785,74 @@
RelativePath="..\..\src\common\bmpbase.cpp"
>
</File>
<File
RelativePath="..\..\src\common\bmpbndl.cpp"
>
<FileConfiguration
Name="Debug|Win32"
>
<Tool
Name="VCCLCompilerTool"
ObjectFile="vc_mswud\core\common_bmpbndl.obj"
/>
</FileConfiguration>
<FileConfiguration
Name="Release|Win32"
>
<Tool
Name="VCCLCompilerTool"
ObjectFile="vc_mswu\core\common_bmpbndl.obj"
/>
</FileConfiguration>
<FileConfiguration
Name="DLL Debug|Win32"
>
<Tool
Name="VCCLCompilerTool"
ObjectFile="vc_mswuddll\core\common_bmpbndl.obj"
/>
</FileConfiguration>
<FileConfiguration
Name="DLL Release|Win32"
>
<Tool
Name="VCCLCompilerTool"
ObjectFile="vc_mswudll\core\common_bmpbndl.obj"
/>
</FileConfiguration>
<FileConfiguration
Name="Debug|x64"
>
<Tool
Name="VCCLCompilerTool"
ObjectFile="vc_x64_mswud\core\common_bmpbndl.obj"
/>
</FileConfiguration>
<FileConfiguration
Name="Release|x64"
>
<Tool
Name="VCCLCompilerTool"
ObjectFile="vc_x64_mswu\core\common_bmpbndl.obj"
/>
</FileConfiguration>
<FileConfiguration
Name="DLL Debug|x64"
>
<Tool
Name="VCCLCompilerTool"
ObjectFile="vc_x64_mswuddll\core\common_bmpbndl.obj"
/>
</FileConfiguration>
<FileConfiguration
Name="DLL Release|x64"
>
<Tool
Name="VCCLCompilerTool"
ObjectFile="vc_x64_mswudll\core\common_bmpbndl.obj"
/>
</FileConfiguration>
</File>
<File
RelativePath="..\..\src\common\bmpbtncmn.cpp"
>
@@ -1422,6 +1490,74 @@
RelativePath="..\..\src\msw\bitmap.cpp"
>
</File>
<File
RelativePath="..\..\src\msw\bmpbndl.cpp"
>
<FileConfiguration
Name="Debug|Win32"
>
<Tool
Name="VCCLCompilerTool"
ObjectFile="vc_mswud\core\msw_bmpbndl.obj"
/>
</FileConfiguration>
<FileConfiguration
Name="Release|Win32"
>
<Tool
Name="VCCLCompilerTool"
ObjectFile="vc_mswu\core\msw_bmpbndl.obj"
/>
</FileConfiguration>
<FileConfiguration
Name="DLL Debug|Win32"
>
<Tool
Name="VCCLCompilerTool"
ObjectFile="vc_mswuddll\core\msw_bmpbndl.obj"
/>
</FileConfiguration>
<FileConfiguration
Name="DLL Release|Win32"
>
<Tool
Name="VCCLCompilerTool"
ObjectFile="vc_mswudll\core\msw_bmpbndl.obj"
/>
</FileConfiguration>
<FileConfiguration
Name="Debug|x64"
>
<Tool
Name="VCCLCompilerTool"
ObjectFile="vc_x64_mswud\core\msw_bmpbndl.obj"
/>
</FileConfiguration>
<FileConfiguration
Name="Release|x64"
>
<Tool
Name="VCCLCompilerTool"
ObjectFile="vc_x64_mswu\core\msw_bmpbndl.obj"
/>
</FileConfiguration>
<FileConfiguration
Name="DLL Debug|x64"
>
<Tool
Name="VCCLCompilerTool"
ObjectFile="vc_x64_mswuddll\core\msw_bmpbndl.obj"
/>
</FileConfiguration>
<FileConfiguration
Name="DLL Release|x64"
>
<Tool
Name="VCCLCompilerTool"
ObjectFile="vc_x64_mswudll\core\msw_bmpbndl.obj"
/>
</FileConfiguration>
</File>
<File
RelativePath="..\..\src\msw\bmpbuttn.cpp"
>
@@ -1951,6 +2087,10 @@
RelativePath="..\..\src\generic\bmpcboxg.cpp"
>
</File>
<File
RelativePath="..\..\src\generic\bmpsvg.cpp"
>
</File>
<File
RelativePath="..\..\src\generic\busyinfo.cpp"
>
@@ -3316,6 +3456,10 @@
RelativePath="..\..\include\wx\bitmap.h"
>
</File>
<File
RelativePath="..\..\include\wx\bmpbndl.h"
>
</File>
<File
RelativePath="..\..\include\wx\bmpbuttn.h"
>

View File

@@ -781,6 +781,74 @@
RelativePath="..\..\src\common\bmpbase.cpp"
>
</File>
<File
RelativePath="..\..\src\common\bmpbndl.cpp"
>
<FileConfiguration
Name="Debug|Win32"
>
<Tool
Name="VCCLCompilerTool"
ObjectFile="vc_mswud\core\common_bmpbndl.obj"
/>
</FileConfiguration>
<FileConfiguration
Name="Release|Win32"
>
<Tool
Name="VCCLCompilerTool"
ObjectFile="vc_mswu\core\common_bmpbndl.obj"
/>
</FileConfiguration>
<FileConfiguration
Name="DLL Debug|Win32"
>
<Tool
Name="VCCLCompilerTool"
ObjectFile="vc_mswuddll\core\common_bmpbndl.obj"
/>
</FileConfiguration>
<FileConfiguration
Name="DLL Release|Win32"
>
<Tool
Name="VCCLCompilerTool"
ObjectFile="vc_mswudll\core\common_bmpbndl.obj"
/>
</FileConfiguration>
<FileConfiguration
Name="Debug|x64"
>
<Tool
Name="VCCLCompilerTool"
ObjectFile="vc_x64_mswud\core\common_bmpbndl.obj"
/>
</FileConfiguration>
<FileConfiguration
Name="Release|x64"
>
<Tool
Name="VCCLCompilerTool"
ObjectFile="vc_x64_mswu\core\common_bmpbndl.obj"
/>
</FileConfiguration>
<FileConfiguration
Name="DLL Debug|x64"
>
<Tool
Name="VCCLCompilerTool"
ObjectFile="vc_x64_mswuddll\core\common_bmpbndl.obj"
/>
</FileConfiguration>
<FileConfiguration
Name="DLL Release|x64"
>
<Tool
Name="VCCLCompilerTool"
ObjectFile="vc_x64_mswudll\core\common_bmpbndl.obj"
/>
</FileConfiguration>
</File>
<File
RelativePath="..\..\src\common\bmpbtncmn.cpp"
>
@@ -1418,6 +1486,74 @@
RelativePath="..\..\src\msw\bitmap.cpp"
>
</File>
<File
RelativePath="..\..\src\msw\bmpbndl.cpp"
>
<FileConfiguration
Name="Debug|Win32"
>
<Tool
Name="VCCLCompilerTool"
ObjectFile="vc_mswud\core\msw_bmpbndl.obj"
/>
</FileConfiguration>
<FileConfiguration
Name="Release|Win32"
>
<Tool
Name="VCCLCompilerTool"
ObjectFile="vc_mswu\core\msw_bmpbndl.obj"
/>
</FileConfiguration>
<FileConfiguration
Name="DLL Debug|Win32"
>
<Tool
Name="VCCLCompilerTool"
ObjectFile="vc_mswuddll\core\msw_bmpbndl.obj"
/>
</FileConfiguration>
<FileConfiguration
Name="DLL Release|Win32"
>
<Tool
Name="VCCLCompilerTool"
ObjectFile="vc_mswudll\core\msw_bmpbndl.obj"
/>
</FileConfiguration>
<FileConfiguration
Name="Debug|x64"
>
<Tool
Name="VCCLCompilerTool"
ObjectFile="vc_x64_mswud\core\msw_bmpbndl.obj"
/>
</FileConfiguration>
<FileConfiguration
Name="Release|x64"
>
<Tool
Name="VCCLCompilerTool"
ObjectFile="vc_x64_mswu\core\msw_bmpbndl.obj"
/>
</FileConfiguration>
<FileConfiguration
Name="DLL Debug|x64"
>
<Tool
Name="VCCLCompilerTool"
ObjectFile="vc_x64_mswuddll\core\msw_bmpbndl.obj"
/>
</FileConfiguration>
<FileConfiguration
Name="DLL Release|x64"
>
<Tool
Name="VCCLCompilerTool"
ObjectFile="vc_x64_mswudll\core\msw_bmpbndl.obj"
/>
</FileConfiguration>
</File>
<File
RelativePath="..\..\src\msw\bmpbuttn.cpp"
>
@@ -1947,6 +2083,10 @@
RelativePath="..\..\src\generic\bmpcboxg.cpp"
>
</File>
<File
RelativePath="..\..\src\generic\bmpsvg.cpp"
>
</File>
<File
RelativePath="..\..\src\generic\busyinfo.cpp"
>
@@ -3312,6 +3452,10 @@
RelativePath="..\..\include\wx\bitmap.h"
>
</File>
<File
RelativePath="..\..\include\wx\bmpbndl.h"
>
</File>
<File
RelativePath="..\..\include\wx\bmpbuttn.h"
>

View File

@@ -209,6 +209,7 @@ Currently the following symbols exist:
@itemdef{wxHAS_REGEX_ADVANCED, Defined if advanced syntax is available in
wxRegEx. This is always the case in wxWidgets 3.1.6 and later, so this
symbol doesn't need to be tested any more.}
@itemdef{wxHAS_SVG, Defined if SVG support (currently only via wxBitmapBundle::FromSVG()) is available.}
@itemdef{wxHAS_TASK_BAR_ICON, Defined if wxTaskBarIcon is available on the current platform.}
@itemdef{wxHAS_WINDOW_LABEL_IN_STATIC_BOX, Defined if wxStaticBox::Create()
overload taking @c wxWindow* instead of the text label is available on the current platform.}

View File

@@ -15,6 +15,7 @@
#include "wx/bitmap.h"
#include "wx/icon.h"
#include "wx/iconbndl.h"
#include "wx/bmpbndl.h"
class WXDLLIMPEXP_FWD_CORE wxArtProvidersList;
class WXDLLIMPEXP_FWD_CORE wxArtProviderCache;
@@ -157,6 +158,14 @@ public:
const wxArtClient& client = wxASCII_STR(wxART_OTHER),
const wxSize& size = wxDefaultSize);
// Query the providers for bitmapbundle with given ID and return it.
// If none is available, then the search for a bitmap with the same properties
// is performed. If successful, the bitmap is wrapped into a bitmap bundle.
static wxBitmapBundle
GetBitmapBundle(const wxArtID& id,
const wxArtClient& client = wxASCII_STR(wxART_OTHER),
const wxSize& size = wxDefaultSize);
// Query the providers for icon with given ID and return it. Return
// wxNullIcon if no provider provides it.
static wxIcon GetIcon(const wxArtID& id,
@@ -225,6 +234,15 @@ protected:
return wxNullBitmap;
}
// Derived classes must override CreateBitmapBundle if they provide
// a bundle that cannot be represented through an ordinary bitmap.
virtual wxBitmapBundle CreateBitmapBundle(const wxArtID& id,
const wxArtClient& client,
const wxSize& size)
{
return wxBitmapBundle(CreateBitmap(id, client, size));
}
virtual wxIconBundle CreateIconBundle(const wxArtID& WXUNUSED(id),
const wxArtClient& WXUNUSED(client))
{

189
include/wx/bmpbndl.h Normal file
View File

@@ -0,0 +1,189 @@
///////////////////////////////////////////////////////////////////////////////
// Name: wx/bmpbndl.h
// Purpose: Declaration of wxBitmapBundle class.
// Author: Vadim Zeitlin
// Created: 2021-09-22
// Copyright: (c) 2021 Vadim Zeitlin <vadim@wxwidgets.org>
// Licence: wxWindows licence
///////////////////////////////////////////////////////////////////////////////
#ifndef _WX_BMPBNDL_H_
#define _WX_BMPBNDL_H_
#include "wx/bitmap.h"
#include "wx/object.h"
#include "wx/vector.h"
class wxBitmapBundleImpl;
// It should be possible to implement SVG rasterizing without raw bitmap
// support using wxDC::DrawSpline(), but currently we don't do it and so
// FromSVG() is only available in the ports providing raw bitmap access.
#ifdef wxHAS_RAW_BITMAP
#define wxHAS_SVG
#endif
// ----------------------------------------------------------------------------
// wxBitmapBundle provides 1 or more versions of a bitmap, all bundled together
// ----------------------------------------------------------------------------
// This class has value semantics and can be copied cheaply.
class WXDLLIMPEXP_CORE wxBitmapBundle
{
public:
// Default ctor constructs an empty bundle which can't be used for
// anything, but can be assigned something later.
wxBitmapBundle();
// This conversion ctor from a single bitmap does the same thing as
// FromBitmap() and only exists for interoperability with the existing code
// using wxBitmap.
wxBitmapBundle(const wxBitmap& bitmap);
// Another conversion ctor from a single image: this one is needed to allow
// passing wxImage to the functions that used to take wxBitmap but now take
// wxBitmapBundle.
wxBitmapBundle(const wxImage& image);
// Default copy ctor and assignment operator and dtor would be ok, but need
// to be defined out of line, where wxBitmapBundleImpl is fully declared.
wxBitmapBundle(const wxBitmapBundle& other);
wxBitmapBundle& operator=(const wxBitmapBundle& other);
~wxBitmapBundle();
// Create from the given collection of bitmaps (all of which must be valid,
// but if the vector itself is empty, empty bundle is returned).
static wxBitmapBundle FromBitmaps(const wxVector<wxBitmap>& bitmaps);
static wxBitmapBundle FromBitmaps(const wxBitmap& bitmap1,
const wxBitmap& bitmap2);
// Create from a single bitmap (this is only useful for compatibility
// with the existing code). Returns empty bundle if bitmap is invalid.
static wxBitmapBundle FromBitmap(const wxBitmap& bitmap);
static wxBitmapBundle FromImage(const wxImage& image);
// It should be possible to implement SVG rasterizing without raw bitmap
// support using wxDC::DrawSpline(), but currently we don't do it and so
// FromSVG() is only available in the ports providing raw bitmap access.
#ifdef wxHAS_SVG
// Create from the SVG data (data is supposed to be in UTF-8 encoding).
// Notice that the data here is non-const because it can be temporarily
// modified while parsing it.
static wxBitmapBundle FromSVG(char* data, const wxSize sizeDef);
// This overload currently makes a copy of the data.
static wxBitmapBundle FromSVG(const char* data, const wxSize sizeDef);
#endif // wxHAS_SVG
// Create from the resources: all existing versions of the bitmap of the
// form name_2x or name@2x (and also using other factors) will be used.
static wxBitmapBundle FromResources(const wxString& name);
// Create from existing implementation
static wxBitmapBundle FromImpl(wxBitmapBundleImpl* impl);
// Check if bitmap bundle is non-empty.
bool IsOk() const { return m_impl; }
// Get the size of the bitmap represented by this bundle when using the
// default DPI, i.e. 100% scaling. Returns invalid size for empty bundle.
wxSize GetDefaultSize() const;
// Get bitmap of the specified size, creating a new bitmap from the closest
// available size by rescaling it if necessary.
//
// If size == wxDefaultSize, GetDefaultSize() is used for it instead.
wxBitmap GetBitmap(const wxSize size) const;
// Access implementation
wxBitmapBundleImpl* GetImpl() const { return m_impl.get(); }
private:
typedef wxObjectDataPtr<wxBitmapBundleImpl> wxBitmapBundleImplPtr;
// Private ctor used by static factory functions to create objects of this
// class. It takes ownership of the pointer (which must be non-null).
explicit wxBitmapBundle(wxBitmapBundleImpl* impl);
wxBitmapBundleImplPtr m_impl;
};
// This macro can be used to create a bundle from resources on the platforms
// that support it and from name_png and name_2x_png on the other ones.
#ifdef wxHAS_IMAGE_RESOURCES
#define wxBITMAP_BUNDLE_2(name) wxBitmapBundle::FromResources(#name)
#else
#define wxBITMAP_BUNDLE_2(name) \
wxBitmapBundle::FromBitmaps(wxBITMAP_PNG_FROM_DATA(name), \
wxBITMAP_PNG_FROM_DATA(name##_2x))
#endif
// Inline functions implementation.
/* static */ inline
wxBitmapBundle wxBitmapBundle::FromBitmaps(const wxBitmap& bitmap1,
const wxBitmap& bitmap2)
{
wxVector<wxBitmap> bitmaps;
if ( bitmap1.IsOk() )
bitmaps.push_back(bitmap1);
if ( bitmap2.IsOk() )
bitmaps.push_back(bitmap2);
return FromBitmaps(bitmaps);
}
/* static */ inline
wxBitmapBundle wxBitmapBundle::FromBitmap(const wxBitmap& bitmap)
{
if ( !bitmap.IsOk() )
return wxBitmapBundle();
wxVector<wxBitmap> bitmaps;
bitmaps.push_back(bitmap);
return FromBitmaps(bitmaps);
}
/* static */ inline
wxBitmapBundle wxBitmapBundle::FromImage(const wxImage& image)
{
if ( !image.IsOk() )
return wxBitmapBundle();
return FromBitmap(wxBitmap(image));
}
// ----------------------------------------------------------------------------
// wxBitmapBundleImpl is the base class for all wxBitmapBundle implementations
// ----------------------------------------------------------------------------
// This class inherits from wxRefCounter to make it possible to use it with
// wxObjectDataPtr in wxBitmapBundle.
//
// It doesn't need to be used directly, but may be inherited from in order to
// implement custom bitmap bundles.
class wxBitmapBundleImpl : public wxRefCounter
{
public:
// Return the size of the bitmaps represented by this bundle in the default
// DPI (a.k.a. 100% resolution).
//
// Must always return a valid size.
virtual wxSize GetDefaultSize() const = 0;
// Retrieve the bitmap of exactly the given size.
//
// Note that this function is non-const because it may generate the bitmap
// on demand and cache it.
virtual wxBitmap GetBitmap(const wxSize size) = 0;
#ifdef __WXOSX__
// returns the native representation of the bitmap bundle
virtual WXImage OSXGetImage() const { return NULL; }
#endif
};
#endif // _WX_BMPBNDL_H_

View File

@@ -66,8 +66,8 @@ protected:
virtual wxToolBarToolBase *CreateTool(int id,
const wxString& label,
const wxBitmap& bmpNormal,
const wxBitmap& bmpDisabled,
const wxBitmapBundle& bmpNormal,
const wxBitmapBundle& bmpDisabled,
wxItemKind kind,
wxObject *clientData,
const wxString& shortHelp,

View File

@@ -47,8 +47,8 @@ public:
virtual void SetWindowStyleFlag( long style ) wxOVERRIDE;
virtual void SetToolNormalBitmap(int id, const wxBitmap& bitmap) wxOVERRIDE;
virtual void SetToolDisabledBitmap(int id, const wxBitmap& bitmap) wxOVERRIDE;
virtual void SetToolNormalBitmap(int id, const wxBitmapBundle& bitmap) wxOVERRIDE;
virtual void SetToolDisabledBitmap(int id, const wxBitmapBundle& bitmap) wxOVERRIDE;
virtual bool Realize() wxOVERRIDE;
@@ -57,8 +57,8 @@ public:
virtual wxToolBarToolBase *CreateTool(int id,
const wxString& label,
const wxBitmap& bitmap1,
const wxBitmap& bitmap2 = wxNullBitmap,
const wxBitmapBundle& bitmap1,
const wxBitmapBundle& bitmap2 = wxNullBitmap,
wxItemKind kind = wxITEM_NORMAL,
wxObject *clientData = NULL,
const wxString& shortHelpString = wxEmptyString,

View File

@@ -83,8 +83,8 @@ protected:
virtual wxToolBarToolBase *CreateTool(int id,
const wxString& label,
const wxBitmap& bitmap1,
const wxBitmap& bitmap2,
const wxBitmapBundle& bitmap1,
const wxBitmapBundle& bitmap2,
wxItemKind kind,
wxObject *clientData,
const wxString& shortHelpString,

View File

@@ -62,8 +62,8 @@ private:
virtual wxToolBarToolBase *CreateTool(int id,
const wxString& label,
const wxBitmap& bmpNormal,
const wxBitmap& bmpDisabled,
const wxBitmapBundle& bmpNormal,
const wxBitmapBundle& bmpDisabled,
wxItemKind kind,
wxObject *clientData,
const wxString& shortHelp,

View File

@@ -53,8 +53,8 @@ public:
virtual void SetRows(int nRows) wxOVERRIDE;
virtual void SetToolNormalBitmap(int id, const wxBitmap& bitmap) wxOVERRIDE;
virtual void SetToolDisabledBitmap(int id, const wxBitmap& bitmap) wxOVERRIDE;
virtual void SetToolNormalBitmap(int id, const wxBitmapBundle& bitmap) wxOVERRIDE;
virtual void SetToolDisabledBitmap(int id, const wxBitmapBundle& bitmap) wxOVERRIDE;
virtual void SetToolPacking(int packing) wxOVERRIDE;
@@ -89,8 +89,8 @@ public:
virtual wxToolBarToolBase *CreateTool(int id,
const wxString& label,
const wxBitmap& bmpNormal,
const wxBitmap& bmpDisabled = wxNullBitmap,
const wxBitmapBundle& bmpNormal,
const wxBitmapBundle& bmpDisabled = wxNullBitmap,
wxItemKind kind = wxITEM_NORMAL,
wxObject *clientData = NULL,
const wxString& shortHelp = wxEmptyString,

View File

@@ -23,6 +23,8 @@
// shared between Cocoa and Carbon
//
#include "wx/bmpbndl.h"
// bring in theming types without pulling in the headers
#if wxUSE_GUI
@@ -42,7 +44,7 @@ WX_NSImage WXDLLIMPEXP_CORE wxOSXGetNSImageFromIconRef( WXHICON iconref );
WX_NSImage WXDLLIMPEXP_CORE wxOSXGetNSImageFromCFURL( CFURLRef urlref );
WX_NSImage WXDLLIMPEXP_CORE wxOSXGetIconForType(OSType type );
void WXDLLIMPEXP_CORE wxOSXSetImageSize(WX_NSImage image, CGFloat width, CGFloat height);
wxBitmap WXDLLIMPEXP_CORE wxOSXCreateSystemBitmap(const wxString& id, const wxString &client, const wxSize& size);
wxBitmapBundle WXDLLIMPEXP_CORE wxOSXCreateSystemBitmapBundle(const wxString& id, const wxString &client, const wxSize& size);
WXWindow WXDLLIMPEXP_CORE wxOSXGetMainWindow();
WXWindow WXDLLIMPEXP_CORE wxOSXGetKeyWindow();
WXImage WXDLLIMPEXP_CORE wxOSXGetNSImageFromNSCursor(const WXHCURSOR cursor);

View File

@@ -24,6 +24,8 @@
#if wxUSE_GUI
#include "wx/bmpbndl.h"
typedef CGRect WXRect;
OSStatus WXDLLIMPEXP_CORE wxMacDrawCGImage(
@@ -32,7 +34,7 @@ OSStatus WXDLLIMPEXP_CORE wxMacDrawCGImage(
CGImageRef inImage) ;
WX_UIImage WXDLLIMPEXP_CORE wxOSXGetUIImageFromCGImage( CGImageRef image );
wxBitmap WXDLLIMPEXP_CORE wxOSXCreateSystemBitmap(const wxString& id, const wxString &client, const wxSize& size);
wxBitmapBundle WXDLLIMPEXP_CORE wxOSXCreateSystemBitmapBundle(const wxString& id, const wxString &client, const wxSize& size);
class WXDLLIMPEXP_CORE wxWidgetIPhoneImpl : public wxWidgetImpl
{

View File

@@ -58,8 +58,9 @@ public:
virtual void SetRows(int nRows) wxOVERRIDE;
virtual void SetToolNormalBitmap(int id, const wxBitmap& bitmap) wxOVERRIDE;
virtual void SetToolDisabledBitmap(int id, const wxBitmap& bitmap) wxOVERRIDE;
virtual void SetToolNormalBitmap(int id, const wxBitmapBundle& bitmap) wxOVERRIDE;
virtual void SetToolDisabledBitmap(int id, const wxBitmapBundle& bitmap) wxOVERRIDE;
#ifndef __WXOSX_IPHONE__
// Add all the buttons
@@ -83,8 +84,8 @@ public:
virtual wxToolBarToolBase *CreateTool(int id,
const wxString& label,
const wxBitmap& bmpNormal,
const wxBitmap& bmpDisabled = wxNullBitmap,
const wxBitmapBundle& bmpNormal,
const wxBitmapBundle& bmpDisabled = wxNullBitmap,
wxItemKind kind = wxITEM_NORMAL,
wxObject *clientData = NULL,
const wxString& shortHelp = wxEmptyString,

View File

@@ -15,6 +15,7 @@
#if wxUSE_PREFERENCES_EDITOR
#include "wx/bitmap.h"
#include "wx/bmpbndl.h"
#include "wx/vector.h"
class WXDLLIMPEXP_FWD_CORE wxWindow;

View File

@@ -0,0 +1,28 @@
///////////////////////////////////////////////////////////////////////////////
// Name: wx/private/bmpbndl.h
// Purpose: wxBitmapBundleImpl declaration.
// Author: Vadim Zeitlin
// Created: 2021-09-22
// Copyright: (c) 2021 Vadim Zeitlin <vadim@wxwidgets.org>
// Licence: wxWindows licence
///////////////////////////////////////////////////////////////////////////////
#ifndef _WX_PRIVATE_BMPBNDL_H_
#define _WX_PRIVATE_BMPBNDL_H_
#include "wx/bmpbndl.h"
#ifdef __WXOSX__
// this methods are wx-private, may change in the future
WXImage WXDLLIMPEXP_CORE wxOSXGetImageFromBundle(const wxBitmapBundle& bundle);
wxBitmapBundle WXDLLIMPEXP_CORE wxOSXMakeBundleFromImage(WXImage image);
WXImage WXDLLIMPEXP_CORE wxOSXImageFromBitmap(const wxBitmap& bmp);
#if wxOSX_USE_COCOA
void WXDLLIMPEXP_CORE wxOSXAddBitmapToImage(WXImage image, const wxBitmap& bmp);
#endif
#endif
#endif // _WX_PRIVATE_BMPBNDL_H_

View File

@@ -43,15 +43,15 @@ public:
virtual void SetWindowStyleFlag( long style ) wxOVERRIDE;
virtual void SetToolShortHelp(int id, const wxString& helpString) wxOVERRIDE;
virtual void SetToolNormalBitmap(int id, const wxBitmap& bitmap) wxOVERRIDE;
virtual void SetToolDisabledBitmap(int id, const wxBitmap& bitmap) wxOVERRIDE;
virtual void SetToolNormalBitmap(int id, const wxBitmapBundle& bitmap) wxOVERRIDE;
virtual void SetToolDisabledBitmap(int id, const wxBitmapBundle& bitmap) wxOVERRIDE;
virtual bool Realize() wxOVERRIDE;
virtual wxToolBarToolBase *CreateTool(int toolid,
const wxString& label,
const wxBitmap& bmpNormal,
const wxBitmap& bmpDisabled = wxNullBitmap,
const wxBitmapBundle& bmpNormal,
const wxBitmapBundle& bmpDisabled = wxNullBitmap,
wxItemKind kind = wxITEM_NORMAL,
wxObject *clientData = NULL,
const wxString& shortHelp = wxEmptyString,

View File

@@ -20,6 +20,7 @@
#if wxUSE_TOOLBAR
#include "wx/bitmap.h"
#include "wx/bmpbndl.h"
#include "wx/list.h"
#include "wx/control.h"
@@ -63,8 +64,8 @@ public:
wxToolBarToolBase(wxToolBarBase *tbar = NULL,
int toolid = wxID_SEPARATOR,
const wxString& label = wxEmptyString,
const wxBitmap& bmpNormal = wxNullBitmap,
const wxBitmap& bmpDisabled = wxNullBitmap,
const wxBitmapBundle& bmpNormal = wxNullBitmap,
const wxBitmapBundle& bmpDisabled = wxNullBitmap,
wxItemKind kind = wxITEM_NORMAL,
wxObject *clientData = NULL,
const wxString& shortHelpString = wxEmptyString,
@@ -145,11 +146,13 @@ public:
{ return m_kind == wxITEM_CHECK || m_kind == wxITEM_RADIO; }
// attributes
const wxBitmap& GetNormalBitmap() const { return m_bmpNormal; }
const wxBitmap& GetDisabledBitmap() const { return m_bmpDisabled; }
wxBitmap GetNormalBitmap(const wxSize& size = wxDefaultSize) const
{ return m_bmpNormal.GetBitmap(size); }
wxBitmap GetDisabledBitmap(const wxSize& size = wxDefaultSize) const
{ return m_bmpDisabled.GetBitmap(size); }
const wxBitmap& GetBitmap() const
{ return IsEnabled() ? GetNormalBitmap() : GetDisabledBitmap(); }
wxBitmap GetBitmap(const wxSize& size = wxDefaultSize) const
{ return IsEnabled() ? GetNormalBitmap(size) : GetDisabledBitmap(size); }
const wxString& GetLabel() const { return m_label; }
@@ -177,8 +180,8 @@ public:
void Toggle() { Toggle(!IsToggled()); }
void SetNormalBitmap(const wxBitmap& bmp) { m_bmpNormal = bmp; }
void SetDisabledBitmap(const wxBitmap& bmp) { m_bmpDisabled = bmp; }
void SetNormalBitmap(const wxBitmapBundle& bmp) { m_bmpNormal = bmp; }
void SetDisabledBitmap(const wxBitmapBundle& bmp) { m_bmpDisabled = bmp; }
virtual void SetLabel(const wxString& label) { m_label = label; }
@@ -251,8 +254,8 @@ protected:
bool m_enabled;
// normal and disabled bitmaps for the tool, both can be invalid
wxBitmap m_bmpNormal;
wxBitmap m_bmpDisabled;
wxBitmapBundle m_bmpNormal;
wxBitmapBundle m_bmpDisabled;
// the button label
wxString m_label;
@@ -290,8 +293,8 @@ public:
// is created and used as the disabled image.
wxToolBarToolBase *AddTool(int toolid,
const wxString& label,
const wxBitmap& bitmap,
const wxBitmap& bmpDisabled,
const wxBitmapBundle& bitmap,
const wxBitmapBundle& bmpDisabled,
wxItemKind kind = wxITEM_NORMAL,
const wxString& shortHelp = wxEmptyString,
const wxString& longHelp = wxEmptyString,
@@ -304,7 +307,7 @@ public:
// the most common AddTool() version
wxToolBarToolBase *AddTool(int toolid,
const wxString& label,
const wxBitmap& bitmap,
const wxBitmapBundle& bitmap,
const wxString& shortHelp = wxEmptyString,
wxItemKind kind = wxITEM_NORMAL)
{
@@ -314,8 +317,8 @@ public:
// add a check tool, i.e. a tool which can be toggled
wxToolBarToolBase *AddCheckTool(int toolid,
const wxString& label,
const wxBitmap& bitmap,
const wxBitmap& bmpDisabled = wxNullBitmap,
const wxBitmapBundle& bitmap,
const wxBitmapBundle& bmpDisabled = wxNullBitmap,
const wxString& shortHelp = wxEmptyString,
const wxString& longHelp = wxEmptyString,
wxObject *clientData = NULL)
@@ -328,8 +331,8 @@ public:
// other toggled radio tools in the same group when it happens
wxToolBarToolBase *AddRadioTool(int toolid,
const wxString& label,
const wxBitmap& bitmap,
const wxBitmap& bmpDisabled = wxNullBitmap,
const wxBitmapBundle& bitmap,
const wxBitmapBundle& bmpDisabled = wxNullBitmap,
const wxString& shortHelp = wxEmptyString,
const wxString& longHelp = wxEmptyString,
wxObject *clientData = NULL)
@@ -346,8 +349,8 @@ public:
size_t pos,
int toolid,
const wxString& label,
const wxBitmap& bitmap,
const wxBitmap& bmpDisabled = wxNullBitmap,
const wxBitmapBundle& bitmap,
const wxBitmapBundle& bmpDisabled = wxNullBitmap,
wxItemKind kind = wxITEM_NORMAL,
const wxString& shortHelp = wxEmptyString,
const wxString& longHelp = wxEmptyString,
@@ -427,9 +430,9 @@ public:
virtual wxString GetToolLongHelp(int toolid) const;
virtual void SetToolNormalBitmap(int WXUNUSED(id),
const wxBitmap& WXUNUSED(bitmap)) {}
const wxBitmapBundle& WXUNUSED(bitmap)) {}
virtual void SetToolDisabledBitmap(int WXUNUSED(id),
const wxBitmap& WXUNUSED(bitmap)) {}
const wxBitmapBundle& WXUNUSED(bitmap)) {}
// margins/packing/separation
@@ -576,8 +579,8 @@ public:
// -------------------------
virtual wxToolBarToolBase *CreateTool(int toolid,
const wxString& label,
const wxBitmap& bmpNormal,
const wxBitmap& bmpDisabled = wxNullBitmap,
const wxBitmapBundle& bmpNormal,
const wxBitmapBundle& bmpDisabled = wxNullBitmap,
wxItemKind kind = wxITEM_NORMAL,
wxObject *clientData = NULL,
const wxString& shortHelp = wxEmptyString,
@@ -625,8 +628,8 @@ protected:
(
int toolid,
const wxString& label,
const wxBitmap& bitmap,
const wxBitmap& bmpDisabled,
const wxBitmapBundle& bitmap,
const wxBitmapBundle& bmpDisabled,
wxItemKind kind,
const wxString& shortHelp = wxEmptyString,
const wxString& longHelp = wxEmptyString,

View File

@@ -91,8 +91,8 @@ protected:
virtual wxToolBarToolBase *CreateTool(int id,
const wxString& label,
const wxBitmap& bmpNormal,
const wxBitmap& bmpDisabled,
const wxBitmapBundle& bmpNormal,
const wxBitmapBundle& bmpDisabled,
wxItemKind kind,
wxObject *clientData,
const wxString& shortHelp,

View File

@@ -44,6 +44,7 @@
#include "wx/gdiobj.h"
#include "wx/region.h"
#include "wx/bitmap.h"
#include "wx/bmpbndl.h"
#include "wx/image.h"
#include "wx/colour.h"
#include "wx/font.h"

View File

@@ -110,13 +110,21 @@ const char* wxART_EDIT;
class MyProvider : public wxArtProvider
{
protected:
// Override this method to return a bundle containing the required
// bitmap in all available sizes.
wxBitmapBundle CreateBitmapBundle(const wxArtID& id,
const wxArtClient& client,
const wxSize& size) override;
// If all bitmaps are available in a single size only, it may be
// simpler to override just this one.
wxBitmap CreateBitmap(const wxArtID& id,
const wxArtClient& client,
const wxSize& size);
const wxSize& size) override;
// optionally override this one as well
wxIconBundle CreateIconBundle(const wxArtID& id,
const wxArtClient& client);
const wxArtClient& client) override;
{ ... }
};
...
@@ -128,8 +136,8 @@ const char* wxART_EDIT;
and supplying icon bundles that contain different bitmap sizes.
There's another way of taking advantage of this class: you can use it in your
code and use platform native icons as provided by wxArtProvider::GetBitmap or
wxArtProvider::GetIcon.
code and use platform native icons as provided by wxArtProvider::GetBitmapBundle
or wxArtProvider::GetIcon.
@section artprovider_identify Identifying art resources
@@ -272,6 +280,9 @@ public:
/**
Query registered providers for bitmap with given ID.
Note that applications using wxWidgets 3.1.6 or later should prefer
calling GetBitmapBundle().
@param id
wxArtID unique identifier of the bitmap.
@param client
@@ -286,6 +297,28 @@ public:
const wxArtClient& client = wxART_OTHER,
const wxSize& size = wxDefaultSize);
/**
Query registered providers for a bundle of bitmaps with given ID.
@since 3.1.6
@param id
wxArtID unique identifier of the bitmap.
@param client
wxArtClient identifier of the client (i.e. who is asking for the bitmap).
@param size
Default size for the returned bundle.
@return If any of the registered providers recognizes the ID in its
CreateBitmapBundle(), this bundle is returned. Otherwise, if any of
providers returns a valid bitmap from CreateBitmap(), the bundle
containing only this bitmap is returned. Otherwise, an empty bundle
is returned.
*/
static wxBitmapBundle GetBitmapBundle(const wxArtID& id,
const wxArtClient& client = wxART_OTHER,
const wxSize& size = wxDefaultSize);
/**
Same as wxArtProvider::GetBitmap, but return a wxIcon object
(or ::wxNullIcon on failure).
@@ -404,8 +437,13 @@ public:
protected:
/**
Derived art provider classes must override this method to create requested art
resource. Note that returned bitmaps are cached by wxArtProvider and it is
Derived art provider classes may override this method to create requested art
resource.
For bitmaps available in more than one size, CreateBitmapBundle()
should be overridden instead.
Note that returned bitmaps are cached by wxArtProvider and it is
therefore not necessary to optimize CreateBitmap() for speed (e.g. you may
create wxBitmap objects from XPMs here).
@@ -429,6 +467,29 @@ protected:
const wxArtClient& client,
const wxSize& size);
/**
Override this method to create the requested art resources available in
more than one size.
Unlike CreateBitmap(), this method can be overridden to return the same
bitmap in several (or all, if wxBitmapBundle::FromSVG() is used) sizes
at once, which will allow selecting the size best suited for the
current display resolution automatically.
@param id
wxArtID unique identifier of the bitmap.
@param client
wxArtClient identifier of the client (i.e. who is asking for the bitmap).
This only serves as a hint.
@param size
Default size of the bitmaps returned by the bundle.
@since 3.1.6
*/
virtual wxBitmapBundle CreateBitmapBundle(const wxArtID& id,
const wxArtClient& client,
const wxSize& size);
/**
This method is similar to CreateBitmap() but can be used when a bitmap
(or an icon) exists in several sizes.

341
interface/wx/bmpbndl.h Normal file
View File

@@ -0,0 +1,341 @@
/////////////////////////////////////////////////////////////////////////////
// Name: wx/bmpbndl.h
// Purpose: Interface of wxBitmapBundle.
// Author: Vadim Zeitlin
// Created: 2021-09-24
// Copyright: (c) 2021 Vadim Zeitlin <vadim@wxwidgets.org>
// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
/**
Contains representations of the same bitmap in different resolutions.
This class generalizes wxBitmap for applications supporting multiple DPIs
and allows to operate with multiple versions of the same bitmap, in the
sizes appropriate to the currently used display resolution, as a single
unit. Notably, an entire wxBitmapBundle can be passed to functions such as
wxToolBar::AddTool() to allow toolbar to select the best available bitmap
to be shown.
Objects of this class are typically created by the application and then
passed to wxWidgets functions, but not used by the application itself.
Currently bitmap bundles can be created from:
- A vector of bitmaps, of any provenance.
- A single wxBitmap or wxImage for backwards compatibility.
More functions for creating bitmap bundles will be added in the future.
Objects of wxBitmapBundle class have value-like semantics, i.e. they can be
copied around freely (and cheaply) and don't need to be allocated on the
heap. However they usually are created using static factory functions
(known as "pseudo-constructors") such as FromBitmaps() instead of using the
real constructors.
Example of using this class to initialize a toolbar in a frame constructor:
@code
MyFrame::MyFrame()
: wxFrame(nullptr, wxID_ANY, "My frame")
{
...
wxToolBar* toolBar = CreateToolBar();
wxVector<wxBitmap> bitmaps;
bitmaps.push_back(wxBITMAP_PNG(open_32x32));
bitmaps.push_back(wxBITMAP_PNG(open_48x48));
bitmaps.push_back(wxBITMAP_PNG(open_64x64));
toolBar->AddTool(wxID_OPEN, wxBitmapBundle::FromBitmaps(bitmaps));
}
@endcode
The code shown above will use 32 pixel bitmap in normal DPI, 64 pixel
bitmap in "high DPI", i.e. pixel-doubling or 200% resolution, and 48 pixel
bitmap in 150% resolution. For all the other resolutions, the best matching
bitmap will be created dynamically from the best available match, e.g. for
175% resolution, 64 pixel bitmap will be rescaled to 56 pixels.
Of course, this code relies on actually having the resources with the
corresponding names (i.e. @c open_NxN) in MSW .rc file or Mac application
bundle and @c open_NxN_png arrays being defined in the program code, e.g.
by including a file generated with @c bin2c (see wxBITMAP_PNG_FROM_DATA()),
on the other platforms.
For the platforms with resources support, you can also create the bundle
from the bitmaps defined in the resources, which has the advantage of not
having to explicitly list all the bitmaps, e.g. the code above becomes
@code
#ifdef wxHAS_IMAGE_RESOURCES
toolBar->AddTool(wxID_OPEN, wxBitmapBundle::FromResources("open"));
#else
... same code as shown above ...
#endif
@endcode
and will load all resources called @c open, @c open_2x, @c open_1_5x etc
(at least the first one of them must be available). See also
wxBITMAP_BUNDLE_2() macro which can avoid the need to check for
wxHAS_IMAGE_RESOURCES explicitly in the code in a common case of having
only 2 embedded resources (for standard and high DPI).
Also note that the existing code using wxBitmap is compatible with the
functions taking wxBitmapBundle in wxWidgets 3.1.6 and later because
bitmaps are implicitly convertible to the objects of this class, so just
passing wxBitmap to the functions taking wxBitmapBundle continues to work
and if high resolution versions of bitmap are not (yet) available for the
other toolbar tools, single bitmaps can continue to be used instead.
@library{wxcore}
@category{gdi}
@since 3.1.6
*/
class wxBitmapBundle
{
public:
/**
Default constructor constructs an empty bundle.
An empty bundle can't be used for anything, but can be assigned
something else later.
*/
wxBitmapBundle();
/**
Conversion constructor from a single bitmap.
This constructor does the same thing as FromBitmap() and only exists
for interoperability with the existing code using wxBitmap.
*/
wxBitmapBundle(const wxBitmap& bitmap);
/**
Conversion constructor from a single image.
Similarly to the constructor from wxBitmap, this constructor only
exists for interoperability with the existing code using wxImage and
can be replaced with more readable FromImage() in the new code.
*/
wxBitmapBundle(const wxImage& image);
/**
Copy constructor creates a copy of another bundle.
*/
wxBitmapBundle(const wxBitmapBundle& other);
/**
Assignment operator makes this bundle a copy of another bundle.
*/
wxBitmapBundle& operator=(const wxBitmapBundle& other);
/**
Create a bundle from the given collection of bitmaps.
If the @a bitmaps vector is empty, an invalid, empty bundle is
returned, otherwise initialize the bundle with all the bitmaps in this
vector which must be themselves valid.
*/
static wxBitmapBundle FromBitmaps(const wxVector<wxBitmap>& bitmaps);
/// @overload
static wxBitmapBundle FromBitmaps(const wxBitmap& bitmap1,
const wxBitmap& bitmap2);
/**
Create a bundle from a single bitmap.
This is only useful for compatibility with the existing code using
wxBitmap.
If @a bitmap is invalid, empty bundle is returned.
*/
static wxBitmapBundle FromBitmap(const wxBitmap& bitmap);
/**
Create a bundle from a single image.
This is only useful for compatibility with the existing code using
wxImage.
If @a image is invalid, empty bundle is returned.
*/
static wxBitmapBundle FromImage(const wxImage& image);
/**
Create a bundle from a custom bitmap bundle implementation.
This function can be used to create bundles implementing custom logic
for creating the bitmaps, e.g. creating them on the fly rather than
using predefined bitmaps.
See wxBitmapBundleImpl.
@param impl A valid, i.e. non-null, pointer. This function takes
ownership of it, so the caller must @e not call DecRef() on it.
*/
static wxBitmapBundle FromImpl(wxBitmapBundleImpl* impl);
/**
Create a bundle from the bitmaps in the application resources.
This function can only be used on the platforms supporting storing
bitmaps in resources, and currently only works under MSW and simply
returns an empty bundle on the other platforms.
Under MSW, for this function to create a valid bundle, you must have @c
RCDATA resource with the given @a name in your application resource
file (with the extension @c .rc) containing PNG file, and any other
resources using @a name as prefix and suffix with the scale, e.g. "_2x"
or "_1_5x" (for 150% DPI) will be also loaded as part of the bundle.
*/
static wxBitmapBundle FromResources(const wxString& name);
/**
Create a bundle from the SVG image.
Please note that the current implementation uses NanoSVG library
(https://github.com/memononen/nanosvg) for parsing and rasterizing SVG
images which imposes the following limitations:
- Text elements are not supported at all.
- SVG 1.1 filters are not supported.
These limitations will be relaxed in the future wxWidgets versions.
Please also note that this method is only available in the ports
providing raw bitmap access via wxPixelData. This is the case for all
tier-1 ports, but not all of them, check if @c wxHAS_SVG is defined
before using this method if for maximum portability.
@param data This data may, or not, have the XML document preamble, i.e.
it can start either with @c "<?xml" processing instruction or
directly with @c svg tag. Notice that two overloads of this
function, taking const and non-const data, are provided: as the
current implementation modifies the data while parsing, using the
non-const variant is more efficient, as it avoids making copy of
the data, but the data is consumed by it and can't be reused any
more.
@param sizeDef The default size to return from GetDefaultSize() for
this bundle. As SVG images usually don't have any natural
default size, it should be provided when creating the bundle.
*/
static wxBitmapBundle FromSVG(char* data, const wxSize sizeDef);
/// @overload
static wxBitmapBundle FromSVG(const char* data, const wxSize sizeDef);
/**
Check if bitmap bundle is non-empty.
Return @true if the bundle contains any bitmaps or @false if it is
empty.
*/
bool IsOk() const;
/**
Get the size of the bitmap represented by this bundle in default
resolution or, equivalently, at 100% scaling.
When creating the bundle from a number of bitmaps, this will be just
the size of the smallest bitmap in it.
Note that this function is mostly used by wxWidgets itself and not the
application.
*/
wxSize GetDefaultSize() const;
/**
Get bitmap of the specified size, creating a new bitmap from the closest
available size by rescaling it if necessary.
This function is mostly used by wxWidgets itself and not the
application. As all bitmaps created by it dynamically are currently
cached, avoid calling it for many different sizes if you do use it, as
this will create many bitmaps that will never be deleted and will
consume resources until the application termination.
*/
wxBitmap GetBitmap(const wxSize size) const;
};
/**
Base class for custom implementations of wxBitmapBundle.
This class shouldn't be used directly in the application code, but may be
derived from to implement custom bitmap bundles.
Example of use:
@code
class MyCustomBitmapBundleImpl : public wxBitmapBundleImpl
{
public:
MyCustomBitmapBundleImpl()
{
}
wxSize GetDefaultSize() const wxOVERRIDE
{
... determine the minimum/default size for bitmap to use ...
}
wxBitmap GetBitmap(const wxSize size) wxOVERRIDE
{
... get the bitmap of the requested size from somewhere and
cache it if necessary, i.e. if getting it is expensive ...
}
};
toolBar->AddTool(wxID_OPEN, wxBitmapBundle::FromImpl(new MyCustomBitmapBundleImpl());
@endcode
Full (but still very simple) example of using it can be found in the
toolbar sample code.
@library{wxcore}
@category{gdi}
@since 3.1.6
*/
class wxBitmapBundleImpl : public wxRefCounter
{
public:
/**
Return the size of the bitmaps represented by this bundle in the default
DPI.
Must always return a valid size.
*/
virtual wxSize GetDefaultSize() const = 0;
/**
Retrieve the bitmap of exactly the given size.
Note that this function is non-const because it may generate the bitmap
on demand and cache it.
*/
virtual wxBitmap GetBitmap(const wxSize size) = 0;
};
/**
Creates a wxBitmapBundle from resources on the platforms supporting them or
from two embedded bitmaps otherwise.
This macro use wxBitmapBundle::FromResources() with the provide @a name,
which must be an @e identifier and not a string, i.e. used without quotes,
on the platforms where it works and wxBitmapBundle::FromBitmaps() with @c
name_png and @c name_2x_png arrays containing PNG data elsewhere.
Using it allows to avoid using preprocessor checks in the common case when
just two bitmaps (for standard and high DPI) are embedded in the
application code. Note that all bitmaps defined in the resources, even if
there are more than 2 of them.
Example of use:
@code
toolBar->AddTool(wxID_OPEN, wxBITMAP_BUNDLE_2(open));
@endcode
@header{wx/bmpbndl.h}
@since 3.1.6
*/
#define wxBITMAP_BUNDLE_2(name)

View File

@@ -83,8 +83,8 @@ public:
wxToolBarToolBase(wxToolBarBase *tbar = NULL,
int toolid = wxID_SEPARATOR,
const wxString& label = wxEmptyString,
const wxBitmap& bmpNormal = wxNullBitmap,
const wxBitmap& bmpDisabled = wxNullBitmap,
const wxBitmapBundle& bmpNormal = wxNullBitmap,
const wxBitmapBundle& bmpDisabled = wxNullBitmap,
wxItemKind kind = wxITEM_NORMAL,
wxObject *clientData = NULL,
const wxString& shortHelpString = wxEmptyString,
@@ -112,10 +112,10 @@ public:
bool IsToggled() const;
bool CanBeToggled() const;
const wxBitmap& GetNormalBitmap() const;
const wxBitmap& GetDisabledBitmap() const;
wxBitmap GetNormalBitmap() const;
wxBitmap GetDisabledBitmap() const;
const wxBitmap& GetBitmap() const;
wxBitmap GetBitmap() const;
const wxString& GetLabel() const;
const wxString& GetShortHelp() const;
@@ -129,8 +129,8 @@ public:
bool SetShortHelp(const wxString& help);
bool SetLongHelp(const wxString& help);
void Toggle();
void SetNormalBitmap(const wxBitmap& bmp);
void SetDisabledBitmap(const wxBitmap& bmp);
void SetNormalBitmap(const wxBitmapBundle& bmp);
void SetDisabledBitmap(const wxBitmapBundle& bmp);
void SetLabel(const wxString& label);
void SetClientData(wxObject *clientData);
@@ -318,8 +318,8 @@ public:
@see AddTool()
*/
wxToolBarToolBase* AddCheckTool(int toolId, const wxString& label,
const wxBitmap& bitmap1,
const wxBitmap& bmpDisabled = wxNullBitmap,
const wxBitmapBundle& bitmap1,
const wxBitmapBundle& bmpDisabled = wxNullBitmap,
const wxString& shortHelp = wxEmptyString,
const wxString& longHelp = wxEmptyString,
wxObject* clientData = NULL);
@@ -354,8 +354,8 @@ public:
@see AddTool()
*/
wxToolBarToolBase* AddRadioTool(int toolId, const wxString& label,
const wxBitmap& bitmap1,
const wxBitmap& bmpDisabled = wxNullBitmap,
const wxBitmapBundle& bitmap1,
const wxBitmapBundle& bmpDisabled = wxNullBitmap,
const wxString& shortHelp = wxEmptyString,
const wxString& longHelp = wxEmptyString,
wxObject* clientData = NULL);
@@ -436,7 +436,7 @@ public:
InsertTool(), DeleteTool(), Realize(), SetDropdownMenu()
*/
wxToolBarToolBase* AddTool(int toolId, const wxString& label,
const wxBitmap& bitmap,
const wxBitmapBundle& bitmap,
const wxString& shortHelp = wxEmptyString,
wxItemKind kind = wxITEM_NORMAL);
@@ -478,8 +478,8 @@ public:
InsertTool(), DeleteTool(), Realize(), SetDropdownMenu()
*/
wxToolBarToolBase* AddTool(int toolId, const wxString& label,
const wxBitmap& bitmap,
const wxBitmap& bmpDisabled,
const wxBitmapBundle& bitmap,
const wxBitmapBundle& bmpDisabled,
wxItemKind kind = wxITEM_NORMAL,
const wxString& shortHelp = wxEmptyString,
const wxString& longHelp = wxEmptyString,
@@ -727,8 +727,8 @@ public:
wxToolBarToolBase* InsertTool( size_t pos,
int toolId,
const wxString& label,
const wxBitmap& bitmap,
const wxBitmap& bmpDisabled = wxNullBitmap,
const wxBitmapBundle& bitmap,
const wxBitmapBundle& bmpDisabled = wxNullBitmap,
wxItemKind kind = wxITEM_NORMAL,
const wxString& shortHelp = wxEmptyString,
const wxString& longHelp = wxEmptyString,
@@ -860,6 +860,11 @@ public:
Sets the default size of each tool bitmap. The default bitmap size is 16
by 15 pixels.
Note that @a size does @e not need to be multiplied by the
DPI-dependent factor even under MSW, where it would normally be
necessary, as the toolbar adjusts this size to the current DPI
automatically.
@param size
The size of the bitmaps in the toolbar.
@@ -895,7 +900,7 @@ public:
have no effect on those platforms.
*/
virtual void SetToolDisabledBitmap(int id, const wxBitmap& bitmap);
virtual void SetToolDisabledBitmap(int id, const wxBitmapBundle& bitmap);
/**
Sets the long help for the given tool.
@@ -921,7 +926,7 @@ public:
@param bitmap
Bitmap to use for normals tools.
*/
virtual void SetToolNormalBitmap(int id, const wxBitmap& bitmap);
virtual void SetToolNormalBitmap(int id, const wxBitmapBundle& bitmap);
/**
Sets the value used for spacing tools. The default value is 1.
@@ -982,8 +987,8 @@ public:
*/
virtual wxToolBarToolBase *CreateTool(int toolId,
const wxString& label,
const wxBitmap& bmpNormal,
const wxBitmap& bmpDisabled = wxNullBitmap,
const wxBitmapBundle& bmpNormal,
const wxBitmapBundle& bmpDisabled = wxNullBitmap,
wxItemKind kind = wxITEM_NORMAL,
wxObject *clientData = NULL,
const wxString& shortHelp = wxEmptyString,

View File

@@ -25,6 +25,7 @@
#endif
#include "wx/toolbar.h"
#include "wx/bmpbndl.h"
#include "wx/log.h"
#include "wx/image.h"
#include "wx/filedlg.h"
@@ -72,6 +73,18 @@
#include "bitmaps/help_2x_png.c"
#endif // !wxHAS_IMAGE_RESOURCES
// Real SVGs would typically be loaded from files, but to keep things as simple
// as possible here, we embed this one directly in the program text.
static const char svg_data[] =
"<svg version=\"1.1\" viewBox=\"0.0 0.0 360.0 360.0\" xmlns:xlink=\"http://www.w3.org/1999/xlink\" xmlns=\"http://www.w3.org/2000/svg\">"
"<g>"
"<path stroke=\"#000000\" fill=\"#ff0000\" d=\"m 10 170 c0 -12 10 -24 24 -24 l100 0 c6 0 12 2 17 7 c4 4 7 10 7 17 l0 100 c0 12 -10 24 -24 24 l-100 0c-12 0 -24 -10 -24 -24 z\"/>"
"<path stroke=\"#000000\" fill=\"#0000ff\" d=\"m100 90 c0 -12 10 -24 24 -24 l100 0 c6 0 12 2 17 7 c4 4 7 10 7 17 l0 100 c0 12 -10 24 -24 24 l-100 0c-12 0 -24 -10 -24 -24 z\"/>"
"<path stroke=\"#000000\" fill=\"#ffff00\" d=\"m210 140 c0 -12 10 -24 24 -24 l100 0 c6 0 12 2 17 7 c4 4 7 10 7 17 l0 100 c0 12 -10 24 -24 24 l-100 0c-12 0 -24 -10 -24 -24 z\"/>"
"</g>"
"</svg>"
;
enum Positions
{
TOOLBAR_LEFT,
@@ -95,12 +108,7 @@ public:
class MyFrame: public wxFrame
{
public:
MyFrame(wxFrame *parent,
wxWindowID id = wxID_ANY,
const wxString& title = "wxToolBar Sample",
const wxPoint& pos = wxDefaultPosition,
const wxSize& size = wxDefaultSize,
long style = wxDEFAULT_FRAME_STYLE|wxCLIP_CHILDREN);
MyFrame();
virtual ~MyFrame();
void PopulateToolbar(wxToolBarBase* toolBar);
@@ -110,7 +118,6 @@ public:
void OnAbout(wxCommandEvent& event);
void OnSize(wxSizeEvent& event);
void OnDPIChanged(wxDPIChangedEvent& event);
void OnToggleToolbar(wxCommandEvent& event);
void OnToggleAnotherToolbar(wxCommandEvent& event);
@@ -236,15 +243,14 @@ enum
// event tables
// ----------------------------------------------------------------------------
// Notice that wxID_HELP will be processed for the 'About' menu and the toolbar
// Notice that wxID_ABOUT will be processed for the 'About' menu and the toolbar
// help button.
wxBEGIN_EVENT_TABLE(MyFrame, wxFrame)
EVT_SIZE(MyFrame::OnSize)
EVT_DPI_CHANGED(MyFrame::OnDPIChanged)
EVT_MENU(wxID_EXIT, MyFrame::OnQuit)
EVT_MENU(wxID_HELP, MyFrame::OnAbout)
EVT_MENU(wxID_ABOUT, MyFrame::OnAbout)
EVT_MENU(IDM_TOOLBAR_TOGGLE_TOOLBAR, MyFrame::OnToggleToolbar)
EVT_MENU(IDM_TOOLBAR_TOGGLE_ANOTHER_TOOLBAR, MyFrame::OnToggleAnotherToolbar)
@@ -313,9 +319,7 @@ bool MyApp::OnInit()
wxImage::AddHandler(new wxPNGHandler);
// Create the main frame window
MyFrame* frame = new MyFrame((wxFrame *) NULL, wxID_ANY,
"wxToolBar Sample",
wxPoint(100, 100), wxDefaultSize);
MyFrame* frame = new MyFrame();
frame->Show(true);
@@ -386,48 +390,46 @@ void MyFrame::PopulateToolbar(wxToolBarBase* toolBar)
Tool_paste,
Tool_print,
Tool_help,
Tool_about,
Tool_Max
};
wxBitmap toolBarBitmaps[Tool_Max];
wxBitmapBundle toolBarBitmaps[Tool_Max];
if ( GetDPIScaleFactor() >= 1.5 )
{
toolBarBitmaps[Tool_new ] = wxBITMAP_PNG(new_2x );
toolBarBitmaps[Tool_open ] = wxBITMAP_PNG(open_2x );
toolBarBitmaps[Tool_save ] = wxBITMAP_PNG(save_2x );
toolBarBitmaps[Tool_copy ] = wxBITMAP_PNG(copy_2x );
toolBarBitmaps[Tool_cut ] = wxBITMAP_PNG(cut_2x );
toolBarBitmaps[Tool_paste] = wxBITMAP_PNG(paste_2x);
toolBarBitmaps[Tool_print] = wxBITMAP_PNG(print_2x);
toolBarBitmaps[Tool_help ] = wxBITMAP_PNG(help_2x );
}
else
{
toolBarBitmaps[Tool_new ] = wxBITMAP_PNG(new );
toolBarBitmaps[Tool_open ] = wxBITMAP_PNG(open );
toolBarBitmaps[Tool_save ] = wxBITMAP_PNG(save );
toolBarBitmaps[Tool_copy ] = wxBITMAP_PNG(copy );
toolBarBitmaps[Tool_cut ] = wxBITMAP_PNG(cut );
toolBarBitmaps[Tool_paste] = wxBITMAP_PNG(paste);
toolBarBitmaps[Tool_print] = wxBITMAP_PNG(print);
toolBarBitmaps[Tool_help ] = wxBITMAP_PNG(help );
}
// Note that to use wxBITMAP_BUNDLE_2() macro it is necessary to
//
// 1. Have resources (either RT_RCDATA under MSW or files in the app
// bundle resources subdirectory under Mac) with this name.
//
// 2. Have name_png and name_2x_png arrays defined under the other
// platforms (as is done in this sample by including the corresponding
// *_png.c files above).
toolBarBitmaps[Tool_new ] = wxBITMAP_BUNDLE_2(new );
toolBarBitmaps[Tool_open ] = wxBITMAP_BUNDLE_2(open );
toolBarBitmaps[Tool_save ] = wxBITMAP_BUNDLE_2(save );
toolBarBitmaps[Tool_copy ] = wxBITMAP_BUNDLE_2(copy );
toolBarBitmaps[Tool_cut ] = wxBITMAP_BUNDLE_2(cut );
toolBarBitmaps[Tool_paste] = wxBITMAP_BUNDLE_2(paste);
toolBarBitmaps[Tool_print] = wxBITMAP_BUNDLE_2(print);
toolBarBitmaps[Tool_help ] = wxBITMAP_BUNDLE_2(help );
int w = toolBarBitmaps[Tool_new].GetWidth(),
h = toolBarBitmaps[Tool_new].GetHeight();
// Size of the bitmaps we use by default.
//
// Note that scaling it up by 2 is not something we would do in real
// application code, it is only done in the sample for testing of bigger
// bitmap sizes.
const wxSize sizeBitmap = toolBarBitmaps[Tool_new].GetDefaultSize() *
(m_smallToolbar ? 1 : 2);
if ( !m_smallToolbar )
{
w *= 2;
h *= 2;
#ifdef wxHAS_SVG
// Use vector SVG image for this button for demonstration purposes.
toolBarBitmaps[Tool_about] = wxBitmapBundle::FromSVG(svg_data, sizeBitmap);
#endif // wxHAS_SVG
for ( size_t n = Tool_new; n < WXSIZEOF(toolBarBitmaps); n++ )
{
toolBarBitmaps[n] =
wxBitmap(toolBarBitmaps[n].ConvertToImage().Scale(w, h));
}
}
// Note that there is no need for FromDIP() here, wxMSW will adjust the
// size on its own and under the other platforms there is no need for
// scaling the coordinates anyhow.
toolBar->SetToolBitmapSize(sizeBitmap);
toolBar->AddTool(wxID_NEW, "New",
toolBarBitmaps[Tool_new], wxNullBitmap, wxITEM_DROPDOWN,
@@ -468,15 +470,15 @@ void MyFrame::PopulateToolbar(wxToolBarBase* toolBar)
if ( m_useCustomDisabled )
{
wxBitmap bmpDisabled(w, h);
wxBitmap bmpDisabled(sizeBitmap);
{
wxMemoryDC dc;
dc.SelectObject(bmpDisabled);
dc.DrawBitmap(toolBarBitmaps[Tool_print], 0, 0);
dc.DrawBitmap(toolBarBitmaps[Tool_print].GetBitmap(sizeBitmap), 0, 0);
wxPen pen(*wxRED, 5);
dc.SetPen(pen);
dc.DrawLine(0, 0, w, h);
dc.DrawLine(0, 0, sizeBitmap.x, sizeBitmap.y);
}
toolBar->AddTool(wxID_PRINT, "Print", toolBarBitmaps[Tool_print],
@@ -495,17 +497,65 @@ void MyFrame::PopulateToolbar(wxToolBarBase* toolBar)
toolBar->AddStretchableSpace();
toolBar->AddTool(wxID_HELP, "Help", toolBarBitmaps[Tool_help], "Help button", wxITEM_CHECK);
toolBar->AddTool(wxID_ABOUT, "About", toolBarBitmaps[Tool_about], "About");
if ( !m_pathBmp.empty() )
{
// create a tool with a custom bitmap for testing
wxImage img(m_pathBmp);
if ( img.IsOk() )
wxImage image(m_pathBmp);
if ( image.IsOk() )
{
if ( img.GetWidth() > w && img.GetHeight() > h )
img = img.GetSubImage(wxRect(0, 0, w, h));
// create a custom bitmap bundle for testing
class MyCustomBitmapBundleImpl : public wxBitmapBundleImpl
{
public:
MyCustomBitmapBundleImpl(const wxImage& image,
const wxSize& sizeDef)
: m_image(image),
m_sizeDef(sizeDef)
{
}
wxSize GetDefaultSize() const wxOVERRIDE
{
return m_sizeDef;
}
wxBitmap GetBitmap(const wxSize size) wxOVERRIDE
{
// In this simple implementation we don't bother caching
// anything.
wxImage image = m_image;
if ( image.GetSize() != size )
image.Rescale(size.x, size.y, wxIMAGE_QUALITY_HIGH);
// This is required under MSW in order to be able to draw
// over the bitmap using wxDC. For full alpha support,
// wxGraphicsContext should be used.
if ( image.HasAlpha() )
image.ClearAlpha();
wxBitmap bitmap(image);
// This is the custom part: we show the size of the bitmap
// being used in the bitmap itself.
wxMemoryDC dc(bitmap);
dc.SetTextForeground(*wxRED);
dc.SetFont(wxFontInfo(wxSize(size.x/4, size.y/2)).Bold());
dc.DrawText(wxString::Format("%d", size.y), size.x/4, size.y/4);
return bitmap;
}
private:
const wxImage m_image;
const wxSize m_sizeDef;
};
wxBitmapBundleImpl* const
impl = new MyCustomBitmapBundleImpl(image, sizeBitmap);
toolBar->AddSeparator();
toolBar->AddTool(wxID_ANY, "Custom", img);
toolBar->AddTool(wxID_ANY, "Custom", wxBitmapBundle::FromImpl(impl));
}
}
@@ -522,13 +572,8 @@ void MyFrame::PopulateToolbar(wxToolBarBase* toolBar)
// ----------------------------------------------------------------------------
// Define my frame constructor
MyFrame::MyFrame(wxFrame* parent,
wxWindowID id,
const wxString& title,
const wxPoint& pos,
const wxSize& size,
long style)
: wxFrame(parent, id, title, pos, size, style)
MyFrame::MyFrame()
: wxFrame(NULL, wxID_ANY, "wxToolBar Sample")
{
m_tbar = NULL;
@@ -622,7 +667,7 @@ MyFrame::MyFrame(wxFrame* parent,
fileMenu->Append(wxID_EXIT, "E&xit\tAlt-X", "Quit toolbar sample" );
wxMenu *helpMenu = new wxMenu;
helpMenu->Append(wxID_HELP, "&About", "About toolbar sample");
helpMenu->Append(wxID_ABOUT, "&About", "About toolbar sample");
wxMenuBar* menuBar = new wxMenuBar( wxMB_DOCKABLE );
@@ -706,16 +751,6 @@ void MyFrame::OnSize(wxSizeEvent& event)
}
}
void MyFrame::OnDPIChanged(wxDPIChangedEvent& event)
{
event.Skip();
// We check the DPI scaling factor when the toolbar is created, so just
// recreate it whenever DPI changes. We could also just update the tools
// bitmaps, but this is simpler and doesn't have any significant drawbacks.
RecreateToolbar();
}
void MyFrame::OnToggleToolbar(wxCommandEvent& WXUNUSED(event))
{
wxToolBar *tbar = GetToolBar();

View File

@@ -39,6 +39,7 @@ WX_DEFINE_LIST(wxArtProvidersList)
// ----------------------------------------------------------------------------
WX_DECLARE_EXPORTED_STRING_HASH_MAP(wxBitmap, wxArtProviderBitmapsHash);
WX_DECLARE_EXPORTED_STRING_HASH_MAP(wxBitmapBundle, wxArtProviderBitmapBundlesHash);
WX_DECLARE_EXPORTED_STRING_HASH_MAP(wxIconBundle, wxArtProviderIconBundlesHash);
class WXDLLEXPORT wxArtProviderCache
@@ -48,6 +49,10 @@ public:
void PutBitmap(const wxString& full_id, const wxBitmap& bmp)
{ m_bitmapsHash[full_id] = bmp; }
bool GetBitmapBundle(const wxString& full_id, wxBitmapBundle* bmpbndl);
void PutBitmapBundle(const wxString& full_id, const wxBitmapBundle& bmpbndl)
{ m_bitmapsBundlesHash[full_id] = bmpbndl; }
bool GetIconBundle(const wxString& full_id, wxIconBundle* bmp);
void PutIconBundle(const wxString& full_id, const wxIconBundle& iconbundle)
{ m_iconBundlesHash[full_id] = iconbundle; }
@@ -62,8 +67,9 @@ public:
const wxArtClient& client);
private:
wxArtProviderBitmapsHash m_bitmapsHash; // cache of wxBitmaps
wxArtProviderIconBundlesHash m_iconBundlesHash; // cache of wxIconBundles
wxArtProviderBitmapsHash m_bitmapsHash; // cache of wxBitmaps
wxArtProviderBitmapBundlesHash m_bitmapsBundlesHash; // cache of wxBitmaps
wxArtProviderIconBundlesHash m_iconBundlesHash; // cache of wxIconBundles
};
bool wxArtProviderCache::GetBitmap(const wxString& full_id, wxBitmap* bmp)
@@ -80,6 +86,21 @@ bool wxArtProviderCache::GetBitmap(const wxString& full_id, wxBitmap* bmp)
}
}
bool wxArtProviderCache::GetBitmapBundle(const wxString& full_id, wxBitmapBundle* bmpbndl)
{
wxArtProviderBitmapBundlesHash::iterator entry = m_bitmapsBundlesHash.find(full_id);
if ( entry == m_bitmapsBundlesHash.end() )
{
return false;
}
else
{
*bmpbndl = entry->second;
return true;
}
}
bool wxArtProviderCache::GetIconBundle(const wxString& full_id, wxIconBundle* bmp)
{
wxArtProviderIconBundlesHash::iterator entry = m_iconBundlesHash.find(full_id);
@@ -274,6 +295,37 @@ void wxArtProvider::RescaleBitmap(wxBitmap& bmp, const wxSize& sizeNeeded)
return bmp;
}
/*static*/
wxBitmapBundle wxArtProvider::GetBitmapBundle(const wxArtID& id,
const wxArtClient& client,
const wxSize& size)
{
// safety-check against writing client,id,size instead of id,client,size:
wxASSERT_MSG( client.Last() == wxT('C'), wxT("invalid 'client' parameter") );
wxCHECK_MSG( sm_providers, wxNullBitmap, wxT("no wxArtProvider exists") );
wxString hashId = wxArtProviderCache::ConstructHashID(id, client);
wxBitmapBundle bitmapbundle; // (DoGetIconBundle(id, client));
if ( !sm_cache->GetBitmapBundle(hashId, &bitmapbundle) )
{
for (wxArtProvidersList::compatibility_iterator node = sm_providers->GetFirst();
node; node = node->GetNext())
{
bitmapbundle = node->GetData()->CreateBitmapBundle(id, client, size);
if ( bitmapbundle.IsOk() )
break;
}
sm_cache->PutBitmapBundle(hashId, bitmapbundle);
}
return bitmapbundle;
}
/*static*/
wxIconBundle wxArtProvider::GetIconBundle(const wxArtID& id, const wxArtClient& client)
{

329
src/common/bmpbndl.cpp Normal file
View File

@@ -0,0 +1,329 @@
///////////////////////////////////////////////////////////////////////////////
// Name: src/common/bmpbndl.cpp
// Purpose: Common methods of wxBitmapBundle class.
// Author: Vadim Zeitlin
// Created: 2021-09-22
// Copyright: (c) 2021 Vadim Zeitlin <vadim@wxwidgets.org>
// Licence: wxWindows licence
///////////////////////////////////////////////////////////////////////////////
// ============================================================================
// declarations
// ============================================================================
// ----------------------------------------------------------------------------
// headers
// ----------------------------------------------------------------------------
// for compilers that support precompilation, includes "wx.h".
#include "wx/wxprec.h"
#ifndef WX_PRECOMP
#endif // WX_PRECOMP
#include "wx/bmpbndl.h"
#include "wx/private/bmpbndl.h"
#include <algorithm>
#ifdef __WXOSX__
#include "wx/osx/private.h"
#endif
// ----------------------------------------------------------------------------
// private helpers
// ----------------------------------------------------------------------------
namespace
{
// Simplest possible bundle implementation storing a collection of bitmaps
class wxBitmapBundleImplSet : public wxBitmapBundleImpl
{
public:
// The vector must not be empty, caller is supposed to have checked for it.
explicit wxBitmapBundleImplSet(const wxVector<wxBitmap>& bitmaps)
{
Init(&bitmaps[0], bitmaps.size());
}
// Convenience ctor from a single bitmap.
explicit wxBitmapBundleImplSet(const wxBitmap& bitmap)
{
Init(&bitmap, 1);
}
~wxBitmapBundleImplSet()
{
#ifdef __WXOSX__
if (m_nsImage)
wxMacCocoaRelease(m_nsImage);
#endif
}
virtual wxSize GetDefaultSize() const wxOVERRIDE;
virtual wxBitmap GetBitmap(const wxSize size) wxOVERRIDE;
#ifdef __WXOSX__
virtual WXImage OSXGetImage() const wxOVERRIDE;
private:
mutable WXImage m_nsImage = NULL;
#endif
private:
// Struct containing bitmap itself as well as a flag indicating whether we
// generated it by rescaling the existing bitmap or not.
struct Entry
{
// Create a new entry from the original bitmap.
explicit Entry(const wxBitmap& bitmap_)
: bitmap(bitmap_)
{
generated = false;
}
// Create a new entry of the given size by resizing the bitmap of an
// existing one.
Entry(const Entry& entry, const wxSize& size)
: bitmap(entry.bitmap)
{
wxASSERT_MSG( !entry.generated, wxS("should use original bitmap") );
generated = true;
wxBitmap::Rescale(bitmap, size);
}
wxBitmap bitmap;
bool generated;
};
// Comparator comparing entries by the bitmap size.
struct BitmapSizeComparator
{
bool operator()(const Entry& entry1, const Entry& entry2) const
{
// We could compare the bitmaps areas too, but they're supposed to
// all use different sizes anyhow, so keep things simple.
return entry1.bitmap.GetHeight() < entry2.bitmap.GetHeight();
}
};
typedef wxVector<Entry> Entries;
// All bitmaps sorted by size.
//
// Note that this vector is never empty.
Entries m_entries;
// Common implementation of all ctors.
void Init(const wxBitmap* bitmaps, size_t n);
wxDECLARE_NO_COPY_CLASS(wxBitmapBundleImplSet);
};
} // anonymous namespace
// ============================================================================
// wxBitmapBundleImplSet implementation
// ============================================================================
void wxBitmapBundleImplSet::Init(const wxBitmap* bitmaps, size_t n)
{
m_entries.reserve(n);
for ( size_t i = 0; i < n; ++i )
{
const wxBitmap& bitmap = bitmaps[i];
wxASSERT_MSG( bitmap.IsOk(), wxS("all bundle bitmaps must be valid") );
m_entries.push_back(Entry(bitmap));
}
std::sort(m_entries.begin(), m_entries.end(), BitmapSizeComparator());
// Should we check that all bitmaps really have unique sizes here? For now,
// don't bother with this, but we might want to do it later if it really
// turns out to be a problem in practice.
}
wxSize wxBitmapBundleImplSet::GetDefaultSize() const
{
// Default size is the size of the smallest bitmap in the bundle.
return m_entries[0].bitmap.GetSize();
}
wxBitmap wxBitmapBundleImplSet::GetBitmap(const wxSize size)
{
// We use linear search instead if binary one because it's simpler and the
// vector size is small enough (< 10) for it not to matter in practice.
const size_t n = m_entries.size();
size_t lastSmaller = 0;
for ( size_t i = 0; i < n; ++i )
{
const Entry& entry = m_entries[i];
const wxSize sizeThis = entry.bitmap.GetSize();
if ( sizeThis.y == size.y )
{
// Exact match, just use it.
return entry.bitmap;
}
if ( sizeThis.y < size.y )
{
// Don't rescale this one, we prefer to downscale rather than
// upscale as it results in better-looking bitmaps.
lastSmaller = i;
continue;
}
if ( sizeThis.y > size.y && !entry.generated )
{
// We know that we don't have any exact match and we've found the
// next bigger bitmap, so rescale it to the desired size.
const Entry entryNew(entry, size);
m_entries.insert(m_entries.begin() + lastSmaller + 1, entryNew);
return entryNew.bitmap;
}
}
// We only get here if the requested size is larger than the size of all
// the bitmaps we have, in which case we have no choice but to upscale one
// of the bitmaps, so find the largest available non-generated bitmap.
for ( size_t i = n; n > 0; --i )
{
const Entry& entry = m_entries[i - 1];
if ( !entry.generated )
{
const Entry entryNew(entry, size);
m_entries.push_back(entryNew);
return entryNew.bitmap;
}
}
// We should have at least one non-generated bitmap.
wxFAIL_MSG( wxS("unreachable") );
return wxBitmap();
}
#ifdef __WXOSX__
WXImage wxBitmapBundleImplSet::OSXGetImage() const
{
if ( m_nsImage == NULL )
{
#if wxOSX_USE_COCOA
m_nsImage = wxOSXImageFromBitmap(m_entries[0].bitmap);
const size_t n = m_entries.size();
for ( size_t i = 1; i < n; ++i )
{
const Entry& entry = m_entries[i];
wxOSXAddBitmapToImage(m_nsImage, entry.bitmap);
}
#else
// TODO determine best bitmap for device scale factor, and use that
// with wxOSXImageFromBitmap as on iOS there is only one bitmap in a UIImage
#endif
if ( m_nsImage )
wxMacCocoaRetain(m_nsImage);
}
return m_nsImage;
}
#endif
// ============================================================================
// wxBitmapBundle implementation
// ============================================================================
wxBitmapBundle::wxBitmapBundle()
{
}
wxBitmapBundle::wxBitmapBundle(wxBitmapBundleImpl* impl)
: m_impl(impl)
{
}
wxBitmapBundle::wxBitmapBundle(const wxBitmap& bitmap)
: m_impl(bitmap.IsOk() ? new wxBitmapBundleImplSet(bitmap) : NULL)
{
}
wxBitmapBundle::wxBitmapBundle(const wxImage& image)
: m_impl(image.IsOk() ? new wxBitmapBundleImplSet(wxBitmap(image)) : NULL)
{
}
wxBitmapBundle::wxBitmapBundle(const wxBitmapBundle& other)
: m_impl(other.m_impl)
{
}
wxBitmapBundle& wxBitmapBundle::operator=(const wxBitmapBundle& other)
{
// No need to check for self-assignment because m_impl already does.
m_impl = other.m_impl;
return *this;
}
wxBitmapBundle::~wxBitmapBundle()
{
}
/* static */
wxBitmapBundle wxBitmapBundle::FromBitmaps(const wxVector<wxBitmap>& bitmaps)
{
if ( bitmaps.empty() )
return wxBitmapBundle();
return wxBitmapBundle(new wxBitmapBundleImplSet(bitmaps));
}
/* static */
wxBitmapBundle wxBitmapBundle::FromImpl(wxBitmapBundleImpl* impl)
{
return wxBitmapBundle(impl);
}
// MSW has its own, actually working, version, in MSW-specific code.
#if !defined( __WXMSW__ ) && !defined( __WXOSX__ )
/* static */
wxBitmapBundle wxBitmapBundle::FromResources(const wxString& WXUNUSED(name))
{
wxFAIL_MSG
(
"Loading bitmaps from resources not available on this platform, "
"don't use this function and call wxBitmapBundle::FromBitmaps() "
"instead."
);
return wxBitmapBundle();
}
#endif // !__WXMSW__ && !__WXOSX__
wxSize wxBitmapBundle::GetDefaultSize() const
{
if ( !m_impl )
return wxDefaultSize;
return m_impl->GetDefaultSize();
}
wxBitmap wxBitmapBundle::GetBitmap(const wxSize size) const
{
if ( !m_impl )
return wxBitmap();
return m_impl->GetBitmap(size == wxDefaultSize ? GetDefaultSize() : size);
}

View File

@@ -156,8 +156,8 @@ void wxToolBarBase::FixupStyle()
wxToolBarToolBase *wxToolBarBase::DoAddTool(int toolid,
const wxString& label,
const wxBitmap& bitmap,
const wxBitmap& bmpDisabled,
const wxBitmapBundle& bitmap,
const wxBitmapBundle& bmpDisabled,
wxItemKind kind,
const wxString& shortHelp,
const wxString& longHelp,
@@ -173,8 +173,8 @@ wxToolBarToolBase *wxToolBarBase::DoAddTool(int toolid,
wxToolBarToolBase *wxToolBarBase::InsertTool(size_t pos,
int toolid,
const wxString& label,
const wxBitmap& bitmap,
const wxBitmap& bmpDisabled,
const wxBitmapBundle& bitmap,
const wxBitmapBundle& bmpDisabled,
wxItemKind kind,
const wxString& shortHelp,
const wxString& longHelp,

184
src/generic/bmpsvg.cpp Normal file
View File

@@ -0,0 +1,184 @@
///////////////////////////////////////////////////////////////////////////////
// Name: src/generic/bmpsvg.cpp
// Purpose: Generic wxBitmapBundle::FromSVG() implementation
// Author: Vadim Zeitlin, Gunter Königsmann
// Created: 2021-09-28
// Copyright: (c) 2019 Gunter Königsmann <wxMaxima@physikbuch.de>
// (c) 2021 Vadim Zeitlin <vadim@wxwidgets.org>
// Licence: wxWindows licence
///////////////////////////////////////////////////////////////////////////////
// ============================================================================
// declarations
// ============================================================================
// ----------------------------------------------------------------------------
// headers
// ----------------------------------------------------------------------------
// for compilers that support precompilation, includes "wx.h".
#include "wx/wxprec.h"
#include "wx/bmpbndl.h"
#ifdef wxHAS_SVG
#ifndef WX_PRECOMP
#include "wx/utils.h" // Only for wxMin()
#endif // WX_PRECOMP
#include "wx/rawbmp.h"
#include "wx/private/bmpbndl.h"
// Disable some warnings inside NanoSVG code that we're not interested in.
#ifdef __VISUALC__
#pragma warning(push)
#pragma warning(disable:4456)
#pragma warning(disable:4702)
// Also make nanosvg.h compile with older MSVC versions which didn't have
// strtoll().
#if _MSC_VER < 1800
#define strtoll _strtoi64
#endif
#endif
#define NANOSVG_IMPLEMENTATION
#define NANOSVGRAST_IMPLEMENTATION
#include "../../3rdparty/nanosvg/src/nanosvg.h"
#include "../../3rdparty/nanosvg/src/nanosvgrast.h"
#ifdef __VISUALC__
#pragma warning(pop)
#endif
// ----------------------------------------------------------------------------
// private helpers
// ----------------------------------------------------------------------------
namespace
{
class wxBitmapBundleImplSVG : public wxBitmapBundleImpl
{
public:
// Ctor must be passed a valid NSVGimage and takes ownership of it.
wxBitmapBundleImplSVG(NSVGimage* svgImage, const wxSize& sizeDef)
: m_svgImage(svgImage),
m_svgRasterizer(nsvgCreateRasterizer()),
m_sizeDef(sizeDef)
{
}
~wxBitmapBundleImplSVG()
{
nsvgDeleteRasterizer(m_svgRasterizer);
nsvgDelete(m_svgImage);
}
virtual wxSize GetDefaultSize() const wxOVERRIDE;
virtual wxBitmap GetBitmap(const wxSize size) wxOVERRIDE;
private:
wxBitmap DoRasterize(const wxSize size);
NSVGimage* const m_svgImage;
NSVGrasterizer* const m_svgRasterizer;
const wxSize m_sizeDef;
// Cache the last used bitmap (may be invalid if not used yet).
//
// Note that we cache only the last bitmap and not all the bitmaps ever
// requested from GetBitmap() for the different sizes because there would
// be no way to clear such cache and its growth could be unbounded,
// resulting in too many bitmap objects being used in an application using
// SVG for all of its icons.
wxBitmap m_cachedBitmap;
wxDECLARE_NO_COPY_CLASS(wxBitmapBundleImplSVG);
};
} // anonymous namespace
// ============================================================================
// wxBitmapBundleImplSVG implementation
// ============================================================================
wxSize wxBitmapBundleImplSVG::GetDefaultSize() const
{
return m_sizeDef;
}
wxBitmap wxBitmapBundleImplSVG::GetBitmap(const wxSize size)
{
if ( !m_cachedBitmap.IsOk() || m_cachedBitmap.GetSize() != size )
{
m_cachedBitmap = DoRasterize(size);
}
return m_cachedBitmap;
}
wxBitmap wxBitmapBundleImplSVG::DoRasterize(const wxSize size)
{
wxVector<unsigned char> buffer(size.x*size.y*4);
nsvgRasterize
(
m_svgRasterizer,
m_svgImage,
0.0, 0.0, // no offset
wxMin
(
size.x/m_svgImage->width,
size.y/m_svgImage->height
), // scale
&buffer[0],
size.x, size.y,
size.x*4 // stride -- we have no gaps between lines
);
wxBitmap bitmap(size, 32);
wxAlphaPixelData bmpdata(bitmap);
wxAlphaPixelData::Iterator dst(bmpdata);
const unsigned char* src = &buffer[0];
for ( int y = 0; y < size.y; ++y )
{
dst.MoveTo(bmpdata, 0, y);
for ( int x = 0; x < size.x; ++x )
{
const unsigned char a = src[3];
dst.Red() = src[0] * a / 255;
dst.Green() = src[1] * a / 255;
dst.Blue() = src[2] * a / 255;
dst.Alpha() = a;
++dst;
src += 4;
}
}
return bitmap;
}
/* static */
wxBitmapBundle wxBitmapBundle::FromSVG(char* data, const wxSize sizeDef)
{
NSVGimage* const svgImage = nsvgParse(data, "px", 96);
if ( !svgImage )
return wxBitmapBundle();
return wxBitmapBundle(new wxBitmapBundleImplSVG(svgImage, sizeDef));
}
/* static */
wxBitmapBundle wxBitmapBundle::FromSVG(const char* data, const wxSize sizeDef)
{
wxCharBuffer copy(data);
return FromSVG(copy.data(), sizeDef);
}
#endif // wxHAS_SVG

View File

@@ -46,8 +46,8 @@ public:
wxButtonToolBarTool(wxButtonToolBar *tbar,
int id,
const wxString& label,
const wxBitmap& bmpNormal,
const wxBitmap& bmpDisabled,
const wxBitmapBundle& bmpNormal,
const wxBitmapBundle& bmpDisabled,
wxItemKind kind,
wxObject *clientData,
const wxString& shortHelp,
@@ -261,8 +261,8 @@ void wxButtonToolBar::DoSetToggle(wxToolBarToolBase *WXUNUSED(tool), bool WXUNUS
wxToolBarToolBase *wxButtonToolBar::CreateTool(int id,
const wxString& label,
const wxBitmap& bmpNormal,
const wxBitmap& bmpDisabled,
const wxBitmapBundle& bmpNormal,
const wxBitmapBundle& bmpDisabled,
wxItemKind kind,
wxObject *clientData,
const wxString& shortHelp,

View File

@@ -35,8 +35,8 @@ public:
wxToolBarTool(wxToolBar *tbar,
int id,
const wxString& label,
const wxBitmap& bitmap1,
const wxBitmap& bitmap2,
const wxBitmapBundle& bitmap1,
const wxBitmapBundle& bitmap2,
wxItemKind kind,
wxObject *clientData,
const wxString& shortHelpString,
@@ -373,8 +373,8 @@ void wxToolBarTool::SetLabel(const wxString& label)
wxToolBarToolBase *wxToolBar::CreateTool(int id,
const wxString& text,
const wxBitmap& bitmap1,
const wxBitmap& bitmap2,
const wxBitmapBundle& bitmap1,
const wxBitmapBundle& bitmap2,
wxItemKind kind,
wxObject *clientData,
const wxString& shortHelpString,
@@ -795,7 +795,7 @@ void wxToolBar::SetToolShortHelp( int id, const wxString& helpString )
}
}
void wxToolBar::SetToolNormalBitmap( int id, const wxBitmap& bitmap )
void wxToolBar::SetToolNormalBitmap( int id, const wxBitmapBundle& bitmap )
{
wxToolBarTool* tool = static_cast<wxToolBarTool*>(FindById(id));
if ( tool )
@@ -807,7 +807,7 @@ void wxToolBar::SetToolNormalBitmap( int id, const wxBitmap& bitmap )
}
}
void wxToolBar::SetToolDisabledBitmap( int id, const wxBitmap& bitmap )
void wxToolBar::SetToolDisabledBitmap( int id, const wxBitmapBundle& bitmap )
{
wxToolBarTool* tool = static_cast<wxToolBarTool*>(FindById(id));
if ( tool )

View File

@@ -75,8 +75,8 @@ public:
wxToolBarTool(wxToolBar *tbar,
int id,
const wxString& label,
const wxBitmap& bitmap1,
const wxBitmap& bitmap2,
const wxBitmapBundle& bitmap1,
const wxBitmapBundle& bitmap2,
wxItemKind kind,
wxObject *clientData,
const wxString& shortHelpString,
@@ -234,8 +234,8 @@ void wxToolBarTool::Init()
wxToolBarToolBase *wxToolBar::CreateTool(int id,
const wxString& text,
const wxBitmap& bitmap1,
const wxBitmap& bitmap2,
const wxBitmapBundle& bitmap1,
const wxBitmapBundle& bitmap2,
wxItemKind kind,
wxObject *clientData,
const wxString& shortHelpString,

View File

@@ -80,8 +80,8 @@ public:
wxToolBarTool(wxToolBar *tbar,
int id,
const wxString& label,
const wxBitmap& bmpNormal,
const wxBitmap& bmpToggled,
const wxBitmapBundle& bmpNormal,
const wxBitmapBundle& bmpToggled,
wxItemKind kind,
wxObject *clientData,
const wxString& shortHelp,
@@ -142,8 +142,8 @@ wxString wxToolBarTimer::helpString;
wxToolBarToolBase *wxToolBar::CreateTool(int id,
const wxString& label,
const wxBitmap& bmpNormal,
const wxBitmap& bmpToggled,
const wxBitmapBundle& bmpNormal,
const wxBitmapBundle& bmpToggled,
wxItemKind kind,
wxObject *clientData,
const wxString& shortHelp,

307
src/msw/bmpbndl.cpp Normal file
View File

@@ -0,0 +1,307 @@
///////////////////////////////////////////////////////////////////////////////
// Name: src/msw/bmpbndl.cpp
// Purpose: MSW-specific part of wxBitmapBundle class.
// Author: Vadim Zeitlin
// Created: 2021-09-22
// Copyright: (c) 2021 Vadim Zeitlin <vadim@wxwidgets.org>
// Licence: wxWindows licence
///////////////////////////////////////////////////////////////////////////////
// ============================================================================
// declarations
// ============================================================================
// ----------------------------------------------------------------------------
// headers
// ----------------------------------------------------------------------------
// for compilers that support precompilation, includes "wx.h".
#include "wx/wxprec.h"
#ifndef WX_PRECOMP
#include "wx/log.h"
#include "wx/msw/wrapwin.h"
#endif // WX_PRECOMP
#include "wx/bmpbndl.h"
#include "wx/private/bmpbndl.h"
#include <algorithm>
// ----------------------------------------------------------------------------
// private helpers
// ----------------------------------------------------------------------------
namespace
{
// Helper function, which will probably need to be factored out as it's likely
// to be useful elsewhere, returning the scale determined by the given suffix,
// i.e. it returns 2 for the suffix of "_2x" or 1.5 for "_1_5x".
//
// Returns 1 if the suffix is empty or 0 if it doesn't look like a valid scale
// suffix at all.
double GetScaleFromSuffix(const wxString& suffix)
{
if ( suffix.empty() )
return 1.0;
if ( *suffix.begin() != '_' )
return 0;
if ( *suffix.rbegin() != 'x' )
return 0;
wxString factor = suffix.substr(1, suffix.length() - 2);
if ( factor.empty() )
return 0;
factor.Replace(wxS("_"), wxS("."));
double d;
if ( !factor.ToCDouble(&d) )
return 0;
return d;
}
// Just a bitmap name and the corresponding scale for some resource.
struct ResourceInfo
{
ResourceInfo(const wxString& name_, double scale_)
: name(name_), scale(scale_)
{
}
wxString name;
double scale;
};
// Predicate for std::sort() comparing resource infos using their scale.
struct ScaleComparator
{
bool operator()(const ResourceInfo& info1, const ResourceInfo& info2) const
{
return info1.scale < info2.scale;
}
};
typedef wxVector<ResourceInfo> ResourceInfos;
// Used to pass information to EnumRCBitmaps() callback.
struct RCEnumCallbackData
{
explicit RCEnumCallbackData(const wxString& name_)
: name(name_.Lower())
{
}
// The base name of all resources, passed to the callback.
wxString name;
// All the existing bitmaps starting with this name and using a valid scale
// suffix, filled by the callback.
ResourceInfos resourceInfos;
};
BOOL CALLBACK EnumRCBitmaps(HMODULE WXUNUSED(hModule),
LPCTSTR WXUNUSED(lpszType),
LPTSTR lpszName,
LONG_PTR lParam)
{
wxString name(lpszName);
name.MakeLower(); // resource names are case insensitive
RCEnumCallbackData *data = reinterpret_cast<RCEnumCallbackData*>(lParam);
wxString suffix;
if ( name.StartsWith(data->name, &suffix) )
{
const double scale = GetScaleFromSuffix(suffix);
if ( scale )
data->resourceInfos.push_back(ResourceInfo(name, scale));
}
return TRUE; // continue enumeration
}
// Bundle implementation using PNG bitmaps from Windows resources.
class wxBitmapBundleImplRC : public wxBitmapBundleImpl
{
public:
// Ctor takes the vector containing all the existing resources starting
// with the given name and the valid bitmap corresponding to the base name
// resource itself.
wxBitmapBundleImplRC(const ResourceInfos& resourceInfos,
const wxBitmap& bitmap);
virtual wxSize GetDefaultSize() const wxOVERRIDE;
virtual wxBitmap GetBitmap(const wxSize size) wxOVERRIDE;
private:
// Load the bitmap from the given resource and add it m_bitmaps, after
// rescaling it to the given size if necessary, i.e. if the needed size is
// different from the size of this bitmap itself.
//
// The expected size is used to confirm that the resource really has the
// size we expect it to have.
//
// Return the just loaded bitmap.
wxBitmap
AddBitmap(const ResourceInfo& info,
const wxSize& sizeExpected,
const wxSize& sizeNeeded);
// All the available resources.
const ResourceInfos m_resourceInfos;
// All already loaded bitmaps sorted by their size.
//
// This vector is never empty and its first element is the bitmap using the
// default size.
wxVector<wxBitmap> m_bitmaps;
wxDECLARE_NO_COPY_CLASS(wxBitmapBundleImplRC);
};
} // anonymous namespace
// ============================================================================
// wxBitmapBundleImplRC implementation
// ============================================================================
wxBitmapBundleImplRC::wxBitmapBundleImplRC(const ResourceInfos& resourceInfos,
const wxBitmap& bitmap)
: m_resourceInfos(resourceInfos)
{
m_bitmaps.push_back(bitmap);
}
wxSize wxBitmapBundleImplRC::GetDefaultSize() const
{
return m_bitmaps[0].GetSize();
}
wxBitmap
wxBitmapBundleImplRC::AddBitmap(const ResourceInfo& info,
const wxSize& sizeExpected,
const wxSize& sizeNeeded)
{
// First load the bitmap, it shouldn't fail, but we can't do much if it
// does fail -- we're just going to return an invalid bitmap in this case.
wxBitmap bitmap(info.name, wxBITMAP_TYPE_PNG_RESOURCE);
// We rely on suffixes really corresponding to the bitmap sizes and bad
// things will happen if they don't.
wxASSERT_MSG
(
bitmap.GetSize() == sizeExpected,
wxString::Format(wxS("Bitmap \"%s\" should have size %d*%d."),
sizeExpected.x, sizeExpected.y)
);
if ( sizeNeeded != sizeExpected )
wxBitmap::Rescale(bitmap, sizeNeeded);
// Now cache the bitmap for future use by inserting it into our sorted
// vector of bitmaps. We don't bother with the binary search here because
// the vector is typically very small (< 10 elements).
const wxSize sizeThis = bitmap.GetSize();
for ( size_t i = 0; ; ++i )
{
if ( i == m_bitmaps.size() )
{
// This is the biggest bitmap we have, put it at the end.
m_bitmaps.push_back(bitmap);
break;
}
if ( m_bitmaps[i].GetSize().y > sizeThis.y )
{
m_bitmaps.insert(m_bitmaps.begin() + i, bitmap);
break;
}
}
return bitmap;
}
wxBitmap wxBitmapBundleImplRC::GetBitmap(const wxSize size)
{
// First check if we already have the bitmap of this size: we're only
// interested in the exact match here.
for ( size_t i = 0; i < m_bitmaps.size(); ++i )
{
const wxBitmap& bitmap = m_bitmaps[i];
if ( bitmap.GetSize() == size )
return bitmap;
}
// If we don't have one, create it using one of the available resources.
// Here we try to find the exact match (ideal) or the next larger size
// (downscaling results in better appearance than upscaling, generally
// speaking).
const wxSize sizeDef = GetDefaultSize();
for ( size_t i = 0; i < m_resourceInfos.size(); ++i )
{
const ResourceInfo& info = m_resourceInfos[i];
const wxSize sizeThis = sizeDef*info.scale;
// Use this bitmap if it's the first one bigger than the requested size
// or if it's the last item as in this case we're not going to find any
// bitmap bigger than the given one anyhow and we don't have any choice
// but to upscale the largest one we have.
if ( sizeThis.y >= size.y || i + 1 == m_resourceInfos.size() )
return AddBitmap(info, sizeThis, size);
}
wxFAIL_MSG( wxS("unreachable") );
return wxBitmap();
}
// ============================================================================
// wxBitmapBundle::FromResources() implementation
// ============================================================================
/* static */
wxBitmapBundle wxBitmapBundle::FromResources(const wxString& name)
{
// First of all, find all resources starting with this name.
RCEnumCallbackData data(name);
if ( !::EnumResourceNames(NULL, // this HMODULE
RT_RCDATA,
EnumRCBitmaps,
reinterpret_cast<LONG_PTR>(&data)) )
{
const DWORD err = ::GetLastError();
if ( err != NO_ERROR && err != ERROR_RESOURCE_TYPE_NOT_FOUND )
{
wxLogSysError(wxS("Couldn't enumerate RCDATA resources"));
}
}
ResourceInfos& resourceInfos = data.resourceInfos;
if ( resourceInfos.empty() )
return wxBitmapBundle();
// We need to load the base bitmap to get the default size anyhow, so do it
// now and also check that it works.
wxBitmap bitmap(name, wxBITMAP_TYPE_PNG_RESOURCE);
if ( !bitmap.IsOk() )
return wxBitmapBundle();
// Sort the resources in the order of increasing sizes to simplify the code
// of wxBitmapBundleImplRC::GetBitmap().
std::sort(resourceInfos.begin(), resourceInfos.end(), ScaleComparator());
return wxBitmapBundle(new wxBitmapBundleImplRC(resourceInfos, bitmap));
}

View File

@@ -150,8 +150,8 @@ public:
wxToolBarTool(wxToolBar *tbar,
int id,
const wxString& label,
const wxBitmap& bmpNormal,
const wxBitmap& bmpDisabled,
const wxBitmapBundle& bmpNormal,
const wxBitmapBundle& bmpDisabled,
wxItemKind kind,
wxObject *clientData,
const wxString& shortHelp,
@@ -344,8 +344,8 @@ static bool MSWShouldBeChecked(const wxToolBarToolBase *tool)
wxToolBarToolBase *wxToolBar::CreateTool(int id,
const wxString& label,
const wxBitmap& bmpNormal,
const wxBitmap& bmpDisabled,
const wxBitmapBundle& bmpNormal,
const wxBitmapBundle& bmpDisabled,
wxItemKind kind,
wxObject *clientData,
const wxString& shortHelp,
@@ -781,14 +781,14 @@ void wxToolBar::CreateDisabledImageList()
node = m_tools.GetFirst(); node; node = node->GetNext() )
{
wxToolBarToolBase *tool = node->GetData();
wxBitmap bmpDisabled = tool->GetDisabledBitmap();
wxBitmap bmpDisabled = tool->GetDisabledBitmap(wxSize(m_defaultWidth,
m_defaultHeight));
if ( bmpDisabled.IsOk() )
{
const wxSize sizeBitmap = bmpDisabled.GetSize();
m_disabledImgList = new wxImageList
(
sizeBitmap.x,
sizeBitmap.y,
m_defaultWidth,
m_defaultHeight,
// Don't use mask if we have alpha
// (wxImageList will fall back to
// mask if alpha not supported)
@@ -858,11 +858,15 @@ bool wxToolBar::Realize()
wxMemoryDC dcAllButtons;
wxBitmap bitmap(totalBitmapWidth, totalBitmapHeight);
const wxSize sizeBitmap(m_defaultWidth, m_defaultHeight);
for ( node = m_tools.GetFirst(); node; node = node->GetNext() )
{
wxToolBarToolBase *tool = node->GetData();
if ( tool->IsButton() &&
tool->GetNormalBitmap().IsOk() && tool->GetNormalBitmap().HasAlpha() )
wxBitmap toolBitmap;
if ( tool->IsButton() )
toolBitmap = tool->GetNormalBitmap(sizeBitmap);
if ( toolBitmap.IsOk() && toolBitmap.HasAlpha() )
{
// By default bitmaps don't have alpha in wxMSW, but if we
// use a bitmap tool with alpha, we should use alpha for
@@ -925,16 +929,10 @@ bool wxToolBar::Realize()
wxToolBarToolBase *tool = node->GetData();
if ( tool->IsButton() )
{
wxBitmap bmp = tool->GetNormalBitmap();
const int w = bmp.GetWidth();
const int h = bmp.GetHeight();
wxBitmap bmp = tool->GetNormalBitmap(sizeBitmap);
if ( bmp.IsOk() )
{
int xOffset = wxMax(0, (m_defaultWidth - w)/2);
int yOffset = wxMax(0, (m_defaultHeight - h)/2);
#if wxUSE_IMAGE
// If a mix of icons with alpha and without is used,
// convert them all to use alpha.
@@ -947,7 +945,7 @@ bool wxToolBar::Realize()
#endif
// notice the last parameter: do use mask
dcAllButtons.DrawBitmap(bmp, x + xOffset, yOffset, true);
dcAllButtons.DrawBitmap(bmp, x, 0, true);
// Handle of the bitmap could have changed inside
// DrawBitmap() call if it had to convert it from DDB to
@@ -963,7 +961,8 @@ bool wxToolBar::Realize()
// also deal with disabled bitmap if we want to use them
if ( m_disabledImgList )
{
wxBitmap bmpDisabled = tool->GetDisabledBitmap();
wxBitmap bmpDisabled = tool->GetDisabledBitmap(sizeBitmap);
#if wxUSE_IMAGE && wxUSE_WXDIB
if ( !bmpDisabled.IsOk() )
{
@@ -977,9 +976,9 @@ bool wxToolBar::Realize()
{
// we need to have light grey background colour for
// MapBitmap() to work correctly
for ( int y = 0; y < h; y++ )
for ( int y = 0; y < m_defaultHeight; y++ )
{
for ( int xx = 0; xx < w; xx++ )
for ( int xx = 0; xx < m_defaultWidth; xx++ )
{
if ( imgGreyed.IsTransparent(xx, y) )
imgGreyed.SetRGB(xx, y,
@@ -995,7 +994,10 @@ bool wxToolBar::Realize()
#endif // wxUSE_IMAGE
if ( remapValue == Remap_Buttons )
MapBitmap(bmpDisabled.GetHBITMAP(), w, h);
{
MapBitmap(bmpDisabled.GetHBITMAP(),
m_defaultWidth, m_defaultHeight);
}
m_disabledImgList->Add(bmpDisabled);
}
@@ -1842,7 +1844,7 @@ void wxToolBar::DoSetToggle(wxToolBarToolBase *WXUNUSED(tool), bool WXUNUSED(tog
wxFAIL_MSG( wxT("not implemented") );
}
void wxToolBar::SetToolNormalBitmap( int id, const wxBitmap& bitmap )
void wxToolBar::SetToolNormalBitmap( int id, const wxBitmapBundle& bitmap )
{
wxToolBarTool* tool = static_cast<wxToolBarTool*>(FindById(id));
if ( tool )
@@ -1854,7 +1856,7 @@ void wxToolBar::SetToolNormalBitmap( int id, const wxBitmap& bitmap )
}
}
void wxToolBar::SetToolDisabledBitmap( int id, const wxBitmap& bitmap )
void wxToolBar::SetToolDisabledBitmap( int id, const wxBitmapBundle& bitmap )
{
wxToolBarTool* tool = static_cast<wxToolBarTool*>(FindById(id));
if ( tool )
@@ -1947,6 +1949,10 @@ void wxToolBar::RealizeHelper()
void wxToolBar::OnDPIChanged(wxDPIChangedEvent& event)
{
// Ensure that when Realize() is called, the bitmaps size corresponding to
// the new resolution will be used.
SetToolBitmapSize(event.Scale(wxSize(m_defaultWidth, m_defaultHeight)));
// Manually scale the size of the controls. Even though the font has been
// updated, the internal size of the controls does not.
wxToolBarToolsList::compatibility_iterator node;

View File

@@ -35,11 +35,11 @@ protected:
const wxArtClient& client) wxOVERRIDE;
#endif
#if wxOSX_USE_COCOA_OR_IPHONE
virtual wxBitmap CreateBitmap(const wxArtID& id,
virtual wxBitmapBundle CreateBitmapBundle(const wxArtID& id,
const wxArtClient& client,
const wxSize& size) wxOVERRIDE
{
return wxOSXCreateSystemBitmap(id, client, size);
return wxOSXCreateSystemBitmapBundle(id, client, size);
}
#endif
};

View File

@@ -27,6 +27,7 @@
#endif
#include "wx/fontutil.h"
#include "wx/private/bmpbndl.h"
#ifdef __WXMAC__
@@ -165,14 +166,14 @@ WXWindow wxOSXGetKeyWindow()
#if wxOSX_USE_IPHONE
wxBitmap wxOSXCreateSystemBitmap(const wxString& name, const wxString &client, const wxSize& size)
wxBitmapBundle wxOSXCreateSystemBitmapBundle(const wxString& name, const wxString &client, const wxSize& size)
{
#if 1
// unfortunately this only accesses images in the app bundle, not the system wide globals
wxCFStringRef cfname(name);
return wxBitmap( [[UIImage imageNamed:cfname.AsNSString()] CGImage] );
return wxOSXMakeBundleFromImage( [UIImage imageNamed:cfname.AsNSString()] );
#else
return wxBitmap();
return wxNullBitmap;
#endif
}
@@ -197,14 +198,12 @@ WXImage wxOSXGetSystemImage(const wxString& name)
return nsimage;
}
wxBitmap wxOSXCreateSystemBitmap(const wxString& name, const wxString &WXUNUSED(client), const wxSize& WXUNUSED(sizeHint))
wxBitmapBundle wxOSXCreateSystemBitmapBundle(const wxString& name, const wxString &WXUNUSED(client), const wxSize& WXUNUSED(sizeHint))
{
NSImage* nsimage = wxOSXGetSystemImage(name);
if ( nsimage )
{
// if ( sizeHint != wxDefaultSize )
// [nsimage setSize:NSMakeSize(sizeHint.GetHeight(), sizeHint.GetWidth())];
return wxBitmap( nsimage );
return wxOSXMakeBundleFromImage( nsimage );
}
return wxNullBitmap;
}

View File

@@ -32,6 +32,7 @@
#include "wx/weakref.h"
#include "wx/windowid.h"
#include "wx/osx/private.h"
#include "wx/private/bmpbndl.h"
#include "wx/osx/private/available.h"
#import <AppKit/NSWindow.h>
@@ -39,15 +40,16 @@
wxBitmap wxStockPreferencesPage::GetLargeIcon() const
{
wxBitmapBundle bundle;
#if __MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_16
if ( WX_IS_MACOS_AVAILABLE(11, 0) )
{
switch ( m_kind )
{
case Kind_General:
return wxBitmap([NSImage imageWithSystemSymbolName:@"gearshape" accessibilityDescription:nil]);
bundle = wxOSXMakeBundleFromImage([NSImage imageWithSystemSymbolName:@"gearshape" accessibilityDescription:nil]);
case Kind_Advanced:
return wxBitmap([NSImage imageWithSystemSymbolName:@"gearshape.2" accessibilityDescription:nil]);
bundle = wxOSXMakeBundleFromImage([NSImage imageWithSystemSymbolName:@"gearshape.2" accessibilityDescription:nil]);
}
}
#endif
@@ -55,12 +57,12 @@ wxBitmap wxStockPreferencesPage::GetLargeIcon() const
switch ( m_kind )
{
case Kind_General:
return wxBitmap([NSImage imageNamed:NSImageNamePreferencesGeneral]);
bundle = wxOSXMakeBundleFromImage([NSImage imageNamed:NSImageNamePreferencesGeneral]);
case Kind_Advanced:
return wxBitmap([NSImage imageNamed:NSImageNameAdvanced]);
bundle = wxOSXMakeBundleFromImage([NSImage imageNamed:NSImageNameAdvanced]);
}
return wxBitmap(); // silence compiler warning
return bundle.IsOk() ? bundle.GetBitmap(bundle.GetDefaultSize()) : wxNullBitmap;
}
@@ -98,7 +100,7 @@ public:
"can't add more preferences pages after showing the window" );
const wxString title = page->GetName();
wxBitmap bmp(page->GetLargeIcon());
wxBitmapBundle bmp(page->GetLargeIcon());
wxASSERT_MSG( bmp.IsOk(), "OS X requires valid bitmap for preference page" );
int toolId = wxIdManager::ReserveId();

View File

@@ -20,6 +20,7 @@
#include "wx/app.h"
#include "wx/osx/private.h"
#include "wx/osx/private/available.h"
#include "wx/private/bmpbndl.h"
#include "wx/geometry.h"
#include "wx/sysopt.h"
@@ -77,8 +78,8 @@ public:
wxToolBar *tbar,
int id,
const wxString& label,
const wxBitmap& bmpNormal,
const wxBitmap& bmpDisabled,
const wxBitmapBundle& bmpNormal,
const wxBitmapBundle& bmpDisabled,
wxItemKind kind,
wxObject *clientData,
const wxString& shortHelp,
@@ -591,14 +592,14 @@ void wxToolBarTool::SetPosition( const wxPoint& position )
void wxToolBarTool::UpdateImages()
{
[(NSButton*) m_controlHandle setImage:m_bmpNormal.GetNSImage()];
[(NSButton*) m_controlHandle setImage:wxOSXGetImageFromBundle(m_bmpNormal)];
if ( CanBeToggled() )
{
int w = m_bmpNormal.GetScaledWidth();
int h = m_bmpNormal.GetScaledHeight();
// TODO CS this should use the best current representation, or optionally iterate through all
wxSize sz = m_bmpNormal.GetDefaultSize();
m_alternateBitmap = wxBitmap();
m_alternateBitmap.CreateScaled(w, h, -1, m_bmpNormal.GetScaleFactor());
m_alternateBitmap.Create(sz.x, sz.y, -1); // TODO CS m_alternateBitmap.CreateScaled(sz.x, sz.y, -1, m_bmpNormal.GetScaleFactor());
m_alternateBitmap.UseAlpha();
wxMemoryDC dc;
@@ -610,8 +611,8 @@ void wxToolBarTool::UpdateImages()
dc.Clear();
dc.SetPen(grey);
dc.SetBrush(grey);
dc.DrawRoundedRectangle( 0, 0, w, h, 3 );
dc.DrawBitmap( m_bmpNormal, 0, 0, true );
dc.DrawRoundedRectangle( 0, 0, sz.x, sz.y, 3 );
dc.DrawBitmap( m_bmpNormal.GetBitmap(sz), 0, 0, true );
dc.SelectObject( wxNullBitmap );
[(NSButton*) m_controlHandle setAlternateImage:m_alternateBitmap.GetNSImage()];
@@ -633,7 +634,7 @@ void wxToolBarTool::UpdateToggleImage( bool toggle )
if ( CanBeToggled() && toggle )
[m_toolbarItem setImage:m_alternateBitmap.GetNSImage()];
else
[m_toolbarItem setImage:m_bmpNormal.GetNSImage()];
[m_toolbarItem setImage:wxOSXGetImageFromBundle(m_bmpNormal)];
}
#endif
@@ -645,8 +646,8 @@ wxToolBarTool::wxToolBarTool(
wxToolBar *tbar,
int id,
const wxString& label,
const wxBitmap& bmpNormal,
const wxBitmap& bmpDisabled,
const wxBitmapBundle& bmpNormal,
const wxBitmapBundle& bmpDisabled,
wxItemKind kind,
wxObject *clientData,
const wxString& shortHelp,
@@ -665,8 +666,8 @@ wxToolBarTool::wxToolBarTool(
wxToolBarToolBase *wxToolBar::CreateTool(
int id,
const wxString& label,
const wxBitmap& bmpNormal,
const wxBitmap& bmpDisabled,
const wxBitmapBundle& bmpNormal,
const wxBitmapBundle& bmpDisabled,
wxItemKind kind,
wxObject *clientData,
const wxString& shortHelp,
@@ -1380,7 +1381,7 @@ void wxToolBar::MacSuperChangedPosition()
*/
}
void wxToolBar::SetToolNormalBitmap( int id, const wxBitmap& bitmap )
void wxToolBar::SetToolNormalBitmap( int id, const wxBitmapBundle& bitmap )
{
wxToolBarTool* tool = static_cast<wxToolBarTool*>(FindById(id));
if ( tool )
@@ -1394,7 +1395,7 @@ void wxToolBar::SetToolNormalBitmap( int id, const wxBitmap& bitmap )
}
}
void wxToolBar::SetToolDisabledBitmap( int id, const wxBitmap& bitmap )
void wxToolBar::SetToolDisabledBitmap( int id, const wxBitmapBundle& bitmap )
{
wxToolBarTool* tool = static_cast<wxToolBarTool*>(FindById(id));
if ( tool )

180
src/osx/core/bmpbndl.mm Normal file
View File

@@ -0,0 +1,180 @@
///////////////////////////////////////////////////////////////////////////////
// Name: src/osx/core/bmpbndl.mm
// Purpose: OSX-specific part of wxBitmapBundle class.
// Author: Vadim Zeitlin and Stefan Csomor
// Created: 2021-09-22
// Copyright: (c) 2021 Vadim Zeitlin <vadim@wxwidgets.org>
// Licence: wxWindows licence
///////////////////////////////////////////////////////////////////////////////
// ============================================================================
// declarations
// ============================================================================
// ----------------------------------------------------------------------------
// headers
// ----------------------------------------------------------------------------
// for compilers that support precompilation, includes "wx.h".
#include "wx/wxprec.h"
#ifndef WX_PRECOMP
#endif // WX_PRECOMP
#include "wx/bmpbndl.h"
#include "wx/private/bmpbndl.h"
#include "wx/osx/private.h"
#include <algorithm>
// ----------------------------------------------------------------------------
// private helpers
// ----------------------------------------------------------------------------
namespace
{
// Bundle implementation using PNG bitmaps from Windows resources.
class wxOSXImageBundleImpl : public wxBitmapBundleImpl
{
public:
// Ctor takes the vector containing all the existing resources starting
// with the given name and the valid bitmap corresponding to the base name
// resource itself.
wxOSXImageBundleImpl(WXImage image);
~wxOSXImageBundleImpl();
virtual wxSize GetDefaultSize() const wxOVERRIDE;
virtual wxBitmap GetBitmap(const wxSize size) wxOVERRIDE;
virtual WXImage OSXGetImage() const wxOVERRIDE;
private:
WXImage m_nsImage;
};
} // anonymouse namespace
// ============================================================================
// wxOSXImageBundleImpl implementation
// ============================================================================
wxOSXImageBundleImpl::wxOSXImageBundleImpl(WXImage image)
{
m_nsImage = (WXImage) wxMacCocoaRetain(image);
}
wxOSXImageBundleImpl::~wxOSXImageBundleImpl()
{
wxMacCocoaRelease(m_nsImage);
}
wxSize wxOSXImageBundleImpl::GetDefaultSize() const
{
CGSize sz = wxOSXGetImageSize(m_nsImage);
return wxSize(sz.width, sz.height);
}
wxBitmap wxOSXImageBundleImpl::GetBitmap(const wxSize size)
{
return wxBitmap();
}
WXImage wxOSXImageBundleImpl::OSXGetImage() const
{
return m_nsImage;
}
wxBitmapBundle wxOSXMakeBundleFromImage( WXImage img)
{
return wxBitmapBundle::FromImpl( new wxOSXImageBundleImpl(img) );
}
// ============================================================================
// wxOSXImageBundleImpl implementation
// ============================================================================
WXImage wxOSXImageFromBitmap( const wxBitmap& bmp)
{
WXImage image;
#if wxOSX_USE_COCOA
double scale = bmp.GetScaleFactor();
NSSize sz = NSMakeSize( bmp.GetWidth()*scale, bmp.GetHeight()*scale);
image = [[NSImage alloc] initWithSize:sz];
wxOSXAddBitmapToImage(image, bmp);
#else
wxCFRef<CGImageRef> cgimage = bmp.CreateCGImage();
image = [[UIImage alloc] initWithCGImage:cgimage scale:bmp.GetScaleFactor() orientation:UIImageOrientationUp];
#endif
[image autorelease];
return image;
}
#if wxOSX_USE_COCOA
void wxOSXAddBitmapToImage( WXImage image, const wxBitmap& bmp)
{
wxCFRef<CGImageRef> cgimage = bmp.CreateCGImage();
NSImageRep* nsrep = [[NSBitmapImageRep alloc] initWithCGImage:cgimage];
[image addRepresentation:nsrep];
[nsrep release];
}
#endif
wxBitmapBundle wxBitmapBundle::FromResources(const wxString& name)
{
wxVector<wxBitmap> resources;
wxString ext = "png"; // TODO adapt as soon as we get res param
wxCFStringRef restype(ext);
for ( int dpiFactor = 1 ; dpiFactor <= 2 ; ++dpiFactor)
{
wxString filename;
if ( dpiFactor == 1 )
filename = name;
else
filename = wxString::Format("%s@%dx", name, dpiFactor);
wxCFStringRef resname(filename);
wxCFRef<CFURLRef> imageURL(CFBundleCopyResourceURL(CFBundleGetMainBundle(), resname, restype, NULL));
if ( !imageURL.get() && dpiFactor != 1 )
{
// try alternate naming scheme
filename = wxString::Format("%s_%dx", name, dpiFactor);
resname = wxCFStringRef(filename);
imageURL = CFBundleCopyResourceURL(CFBundleGetMainBundle(), resname, restype, NULL);
}
if ( imageURL.get() )
{
// Create the data provider object
wxCFRef<CGDataProviderRef> provider(CGDataProviderCreateWithURL (imageURL) );
CGImageRef image = NULL;
if ( ext == "jpeg" )
image = CGImageCreateWithJPEGDataProvider (provider, NULL, true,
kCGRenderingIntentDefault);
else if ( ext == "png" )
image = CGImageCreateWithPNGDataProvider (provider, NULL, true,
kCGRenderingIntentDefault);
if ( image != NULL )
{
wxBitmap bmp(image, dpiFactor);
CGImageRelease(image);
resources.push_back(bmp);
}
}
}
return wxBitmapBundle::FromBitmaps(resources);
}
WXImage wxOSXGetImageFromBundle(const wxBitmapBundle& bundle)
{
WXImage image = bundle.GetImpl()->OSXGetImage();
if (image == 0)
image = bundle.GetBitmap(bundle.GetDefaultSize()).OSXGetImage();
return image;
}

View File

@@ -19,10 +19,13 @@
#endif
#include "wx/app.h"
#include "wx/osx/private.h"
#include "wx/geometry.h"
#include "wx/sysopt.h"
#include "wx/private/bmpbndl.h"
#include "wx/osx/private.h"
#pragma mark -
#pragma mark Tool Implementation
@@ -58,8 +61,8 @@ public:
wxToolBar *tbar,
int id,
const wxString& label,
const wxBitmap& bmpNormal,
const wxBitmap& bmpDisabled,
const wxBitmapBundle& bmpNormal,
const wxBitmapBundle& bmpDisabled,
wxItemKind kind,
wxObject *clientData,
const wxString& shortHelp,
@@ -104,8 +107,8 @@ wxToolBarTool::wxToolBarTool(
wxToolBar *tbar,
int id,
const wxString& label,
const wxBitmap& bmpNormal,
const wxBitmap& bmpDisabled,
const wxBitmapBundle& bmpNormal,
const wxBitmapBundle& bmpDisabled,
wxItemKind kind,
wxObject *clientData,
const wxString& shortHelp,
@@ -127,7 +130,7 @@ wxToolBarToolBase(
}
else if ( bmpNormal.IsOk() )
{
bui = [bui initWithImage:bmpNormal.GetUIImage() style:UIBarButtonItemStylePlain target:toolbar
bui = [bui initWithImage:wxOSXGetImageFromBundle(bmpNormal) style:UIBarButtonItemStylePlain target:toolbar
action:@selector(clickedAction:)];
}
else
@@ -180,8 +183,8 @@ wxToolBarTool::~wxToolBarTool()
wxToolBarToolBase *wxToolBar::CreateTool(
int id,
const wxString& label,
const wxBitmap& bmpNormal,
const wxBitmap& bmpDisabled,
const wxBitmapBundle& bmpNormal,
const wxBitmapBundle& bmpDisabled,
wxItemKind kind,
wxObject *clientData,
const wxString& shortHelp,
@@ -296,7 +299,7 @@ void wxToolBar::SetRows(int nRows)
m_maxRows = nRows;
}
void wxToolBar::SetToolNormalBitmap( int id, const wxBitmap& bitmap )
void wxToolBar::SetToolNormalBitmap( int id, const wxBitmapBundle& bitmap )
{
wxToolBarTool* tool = static_cast<wxToolBarTool*>(FindById(id));
if ( tool )
@@ -307,7 +310,7 @@ void wxToolBar::SetToolNormalBitmap( int id, const wxBitmap& bitmap )
}
}
void wxToolBar::SetToolDisabledBitmap( int id, const wxBitmap& bitmap )
void wxToolBar::SetToolDisabledBitmap( int id, const wxBitmapBundle& bitmap )
{
wxToolBarTool* tool = static_cast<wxToolBarTool*>(FindById(id));
if ( tool )

View File

@@ -28,8 +28,8 @@ class wxQtToolButton;
class wxToolBarTool : public wxToolBarToolBase
{
public:
wxToolBarTool(wxToolBar *tbar, int id, const wxString& label, const wxBitmap& bitmap1,
const wxBitmap& bitmap2, wxItemKind kind, wxObject *clientData,
wxToolBarTool(wxToolBar *tbar, int id, const wxString& label, const wxBitmapBundle& bitmap1,
const wxBitmapBundle& bitmap2, wxItemKind kind, wxObject *clientData,
const wxString& shortHelpString, const wxString& longHelpString)
: wxToolBarToolBase(tbar, id, label, bitmap1, bitmap2, kind,
clientData, shortHelpString, longHelpString)
@@ -194,7 +194,7 @@ void wxToolBar::SetToolShortHelp( int id, const wxString& helpString )
}
}
void wxToolBar::SetToolNormalBitmap( int id, const wxBitmap& bitmap )
void wxToolBar::SetToolNormalBitmap( int id, const wxBitmapBundle& bitmap )
{
wxToolBarTool* tool = static_cast<wxToolBarTool*>(FindById(id));
if ( tool )
@@ -206,7 +206,7 @@ void wxToolBar::SetToolNormalBitmap( int id, const wxBitmap& bitmap )
}
}
void wxToolBar::SetToolDisabledBitmap( int id, const wxBitmap& bitmap )
void wxToolBar::SetToolDisabledBitmap( int id, const wxBitmapBundle& bitmap )
{
wxToolBarTool* tool = static_cast<wxToolBarTool*>(FindById(id));
if ( tool )
@@ -364,8 +364,8 @@ void wxToolBar::DoSetToggle(wxToolBarToolBase * WXUNUSED(tool),
wxFAIL_MSG( wxT("not implemented") );
}
wxToolBarToolBase *wxToolBar::CreateTool(int id, const wxString& label, const wxBitmap& bmpNormal,
const wxBitmap& bmpDisabled, wxItemKind kind, wxObject *clientData,
wxToolBarToolBase *wxToolBar::CreateTool(int id, const wxString& label, const wxBitmapBundle& bmpNormal,
const wxBitmapBundle& bmpDisabled, wxItemKind kind, wxObject *clientData,
const wxString& shortHelp, const wxString& longHelp)
{
return new wxToolBarTool(this, id, label, bmpNormal, bmpDisabled, kind,

View File

@@ -78,8 +78,8 @@ public:
wxToolBarTool(wxToolBar *tbar,
int id,
const wxString& label,
const wxBitmap& bmpNormal,
const wxBitmap& bmpDisabled,
const wxBitmapBundle& bmpNormal,
const wxBitmapBundle& bmpDisabled,
wxItemKind kind,
wxObject *clientData,
const wxString& shortHelp,
@@ -313,8 +313,8 @@ void wxToolBar::DoSetToggle(wxToolBarToolBase *tool, bool WXUNUSED(toggle))
wxToolBarToolBase *wxToolBar::CreateTool(int id,
const wxString& label,
const wxBitmap& bmpNormal,
const wxBitmap& bmpDisabled,
const wxBitmapBundle& bmpNormal,
const wxBitmapBundle& bmpDisabled,
wxItemKind kind,
wxObject *clientData,
const wxString& shortHelp,

View File

@@ -183,6 +183,7 @@ TEST_GUI_OBJECTS = \
test_gui_point.o \
test_gui_region.o \
test_gui_bitmap.o \
test_gui_bmpbundle.o \
test_gui_colour.o \
test_gui_ellipsization.o \
test_gui_measuring.o \
@@ -904,6 +905,9 @@ test_gui_region.o: $(srcdir)/geometry/region.cpp $(TEST_GUI_ODEP)
test_gui_bitmap.o: $(srcdir)/graphics/bitmap.cpp $(TEST_GUI_ODEP)
$(CXXC) -c -o $@ $(TEST_GUI_CXXFLAGS) $(srcdir)/graphics/bitmap.cpp
test_gui_bmpbundle.o: $(srcdir)/graphics/bmpbundle.cpp $(TEST_GUI_ODEP)
$(CXXC) -c -o $@ $(TEST_GUI_CXXFLAGS) $(srcdir)/graphics/bmpbundle.cpp
test_gui_colour.o: $(srcdir)/graphics/colour.cpp $(TEST_GUI_ODEP)
$(CXXC) -c -o $@ $(TEST_GUI_CXXFLAGS) $(srcdir)/graphics/colour.cpp

View File

@@ -0,0 +1,79 @@
///////////////////////////////////////////////////////////////////////////////
// Name: tests/graphics/bmpbundle.cpp
// Purpose: wxBitmapBundle unit test
// Author: Vadim Zeitlin
// Created: 2021-09-27
// Copyright: (c) 2021 Vadim Zeitlin <vadim@wxwidgets.org>
///////////////////////////////////////////////////////////////////////////////
// ----------------------------------------------------------------------------
// headers
// ----------------------------------------------------------------------------
#include "testprec.h"
#include "wx/bmpbndl.h"
#include "asserthelper.h"
// ----------------------------------------------------------------------------
// tests
// ----------------------------------------------------------------------------
TEST_CASE("BitmapBundle::Create", "[bmpbundle]")
{
wxBitmapBundle b;
CHECK( !b.IsOk() );
CHECK( b.GetDefaultSize() == wxDefaultSize );
b = wxBitmap(16, 16);
CHECK( b.IsOk() );
CHECK( b.GetDefaultSize() == wxSize(16, 16) );
}
TEST_CASE("BitmapBundle::FromBitmaps", "[bmpbundle]")
{
wxVector<wxBitmap> bitmaps;
bitmaps.push_back(wxBitmap(16, 16));
bitmaps.push_back(wxBitmap(24, 24));
wxBitmapBundle b = wxBitmapBundle::FromBitmaps(bitmaps);
REQUIRE( b.IsOk() );
CHECK( b.GetDefaultSize() == wxSize(16, 16) );
CHECK( b.GetBitmap(wxDefaultSize ).GetSize() == wxSize(16, 16) );
CHECK( b.GetBitmap(wxSize(16, 16)).GetSize() == wxSize(16, 16) );
CHECK( b.GetBitmap(wxSize(20, 20)).GetSize() == wxSize(20, 20) );
CHECK( b.GetBitmap(wxSize(24, 24)).GetSize() == wxSize(24, 24) );
}
#ifdef wxHAS_SVG
TEST_CASE("BitmapBundle::FromSVG", "[bmpbundle][svg]")
{
static const char svg_data[] =
"<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"no\"?>"
"<!DOCTYPE svg PUBLIC \"-//W3C//DTD SVG 1.1//EN\" \"http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd\">"
"<svg width=\"200\" height=\"200\" xmlns:xlink=\"http://www.w3.org/1999/xlink\" xmlns=\"http://www.w3.org/2000/svg\">"
"<g>"
"<circle cx=\"100\" cy=\"100\" r=\"50\" fill=\"blue\"/>"
"</g>"
"</svg>"
;
wxBitmapBundle b = wxBitmapBundle::FromSVG(svg_data, wxSize(20, 20));
REQUIRE( b.IsOk() );
CHECK( b.GetDefaultSize() == wxSize(20, 20) );
CHECK( b.GetBitmap(wxSize(32, 32)).GetSize() == wxSize(32, 32) );
// Check that not using XML header works too.
const char* svg_tag_start = strstr(svg_data, "<svg");
REQUIRE( svg_tag_start );
b = wxBitmapBundle::FromSVG(svg_data, wxSize(20, 20));
REQUIRE( b.IsOk() );
CHECK( b.GetBitmap(wxSize(16, 16)).GetSize() == wxSize(16, 16) );
}
#endif // wxHAS_SVG

View File

@@ -157,6 +157,7 @@ TEST_GUI_OBJECTS = \
$(OBJS)\test_gui_point.o \
$(OBJS)\test_gui_region.o \
$(OBJS)\test_gui_bitmap.o \
$(OBJS)\test_gui_bmpbundle.o \
$(OBJS)\test_gui_colour.o \
$(OBJS)\test_gui_ellipsization.o \
$(OBJS)\test_gui_measuring.o \
@@ -879,6 +880,9 @@ $(OBJS)\test_gui_region.o: ./geometry/region.cpp
$(OBJS)\test_gui_bitmap.o: ./graphics/bitmap.cpp
$(CXX) -c -o $@ $(TEST_GUI_CXXFLAGS) $(CPPDEPS) $<
$(OBJS)\test_gui_bmpbundle.o: ./graphics/bmpbundle.cpp
$(CXX) -c -o $@ $(TEST_GUI_CXXFLAGS) $(CPPDEPS) $<
$(OBJS)\test_gui_colour.o: ./graphics/colour.cpp
$(CXX) -c -o $@ $(TEST_GUI_CXXFLAGS) $(CPPDEPS) $<

View File

@@ -173,6 +173,7 @@ TEST_GUI_OBJECTS = \
$(OBJS)\test_gui_point.obj \
$(OBJS)\test_gui_region.obj \
$(OBJS)\test_gui_bitmap.obj \
$(OBJS)\test_gui_bmpbundle.obj \
$(OBJS)\test_gui_colour.obj \
$(OBJS)\test_gui_ellipsization.obj \
$(OBJS)\test_gui_measuring.obj \
@@ -1313,6 +1314,9 @@ $(OBJS)\test_gui_region.obj: .\geometry\region.cpp
$(OBJS)\test_gui_bitmap.obj: .\graphics\bitmap.cpp
$(CXX) /c /nologo /TP /Fo$@ $(TEST_GUI_CXXFLAGS) .\graphics\bitmap.cpp
$(OBJS)\test_gui_bmpbundle.obj: .\graphics\bmpbundle.cpp
$(CXX) /c /nologo /TP /Fo$@ $(TEST_GUI_CXXFLAGS) .\graphics\bmpbundle.cpp
$(OBJS)\test_gui_colour.obj: .\graphics\colour.cpp
$(CXX) /c /nologo /TP /Fo$@ $(TEST_GUI_CXXFLAGS) .\graphics\colour.cpp

View File

@@ -177,6 +177,7 @@
geometry/point.cpp
geometry/region.cpp
graphics/bitmap.cpp
graphics/bmpbundle.cpp
graphics/colour.cpp
graphics/ellipsization.cpp
graphics/measuring.cpp

View File

@@ -545,6 +545,7 @@
<ClCompile Include="geometry\size.cpp" />
<ClCompile Include="graphics\affinematrix.cpp" />
<ClCompile Include="graphics\bitmap.cpp" />
<ClCompile Include="graphics\bmpbundle.cpp" />
<ClCompile Include="graphics\boundingbox.cpp" />
<ClCompile Include="graphics\clippingbox.cpp" />
<ClCompile Include="graphics\coords.cpp" />

View File

@@ -23,6 +23,9 @@
<ClCompile Include="graphics\bitmap.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="graphics\bmpbundle.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="controls\bitmapcomboboxtest.cpp">
<Filter>Source Files</Filter>
</ClCompile>
@@ -320,4 +323,4 @@
<Filter>Resource Files</Filter>
</ResourceCompile>
</ItemGroup>
</Project>
</Project>

View File

@@ -858,6 +858,10 @@
RelativePath=".\controls\bitmaptogglebuttontest.cpp"
>
</File>
<File
RelativePath=".\graphics\bmpbundle.cpp"
>
</File>
<File
RelativePath=".\controls\bookctrlbasetest.cpp"
>

View File

@@ -830,6 +830,10 @@
RelativePath=".\controls\bitmaptogglebuttontest.cpp"
>
</File>
<File
RelativePath=".\graphics\bmpbundle.cpp"
>
</File>
<File
RelativePath=".\controls\bookctrlbasetest.cpp"
>