From a30e7029749646348aaacf61da9ed66743d77a40 Mon Sep 17 00:00:00 2001 From: Vadim Zeitlin Date: Sat, 21 Jun 2008 15:32:33 +0000 Subject: [PATCH 1/1] added wxGenericStaticBitmap (#9608) git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@54314 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- Makefile.in | 21 +++++ build/bakefiles/files.bkl | 2 + build/msw/makefile.bcc | 28 ++++++ build/msw/makefile.gcc | 28 ++++++ build/msw/makefile.vc | 28 ++++++ build/msw/makefile.wat | 28 ++++++ build/msw/wx_core.dsp | 8 ++ build/msw/wx_vc7_core.vcproj | 4 + build/msw/wx_vc8_core.vcproj | 6 ++ docs/changes.txt | 1 + include/wx/generic/statbmpg.h | 76 +++++++++++++++++ interface/statbmp.h | 11 +-- samples/widgets/Makefile.in | 13 +++ samples/widgets/icons/statbmp.xpm | 40 +++++++++ samples/widgets/makefile.bcc | 4 + samples/widgets/makefile.gcc | 4 + samples/widgets/makefile.unx | 4 + samples/widgets/makefile.vc | 4 + samples/widgets/makefile.wat | 4 + samples/widgets/statbmp.cpp | 131 +++++++++++++++++++++++++++++ samples/widgets/widgets.bkl | 1 + samples/widgets/widgets.dsp | 4 + samples/widgets/widgets_vc7.vcproj | 2 + samples/widgets/widgets_vc8.vcproj | 3 + src/generic/statbmpg.cpp | 42 +++++++++ 25 files changed, 492 insertions(+), 5 deletions(-) create mode 100644 include/wx/generic/statbmpg.h create mode 100644 samples/widgets/icons/statbmp.xpm create mode 100644 samples/widgets/statbmp.cpp create mode 100644 src/generic/statbmpg.cpp diff --git a/Makefile.in b/Makefile.in index 77b2e0cf23..1a4066f7b5 100644 --- a/Makefile.in +++ b/Makefile.in @@ -3219,6 +3219,7 @@ COND_USE_GUI_1_ALL_GUI_HEADERS = \ wx/generic/spinctlg.h \ wx/generic/splitter.h \ wx/generic/srchctlg.h \ + wx/generic/statbmpg.h \ wx/generic/textdlgg.h \ wx/generic/treectlg.h \ wx/graphics.h \ @@ -3960,6 +3961,7 @@ COND_USE_GUI_1_WXUNIV_0___CORE_SRC_OBJECTS = \ monodll_spinctlg.o \ monodll_splitter.o \ monodll_srchctlg.o \ + monodll_statbmpg.o \ monodll_textdlgg.o \ monodll_tipwin.o \ monodll_toolbkg.o \ @@ -4145,6 +4147,7 @@ COND_USE_GUI_1_WXUNIV_1___CORE_SRC_OBJECTS = \ monodll_spinctlg.o \ monodll_splitter.o \ monodll_srchctlg.o \ + monodll_statbmpg.o \ monodll_textdlgg.o \ monodll_tipwin.o \ monodll_toolbkg.o \ @@ -5877,6 +5880,7 @@ COND_USE_GUI_1_WXUNIV_0___CORE_SRC_OBJECTS_1 = \ monolib_spinctlg.o \ monolib_splitter.o \ monolib_srchctlg.o \ + monolib_statbmpg.o \ monolib_textdlgg.o \ monolib_tipwin.o \ monolib_toolbkg.o \ @@ -6062,6 +6066,7 @@ COND_USE_GUI_1_WXUNIV_1___CORE_SRC_OBJECTS_1 = \ monolib_spinctlg.o \ monolib_splitter.o \ monolib_srchctlg.o \ + monolib_statbmpg.o \ monolib_textdlgg.o \ monolib_tipwin.o \ monolib_toolbkg.o \ @@ -8079,6 +8084,7 @@ COND_USE_GUI_1_WXUNIV_0___CORE_SRC_OBJECTS_2 = \ coredll_spinctlg.o \ coredll_splitter.o \ coredll_srchctlg.o \ + coredll_statbmpg.o \ coredll_textdlgg.o \ coredll_tipwin.o \ coredll_toolbkg.o \ @@ -8264,6 +8270,7 @@ COND_USE_GUI_1_WXUNIV_1___CORE_SRC_OBJECTS_2 = \ coredll_spinctlg.o \ coredll_splitter.o \ coredll_srchctlg.o \ + coredll_statbmpg.o \ coredll_textdlgg.o \ coredll_tipwin.o \ coredll_toolbkg.o \ @@ -9574,6 +9581,7 @@ COND_USE_GUI_1_WXUNIV_0___CORE_SRC_OBJECTS_3 = \ corelib_spinctlg.o \ corelib_splitter.o \ corelib_srchctlg.o \ + corelib_statbmpg.o \ corelib_textdlgg.o \ corelib_tipwin.o \ corelib_toolbkg.o \ @@ -9759,6 +9767,7 @@ COND_USE_GUI_1_WXUNIV_1___CORE_SRC_OBJECTS_3 = \ corelib_spinctlg.o \ corelib_splitter.o \ corelib_srchctlg.o \ + corelib_statbmpg.o \ corelib_textdlgg.o \ corelib_tipwin.o \ corelib_toolbkg.o \ @@ -17845,6 +17854,9 @@ monodll_sound_sdl.o: $(srcdir)/src/unix/sound_sdl.cpp $(MONODLL_ODEP) @COND_USE_GUI_1@monodll_srchctlg.o: $(srcdir)/src/generic/srchctlg.cpp $(MONODLL_ODEP) @COND_USE_GUI_1@ $(CXXC) -c -o $@ $(MONODLL_CXXFLAGS) $(srcdir)/src/generic/srchctlg.cpp +@COND_USE_GUI_1@monodll_statbmpg.o: $(srcdir)/src/generic/statbmpg.cpp $(MONODLL_ODEP) +@COND_USE_GUI_1@ $(CXXC) -c -o $@ $(MONODLL_CXXFLAGS) $(srcdir)/src/generic/statbmpg.cpp + @COND_USE_GUI_1@monodll_textdlgg.o: $(srcdir)/src/generic/textdlgg.cpp $(MONODLL_ODEP) @COND_USE_GUI_1@ $(CXXC) -c -o $@ $(MONODLL_CXXFLAGS) $(srcdir)/src/generic/textdlgg.cpp @@ -22381,6 +22393,9 @@ monolib_sound_sdl.o: $(srcdir)/src/unix/sound_sdl.cpp $(MONOLIB_ODEP) @COND_USE_GUI_1@monolib_srchctlg.o: $(srcdir)/src/generic/srchctlg.cpp $(MONOLIB_ODEP) @COND_USE_GUI_1@ $(CXXC) -c -o $@ $(MONOLIB_CXXFLAGS) $(srcdir)/src/generic/srchctlg.cpp +@COND_USE_GUI_1@monolib_statbmpg.o: $(srcdir)/src/generic/statbmpg.cpp $(MONOLIB_ODEP) +@COND_USE_GUI_1@ $(CXXC) -c -o $@ $(MONOLIB_CXXFLAGS) $(srcdir)/src/generic/statbmpg.cpp + @COND_USE_GUI_1@monolib_textdlgg.o: $(srcdir)/src/generic/textdlgg.cpp $(MONOLIB_ODEP) @COND_USE_GUI_1@ $(CXXC) -c -o $@ $(MONOLIB_CXXFLAGS) $(srcdir)/src/generic/textdlgg.cpp @@ -27457,6 +27472,9 @@ coredll_win32.o: $(srcdir)/src/univ/themes/win32.cpp $(COREDLL_ODEP) @COND_USE_GUI_1@coredll_srchctlg.o: $(srcdir)/src/generic/srchctlg.cpp $(COREDLL_ODEP) @COND_USE_GUI_1@ $(CXXC) -c -o $@ $(COREDLL_CXXFLAGS) $(srcdir)/src/generic/srchctlg.cpp +@COND_USE_GUI_1@coredll_statbmpg.o: $(srcdir)/src/generic/statbmpg.cpp $(COREDLL_ODEP) +@COND_USE_GUI_1@ $(CXXC) -c -o $@ $(COREDLL_CXXFLAGS) $(srcdir)/src/generic/statbmpg.cpp + @COND_USE_GUI_1@coredll_textdlgg.o: $(srcdir)/src/generic/textdlgg.cpp $(COREDLL_ODEP) @COND_USE_GUI_1@ $(CXXC) -c -o $@ $(COREDLL_CXXFLAGS) $(srcdir)/src/generic/textdlgg.cpp @@ -30526,6 +30544,9 @@ corelib_win32.o: $(srcdir)/src/univ/themes/win32.cpp $(CORELIB_ODEP) @COND_USE_GUI_1@corelib_srchctlg.o: $(srcdir)/src/generic/srchctlg.cpp $(CORELIB_ODEP) @COND_USE_GUI_1@ $(CXXC) -c -o $@ $(CORELIB_CXXFLAGS) $(srcdir)/src/generic/srchctlg.cpp +@COND_USE_GUI_1@corelib_statbmpg.o: $(srcdir)/src/generic/statbmpg.cpp $(CORELIB_ODEP) +@COND_USE_GUI_1@ $(CXXC) -c -o $@ $(CORELIB_CXXFLAGS) $(srcdir)/src/generic/statbmpg.cpp + @COND_USE_GUI_1@corelib_textdlgg.o: $(srcdir)/src/generic/textdlgg.cpp $(CORELIB_ODEP) @COND_USE_GUI_1@ $(CXXC) -c -o $@ $(CORELIB_CXXFLAGS) $(srcdir)/src/generic/textdlgg.cpp diff --git a/build/bakefiles/files.bkl b/build/bakefiles/files.bkl index 4021ebb42b..a964fda965 100644 --- a/build/bakefiles/files.bkl +++ b/build/bakefiles/files.bkl @@ -761,6 +761,7 @@ IMPORTANT: please read docs/tech/tn0016.txt before modifying this file! src/generic/spinctlg.cpp src/generic/splitter.cpp src/generic/srchctlg.cpp + src/generic/statbmpg.cpp src/generic/textdlgg.cpp src/generic/tipwin.cpp src/generic/toolbkg.cpp @@ -822,6 +823,7 @@ IMPORTANT: please read docs/tech/tn0016.txt before modifying this file! wx/generic/spinctlg.h wx/generic/splitter.h wx/generic/srchctlg.h + wx/generic/statbmpg.h wx/generic/textdlgg.h wx/generic/treectlg.h wx/graphics.h diff --git a/build/msw/makefile.bcc b/build/msw/makefile.bcc index 5ae94d5ec8..9ab0b83cc3 100644 --- a/build/msw/makefile.bcc +++ b/build/msw/makefile.bcc @@ -1695,6 +1695,7 @@ ____CORE_SRC_FILENAMES_OBJECTS = \ $(OBJS)\monodll_spinctlg.obj \ $(OBJS)\monodll_splitter.obj \ $(OBJS)\monodll_srchctlg.obj \ + $(OBJS)\monodll_statbmpg.obj \ $(OBJS)\monodll_textdlgg.obj \ $(OBJS)\monodll_tipwin.obj \ $(OBJS)\monodll_toolbkg.obj \ @@ -1927,6 +1928,7 @@ ____CORE_SRC_FILENAMES_OBJECTS = \ $(OBJS)\monodll_spinctlg.obj \ $(OBJS)\monodll_splitter.obj \ $(OBJS)\monodll_srchctlg.obj \ + $(OBJS)\monodll_statbmpg.obj \ $(OBJS)\monodll_textdlgg.obj \ $(OBJS)\monodll_tipwin.obj \ $(OBJS)\monodll_toolbkg.obj \ @@ -2348,6 +2350,7 @@ ____CORE_SRC_FILENAMES_1_OBJECTS = \ $(OBJS)\monolib_spinctlg.obj \ $(OBJS)\monolib_splitter.obj \ $(OBJS)\monolib_srchctlg.obj \ + $(OBJS)\monolib_statbmpg.obj \ $(OBJS)\monolib_textdlgg.obj \ $(OBJS)\monolib_tipwin.obj \ $(OBJS)\monolib_toolbkg.obj \ @@ -2580,6 +2583,7 @@ ____CORE_SRC_FILENAMES_1_OBJECTS = \ $(OBJS)\monolib_spinctlg.obj \ $(OBJS)\monolib_splitter.obj \ $(OBJS)\monolib_srchctlg.obj \ + $(OBJS)\monolib_statbmpg.obj \ $(OBJS)\monolib_textdlgg.obj \ $(OBJS)\monolib_tipwin.obj \ $(OBJS)\monolib_toolbkg.obj \ @@ -2916,6 +2920,7 @@ ____CORE_SRC_FILENAMES_2_OBJECTS = \ $(OBJS)\coredll_spinctlg.obj \ $(OBJS)\coredll_splitter.obj \ $(OBJS)\coredll_srchctlg.obj \ + $(OBJS)\coredll_statbmpg.obj \ $(OBJS)\coredll_textdlgg.obj \ $(OBJS)\coredll_tipwin.obj \ $(OBJS)\coredll_toolbkg.obj \ @@ -3148,6 +3153,7 @@ ____CORE_SRC_FILENAMES_2_OBJECTS = \ $(OBJS)\coredll_spinctlg.obj \ $(OBJS)\coredll_splitter.obj \ $(OBJS)\coredll_srchctlg.obj \ + $(OBJS)\coredll_statbmpg.obj \ $(OBJS)\coredll_textdlgg.obj \ $(OBJS)\coredll_tipwin.obj \ $(OBJS)\coredll_toolbkg.obj \ @@ -3383,6 +3389,7 @@ ____CORE_SRC_FILENAMES_3_OBJECTS = \ $(OBJS)\corelib_spinctlg.obj \ $(OBJS)\corelib_splitter.obj \ $(OBJS)\corelib_srchctlg.obj \ + $(OBJS)\corelib_statbmpg.obj \ $(OBJS)\corelib_textdlgg.obj \ $(OBJS)\corelib_tipwin.obj \ $(OBJS)\corelib_toolbkg.obj \ @@ -3615,6 +3622,7 @@ ____CORE_SRC_FILENAMES_3_OBJECTS = \ $(OBJS)\corelib_spinctlg.obj \ $(OBJS)\corelib_splitter.obj \ $(OBJS)\corelib_srchctlg.obj \ + $(OBJS)\corelib_statbmpg.obj \ $(OBJS)\corelib_textdlgg.obj \ $(OBJS)\corelib_tipwin.obj \ $(OBJS)\corelib_toolbkg.obj \ @@ -7162,6 +7170,11 @@ $(OBJS)\monodll_srchctlg.obj: ..\..\src\generic\srchctlg.cpp $(CXX) -q -c -P -o$@ $(MONODLL_CXXFLAGS) ..\..\src\generic\srchctlg.cpp !endif +!if "$(USE_GUI)" == "1" +$(OBJS)\monodll_statbmpg.obj: ..\..\src\generic\statbmpg.cpp + $(CXX) -q -c -P -o$@ $(MONODLL_CXXFLAGS) ..\..\src\generic\statbmpg.cpp +!endif + !if "$(USE_GUI)" == "1" $(OBJS)\monodll_textdlgg.obj: ..\..\src\generic\textdlgg.cpp $(CXX) -q -c -P -o$@ $(MONODLL_CXXFLAGS) ..\..\src\generic\textdlgg.cpp @@ -9307,6 +9320,11 @@ $(OBJS)\monolib_srchctlg.obj: ..\..\src\generic\srchctlg.cpp $(CXX) -q -c -P -o$@ $(MONOLIB_CXXFLAGS) ..\..\src\generic\srchctlg.cpp !endif +!if "$(USE_GUI)" == "1" +$(OBJS)\monolib_statbmpg.obj: ..\..\src\generic\statbmpg.cpp + $(CXX) -q -c -P -o$@ $(MONOLIB_CXXFLAGS) ..\..\src\generic\statbmpg.cpp +!endif + !if "$(USE_GUI)" == "1" $(OBJS)\monolib_textdlgg.obj: ..\..\src\generic\textdlgg.cpp $(CXX) -q -c -P -o$@ $(MONOLIB_CXXFLAGS) ..\..\src\generic\textdlgg.cpp @@ -11503,6 +11521,11 @@ $(OBJS)\coredll_srchctlg.obj: ..\..\src\generic\srchctlg.cpp $(CXX) -q -c -P -o$@ $(COREDLL_CXXFLAGS) ..\..\src\generic\srchctlg.cpp !endif +!if "$(USE_GUI)" == "1" +$(OBJS)\coredll_statbmpg.obj: ..\..\src\generic\statbmpg.cpp + $(CXX) -q -c -P -o$@ $(COREDLL_CXXFLAGS) ..\..\src\generic\statbmpg.cpp +!endif + !if "$(USE_GUI)" == "1" $(OBJS)\coredll_textdlgg.obj: ..\..\src\generic\textdlgg.cpp $(CXX) -q -c -P -o$@ $(COREDLL_CXXFLAGS) ..\..\src\generic\textdlgg.cpp @@ -12834,6 +12857,11 @@ $(OBJS)\corelib_srchctlg.obj: ..\..\src\generic\srchctlg.cpp $(CXX) -q -c -P -o$@ $(CORELIB_CXXFLAGS) ..\..\src\generic\srchctlg.cpp !endif +!if "$(USE_GUI)" == "1" +$(OBJS)\corelib_statbmpg.obj: ..\..\src\generic\statbmpg.cpp + $(CXX) -q -c -P -o$@ $(CORELIB_CXXFLAGS) ..\..\src\generic\statbmpg.cpp +!endif + !if "$(USE_GUI)" == "1" $(OBJS)\corelib_textdlgg.obj: ..\..\src\generic\textdlgg.cpp $(CXX) -q -c -P -o$@ $(CORELIB_CXXFLAGS) ..\..\src\generic\textdlgg.cpp diff --git a/build/msw/makefile.gcc b/build/msw/makefile.gcc index 0d4ae695fa..72d42a134a 100644 --- a/build/msw/makefile.gcc +++ b/build/msw/makefile.gcc @@ -1712,6 +1712,7 @@ ____CORE_SRC_FILENAMES_OBJECTS = \ $(OBJS)\monodll_spinctlg.o \ $(OBJS)\monodll_splitter.o \ $(OBJS)\monodll_srchctlg.o \ + $(OBJS)\monodll_statbmpg.o \ $(OBJS)\monodll_textdlgg.o \ $(OBJS)\monodll_tipwin.o \ $(OBJS)\monodll_toolbkg.o \ @@ -1946,6 +1947,7 @@ ____CORE_SRC_FILENAMES_OBJECTS = \ $(OBJS)\monodll_spinctlg.o \ $(OBJS)\monodll_splitter.o \ $(OBJS)\monodll_srchctlg.o \ + $(OBJS)\monodll_statbmpg.o \ $(OBJS)\monodll_textdlgg.o \ $(OBJS)\monodll_tipwin.o \ $(OBJS)\monodll_toolbkg.o \ @@ -2371,6 +2373,7 @@ ____CORE_SRC_FILENAMES_1_OBJECTS = \ $(OBJS)\monolib_spinctlg.o \ $(OBJS)\monolib_splitter.o \ $(OBJS)\monolib_srchctlg.o \ + $(OBJS)\monolib_statbmpg.o \ $(OBJS)\monolib_textdlgg.o \ $(OBJS)\monolib_tipwin.o \ $(OBJS)\monolib_toolbkg.o \ @@ -2605,6 +2608,7 @@ ____CORE_SRC_FILENAMES_1_OBJECTS = \ $(OBJS)\monolib_spinctlg.o \ $(OBJS)\monolib_splitter.o \ $(OBJS)\monolib_srchctlg.o \ + $(OBJS)\monolib_statbmpg.o \ $(OBJS)\monolib_textdlgg.o \ $(OBJS)\monolib_tipwin.o \ $(OBJS)\monolib_toolbkg.o \ @@ -2955,6 +2959,7 @@ ____CORE_SRC_FILENAMES_2_OBJECTS = \ $(OBJS)\coredll_spinctlg.o \ $(OBJS)\coredll_splitter.o \ $(OBJS)\coredll_srchctlg.o \ + $(OBJS)\coredll_statbmpg.o \ $(OBJS)\coredll_textdlgg.o \ $(OBJS)\coredll_tipwin.o \ $(OBJS)\coredll_toolbkg.o \ @@ -3189,6 +3194,7 @@ ____CORE_SRC_FILENAMES_2_OBJECTS = \ $(OBJS)\coredll_spinctlg.o \ $(OBJS)\coredll_splitter.o \ $(OBJS)\coredll_srchctlg.o \ + $(OBJS)\coredll_statbmpg.o \ $(OBJS)\coredll_textdlgg.o \ $(OBJS)\coredll_tipwin.o \ $(OBJS)\coredll_toolbkg.o \ @@ -3430,6 +3436,7 @@ ____CORE_SRC_FILENAMES_3_OBJECTS = \ $(OBJS)\corelib_spinctlg.o \ $(OBJS)\corelib_splitter.o \ $(OBJS)\corelib_srchctlg.o \ + $(OBJS)\corelib_statbmpg.o \ $(OBJS)\corelib_textdlgg.o \ $(OBJS)\corelib_tipwin.o \ $(OBJS)\corelib_toolbkg.o \ @@ -3664,6 +3671,7 @@ ____CORE_SRC_FILENAMES_3_OBJECTS = \ $(OBJS)\corelib_spinctlg.o \ $(OBJS)\corelib_splitter.o \ $(OBJS)\corelib_srchctlg.o \ + $(OBJS)\corelib_statbmpg.o \ $(OBJS)\corelib_textdlgg.o \ $(OBJS)\corelib_tipwin.o \ $(OBJS)\corelib_toolbkg.o \ @@ -7416,6 +7424,11 @@ $(OBJS)\monodll_srchctlg.o: ../../src/generic/srchctlg.cpp $(CXX) -c -o $@ $(MONODLL_CXXFLAGS) $(CPPDEPS) $< endif +ifeq ($(USE_GUI),1) +$(OBJS)\monodll_statbmpg.o: ../../src/generic/statbmpg.cpp + $(CXX) -c -o $@ $(MONODLL_CXXFLAGS) $(CPPDEPS) $< +endif + ifeq ($(USE_GUI),1) $(OBJS)\monodll_textdlgg.o: ../../src/generic/textdlgg.cpp $(CXX) -c -o $@ $(MONODLL_CXXFLAGS) $(CPPDEPS) $< @@ -9675,6 +9688,11 @@ $(OBJS)\monolib_srchctlg.o: ../../src/generic/srchctlg.cpp $(CXX) -c -o $@ $(MONOLIB_CXXFLAGS) $(CPPDEPS) $< endif +ifeq ($(USE_GUI),1) +$(OBJS)\monolib_statbmpg.o: ../../src/generic/statbmpg.cpp + $(CXX) -c -o $@ $(MONOLIB_CXXFLAGS) $(CPPDEPS) $< +endif + ifeq ($(USE_GUI),1) $(OBJS)\monolib_textdlgg.o: ../../src/generic/textdlgg.cpp $(CXX) -c -o $@ $(MONOLIB_CXXFLAGS) $(CPPDEPS) $< @@ -11985,6 +12003,11 @@ $(OBJS)\coredll_srchctlg.o: ../../src/generic/srchctlg.cpp $(CXX) -c -o $@ $(COREDLL_CXXFLAGS) $(CPPDEPS) $< endif +ifeq ($(USE_GUI),1) +$(OBJS)\coredll_statbmpg.o: ../../src/generic/statbmpg.cpp + $(CXX) -c -o $@ $(COREDLL_CXXFLAGS) $(CPPDEPS) $< +endif + ifeq ($(USE_GUI),1) $(OBJS)\coredll_textdlgg.o: ../../src/generic/textdlgg.cpp $(CXX) -c -o $@ $(COREDLL_CXXFLAGS) $(CPPDEPS) $< @@ -13428,6 +13451,11 @@ $(OBJS)\corelib_srchctlg.o: ../../src/generic/srchctlg.cpp $(CXX) -c -o $@ $(CORELIB_CXXFLAGS) $(CPPDEPS) $< endif +ifeq ($(USE_GUI),1) +$(OBJS)\corelib_statbmpg.o: ../../src/generic/statbmpg.cpp + $(CXX) -c -o $@ $(CORELIB_CXXFLAGS) $(CPPDEPS) $< +endif + ifeq ($(USE_GUI),1) $(OBJS)\corelib_textdlgg.o: ../../src/generic/textdlgg.cpp $(CXX) -c -o $@ $(CORELIB_CXXFLAGS) $(CPPDEPS) $< diff --git a/build/msw/makefile.vc b/build/msw/makefile.vc index 65ae2f601a..0b94488b63 100644 --- a/build/msw/makefile.vc +++ b/build/msw/makefile.vc @@ -1869,6 +1869,7 @@ ____CORE_SRC_FILENAMES_OBJECTS = \ $(OBJS)\monodll_spinctlg.obj \ $(OBJS)\monodll_splitter.obj \ $(OBJS)\monodll_srchctlg.obj \ + $(OBJS)\monodll_statbmpg.obj \ $(OBJS)\monodll_textdlgg.obj \ $(OBJS)\monodll_tipwin.obj \ $(OBJS)\monodll_toolbkg.obj \ @@ -2101,6 +2102,7 @@ ____CORE_SRC_FILENAMES_OBJECTS = \ $(OBJS)\monodll_spinctlg.obj \ $(OBJS)\monodll_splitter.obj \ $(OBJS)\monodll_srchctlg.obj \ + $(OBJS)\monodll_statbmpg.obj \ $(OBJS)\monodll_textdlgg.obj \ $(OBJS)\monodll_tipwin.obj \ $(OBJS)\monodll_toolbkg.obj \ @@ -2528,6 +2530,7 @@ ____CORE_SRC_FILENAMES_1_OBJECTS = \ $(OBJS)\monolib_spinctlg.obj \ $(OBJS)\monolib_splitter.obj \ $(OBJS)\monolib_srchctlg.obj \ + $(OBJS)\monolib_statbmpg.obj \ $(OBJS)\monolib_textdlgg.obj \ $(OBJS)\monolib_tipwin.obj \ $(OBJS)\monolib_toolbkg.obj \ @@ -2760,6 +2763,7 @@ ____CORE_SRC_FILENAMES_1_OBJECTS = \ $(OBJS)\monolib_spinctlg.obj \ $(OBJS)\monolib_splitter.obj \ $(OBJS)\monolib_srchctlg.obj \ + $(OBJS)\monolib_statbmpg.obj \ $(OBJS)\monolib_textdlgg.obj \ $(OBJS)\monolib_tipwin.obj \ $(OBJS)\monolib_toolbkg.obj \ @@ -3126,6 +3130,7 @@ ____CORE_SRC_FILENAMES_2_OBJECTS = \ $(OBJS)\coredll_spinctlg.obj \ $(OBJS)\coredll_splitter.obj \ $(OBJS)\coredll_srchctlg.obj \ + $(OBJS)\coredll_statbmpg.obj \ $(OBJS)\coredll_textdlgg.obj \ $(OBJS)\coredll_tipwin.obj \ $(OBJS)\coredll_toolbkg.obj \ @@ -3358,6 +3363,7 @@ ____CORE_SRC_FILENAMES_2_OBJECTS = \ $(OBJS)\coredll_spinctlg.obj \ $(OBJS)\coredll_splitter.obj \ $(OBJS)\coredll_srchctlg.obj \ + $(OBJS)\coredll_statbmpg.obj \ $(OBJS)\coredll_textdlgg.obj \ $(OBJS)\coredll_tipwin.obj \ $(OBJS)\coredll_toolbkg.obj \ @@ -3599,6 +3605,7 @@ ____CORE_SRC_FILENAMES_3_OBJECTS = \ $(OBJS)\corelib_spinctlg.obj \ $(OBJS)\corelib_splitter.obj \ $(OBJS)\corelib_srchctlg.obj \ + $(OBJS)\corelib_statbmpg.obj \ $(OBJS)\corelib_textdlgg.obj \ $(OBJS)\corelib_tipwin.obj \ $(OBJS)\corelib_toolbkg.obj \ @@ -3831,6 +3838,7 @@ ____CORE_SRC_FILENAMES_3_OBJECTS = \ $(OBJS)\corelib_spinctlg.obj \ $(OBJS)\corelib_splitter.obj \ $(OBJS)\corelib_srchctlg.obj \ + $(OBJS)\corelib_statbmpg.obj \ $(OBJS)\corelib_textdlgg.obj \ $(OBJS)\corelib_tipwin.obj \ $(OBJS)\corelib_toolbkg.obj \ @@ -7494,6 +7502,11 @@ $(OBJS)\monodll_srchctlg.obj: ..\..\src\generic\srchctlg.cpp $(CXX) /c /nologo /TP /Fo$@ $(MONODLL_CXXFLAGS) ..\..\src\generic\srchctlg.cpp !endif +!if "$(USE_GUI)" == "1" +$(OBJS)\monodll_statbmpg.obj: ..\..\src\generic\statbmpg.cpp + $(CXX) /c /nologo /TP /Fo$@ $(MONODLL_CXXFLAGS) ..\..\src\generic\statbmpg.cpp +!endif + !if "$(USE_GUI)" == "1" $(OBJS)\monodll_textdlgg.obj: ..\..\src\generic\textdlgg.cpp $(CXX) /c /nologo /TP /Fo$@ $(MONODLL_CXXFLAGS) ..\..\src\generic\textdlgg.cpp @@ -9639,6 +9652,11 @@ $(OBJS)\monolib_srchctlg.obj: ..\..\src\generic\srchctlg.cpp $(CXX) /c /nologo /TP /Fo$@ $(MONOLIB_CXXFLAGS) ..\..\src\generic\srchctlg.cpp !endif +!if "$(USE_GUI)" == "1" +$(OBJS)\monolib_statbmpg.obj: ..\..\src\generic\statbmpg.cpp + $(CXX) /c /nologo /TP /Fo$@ $(MONOLIB_CXXFLAGS) ..\..\src\generic\statbmpg.cpp +!endif + !if "$(USE_GUI)" == "1" $(OBJS)\monolib_textdlgg.obj: ..\..\src\generic\textdlgg.cpp $(CXX) /c /nologo /TP /Fo$@ $(MONOLIB_CXXFLAGS) ..\..\src\generic\textdlgg.cpp @@ -11835,6 +11853,11 @@ $(OBJS)\coredll_srchctlg.obj: ..\..\src\generic\srchctlg.cpp $(CXX) /c /nologo /TP /Fo$@ $(COREDLL_CXXFLAGS) ..\..\src\generic\srchctlg.cpp !endif +!if "$(USE_GUI)" == "1" +$(OBJS)\coredll_statbmpg.obj: ..\..\src\generic\statbmpg.cpp + $(CXX) /c /nologo /TP /Fo$@ $(COREDLL_CXXFLAGS) ..\..\src\generic\statbmpg.cpp +!endif + !if "$(USE_GUI)" == "1" $(OBJS)\coredll_textdlgg.obj: ..\..\src\generic\textdlgg.cpp $(CXX) /c /nologo /TP /Fo$@ $(COREDLL_CXXFLAGS) ..\..\src\generic\textdlgg.cpp @@ -13166,6 +13189,11 @@ $(OBJS)\corelib_srchctlg.obj: ..\..\src\generic\srchctlg.cpp $(CXX) /c /nologo /TP /Fo$@ $(CORELIB_CXXFLAGS) ..\..\src\generic\srchctlg.cpp !endif +!if "$(USE_GUI)" == "1" +$(OBJS)\corelib_statbmpg.obj: ..\..\src\generic\statbmpg.cpp + $(CXX) /c /nologo /TP /Fo$@ $(CORELIB_CXXFLAGS) ..\..\src\generic\statbmpg.cpp +!endif + !if "$(USE_GUI)" == "1" $(OBJS)\corelib_textdlgg.obj: ..\..\src\generic\textdlgg.cpp $(CXX) /c /nologo /TP /Fo$@ $(CORELIB_CXXFLAGS) ..\..\src\generic\textdlgg.cpp diff --git a/build/msw/makefile.wat b/build/msw/makefile.wat index 612a93b732..5e37525304 100644 --- a/build/msw/makefile.wat +++ b/build/msw/makefile.wat @@ -431,6 +431,7 @@ ____CORE_SRC_FILENAMES_OBJECTS = & $(OBJS)\monodll_spinctlg.obj & $(OBJS)\monodll_splitter.obj & $(OBJS)\monodll_srchctlg.obj & + $(OBJS)\monodll_statbmpg.obj & $(OBJS)\monodll_textdlgg.obj & $(OBJS)\monodll_tipwin.obj & $(OBJS)\monodll_toolbkg.obj & @@ -665,6 +666,7 @@ ____CORE_SRC_FILENAMES_OBJECTS = & $(OBJS)\monodll_spinctlg.obj & $(OBJS)\monodll_splitter.obj & $(OBJS)\monodll_srchctlg.obj & + $(OBJS)\monodll_statbmpg.obj & $(OBJS)\monodll_textdlgg.obj & $(OBJS)\monodll_tipwin.obj & $(OBJS)\monodll_toolbkg.obj & @@ -1095,6 +1097,7 @@ ____CORE_SRC_FILENAMES_1_OBJECTS = & $(OBJS)\monolib_spinctlg.obj & $(OBJS)\monolib_splitter.obj & $(OBJS)\monolib_srchctlg.obj & + $(OBJS)\monolib_statbmpg.obj & $(OBJS)\monolib_textdlgg.obj & $(OBJS)\monolib_tipwin.obj & $(OBJS)\monolib_toolbkg.obj & @@ -1329,6 +1332,7 @@ ____CORE_SRC_FILENAMES_1_OBJECTS = & $(OBJS)\monolib_spinctlg.obj & $(OBJS)\monolib_splitter.obj & $(OBJS)\monolib_srchctlg.obj & + $(OBJS)\monolib_statbmpg.obj & $(OBJS)\monolib_textdlgg.obj & $(OBJS)\monolib_tipwin.obj & $(OBJS)\monolib_toolbkg.obj & @@ -1690,6 +1694,7 @@ ____CORE_SRC_FILENAMES_2_OBJECTS = & $(OBJS)\coredll_spinctlg.obj & $(OBJS)\coredll_splitter.obj & $(OBJS)\coredll_srchctlg.obj & + $(OBJS)\coredll_statbmpg.obj & $(OBJS)\coredll_textdlgg.obj & $(OBJS)\coredll_tipwin.obj & $(OBJS)\coredll_toolbkg.obj & @@ -1924,6 +1929,7 @@ ____CORE_SRC_FILENAMES_2_OBJECTS = & $(OBJS)\coredll_spinctlg.obj & $(OBJS)\coredll_splitter.obj & $(OBJS)\coredll_srchctlg.obj & + $(OBJS)\coredll_statbmpg.obj & $(OBJS)\coredll_textdlgg.obj & $(OBJS)\coredll_tipwin.obj & $(OBJS)\coredll_toolbkg.obj & @@ -2167,6 +2173,7 @@ ____CORE_SRC_FILENAMES_3_OBJECTS = & $(OBJS)\corelib_spinctlg.obj & $(OBJS)\corelib_splitter.obj & $(OBJS)\corelib_srchctlg.obj & + $(OBJS)\corelib_statbmpg.obj & $(OBJS)\corelib_textdlgg.obj & $(OBJS)\corelib_tipwin.obj & $(OBJS)\corelib_toolbkg.obj & @@ -2401,6 +2408,7 @@ ____CORE_SRC_FILENAMES_3_OBJECTS = & $(OBJS)\corelib_spinctlg.obj & $(OBJS)\corelib_splitter.obj & $(OBJS)\corelib_srchctlg.obj & + $(OBJS)\corelib_statbmpg.obj & $(OBJS)\corelib_textdlgg.obj & $(OBJS)\corelib_tipwin.obj & $(OBJS)\corelib_toolbkg.obj & @@ -7648,6 +7656,11 @@ $(OBJS)\monodll_srchctlg.obj : .AUTODEPEND ..\..\src\generic\srchctlg.cpp $(CXX) -bt=nt -zq -fo=$^@ $(MONODLL_CXXFLAGS) $< !endif +!ifeq USE_GUI 1 +$(OBJS)\monodll_statbmpg.obj : .AUTODEPEND ..\..\src\generic\statbmpg.cpp + $(CXX) -bt=nt -zq -fo=$^@ $(MONODLL_CXXFLAGS) $< +!endif + !ifeq USE_GUI 1 $(OBJS)\monodll_textdlgg.obj : .AUTODEPEND ..\..\src\generic\textdlgg.cpp $(CXX) -bt=nt -zq -fo=$^@ $(MONODLL_CXXFLAGS) $< @@ -9907,6 +9920,11 @@ $(OBJS)\monolib_srchctlg.obj : .AUTODEPEND ..\..\src\generic\srchctlg.cpp $(CXX) -bt=nt -zq -fo=$^@ $(MONOLIB_CXXFLAGS) $< !endif +!ifeq USE_GUI 1 +$(OBJS)\monolib_statbmpg.obj : .AUTODEPEND ..\..\src\generic\statbmpg.cpp + $(CXX) -bt=nt -zq -fo=$^@ $(MONOLIB_CXXFLAGS) $< +!endif + !ifeq USE_GUI 1 $(OBJS)\monolib_textdlgg.obj : .AUTODEPEND ..\..\src\generic\textdlgg.cpp $(CXX) -bt=nt -zq -fo=$^@ $(MONOLIB_CXXFLAGS) $< @@ -12217,6 +12235,11 @@ $(OBJS)\coredll_srchctlg.obj : .AUTODEPEND ..\..\src\generic\srchctlg.cpp $(CXX) -bt=nt -zq -fo=$^@ $(COREDLL_CXXFLAGS) $< !endif +!ifeq USE_GUI 1 +$(OBJS)\coredll_statbmpg.obj : .AUTODEPEND ..\..\src\generic\statbmpg.cpp + $(CXX) -bt=nt -zq -fo=$^@ $(COREDLL_CXXFLAGS) $< +!endif + !ifeq USE_GUI 1 $(OBJS)\coredll_textdlgg.obj : .AUTODEPEND ..\..\src\generic\textdlgg.cpp $(CXX) -bt=nt -zq -fo=$^@ $(COREDLL_CXXFLAGS) $< @@ -13660,6 +13683,11 @@ $(OBJS)\corelib_srchctlg.obj : .AUTODEPEND ..\..\src\generic\srchctlg.cpp $(CXX) -bt=nt -zq -fo=$^@ $(CORELIB_CXXFLAGS) $< !endif +!ifeq USE_GUI 1 +$(OBJS)\corelib_statbmpg.obj : .AUTODEPEND ..\..\src\generic\statbmpg.cpp + $(CXX) -bt=nt -zq -fo=$^@ $(CORELIB_CXXFLAGS) $< +!endif + !ifeq USE_GUI 1 $(OBJS)\corelib_textdlgg.obj : .AUTODEPEND ..\..\src\generic\textdlgg.cpp $(CXX) -bt=nt -zq -fo=$^@ $(CORELIB_CXXFLAGS) $< diff --git a/build/msw/wx_core.dsp b/build/msw/wx_core.dsp index d3d96d7148..d12c85c174 100644 --- a/build/msw/wx_core.dsp +++ b/build/msw/wx_core.dsp @@ -3008,6 +3008,10 @@ SOURCE=..\..\src\generic\srchctlg.cpp # End Source File # Begin Source File +SOURCE=..\..\src\generic\statbmpg.cpp +# End Source File +# Begin Source File + SOURCE=..\..\src\generic\statusbr.cpp !IF "$(CFG)" == "core - Win32 DLL Universal Release" @@ -5359,6 +5363,10 @@ SOURCE=..\..\include\wx\generic\srchctlg.h # End Source File # Begin Source File +SOURCE=..\..\include\wx\generic\statbmpg.h +# End Source File +# Begin Source File + SOURCE=..\..\include\wx\generic\statusbr.h # End Source File # Begin Source File diff --git a/build/msw/wx_vc7_core.vcproj b/build/msw/wx_vc7_core.vcproj index ab86868fa0..9a5f5676ce 100644 --- a/build/msw/wx_vc7_core.vcproj +++ b/build/msw/wx_vc7_core.vcproj @@ -1873,6 +1873,8 @@ RelativePath="..\..\src\generic\splitter.cpp"/> + + + @@ -4049,6 +4052,9 @@ + diff --git a/docs/changes.txt b/docs/changes.txt index 1552ec8731..c376363159 100644 --- a/docs/changes.txt +++ b/docs/changes.txt @@ -366,6 +366,7 @@ All (GUI): - Don't blit area larger than necessary in wxBufferedDC::UnMask (Liang Jian) - Fixed wxPixelData compilation (Leonardo Fernandes). - Added wxImage::GetType() (troelsk). +- Added wxGenericStaticBitmap suitable for display of large bitmaps. wxGTK: diff --git a/include/wx/generic/statbmpg.h b/include/wx/generic/statbmpg.h new file mode 100644 index 0000000000..010ec66012 --- /dev/null +++ b/include/wx/generic/statbmpg.h @@ -0,0 +1,76 @@ +/////////////////////////////////////////////////////////////////////////////// +// Name: wx/generic/statbmpg.h +// Purpose: wxGenericStaticBitmap header +// Author: Marcin Wojdyr, Stefan Csomor +// Created: 2008-06-16 +// RCS-ID: $Id$ +// Copyright: wxWidgets developers +// Licence: wxWindows licence +/////////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_GENERIC_STATBMP_H_ +#define _WX_GENERIC_STATBMP_H_ + +#include "wx/statbmp.h" + +class WXDLLIMPEXP_CORE wxGenericStaticBitmap : public wxStaticBitmapBase +{ +public: + wxGenericStaticBitmap() {} + wxGenericStaticBitmap(wxWindow *parent, + wxWindowID id, + const wxBitmap& bitmap, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + long style = 0, + const wxString& name = wxStaticBitmapNameStr) + { + Create(parent, id, bitmap, pos, size, style, name); + } + + bool Create(wxWindow *parent, + wxWindowID id, + const wxBitmap& bitmap, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + long style = 0, + const wxString& name = wxStaticBitmapNameStr); + + virtual void SetBitmap(const wxBitmap& bitmap) + { + m_bitmap = bitmap; + SetInitialSize(GetBitmapSize()); + Refresh(); + } + + virtual wxBitmap GetBitmap() const { return m_bitmap; } + + virtual void SetIcon(const wxIcon& icon) + { + m_bitmap.CopyFromIcon(icon); + SetInitialSize(GetBitmapSize()); + Refresh(); + } + +#if defined(__WXGTK20__) || defined(__WXMAC__) + // icons and bitmaps are really the same thing in wxGTK and wxMac + wxIcon GetIcon() const { return (const wxIcon &)m_bitmap; } +#endif + + +private: + wxSize GetBitmapSize() + { + return m_bitmap.Ok() ? wxSize(m_bitmap.GetWidth(), m_bitmap.GetHeight()) + : wxSize(16, 16); // this is completely arbitrary + } + + void OnPaint(wxPaintEvent& event); + + wxBitmap m_bitmap; + + DECLARE_DYNAMIC_CLASS(wxGenericStaticBitmap) +}; + + +#endif //_WX_GENERIC_STATBMP_H_ diff --git a/interface/statbmp.h b/interface/statbmp.h index dde4136950..d18ff1fe39 100644 --- a/interface/statbmp.h +++ b/interface/statbmp.h @@ -10,11 +10,12 @@ @class wxStaticBitmap @wxheader{statbmp.h} - A static bitmap control displays a bitmap. It is meant for display of the - small icons in the dialog boxes and is not meant to be a general purpose image - display control. In particular, under Windows 9x the size of bitmap is limited - to 64*64 pixels and thus you should use your own control if you want to - display larger images portably. + A static bitmap control displays a bitmap. Native implementations on some + platforms are only meant for display of the small icons in the dialog + boxes. In particular, under Windows 9x the size of bitmap is limited + to 64*64 pixels. + If you want to display larger images portably, you may use generic + implementation wxGenericStaticBitmap declared in . @library{wxcore} @category{ctrl} diff --git a/samples/widgets/Makefile.in b/samples/widgets/Makefile.in index 13f0369b76..3a2cc6c4bf 100644 --- a/samples/widgets/Makefile.in +++ b/samples/widgets/Makefile.in @@ -76,6 +76,7 @@ WIDGETS_OBJECTS = \ widgets_slider.o \ widgets_spinbtn.o \ widgets_static.o \ + widgets_statbmp.o \ widgets_textctrl.o \ widgets_toggle.o \ widgets_widgets.o \ @@ -291,6 +292,9 @@ widgets_spinbtn.o: $(srcdir)/spinbtn.cpp widgets_static.o: $(srcdir)/static.cpp $(CXXC) -c -o $@ $(WIDGETS_CXXFLAGS) $(srcdir)/static.cpp +widgets_statbmp.o: $(srcdir)/statbmp.cpp + $(CXXC) -c -o $@ $(WIDGETS_CXXFLAGS) $(srcdir)/statbmp.cpp + widgets_textctrl.o: $(srcdir)/textctrl.cpp $(CXXC) -c -o $@ $(WIDGETS_CXXFLAGS) $(srcdir)/textctrl.cpp @@ -304,6 +308,15 @@ widgets_sample_rc.o: $(srcdir)/../sample.rc $(WINDRES) -i$< -o$@ --define __WX$(TOOLKIT)__ $(__WXUNIV_DEFINE_p_2) $(__EXCEPTIONS_DEFINE_p_2) $(__RTTI_DEFINE_p_2) $(__THREAD_DEFINE_p_2) --include-dir $(srcdir) $(__DLLFLAG_p_2) --include-dir $(srcdir)/../../samples $(__RCDEFDIR_p_1) --include-dir $(top_srcdir)/include +$(srcdir)/include/wx/stc/stc.h: \ +$(srcdir)/src/stc/scintilla/include/Scintilla.iface \ +$(srcdir)/src/stc/stc.cpp.in \ +$(srcdir)/src/stc/stc.h.in \ +$(srcdir)/src/stc/gen_iface.py + cd $(srcdir)/src/stc && ./gen_iface.py +monolib_stc.o monodll_stc.o stcdll_stc.o stclib_stc.o: \ +$(srcdir)/include/wx/stc/stc.h + # Include dependency info, if present: @IF_GNU_MAKE@-include .deps/*.d diff --git a/samples/widgets/icons/statbmp.xpm b/samples/widgets/icons/statbmp.xpm new file mode 100644 index 0000000000..1129815eaf --- /dev/null +++ b/samples/widgets/icons/statbmp.xpm @@ -0,0 +1,40 @@ +/* XPM */ +static const char *statbmp_xpm[] = { +/* columns rows colors chars-per-pixel */ +"32 32 2 1", +" c Gray0", +"# c none", +/* pixels */ +"################################", +"################################", +"################################", +"################################", +"################################", +"################################", +"## ##", +"## ########################## ##", +"## ########################## ##", +"## ######### ########### ##", +"## ######## ###### ########## ##", +"## ####### ######## ######### ##", +"## ######## ######## ######## ##", +"## ######### ######## ####### ##", +"## ########## ###### ######## ##", +"## ########### #### ######### ##", +"## ############ ########## ##", +"## ########################## ##", +"## ### ########### ##", +"## ### ########## ########### ##", +"## ### ########## ########### ##", +"## ### ########## ########### ##", +"## ### ########## ########### ##", +"## ### ########## ########### ##", +"## ### ########### ##", +"## ########################## ##", +"## ########################## ##", +"## ########################## ##", +"## ##", +"################################", +"################################", +"################################" +}; diff --git a/samples/widgets/makefile.bcc b/samples/widgets/makefile.bcc index df99fc7769..f3aedf1ac1 100644 --- a/samples/widgets/makefile.bcc +++ b/samples/widgets/makefile.bcc @@ -58,6 +58,7 @@ WIDGETS_OBJECTS = \ $(OBJS)\widgets_slider.obj \ $(OBJS)\widgets_spinbtn.obj \ $(OBJS)\widgets_static.obj \ + $(OBJS)\widgets_statbmp.obj \ $(OBJS)\widgets_textctrl.obj \ $(OBJS)\widgets_toggle.obj \ $(OBJS)\widgets_widgets.obj @@ -339,6 +340,9 @@ $(OBJS)\widgets_spinbtn.obj: .\spinbtn.cpp $(OBJS)\widgets_static.obj: .\static.cpp $(CXX) -q -c -P -o$@ $(WIDGETS_CXXFLAGS) .\static.cpp +$(OBJS)\widgets_statbmp.obj: .\statbmp.cpp + $(CXX) -q -c -P -o$@ $(WIDGETS_CXXFLAGS) .\statbmp.cpp + $(OBJS)\widgets_textctrl.obj: .\textctrl.cpp $(CXX) -q -c -P -o$@ $(WIDGETS_CXXFLAGS) .\textctrl.cpp diff --git a/samples/widgets/makefile.gcc b/samples/widgets/makefile.gcc index df362fb5bc..d2fc5dabef 100644 --- a/samples/widgets/makefile.gcc +++ b/samples/widgets/makefile.gcc @@ -51,6 +51,7 @@ WIDGETS_OBJECTS = \ $(OBJS)\widgets_slider.o \ $(OBJS)\widgets_spinbtn.o \ $(OBJS)\widgets_static.o \ + $(OBJS)\widgets_statbmp.o \ $(OBJS)\widgets_textctrl.o \ $(OBJS)\widgets_toggle.o \ $(OBJS)\widgets_widgets.o \ @@ -332,6 +333,9 @@ $(OBJS)\widgets_spinbtn.o: ./spinbtn.cpp $(OBJS)\widgets_static.o: ./static.cpp $(CXX) -c -o $@ $(WIDGETS_CXXFLAGS) $(CPPDEPS) $< +$(OBJS)\widgets_statbmp.o: ./statbmp.cpp + $(CXX) -c -o $@ $(WIDGETS_CXXFLAGS) $(CPPDEPS) $< + $(OBJS)\widgets_textctrl.o: ./textctrl.cpp $(CXX) -c -o $@ $(WIDGETS_CXXFLAGS) $(CPPDEPS) $< diff --git a/samples/widgets/makefile.unx b/samples/widgets/makefile.unx index dadfd89c39..6d2dfc8723 100644 --- a/samples/widgets/makefile.unx +++ b/samples/widgets/makefile.unx @@ -80,6 +80,7 @@ WIDGETS_OBJECTS = \ widgets_slider.o \ widgets_spinbtn.o \ widgets_static.o \ + widgets_statbmp.o \ widgets_textctrl.o \ widgets_toggle.o \ widgets_widgets.o @@ -194,6 +195,9 @@ widgets_spinbtn.o: ./spinbtn.cpp widgets_static.o: ./static.cpp $(CXX) -c -o $@ $(WIDGETS_CXXFLAGS) $(CPPDEPS) $< +widgets_statbmp.o: ./statbmp.cpp + $(CXX) -c -o $@ $(WIDGETS_CXXFLAGS) $(CPPDEPS) $< + widgets_textctrl.o: ./textctrl.cpp $(CXX) -c -o $@ $(WIDGETS_CXXFLAGS) $(CPPDEPS) $< diff --git a/samples/widgets/makefile.vc b/samples/widgets/makefile.vc index 9ed8e41432..143aa2f14b 100644 --- a/samples/widgets/makefile.vc +++ b/samples/widgets/makefile.vc @@ -52,6 +52,7 @@ WIDGETS_OBJECTS = \ $(OBJS)\widgets_slider.obj \ $(OBJS)\widgets_spinbtn.obj \ $(OBJS)\widgets_static.obj \ + $(OBJS)\widgets_statbmp.obj \ $(OBJS)\widgets_textctrl.obj \ $(OBJS)\widgets_toggle.obj \ $(OBJS)\widgets_widgets.obj \ @@ -415,6 +416,9 @@ $(OBJS)\widgets_spinbtn.obj: .\spinbtn.cpp $(OBJS)\widgets_static.obj: .\static.cpp $(CXX) /c /nologo /TP /Fo$@ $(WIDGETS_CXXFLAGS) .\static.cpp +$(OBJS)\widgets_statbmp.obj: .\statbmp.cpp + $(CXX) /c /nologo /TP /Fo$@ $(WIDGETS_CXXFLAGS) .\statbmp.cpp + $(OBJS)\widgets_textctrl.obj: .\textctrl.cpp $(CXX) /c /nologo /TP /Fo$@ $(WIDGETS_CXXFLAGS) .\textctrl.cpp diff --git a/samples/widgets/makefile.wat b/samples/widgets/makefile.wat index d455d317ae..d6464e8000 100644 --- a/samples/widgets/makefile.wat +++ b/samples/widgets/makefile.wat @@ -265,6 +265,7 @@ WIDGETS_OBJECTS = & $(OBJS)\widgets_slider.obj & $(OBJS)\widgets_spinbtn.obj & $(OBJS)\widgets_static.obj & + $(OBJS)\widgets_statbmp.obj & $(OBJS)\widgets_textctrl.obj & $(OBJS)\widgets_toggle.obj & $(OBJS)\widgets_widgets.obj @@ -367,6 +368,9 @@ $(OBJS)\widgets_spinbtn.obj : .AUTODEPEND .\spinbtn.cpp $(OBJS)\widgets_static.obj : .AUTODEPEND .\static.cpp $(CXX) -bt=nt -zq -fo=$^@ $(WIDGETS_CXXFLAGS) $< +$(OBJS)\widgets_statbmp.obj : .AUTODEPEND .\statbmp.cpp + $(CXX) -bt=nt -zq -fo=$^@ $(WIDGETS_CXXFLAGS) $< + $(OBJS)\widgets_textctrl.obj : .AUTODEPEND .\textctrl.cpp $(CXX) -bt=nt -zq -fo=$^@ $(WIDGETS_CXXFLAGS) $< diff --git a/samples/widgets/statbmp.cpp b/samples/widgets/statbmp.cpp new file mode 100644 index 0000000000..b1e04d6615 --- /dev/null +++ b/samples/widgets/statbmp.cpp @@ -0,0 +1,131 @@ +///////////////////////////////////////////////////////////////////////////// +// Program: wxWidgets Widgets Sample +// Name: statbmp.cpp +// Purpose: Part of the widgets sample showing wxStaticBitmap +// Author: Marcin Wojdyr +// Created: 2008-06-19 +// Id: $Id$ +// Copyright: (c) 2008 Marcin Wojdyr +// License: wxWindows license +///////////////////////////////////////////////////////////////////////////// + +// ============================================================================ +// declarations +// ============================================================================ + +// ---------------------------------------------------------------------------- +// headers +// ---------------------------------------------------------------------------- + +// for compilers that support precompilation, includes "wx/wx.h". +#include "wx/wxprec.h" + +#ifdef __BORLANDC__ + #pragma hdrstop +#endif + +// for all others, include the necessary headers +#ifndef WX_PRECOMP + #include "wx/log.h" + + #include "wx/button.h" + #include "wx/radiobox.h" + #include "wx/statbmp.h" + #include "wx/statbox.h" + #include "wx/textctrl.h" +#endif + +#include "wx/generic/statbmpg.h" +#include "wx/sizer.h" +#include "wx/filepicker.h" + +#include "widgets.h" +#include "icons/statbmp.xpm" + + +class StatBmpWidgetsPage : public WidgetsPage +{ +public: + StatBmpWidgetsPage(WidgetsBookCtrl *book, wxImageList *imaglist) + : WidgetsPage(book, imaglist, statbmp_xpm) {} + + virtual void CreateContent(); + virtual wxControl *GetWidget() const { return m_statbmp; } + virtual void RecreateWidget(); + +private: + void OnFileChange(wxFileDirPickerEvent &WXUNUSED(ev)) { RecreateWidget(); } + void OnRadioChange(wxCommandEvent &WXUNUSED(ev)) { RecreateWidget(); } + + void OnMouseEvent(wxMouseEvent& WXUNUSED(event)) + { + wxLogMessage(wxT("wxStaticBitmap clicked.")); + } + + wxStaticBitmapBase *m_statbmp; + wxFilePickerCtrl *m_filepicker; + wxRadioBox *m_radio; + wxStaticBoxSizer *m_sbsizer; + + DECLARE_WIDGETS_PAGE(StatBmpWidgetsPage) +}; + +IMPLEMENT_WIDGETS_PAGE(StatBmpWidgetsPage, wxT("StaticBitmap"), + ALL_CTRLS); + +void StatBmpWidgetsPage::CreateContent() +{ + + static const wxString choices[] = { "native", "generic" }; + m_radio = new wxRadioBox(this, wxID_ANY, "implementation", + wxDefaultPosition, wxDefaultSize, + WXSIZEOF(choices), choices); + + m_filepicker = new wxFilePickerCtrl(this, wxID_ANY, "../image/toucan.png"); + + m_sbsizer = new wxStaticBoxSizer(wxVERTICAL, this, "wxStaticBitmap inside"); + + wxSizer *leftsizer = new wxBoxSizer(wxVERTICAL); + leftsizer->Add(m_radio, wxSizerFlags().Expand().Border()); + leftsizer->Add(m_filepicker, wxSizerFlags().Expand().Border()); + wxSizer *sizer = new wxBoxSizer(wxHORIZONTAL); + sizer->Add(leftsizer, wxSizerFlags().Border()); + sizer->Add(m_sbsizer, wxSizerFlags().Center()); + SetSizer(sizer); + + wxInitAllImageHandlers(); + + Connect(wxEVT_COMMAND_FILEPICKER_CHANGED, + wxFileDirPickerEventHandler(StatBmpWidgetsPage::OnFileChange)); + Connect(wxEVT_COMMAND_RADIOBOX_SELECTED, + wxCommandEventHandler(StatBmpWidgetsPage::OnRadioChange)); + + m_statbmp = NULL; + RecreateWidget(); +} + +void StatBmpWidgetsPage::RecreateWidget() +{ + delete m_statbmp; + wxString filepath = m_filepicker->GetPath(); + wxImage image(filepath); + if (! image.Ok() ) + { + wxLogMessage("Reading image from file '%s' failed.", filepath.c_str()); + m_statbmp = NULL; + return; + } + if (m_radio->GetSelection() == 0) + m_statbmp = new wxStaticBitmap(this, wxID_ANY, wxBitmap(image)); + else + m_statbmp = new wxGenericStaticBitmap(this, wxID_ANY, wxBitmap(image)); + m_sbsizer->Add(m_statbmp, wxSizerFlags(1).Expand()); + GetSizer()->Layout(); + m_statbmp->Connect(wxEVT_LEFT_DOWN, + wxMouseEventHandler(StatBmpWidgetsPage::OnMouseEvent), + NULL, this); + // When switching from generic to native control on wxMSW under Wine, + // the explicit Refresh() is necessary + m_statbmp->Refresh(); +} + diff --git a/samples/widgets/widgets.bkl b/samples/widgets/widgets.bkl index 6f4b4607ba..6654b80741 100644 --- a/samples/widgets/widgets.bkl +++ b/samples/widgets/widgets.bkl @@ -29,6 +29,7 @@ slider.cpp spinbtn.cpp static.cpp + statbmp.cpp textctrl.cpp toggle.cpp widgets.cpp diff --git a/samples/widgets/widgets.dsp b/samples/widgets/widgets.dsp index 4ddb7beca7..014777ad0a 100644 --- a/samples/widgets/widgets.dsp +++ b/samples/widgets/widgets.dsp @@ -344,6 +344,10 @@ SOURCE=.\spinbtn.cpp # End Source File # Begin Source File +SOURCE=.\statbmp.cpp +# End Source File +# Begin Source File + SOURCE=.\static.cpp # End Source File # Begin Source File diff --git a/samples/widgets/widgets_vc7.vcproj b/samples/widgets/widgets_vc7.vcproj index 5073ebc0db..907ade3c2d 100644 --- a/samples/widgets/widgets_vc7.vcproj +++ b/samples/widgets/widgets_vc7.vcproj @@ -669,6 +669,8 @@ RelativePath=".\slider.cpp"/> + + diff --git a/src/generic/statbmpg.cpp b/src/generic/statbmpg.cpp new file mode 100644 index 0000000000..2a094d91ea --- /dev/null +++ b/src/generic/statbmpg.cpp @@ -0,0 +1,42 @@ +/////////////////////////////////////////////////////////////////////////////// +// Name: src/generic/statbmp.cpp +// Purpose: wxGenericStaticBitmap +// Author: Marcin Wojdyr, Stefan Csomor +// Created: 2008-06-16 +// RCS-ID: $Id$ +// Copyright: wxWidgets developers +// Licence: wxWindows licence +/////////////////////////////////////////////////////////////////////////////// + +#include "wx/wxprec.h" + +#if wxUSE_STATBMP + +#include "wx/generic/statbmpg.h" + + +IMPLEMENT_DYNAMIC_CLASS(wxGenericStaticBitmap, wxStaticBitmapBase) + +bool wxGenericStaticBitmap::Create(wxWindow *parent, wxWindowID id, + const wxBitmap& bitmap, + const wxPoint& pos, const wxSize& size, + long style, const wxString& name) +{ + if (! wxControl::Create(parent, id, pos, size, style, + wxDefaultValidator, name)) + return false; + SetBitmap(bitmap); + Connect(wxEVT_PAINT, wxPaintEventHandler(wxGenericStaticBitmap::OnPaint)); + return true; +} + +void wxGenericStaticBitmap::OnPaint(wxPaintEvent& WXUNUSED(event)) +{ + wxPaintDC dc(this); + PrepareDC(dc); + if (m_bitmap.Ok()) + dc.DrawBitmap(m_bitmap, 0, 0, true); +} + +#endif // wxUSE_STATBMP + -- 2.45.2