From dfba244cbf2d6bef4c81a969d0bc72f824842e29 Mon Sep 17 00:00:00 2001 From: Vadim Zeitlin Date: Mon, 10 Mar 2008 15:50:48 +0000 Subject: [PATCH] added wxNativeContainerWindow and implemented it for wxMSW and wxGTK git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@52427 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- Makefile.in | 49 +++++++++++ build/bakefiles/files.bkl | 3 + build/msw/makefile.bcc | 16 ++++ build/msw/makefile.gcc | 16 ++++ build/msw/makefile.vc | 16 ++++ build/msw/makefile.wat | 16 ++++ build/msw/wx_core.dsp | 39 +++++++++ build/msw/wx_vc7_core.vcproj | 17 ++++ docs/changes.txt | 3 +- include/wx/nativewin.h | 155 +++++++++++++++++++++++++++++++++++ src/gtk/nativewin.cpp | 74 +++++++++++++++++ src/msw/nativewin.cpp | 63 ++++++++++++++ 12 files changed, 466 insertions(+), 1 deletion(-) create mode 100644 include/wx/nativewin.h create mode 100644 src/gtk/nativewin.cpp create mode 100644 src/msw/nativewin.cpp diff --git a/Makefile.in b/Makefile.in index b2ba33f52b..d6e2212c76 100644 --- a/Makefile.in +++ b/Makefile.in @@ -3225,6 +3225,7 @@ COND_USE_GUI_1_ALL_GUI_HEADERS = \ wx/mdi.h \ wx/menu.h \ wx/msgdlg.h \ + wx/nativewin.h \ wx/numdlg.h \ wx/overlay.h \ wx/palette.h \ @@ -4620,6 +4621,7 @@ COND_TOOLKIT_GTK_TOOLKIT_VERSION_2___GUI_SRC_OBJECTS = \ monodll_menu.o \ monodll_mnemonics.o \ monodll_msgdlg.o \ + monodll_nativewin.o \ monodll_notebook.o \ monodll_radiobox.o \ monodll_radiobut.o \ @@ -4831,6 +4833,7 @@ COND_TOOLKIT_MSW___GUI_SRC_OBJECTS = \ monodll_metafile.o \ monodll_msgdlg.o \ monodll_nativdlg.o \ + monodll_nativewin.o \ monodll_notebook.o \ monodll_access.o \ monodll_ownerdrw.o \ @@ -4972,6 +4975,7 @@ COND_TOOLKIT_WINCE___GUI_SRC_OBJECTS = \ monodll_metafile.o \ monodll_msgdlg.o \ monodll_nativdlg.o \ + monodll_nativewin.o \ monodll_notebook.o \ monodll_access.o \ monodll_ownerdrw.o \ @@ -6524,6 +6528,7 @@ COND_TOOLKIT_GTK_TOOLKIT_VERSION_2___GUI_SRC_OBJECTS_1 = \ monolib_menu.o \ monolib_mnemonics.o \ monolib_msgdlg.o \ + monolib_nativewin.o \ monolib_notebook.o \ monolib_radiobox.o \ monolib_radiobut.o \ @@ -6735,6 +6740,7 @@ COND_TOOLKIT_MSW___GUI_SRC_OBJECTS_1 = \ monolib_metafile.o \ monolib_msgdlg.o \ monolib_nativdlg.o \ + monolib_nativewin.o \ monolib_notebook.o \ monolib_access.o \ monolib_ownerdrw.o \ @@ -6876,6 +6882,7 @@ COND_TOOLKIT_WINCE___GUI_SRC_OBJECTS_1 = \ monolib_metafile.o \ monolib_msgdlg.o \ monolib_nativdlg.o \ + monolib_nativewin.o \ monolib_notebook.o \ monolib_access.o \ monolib_ownerdrw.o \ @@ -8721,6 +8728,7 @@ COND_TOOLKIT_GTK_TOOLKIT_VERSION_2___GUI_SRC_OBJECTS_2 = \ coredll_menu.o \ coredll_mnemonics.o \ coredll_msgdlg.o \ + coredll_nativewin.o \ coredll_notebook.o \ coredll_radiobox.o \ coredll_radiobut.o \ @@ -8932,6 +8940,7 @@ COND_TOOLKIT_MSW___GUI_SRC_OBJECTS_2 = \ coredll_metafile.o \ coredll_msgdlg.o \ coredll_nativdlg.o \ + coredll_nativewin.o \ coredll_notebook.o \ coredll_access.o \ coredll_ownerdrw.o \ @@ -9073,6 +9082,7 @@ COND_TOOLKIT_WINCE___GUI_SRC_OBJECTS_2 = \ coredll_metafile.o \ coredll_msgdlg.o \ coredll_nativdlg.o \ + coredll_nativewin.o \ coredll_notebook.o \ coredll_access.o \ coredll_ownerdrw.o \ @@ -10215,6 +10225,7 @@ COND_TOOLKIT_GTK_TOOLKIT_VERSION_2___GUI_SRC_OBJECTS_3 = \ corelib_menu.o \ corelib_mnemonics.o \ corelib_msgdlg.o \ + corelib_nativewin.o \ corelib_notebook.o \ corelib_radiobox.o \ corelib_radiobut.o \ @@ -10426,6 +10437,7 @@ COND_TOOLKIT_MSW___GUI_SRC_OBJECTS_3 = \ corelib_metafile.o \ corelib_msgdlg.o \ corelib_nativdlg.o \ + corelib_nativewin.o \ corelib_notebook.o \ corelib_access.o \ corelib_ownerdrw.o \ @@ -10567,6 +10579,7 @@ COND_TOOLKIT_WINCE___GUI_SRC_OBJECTS_3 = \ corelib_metafile.o \ corelib_msgdlg.o \ corelib_nativdlg.o \ + corelib_nativewin.o \ corelib_notebook.o \ corelib_access.o \ corelib_ownerdrw.o \ @@ -16802,6 +16815,15 @@ monodll_sound_sdl.o: $(srcdir)/src/unix/sound_sdl.cpp $(MONODLL_ODEP) @COND_TOOLKIT_PM_USE_GUI_1_WXUNIV_0@monodll_msgdlg.o: $(srcdir)/src/os2/msgdlg.cpp $(MONODLL_ODEP) @COND_TOOLKIT_PM_USE_GUI_1_WXUNIV_0@ $(CXXC) -c -o $@ $(MONODLL_CXXFLAGS) $(srcdir)/src/os2/msgdlg.cpp +@COND_TOOLKIT_GTK_TOOLKIT_VERSION_2_USE_GUI_1_WXUNIV_0@monodll_nativewin.o: $(srcdir)/src/gtk/nativewin.cpp $(MONODLL_ODEP) +@COND_TOOLKIT_GTK_TOOLKIT_VERSION_2_USE_GUI_1_WXUNIV_0@ $(CXXC) -c -o $@ $(MONODLL_CXXFLAGS) $(srcdir)/src/gtk/nativewin.cpp + +@COND_TOOLKIT_MSW_USE_GUI_1_WXUNIV_0@monodll_nativewin.o: $(srcdir)/src/msw/nativewin.cpp $(MONODLL_ODEP) +@COND_TOOLKIT_MSW_USE_GUI_1_WXUNIV_0@ $(CXXC) -c -o $@ $(MONODLL_CXXFLAGS) $(srcdir)/src/msw/nativewin.cpp + +@COND_TOOLKIT_WINCE_USE_GUI_1_WXUNIV_0@monodll_nativewin.o: $(srcdir)/src/msw/nativewin.cpp $(MONODLL_ODEP) +@COND_TOOLKIT_WINCE_USE_GUI_1_WXUNIV_0@ $(CXXC) -c -o $@ $(MONODLL_CXXFLAGS) $(srcdir)/src/msw/nativewin.cpp + @COND_TOOLKIT_GTK_TOOLKIT_VERSION_2_USE_GUI_1_WXUNIV_0@monodll_notebook.o: $(srcdir)/src/gtk/notebook.cpp $(MONODLL_ODEP) @COND_TOOLKIT_GTK_TOOLKIT_VERSION_2_USE_GUI_1_WXUNIV_0@ $(CXXC) -c -o $@ $(MONODLL_CXXFLAGS) $(srcdir)/src/gtk/notebook.cpp @@ -21308,6 +21330,15 @@ monolib_sound_sdl.o: $(srcdir)/src/unix/sound_sdl.cpp $(MONOLIB_ODEP) @COND_TOOLKIT_PM_USE_GUI_1_WXUNIV_0@monolib_msgdlg.o: $(srcdir)/src/os2/msgdlg.cpp $(MONOLIB_ODEP) @COND_TOOLKIT_PM_USE_GUI_1_WXUNIV_0@ $(CXXC) -c -o $@ $(MONOLIB_CXXFLAGS) $(srcdir)/src/os2/msgdlg.cpp +@COND_TOOLKIT_GTK_TOOLKIT_VERSION_2_USE_GUI_1_WXUNIV_0@monolib_nativewin.o: $(srcdir)/src/gtk/nativewin.cpp $(MONOLIB_ODEP) +@COND_TOOLKIT_GTK_TOOLKIT_VERSION_2_USE_GUI_1_WXUNIV_0@ $(CXXC) -c -o $@ $(MONOLIB_CXXFLAGS) $(srcdir)/src/gtk/nativewin.cpp + +@COND_TOOLKIT_MSW_USE_GUI_1_WXUNIV_0@monolib_nativewin.o: $(srcdir)/src/msw/nativewin.cpp $(MONOLIB_ODEP) +@COND_TOOLKIT_MSW_USE_GUI_1_WXUNIV_0@ $(CXXC) -c -o $@ $(MONOLIB_CXXFLAGS) $(srcdir)/src/msw/nativewin.cpp + +@COND_TOOLKIT_WINCE_USE_GUI_1_WXUNIV_0@monolib_nativewin.o: $(srcdir)/src/msw/nativewin.cpp $(MONOLIB_ODEP) +@COND_TOOLKIT_WINCE_USE_GUI_1_WXUNIV_0@ $(CXXC) -c -o $@ $(MONOLIB_CXXFLAGS) $(srcdir)/src/msw/nativewin.cpp + @COND_TOOLKIT_GTK_TOOLKIT_VERSION_2_USE_GUI_1_WXUNIV_0@monolib_notebook.o: $(srcdir)/src/gtk/notebook.cpp $(MONOLIB_ODEP) @COND_TOOLKIT_GTK_TOOLKIT_VERSION_2_USE_GUI_1_WXUNIV_0@ $(CXXC) -c -o $@ $(MONOLIB_CXXFLAGS) $(srcdir)/src/gtk/notebook.cpp @@ -26408,6 +26439,15 @@ coredll_win32.o: $(srcdir)/src/univ/themes/win32.cpp $(COREDLL_ODEP) @COND_TOOLKIT_PM_USE_GUI_1_WXUNIV_0@coredll_msgdlg.o: $(srcdir)/src/os2/msgdlg.cpp $(COREDLL_ODEP) @COND_TOOLKIT_PM_USE_GUI_1_WXUNIV_0@ $(CXXC) -c -o $@ $(COREDLL_CXXFLAGS) $(srcdir)/src/os2/msgdlg.cpp +@COND_TOOLKIT_GTK_TOOLKIT_VERSION_2_USE_GUI_1_WXUNIV_0@coredll_nativewin.o: $(srcdir)/src/gtk/nativewin.cpp $(COREDLL_ODEP) +@COND_TOOLKIT_GTK_TOOLKIT_VERSION_2_USE_GUI_1_WXUNIV_0@ $(CXXC) -c -o $@ $(COREDLL_CXXFLAGS) $(srcdir)/src/gtk/nativewin.cpp + +@COND_TOOLKIT_MSW_USE_GUI_1_WXUNIV_0@coredll_nativewin.o: $(srcdir)/src/msw/nativewin.cpp $(COREDLL_ODEP) +@COND_TOOLKIT_MSW_USE_GUI_1_WXUNIV_0@ $(CXXC) -c -o $@ $(COREDLL_CXXFLAGS) $(srcdir)/src/msw/nativewin.cpp + +@COND_TOOLKIT_WINCE_USE_GUI_1_WXUNIV_0@coredll_nativewin.o: $(srcdir)/src/msw/nativewin.cpp $(COREDLL_ODEP) +@COND_TOOLKIT_WINCE_USE_GUI_1_WXUNIV_0@ $(CXXC) -c -o $@ $(COREDLL_CXXFLAGS) $(srcdir)/src/msw/nativewin.cpp + @COND_TOOLKIT_GTK_TOOLKIT_VERSION_2_USE_GUI_1_WXUNIV_0@coredll_notebook.o: $(srcdir)/src/gtk/notebook.cpp $(COREDLL_ODEP) @COND_TOOLKIT_GTK_TOOLKIT_VERSION_2_USE_GUI_1_WXUNIV_0@ $(CXXC) -c -o $@ $(COREDLL_CXXFLAGS) $(srcdir)/src/gtk/notebook.cpp @@ -29471,6 +29511,15 @@ corelib_win32.o: $(srcdir)/src/univ/themes/win32.cpp $(CORELIB_ODEP) @COND_TOOLKIT_PM_USE_GUI_1_WXUNIV_0@corelib_msgdlg.o: $(srcdir)/src/os2/msgdlg.cpp $(CORELIB_ODEP) @COND_TOOLKIT_PM_USE_GUI_1_WXUNIV_0@ $(CXXC) -c -o $@ $(CORELIB_CXXFLAGS) $(srcdir)/src/os2/msgdlg.cpp +@COND_TOOLKIT_GTK_TOOLKIT_VERSION_2_USE_GUI_1_WXUNIV_0@corelib_nativewin.o: $(srcdir)/src/gtk/nativewin.cpp $(CORELIB_ODEP) +@COND_TOOLKIT_GTK_TOOLKIT_VERSION_2_USE_GUI_1_WXUNIV_0@ $(CXXC) -c -o $@ $(CORELIB_CXXFLAGS) $(srcdir)/src/gtk/nativewin.cpp + +@COND_TOOLKIT_MSW_USE_GUI_1_WXUNIV_0@corelib_nativewin.o: $(srcdir)/src/msw/nativewin.cpp $(CORELIB_ODEP) +@COND_TOOLKIT_MSW_USE_GUI_1_WXUNIV_0@ $(CXXC) -c -o $@ $(CORELIB_CXXFLAGS) $(srcdir)/src/msw/nativewin.cpp + +@COND_TOOLKIT_WINCE_USE_GUI_1_WXUNIV_0@corelib_nativewin.o: $(srcdir)/src/msw/nativewin.cpp $(CORELIB_ODEP) +@COND_TOOLKIT_WINCE_USE_GUI_1_WXUNIV_0@ $(CXXC) -c -o $@ $(CORELIB_CXXFLAGS) $(srcdir)/src/msw/nativewin.cpp + @COND_TOOLKIT_GTK_TOOLKIT_VERSION_2_USE_GUI_1_WXUNIV_0@corelib_notebook.o: $(srcdir)/src/gtk/notebook.cpp $(CORELIB_ODEP) @COND_TOOLKIT_GTK_TOOLKIT_VERSION_2_USE_GUI_1_WXUNIV_0@ $(CXXC) -c -o $@ $(CORELIB_CXXFLAGS) $(srcdir)/src/gtk/notebook.cpp diff --git a/build/bakefiles/files.bkl b/build/bakefiles/files.bkl index a2402bea67..c49c61dddc 100644 --- a/build/bakefiles/files.bkl +++ b/build/bakefiles/files.bkl @@ -837,6 +837,7 @@ IMPORTANT: please read docs/tech/tn0016.txt before modifying this file! wx/mdi.h wx/menu.h wx/msgdlg.h + wx/nativewin.h wx/numdlg.h wx/overlay.h wx/palette.h @@ -1100,6 +1101,7 @@ IMPORTANT: please read docs/tech/tn0016.txt before modifying this file! src/gtk/menu.cpp src/gtk/mnemonics.cpp src/gtk/msgdlg.cpp + src/gtk/nativewin.cpp src/gtk/notebook.cpp src/gtk/radiobox.cpp src/gtk/radiobut.cpp @@ -1675,6 +1677,7 @@ IMPORTANT: please read docs/tech/tn0016.txt before modifying this file! src/msw/metafile.cpp src/msw/msgdlg.cpp src/msw/nativdlg.cpp + src/msw/nativewin.cpp src/msw/notebook.cpp src/msw/ole/access.cpp src/msw/ownerdrw.cpp diff --git a/build/msw/makefile.bcc b/build/msw/makefile.bcc index c99d09f4f4..4f7686360c 100644 --- a/build/msw/makefile.bcc +++ b/build/msw/makefile.bcc @@ -1552,6 +1552,7 @@ ____CORE_SRC_FILENAMES_OBJECTS = \ $(OBJS)\monodll_metafile.obj \ $(OBJS)\monodll_msgdlg.obj \ $(OBJS)\monodll_nativdlg.obj \ + $(OBJS)\monodll_nativewin.obj \ $(OBJS)\monodll_notebook.obj \ $(OBJS)\monodll_access.obj \ $(OBJS)\monodll_ownerdrw.obj \ @@ -2195,6 +2196,7 @@ ____CORE_SRC_FILENAMES_1_OBJECTS = \ $(OBJS)\monolib_metafile.obj \ $(OBJS)\monolib_msgdlg.obj \ $(OBJS)\monolib_nativdlg.obj \ + $(OBJS)\monolib_nativewin.obj \ $(OBJS)\monolib_notebook.obj \ $(OBJS)\monolib_access.obj \ $(OBJS)\monolib_ownerdrw.obj \ @@ -2753,6 +2755,7 @@ ____CORE_SRC_FILENAMES_2_OBJECTS = \ $(OBJS)\coredll_metafile.obj \ $(OBJS)\coredll_msgdlg.obj \ $(OBJS)\coredll_nativdlg.obj \ + $(OBJS)\coredll_nativewin.obj \ $(OBJS)\coredll_notebook.obj \ $(OBJS)\coredll_access.obj \ $(OBJS)\coredll_ownerdrw.obj \ @@ -3217,6 +3220,7 @@ ____CORE_SRC_FILENAMES_3_OBJECTS = \ $(OBJS)\corelib_metafile.obj \ $(OBJS)\corelib_msgdlg.obj \ $(OBJS)\corelib_nativdlg.obj \ + $(OBJS)\corelib_nativewin.obj \ $(OBJS)\corelib_notebook.obj \ $(OBJS)\corelib_access.obj \ $(OBJS)\corelib_ownerdrw.obj \ @@ -5559,6 +5563,9 @@ $(OBJS)\monodll_msgdlg.obj: ..\..\src\msw\msgdlg.cpp $(OBJS)\monodll_nativdlg.obj: ..\..\src\msw\nativdlg.cpp $(CXX) -q -c -P -o$@ $(MONODLL_CXXFLAGS) ..\..\src\msw\nativdlg.cpp +$(OBJS)\monodll_nativewin.obj: ..\..\src\msw\nativewin.cpp + $(CXX) -q -c -P -o$@ $(MONODLL_CXXFLAGS) ..\..\src\msw\nativewin.cpp + $(OBJS)\monodll_access.obj: ..\..\src\msw\ole\access.cpp $(CXX) -q -c -P -o$@ $(MONODLL_CXXFLAGS) ..\..\src\msw\ole\access.cpp @@ -7665,6 +7672,9 @@ $(OBJS)\monolib_msgdlg.obj: ..\..\src\msw\msgdlg.cpp $(OBJS)\monolib_nativdlg.obj: ..\..\src\msw\nativdlg.cpp $(CXX) -q -c -P -o$@ $(MONOLIB_CXXFLAGS) ..\..\src\msw\nativdlg.cpp +$(OBJS)\monolib_nativewin.obj: ..\..\src\msw\nativewin.cpp + $(CXX) -q -c -P -o$@ $(MONOLIB_CXXFLAGS) ..\..\src\msw\nativewin.cpp + $(OBJS)\monolib_access.obj: ..\..\src\msw\ole\access.cpp $(CXX) -q -c -P -o$@ $(MONOLIB_CXXFLAGS) ..\..\src\msw\ole\access.cpp @@ -10155,6 +10165,9 @@ $(OBJS)\coredll_msgdlg.obj: ..\..\src\msw\msgdlg.cpp $(OBJS)\coredll_nativdlg.obj: ..\..\src\msw\nativdlg.cpp $(CXX) -q -c -P -o$@ $(COREDLL_CXXFLAGS) ..\..\src\msw\nativdlg.cpp +$(OBJS)\coredll_nativewin.obj: ..\..\src\msw\nativewin.cpp + $(CXX) -q -c -P -o$@ $(COREDLL_CXXFLAGS) ..\..\src\msw\nativewin.cpp + $(OBJS)\coredll_access.obj: ..\..\src\msw\ole\access.cpp $(CXX) -q -c -P -o$@ $(COREDLL_CXXFLAGS) ..\..\src\msw\ole\access.cpp @@ -11466,6 +11479,9 @@ $(OBJS)\corelib_msgdlg.obj: ..\..\src\msw\msgdlg.cpp $(OBJS)\corelib_nativdlg.obj: ..\..\src\msw\nativdlg.cpp $(CXX) -q -c -P -o$@ $(CORELIB_CXXFLAGS) ..\..\src\msw\nativdlg.cpp +$(OBJS)\corelib_nativewin.obj: ..\..\src\msw\nativewin.cpp + $(CXX) -q -c -P -o$@ $(CORELIB_CXXFLAGS) ..\..\src\msw\nativewin.cpp + $(OBJS)\corelib_access.obj: ..\..\src\msw\ole\access.cpp $(CXX) -q -c -P -o$@ $(CORELIB_CXXFLAGS) ..\..\src\msw\ole\access.cpp diff --git a/build/msw/makefile.gcc b/build/msw/makefile.gcc index dd2ebce2c8..2ca4fe96f5 100644 --- a/build/msw/makefile.gcc +++ b/build/msw/makefile.gcc @@ -1569,6 +1569,7 @@ ____CORE_SRC_FILENAMES_OBJECTS = \ $(OBJS)\monodll_metafile.o \ $(OBJS)\monodll_msgdlg.o \ $(OBJS)\monodll_nativdlg.o \ + $(OBJS)\monodll_nativewin.o \ $(OBJS)\monodll_notebook.o \ $(OBJS)\monodll_access.o \ $(OBJS)\monodll_ownerdrw.o \ @@ -2218,6 +2219,7 @@ ____CORE_SRC_FILENAMES_1_OBJECTS = \ $(OBJS)\monolib_metafile.o \ $(OBJS)\monolib_msgdlg.o \ $(OBJS)\monolib_nativdlg.o \ + $(OBJS)\monolib_nativewin.o \ $(OBJS)\monolib_notebook.o \ $(OBJS)\monolib_access.o \ $(OBJS)\monolib_ownerdrw.o \ @@ -2792,6 +2794,7 @@ ____CORE_SRC_FILENAMES_2_OBJECTS = \ $(OBJS)\coredll_metafile.o \ $(OBJS)\coredll_msgdlg.o \ $(OBJS)\coredll_nativdlg.o \ + $(OBJS)\coredll_nativewin.o \ $(OBJS)\coredll_notebook.o \ $(OBJS)\coredll_access.o \ $(OBJS)\coredll_ownerdrw.o \ @@ -3264,6 +3267,7 @@ ____CORE_SRC_FILENAMES_3_OBJECTS = \ $(OBJS)\corelib_metafile.o \ $(OBJS)\corelib_msgdlg.o \ $(OBJS)\corelib_nativdlg.o \ + $(OBJS)\corelib_nativewin.o \ $(OBJS)\corelib_notebook.o \ $(OBJS)\corelib_access.o \ $(OBJS)\corelib_ownerdrw.o \ @@ -5701,6 +5705,9 @@ $(OBJS)\monodll_msgdlg.o: ../../src/msw/msgdlg.cpp $(OBJS)\monodll_nativdlg.o: ../../src/msw/nativdlg.cpp $(CXX) -c -o $@ $(MONODLL_CXXFLAGS) $(CPPDEPS) $< +$(OBJS)\monodll_nativewin.o: ../../src/msw/nativewin.cpp + $(CXX) -c -o $@ $(MONODLL_CXXFLAGS) $(CPPDEPS) $< + $(OBJS)\monodll_access.o: ../../src/msw/ole/access.cpp $(CXX) -c -o $@ $(MONODLL_CXXFLAGS) $(CPPDEPS) $< @@ -7909,6 +7916,9 @@ $(OBJS)\monolib_msgdlg.o: ../../src/msw/msgdlg.cpp $(OBJS)\monolib_nativdlg.o: ../../src/msw/nativdlg.cpp $(CXX) -c -o $@ $(MONOLIB_CXXFLAGS) $(CPPDEPS) $< +$(OBJS)\monolib_nativewin.o: ../../src/msw/nativewin.cpp + $(CXX) -c -o $@ $(MONOLIB_CXXFLAGS) $(CPPDEPS) $< + $(OBJS)\monolib_access.o: ../../src/msw/ole/access.cpp $(CXX) -c -o $@ $(MONOLIB_CXXFLAGS) $(CPPDEPS) $< @@ -10501,6 +10511,9 @@ $(OBJS)\coredll_msgdlg.o: ../../src/msw/msgdlg.cpp $(OBJS)\coredll_nativdlg.o: ../../src/msw/nativdlg.cpp $(CXX) -c -o $@ $(COREDLL_CXXFLAGS) $(CPPDEPS) $< +$(OBJS)\coredll_nativewin.o: ../../src/msw/nativewin.cpp + $(CXX) -c -o $@ $(COREDLL_CXXFLAGS) $(CPPDEPS) $< + $(OBJS)\coredll_access.o: ../../src/msw/ole/access.cpp $(CXX) -c -o $@ $(COREDLL_CXXFLAGS) $(CPPDEPS) $< @@ -11912,6 +11925,9 @@ $(OBJS)\corelib_msgdlg.o: ../../src/msw/msgdlg.cpp $(OBJS)\corelib_nativdlg.o: ../../src/msw/nativdlg.cpp $(CXX) -c -o $@ $(CORELIB_CXXFLAGS) $(CPPDEPS) $< +$(OBJS)\corelib_nativewin.o: ../../src/msw/nativewin.cpp + $(CXX) -c -o $@ $(CORELIB_CXXFLAGS) $(CPPDEPS) $< + $(OBJS)\corelib_access.o: ../../src/msw/ole/access.cpp $(CXX) -c -o $@ $(CORELIB_CXXFLAGS) $(CPPDEPS) $< diff --git a/build/msw/makefile.vc b/build/msw/makefile.vc index 704df78cfc..d5a3c2bf91 100644 --- a/build/msw/makefile.vc +++ b/build/msw/makefile.vc @@ -1726,6 +1726,7 @@ ____CORE_SRC_FILENAMES_OBJECTS = \ $(OBJS)\monodll_metafile.obj \ $(OBJS)\monodll_msgdlg.obj \ $(OBJS)\monodll_nativdlg.obj \ + $(OBJS)\monodll_nativewin.obj \ $(OBJS)\monodll_notebook.obj \ $(OBJS)\monodll_access.obj \ $(OBJS)\monodll_ownerdrw.obj \ @@ -2375,6 +2376,7 @@ ____CORE_SRC_FILENAMES_1_OBJECTS = \ $(OBJS)\monolib_metafile.obj \ $(OBJS)\monolib_msgdlg.obj \ $(OBJS)\monolib_nativdlg.obj \ + $(OBJS)\monolib_nativewin.obj \ $(OBJS)\monolib_notebook.obj \ $(OBJS)\monolib_access.obj \ $(OBJS)\monolib_ownerdrw.obj \ @@ -2963,6 +2965,7 @@ ____CORE_SRC_FILENAMES_2_OBJECTS = \ $(OBJS)\coredll_metafile.obj \ $(OBJS)\coredll_msgdlg.obj \ $(OBJS)\coredll_nativdlg.obj \ + $(OBJS)\coredll_nativewin.obj \ $(OBJS)\coredll_notebook.obj \ $(OBJS)\coredll_access.obj \ $(OBJS)\coredll_ownerdrw.obj \ @@ -3433,6 +3436,7 @@ ____CORE_SRC_FILENAMES_3_OBJECTS = \ $(OBJS)\corelib_metafile.obj \ $(OBJS)\corelib_msgdlg.obj \ $(OBJS)\corelib_nativdlg.obj \ + $(OBJS)\corelib_nativewin.obj \ $(OBJS)\corelib_notebook.obj \ $(OBJS)\corelib_access.obj \ $(OBJS)\corelib_ownerdrw.obj \ @@ -5891,6 +5895,9 @@ $(OBJS)\monodll_msgdlg.obj: ..\..\src\msw\msgdlg.cpp $(OBJS)\monodll_nativdlg.obj: ..\..\src\msw\nativdlg.cpp $(CXX) /c /nologo /TP /Fo$@ $(MONODLL_CXXFLAGS) ..\..\src\msw\nativdlg.cpp +$(OBJS)\monodll_nativewin.obj: ..\..\src\msw\nativewin.cpp + $(CXX) /c /nologo /TP /Fo$@ $(MONODLL_CXXFLAGS) ..\..\src\msw\nativewin.cpp + $(OBJS)\monodll_access.obj: ..\..\src\msw\ole\access.cpp $(CXX) /c /nologo /TP /Fo$@ $(MONODLL_CXXFLAGS) ..\..\src\msw\ole\access.cpp @@ -7997,6 +8004,9 @@ $(OBJS)\monolib_msgdlg.obj: ..\..\src\msw\msgdlg.cpp $(OBJS)\monolib_nativdlg.obj: ..\..\src\msw\nativdlg.cpp $(CXX) /c /nologo /TP /Fo$@ $(MONOLIB_CXXFLAGS) ..\..\src\msw\nativdlg.cpp +$(OBJS)\monolib_nativewin.obj: ..\..\src\msw\nativewin.cpp + $(CXX) /c /nologo /TP /Fo$@ $(MONOLIB_CXXFLAGS) ..\..\src\msw\nativewin.cpp + $(OBJS)\monolib_access.obj: ..\..\src\msw\ole\access.cpp $(CXX) /c /nologo /TP /Fo$@ $(MONOLIB_CXXFLAGS) ..\..\src\msw\ole\access.cpp @@ -10487,6 +10497,9 @@ $(OBJS)\coredll_msgdlg.obj: ..\..\src\msw\msgdlg.cpp $(OBJS)\coredll_nativdlg.obj: ..\..\src\msw\nativdlg.cpp $(CXX) /c /nologo /TP /Fo$@ $(COREDLL_CXXFLAGS) ..\..\src\msw\nativdlg.cpp +$(OBJS)\coredll_nativewin.obj: ..\..\src\msw\nativewin.cpp + $(CXX) /c /nologo /TP /Fo$@ $(COREDLL_CXXFLAGS) ..\..\src\msw\nativewin.cpp + $(OBJS)\coredll_access.obj: ..\..\src\msw\ole\access.cpp $(CXX) /c /nologo /TP /Fo$@ $(COREDLL_CXXFLAGS) ..\..\src\msw\ole\access.cpp @@ -11798,6 +11811,9 @@ $(OBJS)\corelib_msgdlg.obj: ..\..\src\msw\msgdlg.cpp $(OBJS)\corelib_nativdlg.obj: ..\..\src\msw\nativdlg.cpp $(CXX) /c /nologo /TP /Fo$@ $(CORELIB_CXXFLAGS) ..\..\src\msw\nativdlg.cpp +$(OBJS)\corelib_nativewin.obj: ..\..\src\msw\nativewin.cpp + $(CXX) /c /nologo /TP /Fo$@ $(CORELIB_CXXFLAGS) ..\..\src\msw\nativewin.cpp + $(OBJS)\corelib_access.obj: ..\..\src\msw\ole\access.cpp $(CXX) /c /nologo /TP /Fo$@ $(CORELIB_CXXFLAGS) ..\..\src\msw\ole\access.cpp diff --git a/build/msw/makefile.wat b/build/msw/makefile.wat index 3f82c465db..d0569b7a58 100644 --- a/build/msw/makefile.wat +++ b/build/msw/makefile.wat @@ -288,6 +288,7 @@ ____CORE_SRC_FILENAMES_OBJECTS = & $(OBJS)\monodll_metafile.obj & $(OBJS)\monodll_msgdlg.obj & $(OBJS)\monodll_nativdlg.obj & + $(OBJS)\monodll_nativewin.obj & $(OBJS)\monodll_notebook.obj & $(OBJS)\monodll_access.obj & $(OBJS)\monodll_ownerdrw.obj & @@ -942,6 +943,7 @@ ____CORE_SRC_FILENAMES_1_OBJECTS = & $(OBJS)\monolib_metafile.obj & $(OBJS)\monolib_msgdlg.obj & $(OBJS)\monolib_nativdlg.obj & + $(OBJS)\monolib_nativewin.obj & $(OBJS)\monolib_notebook.obj & $(OBJS)\monolib_access.obj & $(OBJS)\monolib_ownerdrw.obj & @@ -1527,6 +1529,7 @@ ____CORE_SRC_FILENAMES_2_OBJECTS = & $(OBJS)\coredll_metafile.obj & $(OBJS)\coredll_msgdlg.obj & $(OBJS)\coredll_nativdlg.obj & + $(OBJS)\coredll_nativewin.obj & $(OBJS)\coredll_notebook.obj & $(OBJS)\coredll_access.obj & $(OBJS)\coredll_ownerdrw.obj & @@ -2001,6 +2004,7 @@ ____CORE_SRC_FILENAMES_3_OBJECTS = & $(OBJS)\corelib_metafile.obj & $(OBJS)\corelib_msgdlg.obj & $(OBJS)\corelib_nativdlg.obj & + $(OBJS)\corelib_nativewin.obj & $(OBJS)\corelib_notebook.obj & $(OBJS)\corelib_access.obj & $(OBJS)\corelib_ownerdrw.obj & @@ -5933,6 +5937,9 @@ $(OBJS)\monodll_msgdlg.obj : .AUTODEPEND ..\..\src\msw\msgdlg.cpp $(OBJS)\monodll_nativdlg.obj : .AUTODEPEND ..\..\src\msw\nativdlg.cpp $(CXX) -bt=nt -zq -fo=$^@ $(MONODLL_CXXFLAGS) $< +$(OBJS)\monodll_nativewin.obj : .AUTODEPEND ..\..\src\msw\nativewin.cpp + $(CXX) -bt=nt -zq -fo=$^@ $(MONODLL_CXXFLAGS) $< + $(OBJS)\monodll_access.obj : .AUTODEPEND ..\..\src\msw\ole\access.cpp $(CXX) -bt=nt -zq -fo=$^@ $(MONODLL_CXXFLAGS) $< @@ -8141,6 +8148,9 @@ $(OBJS)\monolib_msgdlg.obj : .AUTODEPEND ..\..\src\msw\msgdlg.cpp $(OBJS)\monolib_nativdlg.obj : .AUTODEPEND ..\..\src\msw\nativdlg.cpp $(CXX) -bt=nt -zq -fo=$^@ $(MONOLIB_CXXFLAGS) $< +$(OBJS)\monolib_nativewin.obj : .AUTODEPEND ..\..\src\msw\nativewin.cpp + $(CXX) -bt=nt -zq -fo=$^@ $(MONOLIB_CXXFLAGS) $< + $(OBJS)\monolib_access.obj : .AUTODEPEND ..\..\src\msw\ole\access.cpp $(CXX) -bt=nt -zq -fo=$^@ $(MONOLIB_CXXFLAGS) $< @@ -10733,6 +10743,9 @@ $(OBJS)\coredll_msgdlg.obj : .AUTODEPEND ..\..\src\msw\msgdlg.cpp $(OBJS)\coredll_nativdlg.obj : .AUTODEPEND ..\..\src\msw\nativdlg.cpp $(CXX) -bt=nt -zq -fo=$^@ $(COREDLL_CXXFLAGS) $< +$(OBJS)\coredll_nativewin.obj : .AUTODEPEND ..\..\src\msw\nativewin.cpp + $(CXX) -bt=nt -zq -fo=$^@ $(COREDLL_CXXFLAGS) $< + $(OBJS)\coredll_access.obj : .AUTODEPEND ..\..\src\msw\ole\access.cpp $(CXX) -bt=nt -zq -fo=$^@ $(COREDLL_CXXFLAGS) $< @@ -12144,6 +12157,9 @@ $(OBJS)\corelib_msgdlg.obj : .AUTODEPEND ..\..\src\msw\msgdlg.cpp $(OBJS)\corelib_nativdlg.obj : .AUTODEPEND ..\..\src\msw\nativdlg.cpp $(CXX) -bt=nt -zq -fo=$^@ $(CORELIB_CXXFLAGS) $< +$(OBJS)\corelib_nativewin.obj : .AUTODEPEND ..\..\src\msw\nativewin.cpp + $(CXX) -bt=nt -zq -fo=$^@ $(CORELIB_CXXFLAGS) $< + $(OBJS)\corelib_access.obj : .AUTODEPEND ..\..\src\msw\ole\access.cpp $(CXX) -bt=nt -zq -fo=$^@ $(CORELIB_CXXFLAGS) $< diff --git a/build/msw/wx_core.dsp b/build/msw/wx_core.dsp index 2da4dba8e1..af4ace255a 100644 --- a/build/msw/wx_core.dsp +++ b/build/msw/wx_core.dsp @@ -1777,6 +1777,41 @@ SOURCE=..\..\src\msw\nativdlg.cpp !ELSEIF "$(CFG)" == "core - Win32 Debug" +!ENDIF + +# End Source File +# Begin Source File + +SOURCE=..\..\src\msw\nativewin.cpp + +!IF "$(CFG)" == "core - Win32 DLL Universal Release" + +# PROP Exclude_From_Build 1 + +!ELSEIF "$(CFG)" == "core - Win32 DLL Universal Debug" + +# PROP Exclude_From_Build 1 + +!ELSEIF "$(CFG)" == "core - Win32 DLL Release" + + +!ELSEIF "$(CFG)" == "core - Win32 DLL Debug" + + +!ELSEIF "$(CFG)" == "core - Win32 Universal Release" + +# PROP Exclude_From_Build 1 + +!ELSEIF "$(CFG)" == "core - Win32 Universal Debug" + +# PROP Exclude_From_Build 1 + +!ELSEIF "$(CFG)" == "core - Win32 Release" + + +!ELSEIF "$(CFG)" == "core - Win32 Debug" + + !ENDIF # End Source File @@ -6056,6 +6091,10 @@ SOURCE=..\..\include\wx\msgdlg.h # End Source File # Begin Source File +SOURCE=..\..\include\wx\nativewin.h +# End Source File +# Begin Source File + SOURCE=..\..\include\wx\nonownedwnd.h # End Source File # Begin Source File diff --git a/build/msw/wx_vc7_core.vcproj b/build/msw/wx_vc7_core.vcproj index 7fede62624..25241e418a 100644 --- a/build/msw/wx_vc7_core.vcproj +++ b/build/msw/wx_vc7_core.vcproj @@ -1333,6 +1333,21 @@ Name="Universal Debug|Win32" ExcludedFromBuild="true"/> + + + + + + + +// Licence: wxWindows licence +/////////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_NATIVEWIN_H_ +#define _WX_NATIVEWIN_H_ + +#include "wx/toplevel.h" + +// this symbol can be tested in the user code to see if the current wx port has +// support for creating wxNativeContainerWindow from native windows +// +// be optimistic by default, we undefine it below if we don't have it finally +#define wxHAS_NATIVE_CONTAINER_WINDOW + +// we define the following typedefs for each of the platform supporting native +// windows wrapping: +// +// - wxNativeContainerWindowHandle is the toolkit-level handle of the native +// window, i.e. HWND/GdkWindow*/NSWindow +// +// - wxNativeContainerWindowId is the lowest level identifier of the native +// window, i.e. HWND/GdkNativeWindow/NSWindow (so it's the same as above for +// all platforms except GTK where we also can work with Window/XID) +// +// later we'll also have +// +// - wxNativeWindowHandle for child windows (which will be wrapped by +// wxNativeWindow class), it is HWND/GtkWidget*/ControlRef +#if defined(__WXMSW__) + #include "wx/msw/wrapwin.h" + + typedef HWND wxNativeContainerWindowId; + typedef HWND wxNativeContainerWindowHandle; +#elif defined(__WXGTK__) + #include + + typedef GdkNativeWindow wxNativeContainerWindowId; + typedef GdkWindow *wxNativeContainerWindowHandle; +#else + // no support for using native windows under this platform yet + #undef wxHAS_NATIVE_CONTAINER_WINDOW +#endif + +#ifdef wxHAS_NATIVE_CONTAINER_WINDOW + +// ---------------------------------------------------------------------------- +// wxNativeContainerWindow: can be used for creating other wxWindows inside it +// ---------------------------------------------------------------------------- + +class WXDLLIMPEXP_CORE wxNativeContainerWindow : public wxTopLevelWindow +{ +public: + // default ctor, call Create() later + wxNativeContainerWindow() { } + + // create a window from an existing native window handle + // + // use GetHandle() to check if the creation was successful, it will return + // 0 if the handle was invalid + wxNativeContainerWindow(wxNativeContainerWindowHandle handle) + { + Create(handle); + } + + // same as ctor above but with a return code + bool Create(wxNativeContainerWindowHandle handle); + +#if defined(__WXGTK__) + // this is a convenient ctor for wxGTK applications which can also create + // the objects of this class from the really native window handles and not + // only the GdkWindow objects + // + // wxNativeContainerWindowId is Window (i.e. an XID, i.e. an int) under X11 + // (when GDK_WINDOWING_X11 is defined) or HWND under Win32 + wxNativeContainerWindow(wxNativeContainerWindowId winid) { Create(winid); } + + bool Create(wxNativeContainerWindowId winid); +#endif // wxGTK + + // unlike for the normal windows, dtor will not destroy the native window + // as it normally doesn't belong to us + virtual ~wxNativeContainerWindow(); + + + // provide (trivial) implementation of the base class pure virtuals + virtual void SetTitle(const wxString& WXUNUSED(title)) + { + wxFAIL_MSG( "not implemented for native windows" ); + } + + virtual wxString GetTitle() const + { + wxFAIL_MSG( "not implemented for native windows" ); + + return wxString(); + } + + virtual void Maximize(bool WXUNUSED(maximize) = true) + { + wxFAIL_MSG( "not implemented for native windows" ); + } + + virtual bool IsMaximized() const + { + wxFAIL_MSG( "not implemented for native windows" ); + + return false; + } + + virtual void Iconize(bool WXUNUSED(iconize) = true) + { + wxFAIL_MSG( "not implemented for native windows" ); + } + + virtual bool IsIconized() const + { + // this is called by wxGTK implementation so don't assert + return false; + } + + virtual void Restore() + { + wxFAIL_MSG( "not implemented for native windows" ); + } + + virtual bool ShowFullScreen(bool WXUNUSED(show), + long WXUNUSED(style) = wxFULLSCREEN_ALL) + { + wxFAIL_MSG( "not implemented for native windows" ); + + return false; + } + + virtual bool IsFullScreen() const + { + wxFAIL_MSG( "not implemented for native windows" ); + + return false; + } + +private: + DECLARE_NO_COPY_CLASS(wxNativeContainerWindow) +}; + +#endif // wxHAS_NATIVE_CONTAINER_WINDOW + +#endif // _WX_NATIVEWIN_H_ + diff --git a/src/gtk/nativewin.cpp b/src/gtk/nativewin.cpp new file mode 100644 index 0000000000..5e56224abe --- /dev/null +++ b/src/gtk/nativewin.cpp @@ -0,0 +1,74 @@ +/////////////////////////////////////////////////////////////////////////////// +// Name: src/gtk/nativewin.cpp +// Purpose: wxNativeWindow implementation +// Author: Vadim Zeitlin +// Created: 2008-03-05 +// RCS-ID: $Id$ +// Copyright: (c) 2008 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 +#endif // WX_PRECOMP + +#include "wx/nativewin.h" + +#include + +// ============================================================================ +// implementation +// ============================================================================ + +bool wxNativeContainerWindow::Create(wxNativeContainerWindowHandle *win) +{ + if ( !wxTopLevelWindow::Create(NULL, wxID_ANY, "") ) + return false; + + // we need to realize the window first before reparenting it + gtk_widget_realize(m_widget); + gdk_window_reparent(m_widget->window, win, 0, 0); + + // we should be initially visible as we suppose that the native window we + // wrap is (we could use gdk_window_is_visible() to test for this but this + // doesn't make much sense unless we also react to visibility changes, so + // just suppose it's always shown for now) + Show(); +} + +bool wxNativeContainerWindow::Create(wxNativeContainerWindowId anid) +{ + bool rc; + GdkWindow * const win = gdk_window_foreign_new(anid); + if ( win ) + { + rc = Create(win); + g_object_unref(win); + } + else // invalid native window id + { + rc = false; + } + + return rc; +} + +wxNativeContainerWindow::~wxNativeContainerWindow() +{ + // there doesn't seem to be anything to do here, GTK+ seems to handle + // everything correctly due to its use of reference counting +} diff --git a/src/msw/nativewin.cpp b/src/msw/nativewin.cpp new file mode 100644 index 0000000000..1f0ddeca87 --- /dev/null +++ b/src/msw/nativewin.cpp @@ -0,0 +1,63 @@ +/////////////////////////////////////////////////////////////////////////////// +// Name: src/msw/nativewin.cpp +// Purpose: wxNativeWindow implementation +// Author: Vadim Zeitlin +// Created: 2008-03-05 +// RCS-ID: $Id$ +// Copyright: (c) 2008 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 +#endif // WX_PRECOMP + +#include "wx/nativewin.h" +#include "wx/msw/private.h" + +// ============================================================================ +// implementation +// ============================================================================ + +bool wxNativeContainerWindow::Create(wxNativeContainerWindowHandle hwnd) +{ + if ( !::IsWindow(hwnd) ) + { + // strictly speaking, the fact that IsWindow() returns true doesn't + // mean that the window handle is valid -- it could be being deleted + // right now, for example + // + // but if it returns false, the handle is definitely invalid + return false; + } + + // make this HWND really a wxWindow + SubclassWin(hwnd); + + // inherit the other attributes we can from the native HWND + AdoptAttributesFromHWND(); + + return true; +} + +wxNativeContainerWindow::~wxNativeContainerWindow() +{ + // prevent the base class dtor from destroying the window, it doesn't + // belong to us so we should leave it alive + DissociateHandle(); +} + -- 2.45.2