From bbcf2821a15b8dd75fcd4daa2ac91d600b23b2d1 Mon Sep 17 00:00:00 2001 From: Vadim Zeitlin Date: Tue, 11 Oct 2011 17:07:43 +0000 Subject: [PATCH] Move SetBackgroundBitmap() from wxPanel to new wxCustomBackgroundWindow. wxCustomBackgroundWindow is a new class allowing to set a custom bitmap for the background of any window. The relevant code was mostly moved from wxPanel to which it was added only recently (before 2.9.2) making it unnecessary to preserve compatibility. git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@69378 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- Makefile.in | 25 ++------ build/bakefiles/files.bkl | 5 +- 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 | 20 ++++-- build/msw/wx_vc7_core.vcproj | 15 ++++- build/msw/wx_vc8_core.vcproj | 20 ++++-- build/msw/wx_vc9_core.vcproj | 20 ++++-- docs/changes.txt | 5 ++ docs/doxygen/mainpages/cat_classes.h | 2 +- include/wx/custombgwin.h | 50 +++++++++++++++ include/wx/generic/custombgwin.h | 96 ++++++++++++++++++++++++++++ include/wx/generic/panelg.h | 11 ---- include/wx/msw/custombgwin.h | 58 +++++++++++++++++ include/wx/msw/panel.h | 17 +---- include/wx/panel.h | 15 ----- include/wx/univ/custombgwin.h | 37 +++++++++++ include/wx/univ/panel.h | 7 -- interface/wx/custombgwin.h | 67 +++++++++++++++++++ interface/wx/panel.h | 15 ----- samples/erase/erase.cpp | 6 +- src/generic/panelg.cpp | 69 -------------------- src/msw/panel.cpp | 25 -------- 25 files changed, 388 insertions(+), 309 deletions(-) create mode 100644 include/wx/custombgwin.h create mode 100644 include/wx/generic/custombgwin.h create mode 100644 include/wx/msw/custombgwin.h create mode 100644 include/wx/univ/custombgwin.h create mode 100644 interface/wx/custombgwin.h delete mode 100644 src/generic/panelg.cpp diff --git a/Makefile.in b/Makefile.in index 624cbb8ef6..6c5ce7a403 100644 --- a/Makefile.in +++ b/Makefile.in @@ -2990,6 +2990,7 @@ COND_TOOLKIT_MSW_GUI_HDR = \ wx/msw/control.h \ wx/msw/ctrlsub.h \ wx/msw/cursor.h \ + wx/msw/custombgwin.h \ wx/msw/dc.h \ wx/msw/dcclient.h \ wx/msw/dcmemory.h \ @@ -3519,6 +3520,7 @@ COND_TOOLKIT_WINCE_GUI_HDR = \ wx/msw/control.h \ wx/msw/ctrlsub.h \ wx/msw/cursor.h \ + wx/msw/custombgwin.h \ wx/msw/dc.h \ wx/msw/dcclient.h \ wx/msw/dcmemory.h \ @@ -3855,6 +3857,7 @@ COND_USE_GUI_1_WXUNIV_1_GUI_CORE_HEADERS = \ wx/univ/colschem.h \ wx/univ/combobox.h \ wx/univ/control.h \ + wx/univ/custombgwin.h \ wx/univ/dialog.h \ wx/univ/frame.h \ wx/univ/gauge.h \ @@ -3907,6 +3910,7 @@ COND_USE_GUI_1_ALL_GUI_HEADERS = \ wx/control.h \ wx/ctrlsub.h \ wx/cursor.h \ + wx/custombgwin.h \ wx/dc.h \ wx/dcclient.h \ wx/dcgraph.h \ @@ -3928,6 +3932,7 @@ COND_USE_GUI_1_ALL_GUI_HEADERS = \ wx/generic/choicdgg.h \ wx/generic/colrdlgg.h \ wx/generic/combo.h \ + wx/generic/custombgwin.h \ wx/generic/dcpsg.h \ wx/generic/dirctrlg.h \ wx/generic/dragimgg.h \ @@ -4700,7 +4705,6 @@ COND_USE_GUI_1_WXUNIV_0___CORE_SRC_OBJECTS = \ monodll_markuptext.o \ monodll_msgdlgg.o \ monodll_numdlgg.o \ - monodll_panelg.o \ monodll_progdlgg.o \ monodll_printps.o \ monodll_renderg.o \ @@ -4917,7 +4921,6 @@ COND_USE_GUI_1_WXUNIV_1___CORE_SRC_OBJECTS = \ monodll_markuptext.o \ monodll_msgdlgg.o \ monodll_numdlgg.o \ - monodll_panelg.o \ monodll_progdlgg.o \ monodll_printps.o \ monodll_renderg.o \ @@ -6654,7 +6657,6 @@ COND_USE_GUI_1_WXUNIV_0___CORE_SRC_OBJECTS_1 = \ monolib_markuptext.o \ monolib_msgdlgg.o \ monolib_numdlgg.o \ - monolib_panelg.o \ monolib_progdlgg.o \ monolib_printps.o \ monolib_renderg.o \ @@ -6871,7 +6873,6 @@ COND_USE_GUI_1_WXUNIV_1___CORE_SRC_OBJECTS_1 = \ monolib_markuptext.o \ monolib_msgdlgg.o \ monolib_numdlgg.o \ - monolib_panelg.o \ monolib_progdlgg.o \ monolib_printps.o \ monolib_renderg.o \ @@ -8787,7 +8788,6 @@ COND_USE_GUI_1_WXUNIV_0___CORE_SRC_OBJECTS_2 = \ coredll_markuptext.o \ coredll_msgdlgg.o \ coredll_numdlgg.o \ - coredll_panelg.o \ coredll_progdlgg.o \ coredll_printps.o \ coredll_renderg.o \ @@ -9004,7 +9004,6 @@ COND_USE_GUI_1_WXUNIV_1___CORE_SRC_OBJECTS_2 = \ coredll_markuptext.o \ coredll_msgdlgg.o \ coredll_numdlgg.o \ - coredll_panelg.o \ coredll_progdlgg.o \ coredll_printps.o \ coredll_renderg.o \ @@ -10381,7 +10380,6 @@ COND_USE_GUI_1_WXUNIV_0___CORE_SRC_OBJECTS_3 = \ corelib_markuptext.o \ corelib_msgdlgg.o \ corelib_numdlgg.o \ - corelib_panelg.o \ corelib_progdlgg.o \ corelib_printps.o \ corelib_renderg.o \ @@ -10598,7 +10596,6 @@ COND_USE_GUI_1_WXUNIV_1___CORE_SRC_OBJECTS_3 = \ corelib_markuptext.o \ corelib_msgdlgg.o \ corelib_numdlgg.o \ - corelib_panelg.o \ corelib_progdlgg.o \ corelib_printps.o \ corelib_renderg.o \ @@ -20559,9 +20556,6 @@ monodll_sound_sdl.o: $(srcdir)/src/unix/sound_sdl.cpp $(MONODLL_ODEP) @COND_USE_GUI_1@monodll_numdlgg.o: $(srcdir)/src/generic/numdlgg.cpp $(MONODLL_ODEP) @COND_USE_GUI_1@ $(CXXC) -c -o $@ $(MONODLL_CXXFLAGS) $(srcdir)/src/generic/numdlgg.cpp -@COND_USE_GUI_1@monodll_panelg.o: $(srcdir)/src/generic/panelg.cpp $(MONODLL_ODEP) -@COND_USE_GUI_1@ $(CXXC) -c -o $@ $(MONODLL_CXXFLAGS) $(srcdir)/src/generic/panelg.cpp - @COND_USE_GUI_1@monodll_progdlgg.o: $(srcdir)/src/generic/progdlgg.cpp $(MONODLL_ODEP) @COND_USE_GUI_1@ $(CXXC) -c -o $@ $(MONODLL_CXXFLAGS) $(srcdir)/src/generic/progdlgg.cpp @@ -25932,9 +25926,6 @@ monolib_sound_sdl.o: $(srcdir)/src/unix/sound_sdl.cpp $(MONOLIB_ODEP) @COND_USE_GUI_1@monolib_numdlgg.o: $(srcdir)/src/generic/numdlgg.cpp $(MONOLIB_ODEP) @COND_USE_GUI_1@ $(CXXC) -c -o $@ $(MONOLIB_CXXFLAGS) $(srcdir)/src/generic/numdlgg.cpp -@COND_USE_GUI_1@monolib_panelg.o: $(srcdir)/src/generic/panelg.cpp $(MONOLIB_ODEP) -@COND_USE_GUI_1@ $(CXXC) -c -o $@ $(MONOLIB_CXXFLAGS) $(srcdir)/src/generic/panelg.cpp - @COND_USE_GUI_1@monolib_progdlgg.o: $(srcdir)/src/generic/progdlgg.cpp $(MONOLIB_ODEP) @COND_USE_GUI_1@ $(CXXC) -c -o $@ $(MONOLIB_CXXFLAGS) $(srcdir)/src/generic/progdlgg.cpp @@ -31464,9 +31455,6 @@ coredll_win32.o: $(srcdir)/src/univ/themes/win32.cpp $(COREDLL_ODEP) @COND_USE_GUI_1@coredll_numdlgg.o: $(srcdir)/src/generic/numdlgg.cpp $(COREDLL_ODEP) @COND_USE_GUI_1@ $(CXXC) -c -o $@ $(COREDLL_CXXFLAGS) $(srcdir)/src/generic/numdlgg.cpp -@COND_USE_GUI_1@coredll_panelg.o: $(srcdir)/src/generic/panelg.cpp $(COREDLL_ODEP) -@COND_USE_GUI_1@ $(CXXC) -c -o $@ $(COREDLL_CXXFLAGS) $(srcdir)/src/generic/panelg.cpp - @COND_USE_GUI_1@coredll_progdlgg.o: $(srcdir)/src/generic/progdlgg.cpp $(COREDLL_ODEP) @COND_USE_GUI_1@ $(CXXC) -c -o $@ $(COREDLL_CXXFLAGS) $(srcdir)/src/generic/progdlgg.cpp @@ -35478,9 +35466,6 @@ corelib_win32.o: $(srcdir)/src/univ/themes/win32.cpp $(CORELIB_ODEP) @COND_USE_GUI_1@corelib_numdlgg.o: $(srcdir)/src/generic/numdlgg.cpp $(CORELIB_ODEP) @COND_USE_GUI_1@ $(CXXC) -c -o $@ $(CORELIB_CXXFLAGS) $(srcdir)/src/generic/numdlgg.cpp -@COND_USE_GUI_1@corelib_panelg.o: $(srcdir)/src/generic/panelg.cpp $(CORELIB_ODEP) -@COND_USE_GUI_1@ $(CXXC) -c -o $@ $(CORELIB_CXXFLAGS) $(srcdir)/src/generic/panelg.cpp - @COND_USE_GUI_1@corelib_progdlgg.o: $(srcdir)/src/generic/progdlgg.cpp $(CORELIB_ODEP) @COND_USE_GUI_1@ $(CXXC) -c -o $@ $(CORELIB_CXXFLAGS) $(srcdir)/src/generic/progdlgg.cpp diff --git a/build/bakefiles/files.bkl b/build/bakefiles/files.bkl index 4069889063..96b214b1bb 100644 --- a/build/bakefiles/files.bkl +++ b/build/bakefiles/files.bkl @@ -789,7 +789,6 @@ IMPORTANT: please read docs/tech/tn0016.txt before modifying this file! src/generic/markuptext.cpp src/generic/msgdlgg.cpp src/generic/numdlgg.cpp - src/generic/panelg.cpp src/generic/progdlgg.cpp src/generic/printps.cpp src/generic/renderg.cpp @@ -829,6 +828,7 @@ IMPORTANT: please read docs/tech/tn0016.txt before modifying this file! wx/control.h wx/ctrlsub.h wx/cursor.h + wx/custombgwin.h wx/dc.h wx/dcclient.h wx/dcgraph.h @@ -850,6 +850,7 @@ IMPORTANT: please read docs/tech/tn0016.txt before modifying this file! wx/generic/choicdgg.h wx/generic/colrdlgg.h wx/generic/combo.h + wx/generic/custombgwin.h wx/generic/dcpsg.h wx/generic/dirctrlg.h wx/generic/dragimgg.h @@ -1808,6 +1809,7 @@ IMPORTANT: please read docs/tech/tn0016.txt before modifying this file! wx/msw/control.h wx/msw/ctrlsub.h wx/msw/cursor.h + wx/msw/custombgwin.h wx/msw/dc.h wx/msw/dcclient.h wx/msw/dcmemory.h @@ -2911,6 +2913,7 @@ IMPORTANT: please read docs/tech/tn0016.txt before modifying this file! wx/univ/colschem.h wx/univ/combobox.h wx/univ/control.h + wx/univ/custombgwin.h wx/univ/dialog.h wx/univ/frame.h wx/univ/gauge.h diff --git a/build/msw/makefile.bcc b/build/msw/makefile.bcc index 4e6047c9b4..d5711717d8 100644 --- a/build/msw/makefile.bcc +++ b/build/msw/makefile.bcc @@ -1969,7 +1969,6 @@ ____CORE_SRC_FILENAMES_OBJECTS = \ $(OBJS)\monodll_markuptext.obj \ $(OBJS)\monodll_msgdlgg.obj \ $(OBJS)\monodll_numdlgg.obj \ - $(OBJS)\monodll_panelg.obj \ $(OBJS)\monodll_progdlgg.obj \ $(OBJS)\monodll_printps.obj \ $(OBJS)\monodll_renderg.obj \ @@ -2236,7 +2235,6 @@ ____CORE_SRC_FILENAMES_OBJECTS = \ $(OBJS)\monodll_markuptext.obj \ $(OBJS)\monodll_msgdlgg.obj \ $(OBJS)\monodll_numdlgg.obj \ - $(OBJS)\monodll_panelg.obj \ $(OBJS)\monodll_progdlgg.obj \ $(OBJS)\monodll_printps.obj \ $(OBJS)\monodll_renderg.obj \ @@ -2748,7 +2746,6 @@ ____CORE_SRC_FILENAMES_1_OBJECTS = \ $(OBJS)\monolib_markuptext.obj \ $(OBJS)\monolib_msgdlgg.obj \ $(OBJS)\monolib_numdlgg.obj \ - $(OBJS)\monolib_panelg.obj \ $(OBJS)\monolib_progdlgg.obj \ $(OBJS)\monolib_printps.obj \ $(OBJS)\monolib_renderg.obj \ @@ -3015,7 +3012,6 @@ ____CORE_SRC_FILENAMES_1_OBJECTS = \ $(OBJS)\monolib_markuptext.obj \ $(OBJS)\monolib_msgdlgg.obj \ $(OBJS)\monolib_numdlgg.obj \ - $(OBJS)\monolib_panelg.obj \ $(OBJS)\monolib_progdlgg.obj \ $(OBJS)\monolib_printps.obj \ $(OBJS)\monolib_renderg.obj \ @@ -3410,7 +3406,6 @@ ____CORE_SRC_FILENAMES_2_OBJECTS = \ $(OBJS)\coredll_markuptext.obj \ $(OBJS)\coredll_msgdlgg.obj \ $(OBJS)\coredll_numdlgg.obj \ - $(OBJS)\coredll_panelg.obj \ $(OBJS)\coredll_progdlgg.obj \ $(OBJS)\coredll_printps.obj \ $(OBJS)\coredll_renderg.obj \ @@ -3677,7 +3672,6 @@ ____CORE_SRC_FILENAMES_2_OBJECTS = \ $(OBJS)\coredll_markuptext.obj \ $(OBJS)\coredll_msgdlgg.obj \ $(OBJS)\coredll_numdlgg.obj \ - $(OBJS)\coredll_panelg.obj \ $(OBJS)\coredll_progdlgg.obj \ $(OBJS)\coredll_printps.obj \ $(OBJS)\coredll_renderg.obj \ @@ -3954,7 +3948,6 @@ ____CORE_SRC_FILENAMES_3_OBJECTS = \ $(OBJS)\corelib_markuptext.obj \ $(OBJS)\corelib_msgdlgg.obj \ $(OBJS)\corelib_numdlgg.obj \ - $(OBJS)\corelib_panelg.obj \ $(OBJS)\corelib_progdlgg.obj \ $(OBJS)\corelib_printps.obj \ $(OBJS)\corelib_renderg.obj \ @@ -4221,7 +4214,6 @@ ____CORE_SRC_FILENAMES_3_OBJECTS = \ $(OBJS)\corelib_markuptext.obj \ $(OBJS)\corelib_msgdlgg.obj \ $(OBJS)\corelib_numdlgg.obj \ - $(OBJS)\corelib_panelg.obj \ $(OBJS)\corelib_progdlgg.obj \ $(OBJS)\corelib_printps.obj \ $(OBJS)\corelib_renderg.obj \ @@ -8133,11 +8125,6 @@ $(OBJS)\monodll_numdlgg.obj: ..\..\src\generic\numdlgg.cpp $(CXX) -q -c -P -o$@ $(MONODLL_CXXFLAGS) ..\..\src\generic\numdlgg.cpp !endif -!if "$(USE_GUI)" == "1" -$(OBJS)\monodll_panelg.obj: ..\..\src\generic\panelg.cpp - $(CXX) -q -c -P -o$@ $(MONODLL_CXXFLAGS) ..\..\src\generic\panelg.cpp -!endif - !if "$(USE_GUI)" == "1" $(OBJS)\monodll_progdlgg.obj: ..\..\src\generic\progdlgg.cpp $(CXX) -q -c -P -o$@ $(MONODLL_CXXFLAGS) ..\..\src\generic\progdlgg.cpp @@ -10525,11 +10512,6 @@ $(OBJS)\monolib_numdlgg.obj: ..\..\src\generic\numdlgg.cpp $(CXX) -q -c -P -o$@ $(MONOLIB_CXXFLAGS) ..\..\src\generic\numdlgg.cpp !endif -!if "$(USE_GUI)" == "1" -$(OBJS)\monolib_panelg.obj: ..\..\src\generic\panelg.cpp - $(CXX) -q -c -P -o$@ $(MONOLIB_CXXFLAGS) ..\..\src\generic\panelg.cpp -!endif - !if "$(USE_GUI)" == "1" $(OBJS)\monolib_progdlgg.obj: ..\..\src\generic\progdlgg.cpp $(CXX) -q -c -P -o$@ $(MONOLIB_CXXFLAGS) ..\..\src\generic\progdlgg.cpp @@ -12887,11 +12869,6 @@ $(OBJS)\coredll_numdlgg.obj: ..\..\src\generic\numdlgg.cpp $(CXX) -q -c -P -o$@ $(COREDLL_CXXFLAGS) ..\..\src\generic\numdlgg.cpp !endif -!if "$(USE_GUI)" == "1" -$(OBJS)\coredll_panelg.obj: ..\..\src\generic\panelg.cpp - $(CXX) -q -c -P -o$@ $(COREDLL_CXXFLAGS) ..\..\src\generic\panelg.cpp -!endif - !if "$(USE_GUI)" == "1" $(OBJS)\coredll_progdlgg.obj: ..\..\src\generic\progdlgg.cpp $(CXX) -q -c -P -o$@ $(COREDLL_CXXFLAGS) ..\..\src\generic\progdlgg.cpp @@ -14300,11 +14277,6 @@ $(OBJS)\corelib_numdlgg.obj: ..\..\src\generic\numdlgg.cpp $(CXX) -q -c -P -o$@ $(CORELIB_CXXFLAGS) ..\..\src\generic\numdlgg.cpp !endif -!if "$(USE_GUI)" == "1" -$(OBJS)\corelib_panelg.obj: ..\..\src\generic\panelg.cpp - $(CXX) -q -c -P -o$@ $(CORELIB_CXXFLAGS) ..\..\src\generic\panelg.cpp -!endif - !if "$(USE_GUI)" == "1" $(OBJS)\corelib_progdlgg.obj: ..\..\src\generic\progdlgg.cpp $(CXX) -q -c -P -o$@ $(CORELIB_CXXFLAGS) ..\..\src\generic\progdlgg.cpp diff --git a/build/msw/makefile.gcc b/build/msw/makefile.gcc index 5973775952..7ecbd48b78 100644 --- a/build/msw/makefile.gcc +++ b/build/msw/makefile.gcc @@ -1981,7 +1981,6 @@ ____CORE_SRC_FILENAMES_OBJECTS = \ $(OBJS)\monodll_markuptext.o \ $(OBJS)\monodll_msgdlgg.o \ $(OBJS)\monodll_numdlgg.o \ - $(OBJS)\monodll_panelg.o \ $(OBJS)\monodll_progdlgg.o \ $(OBJS)\monodll_printps.o \ $(OBJS)\monodll_renderg.o \ @@ -2250,7 +2249,6 @@ ____CORE_SRC_FILENAMES_OBJECTS = \ $(OBJS)\monodll_markuptext.o \ $(OBJS)\monodll_msgdlgg.o \ $(OBJS)\monodll_numdlgg.o \ - $(OBJS)\monodll_panelg.o \ $(OBJS)\monodll_progdlgg.o \ $(OBJS)\monodll_printps.o \ $(OBJS)\monodll_renderg.o \ @@ -2766,7 +2764,6 @@ ____CORE_SRC_FILENAMES_1_OBJECTS = \ $(OBJS)\monolib_markuptext.o \ $(OBJS)\monolib_msgdlgg.o \ $(OBJS)\monolib_numdlgg.o \ - $(OBJS)\monolib_panelg.o \ $(OBJS)\monolib_progdlgg.o \ $(OBJS)\monolib_printps.o \ $(OBJS)\monolib_renderg.o \ @@ -3035,7 +3032,6 @@ ____CORE_SRC_FILENAMES_1_OBJECTS = \ $(OBJS)\monolib_markuptext.o \ $(OBJS)\monolib_msgdlgg.o \ $(OBJS)\monolib_numdlgg.o \ - $(OBJS)\monolib_panelg.o \ $(OBJS)\monolib_progdlgg.o \ $(OBJS)\monolib_printps.o \ $(OBJS)\monolib_renderg.o \ @@ -3444,7 +3440,6 @@ ____CORE_SRC_FILENAMES_2_OBJECTS = \ $(OBJS)\coredll_markuptext.o \ $(OBJS)\coredll_msgdlgg.o \ $(OBJS)\coredll_numdlgg.o \ - $(OBJS)\coredll_panelg.o \ $(OBJS)\coredll_progdlgg.o \ $(OBJS)\coredll_printps.o \ $(OBJS)\coredll_renderg.o \ @@ -3713,7 +3708,6 @@ ____CORE_SRC_FILENAMES_2_OBJECTS = \ $(OBJS)\coredll_markuptext.o \ $(OBJS)\coredll_msgdlgg.o \ $(OBJS)\coredll_numdlgg.o \ - $(OBJS)\coredll_panelg.o \ $(OBJS)\coredll_progdlgg.o \ $(OBJS)\coredll_printps.o \ $(OBJS)\coredll_renderg.o \ @@ -3996,7 +3990,6 @@ ____CORE_SRC_FILENAMES_3_OBJECTS = \ $(OBJS)\corelib_markuptext.o \ $(OBJS)\corelib_msgdlgg.o \ $(OBJS)\corelib_numdlgg.o \ - $(OBJS)\corelib_panelg.o \ $(OBJS)\corelib_progdlgg.o \ $(OBJS)\corelib_printps.o \ $(OBJS)\corelib_renderg.o \ @@ -4265,7 +4258,6 @@ ____CORE_SRC_FILENAMES_3_OBJECTS = \ $(OBJS)\corelib_markuptext.o \ $(OBJS)\corelib_msgdlgg.o \ $(OBJS)\corelib_numdlgg.o \ - $(OBJS)\corelib_panelg.o \ $(OBJS)\corelib_progdlgg.o \ $(OBJS)\corelib_printps.o \ $(OBJS)\corelib_renderg.o \ @@ -8301,11 +8293,6 @@ $(OBJS)\monodll_numdlgg.o: ../../src/generic/numdlgg.cpp $(CXX) -c -o $@ $(MONODLL_CXXFLAGS) $(CPPDEPS) $< endif -ifeq ($(USE_GUI),1) -$(OBJS)\monodll_panelg.o: ../../src/generic/panelg.cpp - $(CXX) -c -o $@ $(MONODLL_CXXFLAGS) $(CPPDEPS) $< -endif - ifeq ($(USE_GUI),1) $(OBJS)\monodll_progdlgg.o: ../../src/generic/progdlgg.cpp $(CXX) -c -o $@ $(MONODLL_CXXFLAGS) $(CPPDEPS) $< @@ -10693,11 +10680,6 @@ $(OBJS)\monolib_numdlgg.o: ../../src/generic/numdlgg.cpp $(CXX) -c -o $@ $(MONOLIB_CXXFLAGS) $(CPPDEPS) $< endif -ifeq ($(USE_GUI),1) -$(OBJS)\monolib_panelg.o: ../../src/generic/panelg.cpp - $(CXX) -c -o $@ $(MONOLIB_CXXFLAGS) $(CPPDEPS) $< -endif - ifeq ($(USE_GUI),1) $(OBJS)\monolib_progdlgg.o: ../../src/generic/progdlgg.cpp $(CXX) -c -o $@ $(MONOLIB_CXXFLAGS) $(CPPDEPS) $< @@ -13055,11 +13037,6 @@ $(OBJS)\coredll_numdlgg.o: ../../src/generic/numdlgg.cpp $(CXX) -c -o $@ $(COREDLL_CXXFLAGS) $(CPPDEPS) $< endif -ifeq ($(USE_GUI),1) -$(OBJS)\coredll_panelg.o: ../../src/generic/panelg.cpp - $(CXX) -c -o $@ $(COREDLL_CXXFLAGS) $(CPPDEPS) $< -endif - ifeq ($(USE_GUI),1) $(OBJS)\coredll_progdlgg.o: ../../src/generic/progdlgg.cpp $(CXX) -c -o $@ $(COREDLL_CXXFLAGS) $(CPPDEPS) $< @@ -14468,11 +14445,6 @@ $(OBJS)\corelib_numdlgg.o: ../../src/generic/numdlgg.cpp $(CXX) -c -o $@ $(CORELIB_CXXFLAGS) $(CPPDEPS) $< endif -ifeq ($(USE_GUI),1) -$(OBJS)\corelib_panelg.o: ../../src/generic/panelg.cpp - $(CXX) -c -o $@ $(CORELIB_CXXFLAGS) $(CPPDEPS) $< -endif - ifeq ($(USE_GUI),1) $(OBJS)\corelib_progdlgg.o: ../../src/generic/progdlgg.cpp $(CXX) -c -o $@ $(CORELIB_CXXFLAGS) $(CPPDEPS) $< diff --git a/build/msw/makefile.vc b/build/msw/makefile.vc index 2747640a40..51871e75ab 100644 --- a/build/msw/makefile.vc +++ b/build/msw/makefile.vc @@ -2183,7 +2183,6 @@ ____CORE_SRC_FILENAMES_OBJECTS = \ $(OBJS)\monodll_markuptext.obj \ $(OBJS)\monodll_msgdlgg.obj \ $(OBJS)\monodll_numdlgg.obj \ - $(OBJS)\monodll_panelg.obj \ $(OBJS)\monodll_progdlgg.obj \ $(OBJS)\monodll_printps.obj \ $(OBJS)\monodll_renderg.obj \ @@ -2450,7 +2449,6 @@ ____CORE_SRC_FILENAMES_OBJECTS = \ $(OBJS)\monodll_markuptext.obj \ $(OBJS)\monodll_msgdlgg.obj \ $(OBJS)\monodll_numdlgg.obj \ - $(OBJS)\monodll_panelg.obj \ $(OBJS)\monodll_progdlgg.obj \ $(OBJS)\monodll_printps.obj \ $(OBJS)\monodll_renderg.obj \ @@ -2968,7 +2966,6 @@ ____CORE_SRC_FILENAMES_1_OBJECTS = \ $(OBJS)\monolib_markuptext.obj \ $(OBJS)\monolib_msgdlgg.obj \ $(OBJS)\monolib_numdlgg.obj \ - $(OBJS)\monolib_panelg.obj \ $(OBJS)\monolib_progdlgg.obj \ $(OBJS)\monolib_printps.obj \ $(OBJS)\monolib_renderg.obj \ @@ -3235,7 +3232,6 @@ ____CORE_SRC_FILENAMES_1_OBJECTS = \ $(OBJS)\monolib_markuptext.obj \ $(OBJS)\monolib_msgdlgg.obj \ $(OBJS)\monolib_numdlgg.obj \ - $(OBJS)\monolib_panelg.obj \ $(OBJS)\monolib_progdlgg.obj \ $(OBJS)\monolib_printps.obj \ $(OBJS)\monolib_renderg.obj \ @@ -3696,7 +3692,6 @@ ____CORE_SRC_FILENAMES_2_OBJECTS = \ $(OBJS)\coredll_markuptext.obj \ $(OBJS)\coredll_msgdlgg.obj \ $(OBJS)\coredll_numdlgg.obj \ - $(OBJS)\coredll_panelg.obj \ $(OBJS)\coredll_progdlgg.obj \ $(OBJS)\coredll_printps.obj \ $(OBJS)\coredll_renderg.obj \ @@ -3963,7 +3958,6 @@ ____CORE_SRC_FILENAMES_2_OBJECTS = \ $(OBJS)\coredll_markuptext.obj \ $(OBJS)\coredll_msgdlgg.obj \ $(OBJS)\coredll_numdlgg.obj \ - $(OBJS)\coredll_panelg.obj \ $(OBJS)\coredll_progdlgg.obj \ $(OBJS)\coredll_printps.obj \ $(OBJS)\coredll_renderg.obj \ @@ -4246,7 +4240,6 @@ ____CORE_SRC_FILENAMES_3_OBJECTS = \ $(OBJS)\corelib_markuptext.obj \ $(OBJS)\corelib_msgdlgg.obj \ $(OBJS)\corelib_numdlgg.obj \ - $(OBJS)\corelib_panelg.obj \ $(OBJS)\corelib_progdlgg.obj \ $(OBJS)\corelib_printps.obj \ $(OBJS)\corelib_renderg.obj \ @@ -4513,7 +4506,6 @@ ____CORE_SRC_FILENAMES_3_OBJECTS = \ $(OBJS)\corelib_markuptext.obj \ $(OBJS)\corelib_msgdlgg.obj \ $(OBJS)\corelib_numdlgg.obj \ - $(OBJS)\corelib_panelg.obj \ $(OBJS)\corelib_progdlgg.obj \ $(OBJS)\corelib_printps.obj \ $(OBJS)\corelib_renderg.obj \ @@ -8739,11 +8731,6 @@ $(OBJS)\monodll_numdlgg.obj: ..\..\src\generic\numdlgg.cpp $(CXX) /c /nologo /TP /Fo$@ $(MONODLL_CXXFLAGS) ..\..\src\generic\numdlgg.cpp !endif -!if "$(USE_GUI)" == "1" -$(OBJS)\monodll_panelg.obj: ..\..\src\generic\panelg.cpp - $(CXX) /c /nologo /TP /Fo$@ $(MONODLL_CXXFLAGS) ..\..\src\generic\panelg.cpp -!endif - !if "$(USE_GUI)" == "1" $(OBJS)\monodll_progdlgg.obj: ..\..\src\generic\progdlgg.cpp $(CXX) /c /nologo /TP /Fo$@ $(MONODLL_CXXFLAGS) ..\..\src\generic\progdlgg.cpp @@ -11131,11 +11118,6 @@ $(OBJS)\monolib_numdlgg.obj: ..\..\src\generic\numdlgg.cpp $(CXX) /c /nologo /TP /Fo$@ $(MONOLIB_CXXFLAGS) ..\..\src\generic\numdlgg.cpp !endif -!if "$(USE_GUI)" == "1" -$(OBJS)\monolib_panelg.obj: ..\..\src\generic\panelg.cpp - $(CXX) /c /nologo /TP /Fo$@ $(MONOLIB_CXXFLAGS) ..\..\src\generic\panelg.cpp -!endif - !if "$(USE_GUI)" == "1" $(OBJS)\monolib_progdlgg.obj: ..\..\src\generic\progdlgg.cpp $(CXX) /c /nologo /TP /Fo$@ $(MONOLIB_CXXFLAGS) ..\..\src\generic\progdlgg.cpp @@ -13493,11 +13475,6 @@ $(OBJS)\coredll_numdlgg.obj: ..\..\src\generic\numdlgg.cpp $(CXX) /c /nologo /TP /Fo$@ $(COREDLL_CXXFLAGS) ..\..\src\generic\numdlgg.cpp !endif -!if "$(USE_GUI)" == "1" -$(OBJS)\coredll_panelg.obj: ..\..\src\generic\panelg.cpp - $(CXX) /c /nologo /TP /Fo$@ $(COREDLL_CXXFLAGS) ..\..\src\generic\panelg.cpp -!endif - !if "$(USE_GUI)" == "1" $(OBJS)\coredll_progdlgg.obj: ..\..\src\generic\progdlgg.cpp $(CXX) /c /nologo /TP /Fo$@ $(COREDLL_CXXFLAGS) ..\..\src\generic\progdlgg.cpp @@ -14906,11 +14883,6 @@ $(OBJS)\corelib_numdlgg.obj: ..\..\src\generic\numdlgg.cpp $(CXX) /c /nologo /TP /Fo$@ $(CORELIB_CXXFLAGS) ..\..\src\generic\numdlgg.cpp !endif -!if "$(USE_GUI)" == "1" -$(OBJS)\corelib_panelg.obj: ..\..\src\generic\panelg.cpp - $(CXX) /c /nologo /TP /Fo$@ $(CORELIB_CXXFLAGS) ..\..\src\generic\panelg.cpp -!endif - !if "$(USE_GUI)" == "1" $(OBJS)\corelib_progdlgg.obj: ..\..\src\generic\progdlgg.cpp $(CXX) /c /nologo /TP /Fo$@ $(CORELIB_CXXFLAGS) ..\..\src\generic\progdlgg.cpp diff --git a/build/msw/makefile.wat b/build/msw/makefile.wat index 728f2d636e..f85b42f068 100644 --- a/build/msw/makefile.wat +++ b/build/msw/makefile.wat @@ -498,7 +498,6 @@ ____CORE_SRC_FILENAMES_OBJECTS = & $(OBJS)\monodll_markuptext.obj & $(OBJS)\monodll_msgdlgg.obj & $(OBJS)\monodll_numdlgg.obj & - $(OBJS)\monodll_panelg.obj & $(OBJS)\monodll_progdlgg.obj & $(OBJS)\monodll_printps.obj & $(OBJS)\monodll_renderg.obj & @@ -767,7 +766,6 @@ ____CORE_SRC_FILENAMES_OBJECTS = & $(OBJS)\monodll_markuptext.obj & $(OBJS)\monodll_msgdlgg.obj & $(OBJS)\monodll_numdlgg.obj & - $(OBJS)\monodll_panelg.obj & $(OBJS)\monodll_progdlgg.obj & $(OBJS)\monodll_printps.obj & $(OBJS)\monodll_renderg.obj & @@ -1288,7 +1286,6 @@ ____CORE_SRC_FILENAMES_1_OBJECTS = & $(OBJS)\monolib_markuptext.obj & $(OBJS)\monolib_msgdlgg.obj & $(OBJS)\monolib_numdlgg.obj & - $(OBJS)\monolib_panelg.obj & $(OBJS)\monolib_progdlgg.obj & $(OBJS)\monolib_printps.obj & $(OBJS)\monolib_renderg.obj & @@ -1557,7 +1554,6 @@ ____CORE_SRC_FILENAMES_1_OBJECTS = & $(OBJS)\monolib_markuptext.obj & $(OBJS)\monolib_msgdlgg.obj & $(OBJS)\monolib_numdlgg.obj & - $(OBJS)\monolib_panelg.obj & $(OBJS)\monolib_progdlgg.obj & $(OBJS)\monolib_printps.obj & $(OBJS)\monolib_renderg.obj & @@ -1977,7 +1973,6 @@ ____CORE_SRC_FILENAMES_2_OBJECTS = & $(OBJS)\coredll_markuptext.obj & $(OBJS)\coredll_msgdlgg.obj & $(OBJS)\coredll_numdlgg.obj & - $(OBJS)\coredll_panelg.obj & $(OBJS)\coredll_progdlgg.obj & $(OBJS)\coredll_printps.obj & $(OBJS)\coredll_renderg.obj & @@ -2246,7 +2241,6 @@ ____CORE_SRC_FILENAMES_2_OBJECTS = & $(OBJS)\coredll_markuptext.obj & $(OBJS)\coredll_msgdlgg.obj & $(OBJS)\coredll_numdlgg.obj & - $(OBJS)\coredll_panelg.obj & $(OBJS)\coredll_progdlgg.obj & $(OBJS)\coredll_printps.obj & $(OBJS)\coredll_renderg.obj & @@ -2531,7 +2525,6 @@ ____CORE_SRC_FILENAMES_3_OBJECTS = & $(OBJS)\corelib_markuptext.obj & $(OBJS)\corelib_msgdlgg.obj & $(OBJS)\corelib_numdlgg.obj & - $(OBJS)\corelib_panelg.obj & $(OBJS)\corelib_progdlgg.obj & $(OBJS)\corelib_printps.obj & $(OBJS)\corelib_renderg.obj & @@ -2800,7 +2793,6 @@ ____CORE_SRC_FILENAMES_3_OBJECTS = & $(OBJS)\corelib_markuptext.obj & $(OBJS)\corelib_msgdlgg.obj & $(OBJS)\corelib_numdlgg.obj & - $(OBJS)\corelib_panelg.obj & $(OBJS)\corelib_progdlgg.obj & $(OBJS)\corelib_printps.obj & $(OBJS)\corelib_renderg.obj & @@ -8572,11 +8564,6 @@ $(OBJS)\monodll_numdlgg.obj : .AUTODEPEND ..\..\src\generic\numdlgg.cpp $(CXX) -bt=nt -zq -fo=$^@ $(MONODLL_CXXFLAGS) $< !endif -!ifeq USE_GUI 1 -$(OBJS)\monodll_panelg.obj : .AUTODEPEND ..\..\src\generic\panelg.cpp - $(CXX) -bt=nt -zq -fo=$^@ $(MONODLL_CXXFLAGS) $< -!endif - !ifeq USE_GUI 1 $(OBJS)\monodll_progdlgg.obj : .AUTODEPEND ..\..\src\generic\progdlgg.cpp $(CXX) -bt=nt -zq -fo=$^@ $(MONODLL_CXXFLAGS) $< @@ -10964,11 +10951,6 @@ $(OBJS)\monolib_numdlgg.obj : .AUTODEPEND ..\..\src\generic\numdlgg.cpp $(CXX) -bt=nt -zq -fo=$^@ $(MONOLIB_CXXFLAGS) $< !endif -!ifeq USE_GUI 1 -$(OBJS)\monolib_panelg.obj : .AUTODEPEND ..\..\src\generic\panelg.cpp - $(CXX) -bt=nt -zq -fo=$^@ $(MONOLIB_CXXFLAGS) $< -!endif - !ifeq USE_GUI 1 $(OBJS)\monolib_progdlgg.obj : .AUTODEPEND ..\..\src\generic\progdlgg.cpp $(CXX) -bt=nt -zq -fo=$^@ $(MONOLIB_CXXFLAGS) $< @@ -13326,11 +13308,6 @@ $(OBJS)\coredll_numdlgg.obj : .AUTODEPEND ..\..\src\generic\numdlgg.cpp $(CXX) -bt=nt -zq -fo=$^@ $(COREDLL_CXXFLAGS) $< !endif -!ifeq USE_GUI 1 -$(OBJS)\coredll_panelg.obj : .AUTODEPEND ..\..\src\generic\panelg.cpp - $(CXX) -bt=nt -zq -fo=$^@ $(COREDLL_CXXFLAGS) $< -!endif - !ifeq USE_GUI 1 $(OBJS)\coredll_progdlgg.obj : .AUTODEPEND ..\..\src\generic\progdlgg.cpp $(CXX) -bt=nt -zq -fo=$^@ $(COREDLL_CXXFLAGS) $< @@ -14739,11 +14716,6 @@ $(OBJS)\corelib_numdlgg.obj : .AUTODEPEND ..\..\src\generic\numdlgg.cpp $(CXX) -bt=nt -zq -fo=$^@ $(CORELIB_CXXFLAGS) $< !endif -!ifeq USE_GUI 1 -$(OBJS)\corelib_panelg.obj : .AUTODEPEND ..\..\src\generic\panelg.cpp - $(CXX) -bt=nt -zq -fo=$^@ $(CORELIB_CXXFLAGS) $< -!endif - !ifeq USE_GUI 1 $(OBJS)\corelib_progdlgg.obj : .AUTODEPEND ..\..\src\generic\progdlgg.cpp $(CXX) -bt=nt -zq -fo=$^@ $(CORELIB_CXXFLAGS) $< diff --git a/build/msw/wx_core.dsp b/build/msw/wx_core.dsp index 55f85c60f1..e9ee7ffc94 100644 --- a/build/msw/wx_core.dsp +++ b/build/msw/wx_core.dsp @@ -3244,10 +3244,6 @@ SOURCE=..\..\src\generic\numdlgg.cpp # End Source File # Begin Source File -SOURCE=..\..\src\generic\panelg.cpp -# End Source File -# Begin Source File - SOURCE=..\..\src\generic\printps.cpp # End Source File # Begin Source File @@ -5013,6 +5009,10 @@ SOURCE=..\..\include\wx\msw\cursor.h # End Source File # Begin Source File +SOURCE=..\..\include\wx\msw\custombgwin.h +# End Source File +# Begin Source File + SOURCE=..\..\include\wx\msw\ole\dataform.h # End Source File # Begin Source File @@ -5504,6 +5504,10 @@ SOURCE=..\..\include\wx\generic\ctrlsub.h # End Source File # Begin Source File +SOURCE=..\..\include\wx\generic\custombgwin.h +# End Source File +# Begin Source File + SOURCE=..\..\include\wx\generic\dataview.h # End Source File # Begin Source File @@ -5748,6 +5752,10 @@ SOURCE=..\..\include\wx\univ\control.h # End Source File # Begin Source File +SOURCE=..\..\include\wx\univ\custombgwin.h +# End Source File +# Begin Source File + SOURCE=..\..\include\wx\univ\dialog.h # End Source File # Begin Source File @@ -6152,6 +6160,10 @@ SOURCE=..\..\include\wx\cursor.h # End Source File # Begin Source File +SOURCE=..\..\include\wx\custombgwin.h +# End Source File +# Begin Source File + SOURCE=..\..\include\wx\dataobj.h # End Source File # Begin Source File diff --git a/build/msw/wx_vc7_core.vcproj b/build/msw/wx_vc7_core.vcproj index 0119ad154e..1f08edf19c 100644 --- a/build/msw/wx_vc7_core.vcproj +++ b/build/msw/wx_vc7_core.vcproj @@ -2849,9 +2849,6 @@ - - @@ -4322,6 +4319,9 @@ RelativePath="..\..\include\wx\msw\cursor.h"> + + + + + + + + - - @@ -5792,6 +5788,10 @@ > + + @@ -6289,6 +6289,10 @@ > + + @@ -6534,6 +6538,10 @@ > + + @@ -6940,6 +6948,10 @@ > + + diff --git a/build/msw/wx_vc9_core.vcproj b/build/msw/wx_vc9_core.vcproj index 431dd60e8f..4a088b8b7b 100644 --- a/build/msw/wx_vc9_core.vcproj +++ b/build/msw/wx_vc9_core.vcproj @@ -3828,10 +3828,6 @@ RelativePath="..\..\src\generic\numdlgg.cpp" > - - @@ -5788,6 +5784,10 @@ > + + @@ -6285,6 +6285,10 @@ > + + @@ -6530,6 +6534,10 @@ > + + @@ -6936,6 +6944,10 @@ > + + diff --git a/docs/changes.txt b/docs/changes.txt index ac558b2a49..070a777433 100644 --- a/docs/changes.txt +++ b/docs/changes.txt @@ -444,6 +444,11 @@ Major new features in this release 2.9.3: ------ +INCOMPATIBLE CHANGES SINCE 2.9.2 + +- wxPanel::SetBackgroundBitmap() was removed, derive your class from + wxCustomBackgroundWindow and use its method with the same name instead. + All: - Fix parsing of negated long options in wxCmdLineParser (roed_bis). diff --git a/docs/doxygen/mainpages/cat_classes.h b/docs/doxygen/mainpages/cat_classes.h index c1a0dfacc7..ad5b0dedf4 100644 --- a/docs/doxygen/mainpages/cat_classes.h +++ b/docs/doxygen/mainpages/cat_classes.h @@ -255,7 +255,7 @@ The following are a variety of classes that are derived from wxWindow. arrangement @li wxWizardPage: A base class for the page in wizard dialog. @li wxWizardPageSimple: A page in wizard dialog. - +@li wxCustomBackgroundWindow: A window allowing to set a custom bitmap. @section page_class_cat_aui Window Docking (wxAUI) diff --git a/include/wx/custombgwin.h b/include/wx/custombgwin.h new file mode 100644 index 0000000000..b5684d1df3 --- /dev/null +++ b/include/wx/custombgwin.h @@ -0,0 +1,50 @@ +/////////////////////////////////////////////////////////////////////////////// +// Name: wx/custombgwin.h +// Purpose: Class adding support for custom window backgrounds. +// Author: Vadim Zeitlin +// Created: 2011-10-10 +// RCS-ID: $Id: wxhead.h,v 1.12 2010-04-22 12:44:51 zeitlin Exp $ +// Copyright: (c) 2011 Vadim Zeitlin +// Licence: wxWindows licence +/////////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_CUSTOMBGWIN_H_ +#define _WX_CUSTOMBGWIN_H_ + +// ---------------------------------------------------------------------------- +// wxCustomBackgroundWindow: Adds support for custom backgrounds to any +// wxWindow-derived class. +// ---------------------------------------------------------------------------- + +class wxCustomBackgroundWindowBase +{ +public: + // Trivial default ctor. + wxCustomBackgroundWindowBase() { } + + // Use the given bitmap to tile the background of this window. This bitmap + // will show through any transparent children. + // + // Notice that you must not prevent the base class EVT_ERASE_BACKGROUND + // handler from running (i.e. not to handle this event yourself) for this + // to work. + void SetBackgroundBitmap(const wxBitmap& bmp) + { + DoSetBackgroundBitmap(bmp); + } + +protected: + virtual void DoSetBackgroundBitmap(const wxBitmap& bmp) = 0; + + wxDECLARE_NO_COPY_CLASS(wxCustomBackgroundWindowBase); +}; + +#if defined(__WXUNIVERSAL__) + #include "wx/univ/custombgwin.h" +#elif defined(__WXMSW__) + #include "wx/msw/custombgwin.h" +#else + #include "wx/generic/custombgwin.h" +#endif + +#endif // _WX_CUSTOMBGWIN_H_ diff --git a/include/wx/generic/custombgwin.h b/include/wx/generic/custombgwin.h new file mode 100644 index 0000000000..bff6e65a6d --- /dev/null +++ b/include/wx/generic/custombgwin.h @@ -0,0 +1,96 @@ +/////////////////////////////////////////////////////////////////////////////// +// Name: wx/generic/custombgwin.h +// Purpose: Generic implementation of wxCustomBackgroundWindow. +// Author: Vadim Zeitlin +// Created: 2011-10-10 +// RCS-ID: $Id: wxhead.h,v 1.12 2010-04-22 12:44:51 zeitlin Exp $ +// Copyright: (c) 2011 Vadim Zeitlin +// Licence: wxWindows licence +/////////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_GENERIC_CUSTOMBGWIN_H_ +#define _WX_GENERIC_CUSTOMBGWIN_H_ + +#include "wx/bitmap.h" + +// A helper to avoid template bloat: this class contains all type-independent +// code of wxCustomBackgroundWindow<> below. +class wxCustomBackgroundWindowGenericBase : public wxCustomBackgroundWindowBase +{ +public: + wxCustomBackgroundWindowGenericBase() { } + +protected: + void DoEraseBackground(wxEraseEvent& event, wxWindow* win) + { + wxDC& dc = *event.GetDC(); + + const wxSize clientSize = win->GetClientSize(); + const wxSize bitmapSize = m_bitmapBg.GetSize(); + + for ( int x = 0; x < clientSize.x; x += bitmapSize.x ) + { + for ( int y = 0; y < clientSize.y; y += bitmapSize.y ) + { + dc.DrawBitmap(m_bitmapBg, x, y); + } + } + } + + + // The bitmap used for painting the background if valid. + wxBitmap m_bitmapBg; + + + wxDECLARE_NO_COPY_CLASS(wxCustomBackgroundWindowGenericBase); +}; + +// ---------------------------------------------------------------------------- +// wxCustomBackgroundWindow +// ---------------------------------------------------------------------------- + +template +class wxCustomBackgroundWindow : public W, + public wxCustomBackgroundWindowGenericBase +{ +public: + typedef W BaseWindowClass; + + wxCustomBackgroundWindow() { } + +protected: + virtual void DoSetBackgroundBitmap(const wxBitmap& bmp) + { + m_bitmapBg = bmp; + + if ( m_bitmapBg.IsOk() ) + { + BaseWindowClass::Connect + ( + wxEVT_ERASE_BACKGROUND, + wxEraseEventHandler(wxCustomBackgroundWindow::OnEraseBackground) + ); + } + else + { + BaseWindowClass::Disconnect + ( + wxEVT_ERASE_BACKGROUND, + wxEraseEventHandler(wxCustomBackgroundWindow::OnEraseBackground) + ); + } + } + +private: + // Event handler for erasing the background which is only used when we have + // a valid background bitmap. + void OnEraseBackground(wxEraseEvent& event) + { + DoEraseBackground(event, this); + } + + + wxDECLARE_NO_COPY_TEMPLATE_CLASS(wxCustomBackgroundWindow, W); +}; + +#endif // _WX_GENERIC_CUSTOMBGWIN_H_ diff --git a/include/wx/generic/panelg.h b/include/wx/generic/panelg.h index 9b87ee1a39..a23d64786e 100644 --- a/include/wx/generic/panelg.h +++ b/include/wx/generic/panelg.h @@ -42,18 +42,7 @@ public: ) #endif // WXWIN_COMPATIBILITY_2_8 -protected: - virtual void DoSetBackgroundBitmap(const wxBitmap& bmp); - private: - // Event handler for erasing the background which is only used when we have - // a valid background bitmap. - void OnEraseBackground(wxEraseEvent& event); - - - // The bitmap used for painting the background if valid. - wxBitmap m_bitmapBg; - wxDECLARE_DYNAMIC_CLASS_NO_COPY(wxPanel); }; diff --git a/include/wx/msw/custombgwin.h b/include/wx/msw/custombgwin.h new file mode 100644 index 0000000000..13c9da69dd --- /dev/null +++ b/include/wx/msw/custombgwin.h @@ -0,0 +1,58 @@ +/////////////////////////////////////////////////////////////////////////////// +// Name: wx/msw/custombgwin.h +// Purpose: wxMSW implementation of wxCustomBackgroundWindow +// Author: Vadim Zeitlin +// Created: 2011-10-10 +// RCS-ID: $Id: wxhead.h,v 1.12 2010-04-22 12:44:51 zeitlin Exp $ +// Copyright: (c) 2011 Vadim Zeitlin +// Licence: wxWindows licence +/////////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_MSW_CUSTOMBGWIN_H_ +#define _WX_MSW_CUSTOMBGWIN_H_ + +#include "wx/bitmap.h" +#include "wx/brush.h" + +// ---------------------------------------------------------------------------- +// wxCustomBackgroundWindow +// ---------------------------------------------------------------------------- + +template +class wxCustomBackgroundWindow : public W, + public wxCustomBackgroundWindowBase +{ +public: + typedef W BaseWindowClass; + + wxCustomBackgroundWindow() { m_backgroundBrush = NULL; } + + virtual ~wxCustomBackgroundWindow() { delete m_backgroundBrush; } + +protected: + virtual void DoSetBackgroundBitmap(const wxBitmap& bmp) + { + delete m_backgroundBrush; + m_backgroundBrush = bmp.IsOk() ? new wxBrush(bmp) : NULL; + + // Our transparent children should use our background if we have it, + // otherwise try to restore m_inheritBgCol to some reasonable value: true + // if we also have non-default background colour or false otherwise. + BaseWindowClass::m_inheritBgCol = bmp.IsOk() + || BaseWindowClass::UseBgCol(); + } + + virtual WXHBRUSH MSWGetCustomBgBrush() + { + if ( m_backgroundBrush ) + return (WXHBRUSH)m_backgroundBrush->GetResourceHandle(); + + return BaseWindowClass::MSWGetCustomBgBrush(); + } + + wxBrush *m_backgroundBrush; + + wxDECLARE_NO_COPY_TEMPLATE_CLASS(wxCustomBackgroundWindow, W); +}; + +#endif // _WX_MSW_CUSTOMBGWIN_H_ diff --git a/include/wx/msw/panel.h b/include/wx/msw/panel.h index 4761192d66..690f54438e 100644 --- a/include/wx/msw/panel.h +++ b/include/wx/msw/panel.h @@ -20,7 +20,7 @@ class WXDLLIMPEXP_FWD_CORE wxBrush; class WXDLLIMPEXP_CORE wxPanel : public wxPanelBase { public: - wxPanel() { Init(); } + wxPanel() { } wxPanel(wxWindow *parent, wxWindowID winid = wxID_ANY, @@ -29,13 +29,9 @@ public: long style = wxTAB_TRAVERSAL | wxNO_BORDER, const wxString& name = wxPanelNameStr) { - Init(); - Create(parent, winid, pos, size, style, name); } - virtual ~wxPanel(); - // This is overridden for MSW to return true for all panels that are child // of a window with themed background (such as wxNotebook) which should // show through the child panels. @@ -54,18 +50,7 @@ public: ) #endif // WXWIN_COMPATIBILITY_2_8 -protected: - void Init() - { - m_backgroundBrush = NULL; - } - - virtual void DoSetBackgroundBitmap(const wxBitmap& bmp); - virtual WXHBRUSH MSWGetCustomBgBrush(); - private: - wxBrush *m_backgroundBrush; - wxDECLARE_DYNAMIC_CLASS_NO_COPY(wxPanel); }; diff --git a/include/wx/panel.h b/include/wx/panel.h index bb93a5771b..8f22d180fe 100644 --- a/include/wx/panel.h +++ b/include/wx/panel.h @@ -52,26 +52,11 @@ public: const wxString& name = wxPanelNameStr); - // Use the given bitmap to tile the background of this panel. This bitmap - // will show through any transparent children. - // - // Notice that you must not prevent the base class EVT_ERASE_BACKGROUND - // handler from running (i.e. not to handle this event yourself) for this - // to work. - void SetBackgroundBitmap(const wxBitmap& bmp) - { - DoSetBackgroundBitmap(bmp); - } - - // implementation from now on // -------------------------- virtual void InitDialog(); -protected: - virtual void DoSetBackgroundBitmap(const wxBitmap& bmp) = 0; - private: wxDECLARE_NO_COPY_CLASS(wxPanelBase); }; diff --git a/include/wx/univ/custombgwin.h b/include/wx/univ/custombgwin.h new file mode 100644 index 0000000000..f3e2ca39d3 --- /dev/null +++ b/include/wx/univ/custombgwin.h @@ -0,0 +1,37 @@ +/////////////////////////////////////////////////////////////////////////////// +// Name: wx/univ/custombgwin.h +// Purpose: wxUniv implementation of wxCustomBackgroundWindow. +// Author: Vadim Zeitlin +// Created: 2011-10-10 +// RCS-ID: $Id: wxhead.h,v 1.12 2010-04-22 12:44:51 zeitlin Exp $ +// Copyright: (c) 2011 Vadim Zeitlin +// Licence: wxWindows licence +/////////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_UNIV_CUSTOMBGWIN_H_ +#define _WX_UNIV_CUSTOMBGWIN_H_ + +// ---------------------------------------------------------------------------- +// wxCustomBackgroundWindow +// ---------------------------------------------------------------------------- + +template +class wxCustomBackgroundWindow : public W, + public wxCustomBackgroundWindowBase +{ +public: + typedef W BaseWindowClass; + + wxCustomBackgroundWindow() { } + +protected: + virtual void DoSetBackgroundBitmap(const wxBitmap& bmp) + { + // We have support for background bitmap even at the base class level. + BaseWindowClass::SetBackground(bmp, wxALIGN_NOT, wxTILE); + } + + wxDECLARE_NO_COPY_TEMPLATE_CLASS(wxCustomBackgroundWindow, W); +}; + +#endif // _WX_UNIV_CUSTOMBGWIN_H_ diff --git a/include/wx/univ/panel.h b/include/wx/univ/panel.h index f6bd7c2137..19f0d52dc0 100644 --- a/include/wx/univ/panel.h +++ b/include/wx/univ/panel.h @@ -44,13 +44,6 @@ public: ) #endif // WXWIN_COMPATIBILITY_2_8 -protected: - virtual void DoSetBackgroundBitmap(const wxBitmap& bmp) - { - // We have support for background bitmap even at the base class level. - SetBackground(bmp, wxALIGN_NOT, wxTILE); - } - private: wxDECLARE_DYNAMIC_CLASS_NO_COPY(wxPanel); }; diff --git a/interface/wx/custombgwin.h b/interface/wx/custombgwin.h new file mode 100644 index 0000000000..faab09bd65 --- /dev/null +++ b/interface/wx/custombgwin.h @@ -0,0 +1,67 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/custombgwin.h +// Purpose: Documentation of wxCustomBackgroundWindow. +// Author: Vadim Zeitlin +// Created: 2011-10-10 +// RCS-ID: $Id$ +// Copyright: (c) 2011 Vadim Zeitlin +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +/** + A helper class making it possible to use custom background for any window. + + wxWindow itself only provides SetBackgroundColour() method taking a (solid) + wxColour. This class extends it by allowing to use custom bitmap + backgrounds with any window, provided that you inherit from it. Notice that + the usual rule of not interfering with event handling or painting of native + controls still applies, so you shouldn't try to use custom backgrounds with + classes such as wxButton (even if this might work on some platforms, it's + not guaranteed to work in general). But you can use this class in + conjunction with wxWindow, wxPanel, wxFrame and other similar classes, e.g. + the erase sample shows how to use it with wxScrolledWindow: + + @code + #include "wx/custombgwin.h" + + class MyCanvas : public wxCustomBackgroundWindow + { + public: + MyCanvas(wxWindow* parent) + { + // Notice that we must explicitly call base class Create() + // instead of using its ctor as wxCustomBackgroundWindow + // doesn't define any non-default ctors. + Create(parent, wxID_ANY); + + ... + + SetBackgroundBitmap(bitmap); + } + }; + @endcode + + @category{miscwnd} + + @since 2.9.3 + */ +template +class wxCustomBackgroundWindow : public W +{ +public: + /// Trivial default constructor. + wxCustomBackgroundWindow(); + + /** + Set the background bitmap for this window. + + If @a bmp is a valid bitmap, this bitmap will be tiled over the panel + background and show through any of its transparent children. Passing an + invalid bitmap reverts to the default background appearance. + + Notice that you must not prevent the base class EVT_ERASE_BACKGROUND + handler from running (i.e. not to handle this event yourself) for this + to work. + */ + void SetBackgroundBitmap(const wxBitmap& bmp); +}; diff --git a/interface/wx/panel.h b/interface/wx/panel.h index cc65780d66..b1e83bd223 100644 --- a/interface/wx/panel.h +++ b/interface/wx/panel.h @@ -124,21 +124,6 @@ public: */ void OnSysColourChanged(wxSysColourChangedEvent& event); - /** - Set the background bitmap for this panel. - - If @a bmp is a valid bitmap, this bitmap will be tiled over the panel - background and show through any of its transparent children. Passing an - invalid bitmap reverts to the default background appearance. - - Notice that you must not prevent the base class EVT_ERASE_BACKGROUND - handler from running (i.e. not to handle this event yourself) for this - to work. - - @since 2.9.2 - */ - void SetBackgroundBitmap(const wxBitmap& bmp); - /** Overrides wxWindow::SetFocus(). diff --git a/samples/erase/erase.cpp b/samples/erase/erase.cpp index 138b3fa2bc..bb452f239a 100644 --- a/samples/erase/erase.cpp +++ b/samples/erase/erase.cpp @@ -30,6 +30,7 @@ #include "wx/wx.h" #endif +#include "wx/custombgwin.h" #include "wx/dcbuffer.h" // ---------------------------------------------------------------------------- @@ -52,7 +53,7 @@ public: }; -class MyCanvas : public wxScrolledWindow +class MyCanvas : public wxCustomBackgroundWindow { public: MyCanvas(wxFrame *parent); @@ -310,8 +311,9 @@ BEGIN_EVENT_TABLE(MyCanvas, wxScrolledWindow) END_EVENT_TABLE() MyCanvas::MyCanvas(wxFrame *parent) - : wxScrolledWindow(parent, wxID_ANY) { + Create(parent, wxID_ANY); + m_useBuffer = false; m_useBgBmp = false; m_eraseBgInPaint = false; diff --git a/src/generic/panelg.cpp b/src/generic/panelg.cpp deleted file mode 100644 index d539393dbe..0000000000 --- a/src/generic/panelg.cpp +++ /dev/null @@ -1,69 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// Name: src/generic/panelg.cpp -// Purpose: Generic wxPanel implementation. -// Author: Vadim Zeitlin -// Created: 2011-03-20 -// RCS-ID: $Id: wxhead.cpp,v 1.11 2010-04-22 12:44:51 zeitlin Exp $ -// Copyright: (c) 2011 Vadim Zeitlin -// Licence: wxWindows licence -/////////////////////////////////////////////////////////////////////////////// - -// ============================================================================ -// declarations -// ============================================================================ - -// ---------------------------------------------------------------------------- -// headers -// ---------------------------------------------------------------------------- - -// for compilers that support precompilation, includes "wx.h". -#include "wx/wxprec.h" - -#ifdef __BORLANDC__ - #pragma hdrstop -#endif - -#ifndef WX_PRECOMP - #include "wx/dc.h" - #include "wx/panel.h" -#endif // WX_PRECOMP - -#ifdef wxHAS_GENERIC_PANEL - -// ============================================================================ -// implementation -// ============================================================================ - -void wxPanel::DoSetBackgroundBitmap(const wxBitmap& bmp) -{ - m_bitmapBg = bmp; - - if ( m_bitmapBg.IsOk() ) - { - Connect(wxEVT_ERASE_BACKGROUND, - wxEraseEventHandler(wxPanel::OnEraseBackground)); - } - else - { - Disconnect(wxEVT_ERASE_BACKGROUND, - wxEraseEventHandler(wxPanel::OnEraseBackground)); - } -} - -void wxPanel::OnEraseBackground(wxEraseEvent& event) -{ - wxDC& dc = *event.GetDC(); - - const wxSize clientSize = GetClientSize(); - const wxSize bitmapSize = m_bitmapBg.GetSize(); - - for ( int x = 0; x < clientSize.x; x += bitmapSize.x ) - { - for ( int y = 0; y < clientSize.y; y += bitmapSize.y ) - { - dc.DrawBitmap(m_bitmapBg, x, y); - } - } -} - -#endif // wxHAS_GENERIC_PANEL diff --git a/src/msw/panel.cpp b/src/msw/panel.cpp index c502caf9f5..9d30beb7a0 100644 --- a/src/msw/panel.cpp +++ b/src/msw/panel.cpp @@ -24,8 +24,6 @@ #endif #ifndef WX_PRECOMP - #include "wx/bitmap.h" - #include "wx/brush.h" #include "wx/panel.h" #endif // WX_PRECOMP @@ -33,11 +31,6 @@ // implementation // ============================================================================ -wxPanel::~wxPanel() -{ - delete m_backgroundBrush; -} - bool wxPanel::HasTransparentBackground() { for ( wxWindow *win = GetParent(); win; win = win->GetParent() ) @@ -52,21 +45,3 @@ bool wxPanel::HasTransparentBackground() return false; } -void wxPanel::DoSetBackgroundBitmap(const wxBitmap& bmp) -{ - delete m_backgroundBrush; - m_backgroundBrush = bmp.IsOk() ? new wxBrush(bmp) : NULL; - - // Our transparent children should use our background if we have it, - // otherwise try to restore m_inheritBgCol to some reasonable value: true - // if we also have non-default background colour or false otherwise. - m_inheritBgCol = bmp.IsOk() || UseBgCol(); -} - -WXHBRUSH wxPanel::MSWGetCustomBgBrush() -{ - if ( m_backgroundBrush ) - return (WXHBRUSH)m_backgroundBrush->GetResourceHandle(); - - return wxPanelBase::MSWGetCustomBgBrush(); -} -- 2.45.2