diff --git a/Makefile.in b/Makefile.in index dc1879b412..e603897022 100644 --- a/Makefile.in +++ b/Makefile.in @@ -3129,6 +3129,7 @@ COND_TOOLKIT_MSW_GUI_HDR = \ wx/msw/toplevel.h \ wx/msw/treectrl.h \ wx/msw/window.h \ + wx/msw/rt/utils.h \ wx/msw/checklst.h \ wx/msw/fdrepdlg.h \ wx/msw/fontdlg.h \ @@ -4912,6 +4913,7 @@ COND_TOOLKIT_MSW___LOWLEVEL_SRC_OBJECTS = \ monodll_uxtheme.o \ monodll_msw_window.o \ monodll_graphicsd2d.o \ + monodll_utilsrt.o \ monodll_helpchm.o \ monodll_helpwin.o \ monodll_automtn.o \ @@ -5614,6 +5616,7 @@ COND_TOOLKIT_MSW___LOWLEVEL_SRC_OBJECTS_1 = \ monodll_uxtheme.o \ monodll_msw_window.o \ monodll_graphicsd2d.o \ + monodll_utilsrt.o \ monodll_helpchm.o \ monodll_helpwin.o \ monodll_automtn.o \ @@ -6912,6 +6915,7 @@ COND_TOOLKIT_MSW___LOWLEVEL_SRC_OBJECTS_2 = \ monolib_uxtheme.o \ monolib_msw_window.o \ monolib_graphicsd2d.o \ + monolib_utilsrt.o \ monolib_helpchm.o \ monolib_helpwin.o \ monolib_automtn.o \ @@ -7614,6 +7618,7 @@ COND_TOOLKIT_MSW___LOWLEVEL_SRC_OBJECTS_3 = \ monolib_uxtheme.o \ monolib_msw_window.o \ monolib_graphicsd2d.o \ + monolib_utilsrt.o \ monolib_helpchm.o \ monolib_helpwin.o \ monolib_automtn.o \ @@ -9055,6 +9060,7 @@ COND_TOOLKIT_MSW___LOWLEVEL_SRC_OBJECTS_4 = \ coredll_uxtheme.o \ coredll_msw_window.o \ coredll_graphicsd2d.o \ + coredll_utilsrt.o \ coredll_helpchm.o \ coredll_helpwin.o \ coredll_automtn.o \ @@ -9757,6 +9763,7 @@ COND_TOOLKIT_MSW___LOWLEVEL_SRC_OBJECTS_5 = \ coredll_uxtheme.o \ coredll_msw_window.o \ coredll_graphicsd2d.o \ + coredll_utilsrt.o \ coredll_helpchm.o \ coredll_helpwin.o \ coredll_automtn.o \ @@ -10520,6 +10527,7 @@ COND_TOOLKIT_MSW___LOWLEVEL_SRC_OBJECTS_6 = \ corelib_uxtheme.o \ corelib_msw_window.o \ corelib_graphicsd2d.o \ + corelib_utilsrt.o \ corelib_helpchm.o \ corelib_helpwin.o \ corelib_automtn.o \ @@ -11222,6 +11230,7 @@ COND_TOOLKIT_MSW___LOWLEVEL_SRC_OBJECTS_7 = \ corelib_uxtheme.o \ corelib_msw_window.o \ corelib_graphicsd2d.o \ + corelib_utilsrt.o \ corelib_helpchm.o \ corelib_helpwin.o \ corelib_automtn.o \ @@ -17982,6 +17991,9 @@ monodll_sound_sdl.o: $(srcdir)/src/unix/sound_sdl.cpp $(MONODLL_ODEP) @COND_TOOLKIT_MSW_USE_GUI_1@monodll_graphicsd2d.o: $(srcdir)/src/msw/graphicsd2d.cpp $(MONODLL_ODEP) @COND_TOOLKIT_MSW_USE_GUI_1@ $(CXXC) -c -o $@ $(MONODLL_CXXFLAGS) $(srcdir)/src/msw/graphicsd2d.cpp +@COND_TOOLKIT_MSW_USE_GUI_1@monodll_utilsrt.o: $(srcdir)/src/msw/rt/utilsrt.cpp $(MONODLL_ODEP) +@COND_TOOLKIT_MSW_USE_GUI_1@ $(CXXC) -c -o $@ $(MONODLL_CXXFLAGS) $(srcdir)/src/msw/rt/utilsrt.cpp + @COND_TOOLKIT_MSW_USE_GUI_1@monodll_helpchm.o: $(srcdir)/src/msw/helpchm.cpp $(MONODLL_ODEP) @COND_TOOLKIT_MSW_USE_GUI_1@ $(CXXC) -c -o $@ $(MONODLL_CXXFLAGS) $(srcdir)/src/msw/helpchm.cpp @@ -22791,6 +22803,9 @@ monolib_sound_sdl.o: $(srcdir)/src/unix/sound_sdl.cpp $(MONOLIB_ODEP) @COND_TOOLKIT_MSW_USE_GUI_1@monolib_graphicsd2d.o: $(srcdir)/src/msw/graphicsd2d.cpp $(MONOLIB_ODEP) @COND_TOOLKIT_MSW_USE_GUI_1@ $(CXXC) -c -o $@ $(MONOLIB_CXXFLAGS) $(srcdir)/src/msw/graphicsd2d.cpp +@COND_TOOLKIT_MSW_USE_GUI_1@monolib_utilsrt.o: $(srcdir)/src/msw/rt/utilsrt.cpp $(MONOLIB_ODEP) +@COND_TOOLKIT_MSW_USE_GUI_1@ $(CXXC) -c -o $@ $(MONOLIB_CXXFLAGS) $(srcdir)/src/msw/rt/utilsrt.cpp + @COND_TOOLKIT_MSW_USE_GUI_1@monolib_helpchm.o: $(srcdir)/src/msw/helpchm.cpp $(MONOLIB_ODEP) @COND_TOOLKIT_MSW_USE_GUI_1@ $(CXXC) -c -o $@ $(MONOLIB_CXXFLAGS) $(srcdir)/src/msw/helpchm.cpp @@ -27660,6 +27675,9 @@ coredll_win32.o: $(srcdir)/src/univ/themes/win32.cpp $(COREDLL_ODEP) @COND_TOOLKIT_MSW_USE_GUI_1@coredll_graphicsd2d.o: $(srcdir)/src/msw/graphicsd2d.cpp $(COREDLL_ODEP) @COND_TOOLKIT_MSW_USE_GUI_1@ $(CXXC) -c -o $@ $(COREDLL_CXXFLAGS) $(srcdir)/src/msw/graphicsd2d.cpp +@COND_TOOLKIT_MSW_USE_GUI_1@coredll_utilsrt.o: $(srcdir)/src/msw/rt/utilsrt.cpp $(COREDLL_ODEP) +@COND_TOOLKIT_MSW_USE_GUI_1@ $(CXXC) -c -o $@ $(COREDLL_CXXFLAGS) $(srcdir)/src/msw/rt/utilsrt.cpp + @COND_TOOLKIT_MSW_USE_GUI_1@coredll_helpchm.o: $(srcdir)/src/msw/helpchm.cpp $(COREDLL_ODEP) @COND_TOOLKIT_MSW_USE_GUI_1@ $(CXXC) -c -o $@ $(COREDLL_CXXFLAGS) $(srcdir)/src/msw/helpchm.cpp @@ -31044,6 +31062,9 @@ corelib_win32.o: $(srcdir)/src/univ/themes/win32.cpp $(CORELIB_ODEP) @COND_TOOLKIT_MSW_USE_GUI_1@corelib_graphicsd2d.o: $(srcdir)/src/msw/graphicsd2d.cpp $(CORELIB_ODEP) @COND_TOOLKIT_MSW_USE_GUI_1@ $(CXXC) -c -o $@ $(CORELIB_CXXFLAGS) $(srcdir)/src/msw/graphicsd2d.cpp +@COND_TOOLKIT_MSW_USE_GUI_1@corelib_utilsrt.o: $(srcdir)/src/msw/rt/utilsrt.cpp $(CORELIB_ODEP) +@COND_TOOLKIT_MSW_USE_GUI_1@ $(CXXC) -c -o $@ $(CORELIB_CXXFLAGS) $(srcdir)/src/msw/rt/utilsrt.cpp + @COND_TOOLKIT_MSW_USE_GUI_1@corelib_helpchm.o: $(srcdir)/src/msw/helpchm.cpp $(CORELIB_ODEP) @COND_TOOLKIT_MSW_USE_GUI_1@ $(CXXC) -c -o $@ $(CORELIB_CXXFLAGS) $(srcdir)/src/msw/helpchm.cpp diff --git a/build/bakefiles/files.bkl b/build/bakefiles/files.bkl index 073c850a02..60c45487eb 100644 --- a/build/bakefiles/files.bkl +++ b/build/bakefiles/files.bkl @@ -1895,6 +1895,7 @@ IMPORTANT: please read docs/tech/tn0016.txt before modifying this file! src/msw/uxtheme.cpp src/msw/window.cpp src/msw/graphicsd2d.cpp + src/msw/rt/utilsrt.cpp wx/msw/nonownedwnd.h @@ -2075,6 +2076,7 @@ IMPORTANT: please read docs/tech/tn0016.txt before modifying this file! wx/msw/toplevel.h wx/msw/treectrl.h wx/msw/window.h + wx/msw/rt/utils.h diff --git a/build/files b/build/files index 7a741064e2..8de7b237de 100644 --- a/build/files +++ b/build/files @@ -1550,6 +1550,7 @@ MSW_LOWLEVEL_SRC = src/msw/printwin.cpp src/msw/region.cpp src/msw/renderer.cpp + src/msw/rt/utilsrt.cpp src/msw/settings.cpp src/msw/textmeasure.cpp src/msw/tooltip.cpp @@ -1716,6 +1717,7 @@ MSW_HDR = wx/msw/region.h wx/msw/rcdefs.h wx/msw/richmsgdlg.h + wx/msw/rt/utils.h wx/msw/scrolbar.h wx/msw/slider.h wx/msw/spinbutt.h diff --git a/build/msw/makefile.bcc b/build/msw/makefile.bcc index 70f891216e..b991f9722e 100644 --- a/build/msw/makefile.bcc +++ b/build/msw/makefile.bcc @@ -1824,6 +1824,7 @@ ____CORE_SRC_FILENAMES_OBJECTS = \ $(OBJS)\monodll_uxtheme.obj \ $(OBJS)\monodll_window.obj \ $(OBJS)\monodll_graphicsd2d.obj \ + $(OBJS)\monodll_utilsrt.obj \ $(OBJS)\monodll_helpchm.obj \ $(OBJS)\monodll_helpwin.obj \ $(OBJS)\monodll_automtn.obj \ @@ -2110,6 +2111,7 @@ ____CORE_SRC_FILENAMES_OBJECTS = \ $(OBJS)\monodll_uxtheme.obj \ $(OBJS)\monodll_window.obj \ $(OBJS)\monodll_graphicsd2d.obj \ + $(OBJS)\monodll_utilsrt.obj \ $(OBJS)\monodll_helpchm.obj \ $(OBJS)\monodll_helpwin.obj \ $(OBJS)\monodll_automtn.obj \ @@ -2648,6 +2650,7 @@ ____CORE_SRC_FILENAMES_1_OBJECTS = \ $(OBJS)\monolib_uxtheme.obj \ $(OBJS)\monolib_window.obj \ $(OBJS)\monolib_graphicsd2d.obj \ + $(OBJS)\monolib_utilsrt.obj \ $(OBJS)\monolib_helpchm.obj \ $(OBJS)\monolib_helpwin.obj \ $(OBJS)\monolib_automtn.obj \ @@ -2934,6 +2937,7 @@ ____CORE_SRC_FILENAMES_1_OBJECTS = \ $(OBJS)\monolib_uxtheme.obj \ $(OBJS)\monolib_window.obj \ $(OBJS)\monolib_graphicsd2d.obj \ + $(OBJS)\monolib_utilsrt.obj \ $(OBJS)\monolib_helpchm.obj \ $(OBJS)\monolib_helpwin.obj \ $(OBJS)\monolib_automtn.obj \ @@ -3345,6 +3349,7 @@ ____CORE_SRC_FILENAMES_2_OBJECTS = \ $(OBJS)\coredll_uxtheme.obj \ $(OBJS)\coredll_window.obj \ $(OBJS)\coredll_graphicsd2d.obj \ + $(OBJS)\coredll_utilsrt.obj \ $(OBJS)\coredll_helpchm.obj \ $(OBJS)\coredll_helpwin.obj \ $(OBJS)\coredll_automtn.obj \ @@ -3631,6 +3636,7 @@ ____CORE_SRC_FILENAMES_2_OBJECTS = \ $(OBJS)\coredll_uxtheme.obj \ $(OBJS)\coredll_window.obj \ $(OBJS)\coredll_graphicsd2d.obj \ + $(OBJS)\coredll_utilsrt.obj \ $(OBJS)\coredll_helpchm.obj \ $(OBJS)\coredll_helpwin.obj \ $(OBJS)\coredll_automtn.obj \ @@ -3913,6 +3919,7 @@ ____CORE_SRC_FILENAMES_3_OBJECTS = \ $(OBJS)\corelib_uxtheme.obj \ $(OBJS)\corelib_window.obj \ $(OBJS)\corelib_graphicsd2d.obj \ + $(OBJS)\corelib_utilsrt.obj \ $(OBJS)\corelib_helpchm.obj \ $(OBJS)\corelib_helpwin.obj \ $(OBJS)\corelib_automtn.obj \ @@ -4199,6 +4206,7 @@ ____CORE_SRC_FILENAMES_3_OBJECTS = \ $(OBJS)\corelib_uxtheme.obj \ $(OBJS)\corelib_window.obj \ $(OBJS)\corelib_graphicsd2d.obj \ + $(OBJS)\corelib_utilsrt.obj \ $(OBJS)\corelib_helpchm.obj \ $(OBJS)\corelib_helpwin.obj \ $(OBJS)\corelib_automtn.obj \ @@ -7764,6 +7772,11 @@ $(OBJS)\monodll_graphicsd2d.obj: ..\..\src\msw\graphicsd2d.cpp $(CXX) -q -c -P -o$@ $(MONODLL_CXXFLAGS) ..\..\src\msw\graphicsd2d.cpp !endif +!if "$(USE_GUI)" == "1" +$(OBJS)\monodll_utilsrt.obj: ..\..\src\msw\rt\utilsrt.cpp + $(CXX) -q -c -P -o$@ $(MONODLL_CXXFLAGS) ..\..\src\msw\rt\utilsrt.cpp +!endif + !if "$(USE_GUI)" == "1" $(OBJS)\monodll_helpchm.obj: ..\..\src\msw\helpchm.cpp $(CXX) -q -c -P -o$@ $(MONODLL_CXXFLAGS) ..\..\src\msw\helpchm.cpp @@ -10279,6 +10292,11 @@ $(OBJS)\monolib_graphicsd2d.obj: ..\..\src\msw\graphicsd2d.cpp $(CXX) -q -c -P -o$@ $(MONOLIB_CXXFLAGS) ..\..\src\msw\graphicsd2d.cpp !endif +!if "$(USE_GUI)" == "1" +$(OBJS)\monolib_utilsrt.obj: ..\..\src\msw\rt\utilsrt.cpp + $(CXX) -q -c -P -o$@ $(MONOLIB_CXXFLAGS) ..\..\src\msw\rt\utilsrt.cpp +!endif + !if "$(USE_GUI)" == "1" $(OBJS)\monolib_helpchm.obj: ..\..\src\msw\helpchm.cpp $(CXX) -q -c -P -o$@ $(MONOLIB_CXXFLAGS) ..\..\src\msw\helpchm.cpp @@ -12728,6 +12746,11 @@ $(OBJS)\coredll_graphicsd2d.obj: ..\..\src\msw\graphicsd2d.cpp $(CXX) -q -c -P -o$@ $(COREDLL_CXXFLAGS) ..\..\src\msw\graphicsd2d.cpp !endif +!if "$(USE_GUI)" == "1" +$(OBJS)\coredll_utilsrt.obj: ..\..\src\msw\rt\utilsrt.cpp + $(CXX) -q -c -P -o$@ $(COREDLL_CXXFLAGS) ..\..\src\msw\rt\utilsrt.cpp +!endif + !if "$(USE_GUI)" == "1" $(OBJS)\coredll_helpchm.obj: ..\..\src\msw\helpchm.cpp $(CXX) -q -c -P -o$@ $(COREDLL_CXXFLAGS) ..\..\src\msw\helpchm.cpp @@ -14197,6 +14220,11 @@ $(OBJS)\corelib_graphicsd2d.obj: ..\..\src\msw\graphicsd2d.cpp $(CXX) -q -c -P -o$@ $(CORELIB_CXXFLAGS) ..\..\src\msw\graphicsd2d.cpp !endif +!if "$(USE_GUI)" == "1" +$(OBJS)\corelib_utilsrt.obj: ..\..\src\msw\rt\utilsrt.cpp + $(CXX) -q -c -P -o$@ $(CORELIB_CXXFLAGS) ..\..\src\msw\rt\utilsrt.cpp +!endif + !if "$(USE_GUI)" == "1" $(OBJS)\corelib_helpchm.obj: ..\..\src\msw\helpchm.cpp $(CXX) -q -c -P -o$@ $(CORELIB_CXXFLAGS) ..\..\src\msw\helpchm.cpp diff --git a/build/msw/makefile.gcc b/build/msw/makefile.gcc index 969609d25e..406c7352fe 100644 --- a/build/msw/makefile.gcc +++ b/build/msw/makefile.gcc @@ -1843,6 +1843,7 @@ ____CORE_SRC_FILENAMES_OBJECTS = \ $(OBJS)\monodll_uxtheme.o \ $(OBJS)\monodll_window.o \ $(OBJS)\monodll_graphicsd2d.o \ + $(OBJS)\monodll_utilsrt.o \ $(OBJS)\monodll_helpchm.o \ $(OBJS)\monodll_helpwin.o \ $(OBJS)\monodll_automtn.o \ @@ -2131,6 +2132,7 @@ ____CORE_SRC_FILENAMES_OBJECTS = \ $(OBJS)\monodll_uxtheme.o \ $(OBJS)\monodll_window.o \ $(OBJS)\monodll_graphicsd2d.o \ + $(OBJS)\monodll_utilsrt.o \ $(OBJS)\monodll_helpchm.o \ $(OBJS)\monodll_helpwin.o \ $(OBJS)\monodll_automtn.o \ @@ -2673,6 +2675,7 @@ ____CORE_SRC_FILENAMES_1_OBJECTS = \ $(OBJS)\monolib_uxtheme.o \ $(OBJS)\monolib_window.o \ $(OBJS)\monolib_graphicsd2d.o \ + $(OBJS)\monolib_utilsrt.o \ $(OBJS)\monolib_helpchm.o \ $(OBJS)\monolib_helpwin.o \ $(OBJS)\monolib_automtn.o \ @@ -2961,6 +2964,7 @@ ____CORE_SRC_FILENAMES_1_OBJECTS = \ $(OBJS)\monolib_uxtheme.o \ $(OBJS)\monolib_window.o \ $(OBJS)\monolib_graphicsd2d.o \ + $(OBJS)\monolib_utilsrt.o \ $(OBJS)\monolib_helpchm.o \ $(OBJS)\monolib_helpwin.o \ $(OBJS)\monolib_automtn.o \ @@ -3386,6 +3390,7 @@ ____CORE_SRC_FILENAMES_2_OBJECTS = \ $(OBJS)\coredll_uxtheme.o \ $(OBJS)\coredll_window.o \ $(OBJS)\coredll_graphicsd2d.o \ + $(OBJS)\coredll_utilsrt.o \ $(OBJS)\coredll_helpchm.o \ $(OBJS)\coredll_helpwin.o \ $(OBJS)\coredll_automtn.o \ @@ -3674,6 +3679,7 @@ ____CORE_SRC_FILENAMES_2_OBJECTS = \ $(OBJS)\coredll_uxtheme.o \ $(OBJS)\coredll_window.o \ $(OBJS)\coredll_graphicsd2d.o \ + $(OBJS)\coredll_utilsrt.o \ $(OBJS)\coredll_helpchm.o \ $(OBJS)\coredll_helpwin.o \ $(OBJS)\coredll_automtn.o \ @@ -3962,6 +3968,7 @@ ____CORE_SRC_FILENAMES_3_OBJECTS = \ $(OBJS)\corelib_uxtheme.o \ $(OBJS)\corelib_window.o \ $(OBJS)\corelib_graphicsd2d.o \ + $(OBJS)\corelib_utilsrt.o \ $(OBJS)\corelib_helpchm.o \ $(OBJS)\corelib_helpwin.o \ $(OBJS)\corelib_automtn.o \ @@ -4250,6 +4257,7 @@ ____CORE_SRC_FILENAMES_3_OBJECTS = \ $(OBJS)\corelib_uxtheme.o \ $(OBJS)\corelib_window.o \ $(OBJS)\corelib_graphicsd2d.o \ + $(OBJS)\corelib_utilsrt.o \ $(OBJS)\corelib_helpchm.o \ $(OBJS)\corelib_helpwin.o \ $(OBJS)\corelib_automtn.o \ @@ -7939,6 +7947,11 @@ $(OBJS)\monodll_graphicsd2d.o: ../../src/msw/graphicsd2d.cpp $(CXX) -c -o $@ $(MONODLL_CXXFLAGS) $(CPPDEPS) $< endif +ifeq ($(USE_GUI),1) +$(OBJS)\monodll_utilsrt.o: ../../src/msw/rt/utilsrt.cpp + $(CXX) -c -o $@ $(MONODLL_CXXFLAGS) $(CPPDEPS) $< +endif + ifeq ($(USE_GUI),1) $(OBJS)\monodll_helpchm.o: ../../src/msw/helpchm.cpp $(CXX) -c -o $@ $(MONODLL_CXXFLAGS) $(CPPDEPS) $< @@ -10454,6 +10467,11 @@ $(OBJS)\monolib_graphicsd2d.o: ../../src/msw/graphicsd2d.cpp $(CXX) -c -o $@ $(MONOLIB_CXXFLAGS) $(CPPDEPS) $< endif +ifeq ($(USE_GUI),1) +$(OBJS)\monolib_utilsrt.o: ../../src/msw/rt/utilsrt.cpp + $(CXX) -c -o $@ $(MONOLIB_CXXFLAGS) $(CPPDEPS) $< +endif + ifeq ($(USE_GUI),1) $(OBJS)\monolib_helpchm.o: ../../src/msw/helpchm.cpp $(CXX) -c -o $@ $(MONOLIB_CXXFLAGS) $(CPPDEPS) $< @@ -12903,6 +12921,11 @@ $(OBJS)\coredll_graphicsd2d.o: ../../src/msw/graphicsd2d.cpp $(CXX) -c -o $@ $(COREDLL_CXXFLAGS) $(CPPDEPS) $< endif +ifeq ($(USE_GUI),1) +$(OBJS)\coredll_utilsrt.o: ../../src/msw/rt/utilsrt.cpp + $(CXX) -c -o $@ $(COREDLL_CXXFLAGS) $(CPPDEPS) $< +endif + ifeq ($(USE_GUI),1) $(OBJS)\coredll_helpchm.o: ../../src/msw/helpchm.cpp $(CXX) -c -o $@ $(COREDLL_CXXFLAGS) $(CPPDEPS) $< @@ -14372,6 +14395,11 @@ $(OBJS)\corelib_graphicsd2d.o: ../../src/msw/graphicsd2d.cpp $(CXX) -c -o $@ $(CORELIB_CXXFLAGS) $(CPPDEPS) $< endif +ifeq ($(USE_GUI),1) +$(OBJS)\corelib_utilsrt.o: ../../src/msw/rt/utilsrt.cpp + $(CXX) -c -o $@ $(CORELIB_CXXFLAGS) $(CPPDEPS) $< +endif + ifeq ($(USE_GUI),1) $(OBJS)\corelib_helpchm.o: ../../src/msw/helpchm.cpp $(CXX) -c -o $@ $(CORELIB_CXXFLAGS) $(CPPDEPS) $< diff --git a/build/msw/makefile.vc b/build/msw/makefile.vc index 422eea6e50..a57adf3fd8 100644 --- a/build/msw/makefile.vc +++ b/build/msw/makefile.vc @@ -2124,6 +2124,7 @@ ____CORE_SRC_FILENAMES_OBJECTS = \ $(OBJS)\monodll_uxtheme.obj \ $(OBJS)\monodll_window.obj \ $(OBJS)\monodll_graphicsd2d.obj \ + $(OBJS)\monodll_utilsrt.obj \ $(OBJS)\monodll_helpchm.obj \ $(OBJS)\monodll_helpwin.obj \ $(OBJS)\monodll_automtn.obj \ @@ -2410,6 +2411,7 @@ ____CORE_SRC_FILENAMES_OBJECTS = \ $(OBJS)\monodll_uxtheme.obj \ $(OBJS)\monodll_window.obj \ $(OBJS)\monodll_graphicsd2d.obj \ + $(OBJS)\monodll_utilsrt.obj \ $(OBJS)\monodll_helpchm.obj \ $(OBJS)\monodll_helpwin.obj \ $(OBJS)\monodll_automtn.obj \ @@ -2954,6 +2956,7 @@ ____CORE_SRC_FILENAMES_1_OBJECTS = \ $(OBJS)\monolib_uxtheme.obj \ $(OBJS)\monolib_window.obj \ $(OBJS)\monolib_graphicsd2d.obj \ + $(OBJS)\monolib_utilsrt.obj \ $(OBJS)\monolib_helpchm.obj \ $(OBJS)\monolib_helpwin.obj \ $(OBJS)\monolib_automtn.obj \ @@ -3240,6 +3243,7 @@ ____CORE_SRC_FILENAMES_1_OBJECTS = \ $(OBJS)\monolib_uxtheme.obj \ $(OBJS)\monolib_window.obj \ $(OBJS)\monolib_graphicsd2d.obj \ + $(OBJS)\monolib_utilsrt.obj \ $(OBJS)\monolib_helpchm.obj \ $(OBJS)\monolib_helpwin.obj \ $(OBJS)\monolib_automtn.obj \ @@ -3717,6 +3721,7 @@ ____CORE_SRC_FILENAMES_2_OBJECTS = \ $(OBJS)\coredll_uxtheme.obj \ $(OBJS)\coredll_window.obj \ $(OBJS)\coredll_graphicsd2d.obj \ + $(OBJS)\coredll_utilsrt.obj \ $(OBJS)\coredll_helpchm.obj \ $(OBJS)\coredll_helpwin.obj \ $(OBJS)\coredll_automtn.obj \ @@ -4003,6 +4008,7 @@ ____CORE_SRC_FILENAMES_2_OBJECTS = \ $(OBJS)\coredll_uxtheme.obj \ $(OBJS)\coredll_window.obj \ $(OBJS)\coredll_graphicsd2d.obj \ + $(OBJS)\coredll_utilsrt.obj \ $(OBJS)\coredll_helpchm.obj \ $(OBJS)\coredll_helpwin.obj \ $(OBJS)\coredll_automtn.obj \ @@ -4291,6 +4297,7 @@ ____CORE_SRC_FILENAMES_3_OBJECTS = \ $(OBJS)\corelib_uxtheme.obj \ $(OBJS)\corelib_window.obj \ $(OBJS)\corelib_graphicsd2d.obj \ + $(OBJS)\corelib_utilsrt.obj \ $(OBJS)\corelib_helpchm.obj \ $(OBJS)\corelib_helpwin.obj \ $(OBJS)\corelib_automtn.obj \ @@ -4577,6 +4584,7 @@ ____CORE_SRC_FILENAMES_3_OBJECTS = \ $(OBJS)\corelib_uxtheme.obj \ $(OBJS)\corelib_window.obj \ $(OBJS)\corelib_graphicsd2d.obj \ + $(OBJS)\corelib_utilsrt.obj \ $(OBJS)\corelib_helpchm.obj \ $(OBJS)\corelib_helpwin.obj \ $(OBJS)\corelib_automtn.obj \ @@ -8456,6 +8464,11 @@ $(OBJS)\monodll_graphicsd2d.obj: ..\..\src\msw\graphicsd2d.cpp $(CXX) /c /nologo /TP /Fo$@ $(MONODLL_CXXFLAGS) ..\..\src\msw\graphicsd2d.cpp !endif +!if "$(USE_GUI)" == "1" +$(OBJS)\monodll_utilsrt.obj: ..\..\src\msw\rt\utilsrt.cpp + $(CXX) /c /nologo /TP /Fo$@ $(MONODLL_CXXFLAGS) ..\..\src\msw\rt\utilsrt.cpp +!endif + !if "$(USE_GUI)" == "1" $(OBJS)\monodll_helpchm.obj: ..\..\src\msw\helpchm.cpp $(CXX) /c /nologo /TP /Fo$@ $(MONODLL_CXXFLAGS) ..\..\src\msw\helpchm.cpp @@ -10971,6 +10984,11 @@ $(OBJS)\monolib_graphicsd2d.obj: ..\..\src\msw\graphicsd2d.cpp $(CXX) /c /nologo /TP /Fo$@ $(MONOLIB_CXXFLAGS) ..\..\src\msw\graphicsd2d.cpp !endif +!if "$(USE_GUI)" == "1" +$(OBJS)\monolib_utilsrt.obj: ..\..\src\msw\rt\utilsrt.cpp + $(CXX) /c /nologo /TP /Fo$@ $(MONOLIB_CXXFLAGS) ..\..\src\msw\rt\utilsrt.cpp +!endif + !if "$(USE_GUI)" == "1" $(OBJS)\monolib_helpchm.obj: ..\..\src\msw\helpchm.cpp $(CXX) /c /nologo /TP /Fo$@ $(MONOLIB_CXXFLAGS) ..\..\src\msw\helpchm.cpp @@ -13420,6 +13438,11 @@ $(OBJS)\coredll_graphicsd2d.obj: ..\..\src\msw\graphicsd2d.cpp $(CXX) /c /nologo /TP /Fo$@ $(COREDLL_CXXFLAGS) ..\..\src\msw\graphicsd2d.cpp !endif +!if "$(USE_GUI)" == "1" +$(OBJS)\coredll_utilsrt.obj: ..\..\src\msw\rt\utilsrt.cpp + $(CXX) /c /nologo /TP /Fo$@ $(COREDLL_CXXFLAGS) ..\..\src\msw\rt\utilsrt.cpp +!endif + !if "$(USE_GUI)" == "1" $(OBJS)\coredll_helpchm.obj: ..\..\src\msw\helpchm.cpp $(CXX) /c /nologo /TP /Fo$@ $(COREDLL_CXXFLAGS) ..\..\src\msw\helpchm.cpp @@ -14889,6 +14912,11 @@ $(OBJS)\corelib_graphicsd2d.obj: ..\..\src\msw\graphicsd2d.cpp $(CXX) /c /nologo /TP /Fo$@ $(CORELIB_CXXFLAGS) ..\..\src\msw\graphicsd2d.cpp !endif +!if "$(USE_GUI)" == "1" +$(OBJS)\corelib_utilsrt.obj: ..\..\src\msw\rt\utilsrt.cpp + $(CXX) /c /nologo /TP /Fo$@ $(CORELIB_CXXFLAGS) ..\..\src\msw\rt\utilsrt.cpp +!endif + !if "$(USE_GUI)" == "1" $(OBJS)\corelib_helpchm.obj: ..\..\src\msw\helpchm.cpp $(CXX) /c /nologo /TP /Fo$@ $(CORELIB_CXXFLAGS) ..\..\src\msw\helpchm.cpp diff --git a/build/msw/wx_core.vcxproj b/build/msw/wx_core.vcxproj index e2a32a8e80..425d1e1845 100644 --- a/build/msw/wx_core.vcxproj +++ b/build/msw/wx_core.vcxproj @@ -1,4 +1,4 @@ - + @@ -1006,6 +1006,7 @@ + @@ -1377,6 +1378,7 @@ + diff --git a/build/msw/wx_core.vcxproj.filters b/build/msw/wx_core.vcxproj.filters index 6b958042db..39e16aeb8f 100644 --- a/build/msw/wx_core.vcxproj.filters +++ b/build/msw/wx_core.vcxproj.filters @@ -813,6 +813,9 @@ MSW Sources + + MSW Sources + MSW Sources @@ -1606,6 +1609,9 @@ MSW Headers + + MSW Headers + MSW Headers diff --git a/build/msw/wx_vc7_core.vcproj b/build/msw/wx_vc7_core.vcproj index 9d26e38ba0..526a04a75a 100644 --- a/build/msw/wx_vc7_core.vcproj +++ b/build/msw/wx_vc7_core.vcproj @@ -1051,6 +1051,9 @@ + + + + + + + + + + + + = 1700 + #define wxUSE_WINRT 1 +#else + #define wxUSE_WINRT 0 +#endif + // wxDC caching implementation #define wxUSE_DC_CACHEING 1 diff --git a/include/wx/msw/chkconf.h b/include/wx/msw/chkconf.h index f3d0b0f8ea..656ef98017 100644 --- a/include/wx/msw/chkconf.h +++ b/include/wx/msw/chkconf.h @@ -22,6 +22,14 @@ # endif #endif /* !defined(wxUSE_ACTIVEX) */ +#ifndef wxUSE_WINRT +# ifdef wxABORT_ON_CONFIG_ERROR +# error "wxUSE_WINRT must be defined." +# else +# define wxUSE_WINRT 0 +# endif +#endif /* !defined(wxUSE_ACTIVEX) */ + #ifndef wxUSE_CRASHREPORT # ifdef wxABORT_ON_CONFIG_ERROR # error "wxUSE_CRASHREPORT must be defined." diff --git a/include/wx/msw/rt/utils.h b/include/wx/msw/rt/utils.h new file mode 100644 index 0000000000..b315531090 --- /dev/null +++ b/include/wx/msw/rt/utils.h @@ -0,0 +1,84 @@ +/////////////////////////////////////////////////////////////////////////////// +// Name: wx/msw/rt/utils.h +// Purpose: Windows Runtime Objects helper functions and objects +// Author: Tobias Taschner +// Created: 2015-09-05 +// Copyright: (c) 2015 wxWidgets development team +// Licence: wxWindows licence +/////////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_MSW_RTUTILS_H +#define _WX_MSW_RTUTILS_H + +#include "wx/defs.h" + +#if wxUSE_WINRT + +#include "wx/string.h" +#include "wx/msw/wrapwin.h" + +#include + +namespace wxWinRT +{ + +bool WXDLLIMPEXP_CORE IsAvailable(); + +bool WXDLLIMPEXP_CORE Initialize(); + +void WXDLLIMPEXP_CORE Uninitialize(); + +bool WXDLLIMPEXP_CORE GetActivationFactory(const wxString& activatableClassId, REFIID iid, void ** factory); + +// RAII class initializing WinRT in its ctor and undoing it in its dtor. +class WXDLLIMPEXP_CORE Initializer +{ +public: + Initializer() + : m_ok(Initialize()) + { + } + + bool IsOk() const + { + return m_ok; + } + + ~Initializer() + { + if (m_ok) + Uninitialize(); + } + +private: + const bool m_ok; + + wxDECLARE_NO_COPY_CLASS(Initializer); +}; + +// Simple class to convert wxString to HSTRING +// This just wraps a reference to the wxString object, +// which needs a life time greater than the TempStringRef object +class WXDLLIMPEXP_CORE TempStringRef +{ +public: + HSTRING Get() const { return m_hstring; } + + operator HSTRING() const { return m_hstring; }; + + static const TempStringRef Make(const wxString &str); + +private: + TempStringRef(const wxString &str); + + HSTRING m_hstring; + HSTRING_HEADER m_header; + + wxDECLARE_NO_COPY_CLASS(TempStringRef); +}; + +} // namespace wxWinRT + +#endif // wxUSE_WINRT + +#endif // _WX_MSW_RTUTILS_H diff --git a/include/wx/msw/setup0.h b/include/wx/msw/setup0.h index f0c15456d5..d005bc3580 100644 --- a/include/wx/msw/setup0.h +++ b/include/wx/msw/setup0.h @@ -1553,6 +1553,19 @@ // Recommended setting: 1, required by wxMediaCtrl #define wxUSE_ACTIVEX 1 +// Enable WinRT support +// +// Default is 1 for compilers which support it, i.e. VS2012+ currently. If you +// use an earlier MSVC version or another compiler and installed the necessary +// SDK components manually, you need to change this setting. +// +// Recommended setting: 1 +#if defined(_MSC_VER) && _MSC_VER >= 1700 + #define wxUSE_WINRT 1 +#else + #define wxUSE_WINRT 0 +#endif + // wxDC caching implementation #define wxUSE_DC_CACHEING 1 diff --git a/include/wx/msw/setup_inc.h b/include/wx/msw/setup_inc.h index 20f2b40945..eb01cbd540 100644 --- a/include/wx/msw/setup_inc.h +++ b/include/wx/msw/setup_inc.h @@ -65,6 +65,19 @@ // Recommended setting: 1, required by wxMediaCtrl #define wxUSE_ACTIVEX 1 +// Enable WinRT support +// +// Default is 1 for compilers which support it, i.e. VS2012+ currently. If you +// use an earlier MSVC version or another compiler and installed the necessary +// SDK components manually, you need to change this setting. +// +// Recommended setting: 1 +#if defined(_MSC_VER) && _MSC_VER >= 1700 + #define wxUSE_WINRT 1 +#else + #define wxUSE_WINRT 0 +#endif + // wxDC caching implementation #define wxUSE_DC_CACHEING 1 diff --git a/setup.h.in b/setup.h.in index 439e42afa4..ee9d346573 100644 --- a/setup.h.in +++ b/setup.h.in @@ -653,6 +653,12 @@ #define wxUSE_ACTIVEX 0 +#if defined(_MSC_VER) && _MSC_VER >= 1700 + #define wxUSE_WINRT 0 +#else + #define wxUSE_WINRT 0 +#endif + #define wxUSE_DC_CACHEING 0 #define wxUSE_WXDIB 0 diff --git a/src/msw/rt/utilsrt.cpp b/src/msw/rt/utilsrt.cpp new file mode 100644 index 0000000000..ecc12be979 --- /dev/null +++ b/src/msw/rt/utilsrt.cpp @@ -0,0 +1,259 @@ +/////////////////////////////////////////////////////////////////////////////// +// Name: src/msw/rt/utilsrt.cpp +// Purpose: Windows Runtime Objects helper functions and objects +// Author: Tobias Taschner +// Created: 2015-09-05 +// Copyright: (c) 2015 wxWidgets development team +// Licence: wxWindows licence +/////////////////////////////////////////////////////////////////////////////// + +// ============================================================================ +// Declarations +// ============================================================================ + +// ---------------------------------------------------------------------------- +// headers +// ---------------------------------------------------------------------------- + +// For compilers that support precompilation, includes "wx.h". +#include "wx/wxprec.h" + +#if defined(__BORLANDC__) +#pragma hdrstop +#endif + +#include "wx/msw/rt/utils.h" + +#if wxUSE_WINRT + +#include + +#include "wx/dynlib.h" +#include "wx/utils.h" +#include "wx/module.h" + +// Core function typedefs +typedef HRESULT (__stdcall *PFNWXROINITIALIZE)(RO_INIT_TYPE initType); +typedef void (__stdcall *PFNWXROUNINITIALIZE)(); +typedef HRESULT (__stdcall *PFNWXROGETACTIVATIONFACTORY)( + HSTRING activatableClassId, REFIID iid, void ** factory); + +// String function typedefs +typedef HRESULT (__stdcall *PFNWXWINDOWSCREATESTRINGREFERENCE)( + PCWSTR sourceString, + UINT32 length, + HSTRING_HEADER * hstringHeader, + HSTRING * string +); +typedef HRESULT (__stdcall *PFNWXWINDOWSDELETESTRING)(HSTRING string); + +namespace wxWinRT +{ + +// +// RTCore +// + +class RTCore +{ +public: + static RTCore& Get() + { + if ( ms_isAvailable == -1 ) + { + if ( !ms_rtcore.Initialize() ) + { + ms_isAvailable = 0; + } + else + ms_isAvailable = 1; + } + + return ms_rtcore; + } + + static bool IsAvailable() + { + if (ms_isAvailable == -1) + Get(); + + return (ms_isAvailable == 1); + } + + PFNWXROINITIALIZE RoInitialize; + PFNWXROUNINITIALIZE RoUninitialize; + PFNWXROGETACTIVATIONFACTORY RoGetActivationFactory; + PFNWXWINDOWSCREATESTRINGREFERENCE WindowsCreateStringReference; + PFNWXWINDOWSDELETESTRING WindowsDeleteString; + + bool Initialize() + { +#define RESOLVE_RT_FUNCTION(dll, type, funcname) \ + funcname = (type)dll.GetSymbol(wxT(#funcname)); \ + if ( !funcname ) \ + return false + +#define RESOLVE_RTCORE_FUNCTION(type, funcname) \ + RESOLVE_RT_FUNCTION(m_dllCore, type, funcname) + +#define RESOLVE_RTSTRING_FUNCTION(type, funcname) \ + RESOLVE_RT_FUNCTION(m_dllString, type, funcname) + + // WinRT is only available in Windows 8 or newer + if (!wxCheckOsVersion(6, 2)) + return false; + + // Initialize core functions + if (!m_dllCore.Load("api-ms-win-core-winrt-l1-1-0.dll")) + return false; + + RESOLVE_RTCORE_FUNCTION(PFNWXROINITIALIZE, RoInitialize); + RESOLVE_RTCORE_FUNCTION(PFNWXROUNINITIALIZE, RoUninitialize); + RESOLVE_RTCORE_FUNCTION(PFNWXROGETACTIVATIONFACTORY, RoGetActivationFactory); + + // Initialize string functions + if (!m_dllString.Load("api-ms-win-core-winrt-string-l1-1-0.dll")) + return false; + + RESOLVE_RTSTRING_FUNCTION(PFNWXWINDOWSCREATESTRINGREFERENCE, WindowsCreateStringReference); + RESOLVE_RTSTRING_FUNCTION(PFNWXWINDOWSDELETESTRING, WindowsDeleteString); + + return true; + +#undef RESOLVE_RT_FUNCTION +#undef RESOLVE_RTCORE_FUNCTION +#undef RESOLVE_RTSTRING_FUNCTION + } + + void UnloadModules() + { + m_dllCore.Unload(); + m_dllString.Unload(); + } + + static void Uninitalize() + { + if (ms_isAvailable == 1) + { + Get().UnloadModules(); + ms_isAvailable = -1; + } + } + +private: + RTCore() + { + + } + + wxDynamicLibrary m_dllCore; + wxDynamicLibrary m_dllString; + + static RTCore ms_rtcore; + static int ms_isAvailable; + + wxDECLARE_NO_COPY_CLASS(RTCore); +}; + +RTCore RTCore::ms_rtcore; +int RTCore::ms_isAvailable = -1; + +// +// wxWinRT::TempStringRef +// + +const TempStringRef TempStringRef::Make(const wxString &str) +{ + return TempStringRef(str); +} + +TempStringRef::TempStringRef(const wxString &str) +{ + if ( !RTCore::IsAvailable() ) + wxLogDebug("Can not create string reference without WinRT"); + + // This creates a fast-pass string which must not be deleted using WindowsDeleteString + HRESULT hr = RTCore::Get().WindowsCreateStringReference( + str.wc_str(), str.length(), + &m_header, &m_hstring); + if ( FAILED(hr) ) + wxLogDebug("Could not create string reference %.8x", hr); +} + +// +// wrapper functions +// + +bool IsAvailable() +{ + return RTCore::IsAvailable(); +} + +bool Initialize() +{ + if ( !RTCore::IsAvailable() ) + return false; + + HRESULT hr = RTCore::Get().RoInitialize(RO_INIT_SINGLETHREADED); + if ( FAILED(hr) ) + { + wxLogDebug("RoInitialize failed %.8x", hr); + return false; + } + else + return true; +} + +void Uninitialize() +{ + if ( !RTCore::IsAvailable() ) + return; + + RTCore::Get().RoUninitialize(); +} + +bool GetActivationFactory(const wxString& activatableClassId, REFIID iid, void ** factory) +{ + if ( !RTCore::IsAvailable() ) + return false; + + HRESULT hr = RTCore::Get().RoGetActivationFactory(TempStringRef::Make(activatableClassId), iid, factory); + if ( FAILED(hr) ) + { + wxLogDebug("RoGetActivationFactory failed %.8x", hr); + return false; + } + else + return true; +} + +// ---------------------------------------------------------------------------- +// Module ensuring all global/singleton objects are destroyed on shutdown. +// ---------------------------------------------------------------------------- + +class RTModule : public wxModule +{ +public: + RTModule() + { + } + + virtual bool OnInit() wxOVERRIDE + { + return true; + } + + virtual void OnExit() wxOVERRIDE + { + RTCore::Uninitalize(); + } + +private: + wxDECLARE_DYNAMIC_CLASS(RTModule); +}; + +wxIMPLEMENT_DYNAMIC_CLASS(RTModule, wxModule); + +} // namespace wxWinRT + +#endif // wxUSE_WINRT