Refactor wxMSW helper functions to allow reuse in wxGTK.

Extract wxMSW-specific part of src/msw/utilsgui.cpp into a new
src/msw/utilswin.cpp file to allow reuse the rest of the former file in wxGTK.

Closes #14424.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@72082 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Vadim Zeitlin 2012-07-14 20:11:04 +00:00
parent 6c32fb8f9d
commit 5146904d0f
13 changed files with 325 additions and 136 deletions

View File

@ -5231,6 +5231,7 @@ COND_TOOLKIT_MSW___LOWLEVEL_SRC_OBJECTS = \
monodll_msw_toplevel.o \
monodll_uiaction.o \
monodll_msw_utilsgui.o \
monodll_utilswin.o \
monodll_uxtheme.o \
monodll_msw_window.o \
monodll_helpchm.o \
@ -5291,6 +5292,7 @@ COND_TOOLKIT_WINCE___LOWLEVEL_SRC_OBJECTS = \
monodll_msw_toplevel.o \
monodll_uiaction.o \
monodll_msw_utilsgui.o \
monodll_utilswin.o \
monodll_uxtheme.o \
monodll_msw_window.o
@COND_TOOLKIT_WINCE@__LOWLEVEL_SRC_OBJECTS = $(COND_TOOLKIT_WINCE___LOWLEVEL_SRC_OBJECTS)
@ -6165,6 +6167,7 @@ COND_TOOLKIT_MSW___LOWLEVEL_SRC_OBJECTS_1 = \
monodll_msw_toplevel.o \
monodll_uiaction.o \
monodll_msw_utilsgui.o \
monodll_utilswin.o \
monodll_uxtheme.o \
monodll_msw_window.o \
monodll_helpchm.o \
@ -6225,6 +6228,7 @@ COND_TOOLKIT_WINCE___LOWLEVEL_SRC_OBJECTS_1 = \
monodll_msw_toplevel.o \
monodll_uiaction.o \
monodll_msw_utilsgui.o \
monodll_utilswin.o \
monodll_uxtheme.o \
monodll_msw_window.o
@COND_TOOLKIT_WINCE@__LOWLEVEL_SRC_OBJECTS_1 = $(COND_TOOLKIT_WINCE___LOWLEVEL_SRC_OBJECTS_1)
@ -7425,6 +7429,7 @@ COND_TOOLKIT_MSW___LOWLEVEL_SRC_OBJECTS_2 = \
monolib_msw_toplevel.o \
monolib_uiaction.o \
monolib_msw_utilsgui.o \
monolib_utilswin.o \
monolib_uxtheme.o \
monolib_msw_window.o \
monolib_helpchm.o \
@ -7485,6 +7490,7 @@ COND_TOOLKIT_WINCE___LOWLEVEL_SRC_OBJECTS_2 = \
monolib_msw_toplevel.o \
monolib_uiaction.o \
monolib_msw_utilsgui.o \
monolib_utilswin.o \
monolib_uxtheme.o \
monolib_msw_window.o
@COND_TOOLKIT_WINCE@__LOWLEVEL_SRC_OBJECTS_2 = $(COND_TOOLKIT_WINCE___LOWLEVEL_SRC_OBJECTS_2)
@ -8359,6 +8365,7 @@ COND_TOOLKIT_MSW___LOWLEVEL_SRC_OBJECTS_3 = \
monolib_msw_toplevel.o \
monolib_uiaction.o \
monolib_msw_utilsgui.o \
monolib_utilswin.o \
monolib_uxtheme.o \
monolib_msw_window.o \
monolib_helpchm.o \
@ -8419,6 +8426,7 @@ COND_TOOLKIT_WINCE___LOWLEVEL_SRC_OBJECTS_3 = \
monolib_msw_toplevel.o \
monolib_uiaction.o \
monolib_msw_utilsgui.o \
monolib_utilswin.o \
monolib_uxtheme.o \
monolib_msw_window.o
@COND_TOOLKIT_WINCE@__LOWLEVEL_SRC_OBJECTS_3 = $(COND_TOOLKIT_WINCE___LOWLEVEL_SRC_OBJECTS_3)
@ -9795,6 +9803,7 @@ COND_TOOLKIT_MSW___LOWLEVEL_SRC_OBJECTS_4 = \
coredll_msw_toplevel.o \
coredll_uiaction.o \
coredll_msw_utilsgui.o \
coredll_utilswin.o \
coredll_uxtheme.o \
coredll_msw_window.o \
coredll_helpchm.o \
@ -9855,6 +9864,7 @@ COND_TOOLKIT_WINCE___LOWLEVEL_SRC_OBJECTS_4 = \
coredll_msw_toplevel.o \
coredll_uiaction.o \
coredll_msw_utilsgui.o \
coredll_utilswin.o \
coredll_uxtheme.o \
coredll_msw_window.o
@COND_TOOLKIT_WINCE@__LOWLEVEL_SRC_OBJECTS_4 = $(COND_TOOLKIT_WINCE___LOWLEVEL_SRC_OBJECTS_4)
@ -10729,6 +10739,7 @@ COND_TOOLKIT_MSW___LOWLEVEL_SRC_OBJECTS_5 = \
coredll_msw_toplevel.o \
coredll_uiaction.o \
coredll_msw_utilsgui.o \
coredll_utilswin.o \
coredll_uxtheme.o \
coredll_msw_window.o \
coredll_helpchm.o \
@ -10789,6 +10800,7 @@ COND_TOOLKIT_WINCE___LOWLEVEL_SRC_OBJECTS_5 = \
coredll_msw_toplevel.o \
coredll_uiaction.o \
coredll_msw_utilsgui.o \
coredll_utilswin.o \
coredll_uxtheme.o \
coredll_msw_window.o
@COND_TOOLKIT_WINCE@__LOWLEVEL_SRC_OBJECTS_5 = $(COND_TOOLKIT_WINCE___LOWLEVEL_SRC_OBJECTS_5)
@ -11434,6 +11446,7 @@ COND_TOOLKIT_MSW___LOWLEVEL_SRC_OBJECTS_6 = \
corelib_msw_toplevel.o \
corelib_uiaction.o \
corelib_msw_utilsgui.o \
corelib_utilswin.o \
corelib_uxtheme.o \
corelib_msw_window.o \
corelib_helpchm.o \
@ -11494,6 +11507,7 @@ COND_TOOLKIT_WINCE___LOWLEVEL_SRC_OBJECTS_6 = \
corelib_msw_toplevel.o \
corelib_uiaction.o \
corelib_msw_utilsgui.o \
corelib_utilswin.o \
corelib_uxtheme.o \
corelib_msw_window.o
@COND_TOOLKIT_WINCE@__LOWLEVEL_SRC_OBJECTS_6 = $(COND_TOOLKIT_WINCE___LOWLEVEL_SRC_OBJECTS_6)
@ -12368,6 +12382,7 @@ COND_TOOLKIT_MSW___LOWLEVEL_SRC_OBJECTS_7 = \
corelib_msw_toplevel.o \
corelib_uiaction.o \
corelib_msw_utilsgui.o \
corelib_utilswin.o \
corelib_uxtheme.o \
corelib_msw_window.o \
corelib_helpchm.o \
@ -12428,6 +12443,7 @@ COND_TOOLKIT_WINCE___LOWLEVEL_SRC_OBJECTS_7 = \
corelib_msw_toplevel.o \
corelib_uiaction.o \
corelib_msw_utilsgui.o \
corelib_utilswin.o \
corelib_uxtheme.o \
corelib_msw_window.o
@COND_TOOLKIT_WINCE@__LOWLEVEL_SRC_OBJECTS_7 = $(COND_TOOLKIT_WINCE___LOWLEVEL_SRC_OBJECTS_7)
@ -19236,6 +19252,12 @@ monodll_sound_sdl.o: $(srcdir)/src/unix/sound_sdl.cpp $(MONODLL_ODEP)
@COND_TOOLKIT_WINCE_USE_GUI_1@monodll_msw_utilsgui.o: $(srcdir)/src/msw/utilsgui.cpp $(MONODLL_ODEP)
@COND_TOOLKIT_WINCE_USE_GUI_1@ $(CXXC) -c -o $@ $(MONODLL_CXXFLAGS) $(srcdir)/src/msw/utilsgui.cpp
@COND_TOOLKIT_MSW_USE_GUI_1@monodll_utilswin.o: $(srcdir)/src/msw/utilswin.cpp $(MONODLL_ODEP)
@COND_TOOLKIT_MSW_USE_GUI_1@ $(CXXC) -c -o $@ $(MONODLL_CXXFLAGS) $(srcdir)/src/msw/utilswin.cpp
@COND_TOOLKIT_WINCE_USE_GUI_1@monodll_utilswin.o: $(srcdir)/src/msw/utilswin.cpp $(MONODLL_ODEP)
@COND_TOOLKIT_WINCE_USE_GUI_1@ $(CXXC) -c -o $@ $(MONODLL_CXXFLAGS) $(srcdir)/src/msw/utilswin.cpp
@COND_TOOLKIT_MSW_USE_GUI_1@monodll_uxtheme.o: $(srcdir)/src/msw/uxtheme.cpp $(MONODLL_ODEP)
@COND_TOOLKIT_MSW_USE_GUI_1@ $(CXXC) -c -o $@ $(MONODLL_CXXFLAGS) $(srcdir)/src/msw/uxtheme.cpp
@ -24852,6 +24874,12 @@ monolib_sound_sdl.o: $(srcdir)/src/unix/sound_sdl.cpp $(MONOLIB_ODEP)
@COND_TOOLKIT_WINCE_USE_GUI_1@monolib_msw_utilsgui.o: $(srcdir)/src/msw/utilsgui.cpp $(MONOLIB_ODEP)
@COND_TOOLKIT_WINCE_USE_GUI_1@ $(CXXC) -c -o $@ $(MONOLIB_CXXFLAGS) $(srcdir)/src/msw/utilsgui.cpp
@COND_TOOLKIT_MSW_USE_GUI_1@monolib_utilswin.o: $(srcdir)/src/msw/utilswin.cpp $(MONOLIB_ODEP)
@COND_TOOLKIT_MSW_USE_GUI_1@ $(CXXC) -c -o $@ $(MONOLIB_CXXFLAGS) $(srcdir)/src/msw/utilswin.cpp
@COND_TOOLKIT_WINCE_USE_GUI_1@monolib_utilswin.o: $(srcdir)/src/msw/utilswin.cpp $(MONOLIB_ODEP)
@COND_TOOLKIT_WINCE_USE_GUI_1@ $(CXXC) -c -o $@ $(MONOLIB_CXXFLAGS) $(srcdir)/src/msw/utilswin.cpp
@COND_TOOLKIT_MSW_USE_GUI_1@monolib_uxtheme.o: $(srcdir)/src/msw/uxtheme.cpp $(MONOLIB_ODEP)
@COND_TOOLKIT_MSW_USE_GUI_1@ $(CXXC) -c -o $@ $(MONOLIB_CXXFLAGS) $(srcdir)/src/msw/uxtheme.cpp
@ -30639,6 +30667,12 @@ coredll_win32.o: $(srcdir)/src/univ/themes/win32.cpp $(COREDLL_ODEP)
@COND_TOOLKIT_WINCE_USE_GUI_1@coredll_msw_utilsgui.o: $(srcdir)/src/msw/utilsgui.cpp $(COREDLL_ODEP)
@COND_TOOLKIT_WINCE_USE_GUI_1@ $(CXXC) -c -o $@ $(COREDLL_CXXFLAGS) $(srcdir)/src/msw/utilsgui.cpp
@COND_TOOLKIT_MSW_USE_GUI_1@coredll_utilswin.o: $(srcdir)/src/msw/utilswin.cpp $(COREDLL_ODEP)
@COND_TOOLKIT_MSW_USE_GUI_1@ $(CXXC) -c -o $@ $(COREDLL_CXXFLAGS) $(srcdir)/src/msw/utilswin.cpp
@COND_TOOLKIT_WINCE_USE_GUI_1@coredll_utilswin.o: $(srcdir)/src/msw/utilswin.cpp $(COREDLL_ODEP)
@COND_TOOLKIT_WINCE_USE_GUI_1@ $(CXXC) -c -o $@ $(COREDLL_CXXFLAGS) $(srcdir)/src/msw/utilswin.cpp
@COND_TOOLKIT_MSW_USE_GUI_1@coredll_uxtheme.o: $(srcdir)/src/msw/uxtheme.cpp $(COREDLL_ODEP)
@COND_TOOLKIT_MSW_USE_GUI_1@ $(CXXC) -c -o $@ $(COREDLL_CXXFLAGS) $(srcdir)/src/msw/uxtheme.cpp
@ -34839,6 +34873,12 @@ corelib_win32.o: $(srcdir)/src/univ/themes/win32.cpp $(CORELIB_ODEP)
@COND_TOOLKIT_WINCE_USE_GUI_1@corelib_msw_utilsgui.o: $(srcdir)/src/msw/utilsgui.cpp $(CORELIB_ODEP)
@COND_TOOLKIT_WINCE_USE_GUI_1@ $(CXXC) -c -o $@ $(CORELIB_CXXFLAGS) $(srcdir)/src/msw/utilsgui.cpp
@COND_TOOLKIT_MSW_USE_GUI_1@corelib_utilswin.o: $(srcdir)/src/msw/utilswin.cpp $(CORELIB_ODEP)
@COND_TOOLKIT_MSW_USE_GUI_1@ $(CXXC) -c -o $@ $(CORELIB_CXXFLAGS) $(srcdir)/src/msw/utilswin.cpp
@COND_TOOLKIT_WINCE_USE_GUI_1@corelib_utilswin.o: $(srcdir)/src/msw/utilswin.cpp $(CORELIB_ODEP)
@COND_TOOLKIT_WINCE_USE_GUI_1@ $(CXXC) -c -o $@ $(CORELIB_CXXFLAGS) $(srcdir)/src/msw/utilswin.cpp
@COND_TOOLKIT_MSW_USE_GUI_1@corelib_uxtheme.o: $(srcdir)/src/msw/uxtheme.cpp $(CORELIB_ODEP)
@COND_TOOLKIT_MSW_USE_GUI_1@ $(CXXC) -c -o $@ $(CORELIB_CXXFLAGS) $(srcdir)/src/msw/uxtheme.cpp

View File

@ -1691,6 +1691,7 @@ IMPORTANT: please read docs/tech/tn0016.txt before modifying this file!
src/msw/toplevel.cpp
src/msw/uiaction.cpp
src/msw/utilsgui.cpp
src/msw/utilswin.cpp
src/msw/uxtheme.cpp
src/msw/window.cpp
</set>

View File

@ -1778,6 +1778,7 @@ ____CORE_SRC_FILENAMES_OBJECTS = \
$(OBJS)\monodll_toplevel.obj \
$(OBJS)\monodll_uiaction.obj \
$(OBJS)\monodll_utilsgui.obj \
$(OBJS)\monodll_utilswin.obj \
$(OBJS)\monodll_uxtheme.obj \
$(OBJS)\monodll_window.obj \
$(OBJS)\monodll_helpchm.obj \
@ -2051,6 +2052,7 @@ ____CORE_SRC_FILENAMES_OBJECTS = \
$(OBJS)\monodll_toplevel.obj \
$(OBJS)\monodll_uiaction.obj \
$(OBJS)\monodll_utilsgui.obj \
$(OBJS)\monodll_utilswin.obj \
$(OBJS)\monodll_uxtheme.obj \
$(OBJS)\monodll_window.obj \
$(OBJS)\monodll_helpchm.obj \
@ -2563,6 +2565,7 @@ ____CORE_SRC_FILENAMES_1_OBJECTS = \
$(OBJS)\monolib_toplevel.obj \
$(OBJS)\monolib_uiaction.obj \
$(OBJS)\monolib_utilsgui.obj \
$(OBJS)\monolib_utilswin.obj \
$(OBJS)\monolib_uxtheme.obj \
$(OBJS)\monolib_window.obj \
$(OBJS)\monolib_helpchm.obj \
@ -2836,6 +2839,7 @@ ____CORE_SRC_FILENAMES_1_OBJECTS = \
$(OBJS)\monolib_toplevel.obj \
$(OBJS)\monolib_uiaction.obj \
$(OBJS)\monolib_utilsgui.obj \
$(OBJS)\monolib_utilswin.obj \
$(OBJS)\monolib_uxtheme.obj \
$(OBJS)\monolib_window.obj \
$(OBJS)\monolib_helpchm.obj \
@ -3230,6 +3234,7 @@ ____CORE_SRC_FILENAMES_2_OBJECTS = \
$(OBJS)\coredll_toplevel.obj \
$(OBJS)\coredll_uiaction.obj \
$(OBJS)\coredll_utilsgui.obj \
$(OBJS)\coredll_utilswin.obj \
$(OBJS)\coredll_uxtheme.obj \
$(OBJS)\coredll_window.obj \
$(OBJS)\coredll_helpchm.obj \
@ -3503,6 +3508,7 @@ ____CORE_SRC_FILENAMES_2_OBJECTS = \
$(OBJS)\coredll_toplevel.obj \
$(OBJS)\coredll_uiaction.obj \
$(OBJS)\coredll_utilsgui.obj \
$(OBJS)\coredll_utilswin.obj \
$(OBJS)\coredll_uxtheme.obj \
$(OBJS)\coredll_window.obj \
$(OBJS)\coredll_helpchm.obj \
@ -3773,6 +3779,7 @@ ____CORE_SRC_FILENAMES_3_OBJECTS = \
$(OBJS)\corelib_toplevel.obj \
$(OBJS)\corelib_uiaction.obj \
$(OBJS)\corelib_utilsgui.obj \
$(OBJS)\corelib_utilswin.obj \
$(OBJS)\corelib_uxtheme.obj \
$(OBJS)\corelib_window.obj \
$(OBJS)\corelib_helpchm.obj \
@ -4046,6 +4053,7 @@ ____CORE_SRC_FILENAMES_3_OBJECTS = \
$(OBJS)\corelib_toplevel.obj \
$(OBJS)\corelib_uiaction.obj \
$(OBJS)\corelib_utilsgui.obj \
$(OBJS)\corelib_utilswin.obj \
$(OBJS)\corelib_uxtheme.obj \
$(OBJS)\corelib_window.obj \
$(OBJS)\corelib_helpchm.obj \
@ -7419,6 +7427,11 @@ $(OBJS)\monodll_utilsgui.obj: ..\..\src\msw\utilsgui.cpp
$(CXX) -q -c -P -o$@ $(MONODLL_CXXFLAGS) ..\..\src\msw\utilsgui.cpp
!endif
!if "$(USE_GUI)" == "1"
$(OBJS)\monodll_utilswin.obj: ..\..\src\msw\utilswin.cpp
$(CXX) -q -c -P -o$@ $(MONODLL_CXXFLAGS) ..\..\src\msw\utilswin.cpp
!endif
!if "$(USE_GUI)" == "1"
$(OBJS)\monodll_uxtheme.obj: ..\..\src\msw\uxtheme.cpp
$(CXX) -q -c -P -o$@ $(MONODLL_CXXFLAGS) ..\..\src\msw\uxtheme.cpp
@ -9830,6 +9843,11 @@ $(OBJS)\monolib_utilsgui.obj: ..\..\src\msw\utilsgui.cpp
$(CXX) -q -c -P -o$@ $(MONOLIB_CXXFLAGS) ..\..\src\msw\utilsgui.cpp
!endif
!if "$(USE_GUI)" == "1"
$(OBJS)\monolib_utilswin.obj: ..\..\src\msw\utilswin.cpp
$(CXX) -q -c -P -o$@ $(MONOLIB_CXXFLAGS) ..\..\src\msw\utilswin.cpp
!endif
!if "$(USE_GUI)" == "1"
$(OBJS)\monolib_uxtheme.obj: ..\..\src\msw\uxtheme.cpp
$(CXX) -q -c -P -o$@ $(MONOLIB_CXXFLAGS) ..\..\src\msw\uxtheme.cpp
@ -12208,6 +12226,11 @@ $(OBJS)\coredll_utilsgui.obj: ..\..\src\msw\utilsgui.cpp
$(CXX) -q -c -P -o$@ $(COREDLL_CXXFLAGS) ..\..\src\msw\utilsgui.cpp
!endif
!if "$(USE_GUI)" == "1"
$(OBJS)\coredll_utilswin.obj: ..\..\src\msw\utilswin.cpp
$(CXX) -q -c -P -o$@ $(COREDLL_CXXFLAGS) ..\..\src\msw\utilswin.cpp
!endif
!if "$(USE_GUI)" == "1"
$(OBJS)\coredll_uxtheme.obj: ..\..\src\msw\uxtheme.cpp
$(CXX) -q -c -P -o$@ $(COREDLL_CXXFLAGS) ..\..\src\msw\uxtheme.cpp
@ -13616,6 +13639,11 @@ $(OBJS)\corelib_utilsgui.obj: ..\..\src\msw\utilsgui.cpp
$(CXX) -q -c -P -o$@ $(CORELIB_CXXFLAGS) ..\..\src\msw\utilsgui.cpp
!endif
!if "$(USE_GUI)" == "1"
$(OBJS)\corelib_utilswin.obj: ..\..\src\msw\utilswin.cpp
$(CXX) -q -c -P -o$@ $(CORELIB_CXXFLAGS) ..\..\src\msw\utilswin.cpp
!endif
!if "$(USE_GUI)" == "1"
$(OBJS)\corelib_uxtheme.obj: ..\..\src\msw\uxtheme.cpp
$(CXX) -q -c -P -o$@ $(CORELIB_CXXFLAGS) ..\..\src\msw\uxtheme.cpp

View File

@ -1790,6 +1790,7 @@ ____CORE_SRC_FILENAMES_OBJECTS = \
$(OBJS)\monodll_toplevel.o \
$(OBJS)\monodll_uiaction.o \
$(OBJS)\monodll_utilsgui.o \
$(OBJS)\monodll_utilswin.o \
$(OBJS)\monodll_uxtheme.o \
$(OBJS)\monodll_window.o \
$(OBJS)\monodll_helpchm.o \
@ -2065,6 +2066,7 @@ ____CORE_SRC_FILENAMES_OBJECTS = \
$(OBJS)\monodll_toplevel.o \
$(OBJS)\monodll_uiaction.o \
$(OBJS)\monodll_utilsgui.o \
$(OBJS)\monodll_utilswin.o \
$(OBJS)\monodll_uxtheme.o \
$(OBJS)\monodll_window.o \
$(OBJS)\monodll_helpchm.o \
@ -2581,6 +2583,7 @@ ____CORE_SRC_FILENAMES_1_OBJECTS = \
$(OBJS)\monolib_toplevel.o \
$(OBJS)\monolib_uiaction.o \
$(OBJS)\monolib_utilsgui.o \
$(OBJS)\monolib_utilswin.o \
$(OBJS)\monolib_uxtheme.o \
$(OBJS)\monolib_window.o \
$(OBJS)\monolib_helpchm.o \
@ -2856,6 +2859,7 @@ ____CORE_SRC_FILENAMES_1_OBJECTS = \
$(OBJS)\monolib_toplevel.o \
$(OBJS)\monolib_uiaction.o \
$(OBJS)\monolib_utilsgui.o \
$(OBJS)\monolib_utilswin.o \
$(OBJS)\monolib_uxtheme.o \
$(OBJS)\monolib_window.o \
$(OBJS)\monolib_helpchm.o \
@ -3264,6 +3268,7 @@ ____CORE_SRC_FILENAMES_2_OBJECTS = \
$(OBJS)\coredll_toplevel.o \
$(OBJS)\coredll_uiaction.o \
$(OBJS)\coredll_utilsgui.o \
$(OBJS)\coredll_utilswin.o \
$(OBJS)\coredll_uxtheme.o \
$(OBJS)\coredll_window.o \
$(OBJS)\coredll_helpchm.o \
@ -3539,6 +3544,7 @@ ____CORE_SRC_FILENAMES_2_OBJECTS = \
$(OBJS)\coredll_toplevel.o \
$(OBJS)\coredll_uiaction.o \
$(OBJS)\coredll_utilsgui.o \
$(OBJS)\coredll_utilswin.o \
$(OBJS)\coredll_uxtheme.o \
$(OBJS)\coredll_window.o \
$(OBJS)\coredll_helpchm.o \
@ -3815,6 +3821,7 @@ ____CORE_SRC_FILENAMES_3_OBJECTS = \
$(OBJS)\corelib_toplevel.o \
$(OBJS)\corelib_uiaction.o \
$(OBJS)\corelib_utilsgui.o \
$(OBJS)\corelib_utilswin.o \
$(OBJS)\corelib_uxtheme.o \
$(OBJS)\corelib_window.o \
$(OBJS)\corelib_helpchm.o \
@ -4090,6 +4097,7 @@ ____CORE_SRC_FILENAMES_3_OBJECTS = \
$(OBJS)\corelib_toplevel.o \
$(OBJS)\corelib_uiaction.o \
$(OBJS)\corelib_utilsgui.o \
$(OBJS)\corelib_utilswin.o \
$(OBJS)\corelib_uxtheme.o \
$(OBJS)\corelib_window.o \
$(OBJS)\corelib_helpchm.o \
@ -7587,6 +7595,11 @@ $(OBJS)\monodll_utilsgui.o: ../../src/msw/utilsgui.cpp
$(CXX) -c -o $@ $(MONODLL_CXXFLAGS) $(CPPDEPS) $<
endif
ifeq ($(USE_GUI),1)
$(OBJS)\monodll_utilswin.o: ../../src/msw/utilswin.cpp
$(CXX) -c -o $@ $(MONODLL_CXXFLAGS) $(CPPDEPS) $<
endif
ifeq ($(USE_GUI),1)
$(OBJS)\monodll_uxtheme.o: ../../src/msw/uxtheme.cpp
$(CXX) -c -o $@ $(MONODLL_CXXFLAGS) $(CPPDEPS) $<
@ -9998,6 +10011,11 @@ $(OBJS)\monolib_utilsgui.o: ../../src/msw/utilsgui.cpp
$(CXX) -c -o $@ $(MONOLIB_CXXFLAGS) $(CPPDEPS) $<
endif
ifeq ($(USE_GUI),1)
$(OBJS)\monolib_utilswin.o: ../../src/msw/utilswin.cpp
$(CXX) -c -o $@ $(MONOLIB_CXXFLAGS) $(CPPDEPS) $<
endif
ifeq ($(USE_GUI),1)
$(OBJS)\monolib_uxtheme.o: ../../src/msw/uxtheme.cpp
$(CXX) -c -o $@ $(MONOLIB_CXXFLAGS) $(CPPDEPS) $<
@ -12376,6 +12394,11 @@ $(OBJS)\coredll_utilsgui.o: ../../src/msw/utilsgui.cpp
$(CXX) -c -o $@ $(COREDLL_CXXFLAGS) $(CPPDEPS) $<
endif
ifeq ($(USE_GUI),1)
$(OBJS)\coredll_utilswin.o: ../../src/msw/utilswin.cpp
$(CXX) -c -o $@ $(COREDLL_CXXFLAGS) $(CPPDEPS) $<
endif
ifeq ($(USE_GUI),1)
$(OBJS)\coredll_uxtheme.o: ../../src/msw/uxtheme.cpp
$(CXX) -c -o $@ $(COREDLL_CXXFLAGS) $(CPPDEPS) $<
@ -13784,6 +13807,11 @@ $(OBJS)\corelib_utilsgui.o: ../../src/msw/utilsgui.cpp
$(CXX) -c -o $@ $(CORELIB_CXXFLAGS) $(CPPDEPS) $<
endif
ifeq ($(USE_GUI),1)
$(OBJS)\corelib_utilswin.o: ../../src/msw/utilswin.cpp
$(CXX) -c -o $@ $(CORELIB_CXXFLAGS) $(CPPDEPS) $<
endif
ifeq ($(USE_GUI),1)
$(OBJS)\corelib_uxtheme.o: ../../src/msw/uxtheme.cpp
$(CXX) -c -o $@ $(CORELIB_CXXFLAGS) $(CPPDEPS) $<

View File

@ -2070,6 +2070,7 @@ ____CORE_SRC_FILENAMES_OBJECTS = \
$(OBJS)\monodll_toplevel.obj \
$(OBJS)\monodll_uiaction.obj \
$(OBJS)\monodll_utilsgui.obj \
$(OBJS)\monodll_utilswin.obj \
$(OBJS)\monodll_uxtheme.obj \
$(OBJS)\monodll_window.obj \
$(OBJS)\monodll_helpchm.obj \
@ -2343,6 +2344,7 @@ ____CORE_SRC_FILENAMES_OBJECTS = \
$(OBJS)\monodll_toplevel.obj \
$(OBJS)\monodll_uiaction.obj \
$(OBJS)\monodll_utilsgui.obj \
$(OBJS)\monodll_utilswin.obj \
$(OBJS)\monodll_uxtheme.obj \
$(OBJS)\monodll_window.obj \
$(OBJS)\monodll_helpchm.obj \
@ -2861,6 +2863,7 @@ ____CORE_SRC_FILENAMES_1_OBJECTS = \
$(OBJS)\monolib_toplevel.obj \
$(OBJS)\monolib_uiaction.obj \
$(OBJS)\monolib_utilsgui.obj \
$(OBJS)\monolib_utilswin.obj \
$(OBJS)\monolib_uxtheme.obj \
$(OBJS)\monolib_window.obj \
$(OBJS)\monolib_helpchm.obj \
@ -3134,6 +3137,7 @@ ____CORE_SRC_FILENAMES_1_OBJECTS = \
$(OBJS)\monolib_toplevel.obj \
$(OBJS)\monolib_uiaction.obj \
$(OBJS)\monolib_utilsgui.obj \
$(OBJS)\monolib_utilswin.obj \
$(OBJS)\monolib_uxtheme.obj \
$(OBJS)\monolib_window.obj \
$(OBJS)\monolib_helpchm.obj \
@ -3594,6 +3598,7 @@ ____CORE_SRC_FILENAMES_2_OBJECTS = \
$(OBJS)\coredll_toplevel.obj \
$(OBJS)\coredll_uiaction.obj \
$(OBJS)\coredll_utilsgui.obj \
$(OBJS)\coredll_utilswin.obj \
$(OBJS)\coredll_uxtheme.obj \
$(OBJS)\coredll_window.obj \
$(OBJS)\coredll_helpchm.obj \
@ -3867,6 +3872,7 @@ ____CORE_SRC_FILENAMES_2_OBJECTS = \
$(OBJS)\coredll_toplevel.obj \
$(OBJS)\coredll_uiaction.obj \
$(OBJS)\coredll_utilsgui.obj \
$(OBJS)\coredll_utilswin.obj \
$(OBJS)\coredll_uxtheme.obj \
$(OBJS)\coredll_window.obj \
$(OBJS)\coredll_helpchm.obj \
@ -4143,6 +4149,7 @@ ____CORE_SRC_FILENAMES_3_OBJECTS = \
$(OBJS)\corelib_toplevel.obj \
$(OBJS)\corelib_uiaction.obj \
$(OBJS)\corelib_utilsgui.obj \
$(OBJS)\corelib_utilswin.obj \
$(OBJS)\corelib_uxtheme.obj \
$(OBJS)\corelib_window.obj \
$(OBJS)\corelib_helpchm.obj \
@ -4416,6 +4423,7 @@ ____CORE_SRC_FILENAMES_3_OBJECTS = \
$(OBJS)\corelib_toplevel.obj \
$(OBJS)\corelib_uiaction.obj \
$(OBJS)\corelib_utilsgui.obj \
$(OBJS)\corelib_utilswin.obj \
$(OBJS)\corelib_uxtheme.obj \
$(OBJS)\corelib_window.obj \
$(OBJS)\corelib_helpchm.obj \
@ -8103,6 +8111,11 @@ $(OBJS)\monodll_utilsgui.obj: ..\..\src\msw\utilsgui.cpp
$(CXX) /c /nologo /TP /Fo$@ $(MONODLL_CXXFLAGS) ..\..\src\msw\utilsgui.cpp
!endif
!if "$(USE_GUI)" == "1"
$(OBJS)\monodll_utilswin.obj: ..\..\src\msw\utilswin.cpp
$(CXX) /c /nologo /TP /Fo$@ $(MONODLL_CXXFLAGS) ..\..\src\msw\utilswin.cpp
!endif
!if "$(USE_GUI)" == "1"
$(OBJS)\monodll_uxtheme.obj: ..\..\src\msw\uxtheme.cpp
$(CXX) /c /nologo /TP /Fo$@ $(MONODLL_CXXFLAGS) ..\..\src\msw\uxtheme.cpp
@ -10514,6 +10527,11 @@ $(OBJS)\monolib_utilsgui.obj: ..\..\src\msw\utilsgui.cpp
$(CXX) /c /nologo /TP /Fo$@ $(MONOLIB_CXXFLAGS) ..\..\src\msw\utilsgui.cpp
!endif
!if "$(USE_GUI)" == "1"
$(OBJS)\monolib_utilswin.obj: ..\..\src\msw\utilswin.cpp
$(CXX) /c /nologo /TP /Fo$@ $(MONOLIB_CXXFLAGS) ..\..\src\msw\utilswin.cpp
!endif
!if "$(USE_GUI)" == "1"
$(OBJS)\monolib_uxtheme.obj: ..\..\src\msw\uxtheme.cpp
$(CXX) /c /nologo /TP /Fo$@ $(MONOLIB_CXXFLAGS) ..\..\src\msw\uxtheme.cpp
@ -12892,6 +12910,11 @@ $(OBJS)\coredll_utilsgui.obj: ..\..\src\msw\utilsgui.cpp
$(CXX) /c /nologo /TP /Fo$@ $(COREDLL_CXXFLAGS) ..\..\src\msw\utilsgui.cpp
!endif
!if "$(USE_GUI)" == "1"
$(OBJS)\coredll_utilswin.obj: ..\..\src\msw\utilswin.cpp
$(CXX) /c /nologo /TP /Fo$@ $(COREDLL_CXXFLAGS) ..\..\src\msw\utilswin.cpp
!endif
!if "$(USE_GUI)" == "1"
$(OBJS)\coredll_uxtheme.obj: ..\..\src\msw\uxtheme.cpp
$(CXX) /c /nologo /TP /Fo$@ $(COREDLL_CXXFLAGS) ..\..\src\msw\uxtheme.cpp
@ -14300,6 +14323,11 @@ $(OBJS)\corelib_utilsgui.obj: ..\..\src\msw\utilsgui.cpp
$(CXX) /c /nologo /TP /Fo$@ $(CORELIB_CXXFLAGS) ..\..\src\msw\utilsgui.cpp
!endif
!if "$(USE_GUI)" == "1"
$(OBJS)\corelib_utilswin.obj: ..\..\src\msw\utilswin.cpp
$(CXX) /c /nologo /TP /Fo$@ $(CORELIB_CXXFLAGS) ..\..\src\msw\utilswin.cpp
!endif
!if "$(USE_GUI)" == "1"
$(OBJS)\corelib_uxtheme.obj: ..\..\src\msw\uxtheme.cpp
$(CXX) /c /nologo /TP /Fo$@ $(CORELIB_CXXFLAGS) ..\..\src\msw\uxtheme.cpp

View File

@ -304,6 +304,7 @@ ____CORE_SRC_FILENAMES_OBJECTS = &
$(OBJS)\monodll_toplevel.obj &
$(OBJS)\monodll_uiaction.obj &
$(OBJS)\monodll_utilsgui.obj &
$(OBJS)\monodll_utilswin.obj &
$(OBJS)\monodll_uxtheme.obj &
$(OBJS)\monodll_window.obj &
$(OBJS)\monodll_helpchm.obj &
@ -579,6 +580,7 @@ ____CORE_SRC_FILENAMES_OBJECTS = &
$(OBJS)\monodll_toplevel.obj &
$(OBJS)\monodll_uiaction.obj &
$(OBJS)\monodll_utilsgui.obj &
$(OBJS)\monodll_utilswin.obj &
$(OBJS)\monodll_uxtheme.obj &
$(OBJS)\monodll_window.obj &
$(OBJS)\monodll_helpchm.obj &
@ -1100,6 +1102,7 @@ ____CORE_SRC_FILENAMES_1_OBJECTS = &
$(OBJS)\monolib_toplevel.obj &
$(OBJS)\monolib_uiaction.obj &
$(OBJS)\monolib_utilsgui.obj &
$(OBJS)\monolib_utilswin.obj &
$(OBJS)\monolib_uxtheme.obj &
$(OBJS)\monolib_window.obj &
$(OBJS)\monolib_helpchm.obj &
@ -1375,6 +1378,7 @@ ____CORE_SRC_FILENAMES_1_OBJECTS = &
$(OBJS)\monolib_toplevel.obj &
$(OBJS)\monolib_uiaction.obj &
$(OBJS)\monolib_utilsgui.obj &
$(OBJS)\monolib_utilswin.obj &
$(OBJS)\monolib_uxtheme.obj &
$(OBJS)\monolib_window.obj &
$(OBJS)\monolib_helpchm.obj &
@ -1794,6 +1798,7 @@ ____CORE_SRC_FILENAMES_2_OBJECTS = &
$(OBJS)\coredll_toplevel.obj &
$(OBJS)\coredll_uiaction.obj &
$(OBJS)\coredll_utilsgui.obj &
$(OBJS)\coredll_utilswin.obj &
$(OBJS)\coredll_uxtheme.obj &
$(OBJS)\coredll_window.obj &
$(OBJS)\coredll_helpchm.obj &
@ -2069,6 +2074,7 @@ ____CORE_SRC_FILENAMES_2_OBJECTS = &
$(OBJS)\coredll_toplevel.obj &
$(OBJS)\coredll_uiaction.obj &
$(OBJS)\coredll_utilsgui.obj &
$(OBJS)\coredll_utilswin.obj &
$(OBJS)\coredll_uxtheme.obj &
$(OBJS)\coredll_window.obj &
$(OBJS)\coredll_helpchm.obj &
@ -2347,6 +2353,7 @@ ____CORE_SRC_FILENAMES_3_OBJECTS = &
$(OBJS)\corelib_toplevel.obj &
$(OBJS)\corelib_uiaction.obj &
$(OBJS)\corelib_utilsgui.obj &
$(OBJS)\corelib_utilswin.obj &
$(OBJS)\corelib_uxtheme.obj &
$(OBJS)\corelib_window.obj &
$(OBJS)\corelib_helpchm.obj &
@ -2622,6 +2629,7 @@ ____CORE_SRC_FILENAMES_3_OBJECTS = &
$(OBJS)\corelib_toplevel.obj &
$(OBJS)\corelib_uiaction.obj &
$(OBJS)\corelib_utilsgui.obj &
$(OBJS)\corelib_utilswin.obj &
$(OBJS)\corelib_uxtheme.obj &
$(OBJS)\corelib_window.obj &
$(OBJS)\corelib_helpchm.obj &
@ -7860,6 +7868,11 @@ $(OBJS)\monodll_utilsgui.obj : .AUTODEPEND ..\..\src\msw\utilsgui.cpp
$(CXX) -bt=nt -zq -fo=$^@ $(MONODLL_CXXFLAGS) $<
!endif
!ifeq USE_GUI 1
$(OBJS)\monodll_utilswin.obj : .AUTODEPEND ..\..\src\msw\utilswin.cpp
$(CXX) -bt=nt -zq -fo=$^@ $(MONODLL_CXXFLAGS) $<
!endif
!ifeq USE_GUI 1
$(OBJS)\monodll_uxtheme.obj : .AUTODEPEND ..\..\src\msw\uxtheme.cpp
$(CXX) -bt=nt -zq -fo=$^@ $(MONODLL_CXXFLAGS) $<
@ -10271,6 +10284,11 @@ $(OBJS)\monolib_utilsgui.obj : .AUTODEPEND ..\..\src\msw\utilsgui.cpp
$(CXX) -bt=nt -zq -fo=$^@ $(MONOLIB_CXXFLAGS) $<
!endif
!ifeq USE_GUI 1
$(OBJS)\monolib_utilswin.obj : .AUTODEPEND ..\..\src\msw\utilswin.cpp
$(CXX) -bt=nt -zq -fo=$^@ $(MONOLIB_CXXFLAGS) $<
!endif
!ifeq USE_GUI 1
$(OBJS)\monolib_uxtheme.obj : .AUTODEPEND ..\..\src\msw\uxtheme.cpp
$(CXX) -bt=nt -zq -fo=$^@ $(MONOLIB_CXXFLAGS) $<
@ -12649,6 +12667,11 @@ $(OBJS)\coredll_utilsgui.obj : .AUTODEPEND ..\..\src\msw\utilsgui.cpp
$(CXX) -bt=nt -zq -fo=$^@ $(COREDLL_CXXFLAGS) $<
!endif
!ifeq USE_GUI 1
$(OBJS)\coredll_utilswin.obj : .AUTODEPEND ..\..\src\msw\utilswin.cpp
$(CXX) -bt=nt -zq -fo=$^@ $(COREDLL_CXXFLAGS) $<
!endif
!ifeq USE_GUI 1
$(OBJS)\coredll_uxtheme.obj : .AUTODEPEND ..\..\src\msw\uxtheme.cpp
$(CXX) -bt=nt -zq -fo=$^@ $(COREDLL_CXXFLAGS) $<
@ -14057,6 +14080,11 @@ $(OBJS)\corelib_utilsgui.obj : .AUTODEPEND ..\..\src\msw\utilsgui.cpp
$(CXX) -bt=nt -zq -fo=$^@ $(CORELIB_CXXFLAGS) $<
!endif
!ifeq USE_GUI 1
$(OBJS)\corelib_utilswin.obj : .AUTODEPEND ..\..\src\msw\utilswin.cpp
$(CXX) -bt=nt -zq -fo=$^@ $(CORELIB_CXXFLAGS) $<
!endif
!ifeq USE_GUI 1
$(OBJS)\corelib_uxtheme.obj : .AUTODEPEND ..\..\src\msw\uxtheme.cpp
$(CXX) -bt=nt -zq -fo=$^@ $(CORELIB_CXXFLAGS) $<

View File

@ -2856,6 +2856,10 @@ SOURCE=..\..\src\msw\utilsgui.cpp
# End Source File
# Begin Source File
SOURCE=..\..\src\msw\utilswin.cpp
# End Source File
# Begin Source File
SOURCE=..\..\src\msw\ole\uuid.cpp
# End Source File
# Begin Source File

View File

@ -2575,6 +2575,9 @@
<File
RelativePath="..\..\src\msw\utilsgui.cpp">
</File>
<File
RelativePath="..\..\src\msw\utilswin.cpp">
</File>
<File
RelativePath="..\..\src\msw\ole\uuid.cpp">
</File>

View File

@ -3467,6 +3467,10 @@
RelativePath="..\..\src\msw\utilsgui.cpp"
>
</File>
<File
RelativePath="..\..\src\msw\utilswin.cpp"
>
</File>
<File
RelativePath="..\..\src\msw\ole\uuid.cpp"
>

View File

@ -3463,6 +3463,10 @@
RelativePath="..\..\src\msw\utilsgui.cpp"
>
</File>
<File
RelativePath="..\..\src\msw\utilswin.cpp"
>
</File>
<File
RelativePath="..\..\src\msw\ole\uuid.cpp"
>

View File

@ -621,3 +621,21 @@ int wxDisplayFactoryMSW::GetFromWindow(const wxWindow *window)
}
#endif // wxUSE_DISPLAY
void wxClientDisplayRect(int *x, int *y, int *width, int *height)
{
#if defined(__WXMICROWIN__)
*x = 0; *y = 0;
wxDisplaySize(width, height);
#else
// Determine the desktop dimensions minus the taskbar and any other
// special decorations...
RECT r;
SystemParametersInfo(SPI_GETWORKAREA, 0, &r, 0);
if (x) *x = r.left;
if (y) *y = r.top;
if (width) *width = r.right - r.left;
if (height) *height = r.bottom - r.top;
#endif
}

View File

@ -1,6 +1,6 @@
///////////////////////////////////////////////////////////////////////////////
// Name: src/msw/utilsgui.cpp
// Purpose: Various utility functions only available in GUI
// Purpose: Various utility functions only available in wxMSW GUI
// Author: Vadim Zeitlin
// Modified by:
// Created: 21.06.2003 (extracted from msw/utils.cpp)
@ -33,9 +33,6 @@
#include "wx/dynlib.h"
#include "wx/msw/private.h" // includes <windows.h>
#include "wx/msw/registry.h"
#include <shellapi.h> // needed for SHELLEXECUTEINFO
// ============================================================================
// implementation
@ -197,24 +194,6 @@ void wxDisplaySizeMM(int *width, int *height)
#endif
}
void wxClientDisplayRect(int *x, int *y, int *width, int *height)
{
#if defined(__WXMICROWIN__)
*x = 0; *y = 0;
wxDisplaySize(width, height);
#else
// Determine the desktop dimensions minus the taskbar and any other
// special decorations...
RECT r;
SystemParametersInfo(SPI_GETWORKAREA, 0, &r, 0);
if (x) *x = r.left;
if (y) *y = r.top;
if (width) *width = r.right - r.left;
if (height) *height = r.bottom - r.top;
#endif
}
// ---------------------------------------------------------------------------
// window information functions
// ---------------------------------------------------------------------------
@ -369,117 +348,3 @@ extern bool wxEnableFileNameAutoComplete(HWND hwnd)
return false;
#endif // wxUSE_DYNLIB_CLASS/!wxUSE_DYNLIB_CLASS
}
// ----------------------------------------------------------------------------
// Launch document with default app
// ----------------------------------------------------------------------------
bool wxLaunchDefaultApplication(const wxString& document, int flags)
{
wxUnusedVar(flags);
WinStruct<SHELLEXECUTEINFO> sei;
sei.lpFile = document.t_str();
#ifdef __WXWINCE__
sei.nShow = SW_SHOWNORMAL; // SW_SHOWDEFAULT not defined under CE (#10216)
#else
sei.nShow = SW_SHOWDEFAULT;
#endif
// avoid Windows message box in case of error for consistency with
// wxLaunchDefaultBrowser() even if don't show the error ourselves in this
// function
sei.fMask = SEE_MASK_FLAG_NO_UI;
if ( ::ShellExecuteEx(&sei) )
return true;
return false;
}
// ----------------------------------------------------------------------------
// Launch default browser
// ----------------------------------------------------------------------------
bool wxDoLaunchDefaultBrowser(const wxString& url, const wxString& scheme, int flags)
{
wxUnusedVar(flags);
#if wxUSE_IPC
if ( flags & wxBROWSER_NEW_WINDOW )
{
// ShellExecuteEx() opens the URL in an existing window by default so
// we can't use it if we need a new window
wxRegKey key(wxRegKey::HKCR, scheme + wxT("\\shell\\open"));
if ( !key.Exists() )
{
// try the default browser, it must be registered at least for http URLs
key.SetName(wxRegKey::HKCR, wxT("http\\shell\\open"));
}
if ( key.Exists() )
{
wxRegKey keyDDE(key, wxT("DDEExec"));
if ( keyDDE.Exists() )
{
// we only know the syntax of WWW_OpenURL DDE request for IE,
// optimistically assume that all other browsers are compatible
// with it
static const wxChar *TOPIC_OPEN_URL = wxT("WWW_OpenURL");
wxString ddeCmd;
wxRegKey keyTopic(keyDDE, wxT("topic"));
bool ok = keyTopic.Exists() &&
keyTopic.QueryDefaultValue() == TOPIC_OPEN_URL;
if ( ok )
{
ddeCmd = keyDDE.QueryDefaultValue();
ok = !ddeCmd.empty();
}
if ( ok )
{
// for WWW_OpenURL, the index of the window to open the URL
// in is -1 (meaning "current") by default, replace it with
// 0 which means "new" (see KB article 160957)
ok = ddeCmd.Replace(wxT("-1"), wxT("0"),
false /* only first occurrence */) == 1;
}
if ( ok )
{
// and also replace the parameters: the topic should
// contain a placeholder for the URL
ok = ddeCmd.Replace(wxT("%1"), url, false) == 1;
}
if ( ok )
{
// try to send it the DDE request now but ignore the errors
wxLogNull noLog;
const wxString ddeServer = wxRegKey(keyDDE, wxT("application"));
if ( wxExecuteDDE(ddeServer, TOPIC_OPEN_URL, ddeCmd) )
return true;
// this is not necessarily an error: maybe browser is
// simply not running, but no matter, in any case we're
// going to launch it using ShellExecuteEx() below now and
// we shouldn't try to open a new window if we open a new
// browser anyhow
}
}
}
}
#endif // wxUSE_IPC
WinStruct<SHELLEXECUTEINFO> sei;
sei.lpFile = url.c_str();
sei.lpVerb = wxT("open");
sei.nShow = SW_SHOWNORMAL;
sei.fMask = SEE_MASK_FLAG_NO_UI; // we give error message ourselves
if ( ::ShellExecuteEx(&sei) )
return true;
return false;
}

138
src/msw/utilswin.cpp Normal file
View File

@ -0,0 +1,138 @@
///////////////////////////////////////////////////////////////////////////////
// Name: src/msw/utilswin.cpp
// Purpose: Various utility functions only available in Windows GUI
// Author: Vadim Zeitlin
// Modified by:
// Created: 21.06.2003 (extracted from msw/utils.cpp)
// RCS-ID: $Id$
// Copyright: (c) Julian Smart
// Licence: wxWindows licence
///////////////////////////////////////////////////////////////////////////////
#include "wx/wxprec.h"
#ifdef __BORLANDC__
#pragma hdrstop
#endif
#ifndef WX_PRECOMP
#include "wx/utils.h"
#endif //WX_PRECOMP
#include "wx/msw/private.h" // includes <windows.h>
#include "wx/msw/registry.h"
#include <shellapi.h> // needed for SHELLEXECUTEINFO
// ----------------------------------------------------------------------------
// Launch document with default app
// ----------------------------------------------------------------------------
bool wxLaunchDefaultApplication(const wxString& document, int flags)
{
wxUnusedVar(flags);
WinStruct<SHELLEXECUTEINFO> sei;
sei.lpFile = document.t_str();
#ifdef __WXWINCE__
sei.nShow = SW_SHOWNORMAL; // SW_SHOWDEFAULT not defined under CE (#10216)
#else
sei.nShow = SW_SHOWDEFAULT;
#endif
// avoid Windows message box in case of error for consistency with
// wxLaunchDefaultBrowser() even if don't show the error ourselves in this
// function
sei.fMask = SEE_MASK_FLAG_NO_UI;
if ( ::ShellExecuteEx(&sei) )
return true;
return false;
}
// ----------------------------------------------------------------------------
// Launch default browser
// ----------------------------------------------------------------------------
bool wxDoLaunchDefaultBrowser(const wxString& url, const wxString& scheme, int flags)
{
wxUnusedVar(flags);
#if wxUSE_IPC
if ( flags & wxBROWSER_NEW_WINDOW )
{
// ShellExecuteEx() opens the URL in an existing window by default so
// we can't use it if we need a new window
wxRegKey key(wxRegKey::HKCR, scheme + wxT("\\shell\\open"));
if ( !key.Exists() )
{
// try the default browser, it must be registered at least for http URLs
key.SetName(wxRegKey::HKCR, wxT("http\\shell\\open"));
}
if ( key.Exists() )
{
wxRegKey keyDDE(key, wxT("DDEExec"));
if ( keyDDE.Exists() )
{
// we only know the syntax of WWW_OpenURL DDE request for IE,
// optimistically assume that all other browsers are compatible
// with it
static const wxChar *TOPIC_OPEN_URL = wxT("WWW_OpenURL");
wxString ddeCmd;
wxRegKey keyTopic(keyDDE, wxT("topic"));
bool ok = keyTopic.Exists() &&
keyTopic.QueryDefaultValue() == TOPIC_OPEN_URL;
if ( ok )
{
ddeCmd = keyDDE.QueryDefaultValue();
ok = !ddeCmd.empty();
}
if ( ok )
{
// for WWW_OpenURL, the index of the window to open the URL
// in is -1 (meaning "current") by default, replace it with
// 0 which means "new" (see KB article 160957)
ok = ddeCmd.Replace(wxT("-1"), wxT("0"),
false /* only first occurrence */) == 1;
}
if ( ok )
{
// and also replace the parameters: the topic should
// contain a placeholder for the URL
ok = ddeCmd.Replace(wxT("%1"), url, false) == 1;
}
if ( ok )
{
// try to send it the DDE request now but ignore the errors
wxLogNull noLog;
const wxString ddeServer = wxRegKey(keyDDE, wxT("application"));
if ( wxExecuteDDE(ddeServer, TOPIC_OPEN_URL, ddeCmd) )
return true;
// this is not necessarily an error: maybe browser is
// simply not running, but no matter, in any case we're
// going to launch it using ShellExecuteEx() below now and
// we shouldn't try to open a new window if we open a new
// browser anyhow
}
}
}
}
#endif // wxUSE_IPC
WinStruct<SHELLEXECUTEINFO> sei;
sei.lpFile = url.c_str();
sei.lpVerb = wxT("open");
sei.nShow = SW_SHOWNORMAL;
sei.fMask = SEE_MASK_FLAG_NO_UI; // we give error message ourselves
if ( ::ShellExecuteEx(&sei) )
return true;
return false;
}