Merge branch 'simplify-imagelist'

Merge Mac-specific and generic wxImageList versions and modernize the
code.

See https://github.com/wxWidgets/wxWidgets/pull/1001
This commit is contained in:
Vadim Zeitlin
2018-11-04 14:15:16 +01:00
13 changed files with 148 additions and 565 deletions

View File

@@ -3314,7 +3314,6 @@ COND_TOOLKIT_OSX_COCOA_GUI_HDR = \
wx/osx/fontdlg.h \ wx/osx/fontdlg.h \
wx/osx/frame.h \ wx/osx/frame.h \
wx/osx/gauge.h \ wx/osx/gauge.h \
wx/osx/imaglist.h \
wx/osx/listbox.h \ wx/osx/listbox.h \
wx/osx/listctrl.h \ wx/osx/listctrl.h \
wx/osx/mdi.h \ wx/osx/mdi.h \
@@ -3368,6 +3367,7 @@ COND_TOOLKIT_OSX_COCOA_GUI_HDR = \
wx/generic/statusbr.h \ wx/generic/statusbr.h \
wx/osx/appprogress.h \ wx/osx/appprogress.h \
wx/generic/icon.h \ wx/generic/icon.h \
wx/generic/imaglist.h \
wx/osx/cocoa/chkconf.h \ wx/osx/cocoa/chkconf.h \
wx/osx/cocoa/evtloop.h \ wx/osx/cocoa/evtloop.h \
wx/osx/cocoa/private.h \ wx/osx/cocoa/private.h \
@@ -3424,7 +3424,6 @@ COND_TOOLKIT_OSX_IPHONE_GUI_HDR = \
wx/osx/fontdlg.h \ wx/osx/fontdlg.h \
wx/osx/frame.h \ wx/osx/frame.h \
wx/osx/gauge.h \ wx/osx/gauge.h \
wx/osx/imaglist.h \
wx/osx/listbox.h \ wx/osx/listbox.h \
wx/osx/listctrl.h \ wx/osx/listctrl.h \
wx/osx/mdi.h \ wx/osx/mdi.h \
@@ -3478,6 +3477,7 @@ COND_TOOLKIT_OSX_IPHONE_GUI_HDR = \
wx/generic/statusbr.h \ wx/generic/statusbr.h \
wx/osx/appprogress.h \ wx/osx/appprogress.h \
wx/generic/icon.h \ wx/generic/icon.h \
wx/generic/imaglist.h \
wx/osx/iphone/chkconf.h \ wx/osx/iphone/chkconf.h \
wx/osx/iphone/evtloop.h \ wx/osx/iphone/evtloop.h \
wx/osx/iphone/private.h \ wx/osx/iphone/private.h \
@@ -13174,7 +13174,8 @@ COND_PLATFORM_MACOSX_1___OSX_COMMON_SRC_OBJECTS = \
monodll_generic_statusbr.o \ monodll_generic_statusbr.o \
monodll_generic_textmeasure.o \ monodll_generic_textmeasure.o \
monodll_generic_icon.o \ monodll_generic_icon.o \
monodll_statbmp_osx.o monodll_statbmp_osx.o \
monodll_generic_imaglist.o
@COND_PLATFORM_MACOSX_1@__OSX_COMMON_SRC_OBJECTS = $(COND_PLATFORM_MACOSX_1___OSX_COMMON_SRC_OBJECTS) @COND_PLATFORM_MACOSX_1@__OSX_COMMON_SRC_OBJECTS = $(COND_PLATFORM_MACOSX_1___OSX_COMMON_SRC_OBJECTS)
COND_PLATFORM_MACOSX_1___GTK_PLATFORM_SRC_OBJECTS = \ COND_PLATFORM_MACOSX_1___GTK_PLATFORM_SRC_OBJECTS = \
monodll_generic_caret.o \ monodll_generic_caret.o \
@@ -13225,7 +13226,6 @@ COND_PLATFORM_MACOSX_1___OSX_LOWLEVEL_SRC_OBJECTS = \
monodll_osx_brush.o \ monodll_osx_brush.o \
monodll_dialog_osx.o \ monodll_dialog_osx.o \
monodll_osx_fontutil.o \ monodll_osx_fontutil.o \
monodll_osx_imaglist.o \
monodll_osx_minifram.o \ monodll_osx_minifram.o \
monodll_nonownedwnd_osx.o \ monodll_nonownedwnd_osx.o \
monodll_osx_palette.o \ monodll_osx_palette.o \
@@ -13315,7 +13315,8 @@ COND_PLATFORM_MACOSX_1___OSX_COMMON_SRC_OBJECTS_0 = \
monolib_generic_statusbr.o \ monolib_generic_statusbr.o \
monolib_generic_textmeasure.o \ monolib_generic_textmeasure.o \
monolib_generic_icon.o \ monolib_generic_icon.o \
monolib_statbmp_osx.o monolib_statbmp_osx.o \
monolib_generic_imaglist.o
@COND_PLATFORM_MACOSX_1@__OSX_COMMON_SRC_OBJECTS_0 = $(COND_PLATFORM_MACOSX_1___OSX_COMMON_SRC_OBJECTS_0) @COND_PLATFORM_MACOSX_1@__OSX_COMMON_SRC_OBJECTS_0 = $(COND_PLATFORM_MACOSX_1___OSX_COMMON_SRC_OBJECTS_0)
COND_PLATFORM_MACOSX_1___GTK_PLATFORM_SRC_OBJECTS_27 = \ COND_PLATFORM_MACOSX_1___GTK_PLATFORM_SRC_OBJECTS_27 = \
monolib_generic_caret.o \ monolib_generic_caret.o \
@@ -13366,7 +13367,6 @@ COND_PLATFORM_MACOSX_1___OSX_LOWLEVEL_SRC_OBJECTS_17 = \
monolib_osx_brush.o \ monolib_osx_brush.o \
monolib_dialog_osx.o \ monolib_dialog_osx.o \
monolib_osx_fontutil.o \ monolib_osx_fontutil.o \
monolib_osx_imaglist.o \
monolib_osx_minifram.o \ monolib_osx_minifram.o \
monolib_nonownedwnd_osx.o \ monolib_nonownedwnd_osx.o \
monolib_osx_palette.o \ monolib_osx_palette.o \
@@ -13456,7 +13456,8 @@ COND_PLATFORM_MACOSX_1___OSX_COMMON_SRC_OBJECTS_8 = \
coredll_generic_statusbr.o \ coredll_generic_statusbr.o \
coredll_generic_textmeasure.o \ coredll_generic_textmeasure.o \
coredll_generic_icon.o \ coredll_generic_icon.o \
coredll_statbmp_osx.o coredll_statbmp_osx.o \
coredll_generic_imaglist.o
@COND_PLATFORM_MACOSX_1@__OSX_COMMON_SRC_OBJECTS_8 = $(COND_PLATFORM_MACOSX_1___OSX_COMMON_SRC_OBJECTS_8) @COND_PLATFORM_MACOSX_1@__OSX_COMMON_SRC_OBJECTS_8 = $(COND_PLATFORM_MACOSX_1___OSX_COMMON_SRC_OBJECTS_8)
COND_PLATFORM_MACOSX_1___GTK_PLATFORM_SRC_OBJECTS_1_4 = \ COND_PLATFORM_MACOSX_1___GTK_PLATFORM_SRC_OBJECTS_1_4 = \
coredll_generic_caret.o \ coredll_generic_caret.o \
@@ -13507,7 +13508,6 @@ COND_PLATFORM_MACOSX_1___OSX_LOWLEVEL_SRC_OBJECTS_1_1 = \
coredll_osx_brush.o \ coredll_osx_brush.o \
coredll_dialog_osx.o \ coredll_dialog_osx.o \
coredll_osx_fontutil.o \ coredll_osx_fontutil.o \
coredll_osx_imaglist.o \
coredll_osx_minifram.o \ coredll_osx_minifram.o \
coredll_nonownedwnd_osx.o \ coredll_nonownedwnd_osx.o \
coredll_osx_palette.o \ coredll_osx_palette.o \
@@ -13594,7 +13594,8 @@ COND_PLATFORM_MACOSX_1___OSX_COMMON_SRC_OBJECTS_9 = \
corelib_generic_statusbr.o \ corelib_generic_statusbr.o \
corelib_generic_textmeasure.o \ corelib_generic_textmeasure.o \
corelib_generic_icon.o \ corelib_generic_icon.o \
corelib_statbmp_osx.o corelib_statbmp_osx.o \
corelib_generic_imaglist.o
@COND_PLATFORM_MACOSX_1@__OSX_COMMON_SRC_OBJECTS_9 = $(COND_PLATFORM_MACOSX_1___OSX_COMMON_SRC_OBJECTS_9) @COND_PLATFORM_MACOSX_1@__OSX_COMMON_SRC_OBJECTS_9 = $(COND_PLATFORM_MACOSX_1___OSX_COMMON_SRC_OBJECTS_9)
COND_PLATFORM_MACOSX_1___GTK_PLATFORM_SRC_OBJECTS_2_2 = \ COND_PLATFORM_MACOSX_1___GTK_PLATFORM_SRC_OBJECTS_2_2 = \
corelib_generic_caret.o \ corelib_generic_caret.o \
@@ -13645,7 +13646,6 @@ COND_PLATFORM_MACOSX_1___OSX_LOWLEVEL_SRC_OBJECTS_1_4 = \
corelib_osx_brush.o \ corelib_osx_brush.o \
corelib_dialog_osx.o \ corelib_dialog_osx.o \
corelib_osx_fontutil.o \ corelib_osx_fontutil.o \
corelib_osx_imaglist.o \
corelib_osx_minifram.o \ corelib_osx_minifram.o \
corelib_nonownedwnd_osx.o \ corelib_nonownedwnd_osx.o \
corelib_osx_palette.o \ corelib_osx_palette.o \
@@ -17549,6 +17549,12 @@ monodll_sound_sdl.o: $(srcdir)/src/unix/sound_sdl.cpp $(MONODLL_ODEP)
@COND_TOOLKIT_DFB_USE_GUI_1@monodll_generic_caret.o: $(srcdir)/src/generic/caret.cpp $(MONODLL_ODEP) @COND_TOOLKIT_DFB_USE_GUI_1@monodll_generic_caret.o: $(srcdir)/src/generic/caret.cpp $(MONODLL_ODEP)
@COND_TOOLKIT_DFB_USE_GUI_1@ $(CXXC) -c -o $@ $(MONODLL_CXXFLAGS) $(srcdir)/src/generic/caret.cpp @COND_TOOLKIT_DFB_USE_GUI_1@ $(CXXC) -c -o $@ $(MONODLL_CXXFLAGS) $(srcdir)/src/generic/caret.cpp
@COND_PLATFORM_MACOSX_1_TOOLKIT_OSX_COCOA_USE_GUI_1_WXUNIV_0@monodll_generic_imaglist.o: $(srcdir)/src/generic/imaglist.cpp $(MONODLL_ODEP)
@COND_PLATFORM_MACOSX_1_TOOLKIT_OSX_COCOA_USE_GUI_1_WXUNIV_0@ $(CXXC) -c -o $@ $(MONODLL_CXXFLAGS) $(srcdir)/src/generic/imaglist.cpp
@COND_PLATFORM_MACOSX_1_TOOLKIT_OSX_IPHONE_USE_GUI_1_WXUNIV_0@monodll_generic_imaglist.o: $(srcdir)/src/generic/imaglist.cpp $(MONODLL_ODEP)
@COND_PLATFORM_MACOSX_1_TOOLKIT_OSX_IPHONE_USE_GUI_1_WXUNIV_0@ $(CXXC) -c -o $@ $(MONODLL_CXXFLAGS) $(srcdir)/src/generic/imaglist.cpp
@COND_TOOLKIT_QT_USE_GUI_1_WXUNIV_0@monodll_generic_imaglist.o: $(srcdir)/src/generic/imaglist.cpp $(MONODLL_ODEP) @COND_TOOLKIT_QT_USE_GUI_1_WXUNIV_0@monodll_generic_imaglist.o: $(srcdir)/src/generic/imaglist.cpp $(MONODLL_ODEP)
@COND_TOOLKIT_QT_USE_GUI_1_WXUNIV_0@ $(CXXC) -c -o $@ $(MONODLL_CXXFLAGS) $(srcdir)/src/generic/imaglist.cpp @COND_TOOLKIT_QT_USE_GUI_1_WXUNIV_0@ $(CXXC) -c -o $@ $(MONODLL_CXXFLAGS) $(srcdir)/src/generic/imaglist.cpp
@@ -18704,12 +18710,6 @@ monodll_sound_sdl.o: $(srcdir)/src/unix/sound_sdl.cpp $(MONODLL_ODEP)
@COND_PLATFORM_MACOSX_1_TOOLKIT_OSX_IPHONE_USE_GUI_1@monodll_osx_fontutil.o: $(srcdir)/src/osx/fontutil.cpp $(MONODLL_ODEP) @COND_PLATFORM_MACOSX_1_TOOLKIT_OSX_IPHONE_USE_GUI_1@monodll_osx_fontutil.o: $(srcdir)/src/osx/fontutil.cpp $(MONODLL_ODEP)
@COND_PLATFORM_MACOSX_1_TOOLKIT_OSX_IPHONE_USE_GUI_1@ $(CXXC) -c -o $@ $(MONODLL_CXXFLAGS) $(srcdir)/src/osx/fontutil.cpp @COND_PLATFORM_MACOSX_1_TOOLKIT_OSX_IPHONE_USE_GUI_1@ $(CXXC) -c -o $@ $(MONODLL_CXXFLAGS) $(srcdir)/src/osx/fontutil.cpp
@COND_PLATFORM_MACOSX_1_TOOLKIT_OSX_COCOA_USE_GUI_1@monodll_osx_imaglist.o: $(srcdir)/src/osx/imaglist.cpp $(MONODLL_ODEP)
@COND_PLATFORM_MACOSX_1_TOOLKIT_OSX_COCOA_USE_GUI_1@ $(CXXC) -c -o $@ $(MONODLL_CXXFLAGS) $(srcdir)/src/osx/imaglist.cpp
@COND_PLATFORM_MACOSX_1_TOOLKIT_OSX_IPHONE_USE_GUI_1@monodll_osx_imaglist.o: $(srcdir)/src/osx/imaglist.cpp $(MONODLL_ODEP)
@COND_PLATFORM_MACOSX_1_TOOLKIT_OSX_IPHONE_USE_GUI_1@ $(CXXC) -c -o $@ $(MONODLL_CXXFLAGS) $(srcdir)/src/osx/imaglist.cpp
@COND_PLATFORM_MACOSX_1_TOOLKIT_OSX_COCOA_USE_GUI_1@monodll_osx_minifram.o: $(srcdir)/src/osx/minifram.cpp $(MONODLL_ODEP) @COND_PLATFORM_MACOSX_1_TOOLKIT_OSX_COCOA_USE_GUI_1@monodll_osx_minifram.o: $(srcdir)/src/osx/minifram.cpp $(MONODLL_ODEP)
@COND_PLATFORM_MACOSX_1_TOOLKIT_OSX_COCOA_USE_GUI_1@ $(CXXC) -c -o $@ $(MONODLL_CXXFLAGS) $(srcdir)/src/osx/minifram.cpp @COND_PLATFORM_MACOSX_1_TOOLKIT_OSX_COCOA_USE_GUI_1@ $(CXXC) -c -o $@ $(MONODLL_CXXFLAGS) $(srcdir)/src/osx/minifram.cpp
@@ -22802,6 +22802,12 @@ monolib_sound_sdl.o: $(srcdir)/src/unix/sound_sdl.cpp $(MONOLIB_ODEP)
@COND_TOOLKIT_DFB_USE_GUI_1@monolib_generic_caret.o: $(srcdir)/src/generic/caret.cpp $(MONOLIB_ODEP) @COND_TOOLKIT_DFB_USE_GUI_1@monolib_generic_caret.o: $(srcdir)/src/generic/caret.cpp $(MONOLIB_ODEP)
@COND_TOOLKIT_DFB_USE_GUI_1@ $(CXXC) -c -o $@ $(MONOLIB_CXXFLAGS) $(srcdir)/src/generic/caret.cpp @COND_TOOLKIT_DFB_USE_GUI_1@ $(CXXC) -c -o $@ $(MONOLIB_CXXFLAGS) $(srcdir)/src/generic/caret.cpp
@COND_PLATFORM_MACOSX_1_TOOLKIT_OSX_COCOA_USE_GUI_1_WXUNIV_0@monolib_generic_imaglist.o: $(srcdir)/src/generic/imaglist.cpp $(MONOLIB_ODEP)
@COND_PLATFORM_MACOSX_1_TOOLKIT_OSX_COCOA_USE_GUI_1_WXUNIV_0@ $(CXXC) -c -o $@ $(MONOLIB_CXXFLAGS) $(srcdir)/src/generic/imaglist.cpp
@COND_PLATFORM_MACOSX_1_TOOLKIT_OSX_IPHONE_USE_GUI_1_WXUNIV_0@monolib_generic_imaglist.o: $(srcdir)/src/generic/imaglist.cpp $(MONOLIB_ODEP)
@COND_PLATFORM_MACOSX_1_TOOLKIT_OSX_IPHONE_USE_GUI_1_WXUNIV_0@ $(CXXC) -c -o $@ $(MONOLIB_CXXFLAGS) $(srcdir)/src/generic/imaglist.cpp
@COND_TOOLKIT_QT_USE_GUI_1_WXUNIV_0@monolib_generic_imaglist.o: $(srcdir)/src/generic/imaglist.cpp $(MONOLIB_ODEP) @COND_TOOLKIT_QT_USE_GUI_1_WXUNIV_0@monolib_generic_imaglist.o: $(srcdir)/src/generic/imaglist.cpp $(MONOLIB_ODEP)
@COND_TOOLKIT_QT_USE_GUI_1_WXUNIV_0@ $(CXXC) -c -o $@ $(MONOLIB_CXXFLAGS) $(srcdir)/src/generic/imaglist.cpp @COND_TOOLKIT_QT_USE_GUI_1_WXUNIV_0@ $(CXXC) -c -o $@ $(MONOLIB_CXXFLAGS) $(srcdir)/src/generic/imaglist.cpp
@@ -23957,12 +23963,6 @@ monolib_sound_sdl.o: $(srcdir)/src/unix/sound_sdl.cpp $(MONOLIB_ODEP)
@COND_PLATFORM_MACOSX_1_TOOLKIT_OSX_IPHONE_USE_GUI_1@monolib_osx_fontutil.o: $(srcdir)/src/osx/fontutil.cpp $(MONOLIB_ODEP) @COND_PLATFORM_MACOSX_1_TOOLKIT_OSX_IPHONE_USE_GUI_1@monolib_osx_fontutil.o: $(srcdir)/src/osx/fontutil.cpp $(MONOLIB_ODEP)
@COND_PLATFORM_MACOSX_1_TOOLKIT_OSX_IPHONE_USE_GUI_1@ $(CXXC) -c -o $@ $(MONOLIB_CXXFLAGS) $(srcdir)/src/osx/fontutil.cpp @COND_PLATFORM_MACOSX_1_TOOLKIT_OSX_IPHONE_USE_GUI_1@ $(CXXC) -c -o $@ $(MONOLIB_CXXFLAGS) $(srcdir)/src/osx/fontutil.cpp
@COND_PLATFORM_MACOSX_1_TOOLKIT_OSX_COCOA_USE_GUI_1@monolib_osx_imaglist.o: $(srcdir)/src/osx/imaglist.cpp $(MONOLIB_ODEP)
@COND_PLATFORM_MACOSX_1_TOOLKIT_OSX_COCOA_USE_GUI_1@ $(CXXC) -c -o $@ $(MONOLIB_CXXFLAGS) $(srcdir)/src/osx/imaglist.cpp
@COND_PLATFORM_MACOSX_1_TOOLKIT_OSX_IPHONE_USE_GUI_1@monolib_osx_imaglist.o: $(srcdir)/src/osx/imaglist.cpp $(MONOLIB_ODEP)
@COND_PLATFORM_MACOSX_1_TOOLKIT_OSX_IPHONE_USE_GUI_1@ $(CXXC) -c -o $@ $(MONOLIB_CXXFLAGS) $(srcdir)/src/osx/imaglist.cpp
@COND_PLATFORM_MACOSX_1_TOOLKIT_OSX_COCOA_USE_GUI_1@monolib_osx_minifram.o: $(srcdir)/src/osx/minifram.cpp $(MONOLIB_ODEP) @COND_PLATFORM_MACOSX_1_TOOLKIT_OSX_COCOA_USE_GUI_1@monolib_osx_minifram.o: $(srcdir)/src/osx/minifram.cpp $(MONOLIB_ODEP)
@COND_PLATFORM_MACOSX_1_TOOLKIT_OSX_COCOA_USE_GUI_1@ $(CXXC) -c -o $@ $(MONOLIB_CXXFLAGS) $(srcdir)/src/osx/minifram.cpp @COND_PLATFORM_MACOSX_1_TOOLKIT_OSX_COCOA_USE_GUI_1@ $(CXXC) -c -o $@ $(MONOLIB_CXXFLAGS) $(srcdir)/src/osx/minifram.cpp
@@ -28148,6 +28148,12 @@ coredll_sound_sdl.o: $(srcdir)/src/unix/sound_sdl.cpp $(COREDLL_ODEP)
@COND_TOOLKIT_DFB_USE_GUI_1@coredll_generic_caret.o: $(srcdir)/src/generic/caret.cpp $(COREDLL_ODEP) @COND_TOOLKIT_DFB_USE_GUI_1@coredll_generic_caret.o: $(srcdir)/src/generic/caret.cpp $(COREDLL_ODEP)
@COND_TOOLKIT_DFB_USE_GUI_1@ $(CXXC) -c -o $@ $(COREDLL_CXXFLAGS) $(srcdir)/src/generic/caret.cpp @COND_TOOLKIT_DFB_USE_GUI_1@ $(CXXC) -c -o $@ $(COREDLL_CXXFLAGS) $(srcdir)/src/generic/caret.cpp
@COND_PLATFORM_MACOSX_1_TOOLKIT_OSX_COCOA_USE_GUI_1_WXUNIV_0@coredll_generic_imaglist.o: $(srcdir)/src/generic/imaglist.cpp $(COREDLL_ODEP)
@COND_PLATFORM_MACOSX_1_TOOLKIT_OSX_COCOA_USE_GUI_1_WXUNIV_0@ $(CXXC) -c -o $@ $(COREDLL_CXXFLAGS) $(srcdir)/src/generic/imaglist.cpp
@COND_PLATFORM_MACOSX_1_TOOLKIT_OSX_IPHONE_USE_GUI_1_WXUNIV_0@coredll_generic_imaglist.o: $(srcdir)/src/generic/imaglist.cpp $(COREDLL_ODEP)
@COND_PLATFORM_MACOSX_1_TOOLKIT_OSX_IPHONE_USE_GUI_1_WXUNIV_0@ $(CXXC) -c -o $@ $(COREDLL_CXXFLAGS) $(srcdir)/src/generic/imaglist.cpp
@COND_TOOLKIT_QT_USE_GUI_1_WXUNIV_0@coredll_generic_imaglist.o: $(srcdir)/src/generic/imaglist.cpp $(COREDLL_ODEP) @COND_TOOLKIT_QT_USE_GUI_1_WXUNIV_0@coredll_generic_imaglist.o: $(srcdir)/src/generic/imaglist.cpp $(COREDLL_ODEP)
@COND_TOOLKIT_QT_USE_GUI_1_WXUNIV_0@ $(CXXC) -c -o $@ $(COREDLL_CXXFLAGS) $(srcdir)/src/generic/imaglist.cpp @COND_TOOLKIT_QT_USE_GUI_1_WXUNIV_0@ $(CXXC) -c -o $@ $(COREDLL_CXXFLAGS) $(srcdir)/src/generic/imaglist.cpp
@@ -29303,12 +29309,6 @@ coredll_sound_sdl.o: $(srcdir)/src/unix/sound_sdl.cpp $(COREDLL_ODEP)
@COND_PLATFORM_MACOSX_1_TOOLKIT_OSX_IPHONE_USE_GUI_1@coredll_osx_fontutil.o: $(srcdir)/src/osx/fontutil.cpp $(COREDLL_ODEP) @COND_PLATFORM_MACOSX_1_TOOLKIT_OSX_IPHONE_USE_GUI_1@coredll_osx_fontutil.o: $(srcdir)/src/osx/fontutil.cpp $(COREDLL_ODEP)
@COND_PLATFORM_MACOSX_1_TOOLKIT_OSX_IPHONE_USE_GUI_1@ $(CXXC) -c -o $@ $(COREDLL_CXXFLAGS) $(srcdir)/src/osx/fontutil.cpp @COND_PLATFORM_MACOSX_1_TOOLKIT_OSX_IPHONE_USE_GUI_1@ $(CXXC) -c -o $@ $(COREDLL_CXXFLAGS) $(srcdir)/src/osx/fontutil.cpp
@COND_PLATFORM_MACOSX_1_TOOLKIT_OSX_COCOA_USE_GUI_1@coredll_osx_imaglist.o: $(srcdir)/src/osx/imaglist.cpp $(COREDLL_ODEP)
@COND_PLATFORM_MACOSX_1_TOOLKIT_OSX_COCOA_USE_GUI_1@ $(CXXC) -c -o $@ $(COREDLL_CXXFLAGS) $(srcdir)/src/osx/imaglist.cpp
@COND_PLATFORM_MACOSX_1_TOOLKIT_OSX_IPHONE_USE_GUI_1@coredll_osx_imaglist.o: $(srcdir)/src/osx/imaglist.cpp $(COREDLL_ODEP)
@COND_PLATFORM_MACOSX_1_TOOLKIT_OSX_IPHONE_USE_GUI_1@ $(CXXC) -c -o $@ $(COREDLL_CXXFLAGS) $(srcdir)/src/osx/imaglist.cpp
@COND_PLATFORM_MACOSX_1_TOOLKIT_OSX_COCOA_USE_GUI_1@coredll_osx_minifram.o: $(srcdir)/src/osx/minifram.cpp $(COREDLL_ODEP) @COND_PLATFORM_MACOSX_1_TOOLKIT_OSX_COCOA_USE_GUI_1@coredll_osx_minifram.o: $(srcdir)/src/osx/minifram.cpp $(COREDLL_ODEP)
@COND_PLATFORM_MACOSX_1_TOOLKIT_OSX_COCOA_USE_GUI_1@ $(CXXC) -c -o $@ $(COREDLL_CXXFLAGS) $(srcdir)/src/osx/minifram.cpp @COND_PLATFORM_MACOSX_1_TOOLKIT_OSX_COCOA_USE_GUI_1@ $(CXXC) -c -o $@ $(COREDLL_CXXFLAGS) $(srcdir)/src/osx/minifram.cpp
@@ -32396,6 +32396,12 @@ corelib_sound_sdl.o: $(srcdir)/src/unix/sound_sdl.cpp $(CORELIB_ODEP)
@COND_TOOLKIT_DFB_USE_GUI_1@corelib_generic_caret.o: $(srcdir)/src/generic/caret.cpp $(CORELIB_ODEP) @COND_TOOLKIT_DFB_USE_GUI_1@corelib_generic_caret.o: $(srcdir)/src/generic/caret.cpp $(CORELIB_ODEP)
@COND_TOOLKIT_DFB_USE_GUI_1@ $(CXXC) -c -o $@ $(CORELIB_CXXFLAGS) $(srcdir)/src/generic/caret.cpp @COND_TOOLKIT_DFB_USE_GUI_1@ $(CXXC) -c -o $@ $(CORELIB_CXXFLAGS) $(srcdir)/src/generic/caret.cpp
@COND_PLATFORM_MACOSX_1_TOOLKIT_OSX_COCOA_USE_GUI_1_WXUNIV_0@corelib_generic_imaglist.o: $(srcdir)/src/generic/imaglist.cpp $(CORELIB_ODEP)
@COND_PLATFORM_MACOSX_1_TOOLKIT_OSX_COCOA_USE_GUI_1_WXUNIV_0@ $(CXXC) -c -o $@ $(CORELIB_CXXFLAGS) $(srcdir)/src/generic/imaglist.cpp
@COND_PLATFORM_MACOSX_1_TOOLKIT_OSX_IPHONE_USE_GUI_1_WXUNIV_0@corelib_generic_imaglist.o: $(srcdir)/src/generic/imaglist.cpp $(CORELIB_ODEP)
@COND_PLATFORM_MACOSX_1_TOOLKIT_OSX_IPHONE_USE_GUI_1_WXUNIV_0@ $(CXXC) -c -o $@ $(CORELIB_CXXFLAGS) $(srcdir)/src/generic/imaglist.cpp
@COND_TOOLKIT_QT_USE_GUI_1_WXUNIV_0@corelib_generic_imaglist.o: $(srcdir)/src/generic/imaglist.cpp $(CORELIB_ODEP) @COND_TOOLKIT_QT_USE_GUI_1_WXUNIV_0@corelib_generic_imaglist.o: $(srcdir)/src/generic/imaglist.cpp $(CORELIB_ODEP)
@COND_TOOLKIT_QT_USE_GUI_1_WXUNIV_0@ $(CXXC) -c -o $@ $(CORELIB_CXXFLAGS) $(srcdir)/src/generic/imaglist.cpp @COND_TOOLKIT_QT_USE_GUI_1_WXUNIV_0@ $(CXXC) -c -o $@ $(CORELIB_CXXFLAGS) $(srcdir)/src/generic/imaglist.cpp
@@ -33551,12 +33557,6 @@ corelib_sound_sdl.o: $(srcdir)/src/unix/sound_sdl.cpp $(CORELIB_ODEP)
@COND_PLATFORM_MACOSX_1_TOOLKIT_OSX_IPHONE_USE_GUI_1@corelib_osx_fontutil.o: $(srcdir)/src/osx/fontutil.cpp $(CORELIB_ODEP) @COND_PLATFORM_MACOSX_1_TOOLKIT_OSX_IPHONE_USE_GUI_1@corelib_osx_fontutil.o: $(srcdir)/src/osx/fontutil.cpp $(CORELIB_ODEP)
@COND_PLATFORM_MACOSX_1_TOOLKIT_OSX_IPHONE_USE_GUI_1@ $(CXXC) -c -o $@ $(CORELIB_CXXFLAGS) $(srcdir)/src/osx/fontutil.cpp @COND_PLATFORM_MACOSX_1_TOOLKIT_OSX_IPHONE_USE_GUI_1@ $(CXXC) -c -o $@ $(CORELIB_CXXFLAGS) $(srcdir)/src/osx/fontutil.cpp
@COND_PLATFORM_MACOSX_1_TOOLKIT_OSX_COCOA_USE_GUI_1@corelib_osx_imaglist.o: $(srcdir)/src/osx/imaglist.cpp $(CORELIB_ODEP)
@COND_PLATFORM_MACOSX_1_TOOLKIT_OSX_COCOA_USE_GUI_1@ $(CXXC) -c -o $@ $(CORELIB_CXXFLAGS) $(srcdir)/src/osx/imaglist.cpp
@COND_PLATFORM_MACOSX_1_TOOLKIT_OSX_IPHONE_USE_GUI_1@corelib_osx_imaglist.o: $(srcdir)/src/osx/imaglist.cpp $(CORELIB_ODEP)
@COND_PLATFORM_MACOSX_1_TOOLKIT_OSX_IPHONE_USE_GUI_1@ $(CXXC) -c -o $@ $(CORELIB_CXXFLAGS) $(srcdir)/src/osx/imaglist.cpp
@COND_PLATFORM_MACOSX_1_TOOLKIT_OSX_COCOA_USE_GUI_1@corelib_osx_minifram.o: $(srcdir)/src/osx/minifram.cpp $(CORELIB_ODEP) @COND_PLATFORM_MACOSX_1_TOOLKIT_OSX_COCOA_USE_GUI_1@corelib_osx_minifram.o: $(srcdir)/src/osx/minifram.cpp $(CORELIB_ODEP)
@COND_PLATFORM_MACOSX_1_TOOLKIT_OSX_COCOA_USE_GUI_1@ $(CXXC) -c -o $@ $(CORELIB_CXXFLAGS) $(srcdir)/src/osx/minifram.cpp @COND_PLATFORM_MACOSX_1_TOOLKIT_OSX_COCOA_USE_GUI_1@ $(CXXC) -c -o $@ $(CORELIB_CXXFLAGS) $(srcdir)/src/osx/minifram.cpp

View File

@@ -2395,7 +2395,6 @@ IMPORTANT: please read docs/tech/tn0016.txt before modifying this file!
src/osx/brush.cpp src/osx/brush.cpp
src/osx/dialog_osx.cpp src/osx/dialog_osx.cpp
src/osx/fontutil.cpp src/osx/fontutil.cpp
src/osx/imaglist.cpp
src/osx/minifram.cpp src/osx/minifram.cpp
src/osx/nonownedwnd_osx.cpp src/osx/nonownedwnd_osx.cpp
src/osx/palette.cpp src/osx/palette.cpp
@@ -2495,6 +2494,7 @@ IMPORTANT: please read docs/tech/tn0016.txt before modifying this file!
src/generic/textmeasure.cpp src/generic/textmeasure.cpp
src/generic/icon.cpp src/generic/icon.cpp
src/osx/statbmp_osx.cpp src/osx/statbmp_osx.cpp
src/generic/imaglist.cpp
</if> </if>
</set> </set>
@@ -2538,7 +2538,6 @@ IMPORTANT: please read docs/tech/tn0016.txt before modifying this file!
wx/osx/fontdlg.h wx/osx/fontdlg.h
wx/osx/frame.h wx/osx/frame.h
wx/osx/gauge.h wx/osx/gauge.h
wx/osx/imaglist.h
wx/osx/listbox.h wx/osx/listbox.h
wx/osx/listctrl.h wx/osx/listctrl.h
wx/osx/mdi.h wx/osx/mdi.h
@@ -2593,6 +2592,7 @@ IMPORTANT: please read docs/tech/tn0016.txt before modifying this file!
wx/generic/statusbr.h wx/generic/statusbr.h
wx/osx/appprogress.h wx/osx/appprogress.h
wx/generic/icon.h wx/generic/icon.h
wx/generic/imaglist.h
</set> </set>
<!-- ====================================================================== --> <!-- ====================================================================== -->

View File

@@ -2274,7 +2274,6 @@ set(OSX_LOWLEVEL_SRC
src/osx/brush.cpp src/osx/brush.cpp
src/osx/dialog_osx.cpp src/osx/dialog_osx.cpp
src/osx/fontutil.cpp src/osx/fontutil.cpp
src/osx/imaglist.cpp
src/osx/minifram.cpp src/osx/minifram.cpp
src/osx/nonownedwnd_osx.cpp src/osx/nonownedwnd_osx.cpp
src/osx/palette.cpp src/osx/palette.cpp
@@ -2373,6 +2372,7 @@ set(OSX_COMMON_SRC
src/generic/icon.cpp src/generic/icon.cpp
#TODO: </if> #TODO: </if>
src/osx/statbmp_osx.cpp src/osx/statbmp_osx.cpp
src/generic/imaglist.cpp
) )
set(OSX_SHARED_HDR set(OSX_SHARED_HDR
@@ -2414,7 +2414,6 @@ set(OSX_SHARED_HDR
wx/osx/fontdlg.h wx/osx/fontdlg.h
wx/osx/frame.h wx/osx/frame.h
wx/osx/gauge.h wx/osx/gauge.h
wx/osx/imaglist.h
wx/osx/listbox.h wx/osx/listbox.h
wx/osx/listctrl.h wx/osx/listctrl.h
wx/osx/mdi.h wx/osx/mdi.h
@@ -2469,6 +2468,7 @@ set(OSX_SHARED_HDR
wx/generic/statusbr.h wx/generic/statusbr.h
wx/osx/appprogress.h wx/osx/appprogress.h
wx/generic/icon.h wx/generic/icon.h
wx/generic/imaglist.h
) )
set(OSX_COCOA_SRC set(OSX_COCOA_SRC

View File

@@ -2256,7 +2256,6 @@ OSX_LOWLEVEL_SRC =
src/osx/brush.cpp src/osx/brush.cpp
src/osx/dialog_osx.cpp src/osx/dialog_osx.cpp
src/osx/fontutil.cpp src/osx/fontutil.cpp
src/osx/imaglist.cpp
src/osx/minifram.cpp src/osx/minifram.cpp
src/osx/nonownedwnd_osx.cpp src/osx/nonownedwnd_osx.cpp
src/osx/palette.cpp src/osx/palette.cpp
@@ -2347,6 +2346,7 @@ OSX_COMMON_SRC =
src/generic/fontdlgg.cpp src/generic/fontdlgg.cpp
src/generic/fontpickerg.cpp src/generic/fontpickerg.cpp
src/generic/icon.cpp src/generic/icon.cpp
src/generic/imaglist.cpp
src/generic/listctrl.cpp src/generic/listctrl.cpp
src/generic/prntdlgg.cpp src/generic/prntdlgg.cpp
src/generic/statusbr.cpp src/generic/statusbr.cpp
@@ -2393,7 +2393,6 @@ OSX_SHARED_HDR =
wx/osx/fontdlg.h wx/osx/fontdlg.h
wx/osx/frame.h wx/osx/frame.h
wx/osx/gauge.h wx/osx/gauge.h
wx/osx/imaglist.h
wx/osx/listbox.h wx/osx/listbox.h
wx/osx/listctrl.h wx/osx/listctrl.h
wx/osx/mdi.h wx/osx/mdi.h
@@ -2444,6 +2443,7 @@ OSX_SHARED_HDR =
wx/generic/fontdlgg.h wx/generic/fontdlgg.h
wx/generic/fontpickerg.h wx/generic/fontpickerg.h
wx/generic/icon.h wx/generic/icon.h
wx/generic/imaglist.h
wx/generic/listctrl.h wx/generic/listctrl.h
wx/generic/prntdlgg.h wx/generic/prntdlgg.h
wx/generic/statusbr.h wx/generic/statusbr.h

View File

@@ -10,10 +10,11 @@
#ifndef _WX_IMAGLISTG_H_ #ifndef _WX_IMAGLISTG_H_
#define _WX_IMAGLISTG_H_ #define _WX_IMAGLISTG_H_
#include "wx/bitmap.h"
#include "wx/gdicmn.h" #include "wx/gdicmn.h"
#include "wx/vector.h"
class WXDLLIMPEXP_FWD_CORE wxDC; class WXDLLIMPEXP_FWD_CORE wxDC;
class WXDLLIMPEXP_FWD_CORE wxBitmap;
class WXDLLIMPEXP_FWD_CORE wxIcon; class WXDLLIMPEXP_FWD_CORE wxIcon;
class WXDLLIMPEXP_FWD_CORE wxColour; class WXDLLIMPEXP_FWD_CORE wxColour;
@@ -21,23 +22,23 @@ class WXDLLIMPEXP_FWD_CORE wxColour;
class WXDLLIMPEXP_CORE wxGenericImageList: public wxObject class WXDLLIMPEXP_CORE wxGenericImageList: public wxObject
{ {
public: public:
wxGenericImageList() { m_width = m_height = 0; } wxGenericImageList() { }
wxGenericImageList( int width, int height, bool mask = true, int initialCount = 1 ); wxGenericImageList( int width, int height, bool mask = true, int initialCount = 1 );
virtual ~wxGenericImageList(); virtual ~wxGenericImageList();
bool Create( int width, int height, bool mask = true, int initialCount = 1 ); bool Create( int width, int height, bool mask = true, int initialCount = 1 );
bool Create();
virtual int GetImageCount() const; virtual int GetImageCount() const;
virtual bool GetSize( int index, int &width, int &height ) const; virtual bool GetSize( int index, int &width, int &height ) const;
virtual wxSize GetSize() const { return wxSize(m_width, m_height); } virtual wxSize GetSize() const { return m_size; }
int Add( const wxBitmap& bitmap ); int Add( const wxBitmap& bitmap );
int Add( const wxBitmap& bitmap, const wxBitmap& mask ); int Add( const wxBitmap& bitmap, const wxBitmap& mask );
int Add( const wxBitmap& bitmap, const wxColour& maskColour ); int Add( const wxBitmap& bitmap, const wxColour& maskColour );
wxBitmap GetBitmap(int index) const; wxBitmap GetBitmap(int index) const;
wxIcon GetIcon(int index) const; wxIcon GetIcon(int index) const;
bool Replace( int index, const wxBitmap &bitmap ); bool Replace( int index,
bool Replace( int index, const wxBitmap &bitmap, const wxBitmap& mask ); const wxBitmap& bitmap,
const wxBitmap& mask = wxNullBitmap );
bool Remove( int index ); bool Remove( int index );
bool RemoveAll(); bool RemoveAll();
@@ -45,13 +46,21 @@ public:
int flags = wxIMAGELIST_DRAW_NORMAL, int flags = wxIMAGELIST_DRAW_NORMAL,
bool solidBackground = false); bool solidBackground = false);
// Internal use only #if WXWIN_COMPATIBILITY_3_0
const wxBitmap *GetBitmapPtr(int index) const; wxDEPRECATED_MSG("Don't use this overload: it's not portable and does nothing")
private: bool Create() { return true; }
wxObjectList m_images;
int m_width; wxDEPRECATED_MSG("Use GetBitmap() instead")
int m_height; const wxBitmap *GetBitmapPtr(int index) const { return DoGetPtr(index); }
#endif // WXWIN_COMPATIBILITY_3_0
private:
const wxBitmap *DoGetPtr(int index) const;
wxVector<wxBitmap> m_images;
// Size of a single bitmap in the list.
wxSize m_size;
wxDECLARE_DYNAMIC_CLASS_NO_COPY(wxGenericImageList); wxDECLARE_DYNAMIC_CLASS_NO_COPY(wxGenericImageList);
}; };

View File

@@ -41,16 +41,11 @@ enum
#define wxIMAGELIST_DRAW_SELECTED 0x0004 #define wxIMAGELIST_DRAW_SELECTED 0x0004
#define wxIMAGELIST_DRAW_FOCUSED 0x0008 #define wxIMAGELIST_DRAW_FOCUSED 0x0008
#if defined(__WXMSW__) || defined(__WXMAC__) #if defined(__WXMSW__)
#define wxHAS_NATIVE_IMAGELIST
#endif
#if !defined(wxHAS_NATIVE_IMAGELIST)
#include "wx/generic/imaglist.h"
#elif defined(__WXMSW__)
#include "wx/msw/imaglist.h" #include "wx/msw/imaglist.h"
#elif defined(__WXMAC__) #define wxHAS_NATIVE_IMAGELIST
#include "wx/osx/imaglist.h" #else
#include "wx/generic/imaglist.h"
#endif #endif
#endif // _WX_IMAGLIST_H_BASE_ #endif // _WX_IMAGLIST_H_BASE_

View File

@@ -1,60 +0,0 @@
/////////////////////////////////////////////////////////////////////////////
// Name: wx/osx/imaglist.h
// Purpose:
// Author: Robert Roebling, Stefan Csomor
// Created: 01/02/97
// Id:
// Copyright: (c) 1998 Robert Roebling and Julian Smart
// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
#ifndef _WX_IMAGLIST_H_
#define _WX_IMAGLIST_H_
#include "wx/defs.h"
#include "wx/list.h"
#include "wx/icon.h"
class WXDLLIMPEXP_FWD_CORE wxDC;
class WXDLLIMPEXP_FWD_CORE wxBitmap;
class WXDLLIMPEXP_FWD_CORE wxColour;
class WXDLLIMPEXP_CORE wxImageList: public wxObject
{
public:
wxImageList() { m_width = m_height = 0; }
wxImageList( int width, int height, bool mask = true, int initialCount = 1 );
virtual ~wxImageList();
bool Create( int width, int height, bool mask = true, int initialCount = 1 );
bool Create();
virtual int GetImageCount() const;
virtual bool GetSize( int index, int &width, int &height ) const;
virtual wxSize GetSize() const { return wxSize(m_width, m_height); }
int Add( const wxBitmap& bitmap );
int Add( const wxBitmap& bitmap, const wxBitmap& mask );
int Add( const wxBitmap& bitmap, const wxColour& maskColour );
wxBitmap GetBitmap(int index) const;
wxIcon GetIcon(int index) const;
bool Replace( int index, const wxIcon &bitmap );
bool Replace( int index, const wxBitmap &bitmap );
bool Replace( int index, const wxBitmap &bitmap, const wxBitmap &mask );
bool Remove( int index );
bool RemoveAll();
virtual bool Draw(int index, wxDC& dc, int x, int y,
int flags = wxIMAGELIST_DRAW_NORMAL,
bool solidBackground = false);
private:
wxList m_images;
int m_width;
int m_height;
wxDECLARE_DYNAMIC_CLASS(wxImageList);
};
#endif // _WX_IMAGLIST_H_

View File

@@ -42,62 +42,52 @@ wxGenericImageList::~wxGenericImageList()
int wxGenericImageList::GetImageCount() const int wxGenericImageList::GetImageCount() const
{ {
return m_images.GetCount(); return static_cast<int>(m_images.size());
} }
bool wxGenericImageList::Create( int width, int height, bool WXUNUSED(mask), int WXUNUSED(initialCount) ) bool wxGenericImageList::Create( int width, int height, bool WXUNUSED(mask), int WXUNUSED(initialCount) )
{ {
m_width = width; m_size = wxSize(width, height);
m_height = height;
return Create();
}
bool wxGenericImageList::Create()
{
return true; return true;
} }
int wxGenericImageList::Add( const wxBitmap &bitmap ) int wxGenericImageList::Add( const wxBitmap &bitmap )
{ {
wxASSERT_MSG( (bitmap.GetWidth() >= m_width && bitmap.GetHeight() == m_height) // We use the scaled, i.e. logical, size here as image list images size is
|| (m_width == 0 && m_height == 0), // specified in logical pixels, just as window coordinates and sizes are.
wxT("invalid bitmap size in wxImageList: this might work ") const wxSize bitmapSize = bitmap.GetScaledSize();
wxT("on this platform but definitely won't under Windows.") );
const int index = int(m_images.GetCount()); if ( m_size == wxSize(0, 0) )
if (bitmap.IsKindOf(wxCLASSINFO(wxIcon)))
{ {
m_images.Append( new wxIcon( (const wxIcon&) bitmap ) ); // This is the first time Add() is called and we hadn't had any fixed
// size: adopt the size of our first bitmap as image size.
m_size = bitmapSize;
} }
else else // We already have a fixed size, check that the bitmap conforms to it.
{ {
// Mimic behaviour of Windows ImageList_Add that automatically breaks up the added // There is a special case: a bitmap may contain more than one image,
// bitmap into sub-images of the correct size // in which case we're supposed to chop it in parts, just as Windows
if (m_width > 0 && bitmap.GetWidth() > m_width && bitmap.GetHeight() >= m_height) // ImageList_Add() does.
if ( bitmapSize.x > m_size.x && (bitmapSize.x % m_size.x == 0) )
{ {
int numImages = bitmap.GetWidth() / m_width; const int numImages = bitmapSize.x / m_size.x;
for (int subIndex = 0; subIndex < numImages; subIndex++) for (int subIndex = 0; subIndex < numImages; subIndex++)
{ {
wxRect rect(m_width * subIndex, 0, m_width, m_height); wxRect rect(m_size.x * subIndex, 0, m_size.x, m_size.y);
wxBitmap tmpBmp = bitmap.GetSubBitmap(rect); Add(bitmap.GetSubBitmap(rect));
m_images.Append( new wxBitmap(tmpBmp) );
} }
return GetImageCount() - 1;
} }
else
{ wxASSERT_MSG( bitmapSize == m_size,
m_images.Append( new wxBitmap(bitmap) ); "All bitmaps in wxImageList must have the same size" );
}
} }
if (m_width == 0 && m_height == 0) m_images.push_back(bitmap);
{
m_width = bitmap.GetWidth();
m_height = bitmap.GetHeight();
}
return index; return GetImageCount() - 1;
} }
int wxGenericImageList::Add( const wxBitmap& bitmap, const wxBitmap& mask ) int wxGenericImageList::Add( const wxBitmap& bitmap, const wxBitmap& mask )
@@ -115,128 +105,79 @@ int wxGenericImageList::Add( const wxBitmap& bitmap, const wxColour& maskColour
return Add(wxBitmap(img)); return Add(wxBitmap(img));
} }
const wxBitmap *wxGenericImageList::GetBitmapPtr( int index ) const const wxBitmap *wxGenericImageList::DoGetPtr( int index ) const
{ {
wxObjectList::compatibility_iterator node = m_images.Item( index ); wxCHECK_MSG( index >= 0 && (size_t)index < m_images.size(),
NULL, wxT("wrong index in image list") );
wxCHECK_MSG( node, NULL, wxT("wrong index in image list") ); return &m_images[index];
return (wxBitmap*)node->GetData();
} }
// Get the bitmap // Get the bitmap
wxBitmap wxGenericImageList::GetBitmap(int index) const wxBitmap wxGenericImageList::GetBitmap(int index) const
{ {
const wxBitmap* bmp = GetBitmapPtr(index); const wxBitmap* bmp = DoGetPtr(index);
if (bmp) if (!bmp)
return *bmp;
else
return wxNullBitmap; return wxNullBitmap;
return *bmp;
} }
// Get the icon // Get the icon
wxIcon wxGenericImageList::GetIcon(int index) const wxIcon wxGenericImageList::GetIcon(int index) const
{ {
const wxBitmap* bmp = GetBitmapPtr(index); const wxBitmap* bmp = DoGetPtr(index);
if (bmp) if (!bmp)
{
wxIcon icon;
icon.CopyFromBitmap(*bmp);
return icon;
}
else
return wxNullIcon; return wxNullIcon;
wxIcon icon;
icon.CopyFromBitmap(*bmp);
return icon;
} }
bool wxGenericImageList::Replace( int index, const wxBitmap &bitmap ) bool
wxGenericImageList::Replace(int index,
const wxBitmap& bitmap,
const wxBitmap& mask)
{ {
wxObjectList::compatibility_iterator node = m_images.Item( index ); // Call DoGetPtr() just to check the index validity.
if ( !DoGetPtr(index) )
return false;
wxCHECK_MSG( node, false, wxT("wrong index in image list") ); m_images[index] = bitmap;
wxBitmap* newBitmap = (bitmap.IsKindOf(wxCLASSINFO(wxIcon))) ? if ( mask.IsOk() )
new wxBitmap( (const wxIcon&) bitmap ) m_images[index].SetMask(new wxMask(mask));
: new wxBitmap(bitmap) ;
if (index == (int) m_images.GetCount() - 1)
{
delete node->GetData();
m_images.Erase( node );
m_images.Append( newBitmap );
}
else
{
wxObjectList::compatibility_iterator next = node->GetNext();
delete node->GetData();
m_images.Erase( node );
m_images.Insert( next, newBitmap );
}
return true;
}
bool wxGenericImageList::Replace( int index, const wxBitmap &bitmap, const wxBitmap &mask )
{
wxObjectList::compatibility_iterator node = m_images.Item( index );
wxCHECK_MSG( node, false, wxT("wrong index in image list") );
wxBitmap* newBitmap = (bitmap.IsKindOf(wxCLASSINFO(wxIcon))) ?
new wxBitmap( (const wxIcon&) bitmap )
: new wxBitmap(bitmap) ;
if (index == (int) m_images.GetCount() - 1)
{
delete node->GetData();
m_images.Erase( node );
m_images.Append( newBitmap );
}
else
{
wxObjectList::compatibility_iterator next = node->GetNext();
delete node->GetData();
m_images.Erase( node );
m_images.Insert( next, newBitmap );
}
if (mask.IsOk())
newBitmap->SetMask(new wxMask(mask));
return true; return true;
} }
bool wxGenericImageList::Remove( int index ) bool wxGenericImageList::Remove( int index )
{ {
wxObjectList::compatibility_iterator node = m_images.Item( index ); m_images.erase(m_images.begin() + index);
wxCHECK_MSG( node, false, wxT("wrong index in image list") );
delete node->GetData();
m_images.Erase( node );
return true; return true;
} }
bool wxGenericImageList::RemoveAll() bool wxGenericImageList::RemoveAll()
{ {
WX_CLEAR_LIST(wxObjectList, m_images); m_images.clear();
m_images.Clear();
return true; return true;
} }
bool wxGenericImageList::GetSize( int index, int &width, int &height ) const bool wxGenericImageList::GetSize( int index, int &width, int &height ) const
{ {
width = 0; const wxBitmap* bmp = DoGetPtr(index);
height = 0; if ( !bmp )
{
width = 0;
height = 0;
return false;
}
wxObjectList::compatibility_iterator node = m_images.Item( index ); width = bmp->GetScaledWidth();
height = bmp->GetScaledHeight();
wxCHECK_MSG( node, false, wxT("wrong index in image list") );
wxBitmap *bm = (wxBitmap*)node->GetData();
width = bm->GetWidth();
height = bm->GetHeight();
return true; return true;
} }
@@ -244,16 +185,11 @@ bool wxGenericImageList::GetSize( int index, int &width, int &height ) const
bool wxGenericImageList::Draw( int index, wxDC &dc, int x, int y, bool wxGenericImageList::Draw( int index, wxDC &dc, int x, int y,
int flags, bool WXUNUSED(solidBackground) ) int flags, bool WXUNUSED(solidBackground) )
{ {
wxObjectList::compatibility_iterator node = m_images.Item( index ); const wxBitmap* bmp = DoGetPtr(index);
if ( !bmp )
return false;
wxCHECK_MSG( node, false, wxT("wrong index in image list") ); dc.DrawBitmap(*bmp, x, y, (flags & wxIMAGELIST_DRAW_TRANSPARENT) != 0);
wxBitmap *bm = (wxBitmap*)node->GetData();
if (bm->IsKindOf(wxCLASSINFO(wxIcon)))
dc.DrawIcon( * ((wxIcon*) bm), x, y);
else
dc.DrawBitmap( *bm, x, y, (flags & wxIMAGELIST_DRAW_TRANSPARENT) > 0 );
return true; return true;
} }

View File

@@ -284,17 +284,15 @@ bool wxNotebook::SetPageImage( size_t page, int image )
if (image >= 0) if (image >= 0)
{ {
wxCHECK_MSG(HasImageList(), false, "invalid notebook imagelist"); wxCHECK_MSG(HasImageList(), false, "invalid notebook imagelist");
const wxBitmap* bitmap = GetImageList()->GetBitmapPtr(image); const wxBitmap bitmap = GetImageList()->GetBitmap(image);
if (bitmap == NULL)
return false;
if (pageData->m_image) if (pageData->m_image)
{ {
gtk_image_set_from_pixbuf( gtk_image_set_from_pixbuf(
GTK_IMAGE(pageData->m_image), bitmap->GetPixbuf()); GTK_IMAGE(pageData->m_image), bitmap.GetPixbuf());
} }
else else
{ {
pageData->m_image = gtk_image_new_from_pixbuf(bitmap->GetPixbuf()); pageData->m_image = gtk_image_new_from_pixbuf(bitmap.GetPixbuf());
gtk_widget_show(pageData->m_image); gtk_widget_show(pageData->m_image);
gtk_box_pack_start(GTK_BOX(pageData->m_box), gtk_box_pack_start(GTK_BOX(pageData->m_box),
pageData->m_image, false, false, m_padding); pageData->m_image, false, false, m_padding);
@@ -443,8 +441,8 @@ bool wxNotebook::InsertPage( size_t position,
{ {
if (HasImageList()) if (HasImageList())
{ {
const wxBitmap* bitmap = GetImageList()->GetBitmapPtr(imageId); const wxBitmap bitmap = GetImageList()->GetBitmap(imageId);
pageData->m_image = gtk_image_new_from_pixbuf(bitmap->GetPixbuf()); pageData->m_image = gtk_image_new_from_pixbuf(bitmap.GetPixbuf());
gtk_box_pack_start(GTK_BOX(pageData->m_box), gtk_box_pack_start(GTK_BOX(pageData->m_box),
pageData->m_image, false, false, m_padding); pageData->m_image, false, false, m_padding);
} }

View File

@@ -512,12 +512,12 @@ bool wxNotebook::SetPageImage( size_t page, int image )
wxASSERT( HasImageList() ); /* Just in case */ wxASSERT( HasImageList() ); /* Just in case */
/* Construct the new pixmap */ /* Construct the new pixmap */
const wxBitmap *bmp = GetImageList()->GetBitmapPtr(image); const wxBitmap bmp = GetImageList()->GetBitmap(image);
GdkPixmap *pixmap = bmp->GetPixmap(); GdkPixmap *pixmap = bmp.GetPixmap();
GdkBitmap *mask = NULL; GdkBitmap *mask = NULL;
if ( bmp->GetMask() ) if ( bmp.GetMask() )
{ {
mask = bmp->GetMask()->GetBitmap(); mask = bmp.GetMask()->GetBitmap();
} }
if (pixmapwid == NULL) if (pixmapwid == NULL)
@@ -679,12 +679,12 @@ bool wxNotebook::InsertPage( size_t position,
{ {
wxASSERT( HasImageList() ); wxASSERT( HasImageList() );
const wxBitmap *bmp = GetImageList()->GetBitmapPtr(imageId); const wxBitmap bmp = GetImageList()->GetBitmap(imageId);
GdkPixmap *pixmap = bmp->GetPixmap(); GdkPixmap *pixmap = bmp.GetPixmap();
GdkBitmap *mask = NULL; GdkBitmap *mask = NULL;
if ( bmp->GetMask() ) if ( bmp.GetMask() )
{ {
mask = bmp->GetMask()->GetBitmap(); mask = bmp.GetMask()->GetBitmap();
} }
GtkWidget *pixmapwid = gtk_pixmap_new (pixmap, mask ); GtkWidget *pixmapwid = gtk_pixmap_new (pixmap, mask );

View File

@@ -1,290 +0,0 @@
/////////////////////////////////////////////////////////////////////////////
// Name: src/osx/imaglist.cpp
// Purpose:
// Author: Robert Roebling
// Copyright: (c) 1998 Robert Roebling
// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
#include "wx/wxprec.h"
#ifdef __BORLANDC__
#pragma hdrstop
#endif
#if wxUSE_IMAGLIST
#include "wx/imaglist.h"
#ifndef WX_PRECOMP
#include "wx/dc.h"
#include "wx/icon.h"
#include "wx/image.h"
#endif
wxIMPLEMENT_DYNAMIC_CLASS(wxImageList, wxObject);
wxImageList::wxImageList( int width, int height, bool mask, int initialCount )
{
(void)Create(width, height, mask, initialCount);
}
wxImageList::~wxImageList()
{
(void)RemoveAll();
}
int wxImageList::GetImageCount() const
{
return m_images.GetCount();
}
bool wxImageList::Create( int width, int height, bool WXUNUSED(mask), int WXUNUSED(initialCount) )
{
m_width = width;
m_height = height;
return Create();
}
bool wxImageList::Create()
{
return true;
}
int wxImageList::Add( const wxBitmap &bitmap )
{
wxASSERT_MSG( (bitmap.GetScaledWidth() >= m_width && bitmap.GetScaledHeight() == m_height)
|| (m_width == 0 && m_height == 0),
wxT("invalid bitmap size in wxImageList: this might work ")
wxT("on this platform but definitely won't under Windows.") );
// Mimic behaviour of Windows ImageList_Add that automatically breaks up the added
// bitmap into sub-images of the correct size
if (m_width > 0 && bitmap.GetScaledWidth() > m_width && bitmap.GetScaledHeight() >= m_height)
{
int numImages = bitmap.GetScaledWidth() / m_width;
for (int subIndex = 0; subIndex < numImages; subIndex++)
{
wxRect rect(m_width * subIndex, 0, m_width, m_height);
wxBitmap tmpBmp = bitmap.GetSubBitmap(rect);
m_images.Append( new wxBitmap(tmpBmp) );
}
}
else
{
m_images.Append( new wxBitmap(bitmap) );
}
if (m_width == 0 && m_height == 0)
{
m_width = bitmap.GetScaledWidth();
m_height = bitmap.GetScaledHeight();
}
return m_images.GetCount() - 1;
}
int wxImageList::Add( const wxBitmap& bitmap, const wxBitmap& mask )
{
wxBitmap bmp( bitmap );
if (mask.IsOk())
bmp.SetMask( new wxMask( mask ) );
return Add( bmp );
}
int wxImageList::Add( const wxBitmap& bitmap, const wxColour& maskColour )
{
wxImage img = bitmap.ConvertToImage();
img.SetMaskColour( maskColour.Red(), maskColour.Green(), maskColour.Blue() );
return Add( wxBitmap( img ) );
}
// Get the bitmap
wxBitmap wxImageList::GetBitmap(int index) const
{
wxList::compatibility_iterator node = m_images.Item( index );
wxCHECK_MSG( node, wxNullBitmap , wxT("wrong index in image list") );
wxObject* obj = (wxObject*) node->GetData();
if ( obj == NULL )
return wxNullBitmap ;
else if ( obj->IsKindOf(CLASSINFO(wxIcon)) )
return wxBitmap( *(static_cast<wxIcon*>(obj)) ) ;
else
return *(static_cast<wxBitmap*>(obj)) ;
}
// Get the icon
wxIcon wxImageList::GetIcon(int index) const
{
wxList::compatibility_iterator node = m_images.Item( index );
wxCHECK_MSG( node, wxNullIcon , wxT("wrong index in image list") );
wxObject* obj = (wxObject*) node->GetData();
if ( obj == NULL )
return wxNullIcon ;
if ( obj->IsKindOf(CLASSINFO(wxBitmap)) )
{
wxIcon icon;
icon.CopyFromBitmap(*static_cast<const wxBitmap*>(obj));
return icon;
}
return *(static_cast<wxIcon*>(obj)) ;
}
bool wxImageList::Replace( int index, const wxBitmap &bitmap )
{
wxList::compatibility_iterator node = m_images.Item( index );
wxCHECK_MSG( node, false, wxT("wrong index in image list") );
wxBitmap* newBitmap = new wxBitmap( bitmap );
if (index == (int) m_images.GetCount() - 1)
{
delete node->GetData();
m_images.Erase( node );
m_images.Append( newBitmap );
}
else
{
wxList::compatibility_iterator next = node->GetNext();
delete node->GetData();
m_images.Erase( node );
m_images.Insert( next, newBitmap );
}
return true;
}
bool wxImageList::Replace( int index, const wxIcon &bitmap )
{
wxList::compatibility_iterator node = m_images.Item( index );
wxCHECK_MSG( node, false, wxT("wrong index in image list") );
wxIcon* newBitmap = new wxIcon( bitmap );
if (index == (int) m_images.GetCount() - 1)
{
delete node->GetData();
m_images.Erase( node );
m_images.Append( newBitmap );
}
else
{
wxList::compatibility_iterator next = node->GetNext();
delete node->GetData();
m_images.Erase( node );
m_images.Insert( next, newBitmap );
}
return true;
}
bool wxImageList::Replace( int index, const wxBitmap &bitmap, const wxBitmap &mask )
{
wxList::compatibility_iterator node = m_images.Item( index );
wxCHECK_MSG( node, false, wxT("wrong index in image list") );
wxBitmap* newBitmap = new wxBitmap(bitmap);
if (index == (int) m_images.GetCount() - 1)
{
delete node->GetData();
m_images.Erase( node );
m_images.Append( newBitmap );
}
else
{
wxList::compatibility_iterator next = node->GetNext();
delete node->GetData();
m_images.Erase( node );
m_images.Insert( next, newBitmap );
}
if (mask.IsOk())
newBitmap->SetMask(new wxMask(mask));
return true;
}
bool wxImageList::Remove( int index )
{
wxList::compatibility_iterator node = m_images.Item( index );
wxCHECK_MSG( node, false, wxT("wrong index in image list") );
delete node->GetData();
m_images.Erase( node );
return true;
}
bool wxImageList::RemoveAll()
{
WX_CLEAR_LIST(wxList, m_images);
m_images.Clear();
return true;
}
bool wxImageList::GetSize( int index, int &width, int &height ) const
{
width = 0;
height = 0;
wxList::compatibility_iterator node = m_images.Item( index );
wxCHECK_MSG( node, false, wxT("wrong index in image list") );
wxObject *obj = (wxObject*)node->GetData();
if (obj->IsKindOf(CLASSINFO(wxIcon)))
{
wxIcon *bm = static_cast< wxIcon* >(obj ) ;
width = bm->GetWidth();
height = bm->GetHeight();
}
else
{
wxBitmap *bm = static_cast< wxBitmap* >(obj ) ;
width = bm->GetScaledWidth();
height = bm->GetScaledHeight();
}
return true;
}
bool wxImageList::Draw(
int index, wxDC &dc, int x, int y,
int flags, bool WXUNUSED(solidBackground) )
{
wxList::compatibility_iterator node = m_images.Item( index );
wxCHECK_MSG( node, false, wxT("wrong index in image list") );
wxObject *obj = (wxObject*)node->GetData();
if (obj->IsKindOf(CLASSINFO(wxIcon)))
{
wxIcon *bm = static_cast< wxIcon* >(obj ) ;
dc.DrawIcon( *bm , x, y );
}
else
{
wxBitmap *bm = static_cast< wxBitmap* >(obj ) ;
dc.DrawBitmap( *bm, x, y, (flags & wxIMAGELIST_DRAW_TRANSPARENT) > 0 );
}
return true;
}
#endif // wxUSE_IMAGLIST

View File

@@ -329,12 +329,9 @@ bool wxListCtrl::SetItem(wxListItem& info)
{ {
wxImageList *imglst = GetImageList(InReportView() ? wxIMAGE_LIST_SMALL : wxIMAGE_LIST_NORMAL); wxImageList *imglst = GetImageList(InReportView() ? wxIMAGE_LIST_SMALL : wxIMAGE_LIST_NORMAL);
wxCHECK_MSG(imglst, false, "invalid listctrl imagelist"); wxCHECK_MSG(imglst, false, "invalid listctrl imagelist");
const wxBitmap* bitmap = imglst->GetBitmapPtr(info.m_image); const wxBitmap bitmap = imglst->GetBitmap(info.m_image);
if (bitmap != NULL) // set the new image:
{ qitem->setIcon( info.GetColumn(), QIcon( *bitmap.GetHandle() ));
// set the new image:
qitem->setIcon( info.GetColumn(), QIcon( *bitmap->GetHandle() ));
}
} }
else else
{ {

View File

@@ -112,11 +112,9 @@ bool wxNotebook::SetPageImage(size_t n, int imageId)
if (imageId >= 0) if (imageId >= 0)
{ {
wxCHECK_MSG(HasImageList(), false, "invalid notebook imagelist"); wxCHECK_MSG(HasImageList(), false, "invalid notebook imagelist");
const wxBitmap* bitmap = GetImageList()->GetBitmapPtr(imageId); const wxBitmap bitmap = GetImageList()->GetBitmap(imageId);
if (bitmap == NULL)
return false;
// set the new image: // set the new image:
m_qtTabWidget->setTabIcon( n, QIcon( *bitmap->GetHandle() )); m_qtTabWidget->setTabIcon( n, QIcon( *bitmap.GetHandle() ));
} }
else else
{ {
@@ -137,8 +135,8 @@ bool wxNotebook::InsertPage(size_t n, wxWindow *page, const wxString& text,
{ {
if (HasImageList()) if (HasImageList())
{ {
const wxBitmap* bitmap = GetImageList()->GetBitmapPtr(imageId); const wxBitmap bitmap = GetImageList()->GetBitmap(imageId);
m_qtTabWidget->insertTab( n, page->GetHandle(), QIcon( *bitmap->GetHandle() ), wxQtConvertString( text )); m_qtTabWidget->insertTab( n, page->GetHandle(), QIcon( *bitmap.GetHandle() ), wxQtConvertString( text ));
} }
else else
{ {