diff --git a/Makefile.in b/Makefile.in index 4cd7651056..5b5e83a97f 100644 --- a/Makefile.in +++ b/Makefile.in @@ -2027,11 +2027,22 @@ STCDLL_CXXFLAGS = $(__stcdll_PCH_INC) -D__WX$(TOOLKIT)__ $(__WXUNIV_DEFINE_p) \ -I$(top_srcdir)/src/stc/scintilla/src -D__WX__ -DSCI_LEXER -DNO_CXX11_REGEX \ -DLINK_LEXERS -DWXUSINGDLL -DWXMAKINGDLL_STC $(PIC_FLAG) $(CXXWARNINGS) \ $(CPPFLAGS) $(CXXFLAGS) +STCDLL_OBJCXXFLAGS = $(__stcdll_PCH_INC) -D__WX$(TOOLKIT)__ \ + $(__WXUNIV_DEFINE_p) $(__DEBUG_DEFINE_p) $(__EXCEPTIONS_DEFINE_p) \ + $(__RTTI_DEFINE_p) $(__THREAD_DEFINE_p) -DWXBUILDING $(__INC_TIFF_BUILD_p) \ + $(__INC_TIFF_p) $(__INC_JPEG_p) $(__INC_PNG_p) $(__INC_ZLIB_p) \ + $(__INC_REGEX_p) $(__INC_EXPAT_p) \ + -I$(top_srcdir)/src/stc/scintilla/include \ + -I$(top_srcdir)/src/stc/scintilla/lexlib \ + -I$(top_srcdir)/src/stc/scintilla/src -D__WX__ -DSCI_LEXER -DNO_CXX11_REGEX \ + -DLINK_LEXERS -DWXUSINGDLL -DWXMAKINGDLL_STC $(PIC_FLAG) $(CPPFLAGS) \ + $(OBJCXXFLAGS) STCDLL_OBJECTS = \ $(__stcdll___win32rc) \ stcdll_stc.o \ stcdll_PlatWX.o \ - stcdll_ScintillaWX.o + stcdll_ScintillaWX.o \ + $(__STC_PLATFORM_SRC_OBJECTS_2) STCDLL_ODEP = $(_____pch_wxprec_stcdll_wx_wxprec_h_gch___depname) STCLIB_CXXFLAGS = $(__stclib_PCH_INC) -D__WX$(TOOLKIT)__ $(__WXUNIV_DEFINE_p) \ $(__DEBUG_DEFINE_p) $(__EXCEPTIONS_DEFINE_p) $(__RTTI_DEFINE_p) \ @@ -2041,10 +2052,20 @@ STCLIB_CXXFLAGS = $(__stclib_PCH_INC) -D__WX$(TOOLKIT)__ $(__WXUNIV_DEFINE_p) \ -I$(top_srcdir)/src/stc/scintilla/lexlib \ -I$(top_srcdir)/src/stc/scintilla/src -D__WX__ -DSCI_LEXER -DNO_CXX11_REGEX \ -DLINK_LEXERS $(CXXWARNINGS) $(CPPFLAGS) $(CXXFLAGS) +STCLIB_OBJCXXFLAGS = $(__stclib_PCH_INC) -D__WX$(TOOLKIT)__ \ + $(__WXUNIV_DEFINE_p) $(__DEBUG_DEFINE_p) $(__EXCEPTIONS_DEFINE_p) \ + $(__RTTI_DEFINE_p) $(__THREAD_DEFINE_p) -DWXBUILDING $(__INC_TIFF_BUILD_p) \ + $(__INC_TIFF_p) $(__INC_JPEG_p) $(__INC_PNG_p) $(__INC_ZLIB_p) \ + $(__INC_REGEX_p) $(__INC_EXPAT_p) \ + -I$(top_srcdir)/src/stc/scintilla/include \ + -I$(top_srcdir)/src/stc/scintilla/lexlib \ + -I$(top_srcdir)/src/stc/scintilla/src -D__WX__ -DSCI_LEXER -DNO_CXX11_REGEX \ + -DLINK_LEXERS $(CPPFLAGS) $(OBJCXXFLAGS) STCLIB_OBJECTS = \ stclib_stc.o \ stclib_PlatWX.o \ - stclib_ScintillaWX.o + stclib_ScintillaWX.o \ + $(__STC_PLATFORM_SRC_OBJECTS_3) STCLIB_ODEP = $(_____pch_wxprec_stclib_wx_wxprec_h_gch___depname) GLDLL_CXXFLAGS = $(__gldll_PCH_INC) -D__WX$(TOOLKIT)__ $(__WXUNIV_DEFINE_p) \ $(__DEBUG_DEFINE_p) $(__EXCEPTIONS_DEFINE_p) $(__RTTI_DEFINE_p) \ @@ -6112,8 +6133,13 @@ COND_TOOLKIT_X11___LOWLEVEL_SRC_OBJECTS_1 = \ @COND_TOOLKIT_GTK_TOOLKIT_VERSION_2@ = monodll_tabartgtk.o @COND_TOOLKIT_MSW@__AUI_PLATFORM_SRC_OBJECTS = \ @COND_TOOLKIT_MSW@ monodll_tabartmsw.o monodll_barartmsw.o -@COND_USE_STC_1@__MONOLIB_STC_SRC_OBJECTS = monodll_stc.o \ -@COND_USE_STC_1@ monodll_PlatWX.o monodll_ScintillaWX.o +COND_USE_STC_1___MONOLIB_STC_SRC_OBJECTS = \ + monodll_stc.o \ + monodll_PlatWX.o \ + monodll_ScintillaWX.o \ + $(__STC_PLATFORM_SRC_OBJECTS) +@COND_USE_STC_1@__MONOLIB_STC_SRC_OBJECTS = $(COND_USE_STC_1___MONOLIB_STC_SRC_OBJECTS) +@COND_TOOLKIT_OSX_COCOA@__STC_PLATFORM_SRC_OBJECTS = monodll_PlatWXcocoa.o @COND_PLATFORM_UNIX_1_USE_PLUGINS_0@__PLUGIN_SRC_OBJECTS \ @COND_PLATFORM_UNIX_1_USE_PLUGINS_0@ = monodll_sound_sdl.o @COND_PLATFORM_WIN32_1@__monodll___win32rc = monodll_version_rc.o @@ -8091,8 +8117,14 @@ COND_TOOLKIT_X11___LOWLEVEL_SRC_OBJECTS_3 = \ @COND_TOOLKIT_GTK_TOOLKIT_VERSION_2@ = monolib_tabartgtk.o @COND_TOOLKIT_MSW@__AUI_PLATFORM_SRC_OBJECTS_1 = \ @COND_TOOLKIT_MSW@ monolib_tabartmsw.o monolib_barartmsw.o -@COND_USE_STC_1@__MONOLIB_STC_SRC_OBJECTS_1 = monolib_stc.o \ -@COND_USE_STC_1@ monolib_PlatWX.o monolib_ScintillaWX.o +COND_USE_STC_1___MONOLIB_STC_SRC_OBJECTS_1 = \ + monolib_stc.o \ + monolib_PlatWX.o \ + monolib_ScintillaWX.o \ + $(__STC_PLATFORM_SRC_OBJECTS_1) +@COND_USE_STC_1@__MONOLIB_STC_SRC_OBJECTS_1 = $(COND_USE_STC_1___MONOLIB_STC_SRC_OBJECTS_1) +@COND_TOOLKIT_OSX_COCOA@__STC_PLATFORM_SRC_OBJECTS_1 \ +@COND_TOOLKIT_OSX_COCOA@ = monolib_PlatWXcocoa.o @COND_PLATFORM_UNIX_1_USE_PLUGINS_0@__PLUGIN_SRC_OBJECTS_1 \ @COND_PLATFORM_UNIX_1_USE_PLUGINS_0@ = monolib_sound_sdl.o COND_MONOLITHIC_0_SHARED_1___basedll___depname = \ @@ -12955,6 +12987,7 @@ COND_USE_SOVERSOLARIS_1___stcdll___so_symlinks_uninst_cmd = rm -f \ $(LIBPREFIX)wx_$(PORTNAME)$(WXUNIVNAME)$(WXUNICODEFLAG)$(WXDEBUGFLAG)$(WX_LIB_FLAVOUR)_stc-$(WX_RELEASE)$(HOST_SUFFIX).$(DLLIMP_SUFFIX) @COND_USE_SOVERSOLARIS_1@__stcdll___so_symlinks_uninst_cmd = $(COND_USE_SOVERSOLARIS_1___stcdll___so_symlinks_uninst_cmd) @COND_PLATFORM_WIN32_1@__stcdll___win32rc = stcdll_version_rc.o +@COND_TOOLKIT_OSX_COCOA@__STC_PLATFORM_SRC_OBJECTS_2 = stcdll_PlatWXcocoa.o COND_MONOLITHIC_0_SHARED_0_USE_STC_1___stclib___depname = \ $(LIBDIRNAME)/$(LIBPREFIX)wx_$(PORTNAME)$(WXUNIVNAME)$(WXUNICODEFLAG)$(WXDEBUGFLAG)$(WX_LIB_FLAVOUR)_stc-$(WX_RELEASE)$(HOST_SUFFIX)$(LIBEXT) @COND_MONOLITHIC_0_SHARED_0_USE_STC_1@__stclib___depname = $(COND_MONOLITHIC_0_SHARED_0_USE_STC_1___stclib___depname) @@ -12967,6 +13000,7 @@ COND_MONOLITHIC_0_SHARED_0_USE_STC_1___stclib___depname = \ @COND_ICC_PCH_1@ ./.pch/wxprec_stclib/wx/wxprec.h.gch @COND_USE_PCH_1@_____pch_wxprec_stclib_wx_wxprec_h_gch___depname \ @COND_USE_PCH_1@ = ./.pch/wxprec_stclib/wx/wxprec.h.gch +@COND_TOOLKIT_OSX_COCOA@__STC_PLATFORM_SRC_OBJECTS_3 = stclib_PlatWXcocoa.o @COND_SHARED_1@____wxstc_namedll_DEP = $(__stcdll___depname) @COND_SHARED_0@____wxstc_namelib_DEP = $(__stclib___depname) COND_SHARED_1_USE_GUI_1_USE_OPENGL_1___gldll___depname = \ @@ -17416,6 +17450,9 @@ monodll_PlatWX.o: $(srcdir)/src/stc/PlatWX.cpp $(MONODLL_ODEP) monodll_ScintillaWX.o: $(srcdir)/src/stc/ScintillaWX.cpp $(MONODLL_ODEP) $(CXXC) -c -o $@ $(MONODLL_CXXFLAGS) $(srcdir)/src/stc/ScintillaWX.cpp +monodll_PlatWXcocoa.o: $(srcdir)/src/stc/PlatWXcocoa.mm $(MONODLL_ODEP) + $(CXXC) -c -o $@ $(MONODLL_OBJCXXFLAGS) $(srcdir)/src/stc/PlatWXcocoa.mm + monodll_xml.o: $(srcdir)/src/xml/xml.cpp $(MONODLL_ODEP) $(CXXC) -c -o $@ $(MONODLL_CXXFLAGS) $(srcdir)/src/xml/xml.cpp @@ -22675,6 +22712,9 @@ monolib_PlatWX.o: $(srcdir)/src/stc/PlatWX.cpp $(MONOLIB_ODEP) monolib_ScintillaWX.o: $(srcdir)/src/stc/ScintillaWX.cpp $(MONOLIB_ODEP) $(CXXC) -c -o $@ $(MONOLIB_CXXFLAGS) $(srcdir)/src/stc/ScintillaWX.cpp +monolib_PlatWXcocoa.o: $(srcdir)/src/stc/PlatWXcocoa.mm $(MONOLIB_ODEP) + $(CXXC) -c -o $@ $(MONOLIB_OBJCXXFLAGS) $(srcdir)/src/stc/PlatWXcocoa.mm + monolib_xml.o: $(srcdir)/src/xml/xml.cpp $(MONOLIB_ODEP) $(CXXC) -c -o $@ $(MONOLIB_CXXFLAGS) $(srcdir)/src/xml/xml.cpp @@ -36613,6 +36653,9 @@ stcdll_PlatWX.o: $(srcdir)/src/stc/PlatWX.cpp $(STCDLL_ODEP) stcdll_ScintillaWX.o: $(srcdir)/src/stc/ScintillaWX.cpp $(STCDLL_ODEP) $(CXXC) -c -o $@ $(STCDLL_CXXFLAGS) $(srcdir)/src/stc/ScintillaWX.cpp +stcdll_PlatWXcocoa.o: $(srcdir)/src/stc/PlatWXcocoa.mm $(STCDLL_ODEP) + $(CXXC) -c -o $@ $(STCDLL_OBJCXXFLAGS) $(srcdir)/src/stc/PlatWXcocoa.mm + stclib_stc.o: $(srcdir)/src/stc/stc.cpp $(STCLIB_ODEP) $(CXXC) -c -o $@ $(STCLIB_CXXFLAGS) $(srcdir)/src/stc/stc.cpp @@ -36622,6 +36665,9 @@ stclib_PlatWX.o: $(srcdir)/src/stc/PlatWX.cpp $(STCLIB_ODEP) stclib_ScintillaWX.o: $(srcdir)/src/stc/ScintillaWX.cpp $(STCLIB_ODEP) $(CXXC) -c -o $@ $(STCLIB_CXXFLAGS) $(srcdir)/src/stc/ScintillaWX.cpp +stclib_PlatWXcocoa.o: $(srcdir)/src/stc/PlatWXcocoa.mm $(STCLIB_ODEP) + $(CXXC) -c -o $@ $(STCLIB_OBJCXXFLAGS) $(srcdir)/src/stc/PlatWXcocoa.mm + gldll_version_rc.o: $(srcdir)/src/msw/version.rc $(GLDLL_ODEP) $(WINDRES) -i$< -o$@ --define __WX$(TOOLKIT)__ $(__WXUNIV_DEFINE_p_67) $(__DEBUG_DEFINE_p_66) $(__EXCEPTIONS_DEFINE_p_65) $(__RTTI_DEFINE_p_65) $(__THREAD_DEFINE_p_65) --define WXBUILDING --define WXDLLNAME=$(WXDLLNAMEPREFIXGUI)$(WXUNICODEFLAG)$(WXDEBUGFLAG)$(WX_LIB_FLAVOUR)_gl$(WXCOMPILER)$(VENDORTAG)$(WXDLLVERSIONTAG) $(__RCDEFDIR_p) --include-dir $(top_srcdir)/include $(__INC_TIFF_BUILD_p_66) $(__INC_TIFF_p_66) $(__INC_JPEG_p_66) $(__INC_PNG_p_65) $(__INC_ZLIB_p_67) $(__INC_REGEX_p_65) $(__INC_EXPAT_p_65) --define WXUSINGDLL --define WXMAKINGDLL_GL diff --git a/autoconf_inc.m4 b/autoconf_inc.m4 index 8d9e122a8a..7607d65a88 100644 --- a/autoconf_inc.m4 +++ b/autoconf_inc.m4 @@ -278,7 +278,7 @@ dnl ### begin block 20_COND_MONOLITHIC_0_USE_RICHTEXT_1[wx.bkl] ### COND_MONOLITHIC_0_USE_RICHTEXT_1="" fi AC_SUBST(COND_MONOLITHIC_0_USE_RICHTEXT_1) -dnl ### begin block 20_COND_MONOLITHIC_0_USE_STC_1[wx.bkl] ### +dnl ### begin block 20_COND_MONOLITHIC_0_USE_STC_1[../../tests/test.bkl,wx.bkl] ### COND_MONOLITHIC_0_USE_STC_1="#" if test "x$MONOLITHIC" = "x0" -a "x$USE_STC" = "x1" ; then COND_MONOLITHIC_0_USE_STC_1="" diff --git a/build/bakefiles/common.bkl b/build/bakefiles/common.bkl index 7c17434719..1fe539ad02 100644 --- a/build/bakefiles/common.bkl +++ b/build/bakefiles/common.bkl @@ -180,7 +180,7 @@ $(mk.evalExpr(wxwin.mkLibName('richtext'))) - $(mk.evalExpr(wxwin.mkLibName('stc'))) + $(mk.evalExpr(wxwin.mkLibName('stc'))) diff --git a/build/bakefiles/files.bkl b/build/bakefiles/files.bkl index b7cc9e1699..047134a61f 100644 --- a/build/bakefiles/files.bkl +++ b/build/bakefiles/files.bkl @@ -3459,16 +3459,23 @@ IMPORTANT: please read docs/tech/tn0016.txt before modifying this file! - + src/stc/stc.cpp src/stc/PlatWX.cpp src/stc/ScintillaWX.cpp - + wx/stc/stc.h + + src/stc/PlatWXcocoa.mm + + + + + @@ -3650,6 +3657,16 @@ IMPORTANT: please read docs/tech/tn0016.txt before modifying this file! $(MEDIA_CMN_SRC) $(MEDIA_PLATFORM_SRC) $(MEDIA_CMN_HDR) $(MEDIA_PLATFORM_HDR) + + + $(STC_OSX_COCOA_SRC) + + + $(STC_OSX_COCOA_HDR) + + $(STC_CMN_SRC) $(STC_PLATFORM_SRC) + $(STC_CMN_HDR) $(STC_PLATFORM_HDR) + $(GUI_HDR) diff --git a/build/cmake/files.cmake b/build/cmake/files.cmake index 75cc4a916f..0e5f97b7f0 100644 --- a/build/cmake/files.cmake +++ b/build/cmake/files.cmake @@ -3196,13 +3196,20 @@ set(RICHTEXT_HDR wx/xrc/xh_richtext.h ) -set(STC_SRC +set(STC_CMN_SRC src/stc/stc.cpp src/stc/PlatWX.cpp src/stc/ScintillaWX.cpp ) -set(STC_HDR +set(STC_CMN_HDR wx/stc/stc.h ) +set(STC_OSX_COCOA_SRC + src/stc/PlatWXcocoa.mm +) + +set(STC_OSX_COCOA_HDR +) + diff --git a/build/cmake/lib/stc/CMakeLists.txt b/build/cmake/lib/stc/CMakeLists.txt index 82b79518fa..25bb80801e 100644 --- a/build/cmake/lib/stc/CMakeLists.txt +++ b/build/cmake/lib/stc/CMakeLists.txt @@ -9,7 +9,11 @@ include(../../source_groups.cmake) -wx_append_sources(STC_FILES STC) +wx_append_sources(STC_FILES STC_CMN) + +if(WXOSX_COCOA) + wx_append_sources(STC_FILES STC_OSX_COCOA) +endif() wx_add_builtin_library(wxscintilla src/stc/scintilla/lexers/LexA68k.cxx diff --git a/build/cmake/tests/gui/CMakeLists.txt b/build/cmake/tests/gui/CMakeLists.txt index 44aa37cbdf..75db39bb99 100644 --- a/build/cmake/tests/gui/CMakeLists.txt +++ b/build/cmake/tests/gui/CMakeLists.txt @@ -63,6 +63,7 @@ set(TEST_GUI_SRC controls/slidertest.cpp controls/spinctrldbltest.cpp controls/spinctrltest.cpp + controls/styledtextctrltest.cpp controls/textctrltest.cpp controls/textentrytest.cpp controls/togglebuttontest.cpp @@ -171,6 +172,9 @@ wx_exe_link_libraries(test_gui core) if(wxUSE_RICHTEXT) wx_exe_link_libraries(test_gui richtext) endif() +if(wxUSE_STC) + wx_exe_link_libraries(test_gui stc) +endif() if(wxUSE_MEDIACTRL) wx_exe_link_libraries(test_gui media) endif() diff --git a/build/files b/build/files index 8df05a9460..08fcbfb6d4 100644 --- a/build/files +++ b/build/files @@ -3129,10 +3129,15 @@ RICHTEXT_HDR = # wxSTC -STC_SRC = +STC_CMN_SRC = src/stc/stc.cpp src/stc/PlatWX.cpp src/stc/ScintillaWX.cpp -STC_HDR = +STC_CMN_HDR = wx/stc/stc.h + +STC_OSX_COCOA_SRC = + src/stc/PlatWXcocoa.mm +STC_OSX_COCOA_HDR = + diff --git a/build/osx/wxcocoa.xcodeproj/project.pbxproj b/build/osx/wxcocoa.xcodeproj/project.pbxproj index a7b2275d59..cc7dd28bf3 100644 --- a/build/osx/wxcocoa.xcodeproj/project.pbxproj +++ b/build/osx/wxcocoa.xcodeproj/project.pbxproj @@ -962,6 +962,9 @@ 4CB3626391CE34D4B1F71AA0 /* jdatasrc.c in Sources */ = {isa = PBXBuildFile; fileRef = DECAF5DD80383A2CA76EB383 /* jdatasrc.c */; }; 4CB3626391CE34D4B1F71AA1 /* jdatasrc.c in Sources */ = {isa = PBXBuildFile; fileRef = DECAF5DD80383A2CA76EB383 /* jdatasrc.c */; }; 4CB3626391CE34D4B1F71AA2 /* jdatasrc.c in Sources */ = {isa = PBXBuildFile; fileRef = DECAF5DD80383A2CA76EB383 /* jdatasrc.c */; }; + 4CECCB6D2224FAD300FF250C /* PlatWXcocoa.mm in Sources */ = {isa = PBXBuildFile; fileRef = 4CECCB6C2224FAD300FF250C /* PlatWXcocoa.mm */; }; + 4CECCB6E2224FADB00FF250C /* PlatWXcocoa.mm in Sources */ = {isa = PBXBuildFile; fileRef = 4CECCB6C2224FAD300FF250C /* PlatWXcocoa.mm */; }; + 4CECCB6F2224FAE300FF250C /* PlatWXcocoa.mm in Sources */ = {isa = PBXBuildFile; fileRef = 4CECCB6C2224FAD300FF250C /* PlatWXcocoa.mm */; }; 4CF9BA40653C3153805D88AB /* arcfind.cpp in Sources */ = {isa = PBXBuildFile; fileRef = C513377E9E303F778BA9D7ED /* arcfind.cpp */; }; 4CF9BA40653C3153805D88AC /* arcfind.cpp in Sources */ = {isa = PBXBuildFile; fileRef = C513377E9E303F778BA9D7ED /* arcfind.cpp */; }; 4CF9BA40653C3153805D88AD /* arcfind.cpp in Sources */ = {isa = PBXBuildFile; fileRef = C513377E9E303F778BA9D7ED /* arcfind.cpp */; }; @@ -4131,6 +4134,7 @@ 4BA819575B5136B09FA8FEB1 /* pen.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; name = pen.cpp; path = ../../src/osx/pen.cpp; sourceTree = ""; }; 4C4649974D8B3A109D1BF145 /* art_internal.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; name = art_internal.cpp; path = ../../src/ribbon/art_internal.cpp; sourceTree = ""; }; 4CB467F9898C3952A68D988B /* zutil.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; name = zutil.c; path = ../../src/zlib/zutil.c; sourceTree = ""; }; + 4CECCB6C2224FAD300FF250C /* PlatWXcocoa.mm */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.objcpp; name = PlatWXcocoa.mm; path = ../../src/stc/PlatWXcocoa.mm; sourceTree = ""; }; 4EB3B255D20F3AE5A95230F6 /* LexCSS.cxx */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; name = LexCSS.cxx; path = ../../src/stc/scintilla/lexers/LexCSS.cxx; sourceTree = ""; }; 4F58B88D42A93BD0B74ADF75 /* CallTip.cxx */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; name = CallTip.cxx; path = ../../src/stc/scintilla/src/CallTip.cxx; sourceTree = ""; }; 4F768B23D8B535CE8D0BD343 /* tif_jpeg_12.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; name = tif_jpeg_12.c; path = ../../src/tiff/libtiff/tif_jpeg_12.c; sourceTree = ""; }; @@ -6152,6 +6156,7 @@ D0B9C41A4D12345AAA764CAD /* stc.cpp */, 47FF6D792CA234C395692118 /* PlatWX.cpp */, 8E6F9D4319F639BE89E5A82F /* ScintillaWX.cpp */, + 4CECCB6C2224FAD300FF250C /* PlatWXcocoa.mm */, ); name = stc; sourceTree = ""; @@ -8066,6 +8071,7 @@ E3B3E4F75D503DB89B5C622F /* stc.cpp in Sources */, 908957F65B7E36F8BF3858DF /* PlatWX.cpp in Sources */, 3E6AA08E72A030D39D867D4D /* ScintillaWX.cpp in Sources */, + 4CECCB6F2224FAE300FF250C /* PlatWXcocoa.mm in Sources */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -8916,6 +8922,7 @@ D4EC9DB5F8DF319EA0FD26A5 /* LexVB.cxx in Sources */, 3C5E1A45A57B3169A4C073DA /* LexVerilog.cxx in Sources */, 16021CFD78623B8CBD08FC20 /* LexVHDL.cxx in Sources */, + 4CECCB6E2224FADB00FF250C /* PlatWXcocoa.mm in Sources */, 9CC92BB4B0E233A0A7F8127A /* LexVisualProlog.cxx in Sources */, 159E4248CB1333AD841D9F04 /* LexYAML.cxx in Sources */, 91364FDD73053139BBAA313C /* Accessor.cxx in Sources */, @@ -10141,6 +10148,7 @@ D4EC9DB5F8DF319EA0FD26A4 /* LexVB.cxx in Sources */, 3C5E1A45A57B3169A4C073D9 /* LexVerilog.cxx in Sources */, 16021CFD78623B8CBD08FC1F /* LexVHDL.cxx in Sources */, + 4CECCB6D2224FAD300FF250C /* PlatWXcocoa.mm in Sources */, 9CC92BB4B0E233A0A7F81279 /* LexVisualProlog.cxx in Sources */, 159E4248CB1333AD841D9F03 /* LexYAML.cxx in Sources */, 91364FDD73053139BBAA313B /* Accessor.cxx in Sources */, diff --git a/build/upmake b/build/upmake index 33b6d0c7fb..de8d1c80b4 100755 --- a/build/upmake +++ b/build/upmake @@ -1441,7 +1441,7 @@ if (!$only_bkl) { qa => [qw(QA)], ribbon => [qw(RIBBON)], richtext => [qw(RICHTEXT)], - stc => [qw(STC)], + stc => [qw(STC_CMN)], webview => [qw(WEBVIEW_CMN WEBVIEW_MSW)], xml => [qw(XML)], xrc => [qw(XRC)], diff --git a/build/upmake_script.pl b/build/upmake_script.pl index f11bbeaf72..594e553c74 100755 --- a/build/upmake_script.pl +++ b/build/upmake_script.pl @@ -82,7 +82,7 @@ if (!$only_bkl) { qa => [qw(QA)], ribbon => [qw(RIBBON)], richtext => [qw(RICHTEXT)], - stc => [qw(STC)], + stc => [qw(STC_CMN)], webview => [qw(WEBVIEW_CMN WEBVIEW_MSW)], xml => [qw(XML)], xrc => [qw(XRC)], diff --git a/configure b/configure index e289050304..1415627456 100755 --- a/configure +++ b/configure @@ -1026,6 +1026,7 @@ infodir docdir oldincludedir includedir +runstatedir localstatedir sharedstatedir sysconfdir @@ -1449,6 +1450,7 @@ datadir='${datarootdir}' sysconfdir='${prefix}/etc' sharedstatedir='${prefix}/com' localstatedir='${prefix}/var' +runstatedir='${localstatedir}/run' includedir='${prefix}/include' oldincludedir='/usr/include' docdir='${datarootdir}/doc/${PACKAGE_TARNAME}' @@ -1701,6 +1703,15 @@ do | -silent | --silent | --silen | --sile | --sil) silent=yes ;; + -runstatedir | --runstatedir | --runstatedi | --runstated \ + | --runstate | --runstat | --runsta | --runst | --runs \ + | --run | --ru | --r) + ac_prev=runstatedir ;; + -runstatedir=* | --runstatedir=* | --runstatedi=* | --runstated=* \ + | --runstate=* | --runstat=* | --runsta=* | --runst=* | --runs=* \ + | --run=* | --ru=* | --r=*) + runstatedir=$ac_optarg ;; + -sbindir | --sbindir | --sbindi | --sbind | --sbin | --sbi | --sb) ac_prev=sbindir ;; -sbindir=* | --sbindir=* | --sbindi=* | --sbind=* | --sbin=* \ @@ -1838,7 +1849,7 @@ fi for ac_var in exec_prefix prefix bindir sbindir libexecdir datarootdir \ datadir sysconfdir sharedstatedir localstatedir includedir \ oldincludedir docdir infodir htmldir dvidir pdfdir psdir \ - libdir localedir mandir + libdir localedir mandir runstatedir do eval ac_val=\$$ac_var # Remove trailing slashes. @@ -1991,6 +2002,7 @@ Fine tuning of the installation directories: --sysconfdir=DIR read-only single-machine data [PREFIX/etc] --sharedstatedir=DIR modifiable architecture-independent data [PREFIX/com] --localstatedir=DIR modifiable single-machine data [PREFIX/var] + --runstatedir=DIR modifiable per-process data [LOCALSTATEDIR/run] --libdir=DIR object code libraries [EPREFIX/lib] --includedir=DIR C header files [PREFIX/include] --oldincludedir=DIR C header files for non-gcc [/usr/include] diff --git a/include/wx/stc/stc.h b/include/wx/stc/stc.h index f069dfe2fb..94ce11aa2c 100644 --- a/include/wx/stc/stc.h +++ b/include/wx/stc/stc.h @@ -5187,6 +5187,16 @@ public: // Register an image for use in autocompletion lists. void RegisterImage(int type, const wxBitmap& bmp); + // Set the colours used to display the items in an autocompletion list. + void AutoCompSetColours(const wxColour& background, const wxColour& text, + const wxColour& highlight, + const wxColour& highlightText); + + // Use a wxListCtrl to display autocompletion lists. + void AutoCompUseListCtrl(bool useListCtrl = true, + const wxColour& currentBgColour = wxNullColour, + const wxColour& currentTextColour = wxNullColour); + // The following methods are nearly equivalent to their similarly named diff --git a/interface/wx/stc/stc.h b/interface/wx/stc/stc.h index 21a3a4cac4..f7ca8e70c6 100644 --- a/interface/wx/stc/stc.h +++ b/interface/wx/stc/stc.h @@ -7423,6 +7423,54 @@ public: */ void RegisterImage(int type, const wxBitmap& bmp); + /** + Set the colours used to display the items in an autocompletion list. + + This method can be used if the default colours make the list hard to + read or if specific colours are desired for whatever reason. + @param background + The colour used for the background of the list. + @param text + The colour used for all text except for the selected item. + @param highlight + The colour used to highlight the selected item in the list. + @param highlightText + The colour used for the text of the selected item. + @remarks + To reset one or more of the colours to its default, + call this method with wxNullColour for the colour or colours + to be reset. + + @since 3.1.3 + */ + void AutoCompSetColours(const wxColour& background, const wxColour& text, + const wxColour& highlight, + const wxColour& highlightText); + + /** + Use a wxListCtrl to display autocompletion and user lists. + + By default lists will be displayed in a wxListBox. Use this method to + display them in a wxListCtrl instead. The primary difference is that + wxListCtrl has hot tracking to highlight the item under the mouse cursor. + @param useListCtrl + Set this to true to use a wxListCtrl and to false to use a + wxListBox. + @param currentBgColour + The colour used to highlight the item under the mouse cursor. + @param currentTextColour + The colour used for the text of the item under the mouse cursor. + @remarks + To reset one or more of the colours to its default, + call this method with wxNullColour for the colour or colours + to be reset. + + @since 3.1.3 + */ + void AutoCompUseListCtrl(bool useListCtrl = true, + const wxColour& currentBgColour = wxNullColour, + const wxColour& currentTextColour = wxNullColour); + //@} diff --git a/samples/stc/edit.cpp b/samples/stc/edit.cpp index e9aeac9990..0900639684 100644 --- a/samples/stc/edit.cpp +++ b/samples/stc/edit.cpp @@ -52,6 +52,22 @@ // The (uniform) style used for the annotations. const int ANNOTATION_STYLE = wxSTC_STYLE_LASTPREDEFINED + 1; +// A small image of a hashtag symbol used in the autocompletion window. +const char* hashtag_xpm[] = { +"10 10 2 1", +" c None", +". c #BD08F9", +" .. .. ", +" .. .. ", +"..........", +"..........", +" .. .. ", +" .. .. ", +"..........", +"..........", +" .. .. ", +" .. .. "}; + //============================================================================ // implementation //============================================================================ @@ -115,6 +131,7 @@ wxBEGIN_EVENT_TABLE (Edit, wxStyledTextCtrl) // stc EVT_STC_MARGINCLICK (wxID_ANY, Edit::OnMarginClick) EVT_STC_CHARADDED (wxID_ANY, Edit::OnCharAdded) + EVT_STC_CALLTIP_CLICK(wxID_ANY, Edit::OnCallTipClick) EVT_KEY_DOWN( Edit::OnKeyDown ) wxEND_EVENT_TABLE() @@ -169,6 +186,14 @@ Edit::Edit (wxWindow *parent, wxWindowID id, // annotations AnnotationSetVisible(wxSTC_ANNOTATION_BOXED); + // autocompletion + wxBitmap bmp(hashtag_xpm); + RegisterImage(0, bmp); + + // call tips + CallTipSetBackground(*wxYELLOW); + m_calltipNo = 1; + // miscellaneous m_LineNrMargin = TextWidth (wxSTC_STYLE_LINENUMBER, "_999999"); m_FoldingMargin = 16; @@ -211,11 +236,9 @@ void Edit::OnKeyDown (wxKeyEvent &event) CallTipCancel(); if (event.GetKeyCode() == WXK_SPACE && event.ControlDown() && event.ShiftDown()) { - int pos = GetCurrentPos(); - CallTipSetBackground(*wxYELLOW); - CallTipShow(pos, - "This is a CallTip with multiple lines.\n" - "It is meant to be a context sensitive popup helper for the user."); + // Show our first call tip at the current position of the caret. + m_calltipNo = 1; + ShowCallTipAt(GetCurrentPos()); return; } event.Skip(); @@ -481,11 +504,50 @@ void Edit::OnCharAdded (wxStyledTextEvent &event) { SetLineIndentation (currentLine, lineInd); GotoPos(PositionFromLine (currentLine) + lineInd); } + else if (chr == '#') { + wxString s = "define?0 elif?0 else?0 endif?0 error?0 if?0 ifdef?0 " + "ifndef?0 include?0 line?0 pragma?0 undef?0"; + AutoCompShow(0,s); + } +} + +void Edit::OnCallTipClick(wxStyledTextEvent &event) +{ + if ( event.GetPosition() == 1 ) { + // If position=1, the up arrow has been clicked. Show the next tip. + m_calltipNo = m_calltipNo==3?1:(m_calltipNo+1); + ShowCallTipAt(CallTipPosAtStart()); + } + else if ( event.GetPosition() == 2 ) { + // If position=2, the down arrow has been clicked. Show previous tip. + m_calltipNo = m_calltipNo==1?3:(m_calltipNo-1); + ShowCallTipAt(CallTipPosAtStart()); + } } //---------------------------------------------------------------------------- // private functions +void Edit::ShowCallTipAt(int position) +{ + // In a call tip string, the character '\001' will become a clickable + // up arrow and '\002' will become a clickable down arrow. + wxString ctString = wxString::Format("\001 %d of 3 \002 ", m_calltipNo); + if ( m_calltipNo == 1 ) + ctString += "This is a call tip. Try clicking the up or down buttons."; + else if ( m_calltipNo == 2 ) + ctString += "It is meant to be a context sensitive popup helper for " + "the user."; + else + ctString += "This is a call tip with multiple lines.\n" + "You can provide slightly longer help with " + "call tips like these."; + + if ( CallTipActive() ) + CallTipCancel(); + CallTipShow(position, ctString); +} + wxString Edit::DeterminePrefs (const wxString &filename) { LanguageInfo const* curInfo; diff --git a/samples/stc/edit.h b/samples/stc/edit.h index 703ebae395..09ca020847 100644 --- a/samples/stc/edit.h +++ b/samples/stc/edit.h @@ -105,9 +105,13 @@ public: // stc void OnMarginClick (wxStyledTextEvent &event); void OnCharAdded (wxStyledTextEvent &event); + void OnCallTipClick(wxStyledTextEvent &event); void OnKeyDown(wxKeyEvent &event); + // call tips + void ShowCallTipAt(int position); + //! language/lexer wxString DeterminePrefs (const wxString &filename); bool InitializePrefs (const wxString &filename); @@ -137,6 +141,9 @@ private: int m_FoldingMargin; int m_DividerID; + // call tip data + int m_calltipNo; + wxDECLARE_EVENT_TABLE(); }; diff --git a/src/stc/PlatWX.cpp b/src/stc/PlatWX.cpp index 6ac1b876af..c9fdfe9ee8 100644 --- a/src/stc/PlatWX.cpp +++ b/src/stc/PlatWX.cpp @@ -32,6 +32,13 @@ #include "wx/tokenzr.h" #include "wx/dynlib.h" #include "wx/scopedarray.h" +#include "wx/toplevel.h" +#include "wx/vlbox.h" +#include "wx/sizer.h" +#include "wx/renderer.h" +#include "wx/hashset.h" +#include "wx/dcclient.h" +#include "wx/wupdlock.h" #ifdef wxHAS_RAW_BITMAP #include "wx/rawbmp.h" @@ -55,6 +62,14 @@ #include "wx/dcscreen.h" #endif +#if defined(__WXGTK__) && wxSTC_POPUP_IS_FRAME + #include "wx/gtk/private/wrapgtk.h" +#elif defined(__WXMSW__) + #include "wx/msw/wrapwin.h" +#elif defined(__WXOSX_COCOA__) + #include "PlatWXcocoa.h" +#endif + Point Point::FromLong(long lpoint) { return Point(lpoint & 0xFFFF, lpoint >> 16); } @@ -1983,544 +1998,400 @@ PRectangle Window::GetMonitorRect(Point pt) { return PRectangleFromwxRect(dpy.GetGeometry()); } + //---------------------------------------------------------------------- -// Helper classes for ListBox +// wxSTCPopupBase and wxSTCPopupWindow +#ifdef __WXOSX_COCOA__ -// This is a simple subclass of wxListView that just resets focus to the -// parent when it gets it. -class wxSTCListBox : public wxListView { -public: - wxSTCListBox(wxWindow* parent, wxWindowID id, - const wxPoint& pos, const wxSize& size, - long style) - : wxListView() + wxSTCPopupBase::wxSTCPopupBase(wxWindow* parent):wxNonOwnedWindow() { -#ifdef __WXMSW__ - Hide(); // don't flicker as we move it around... -#endif - Create(parent, id, pos, size, style); + m_nativeWin = CreateFloatingWindow(this); + wxNonOwnedWindow::Create(parent, m_nativeWin); + m_stc = wxDynamicCast(parent, wxStyledTextCtrl); + m_isShown = false; + + Bind(wxEVT_ENTER_WINDOW, &wxSTCPopupBase::OnMouseEnter, this); + Bind(wxEVT_LEAVE_WINDOW, &wxSTCPopupBase::OnMouseLeave, this); } - - void OnFocus(wxFocusEvent& event) { - GetParent()->SetFocus(); - event.Skip(); - } - - void OnKillFocus(wxFocusEvent& WXUNUSED(event)) { - // Do nothing. Prevents base class from resetting the colors... - } - -#ifdef __WXMAC__ - // For some reason I don't understand yet the focus doesn't really leave - // the listbox like it should, so if we get any events feed them back to - // the wxSTC - void OnKeyDown(wxKeyEvent& event) { - GetGrandParent()->GetEventHandler()->ProcessEvent(event); - } - void OnChar(wxKeyEvent& event) { - GetGrandParent()->GetEventHandler()->ProcessEvent(event); - } - - // And we need to force the focus back when being destroyed - ~wxSTCListBox() { - GetGrandParent()->SetFocus(); - } -#endif - -private: - wxDECLARE_EVENT_TABLE(); -}; - -wxBEGIN_EVENT_TABLE(wxSTCListBox, wxListView) - EVT_SET_FOCUS( wxSTCListBox::OnFocus) - EVT_KILL_FOCUS(wxSTCListBox::OnKillFocus) -#ifdef __WXMAC__ - EVT_KEY_DOWN( wxSTCListBox::OnKeyDown) - EVT_CHAR( wxSTCListBox::OnChar) -#endif -wxEND_EVENT_TABLE() - - - -#if wxUSE_POPUPWIN //----------------------------------- -#include "wx/popupwin.h" - -// A popup window to place the wxSTCListBox upon -class wxSTCListBoxWin : public wxPopupWindow -{ -private: - wxListView* lv; - CallBackAction doubleClickAction; - void* doubleClickActionData; -public: - wxSTCListBoxWin(wxWindow* parent, wxWindowID id, Point WXUNUSED(location)) : - wxPopupWindow(parent, wxBORDER_SIMPLE) + wxSTCPopupBase::~wxSTCPopupBase() { + UnsubclassWin(); + CloseFloatingWindow(m_nativeWin); - lv = new wxSTCListBox(parent, id, wxPoint(-50,-50), wxDefaultSize, - wxLC_REPORT | wxLC_SINGLE_SEL | wxLC_NO_HEADER | wxBORDER_NONE); - lv->SetCursor(wxCursor(wxCURSOR_ARROW)); - lv->InsertColumn(0, wxEmptyString); - lv->InsertColumn(1, wxEmptyString); - - // NOTE: We need to fool the wxListView into thinking that it has the - // focus so it will use the normal selection colour and will look - // "right" to the user. But since the wxPopupWindow or its children - // can't receive focus then we have to pull a fast one and temporarily - // parent the listctrl on the STC window and then call SetFocus and - // then reparent it back to the popup. - lv->SetFocus(); - lv->Reparent(this); -#ifdef __WXMSW__ - lv->Show(); -#endif -#if defined(__WXOSX_COCOA__) || defined(__WXGTK__) - // This color will end up being our border - SetBackgroundColour(wxColour(0xC0, 0xC0, 0xC0)); -#endif + SetSTCCursor(wxSTC_CURSORNORMAL); } + bool wxSTCPopupBase::Show(bool show) + { + if ( !wxWindowBase::Show(show) ) + return false; - // Set position in client coords - virtual void DoSetSize(int x, int y, - int width, int height, - int sizeFlags = wxSIZE_AUTO) wxOVERRIDE { - if (x != wxDefaultCoord) { - GetParent()->ClientToScreen(&x, NULL); + if ( show ) + { + ShowFloatingWindow(m_nativeWin); + + if ( GetRect().Contains(::wxMouseState().GetPosition()) ) + SetSTCCursor(wxSTC_CURSORARROW); } - if (y != wxDefaultCoord) { - GetParent()->ClientToScreen(NULL, &y); + else + { + HideFloatingWindow(m_nativeWin); + SetSTCCursor(wxSTC_CURSORNORMAL); } - wxPopupWindow::DoSetSize(x, y, width, height, sizeFlags); - } - // return position as if it were in client coords - virtual void DoGetPosition( int *x, int *y ) const wxOVERRIDE { - int sx, sy; - wxPopupWindow::DoGetPosition(&sx, &sy); - GetParent()->ScreenToClient(&sx, &sy); - if (x) *x = sx; - if (y) *y = sy; - } - - - bool Destroy() wxOVERRIDE { - if ( !wxPendingDelete.Member(this) ) - wxPendingDelete.Append(this); return true; } + void wxSTCPopupBase::DoSetSize(int x, int y, int width, int ht, int flags) + { + wxSize oldSize = GetSize(); + wxNonOwnedWindow::DoSetSize(x, y, width, ht, flags); - int IconWidth() { - wxImageList* il = lv->GetImageList(wxIMAGE_LIST_SMALL); - if (il != NULL) { - int w, h; - il->GetSize(0, w, h); - return w; + if ( oldSize != GetSize() ) + SendSizeEvent(); + } + + void wxSTCPopupBase::SetSTCCursor(int cursor) + { + if ( m_stc ) + m_stc->SetSTCCursor(cursor); + } + + void wxSTCPopupBase::OnMouseEnter(wxMouseEvent& WXUNUSED(event)) + { + SetSTCCursor(wxSTC_CURSORARROW); + } + + void wxSTCPopupBase::OnMouseLeave(wxMouseEvent& WXUNUSED(event)) + { + SetSTCCursor(wxSTC_CURSORNORMAL); + } + +#elif wxUSE_POPUPWIN + + wxSTCPopupBase::wxSTCPopupBase(wxWindow* parent) + :wxPopupWindow(parent, wxPU_CONTAINS_CONTROLS) + { + } + + #ifdef __WXGTK__ + + wxSTCPopupBase::~wxSTCPopupBase() + { + wxRect rect = GetRect(); + GetParent()->ScreenToClient(&(rect.x), &(rect.y)); + GetParent()->Refresh(false, &rect); } - return 0; - } + #elif defined(__WXMSW__) - void SetDoubleClickAction(CallBackAction action, void *data) { - doubleClickAction = action; - doubleClickActionData = data; - } + // Do not activate the window when it is shown. + bool wxSTCPopupBase::Show(bool show) + { + if ( !wxWindowBase::Show(show) ) + return false; + if ( show ) + { + HWND hWnd = reinterpret_cast(GetHandle()); + if ( GetName() == "wxSTCCallTip" ) + ::AnimateWindow(hWnd, 25, AW_BLEND); + else + ::ShowWindow(hWnd, SW_SHOWNA ); - void OnFocus(wxFocusEvent& event) { - GetParent()->SetFocus(); - event.Skip(); - } + ::SetWindowPos(hWnd, HWND_NOTOPMOST, 0, 0, 0, 0, + SWP_NOMOVE | SWP_NOSIZE | SWP_NOACTIVATE); + } + else + wxPopupWindow::Show(false); - void OnSize(wxSizeEvent& event) { - // resize the child to fill the popup - wxSize sz = GetClientSize(); - int x, y, w, h; - x = y = 0; - w = sz.x; - h = sz.y; -#if defined(__WXOSX_COCOA__) || defined(__WXGTK__) - // make room for the parent's bg color to show, to act as a border - x = y = 1; - w -= 2; - h -= 2; -#endif - lv->SetSize(x, y, w, h); - // reset the column widths - lv->SetColumnWidth(0, IconWidth()+4); - lv->SetColumnWidth(1, w - 2 - lv->GetColumnWidth(0) - - wxSystemSettings::GetMetric(wxSYS_VSCROLL_X)); - event.Skip(); - } + return true; + } - void OnActivate(wxListEvent& WXUNUSED(event)) { - doubleClickAction(doubleClickActionData); - } + // Do not activate in response to mouse clicks on this window. + bool wxSTCPopupBase::MSWHandleMessage(WXLRESULT *res, WXUINT msg, + WXWPARAM wParam, WXLPARAM lParam) + { + if ( msg == WM_MOUSEACTIVATE ) + { + *res = MA_NOACTIVATE; + return true; + } + else + return wxPopupWindow::MSWHandleMessage(res, msg, wParam,lParam); + } - wxListView* GetLB() { return lv; } + #endif // __WXGTK__ -private: - wxDECLARE_EVENT_TABLE(); - -}; - -wxBEGIN_EVENT_TABLE(wxSTCListBoxWin, wxPopupWindow) - EVT_SET_FOCUS ( wxSTCListBoxWin::OnFocus) - EVT_SIZE ( wxSTCListBoxWin::OnSize) - EVT_LIST_ITEM_ACTIVATED(wxID_ANY, wxSTCListBoxWin::OnActivate) -wxEND_EVENT_TABLE() - - - -#else // !wxUSE_POPUPWIN ----------------------------------- -#include "wx/frame.h" - -// A normal window to place the wxSTCListBox upon, but make it behave as much -// like a wxPopupWindow as possible -class wxSTCListBoxWin : public wxFrame { -private: - wxListView* lv; - CallBackAction doubleClickAction; - void* doubleClickActionData; -public: - wxSTCListBoxWin(wxWindow* parent, wxWindowID id, Point location) : - wxFrame(parent, id, wxEmptyString, wxPoint(location.x, location.y), wxSize(0,0), - wxFRAME_NO_TASKBAR - | wxFRAME_FLOAT_ON_PARENT -#ifdef __WXMAC__ - | wxPOPUP_WINDOW - | wxNO_BORDER #else - | wxSIMPLE_BORDER -#endif - ) + + wxSTCPopupBase::wxSTCPopupBase(wxWindow* parent) + :wxFrame(parent, wxID_ANY, wxEmptyString, + wxDefaultPosition, wxDefaultSize, + wxFRAME_FLOAT_ON_PARENT | wxBORDER_NONE) { - - lv = new wxSTCListBox(this, id, wxDefaultPosition, wxDefaultSize, - wxLC_REPORT | wxLC_SINGLE_SEL | wxLC_NO_HEADER | wxNO_BORDER); - lv->SetCursor(wxCursor(wxCURSOR_ARROW)); - lv->InsertColumn(0, wxEmptyString); - lv->InsertColumn(1, wxEmptyString); - - // Eventhough we immediately reset the focus to the parent, this helps - // things to look right... - lv->SetFocus(); - - Hide(); + #if defined(__WXGTK__) + gtk_window_set_accept_focus(GTK_WINDOW(this->GetHandle()), FALSE); + #endif } + #ifdef __WXMSW__ - // On OSX and (possibly others) there can still be pending - // messages/events for the list control when Scintilla wants to - // close it, so do a pending delete of it instead of destroying - // immediately. - bool Destroy() + // Use ShowWithoutActivating instead of show. + bool wxSTCPopupBase::Show(bool show) wxOVERRIDE + { + if ( show ) + { + if ( IsShown() ) + return false; + else + { + ShowWithoutActivating(); + return true; + } + } + else + return wxFrame::Show(false); + } + + // Do not activate in response to mouse clicks on this window. + bool wxSTCPopupBase::MSWHandleMessage(WXLRESULT *res, WXUINT msg, + WXWPARAM wParam, WXLPARAM lParam) wxOVERRIDE + { + if ( msg == WM_MOUSEACTIVATE ) + { + *res = MA_NOACTIVATE; + return true; + } + else + return wxFrame::MSWHandleMessage(res, msg, wParam, lParam); + } + + #elif !wxSTC_POPUP_IS_CUSTOM + + void wxSTCPopupBase::ActivateParent() + { + // Although we're a frame, we always want the parent to be active, + // so raise it whenever we get shown, focused, etc. + wxTopLevelWindow *frame = wxDynamicCast( + wxGetTopLevelParent(GetParent()), wxTopLevelWindow); + if (frame) + frame->Raise(); + } + + bool wxSTCPopupBase::Show(bool show) + { + bool rv = wxFrame::Show(show); + if (rv && show) + ActivateParent(); + + #ifdef __WXMAC__ + GetParent()->Refresh(false); + #endif + } + + #endif + +#endif // __WXOSX_COCOA__ + +wxSTCPopupWindow::wxSTCPopupWindow(wxWindow* parent) + :wxSTCPopupBase(parent), m_initialPosition(wxDefaultPosition) +{ + #if !wxSTC_POPUP_IS_CUSTOM + Bind(wxEVT_SET_FOCUS, &wxSTCPopupWindow::OnFocus, this); + #endif + + m_tlw = wxDynamicCast(wxGetTopLevelParent(parent), wxTopLevelWindow); + if ( m_tlw ) { -#ifdef __WXMAC__ + m_tlw->Bind(wxEVT_MOVE, &wxSTCPopupWindow::OnParentMove, this); + #if defined(__WXOSX_COCOA__) || (defined(__WXGTK__)&&!wxSTC_POPUP_IS_FRAME) + m_tlw->Bind(wxEVT_ICONIZE, &wxSTCPopupWindow::OnIconize, this); + #endif + } +} + +wxSTCPopupWindow::~wxSTCPopupWindow() +{ + if ( m_tlw ) + { + m_tlw->Unbind(wxEVT_MOVE, &wxSTCPopupWindow::OnParentMove, this); + #if defined(__WXOSX_COCOA__) || (defined(__WXGTK__)&&!wxSTC_POPUP_IS_FRAME) + m_tlw->Unbind(wxEVT_ICONIZE, &wxSTCPopupWindow::OnIconize, this); + #endif + } +} + +bool wxSTCPopupWindow::Destroy() +{ + #if defined(__WXMAC__) && wxSTC_POPUP_IS_FRAME && !wxSTC_POPUP_IS_CUSTOM // The bottom edge of this window is not getting properly // refreshed upon deletion, so help it out... wxWindow* p = GetParent(); wxRect r(GetPosition(), GetSize()); r.SetHeight(r.GetHeight()+1); p->Refresh(false, &r); -#endif - if ( !wxPendingDelete.Member(this) ) - wxPendingDelete.Append(this); - return true; + #endif + + if ( !wxPendingDelete.Member(this) ) + wxPendingDelete.Append(this); + + return true; +} + +bool wxSTCPopupWindow::AcceptsFocus() const +{ + return false; +} + +void wxSTCPopupWindow::DoSetSize(int x, int y, int width, int height, int flags) +{ + if ( m_initialPosition == wxDefaultPosition + && x != wxDefaultCoord && y != wxDefaultCoord ) + m_initialPosition = wxPoint(x, y); + + // convert coords to screen coords since we're a top-level window + if (x != wxDefaultCoord) + GetParent()->ClientToScreen(&x, NULL); + + if (y != wxDefaultCoord) + GetParent()->ClientToScreen(NULL, &y); + + wxSTCPopupBase::DoSetSize(x, y, width, height, flags); +} + +void wxSTCPopupWindow::OnParentMove(wxMoveEvent& event) +{ + if ( m_initialPosition != wxDefaultPosition ) + SetPosition(m_initialPosition); + event.Skip(); +} + +#if defined(__WXOSX_COCOA__) || (defined(__WXGTK__) && !wxSTC_POPUP_IS_FRAME) + + void wxSTCPopupWindow::OnIconize(wxIconizeEvent& event) + { + Show(!event.IsIconized()); } +#elif !wxSTC_POPUP_IS_CUSTOM - int IconWidth() + void wxSTCPopupWindow::OnFocus(wxFocusEvent& event) { - wxImageList* il = lv->GetImageList(wxIMAGE_LIST_SMALL); - if (il != NULL) { - int w, h; - il->GetSize(0, w, h); - return w; - } - return 0; - } + #if wxSTC_POPUP_IS_FRAME + ActivateParent(); + #endif - - void SetDoubleClickAction(CallBackAction action, void *data) - { - doubleClickAction = action; - doubleClickActionData = data; - } - - - void OnFocus(wxFocusEvent& event) - { - ActivateParent(); GetParent()->SetFocus(); event.Skip(); } - void OnSize(wxSizeEvent& event) - { - // resize the child - wxSize sz = GetClientSize(); - lv->SetSize(sz); - // reset the column widths - lv->SetColumnWidth(0, IconWidth()+4); - lv->SetColumnWidth(1, sz.x - 2 - lv->GetColumnWidth(0) - - wxSystemSettings::GetMetric(wxSYS_VSCROLL_X)); - event.Skip(); - } +#endif // __WXOSX_COCOA__ - void ActivateParent() - { - // Although we're a frame, we always want the parent to be active, so - // raise it whenever we get shown, focused, etc. - wxTopLevelWindow *frame = wxDynamicCast( - wxGetTopLevelParent(GetParent()), wxTopLevelWindow); - if (frame) - frame->Raise(); - } - - - virtual void DoSetSize(int x, int y, - int width, int height, - int sizeFlags = wxSIZE_AUTO) - { - // convert coords to screen coords since we're a top-level window - if (x != wxDefaultCoord) { - GetParent()->ClientToScreen(&x, NULL); - } - if (y != wxDefaultCoord) { - GetParent()->ClientToScreen(NULL, &y); - } - wxFrame::DoSetSize(x, y, width, height, sizeFlags); - } - - virtual bool Show(bool show = true) - { - bool rv = wxFrame::Show(show); - if (rv && show) - ActivateParent(); -#ifdef __WXMAC__ - GetParent()->Refresh(false); -#endif - return rv; - } - - void OnActivate(wxListEvent& WXUNUSED(event)) - { - doubleClickAction(doubleClickActionData); - } - - wxListView* GetLB() { return lv; } - -private: - wxDECLARE_EVENT_TABLE(); -}; - - -wxBEGIN_EVENT_TABLE(wxSTCListBoxWin, wxWindow) - EVT_SET_FOCUS ( wxSTCListBoxWin::OnFocus) - EVT_SIZE ( wxSTCListBoxWin::OnSize) - EVT_LIST_ITEM_ACTIVATED(wxID_ANY, wxSTCListBoxWin::OnActivate) -wxEND_EVENT_TABLE() - -#endif // wxUSE_POPUPWIN ----------------------------------- - - -inline wxSTCListBoxWin* GETLBW(WindowID win) { - return ((wxSTCListBoxWin*)win); -} - -inline wxListView* GETLB(WindowID win) { - return GETLBW(win)->GetLB(); -} //---------------------------------------------------------------------- +// Helper classes for ListBox -ListBoxImpl::ListBoxImpl() - : lineHeight(10), unicodeMode(false), - desiredVisibleRows(5), aveCharWidth(8), maxStrWidth(0), - imgList(NULL), imgTypeMap(NULL) +// The class manages the colours, images, and other data needed for popup lists. +class wxSTCListBoxVisualData { -} +public: + wxSTCListBoxVisualData(int d); + virtual ~wxSTCListBoxVisualData(); -ListBoxImpl::~ListBoxImpl() { - wxDELETE(imgList); - wxDELETE(imgTypeMap); -} + // ListBoxImpl implementation + void SetDesiredVisibleRows(int d); + int GetDesiredVisibleRows() const; + void RegisterImage(int type, const wxBitmap& bmp); + void RegisterImage(int, const char *); + void RegisterRGBAImage(int, int, int,const unsigned char *); + void ClearRegisteredImages(); + // Image data + const wxBitmap* GetImage(int i) const; -void ListBoxImpl::SetFont(Font &font) { - GETLB(wid)->SetFont(*((wxFont*)font.GetID())); -} + // Colour data + void ComputeColours(); + const wxColour& GetBorderColour() const; + void SetColours(const wxColour&, const wxColour&, + const wxColour&,const wxColour&); + const wxColour& GetBgColour() const; + const wxColour& GetTextColour() const; + const wxColour& GetHighlightBgColour() const; + const wxColour& GetHighlightTextColour() const; + // ListCtrl Style + void UseListCtrlStyle(bool, const wxColour&, const wxColour&); + bool HasListCtrlAppearance() const; + const wxColour& GetCurrentBgColour() const; + const wxColour& GetCurrentTextColour() const; -void ListBoxImpl::Create(Window &parent, int ctrlID, Point location_, int lineHeight_, bool unicodeMode_, int WXUNUSED(technology_)) { - location = location_; - lineHeight = lineHeight_; - unicodeMode = unicodeMode_; - maxStrWidth = 0; - wid = new wxSTCListBoxWin(GETWIN(parent.GetID()), ctrlID, location); - if (imgList != NULL) - GETLB(wid)->SetImageList(imgList, wxIMAGE_LIST_SMALL); -} +private: + WX_DECLARE_HASH_MAP(int, wxBitmap, wxIntegerHash, wxIntegerEqual, ImgList); + int m_desiredVisibleRows; + ImgList m_imgList; -void ListBoxImpl::SetAverageCharWidth(int width) { - aveCharWidth = width; -} + wxColour m_borderColour; + wxColour m_bgColour; + wxColour m_textColour; + wxColour m_highlightBgColour; + wxColour m_highlightTextColour; + bool m_useDefaultBgColour; + bool m_useDefaultTextColour; + bool m_useDefaultHighlightBgColour; + bool m_useDefaultHighlightTextColour; + bool m_hasListCtrlAppearance; + wxColour m_currentBgColour; + wxColour m_currentTextColour; + bool m_useDefaultCurrentBgColour; + bool m_useDefaultCurrentTextColour; +}; -void ListBoxImpl::SetVisibleRows(int rows) { - desiredVisibleRows = rows; -} - - -int ListBoxImpl::GetVisibleRows() const { - return desiredVisibleRows; -} - -PRectangle ListBoxImpl::GetDesiredRect() { - // wxListCtrl doesn't have a DoGetBestSize, so instead we kept track of - // the max size in Append and calculate it here... - int maxw = maxStrWidth * aveCharWidth; - int maxh ; - - // give it a default if there are no lines, and/or add a bit more - if (maxw == 0) maxw = 100; - maxw += aveCharWidth * 3 + - GETLBW(wid)->IconWidth() + wxSystemSettings::GetMetric(wxSYS_VSCROLL_X); - if (maxw > 350) - maxw = 350; - - // estimate a desired height - int count = GETLB(wid)->GetItemCount(); - if (count) { - wxRect rect; - GETLB(wid)->GetItemRect(0, rect); - maxh = count * rect.GetHeight(); - if (maxh > 140) // TODO: Use desiredVisibleRows?? - maxh = 140; - - // Try to make the size an exact multiple of some number of lines - int lines = maxh / rect.GetHeight(); - maxh = (lines + 1) * rect.GetHeight() + 2; - } - else - maxh = 100; - - PRectangle rc; - rc.top = 0; - rc.left = 0; - rc.right = maxw; - rc.bottom = maxh; - return rc; -} - - -int ListBoxImpl::CaretFromEdge() { - return 4 + GETLBW(wid)->IconWidth(); -} - - -void ListBoxImpl::Clear() { - GETLB(wid)->DeleteAllItems(); -} - - -void ListBoxImpl::Append(char *s, int type) { - Append(stc2wx(s), type); -} - -void ListBoxImpl::Append(const wxString& text, int type) { - long count = GETLB(wid)->GetItemCount(); - long itemID = GETLB(wid)->InsertItem(count, wxEmptyString); - long idx = -1; - GETLB(wid)->SetItem(itemID, 1, text); - maxStrWidth = wxMax(maxStrWidth, text.length()); - if (type != -1) { - wxCHECK_RET(imgTypeMap, wxT("Unexpected NULL imgTypeMap")); - idx = imgTypeMap->Item(type); - } - GETLB(wid)->SetItemImage(itemID, idx, idx); -} - -void ListBoxImpl::SetList(const char* list, char separator, char typesep) { - GETLB(wid)->Freeze(); - Clear(); - wxStringTokenizer tkzr(stc2wx(list), (wxChar)separator); - while ( tkzr.HasMoreTokens() ) { - wxString token = tkzr.GetNextToken(); - long type = -1; - int pos = token.Find(typesep); - if (pos != -1) { - token.Mid(pos+1).ToLong(&type); - token.Truncate(pos); - } - Append(token, (int)type); - } - GETLB(wid)->Thaw(); -} - - -int ListBoxImpl::Length() { - return GETLB(wid)->GetItemCount(); -} - - -void ListBoxImpl::Select(int n) { - bool select = true; - if (n == -1) { - n = 0; - select = false; - } - GETLB(wid)->EnsureVisible(n); - GETLB(wid)->Select(n, select); -} - - -int ListBoxImpl::GetSelection() { - return GETLB(wid)->GetFirstSelected(); -} - - -int ListBoxImpl::Find(const char *WXUNUSED(prefix)) { - // No longer used - return wxNOT_FOUND; -} - - -void ListBoxImpl::GetValue(int n, char *value, int len) { - wxListItem item; - item.SetId(n); - item.SetColumn(1); - item.SetMask(wxLIST_MASK_TEXT); - GETLB(wid)->GetItem(item); - strncpy(value, wx2stc(item.GetText()), len); - value[len-1] = '\0'; -} - -void ListBoxImpl::RegisterImageHelper(int type, const wxBitmap& bmp) +wxSTCListBoxVisualData::wxSTCListBoxVisualData(int d):m_desiredVisibleRows(d), + m_useDefaultBgColour(true), + m_useDefaultTextColour(true), + m_useDefaultHighlightBgColour(true), + m_useDefaultHighlightTextColour(true), + m_hasListCtrlAppearance(false), + m_useDefaultCurrentBgColour(true), + m_useDefaultCurrentTextColour(true) { - if (! imgList) { - // assumes all images are the same size - imgList = new wxImageList(bmp.GetWidth(), bmp.GetHeight(), true); - imgTypeMap = new wxArrayInt; - } - - int idx = imgList->Add(bmp); - - // do we need to extend the mapping array? - wxArrayInt& itm = *imgTypeMap; - if ( itm.GetCount() < (size_t)type+1) - itm.Add(-1, type - itm.GetCount() + 1); - - // Add an item that maps type to the image index - itm[type] = idx; + ComputeColours(); } -void ListBoxImpl::RegisterImage(int type, const char *xpm_data) { +wxSTCListBoxVisualData::~wxSTCListBoxVisualData() +{ + m_imgList.clear(); +} + +void wxSTCListBoxVisualData::SetDesiredVisibleRows(int d) +{ + m_desiredVisibleRows=d; +} + +int wxSTCListBoxVisualData::GetDesiredVisibleRows() const +{ + return m_desiredVisibleRows; +} + +void wxSTCListBoxVisualData::RegisterImage(int type, const wxBitmap& bmp) +{ + if ( !bmp.IsOk() ) + return; + + ImgList::iterator it=m_imgList.find(type); + if ( it != m_imgList.end() ) + m_imgList.erase(it); + + m_imgList[type] = bmp; +} + +void wxSTCListBoxVisualData::RegisterImage(int type, const char *xpm_data) +{ wxXPMDecoder dec; wxImage img; @@ -2537,28 +2408,771 @@ void ListBoxImpl::RegisterImage(int type, const char *xpm_data) { img = dec.ReadData(reinterpret_cast(xpm_data)); wxBitmap bmp(img); - RegisterImageHelper(type, bmp); + RegisterImage(type, bmp); +} + +void wxSTCListBoxVisualData::RegisterRGBAImage(int type, int width, int height, + const unsigned char *pixelsImage) +{ + wxBitmap bmp = BitmapFromRGBAImage(width, height, pixelsImage); + RegisterImage(type, bmp); +} + +void wxSTCListBoxVisualData::ClearRegisteredImages() +{ + m_imgList.clear(); +} + +const wxBitmap* wxSTCListBoxVisualData::GetImage(int i) const +{ + ImgList::const_iterator it = m_imgList.find(i); + + if ( it != m_imgList.end() ) + return &(it->second); + else + return NULL; +} + +void wxSTCListBoxVisualData::ComputeColours() +{ + // wxSYS_COLOUR_BTNSHADOW seems to be the closest match with most themes. + m_borderColour = wxSystemSettings::GetColour(wxSYS_COLOUR_BTNSHADOW ); + + if ( m_useDefaultBgColour ) + m_bgColour = wxSystemSettings::GetColour(wxSYS_COLOUR_LISTBOX); + + if ( m_useDefaultTextColour ) + m_textColour = wxSystemSettings::GetColour(wxSYS_COLOUR_LISTBOXTEXT); + + if ( m_hasListCtrlAppearance ) + { + // If m_highlightBgColour and/or m_currentBgColour are not + // explicitly set, set them to wxNullColour to indicate that they + // should be drawn with wxRendererNative. + if ( m_useDefaultHighlightBgColour ) + m_highlightBgColour = wxNullColour; + + if ( m_useDefaultCurrentBgColour ) + m_currentBgColour = wxNullColour; + + #ifdef __WXMSW__ + if ( m_useDefaultHighlightTextColour ) + m_highlightTextColour = + wxSystemSettings::GetColour(wxSYS_COLOUR_LISTBOXTEXT); + #else + if ( m_useDefaultHighlightTextColour ) + m_highlightTextColour = wxSystemSettings::GetColour( + wxSYS_COLOUR_LISTBOXHIGHLIGHTTEXT); + #endif + + if ( m_useDefaultCurrentTextColour ) + m_currentTextColour = wxSystemSettings::GetColour( + wxSYS_COLOUR_LISTBOXTEXT); + } + else + { + #ifdef __WXOSX_COCOA__ + if ( m_useDefaultHighlightBgColour ) + m_highlightBgColour = GetListHighlightColour(); + #else + if ( m_useDefaultHighlightBgColour ) + m_highlightBgColour = + wxSystemSettings::GetColour(wxSYS_COLOUR_HIGHLIGHT); + #endif + + if ( m_useDefaultHighlightTextColour ) + m_highlightTextColour = + wxSystemSettings::GetColour(wxSYS_COLOUR_LISTBOXHIGHLIGHTTEXT); + } +} + +static void SetColourHelper(bool& isDefault, wxColour& itemColour, + const wxColour& newColour) +{ + isDefault = !newColour.IsOk(); + itemColour = newColour; +} + +void wxSTCListBoxVisualData::SetColours(const wxColour& bg, + const wxColour& txt, + const wxColour& hlbg, + const wxColour& hltext) +{ + SetColourHelper(m_useDefaultBgColour, m_bgColour, bg); + SetColourHelper(m_useDefaultTextColour, m_textColour, txt); + SetColourHelper(m_useDefaultHighlightBgColour, m_highlightBgColour, hlbg); + SetColourHelper(m_useDefaultHighlightTextColour, m_highlightTextColour, + hltext); + ComputeColours(); +} + +const wxColour& wxSTCListBoxVisualData::GetBorderColour() const +{ + return m_borderColour; +} + +const wxColour& wxSTCListBoxVisualData::GetBgColour() const +{ + return m_bgColour; +} + +const wxColour& wxSTCListBoxVisualData::GetTextColour() const +{ + return m_textColour; +} + +const wxColour& wxSTCListBoxVisualData::GetHighlightBgColour() const +{ + return m_highlightBgColour; +} + +const wxColour& wxSTCListBoxVisualData::GetHighlightTextColour() const +{ + return m_highlightTextColour; +} + +void wxSTCListBoxVisualData::UseListCtrlStyle(bool useListCtrlStyle, + const wxColour& curBg, + const wxColour& curText) +{ + m_hasListCtrlAppearance = useListCtrlStyle; + SetColourHelper(m_useDefaultCurrentBgColour, m_currentBgColour, curBg); + SetColourHelper(m_useDefaultCurrentTextColour, m_currentTextColour, + curText); + ComputeColours(); +} + +bool wxSTCListBoxVisualData::HasListCtrlAppearance() const +{ + return m_hasListCtrlAppearance; +} + +const wxColour& wxSTCListBoxVisualData::GetCurrentBgColour() const +{ + return m_currentBgColour; +} + +const wxColour& wxSTCListBoxVisualData::GetCurrentTextColour() const +{ + return m_currentTextColour; +} + +// The class is intended to look like a standard listbox (with an optional +// icon). However, it needs to look like it has focus even when it doesn't. +class wxSTCListBox : public wxSystemThemedControl +{ +public: + wxSTCListBox(wxWindow*, wxSTCListBoxVisualData*, int); + + // wxWindow overrides + virtual bool AcceptsFocus() const wxOVERRIDE; + virtual void SetFocus() wxOVERRIDE; + + // Setters + void SetContainerBorderSize(int); + + // ListBoxImpl implementation + void SetListBoxFont(Font &font); + void SetAverageCharWidth(int width); + PRectangle GetDesiredRect() const; + int CaretFromEdge() const; + void Clear(); + void Append(char *s, int type = -1); + int Length() const; + void Select(int n); + void GetValue(int n, char *value, int len) const; + void SetDoubleClickAction(CallBackAction, void *); + void SetList(const char* list, char separator, char typesep); + +protected: + // Helpers + void AppendHelper(const wxString& text, int type); + void AccountForBitmap(int type, bool recalculateItemHeight); + void RecalculateItemHeight(); + int TextBoxFromClientEdge() const; + + // Event handlers + void OnDClick(wxCommandEvent&); + void OnSysColourChanged(wxSysColourChangedEvent& event); + void OnMouseMotion(wxMouseEvent& event); + void OnMouseLeaveWindow(wxMouseEvent& event); + + // wxVListBox overrides + virtual wxCoord OnMeasureItem(size_t) const wxOVERRIDE; + virtual void OnDrawItem(wxDC& , const wxRect &, size_t) const wxOVERRIDE; + virtual void OnDrawBackground(wxDC&, const wxRect&,size_t) const wxOVERRIDE; + +private: + WX_DECLARE_HASH_SET(int, wxIntegerHash, wxIntegerEqual, SetOfInts); + + wxSTCListBoxVisualData* m_visualData; + wxVector m_labels; + wxVector m_imageNos; + size_t m_maxStrWidth; + int m_currentRow; + + CallBackAction m_doubleClickAction; + void* m_doubleClickActionData; + int m_aveCharWidth; + + // These drawing parameters are computed or set externally. + int m_borderSize; + int m_textHeight; + int m_itemHeight; + int m_textTopGap; + int m_imageAreaWidth; + int m_imageAreaHeight; + + // These drawing parameters are set internally and can be changed if needed + // to better match the appearance of a list box on a specific platform. + int m_imagePadding; + int m_textBoxToTextGap; + int m_textExtraVerticalPadding; +}; + +wxSTCListBox::wxSTCListBox(wxWindow* parent, wxSTCListBoxVisualData* v, int ht) + :wxSystemThemedControl(), + m_visualData(v), m_maxStrWidth(0), m_currentRow(wxNOT_FOUND), + m_doubleClickAction(NULL), m_doubleClickActionData(NULL), + m_aveCharWidth(8), m_textHeight(ht), m_itemHeight(ht), + m_textTopGap(0), m_imageAreaWidth(0), m_imageAreaHeight(0) +{ + wxVListBox::Create(parent, wxID_ANY, wxDefaultPosition, wxDefaultSize, + wxBORDER_NONE); + + m_imagePadding = FromDIP(1); + m_textBoxToTextGap = FromDIP(3); + m_textExtraVerticalPadding = FromDIP(1); + + SetBackgroundColour(m_visualData->GetBgColour()); + + Bind(wxEVT_LISTBOX_DCLICK, &wxSTCListBox::OnDClick, this); + Bind(wxEVT_SYS_COLOUR_CHANGED, &wxSTCListBox::OnSysColourChanged, this); + + if ( m_visualData->HasListCtrlAppearance() ) + { + EnableSystemTheme(); + Bind(wxEVT_MOTION, &wxSTCListBox::OnMouseMotion, this); + Bind(wxEVT_LEAVE_WINDOW, &wxSTCListBox::OnMouseLeaveWindow, this); + + #ifdef __WXMSW__ + // On MSW when using wxRendererNative to draw items in list control + // style, the colours used seem to be based on the parent's + // background colour. So set the popup's background. + parent->SetOwnBackgroundColour(m_visualData->GetBgColour()); + #endif + } +} + +bool wxSTCListBox::AcceptsFocus() const +{ + return false; +} + +// Do nothing in response to an attempt to set focus. +void wxSTCListBox::SetFocus() +{ +} + +void wxSTCListBox::SetContainerBorderSize(int s) +{ + m_borderSize = s; +} + +void wxSTCListBox::SetListBoxFont(Font &font) +{ + SetFont(*((wxFont*)font.GetID())); + int w; + GetTextExtent(EXTENT_TEST, &w, &m_textHeight); + RecalculateItemHeight(); +} + +void wxSTCListBox::SetAverageCharWidth(int width) +{ + m_aveCharWidth = width; +} + +PRectangle wxSTCListBox::GetDesiredRect() const +{ + int maxw = m_maxStrWidth * m_aveCharWidth; + int maxh ; + + // give it a default if there are no lines, and/or add a bit more + if (maxw == 0) maxw = 100; + maxw += TextBoxFromClientEdge() + m_textBoxToTextGap + m_aveCharWidth * 3; + if (maxw > 350) + maxw = 350; + + // estimate a desired height + const int count = Length(); + const int desiredVisibleRows = m_visualData->GetDesiredVisibleRows(); + if ( count ) + { + if ( count <= desiredVisibleRows ) + maxh = count * m_itemHeight; + else + maxh = desiredVisibleRows * m_itemHeight; + } + else + maxh = 100; + + // Add space for a scrollbar if needed. + if ( count > desiredVisibleRows ) + maxw += wxSystemSettings::GetMetric(wxSYS_VSCROLL_X); + + // Add borders. + maxw += 2 * m_borderSize; + maxh += 2 * m_borderSize; + + PRectangle rc; + rc.top = 0; + rc.left = 0; + rc.right = maxw; + rc.bottom = maxh; + return rc; +} + +int wxSTCListBox::CaretFromEdge() const +{ + return m_borderSize + TextBoxFromClientEdge() + m_textBoxToTextGap; +} + +void wxSTCListBox::Clear() +{ + m_imageAreaWidth = 0; + m_imageAreaHeight = 0; + m_labels.clear(); + m_imageNos.clear(); +} + +void wxSTCListBox::Append(char *s, int type) +{ + AppendHelper(stc2wx(s), type); + AccountForBitmap(type, true); +} + +int wxSTCListBox::Length() const +{ + return GetItemCount(); +} + +void wxSTCListBox::Select(int n) +{ + SetSelection(n); +} + +void wxSTCListBox::GetValue(int n, char *value, int len) const +{ + strncpy(value, wx2stc(m_labels[n]), len); + value[len-1] = '\0'; +} + +void wxSTCListBox::SetDoubleClickAction(CallBackAction action, void *data) +{ + m_doubleClickAction = action; + m_doubleClickActionData = data; +} + +void wxSTCListBox::SetList(const char* list, char separator, char typesep) +{ + wxWindowUpdateLocker noUpdates(this); + Clear(); + SetOfInts bitmapNos; + wxStringTokenizer tkzr(stc2wx(list), (wxChar)separator); + while ( tkzr.HasMoreTokens() ) { + wxString token = tkzr.GetNextToken(); + long type = -1; + int pos = token.Find(typesep); + if (pos != -1) { + token.Mid(pos+1).ToLong(&type); + token.Truncate(pos); + } + AppendHelper(token, (int)type); + bitmapNos.insert(static_cast(type)); + } + + for ( SetOfInts::iterator it=bitmapNos.begin(); it!=bitmapNos.end(); ++it ) + AccountForBitmap(*it, false); + + if ( m_imageAreaHeight > 0 ) + RecalculateItemHeight(); +} + +void wxSTCListBox::AppendHelper(const wxString& text, int type) +{ + m_maxStrWidth = wxMax(m_maxStrWidth, text.length()); + m_labels.push_back(text); + m_imageNos.push_back(type); + SetItemCount(m_labels.size()); +} + +void wxSTCListBox::AccountForBitmap(int type, bool recalculateItemHeight) +{ + const int oldHeight = m_imageAreaHeight; + const wxBitmap* bmp = m_visualData->GetImage(type); + + if ( bmp ) + { + if ( bmp->GetWidth() > m_imageAreaWidth ) + m_imageAreaWidth = bmp->GetWidth(); + + if ( bmp->GetHeight() > m_imageAreaHeight ) + m_imageAreaHeight = bmp->GetHeight(); + } + + if ( recalculateItemHeight && m_imageAreaHeight != oldHeight ) + RecalculateItemHeight(); +} + +void wxSTCListBox::RecalculateItemHeight() +{ + m_itemHeight = wxMax(m_textHeight + 2 * m_textExtraVerticalPadding, + m_imageAreaHeight + 2 * m_imagePadding); + m_textTopGap = (m_itemHeight - m_textHeight)/2; +} + +int wxSTCListBox::TextBoxFromClientEdge() const +{ + return (m_imageAreaWidth == 0 ? 0 : m_imageAreaWidth + 2 * m_imagePadding); +} + +void wxSTCListBox::OnDClick(wxCommandEvent& WXUNUSED(event)) +{ + if ( m_doubleClickAction ) + m_doubleClickAction(m_doubleClickActionData); +} + +void wxSTCListBox::OnSysColourChanged(wxSysColourChangedEvent& WXUNUSED(event)) +{ + m_visualData->ComputeColours(); + GetParent()->SetOwnBackgroundColour(m_visualData->GetBgColour()); + SetBackgroundColour(m_visualData->GetBgColour()); + GetParent()->Refresh(); +} + +void wxSTCListBox::OnMouseLeaveWindow(wxMouseEvent& event) +{ + const int old = m_currentRow; + m_currentRow = wxNOT_FOUND; + + if ( old != wxNOT_FOUND ) + RefreshRow(old); + + event.Skip(); +} + +void wxSTCListBox::OnMouseMotion(wxMouseEvent& event) +{ + const int old = m_currentRow; + m_currentRow = VirtualHitTest(event.GetY()); + + if ( old != m_currentRow ) + { + if( m_currentRow != wxNOT_FOUND ) + RefreshRow(m_currentRow); + + if( old != wxNOT_FOUND ) + RefreshRow(old); + } + + event.Skip(); +} + +wxCoord wxSTCListBox::OnMeasureItem(size_t WXUNUSED(n)) const +{ + return static_cast(m_itemHeight); +} + +// This control will be drawn so that a typical row of pixels looks like: +// +// +++++++++++++++++++++++++ =====ITEM TEXT================ +// | | | | +// | m_imageAreaWidth | | +// | | | +// m_imagePadding | m_textBoxToTextGap +// | +// m_imagePadding +// +// +// m_imagePadding : Used to give a little extra space between the +// client edge and an item's bitmap. +// m_imageAreaWidth : Computed as the width of the largest registered +// bitmap. +// m_textBoxToTextGap : Used so that item text does not begin immediately +// at the edge of the highlight box. +// +// Images are drawn centered in the image area. +// If a selection rectangle is drawn, its left edge is at x=0 if there are +// no bitmaps. Otherwise +// x = m_imagePadding + m_imageAreaWidth + m_imagePadding. +// Text is drawn at x + m_textBoxToTextGap and centered vertically. + +void wxSTCListBox::OnDrawItem(wxDC& dc, const wxRect& rect, size_t n) const +{ + wxString label; + int imageNo = -1; + if ( n < m_labels.size() ) + { + label = m_labels[n]; + imageNo = m_imageNos[n]; + } + + int topGap = m_textTopGap; + int leftGap = TextBoxFromClientEdge() + m_textBoxToTextGap; + + wxDCTextColourChanger tcc(dc); + + if ( IsSelected(n) ) + tcc.Set(m_visualData->GetHighlightTextColour()); + else if ( static_cast(n) == m_currentRow ) + tcc.Set(m_visualData->GetCurrentTextColour()); + else + tcc.Set(m_visualData->GetTextColour()); + + label = wxControl::Ellipsize(label, dc, wxELLIPSIZE_END, + rect.GetWidth() - leftGap); + dc.DrawText(label, rect.GetLeft() + leftGap, rect.GetTop() + topGap); + + const wxBitmap* b = m_visualData->GetImage(imageNo); + if ( b ) + { + topGap = (m_itemHeight - b->GetHeight())/2; + leftGap = m_imagePadding + (m_imageAreaWidth - b->GetWidth())/2; + dc.DrawBitmap(*b, rect.GetLeft()+leftGap, rect.GetTop()+topGap, true); + } +} + +void wxSTCListBox::OnDrawBackground(wxDC &dc, const wxRect &rect,size_t n) const +{ + if ( IsSelected(n) ) + { + wxRect selectionRect(rect); + const wxColour& highlightBgColour =m_visualData->GetHighlightBgColour(); + + #ifdef __WXMSW__ + if ( !m_visualData->HasListCtrlAppearance() ) + { + // On windows the selection rectangle in Scintilla's + // autocompletion list only covers the text and not the icon. + + const int textBoxFromClientEdge = TextBoxFromClientEdge(); + selectionRect.SetLeft(rect.GetLeft() + textBoxFromClientEdge); + selectionRect.SetWidth(rect.GetWidth() - textBoxFromClientEdge); + } + #endif // __WXMSW__ + + if ( highlightBgColour.IsOk() ) + { + wxDCBrushChanger bc(dc, highlightBgColour); + wxDCPenChanger pc(dc, highlightBgColour); + dc.DrawRectangle(selectionRect); + } + else + { + wxRendererNative::GetDefault().DrawItemSelectionRect( + const_cast(this), dc, selectionRect, + wxCONTROL_SELECTED | wxCONTROL_FOCUSED); + } + + if ( !m_visualData->HasListCtrlAppearance() ) + wxRendererNative::GetDefault().DrawFocusRect( + const_cast(this), dc, selectionRect); + } + else if ( static_cast(n) == m_currentRow ) + { + const wxColour& currentBgColour = m_visualData->GetCurrentBgColour(); + + if ( currentBgColour.IsOk() ) + { + wxDCBrushChanger bc(dc, currentBgColour); + wxDCPenChanger pc(dc, currentBgColour); + dc.DrawRectangle(rect); + } + else + { + wxRendererNative::GetDefault().DrawItemSelectionRect( + const_cast(this), dc, rect, + wxCONTROL_CURRENT | wxCONTROL_FOCUSED); + } + } +} + + +// A popup window to place the wxSTCListBox upon +class wxSTCListBoxWin : public wxSTCPopupWindow +{ +public: + wxSTCListBoxWin(wxWindow*, wxSTCListBox**, wxSTCListBoxVisualData*, int); + +protected: + void OnPaint(wxPaintEvent&); + +private: + wxSTCListBoxVisualData* m_visualData; +}; + +wxSTCListBoxWin::wxSTCListBoxWin(wxWindow* parent, wxSTCListBox** lb, + wxSTCListBoxVisualData* v, int h) + :wxSTCPopupWindow(parent) +{ + *lb = new wxSTCListBox(this, v, h); + + // Use the background of this window to form a frame around the listbox + // except on macos where the native Scintilla popup has no frame. +#ifdef __WXOSX_COCOA__ + const int borderThickness = 0; +#else + const int borderThickness = FromDIP(1); +#endif + wxBoxSizer* bSizer = new wxBoxSizer(wxVERTICAL); + bSizer->Add(*lb, 1, wxEXPAND|wxALL, borderThickness); + SetSizer(bSizer); + (*lb)->SetContainerBorderSize(borderThickness); + + // When drawing highlighting in listctrl style with wxRendererNative on MSW, + // the colours used seem to be based on the background of the parent window. + // So manually paint this window to give it the border colour instead of + // setting the background colour. + m_visualData = v; + Bind(wxEVT_PAINT, &wxSTCListBoxWin::OnPaint, this); + SetBackgroundStyle(wxBG_STYLE_PAINT); +} + +void wxSTCListBoxWin::OnPaint(wxPaintEvent& WXUNUSED(evt)) +{ + wxPaintDC dc(this); + dc.SetBackground(m_visualData->GetBorderColour()); + dc.Clear(); +} + + +//---------------------------------------------------------------------- + +ListBoxImpl::ListBoxImpl() + :m_listBox(NULL), m_visualData(new wxSTCListBoxVisualData(5)) +{ +} + +ListBoxImpl::~ListBoxImpl() { + delete m_visualData; +} + + +void ListBoxImpl::SetFont(Font &font) { + m_listBox->SetListBoxFont(font); +} + + +void ListBoxImpl::Create(Window &parent, int WXUNUSED(ctrlID), + Point WXUNUSED(location_), int lineHeight_, + bool WXUNUSED(unicodeMode_), + int WXUNUSED(technology_)) { + wid = new wxSTCListBoxWin(GETWIN(parent.GetID()), &m_listBox, m_visualData, + lineHeight_); +} + + +void ListBoxImpl::SetAverageCharWidth(int width) { + m_listBox->SetAverageCharWidth(width); +} + + +void ListBoxImpl::SetVisibleRows(int rows) { + m_visualData->SetDesiredVisibleRows(rows); +} + + +int ListBoxImpl::GetVisibleRows() const { + return m_visualData->GetDesiredVisibleRows(); +} + +PRectangle ListBoxImpl::GetDesiredRect() { + return m_listBox->GetDesiredRect(); +} + + +int ListBoxImpl::CaretFromEdge() { + return m_listBox->CaretFromEdge(); +} + + +void ListBoxImpl::Clear() { + m_listBox->Clear(); +} + + +void ListBoxImpl::Append(char *s, int type) { + m_listBox->Append(s, type); +} + + +void ListBoxImpl::SetList(const char* list, char separator, char typesep) { + m_listBox->SetList(list, separator, typesep); +} + + +int ListBoxImpl::Length() { + return m_listBox->Length(); +} + + +void ListBoxImpl::Select(int n) { + m_listBox->Select(n); +} + + +int ListBoxImpl::GetSelection() { + return m_listBox->GetSelection(); +} + + +int ListBoxImpl::Find(const char *WXUNUSED(prefix)) { + // No longer used + return wxNOT_FOUND; +} + + +void ListBoxImpl::GetValue(int n, char *value, int len) { + m_listBox->GetValue(n, value, len); +} + +void ListBoxImpl::RegisterImageHelper(int type, const wxBitmap& bmp) +{ + m_visualData->RegisterImage(type, bmp); +} + + +void ListBoxImpl::RegisterImage(int type, const char *xpm_data) { + m_visualData->RegisterImage(type, xpm_data); } void ListBoxImpl::RegisterRGBAImage(int type, int width, int height, const unsigned char *pixelsImage) { - wxBitmap bmp = BitmapFromRGBAImage(width, height, pixelsImage); - RegisterImageHelper(type, bmp); + m_visualData->RegisterRGBAImage(type, width, height, pixelsImage); } void ListBoxImpl::ClearRegisteredImages() { - wxDELETE(imgList); - wxDELETE(imgTypeMap); - if (wid) - GETLB(wid)->SetImageList(NULL, wxIMAGE_LIST_SMALL); + m_visualData->ClearRegisteredImages(); } void ListBoxImpl::SetDoubleClickAction(CallBackAction action, void *data) { - GETLBW(wid)->SetDoubleClickAction(action, data); + m_listBox->SetDoubleClickAction(action, data); +} + +void ListBoxImpl::SetColours(const wxColour& background, const wxColour& text, + const wxColour& hiliBg, const wxColour& hiliText) +{ + m_visualData->SetColours(background, text, hiliBg, hiliText); +} + +void ListBoxImpl::UseListCtrlStyle(bool useListCtrl, const wxColour& currentBg, + const wxColour& currentText) +{ + m_visualData->UseListCtrlStyle(useListCtrl, currentBg, currentText); } diff --git a/src/stc/PlatWX.h b/src/stc/PlatWX.h index ce308b50a0..8449c870d2 100644 --- a/src/stc/PlatWX.h +++ b/src/stc/PlatWX.h @@ -8,6 +8,9 @@ #include "wx/imaglist.h" #include "Platform.h" +class wxStyledTextCtrl; +class wxSTCListBox; +class wxSTCListBoxVisualData; @@ -17,14 +20,8 @@ wxColour wxColourFromCD(const ColourDesired& ca); class ListBoxImpl : public ListBox { private: - int lineHeight; - bool unicodeMode; - int desiredVisibleRows; - int aveCharWidth; - size_t maxStrWidth; - Point location; // Caret location at which the list is opened - wxImageList* imgList; - wxArrayInt* imgTypeMap; + wxSTCListBox* m_listBox; + wxSTCListBoxVisualData* m_visualData; public: ListBoxImpl(); @@ -52,8 +49,113 @@ public: virtual void ClearRegisteredImages() wxOVERRIDE; virtual void SetDoubleClickAction(CallBackAction, void *) wxOVERRIDE; virtual void SetList(const char* list, char separator, char typesep) wxOVERRIDE; + void SetColours(const wxColour&, const wxColour&, + const wxColour&, const wxColour&); + void UseListCtrlStyle(bool, const wxColour&, const wxColour&); }; + +//---------------------------------------------------------------------- +// wxSTCPopupWindow + +#if defined(__WXOSX_COCOA__) || defined(__WXMSW__) || defined(__WXGTK__) + #define wxSTC_POPUP_IS_CUSTOM 1 +#else + #define wxSTC_POPUP_IS_CUSTOM 0 +#endif + +// Define the base class used for wxSTCPopupWindow. +#ifdef __WXOSX_COCOA__ + + #include "wx/nonownedwnd.h" + #define wxSTC_POPUP_IS_FRAME 0 + + class wxSTCPopupBase:public wxNonOwnedWindow + { + public: + wxSTCPopupBase(wxWindow*); + virtual ~wxSTCPopupBase(); + virtual bool Show(bool show=true) wxOVERRIDE; + + protected: + virtual void DoSetSize(int, int, int, int, int) wxOVERRIDE; + void SetSTCCursor(int); + void OnMouseEnter(wxMouseEvent&); + void OnMouseLeave(wxMouseEvent&); + + private: + WX_NSWindow m_nativeWin; + wxStyledTextCtrl* m_stc; + }; + +#elif wxUSE_POPUPWIN + + #include "wx/popupwin.h" + #define wxSTC_POPUP_IS_FRAME 0 + + class wxSTCPopupBase:public wxPopupWindow + { + public: + wxSTCPopupBase(wxWindow*); + #ifdef __WXGTK__ + virtual ~wxSTCPopupBase(); + #elif defined(__WXMSW__) + virtual bool Show(bool show=true) wxOVERRIDE; + virtual bool MSWHandleMessage(WXLRESULT *result, WXUINT message, + WXWPARAM wParam, WXLPARAM lParam) + wxOVERRIDE; + #endif + }; + +#else + + #include "wx/frame.h" + #define wxSTC_POPUP_IS_FRAME 1 + + class wxSTCPopupBase:public wxFrame + { + public: + wxSTCPopupBase(wxWindow*); + #ifdef __WXMSW__ + virtual bool Show(bool show=true) wxOVERRIDE; + virtual bool MSWHandleMessage(WXLRESULT *result, WXUINT message, + WXWPARAM wParam, WXLPARAM lParam) + wxOVERRIDE; + #elif !wxSTC_POPUP_IS_CUSTOM + virtual bool Show(bool show=true) wxOVERRIDE; + void ActivateParent(); + #endif + }; + +#endif // __WXOSX_COCOA__ + +class wxSTCPopupWindow:public wxSTCPopupBase +{ +public: + wxSTCPopupWindow(wxWindow*); + virtual ~wxSTCPopupWindow(); + virtual bool Destroy() wxOVERRIDE; + virtual bool AcceptsFocus() const wxOVERRIDE; + +protected: + virtual void DoSetSize(int x, int y, int width, int height, + int sizeFlags = wxSIZE_AUTO) wxOVERRIDE; + void OnParentMove(wxMoveEvent& event); + #if defined(__WXOSX_COCOA__) || (defined(__WXGTK__)&&!wxSTC_POPUP_IS_FRAME) + void OnIconize(wxIconizeEvent& event); + #elif !wxSTC_POPUP_IS_CUSTOM + void OnFocus(wxFocusEvent& event); + #endif + +private: + wxPoint m_initialPosition; + wxWindow* m_tlw; +}; + + +//---------------------------------------------------------------------- +// SurfaceData + class SurfaceData { public: diff --git a/src/stc/PlatWXcocoa.h b/src/stc/PlatWXcocoa.h new file mode 100644 index 0000000000..74c7f4856c --- /dev/null +++ b/src/stc/PlatWXcocoa.h @@ -0,0 +1,28 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: src/stc/PlatWXcocoa.h +// Purpose: Declaration of utility functions for wxSTC with cocoa +// Author: New Pagodi +// Created: 2019-03-10 +// Copyright: (c) 2019 wxWidgets development team +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _SRC_STC_PLATWXCOCOA_H_ +#define _SRC_STC_PLATWXCOCOA_H_ + +#include "wx/defs.h" + +#if wxUSE_STC + +// Functions used to create and manage popup windows. +WX_NSWindow CreateFloatingWindow(wxWindow*); +void CloseFloatingWindow(WX_NSWindow win); +void ShowFloatingWindow(WX_NSWindow win); +void HideFloatingWindow(WX_NSWindow win); + +// Function needed for list control colours. +wxColour GetListHighlightColour(); + +#endif // wxUSE_STC + +#endif // _SRC_STC_PLATWXCOCOA_H_ diff --git a/src/stc/PlatWXcocoa.mm b/src/stc/PlatWXcocoa.mm new file mode 100644 index 0000000000..7b798f954e --- /dev/null +++ b/src/stc/PlatWXcocoa.mm @@ -0,0 +1,132 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: src/stc/PlatWXcocoa.mm +// Purpose: Implementation of utility functions for wxSTC with cocoa +// Author: New Pagodi +// Created: 2019-03-10 +// Copyright: (c) 2019 wxWidgets development team +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#include "wx/wxprec.h" + +#if wxUSE_STC + +#include "wx/osx/private.h" +#include "PlatWXcocoa.h" + +// A simple view used for popup windows. + +@interface wxSTCPopupBaseView : NSView +{ +@private + NSTrackingArea * m_trackingArea; + wxWindow* m_wxWin; +} + +- (id)initWithwxWin:(wxWindow*) wxWin; + +@end + +@implementation wxSTCPopupBaseView + +- (id)initWithwxWin:(wxWindow*) wxWin +{ + m_trackingArea = nil; + + self = [super init]; + if ( self ) + m_wxWin = wxWin; + + return self; +} + +- (void)updateTrackingAreas +{ + if( m_trackingArea != nil ) + { + [self removeTrackingArea:m_trackingArea]; + [m_trackingArea release]; + } + + int options = NSTrackingMouseEnteredAndExited | NSTrackingActiveAlways; + m_trackingArea = [[NSTrackingArea alloc] initWithRect: [self bounds] + options: options + owner: self + userInfo: nil]; + [self addTrackingArea:m_trackingArea]; +} + +- (void)mouseEntered:(NSEvent *)evt +{ + wxMouseEvent wxevent(wxEVT_ENTER_WINDOW); + wxevent.SetEventObject(m_wxWin); + m_wxWin->ProcessWindowEvent(wxevent); +} + +- (void)mouseExited:(NSEvent *)evt +{ + wxMouseEvent wxevent(wxEVT_LEAVE_WINDOW); + wxevent.SetEventObject(m_wxWin); + m_wxWin->ProcessWindowEvent(wxevent); +} + +- (void)mouseDown:(NSEvent *)evt +{ + NSRect locationInWindow = NSZeroRect; + locationInWindow.origin = [evt locationInWindow]; + NSPoint locationInView = [self convertPoint: locationInWindow.origin + fromView: nil]; + wxPoint locationInViewWX = wxFromNSPoint(self, locationInView); + + wxMouseEvent wxevent(wxEVT_LEFT_DOWN); + wxevent.SetEventObject(m_wxWin); + wxevent.SetX(locationInViewWX.x); + wxevent.SetY(locationInViewWX.y); + m_wxWin->ProcessWindowEvent(wxevent); +} + +- (void)drawRect:(NSRect)dirtyRect +{ + static_cast(m_wxWin->GetPeer())-> + drawRect(&dirtyRect, self, NULL); +} + +@end + + +// Utility functions. + +WX_NSWindow CreateFloatingWindow(wxWindow* wxWin) +{ + NSWindow* w = [[NSWindow alloc] initWithContentRect: NSZeroRect + styleMask: NSBorderlessWindowMask + backing: NSBackingStoreBuffered + defer: NO]; + [w setLevel:NSFloatingWindowLevel]; + [w setHasShadow:YES]; + [w setContentView:[[wxSTCPopupBaseView alloc] initWithwxWin:wxWin]]; + + return w; +} + +void CloseFloatingWindow(WX_NSWindow nsWin) +{ + [nsWin close]; +} + +void ShowFloatingWindow(WX_NSWindow nsWin) +{ + [nsWin orderFront:NSApp]; +} + +void HideFloatingWindow(WX_NSWindow nsWin) +{ + [nsWin orderOut:NSApp]; +} + +wxColour GetListHighlightColour() +{ + return wxColour([NSColor alternateSelectedControlColor]); +} + +#endif // wxUSE_STC diff --git a/src/stc/ScintillaWX.cpp b/src/stc/ScintillaWX.cpp index 208743fef4..eb99d863f0 100644 --- a/src/stc/ScintillaWX.cpp +++ b/src/stc/ScintillaWX.cpp @@ -35,6 +35,7 @@ #include "wx/dnd.h" #include "wx/image.h" #include "wx/scopedarray.h" +#include "wx/dcbuffer.h" #if !wxUSE_STD_CONTAINERS && !wxUSE_STD_IOSTREAM && !wxUSE_STD_STRING #include "wx/beforestd.h" @@ -92,62 +93,42 @@ void wxSTCDropTarget::OnLeave() { #endif // wxUSE_DRAG_AND_DROP -#if wxUSE_POPUPWIN -#include "wx/popupwin.h" -#define wxSTCCallTipBase wxPopupWindow -#else -#include "wx/frame.h" -#define wxSTCCallTipBase wxFrame -#endif - -#include "wx/dcbuffer.h" - -class wxSTCCallTip : public wxSTCCallTipBase { +class wxSTCCallTip : public wxSTCPopupWindow { public: wxSTCCallTip(wxWindow* parent, CallTip* ct, ScintillaWX* swx) : -#if wxUSE_POPUPWIN - wxSTCCallTipBase(parent, wxBORDER_NONE), -#else - wxSTCCallTipBase(parent, -1, wxEmptyString, wxDefaultPosition, wxDefaultSize, - wxFRAME_NO_TASKBAR - | wxFRAME_FLOAT_ON_PARENT - | wxBORDER_NONE -#ifdef __WXMAC__ - | wxPOPUP_WINDOW -#endif - ), -#endif - m_ct(ct), m_swx(swx), m_cx(wxDefaultCoord), m_cy(wxDefaultCoord) - { - SetBackgroundStyle(wxBG_STYLE_PAINT); - SetName("wxSTCCallTip"); - } + wxSTCPopupWindow(parent), m_ct(ct), m_swx(swx) + { + Bind(wxEVT_LEFT_DOWN, &wxSTCCallTip::OnLeftDown, this); + Bind(wxEVT_SIZE, &wxSTCCallTip::OnSize, this); + Bind(wxEVT_PAINT, &wxSTCCallTip::OnPaint, this); - ~wxSTCCallTip() { -#if wxUSE_POPUPWIN && defined(__WXGTK__) - wxRect rect = GetRect(); - rect.x = m_cx; - rect.y = m_cy; - GetParent()->Refresh(false, &rect); +#ifdef __WXMSW__ + Bind(wxEVT_ERASE_BACKGROUND, &wxSTCCallTip::OnEraseBackground, this); + SetBackgroundStyle(wxBG_STYLE_ERASE); +#else + SetBackgroundStyle(wxBG_STYLE_PAINT); #endif + + SetName("wxSTCCallTip"); } - bool AcceptsFocus() const wxOVERRIDE { return false; } - - void OnPaint(wxPaintEvent& WXUNUSED(evt)) + void DrawBack(const wxSize& size) { - wxAutoBufferedPaintDC dc(this); + m_back = wxBitmap(size); + wxMemoryDC mem(m_back); Surface* surfaceWindow = Surface::Allocate(m_swx->technology); - surfaceWindow->Init(&dc, m_ct->wDraw.GetID()); + surfaceWindow->Init(&mem, m_ct->wDraw.GetID()); m_ct->PaintCT(surfaceWindow); surfaceWindow->Release(); delete surfaceWindow; } - void OnFocus(wxFocusEvent& event) + virtual void Refresh(bool eraseBg=true, const wxRect *rect=NULL) wxOVERRIDE { - GetParent()->SetFocus(); - event.Skip(); + if ( rect == NULL ) + DrawBack(GetSize()); + + wxSTCPopupWindow::Refresh(eraseBg, rect); } void OnLeftDown(wxMouseEvent& event) @@ -158,58 +139,45 @@ public: m_swx->CallTipClick(); } - virtual void DoSetSize(int x, int y, - int width, int height, - int sizeFlags = wxSIZE_AUTO) wxOVERRIDE + void OnSize(wxSizeEvent& event) { - // convert coords to screen coords since we're a top-level window - if (x != wxDefaultCoord) { - m_cx = x; - GetParent()->ClientToScreen(&x, NULL); - } - if (y != wxDefaultCoord) { - m_cy = y; - GetParent()->ClientToScreen(NULL, &y); - } - wxSTCCallTipBase::DoSetSize(x, y, width, height, sizeFlags); + DrawBack(event.GetSize()); + event.Skip(); + } + +#ifdef __WXMSW__ + + void OnPaint(wxPaintEvent& WXUNUSED(evt)) + { + wxRect upd = GetUpdateClientRect(); + wxMemoryDC mem(m_back); + wxPaintDC dc(this); + + dc.Blit(upd.GetX(), upd.GetY(), upd.GetWidth(), upd.GetHeight(), &mem, + upd.GetX(), upd.GetY()); + } + + void OnEraseBackground(wxEraseEvent& event) + { + event.GetDC()->DrawBitmap(m_back, 0, 0); } -#if wxUSE_POPUPWIN #else - virtual bool Show( bool show = true ) - { - // Although we're a frame, we always want the parent to be active, so - // raise it whenever we get shown. - bool rv = wxSTCCallTipBase::Show(show); - if (rv && show) - { - wxTopLevelWindow *frame = wxDynamicCast( - wxGetTopLevelParent(GetParent()), wxTopLevelWindow); - if (frame) - frame->Raise(); - } - return rv; - } -#endif - wxPoint GetMyPosition() + void OnPaint(wxPaintEvent& WXUNUSED(evt)) { - return wxPoint(m_cx, m_cy); + wxAutoBufferedPaintDC dc(this); + dc.DrawBitmap(m_back, 0, 0); } +#endif // __WXMSW__ + private: CallTip* m_ct; ScintillaWX* m_swx; - int m_cx, m_cy; - wxDECLARE_EVENT_TABLE(); + wxBitmap m_back; }; -wxBEGIN_EVENT_TABLE(wxSTCCallTip, wxSTCCallTipBase) - EVT_PAINT(wxSTCCallTip::OnPaint) - EVT_SET_FOCUS(wxSTCCallTip::OnFocus) - EVT_LEFT_DOWN(wxSTCCallTip::OnLeftDown) -wxEND_EVENT_TABLE() - //---------------------------------------------------------------------- @@ -1389,6 +1357,24 @@ void ScintillaWX::DoRegisterImage(int type, const wxBitmap& bmp) { static_cast(ac.lb)->RegisterImageHelper(type, bmp); } +void ScintillaWX::SetListBoxColours(const wxColour& background, + const wxColour& text, + const wxColour& highlight, + const wxColour& highlightText) +{ + static_cast(ac.lb)->SetColours(background, text, + highlight, highlightText); +} + +void ScintillaWX::UseListCtrlStyleForLists(bool useListCtrl, + const wxColour& currentBgColour, + const wxColour& currentTextColour) +{ + static_cast(ac.lb)->UseListCtrlStyle(useListCtrl, + currentBgColour, + currentTextColour); +} + sptr_t ScintillaWX::DirectFunction( ScintillaWX* swx, unsigned int iMessage, uptr_t wParam, sptr_t lParam) { return swx->WndProc(iMessage, wParam, lParam); diff --git a/src/stc/ScintillaWX.h b/src/stc/ScintillaWX.h index 92079170e3..5bbe6179c3 100644 --- a/src/stc/ScintillaWX.h +++ b/src/stc/ScintillaWX.h @@ -201,6 +201,9 @@ public: void SetPaintAbandoned(){paintState = paintAbandoned;} void DoMarkerDefineBitmap(int markerNumber, const wxBitmap& bmp); void DoRegisterImage(int type, const wxBitmap& bmp); + void SetListBoxColours(const wxColour&, const wxColour&, + const wxColour&, const wxColour&); + void UseListCtrlStyleForLists(bool, const wxColour&, const wxColour&); private: bool capturedMouse; diff --git a/src/stc/stc.cpp b/src/stc/stc.cpp index b01802915c..54695d5466 100644 --- a/src/stc/stc.cpp +++ b/src/stc/stc.cpp @@ -5046,6 +5046,22 @@ void wxStyledTextCtrl::RegisterImage(int type, const wxBitmap& bmp) m_swx->DoRegisterImage(type, bmp); } +void wxStyledTextCtrl::AutoCompSetColours(const wxColour& background, + const wxColour& text, + const wxColour& highlight, + const wxColour& highlightText) +{ + m_swx->SetListBoxColours(background, text, highlight, highlightText); +} + +void wxStyledTextCtrl::AutoCompUseListCtrl(bool useListCtrl, + const wxColour& currentBgColour, + const wxColour& currentTextColour) +{ + m_swx->UseListCtrlStyleForLists(useListCtrl, currentBgColour, + currentTextColour); +} + diff --git a/src/stc/stc.cpp.in b/src/stc/stc.cpp.in index fb44624ab7..91807cf3f9 100644 --- a/src/stc/stc.cpp.in +++ b/src/stc/stc.cpp.in @@ -573,6 +573,22 @@ void wxStyledTextCtrl::RegisterImage(int type, const wxBitmap& bmp) m_swx->DoRegisterImage(type, bmp); } +void wxStyledTextCtrl::AutoCompSetColours(const wxColour& background, + const wxColour& text, + const wxColour& highlight, + const wxColour& highlightText) +{ + m_swx->SetListBoxColours(background, text, highlight, highlightText); +} + +void wxStyledTextCtrl::AutoCompUseListCtrl(bool useListCtrl, + const wxColour& currentBgColour, + const wxColour& currentTextColour) +{ + m_swx->UseListCtrlStyleForLists(useListCtrl, currentBgColour, + currentTextColour); +} + diff --git a/src/stc/stc.h.in b/src/stc/stc.h.in index ef38ee1b20..ea04d4f60c 100644 --- a/src/stc/stc.h.in +++ b/src/stc/stc.h.in @@ -304,6 +304,16 @@ public: // Register an image for use in autocompletion lists. void RegisterImage(int type, const wxBitmap& bmp); + // Set the colours used to display the items in an autocompletion list. + void AutoCompSetColours(const wxColour& background, const wxColour& text, + const wxColour& highlight, + const wxColour& highlightText); + + // Use a wxListCtrl to display autocompletion lists. + void AutoCompUseListCtrl(bool useListCtrl = true, + const wxColour& currentBgColour = wxNullColour, + const wxColour& currentTextColour = wxNullColour); + // The following methods are nearly equivalent to their similarly named diff --git a/src/stc/stc.interface.h.in b/src/stc/stc.interface.h.in index f2ac38130b..a3c0334908 100644 --- a/src/stc/stc.interface.h.in +++ b/src/stc/stc.interface.h.in @@ -363,6 +363,54 @@ public: */ void RegisterImage(int type, const wxBitmap& bmp); + /** + Set the colours used to display the items in an autocompletion list. + + This method can be used if the default colours make the list hard to + read or if specific colours are desired for whatever reason. + @param background + The colour used for the background of the list. + @param text + The colour used for all text except for the selected item. + @param highlight + The colour used to highlight the selected item in the list. + @param highlightText + The colour used for the text of the selected item. + @remarks + To reset one or more of the colours to its default, + call this method with wxNullColour for the colour or colours + to be reset. + + @since 3.1.3 + */ + void AutoCompSetColours(const wxColour& background, const wxColour& text, + const wxColour& highlight, + const wxColour& highlightText); + + /** + Use a wxListCtrl to display autocompletion and user lists. + + By default lists will be displayed in a wxListBox. Use this method to + display them in a wxListCtrl instead. The primary difference is that + wxListCtrl has hot tracking to highlight the item under the mouse cursor. + @param useListCtrl + Set this to true to use a wxListCtrl and to false to use a + wxListBox. + @param currentBgColour + The colour used to highlight the item under the mouse cursor. + @param currentTextColour + The colour used for the text of the item under the mouse cursor. + @remarks + To reset one or more of the colours to its default, + call this method with wxNullColour for the colour or colours + to be reset. + + @since 3.1.3 + */ + void AutoCompUseListCtrl(bool useListCtrl = true, + const wxColour& currentBgColour = wxNullColour, + const wxColour& currentTextColour = wxNullColour); + //@} diff --git a/tests/Makefile.in b/tests/Makefile.in index 626269dfd7..e9f79143a9 100644 --- a/tests/Makefile.in +++ b/tests/Makefile.in @@ -223,6 +223,7 @@ TEST_GUI_OBJECTS = \ test_gui_slidertest.o \ test_gui_spinctrldbltest.o \ test_gui_spinctrltest.o \ + test_gui_styledtextctrltest.o \ test_gui_textctrltest.o \ test_gui_textentrytest.o \ test_gui_togglebuttontest.o \ @@ -330,6 +331,9 @@ TEST_GUI_ODEP = $(_____pch_testprec_test_gui_testprec_h_gch___depname) COND_MONOLITHIC_0_USE_WEBVIEW_1___WXLIB_WEBVIEW_p = \ -lwx_$(PORTNAME)$(WXUNIVNAME)$(WXUNICODEFLAG)$(WXDEBUGFLAG)$(WX_LIB_FLAVOUR)_webview-$(WX_RELEASE)$(HOST_SUFFIX) @COND_MONOLITHIC_0_USE_WEBVIEW_1@__WXLIB_WEBVIEW_p = $(COND_MONOLITHIC_0_USE_WEBVIEW_1___WXLIB_WEBVIEW_p) +COND_MONOLITHIC_0_USE_STC_1___WXLIB_STC_p = \ + -lwx_$(PORTNAME)$(WXUNIVNAME)$(WXUNICODEFLAG)$(WXDEBUGFLAG)$(WX_LIB_FLAVOUR)_stc-$(WX_RELEASE)$(HOST_SUFFIX) +@COND_MONOLITHIC_0_USE_STC_1@__WXLIB_STC_p = $(COND_MONOLITHIC_0_USE_STC_1___WXLIB_STC_p) COND_MONOLITHIC_0___WXLIB_AUI_p = \ -lwx_$(PORTNAME)$(WXUNIVNAME)$(WXUNICODEFLAG)$(WXDEBUGFLAG)$(WX_LIB_FLAVOUR)_aui-$(WX_RELEASE)$(HOST_SUFFIX) @COND_MONOLITHIC_0@__WXLIB_AUI_p = $(COND_MONOLITHIC_0___WXLIB_AUI_p) @@ -424,7 +428,7 @@ test$(EXEEXT): $(TEST_OBJECTS) @COND_SHARED_1_USE_GUI_1@ $(SHARED_LD_MODULE_CXX) $@ $(TEST_DRAWINGPLUGIN_OBJECTS) -L$(LIBDIRNAME) $(LDFLAGS) $(__WXLIB_CORE_p) $(__WXLIB_BASE_p) $(__WXLIB_MONO_p) $(__LIB_SCINTILLA_IF_MONO_p) $(__LIB_TIFF_p) $(__LIB_JPEG_p) $(__LIB_PNG_p) $(EXTRALIBS_FOR_GUI) $(__LIB_ZLIB_p) $(__LIB_REGEX_p) $(__LIB_EXPAT_p) $(EXTRALIBS_FOR_BASE) $(LIBS) @COND_USE_GUI_1@test_gui$(EXEEXT): $(TEST_GUI_OBJECTS) $(__test_gui___win32rc) -@COND_USE_GUI_1@ $(CXX) -o $@ $(TEST_GUI_OBJECTS) -L$(LIBDIRNAME) $(SAMPLES_RPATH_FLAG) $(LDFLAGS) $(__WXLIB_WEBVIEW_p) $(__WXLIB_AUI_p) $(__WXLIB_RICHTEXT_p) $(__WXLIB_MEDIA_p) $(EXTRALIBS_MEDIA) $(__WXLIB_XRC_p) $(__WXLIB_XML_p) $(EXTRALIBS_XML) $(__WXLIB_HTML_p) $(EXTRALIBS_HTML) $(__WXLIB_CORE_p) $(__WXLIB_NET_p) $(__WXLIB_BASE_p) $(__WXLIB_MONO_p) $(__LIB_SCINTILLA_IF_MONO_p) $(__LIB_TIFF_p) $(__LIB_JPEG_p) $(__LIB_PNG_p) $(EXTRALIBS_FOR_GUI) $(__LIB_ZLIB_p) $(__LIB_REGEX_p) $(__LIB_EXPAT_p) $(EXTRALIBS_FOR_BASE) $(LIBS) +@COND_USE_GUI_1@ $(CXX) -o $@ $(TEST_GUI_OBJECTS) -L$(LIBDIRNAME) $(SAMPLES_RPATH_FLAG) $(LDFLAGS) $(__WXLIB_WEBVIEW_p) $(__WXLIB_STC_p) $(__WXLIB_AUI_p) $(__WXLIB_RICHTEXT_p) $(__WXLIB_MEDIA_p) $(EXTRALIBS_MEDIA) $(__WXLIB_XRC_p) $(__WXLIB_XML_p) $(EXTRALIBS_XML) $(__WXLIB_HTML_p) $(EXTRALIBS_HTML) $(__WXLIB_CORE_p) $(__WXLIB_NET_p) $(__WXLIB_BASE_p) $(__WXLIB_MONO_p) $(__LIB_SCINTILLA_IF_MONO_p) $(__LIB_TIFF_p) $(__LIB_JPEG_p) $(__LIB_PNG_p) $(EXTRALIBS_FOR_GUI) $(__LIB_ZLIB_p) $(__LIB_REGEX_p) $(__LIB_EXPAT_p) $(EXTRALIBS_FOR_BASE) $(LIBS) @COND_PLATFORM_MACOSX_1_USE_GUI_1@test_gui.app/Contents/PkgInfo: $(__test_gui___depname) $(top_srcdir)/src/osx/carbon/Info.plist.in $(top_srcdir)/src/osx/carbon/wxmac.icns @COND_PLATFORM_MACOSX_1_USE_GUI_1@ mkdir -p test_gui.app/Contents @@ -943,6 +947,9 @@ test_gui_spinctrldbltest.o: $(srcdir)/controls/spinctrldbltest.cpp $(TEST_GUI_OD test_gui_spinctrltest.o: $(srcdir)/controls/spinctrltest.cpp $(TEST_GUI_ODEP) $(CXXC) -c -o $@ $(TEST_GUI_CXXFLAGS) $(srcdir)/controls/spinctrltest.cpp +test_gui_styledtextctrltest.o: $(srcdir)/controls/styledtextctrltest.cpp $(TEST_GUI_ODEP) + $(CXXC) -c -o $@ $(TEST_GUI_CXXFLAGS) $(srcdir)/controls/styledtextctrltest.cpp + test_gui_textctrltest.o: $(srcdir)/controls/textctrltest.cpp $(TEST_GUI_ODEP) $(CXXC) -c -o $@ $(TEST_GUI_CXXFLAGS) $(srcdir)/controls/textctrltest.cpp diff --git a/tests/controls/styledtextctrltest.cpp b/tests/controls/styledtextctrltest.cpp new file mode 100644 index 0000000000..63c8610cb6 --- /dev/null +++ b/tests/controls/styledtextctrltest.cpp @@ -0,0 +1,157 @@ +/////////////////////////////////////////////////////////////////////////////// +// Name: tests/controls/styledtextctrltest.cpp +// Purpose: wxStyledTextCtrl unit test +// Author: New Pagodi +// Created: 2019-03-10 +// Copyright: (c) 2019 wxWidgets development team +// Licence: wxWindows licence +/////////////////////////////////////////////////////////////////////////////// + +#include "testprec.h" + +#if wxUSE_STC + +#if WXUSINGDLL + +#ifdef __BORLANDC__ + #pragma hdrstop +#endif + +#ifndef WX_PRECOMP + #include "wx/app.h" +#endif // WX_PRECOMP + +#include "wx/stc/stc.h" +#include "wx/uiaction.h" + +#if defined(__WXOSX_COCOA__) || defined(__WXMSW__) || defined(__WXGTK__) + +class StcPopupWindowsTestCase +{ +public: + StcPopupWindowsTestCase() + : m_stc(new wxStyledTextCtrl(wxTheApp->GetTopWindow(), wxID_ANY)) + { + m_focusAlwaysRetained=true; + m_calltipClickReceived=false; + + m_stc->Bind(wxEVT_KILL_FOCUS, + &StcPopupWindowsTestCase::OnKillSTCFocus, this); + m_stc->Bind(wxEVT_STC_CALLTIP_CLICK, + &StcPopupWindowsTestCase::OnCallTipClick, this); + } + + ~StcPopupWindowsTestCase() + { + delete m_stc; + } + + void OnKillSTCFocus(wxFocusEvent& WXUNUSED(event)) + { + m_focusAlwaysRetained=false; + } + + void OnCallTipClick(wxStyledTextEvent& WXUNUSED(event)) + { + m_calltipClickReceived=true; + } + +protected: + wxStyledTextCtrl* const m_stc; + bool m_focusAlwaysRetained; + bool m_calltipClickReceived; +}; + +// This set of tests is used to verify that an autocompletion popup does not +// take focus from its parent styled text control. +TEST_CASE_METHOD(StcPopupWindowsTestCase, + "wxStyledTextCtrl::AutoComp", + "[wxStyledTextCtrl][focus]") +{ + m_stc->SetFocus(); + m_focusAlwaysRetained = true; + m_stc->AutoCompShow(0,"ability able about above abroad absence absent"); + +#if wxUSE_UIACTIONSIMULATOR + // Pressing the tab key should cause the current entry in the list to be + // entered into the styled text control. However with GTK+, characters sent + // with the UI simulator seem to arrive too late, so select the current + // entry with a double click instead. + + wxUIActionSimulator sim; + +#ifdef __WXGTK__ + wxPoint zeroPosition = m_stc->PointFromPosition(0); + int textHt = m_stc->TextHeight(0); + int textWd = m_stc->TextWidth(0,"ability"); + wxPoint autoCompPoint(zeroPosition.x + textWd/2, + zeroPosition.y + textHt + textHt/2); + wxPoint scrnPoint = m_stc->ClientToScreen(autoCompPoint); + sim.MouseMove(scrnPoint); + sim.MouseDblClick(); +#else + sim.Char(WXK_TAB); +#endif // __WXGTK__ + ::wxYield(); + CHECK( m_stc->GetText() == "ability" ); +#endif //wxUSE_UIACTIONSIMULATOR + + if ( m_stc->AutoCompActive() ) + m_stc->AutoCompCancel(); + + CHECK( m_stc->HasFocus() ); + CHECK( m_focusAlwaysRetained ); +} + +// This test is used to verify that a call tip receives mouse clicks. However +// the clicks do sent with the UI simulator do not seem to be received on +// cocoa for some reason, so skip the test there for now. +#if !defined(__WXOSX_COCOA__) +TEST_CASE_METHOD(StcPopupWindowsTestCase, + "wxStyledTextCtrl::Calltip", + "[wxStyledTextCtrl][focus]") +{ + m_stc->SetFocus(); + m_calltipClickReceived = false; + m_focusAlwaysRetained = true; + + wxString calltipText = "This is a calltip."; + m_stc->CallTipShow(0,calltipText); + +#if wxUSE_UIACTIONSIMULATOR + wxUIActionSimulator sim; + wxPoint zeroPosition = m_stc->PointFromPosition(0); + int textHt = m_stc->TextHeight(0); + int textWd = m_stc->TextWidth(0,calltipText); + + // zeroPosition is the top left of position 0 and the call tip should have + // roughly the same height as textHt (there seems to be some extra padding + // that makes it a little taller, but it's roughly the same height), + // so (zeroPosition.x+textWd/2,zeroPosition.y+textHt+textHt/2) should + // be the middle of the calltip. + wxPoint calltipMidPoint(zeroPosition.x + textWd/2, + zeroPosition.y + textHt + textHt/2); + wxPoint scrnPoint = m_stc->ClientToScreen(calltipMidPoint); + sim.MouseMove(scrnPoint); + sim.MouseClick(); + ::wxYield(); + + CHECK( m_calltipClickReceived ); +#endif // wxUSE_UIACTIONSIMULATOR + + if ( m_stc->CallTipActive() ) + m_stc->CallTipCancel(); + + // Verify that clicking the call tip did not take focus from the STC. + CHECK( m_stc->HasFocus() ); + CHECK( m_focusAlwaysRetained ); +} + +#endif // !defined(__WXOSX_COCOA__) + +#endif // defined(__WXOSX_COCOA__) || defined(__WXMSW__) || defined(__WXGTK__) + +#endif // WXUSINGDLL + +#endif // wxUSE_STC + diff --git a/tests/descrip.mms b/tests/descrip.mms index d448c7095a..cb3b80f367 100644 --- a/tests/descrip.mms +++ b/tests/descrip.mms @@ -184,6 +184,7 @@ TEST_GUI_OBJECTS2=test_gui_richtextctrltest.obj,\ test_gui_slidertest.obj,\ test_gui_spinctrldbltest.obj,\ test_gui_spinctrltest.obj,\ + test_gui_styledtextctrltest.obj,\ test_gui_textctrltest.obj,\ test_gui_textentrytest.obj,\ test_gui_togglebuttontest.obj,\ @@ -617,6 +618,9 @@ test_gui_spinctrldbltest.obj : [.controls]spinctrldbltest.cpp test_gui_spinctrltest.obj : [.controls]spinctrltest.cpp $(CXXC) /object=[]$@ $(TEST_GUI_CXXFLAGS) [.controls]spinctrltest.cpp +test_gui_styledtextctrltest.obj : [.controls]styledtextctrltest.cpp + $(CXXC) /object=[]$@ $(TEST_GUI_CXXFLAGS) [.controls]styledtextctrltest.cpp + test_gui_textctrltest.obj : [.controls]textctrltest.cpp $(CXXC) /object=[]$@ $(TEST_GUI_CXXFLAGS) [.controls]textctrltest.cpp diff --git a/tests/makefile.bcc b/tests/makefile.bcc index 51192463b0..53cc3a0f49 100644 --- a/tests/makefile.bcc +++ b/tests/makefile.bcc @@ -210,6 +210,7 @@ TEST_GUI_OBJECTS = \ $(OBJS)\test_gui_slidertest.obj \ $(OBJS)\test_gui_spinctrldbltest.obj \ $(OBJS)\test_gui_spinctrltest.obj \ + $(OBJS)\test_gui_styledtextctrltest.obj \ $(OBJS)\test_gui_textctrltest.obj \ $(OBJS)\test_gui_textentrytest.obj \ $(OBJS)\test_gui_togglebuttontest.obj \ @@ -334,6 +335,10 @@ __DLLFLAG_p_7 = -dWXUSINGDLL __WXLIB_WEBVIEW_p = \ wx$(PORTNAME)$(WXUNIVNAME)$(WX_RELEASE_NODOT)$(WXUNICODEFLAG)$(WXDEBUGFLAG)$(WX_LIB_FLAVOUR)_webview.lib !endif +!if "$(MONOLITHIC)" == "0" && "$(USE_STC)" == "1" +__WXLIB_STC_p = \ + wx$(PORTNAME)$(WXUNIVNAME)$(WX_RELEASE_NODOT)$(WXUNICODEFLAG)$(WXDEBUGFLAG)$(WX_LIB_FLAVOUR)_stc.lib +!endif !if "$(MONOLITHIC)" == "0" __WXLIB_AUI_p = \ wx$(PORTNAME)$(WXUNIVNAME)$(WX_RELEASE_NODOT)$(WXUNICODEFLAG)$(WXDEBUGFLAG)$(WX_LIB_FLAVOUR)_aui.lib @@ -525,7 +530,7 @@ $(OBJS)\test_drawingplugin.dll: $(TEST_DRAWINGPLUGIN_OBJECTS) !if "$(USE_GUI)" == "1" $(OBJS)\test_gui.exe: $(OBJS)\test_gui_dummy.obj $(TEST_GUI_OBJECTS) $(OBJS)\test_gui_sample.res ilink32 -Tpe -q -L$(BCCDIR)\lib -L$(BCCDIR)\lib\psdk $(__DEBUGINFO) -L$(LIBDIRNAME) -ap $(____CAIRO_LIBDIR_FILENAMES) $(LDFLAGS) @&&| - c0x32.obj $(TEST_GUI_OBJECTS),$@,, $(__WXLIB_WEBVIEW_p) $(__WXLIB_AUI_p) $(__WXLIB_RICHTEXT_p) $(__WXLIB_MEDIA_p) $(__WXLIB_XRC_p) $(__WXLIB_XML_p) $(__WXLIB_HTML_p) $(__WXLIB_CORE_p) $(__WXLIB_NET_p) $(__WXLIB_BASE_p) $(__WXLIB_MONO_p) $(__LIB_SCINTILLA_IF_MONO_p) $(__LIB_TIFF_p) $(__LIB_JPEG_p) $(__LIB_PNG_p) wxzlib$(WXDEBUGFLAG).lib wxregex$(WXUNICODEFLAG)$(WXDEBUGFLAG).lib wxexpat$(WXDEBUGFLAG).lib $(EXTRALIBS_FOR_BASE) $(__CAIRO_LIB_p) ole2w32.lib oleacc.lib uxtheme.lib import32.lib cw32$(__THREADSFLAG)$(__RUNTIME_LIBS_2).lib,, $(OBJS)\test_gui_sample.res + c0x32.obj $(TEST_GUI_OBJECTS),$@,, $(__WXLIB_WEBVIEW_p) $(__WXLIB_STC_p) $(__WXLIB_AUI_p) $(__WXLIB_RICHTEXT_p) $(__WXLIB_MEDIA_p) $(__WXLIB_XRC_p) $(__WXLIB_XML_p) $(__WXLIB_HTML_p) $(__WXLIB_CORE_p) $(__WXLIB_NET_p) $(__WXLIB_BASE_p) $(__WXLIB_MONO_p) $(__LIB_SCINTILLA_IF_MONO_p) $(__LIB_TIFF_p) $(__LIB_JPEG_p) $(__LIB_PNG_p) wxzlib$(WXDEBUGFLAG).lib wxregex$(WXUNICODEFLAG)$(WXDEBUGFLAG).lib wxexpat$(WXDEBUGFLAG).lib $(EXTRALIBS_FOR_BASE) $(__CAIRO_LIB_p) ole2w32.lib oleacc.lib uxtheme.lib import32.lib cw32$(__THREADSFLAG)$(__RUNTIME_LIBS_2).lib,, $(OBJS)\test_gui_sample.res | !endif @@ -998,6 +1003,9 @@ $(OBJS)\test_gui_spinctrldbltest.obj: .\controls\spinctrldbltest.cpp $(OBJS)\test_gui_spinctrltest.obj: .\controls\spinctrltest.cpp $(CXX) -q -c -P -o$@ $(TEST_GUI_CXXFLAGS) .\controls\spinctrltest.cpp +$(OBJS)\test_gui_styledtextctrltest.obj: .\controls\styledtextctrltest.cpp + $(CXX) -q -c -P -o$@ $(TEST_GUI_CXXFLAGS) .\controls\styledtextctrltest.cpp + $(OBJS)\test_gui_textctrltest.obj: .\controls\textctrltest.cpp $(CXX) -q -c -P -o$@ $(TEST_GUI_CXXFLAGS) .\controls\textctrltest.cpp diff --git a/tests/makefile.gcc b/tests/makefile.gcc index 94d034dd80..9736869d0a 100644 --- a/tests/makefile.gcc +++ b/tests/makefile.gcc @@ -205,6 +205,7 @@ TEST_GUI_OBJECTS = \ $(OBJS)\test_gui_slidertest.o \ $(OBJS)\test_gui_spinctrldbltest.o \ $(OBJS)\test_gui_spinctrltest.o \ + $(OBJS)\test_gui_styledtextctrltest.o \ $(OBJS)\test_gui_textctrltest.o \ $(OBJS)\test_gui_textentrytest.o \ $(OBJS)\test_gui_togglebuttontest.o \ @@ -337,6 +338,12 @@ __WXLIB_WEBVIEW_p = \ endif endif ifeq ($(MONOLITHIC),0) +ifeq ($(USE_STC),1) +__WXLIB_STC_p = \ + -lwx$(PORTNAME)$(WXUNIVNAME)$(WX_RELEASE_NODOT)$(WXUNICODEFLAG)$(WXDEBUGFLAG)$(WX_LIB_FLAVOUR)_stc +endif +endif +ifeq ($(MONOLITHIC),0) __WXLIB_AUI_p = \ -lwx$(PORTNAME)$(WXUNIVNAME)$(WX_RELEASE_NODOT)$(WXUNICODEFLAG)$(WXDEBUGFLAG)$(WX_LIB_FLAVOUR)_aui endif @@ -503,7 +510,7 @@ endif ifeq ($(USE_GUI),1) $(OBJS)\test_gui.exe: $(TEST_GUI_OBJECTS) $(OBJS)\test_gui_sample_rc.o - $(CXX) -o $@ $(TEST_GUI_OBJECTS) $(__DEBUGINFO) $(__THREADSFLAG) -L$(LIBDIRNAME) $(____CAIRO_LIBDIR_FILENAMES) $(LDFLAGS) $(__WXLIB_WEBVIEW_p) $(__WXLIB_AUI_p) $(__WXLIB_RICHTEXT_p) $(__WXLIB_MEDIA_p) $(__WXLIB_XRC_p) $(__WXLIB_XML_p) $(__WXLIB_HTML_p) $(__WXLIB_CORE_p) $(__WXLIB_NET_p) $(__WXLIB_BASE_p) $(__WXLIB_MONO_p) $(__LIB_SCINTILLA_IF_MONO_p) $(__LIB_TIFF_p) $(__LIB_JPEG_p) $(__LIB_PNG_p) -lwxzlib$(WXDEBUGFLAG) -lwxregex$(WXUNICODEFLAG)$(WXDEBUGFLAG) -lwxexpat$(WXDEBUGFLAG) $(EXTRALIBS_FOR_BASE) $(__CAIRO_LIB_p) -lkernel32 -luser32 -lgdi32 -lcomdlg32 -lwinspool -lwinmm -lshell32 -lshlwapi -lcomctl32 -lole32 -loleaut32 -luuid -lrpcrt4 -ladvapi32 -lversion -lwsock32 -lwininet -loleacc -luxtheme + $(CXX) -o $@ $(TEST_GUI_OBJECTS) $(__DEBUGINFO) $(__THREADSFLAG) -L$(LIBDIRNAME) $(____CAIRO_LIBDIR_FILENAMES) $(LDFLAGS) $(__WXLIB_WEBVIEW_p) $(__WXLIB_STC_p) $(__WXLIB_AUI_p) $(__WXLIB_RICHTEXT_p) $(__WXLIB_MEDIA_p) $(__WXLIB_XRC_p) $(__WXLIB_XML_p) $(__WXLIB_HTML_p) $(__WXLIB_CORE_p) $(__WXLIB_NET_p) $(__WXLIB_BASE_p) $(__WXLIB_MONO_p) $(__LIB_SCINTILLA_IF_MONO_p) $(__LIB_TIFF_p) $(__LIB_JPEG_p) $(__LIB_PNG_p) -lwxzlib$(WXDEBUGFLAG) -lwxregex$(WXUNICODEFLAG)$(WXDEBUGFLAG) -lwxexpat$(WXDEBUGFLAG) $(EXTRALIBS_FOR_BASE) $(__CAIRO_LIB_p) -lkernel32 -luser32 -lgdi32 -lcomdlg32 -lwinspool -lwinmm -lshell32 -lshlwapi -lcomctl32 -lole32 -loleaut32 -luuid -lrpcrt4 -ladvapi32 -lversion -lwsock32 -lwininet -loleacc -luxtheme endif data: @@ -975,6 +982,9 @@ $(OBJS)\test_gui_spinctrldbltest.o: ./controls/spinctrldbltest.cpp $(OBJS)\test_gui_spinctrltest.o: ./controls/spinctrltest.cpp $(CXX) -c -o $@ $(TEST_GUI_CXXFLAGS) $(CPPDEPS) $< +$(OBJS)\test_gui_styledtextctrltest.o: ./controls/styledtextctrltest.cpp + $(CXX) -c -o $@ $(TEST_GUI_CXXFLAGS) $(CPPDEPS) $< + $(OBJS)\test_gui_textctrltest.o: ./controls/textctrltest.cpp $(CXX) -c -o $@ $(TEST_GUI_CXXFLAGS) $(CPPDEPS) $< diff --git a/tests/makefile.vc b/tests/makefile.vc index 95861401c6..3b1462545b 100644 --- a/tests/makefile.vc +++ b/tests/makefile.vc @@ -216,6 +216,7 @@ TEST_GUI_OBJECTS = \ $(OBJS)\test_gui_slidertest.obj \ $(OBJS)\test_gui_spinctrldbltest.obj \ $(OBJS)\test_gui_spinctrltest.obj \ + $(OBJS)\test_gui_styledtextctrltest.obj \ $(OBJS)\test_gui_textctrltest.obj \ $(OBJS)\test_gui_textentrytest.obj \ $(OBJS)\test_gui_togglebuttontest.obj \ @@ -486,6 +487,10 @@ __DLLFLAG_p_7 = /d WXUSINGDLL __WXLIB_WEBVIEW_p = \ wx$(PORTNAME)$(WXUNIVNAME)$(WX_RELEASE_NODOT)$(WXUNICODEFLAG)$(WXDEBUGFLAG)$(WX_LIB_FLAVOUR)_webview.lib !endif +!if "$(MONOLITHIC)" == "0" && "$(USE_STC)" == "1" +__WXLIB_STC_p = \ + wx$(PORTNAME)$(WXUNIVNAME)$(WX_RELEASE_NODOT)$(WXUNICODEFLAG)$(WXDEBUGFLAG)$(WX_LIB_FLAVOUR)_stc.lib +!endif !if "$(MONOLITHIC)" == "0" __WXLIB_AUI_p = \ wx$(PORTNAME)$(WXUNIVNAME)$(WX_RELEASE_NODOT)$(WXUNICODEFLAG)$(WXDEBUGFLAG)$(WX_LIB_FLAVOUR)_aui.lib @@ -716,7 +721,7 @@ $(OBJS)\test_drawingplugin.dll: $(TEST_DRAWINGPLUGIN_OBJECTS) !if "$(USE_GUI)" == "1" $(OBJS)\test_gui.exe: $(OBJS)\test_gui_dummy.obj $(TEST_GUI_OBJECTS) $(OBJS)\test_gui_sample.res link /NOLOGO /OUT:$@ $(__DEBUGINFO_4) /pdb:"$(OBJS)\test_gui.pdb" $(__DEBUGINFO_51) $(LINK_TARGET_CPU) /LIBPATH:$(LIBDIRNAME) /SUBSYSTEM:CONSOLE $(____CAIRO_LIBDIR_FILENAMES) $(LDFLAGS) @<< - $(TEST_GUI_OBJECTS) $(TEST_GUI_RESOURCES) $(__WXLIB_WEBVIEW_p) $(__WXLIB_AUI_p) $(__WXLIB_RICHTEXT_p) $(__WXLIB_MEDIA_p) $(__WXLIB_XRC_p) $(__WXLIB_XML_p) $(__WXLIB_HTML_p) $(__WXLIB_CORE_p) $(__WXLIB_NET_p) $(__WXLIB_BASE_p) $(__WXLIB_MONO_p) $(__LIB_SCINTILLA_IF_MONO_p) $(__LIB_TIFF_p) $(__LIB_JPEG_p) $(__LIB_PNG_p) wxzlib$(WXDEBUGFLAG).lib wxregex$(WXUNICODEFLAG)$(WXDEBUGFLAG).lib wxexpat$(WXDEBUGFLAG).lib $(EXTRALIBS_FOR_BASE) $(__CAIRO_LIB_p) kernel32.lib user32.lib gdi32.lib comdlg32.lib winspool.lib winmm.lib shell32.lib shlwapi.lib comctl32.lib ole32.lib oleaut32.lib uuid.lib rpcrt4.lib advapi32.lib version.lib wsock32.lib wininet.lib + $(TEST_GUI_OBJECTS) $(TEST_GUI_RESOURCES) $(__WXLIB_WEBVIEW_p) $(__WXLIB_STC_p) $(__WXLIB_AUI_p) $(__WXLIB_RICHTEXT_p) $(__WXLIB_MEDIA_p) $(__WXLIB_XRC_p) $(__WXLIB_XML_p) $(__WXLIB_HTML_p) $(__WXLIB_CORE_p) $(__WXLIB_NET_p) $(__WXLIB_BASE_p) $(__WXLIB_MONO_p) $(__LIB_SCINTILLA_IF_MONO_p) $(__LIB_TIFF_p) $(__LIB_JPEG_p) $(__LIB_PNG_p) wxzlib$(WXDEBUGFLAG).lib wxregex$(WXUNICODEFLAG)$(WXDEBUGFLAG).lib wxexpat$(WXDEBUGFLAG).lib $(EXTRALIBS_FOR_BASE) $(__CAIRO_LIB_p) kernel32.lib user32.lib gdi32.lib comdlg32.lib winspool.lib winmm.lib shell32.lib shlwapi.lib comctl32.lib ole32.lib oleaut32.lib uuid.lib rpcrt4.lib advapi32.lib version.lib wsock32.lib wininet.lib << !endif @@ -1189,6 +1194,9 @@ $(OBJS)\test_gui_spinctrldbltest.obj: .\controls\spinctrldbltest.cpp $(OBJS)\test_gui_spinctrltest.obj: .\controls\spinctrltest.cpp $(CXX) /c /nologo /TP /Fo$@ $(TEST_GUI_CXXFLAGS) .\controls\spinctrltest.cpp +$(OBJS)\test_gui_styledtextctrltest.obj: .\controls\styledtextctrltest.cpp + $(CXX) /c /nologo /TP /Fo$@ $(TEST_GUI_CXXFLAGS) .\controls\styledtextctrltest.cpp + $(OBJS)\test_gui_textctrltest.obj: .\controls\textctrltest.cpp $(CXX) /c /nologo /TP /Fo$@ $(TEST_GUI_CXXFLAGS) .\controls\textctrltest.cpp diff --git a/tests/test.bkl b/tests/test.bkl index 1f389fa3bf..70326b8dce 100644 --- a/tests/test.bkl +++ b/tests/test.bkl @@ -223,6 +223,7 @@ controls/slidertest.cpp controls/spinctrldbltest.cpp controls/spinctrltest.cpp + controls/styledtextctrltest.cpp controls/textctrltest.cpp controls/textentrytest.cpp controls/togglebuttontest.cpp @@ -282,9 +283,10 @@ Can't use here as it doesn't work with conditionally defined variables, so fall back as we must not link with inexisting webview library to be able to run tests even if - wxWebView is not available. + wxWebView or wxSTC is not available. --> $(WXLIB_WEBVIEW) + $(WXLIB_STC) aui richtext media diff --git a/tests/test_gui.vcxproj b/tests/test_gui.vcxproj index dd60da1d58..01d985c991 100644 --- a/tests/test_gui.vcxproj +++ b/tests/test_gui.vcxproj @@ -154,7 +154,7 @@ ..\lib\$(wxOutDirName)\$(wxIncSubDir);.\..\include;..\3rdparty\catch\include;.;.\..\samples;%(AdditionalIncludeDirectories) - wxmsw$(wxShortVersionString)ud_webview.lib;wxmsw$(wxShortVersionString)ud_richtext.lib;wxmsw$(wxShortVersionString)ud_aui.lib;wxmsw$(wxShortVersionString)ud_media.lib;wxmsw$(wxShortVersionString)ud_xrc.lib;wxbase$(wxShortVersionString)ud_xml.lib;wxmsw$(wxShortVersionString)ud_html.lib;wxmsw$(wxShortVersionString)ud_core.lib;wxbase$(wxShortVersionString)ud_net.lib;wxbase$(wxShortVersionString)ud.lib;wxtiffd.lib;wxjpegd.lib;wxpngd.lib;wxzlibd.lib;wxregexud.lib;wxexpatd.lib;kernel32.lib;user32.lib;gdi32.lib;comdlg32.lib;winspool.lib;winmm.lib;shell32.lib;comctl32.lib;ole32.lib;oleaut32.lib;uuid.lib;rpcrt4.lib;advapi32.lib;wsock32.lib;wininet.lib;%(AdditionalDependencies) + wxmsw$(wxShortVersionString)ud_webview.lib;wxmsw$(wxShortVersionString)ud_richtext.lib;wxmsw$(wxShortVersionString)ud_stc.lib;wxmsw$(wxShortVersionString)ud_aui.lib;wxmsw$(wxShortVersionString)ud_media.lib;wxmsw$(wxShortVersionString)ud_xrc.lib;wxbase$(wxShortVersionString)ud_xml.lib;wxmsw$(wxShortVersionString)ud_html.lib;wxmsw$(wxShortVersionString)ud_core.lib;wxbase$(wxShortVersionString)ud_net.lib;wxbase$(wxShortVersionString)ud.lib;wxtiffd.lib;wxjpegd.lib;wxpngd.lib;wxzlibd.lib;wxregexud.lib;wxexpatd.lib;kernel32.lib;user32.lib;gdi32.lib;comdlg32.lib;winspool.lib;winmm.lib;shell32.lib;comctl32.lib;ole32.lib;oleaut32.lib;uuid.lib;rpcrt4.lib;advapi32.lib;wsock32.lib;wininet.lib;%(AdditionalDependencies) true ..\lib\$(wxOutDirName);%(AdditionalLibraryDirectories) true @@ -193,7 +193,7 @@ ..\lib\$(wxOutDirName)\$(wxIncSubDir);.\..\include;..\3rdparty\catch\include;.;.\..\samples;%(AdditionalIncludeDirectories) - wxmsw$(wxShortVersionString)u_webview.lib;wxmsw$(wxShortVersionString)u_richtext.lib;wxmsw$(wxShortVersionString)u_aui.lib;wxmsw$(wxShortVersionString)u_media.lib;wxmsw$(wxShortVersionString)u_xrc.lib;wxbase$(wxShortVersionString)u_xml.lib;wxmsw$(wxShortVersionString)u_html.lib;wxmsw$(wxShortVersionString)u_core.lib;wxbase$(wxShortVersionString)u_net.lib;wxbase$(wxShortVersionString)u.lib;wxtiff.lib;wxjpeg.lib;wxpng.lib;wxzlib.lib;wxregexu.lib;wxexpat.lib;kernel32.lib;user32.lib;gdi32.lib;comdlg32.lib;winspool.lib;winmm.lib;shell32.lib;comctl32.lib;ole32.lib;oleaut32.lib;uuid.lib;rpcrt4.lib;advapi32.lib;wsock32.lib;wininet.lib;%(AdditionalDependencies) + wxmsw$(wxShortVersionString)u_webview.lib;wxmsw$(wxShortVersionString)u_richtext.lib;wxmsw$(wxShortVersionString)u_stc.lib;wxmsw$(wxShortVersionString)u_aui.lib;wxmsw$(wxShortVersionString)u_media.lib;wxmsw$(wxShortVersionString)u_xrc.lib;wxbase$(wxShortVersionString)u_xml.lib;wxmsw$(wxShortVersionString)u_html.lib;wxmsw$(wxShortVersionString)u_core.lib;wxbase$(wxShortVersionString)u_net.lib;wxbase$(wxShortVersionString)u.lib;wxtiff.lib;wxjpeg.lib;wxpng.lib;wxzlib.lib;wxregexu.lib;wxexpat.lib;kernel32.lib;user32.lib;gdi32.lib;comdlg32.lib;winspool.lib;winmm.lib;shell32.lib;comctl32.lib;ole32.lib;oleaut32.lib;uuid.lib;rpcrt4.lib;advapi32.lib;wsock32.lib;wininet.lib;%(AdditionalDependencies) true ..\lib\$(wxOutDirName);%(AdditionalLibraryDirectories) true @@ -236,7 +236,7 @@ ..\lib\$(wxOutDirName)\$(wxIncSubDir);.\..\include;..\3rdparty\catch\include;.;.\..\samples;%(AdditionalIncludeDirectories) - wxmsw$(wxShortVersionString)ud_webview.lib;wxmsw$(wxShortVersionString)ud_richtext.lib;wxmsw$(wxShortVersionString)ud_aui.lib;wxmsw$(wxShortVersionString)ud_media.lib;wxmsw$(wxShortVersionString)ud_xrc.lib;wxbase$(wxShortVersionString)ud_xml.lib;wxmsw$(wxShortVersionString)ud_html.lib;wxmsw$(wxShortVersionString)ud_core.lib;wxbase$(wxShortVersionString)ud_net.lib;wxbase$(wxShortVersionString)ud.lib;wxtiffd.lib;wxjpegd.lib;wxpngd.lib;wxzlibd.lib;wxregexud.lib;wxexpatd.lib;kernel32.lib;user32.lib;gdi32.lib;comdlg32.lib;winspool.lib;winmm.lib;shell32.lib;comctl32.lib;ole32.lib;oleaut32.lib;uuid.lib;rpcrt4.lib;advapi32.lib;wsock32.lib;wininet.lib;%(AdditionalDependencies) + wxmsw$(wxShortVersionString)ud_webview.lib;wxmsw$(wxShortVersionString)ud_richtext.lib;wxmsw$(wxShortVersionString)ud_stc.lib;wxmsw$(wxShortVersionString)ud_aui.lib;wxmsw$(wxShortVersionString)ud_media.lib;wxmsw$(wxShortVersionString)ud_xrc.lib;wxbase$(wxShortVersionString)ud_xml.lib;wxmsw$(wxShortVersionString)ud_html.lib;wxmsw$(wxShortVersionString)ud_core.lib;wxbase$(wxShortVersionString)ud_net.lib;wxbase$(wxShortVersionString)ud.lib;wxtiffd.lib;wxjpegd.lib;wxpngd.lib;wxzlibd.lib;wxregexud.lib;wxexpatd.lib;kernel32.lib;user32.lib;gdi32.lib;comdlg32.lib;winspool.lib;winmm.lib;shell32.lib;comctl32.lib;ole32.lib;oleaut32.lib;uuid.lib;rpcrt4.lib;advapi32.lib;wsock32.lib;wininet.lib;%(AdditionalDependencies) true ..\lib\$(wxOutDirName);%(AdditionalLibraryDirectories) true @@ -275,7 +275,7 @@ ..\lib\$(wxOutDirName)\$(wxIncSubDir);.\..\include;..\3rdparty\catch\include;.;.\..\samples;%(AdditionalIncludeDirectories) - wxmsw$(wxShortVersionString)u_webview.lib;wxmsw$(wxShortVersionString)u_richtext.lib;wxmsw$(wxShortVersionString)u_aui.lib;wxmsw$(wxShortVersionString)u_media.lib;wxmsw$(wxShortVersionString)u_xrc.lib;wxbase$(wxShortVersionString)u_xml.lib;wxmsw$(wxShortVersionString)u_html.lib;wxmsw$(wxShortVersionString)u_core.lib;wxbase$(wxShortVersionString)u_net.lib;wxbase$(wxShortVersionString)u.lib;wxtiff.lib;wxjpeg.lib;wxpng.lib;wxzlib.lib;wxregexu.lib;wxexpat.lib;kernel32.lib;user32.lib;gdi32.lib;comdlg32.lib;winspool.lib;winmm.lib;shell32.lib;comctl32.lib;ole32.lib;oleaut32.lib;uuid.lib;rpcrt4.lib;advapi32.lib;wsock32.lib;wininet.lib;%(AdditionalDependencies) + wxmsw$(wxShortVersionString)u_webview.lib;wxmsw$(wxShortVersionString)u_richtext.lib;wxmsw$(wxShortVersionString)u_stc.lib;wxmsw$(wxShortVersionString)u_aui.lib;wxmsw$(wxShortVersionString)u_media.lib;wxmsw$(wxShortVersionString)u_xrc.lib;wxbase$(wxShortVersionString)u_xml.lib;wxmsw$(wxShortVersionString)u_html.lib;wxmsw$(wxShortVersionString)u_core.lib;wxbase$(wxShortVersionString)u_net.lib;wxbase$(wxShortVersionString)u.lib;wxtiff.lib;wxjpeg.lib;wxpng.lib;wxzlib.lib;wxregexu.lib;wxexpat.lib;kernel32.lib;user32.lib;gdi32.lib;comdlg32.lib;winspool.lib;winmm.lib;shell32.lib;comctl32.lib;ole32.lib;oleaut32.lib;uuid.lib;rpcrt4.lib;advapi32.lib;wsock32.lib;wininet.lib;%(AdditionalDependencies) true ..\lib\$(wxOutDirName);%(AdditionalLibraryDirectories) true @@ -318,7 +318,7 @@ ..\lib\$(wxOutDirName)\$(wxIncSubDir);.\..\include;..\3rdparty\catch\include;.;.\..\samples;%(AdditionalIncludeDirectories) - wxmsw$(wxShortVersionString)ud_webview.lib;wxmsw$(wxShortVersionString)ud_richtext.lib;wxmsw$(wxShortVersionString)ud_aui.lib;wxmsw$(wxShortVersionString)ud_media.lib;wxmsw$(wxShortVersionString)ud_xrc.lib;wxbase$(wxShortVersionString)ud_xml.lib;wxmsw$(wxShortVersionString)ud_html.lib;wxmsw$(wxShortVersionString)ud_core.lib;wxbase$(wxShortVersionString)ud_net.lib;wxbase$(wxShortVersionString)ud.lib;wxtiffd.lib;wxjpegd.lib;wxpngd.lib;wxzlibd.lib;wxregexud.lib;wxexpatd.lib;kernel32.lib;user32.lib;gdi32.lib;comdlg32.lib;winspool.lib;winmm.lib;shell32.lib;comctl32.lib;ole32.lib;oleaut32.lib;uuid.lib;rpcrt4.lib;advapi32.lib;wsock32.lib;wininet.lib;%(AdditionalDependencies) + wxmsw$(wxShortVersionString)ud_webview.lib;wxmsw$(wxShortVersionString)ud_richtext.lib;wxmsw$(wxShortVersionString)ud_stc.lib;wxmsw$(wxShortVersionString)ud_aui.lib;wxmsw$(wxShortVersionString)ud_media.lib;wxmsw$(wxShortVersionString)ud_xrc.lib;wxbase$(wxShortVersionString)ud_xml.lib;wxmsw$(wxShortVersionString)ud_html.lib;wxmsw$(wxShortVersionString)ud_core.lib;wxbase$(wxShortVersionString)ud_net.lib;wxbase$(wxShortVersionString)ud.lib;wxtiffd.lib;wxjpegd.lib;wxpngd.lib;wxzlibd.lib;wxregexud.lib;wxexpatd.lib;kernel32.lib;user32.lib;gdi32.lib;comdlg32.lib;winspool.lib;winmm.lib;shell32.lib;comctl32.lib;ole32.lib;oleaut32.lib;uuid.lib;rpcrt4.lib;advapi32.lib;wsock32.lib;wininet.lib;%(AdditionalDependencies) true ..\lib\$(wxOutDirName);%(AdditionalLibraryDirectories) true @@ -357,7 +357,7 @@ ..\lib\$(wxOutDirName)\$(wxIncSubDir);.\..\include;..\3rdparty\catch\include;.;.\..\samples;%(AdditionalIncludeDirectories) - wxmsw$(wxShortVersionString)u_webview.lib;wxmsw$(wxShortVersionString)u_richtext.lib;wxmsw$(wxShortVersionString)u_aui.lib;wxmsw$(wxShortVersionString)u_media.lib;wxmsw$(wxShortVersionString)u_xrc.lib;wxbase$(wxShortVersionString)u_xml.lib;wxmsw$(wxShortVersionString)u_html.lib;wxmsw$(wxShortVersionString)u_core.lib;wxbase$(wxShortVersionString)u_net.lib;wxbase$(wxShortVersionString)u.lib;wxtiff.lib;wxjpeg.lib;wxpng.lib;wxzlib.lib;wxregexu.lib;wxexpat.lib;kernel32.lib;user32.lib;gdi32.lib;comdlg32.lib;winspool.lib;winmm.lib;shell32.lib;comctl32.lib;ole32.lib;oleaut32.lib;uuid.lib;rpcrt4.lib;advapi32.lib;wsock32.lib;wininet.lib;%(AdditionalDependencies) + wxmsw$(wxShortVersionString)u_webview.lib;wxmsw$(wxShortVersionString)u_richtext.lib;wxmsw$(wxShortVersionString)u_stc.lib;wxmsw$(wxShortVersionString)u_aui.lib;wxmsw$(wxShortVersionString)u_media.lib;wxmsw$(wxShortVersionString)u_xrc.lib;wxbase$(wxShortVersionString)u_xml.lib;wxmsw$(wxShortVersionString)u_html.lib;wxmsw$(wxShortVersionString)u_core.lib;wxbase$(wxShortVersionString)u_net.lib;wxbase$(wxShortVersionString)u.lib;wxtiff.lib;wxjpeg.lib;wxpng.lib;wxzlib.lib;wxregexu.lib;wxexpat.lib;kernel32.lib;user32.lib;gdi32.lib;comdlg32.lib;winspool.lib;winmm.lib;shell32.lib;comctl32.lib;ole32.lib;oleaut32.lib;uuid.lib;rpcrt4.lib;advapi32.lib;wsock32.lib;wininet.lib;%(AdditionalDependencies) true ..\lib\$(wxOutDirName);%(AdditionalLibraryDirectories) true @@ -400,7 +400,7 @@ ..\lib\$(wxOutDirName)\$(wxIncSubDir);.\..\include;..\3rdparty\catch\include;.;.\..\samples;%(AdditionalIncludeDirectories) - wxmsw$(wxShortVersionString)ud_webview.lib;wxmsw$(wxShortVersionString)ud_richtext.lib;wxmsw$(wxShortVersionString)ud_aui.lib;wxmsw$(wxShortVersionString)ud_media.lib;wxmsw$(wxShortVersionString)ud_xrc.lib;wxbase$(wxShortVersionString)ud_xml.lib;wxmsw$(wxShortVersionString)ud_html.lib;wxmsw$(wxShortVersionString)ud_core.lib;wxbase$(wxShortVersionString)ud_net.lib;wxbase$(wxShortVersionString)ud.lib;wxtiffd.lib;wxjpegd.lib;wxpngd.lib;wxzlibd.lib;wxregexud.lib;wxexpatd.lib;kernel32.lib;user32.lib;gdi32.lib;comdlg32.lib;winspool.lib;winmm.lib;shell32.lib;comctl32.lib;ole32.lib;oleaut32.lib;uuid.lib;rpcrt4.lib;advapi32.lib;wsock32.lib;wininet.lib;%(AdditionalDependencies) + wxmsw$(wxShortVersionString)ud_webview.lib;wxmsw$(wxShortVersionString)ud_richtext.lib;wxmsw$(wxShortVersionString)ud_stc.lib;wxmsw$(wxShortVersionString)ud_aui.lib;wxmsw$(wxShortVersionString)ud_media.lib;wxmsw$(wxShortVersionString)ud_xrc.lib;wxbase$(wxShortVersionString)ud_xml.lib;wxmsw$(wxShortVersionString)ud_html.lib;wxmsw$(wxShortVersionString)ud_core.lib;wxbase$(wxShortVersionString)ud_net.lib;wxbase$(wxShortVersionString)ud.lib;wxtiffd.lib;wxjpegd.lib;wxpngd.lib;wxzlibd.lib;wxregexud.lib;wxexpatd.lib;kernel32.lib;user32.lib;gdi32.lib;comdlg32.lib;winspool.lib;winmm.lib;shell32.lib;comctl32.lib;ole32.lib;oleaut32.lib;uuid.lib;rpcrt4.lib;advapi32.lib;wsock32.lib;wininet.lib;%(AdditionalDependencies) true ..\lib\$(wxOutDirName);%(AdditionalLibraryDirectories) true @@ -439,7 +439,7 @@ ..\lib\$(wxOutDirName)\$(wxIncSubDir);.\..\include;..\3rdparty\catch\include;.;.\..\samples;%(AdditionalIncludeDirectories) - wxmsw$(wxShortVersionString)u_webview.lib;wxmsw$(wxShortVersionString)u_richtext.lib;wxmsw$(wxShortVersionString)u_aui.lib;wxmsw$(wxShortVersionString)u_media.lib;wxmsw$(wxShortVersionString)u_xrc.lib;wxbase$(wxShortVersionString)u_xml.lib;wxmsw$(wxShortVersionString)u_html.lib;wxmsw$(wxShortVersionString)u_core.lib;wxbase$(wxShortVersionString)u_net.lib;wxbase$(wxShortVersionString)u.lib;wxtiff.lib;wxjpeg.lib;wxpng.lib;wxzlib.lib;wxregexu.lib;wxexpat.lib;kernel32.lib;user32.lib;gdi32.lib;comdlg32.lib;winspool.lib;winmm.lib;shell32.lib;comctl32.lib;ole32.lib;oleaut32.lib;uuid.lib;rpcrt4.lib;advapi32.lib;wsock32.lib;wininet.lib;%(AdditionalDependencies) + wxmsw$(wxShortVersionString)u_webview.lib;wxmsw$(wxShortVersionString)u_richtext.lib;wxmsw$(wxShortVersionString)u_stc.lib;wxmsw$(wxShortVersionString)u_aui.lib;wxmsw$(wxShortVersionString)u_media.lib;wxmsw$(wxShortVersionString)u_xrc.lib;wxbase$(wxShortVersionString)u_xml.lib;wxmsw$(wxShortVersionString)u_html.lib;wxmsw$(wxShortVersionString)u_core.lib;wxbase$(wxShortVersionString)u_net.lib;wxbase$(wxShortVersionString)u.lib;wxtiff.lib;wxjpeg.lib;wxpng.lib;wxzlib.lib;wxregexu.lib;wxexpat.lib;kernel32.lib;user32.lib;gdi32.lib;comdlg32.lib;winspool.lib;winmm.lib;shell32.lib;comctl32.lib;ole32.lib;oleaut32.lib;uuid.lib;rpcrt4.lib;advapi32.lib;wsock32.lib;wininet.lib;%(AdditionalDependencies) true ..\lib\$(wxOutDirName);%(AdditionalLibraryDirectories) true @@ -496,6 +496,7 @@ + diff --git a/tests/test_gui.vcxproj.filters b/tests/test_gui.vcxproj.filters index 38c0bd0806..e61c1bf4fd 100644 --- a/tests/test_gui.vcxproj.filters +++ b/tests/test_gui.vcxproj.filters @@ -239,6 +239,9 @@ Source Files + + Source Files + Source Files diff --git a/tests/test_vc7_test_gui.vcproj b/tests/test_vc7_test_gui.vcproj index 5854a3b1a2..83ccfa7655 100644 --- a/tests/test_vc7_test_gui.vcproj +++ b/tests/test_vc7_test_gui.vcproj @@ -49,7 +49,7 @@ + + diff --git a/tests/test_vc8_test_gui.vcproj b/tests/test_vc8_test_gui.vcproj index 6c61aa1c74..5dba30d921 100644 --- a/tests/test_vc8_test_gui.vcproj +++ b/tests/test_vc8_test_gui.vcproj @@ -86,7 +86,7 @@ + + diff --git a/tests/test_vc9_test_gui.vcproj b/tests/test_vc9_test_gui.vcproj index 85e5038f99..fe4f382385 100644 --- a/tests/test_vc9_test_gui.vcproj +++ b/tests/test_vc9_test_gui.vcproj @@ -85,7 +85,7 @@ + +