diff --git a/CMakeLists.txt b/CMakeLists.txt index c6fbad069d..fe40c84e02 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -146,12 +146,17 @@ if (APPLE) # features can be used, not the minimum required version to run. set(OSX_MIN_VERSION "10.5.4") set(TARGET_FLAGS "${TARGET_FLAGS} -mmacosx-version-min=${OSX_MIN_VERSION}") - set(TARGET_SYSROOT "/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.6.sdk") - if (NOT EXISTS "${TARGET_SYSROOT}/") - set(TARGET_SYSROOT "/Developer/SDKs/MacOSX10.6.sdk") + set(SYSROOT_LEGACY_PATH "/Developer/SDKs/MacOSX10.6.sdk") + set(SYSROOT_PATH "/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.6.sdk") + if (EXISTS "${SYSROOT_PATH}/") + set(TARGET_SYSROOT ${SYSROOT_PATH}) + elif (EXISTS "${SYSROOT_LEGACY_PATH}/") + set(TARGET_SYSROOT ${SYSROOT_LEGACY_PATH}) + endif() + if (${TARGET_SYSROOT}) + set(TARGET_FLAGS "${TARGET_FLAGS} -isysroot ${TARGET_SYSROOT}") + set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -Wl,-syslibroot,${TARGET_SYSROOT}") endif() - set(TARGET_FLAGS "${TARGET_FLAGS} -isysroot ${TARGET_SYSROOT}") - set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -Wl,-syslibroot,/Developer/SDKs/MacOSX10.6.sdk") # Do not warn about frameworks that are not available on all architectures. # This avoids a warning when linking with QuickTime. set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -Wl,-no_arch_warnings") @@ -472,10 +477,8 @@ endif() option(DISABLE_WX "Disable wxWidgets (use CLI interface)" OFF) if(NOT DISABLE_WX) - if(NOT ${CMAKE_SYSTEM_NAME} MATCHES "Darwin") - include(FindwxWidgets OPTIONAL) - FIND_PACKAGE(wxWidgets COMPONENTS core aui adv) - endif() + include(FindwxWidgets OPTIONAL) + FIND_PACKAGE(wxWidgets COMPONENTS core aui adv) if(wxWidgets_FOUND) EXECUTE_PROCESS( @@ -486,53 +489,61 @@ if(NOT DISABLE_WX) ERROR_QUIET ) message("Found wxWidgets version ${wxWidgets_VERSION}") - if(${wxWidgets_VERSION} VERSION_LESS "2.8.9") - message("At least 2.8.9 is required; ignoring found version") + if(${wxWidgets_VERSION} VERSION_LESS "2.9.4") + message("At least 2.9.4 is required; ignoring found version") unset(wxWidgets_FOUND) endif() endif(wxWidgets_FOUND) - - if(wxWidgets_FOUND) - include(${wxWidgets_USE_FILE}) - if(UNIX AND NOT APPLE) - # There is a bug in the FindGTK module in cmake version 2.8.2 that - # does not find gdk-pixbuf-2.0. On the other hand some 2.8.3 - # users have complained that pkg-config does not find - # gdk-pixbuf-2.0. On yet another hand, cmake version 2.8.3 in - # Ubuntu Natty does not find the glib libraries correctly. - # Ugly!!! - execute_process(COMMAND lsb_release -c -s - OUTPUT_VARIABLE DIST_NAME - ERROR_QUIET OUTPUT_STRIP_TRAILING_WHITESPACE) - if(${CMAKE_MAJOR_VERSION}.${CMAKE_MINOR_VERSION}.${CMAKE_PATCH_VERSION} - VERSION_EQUAL 2.8.2 OR "${DIST_NAME}" STREQUAL "natty") - check_lib(GTK2 gtk+-2.0 gtk.h REQUIRED) - else() - include(FindGTK2) - if(GTK2_FOUND) - include_directories(${GTK2_INCLUDE_DIRS}) - endif() + if(UNIX AND NOT APPLE) + # There is a bug in the FindGTK module in cmake version 2.8.2 that + # does not find gdk-pixbuf-2.0. On the other hand some 2.8.3 + # users have complained that pkg-config does not find + # gdk-pixbuf-2.0. On yet another hand, cmake version 2.8.3 in + # Ubuntu Natty does not find the glib libraries correctly. + # Ugly!!! + execute_process(COMMAND lsb_release -c -s + OUTPUT_VARIABLE DIST_NAME + ERROR_QUIET OUTPUT_STRIP_TRAILING_WHITESPACE) + if(${CMAKE_MAJOR_VERSION}.${CMAKE_MINOR_VERSION}.${CMAKE_PATCH_VERSION} + VERSION_EQUAL 2.8.2 OR "${DIST_NAME}" STREQUAL "natty") + check_lib(GTK2 gtk+-2.0 gtk.h REQUIRED) + else() + include(FindGTK2) + if(GTK2_FOUND) + include_directories(${GTK2_INCLUDE_DIRS}) endif() endif() + endif() + if(wxWidgets_FOUND) + include(${wxWidgets_USE_FILE}) message("wxWidgets found, enabling GUI build") else(wxWidgets_FOUND) - if(${CMAKE_SYSTEM_NAME} MATCHES "Linux") - message(FATAL_ERROR "wxWidgets not found. It is required to build the GUI") - endif() message("Using static wxWidgets from Externals") + + # These definitions and includes are used when building dolphin against wx, + # not when building wx itself (see wxw3 CMakeLists.txt for that) if(${CMAKE_SYSTEM_NAME} MATCHES "Darwin") add_definitions(-D__WXOSX_COCOA__) - include_directories(Externals/wxWidgets3) - include_directories(Externals/wxWidgets3/include) - add_subdirectory(Externals/wxWidgets3) - set(wxWidgets_LIBRARIES "wx") + elseif(${CMAKE_SYSTEM_NAME} MATCHES "Linux") + add_definitions(-D__WXGTK__) + + # Check for required libs + check_lib(GTHREAD2 gthread-2.0 glib/gthread.h REQUIRED) + check_lib(PANGOCAIRO pangocairo pango/pangocairo.h REQUIRED) + elseif(${CMAKE_SYSTEM_NAME} MATCHES "Windows") + add_definitions(-D__WXMSW__) else() - include_directories(Externals/wxWidgets/include) - add_subdirectory(Externals/wxWidgets) + message(FATAL_ERROR "wxWidgets in Externals is not compatible with your platform") endif() + + include_directories( + Externals/wxWidgets3 + Externals/wxWidgets3/include) + add_subdirectory(Externals/wxWidgets3) set(wxWidgets_FOUND TRUE) + set(wxWidgets_LIBRARIES "wx") endif(wxWidgets_FOUND) add_definitions(-DHAVE_WX=1) endif(NOT DISABLE_WX) diff --git a/Externals/Bochs_disasm/Bochs_disasm.vcxproj b/Externals/Bochs_disasm/Bochs_disasm.vcxproj index f7110f2e9a..50f62f70f6 100644 --- a/Externals/Bochs_disasm/Bochs_disasm.vcxproj +++ b/Externals/Bochs_disasm/Bochs_disasm.vcxproj @@ -152,7 +152,6 @@ - diff --git a/Externals/CLRun/clrun/CLRun.vcxproj b/Externals/CLRun/clrun/CLRun.vcxproj index 0b168991d0..c6a4cb2e6d 100644 --- a/Externals/CLRun/clrun/CLRun.vcxproj +++ b/Externals/CLRun/clrun/CLRun.vcxproj @@ -166,9 +166,7 @@ - - diff --git a/Externals/CLRun/clrun/CLRun.vcxproj.filters b/Externals/CLRun/clrun/CLRun.vcxproj.filters index 795200b898..3f252a668b 100644 --- a/Externals/CLRun/clrun/CLRun.vcxproj.filters +++ b/Externals/CLRun/clrun/CLRun.vcxproj.filters @@ -46,9 +46,7 @@ - - Resource Files diff --git a/Externals/LZO/LZO.vcxproj b/Externals/LZO/LZO.vcxproj index b29b9b2c84..76b75cdc4c 100644 --- a/Externals/LZO/LZO.vcxproj +++ b/Externals/LZO/LZO.vcxproj @@ -143,7 +143,6 @@ - diff --git a/Externals/LZO/LZO.vcxproj.filters b/Externals/LZO/LZO.vcxproj.filters index 50cd659802..889fdb14a0 100644 --- a/Externals/LZO/LZO.vcxproj.filters +++ b/Externals/LZO/LZO.vcxproj.filters @@ -26,6 +26,5 @@ - \ No newline at end of file diff --git a/Externals/SOIL/SOIL.vcxproj b/Externals/SOIL/SOIL.vcxproj index eba92bad49..33f75bbaf9 100644 --- a/Externals/SOIL/SOIL.vcxproj +++ b/Externals/SOIL/SOIL.vcxproj @@ -150,7 +150,6 @@ - diff --git a/Externals/libpng/png/png.vcxproj b/Externals/libpng/png/png.vcxproj new file mode 100644 index 0000000000..e272b07452 --- /dev/null +++ b/Externals/libpng/png/png.vcxproj @@ -0,0 +1,208 @@ + + + + + DebugFast + Win32 + + + DebugFast + x64 + + + Debug + Win32 + + + Debug + x64 + + + Release + Win32 + + + Release + x64 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + {01573C36-AC6E-49F6-94BA-572517EB9740} + Win32Proj + png + + + + StaticLibrary + true + Unicode + + + StaticLibrary + true + Unicode + + + StaticLibrary + false + Unicode + + + StaticLibrary + false + Unicode + + + StaticLibrary + false + Unicode + + + StaticLibrary + false + Unicode + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Disabled + ..\..\zlib;%(AdditionalIncludeDirectories) + + + Windows + true + + + + + Disabled + ..\..\zlib;%(AdditionalIncludeDirectories) + + + Windows + true + + + + + MaxSpeed + true + true + ..\..\zlib;%(AdditionalIncludeDirectories) + + + Windows + true + true + true + + + + + MaxSpeed + true + true + ..\..\zlib;%(AdditionalIncludeDirectories) + + + Windows + true + true + true + + + + + MaxSpeed + true + true + ..\..\zlib;%(AdditionalIncludeDirectories) + + + Windows + true + true + true + + + + + MaxSpeed + true + true + ..\..\zlib;%(AdditionalIncludeDirectories) + + + Windows + true + true + true + + + + + + \ No newline at end of file diff --git a/Externals/libpng/png/png.vcxproj.filters b/Externals/libpng/png/png.vcxproj.filters new file mode 100644 index 0000000000..5bccb29842 --- /dev/null +++ b/Externals/libpng/png/png.vcxproj.filters @@ -0,0 +1,32 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/Externals/portaudio/Win32/Debug/portaudio.lib b/Externals/portaudio/Win32/Debug/portaudio.lib new file mode 100644 index 0000000000..058b3c404c Binary files /dev/null and b/Externals/portaudio/Win32/Debug/portaudio.lib differ diff --git a/Externals/portaudio/Win32/Debug/portaudio.pdb b/Externals/portaudio/Win32/Debug/portaudio.pdb new file mode 100644 index 0000000000..c9269f2c5d Binary files /dev/null and b/Externals/portaudio/Win32/Debug/portaudio.pdb differ diff --git a/Externals/portaudio/Win32/DebugFast/portaudio.lib b/Externals/portaudio/Win32/DebugFast/portaudio.lib new file mode 100644 index 0000000000..30874d6f05 Binary files /dev/null and b/Externals/portaudio/Win32/DebugFast/portaudio.lib differ diff --git a/Externals/portaudio/Win32/DebugFast/portaudio.pdb b/Externals/portaudio/Win32/DebugFast/portaudio.pdb new file mode 100644 index 0000000000..12415be92d Binary files /dev/null and b/Externals/portaudio/Win32/DebugFast/portaudio.pdb differ diff --git a/Externals/portaudio/Win32/Release/portaudio.lib b/Externals/portaudio/Win32/Release/portaudio.lib new file mode 100644 index 0000000000..30874d6f05 Binary files /dev/null and b/Externals/portaudio/Win32/Release/portaudio.lib differ diff --git a/Externals/portaudio/Win32/Release/portaudio.pdb b/Externals/portaudio/Win32/Release/portaudio.pdb new file mode 100644 index 0000000000..12415be92d Binary files /dev/null and b/Externals/portaudio/Win32/Release/portaudio.pdb differ diff --git a/Externals/portaudio/Win32/portaudio.lib b/Externals/portaudio/Win32/portaudio.lib deleted file mode 100644 index 01213c5399..0000000000 Binary files a/Externals/portaudio/Win32/portaudio.lib and /dev/null differ diff --git a/Externals/portaudio/x64/Debug/portaudio.lib b/Externals/portaudio/x64/Debug/portaudio.lib new file mode 100644 index 0000000000..a092624370 Binary files /dev/null and b/Externals/portaudio/x64/Debug/portaudio.lib differ diff --git a/Externals/portaudio/x64/Debug/portaudio.pdb b/Externals/portaudio/x64/Debug/portaudio.pdb new file mode 100644 index 0000000000..fd5cd214b4 Binary files /dev/null and b/Externals/portaudio/x64/Debug/portaudio.pdb differ diff --git a/Externals/portaudio/x64/DebugFast/portaudio.lib b/Externals/portaudio/x64/DebugFast/portaudio.lib new file mode 100644 index 0000000000..3029595193 Binary files /dev/null and b/Externals/portaudio/x64/DebugFast/portaudio.lib differ diff --git a/Externals/portaudio/x64/DebugFast/portaudio.pdb b/Externals/portaudio/x64/DebugFast/portaudio.pdb new file mode 100644 index 0000000000..3642ec683a Binary files /dev/null and b/Externals/portaudio/x64/DebugFast/portaudio.pdb differ diff --git a/Externals/portaudio/x64/Release/portaudio.lib b/Externals/portaudio/x64/Release/portaudio.lib new file mode 100644 index 0000000000..3029595193 Binary files /dev/null and b/Externals/portaudio/x64/Release/portaudio.lib differ diff --git a/Externals/portaudio/x64/Release/portaudio.pdb b/Externals/portaudio/x64/Release/portaudio.pdb new file mode 100644 index 0000000000..3642ec683a Binary files /dev/null and b/Externals/portaudio/x64/Release/portaudio.pdb differ diff --git a/Externals/portaudio/x64/portaudio.lib b/Externals/portaudio/x64/portaudio.lib deleted file mode 100644 index 1793b91480..0000000000 Binary files a/Externals/portaudio/x64/portaudio.lib and /dev/null differ diff --git a/Externals/wxWidgets3/CMakeLists.txt b/Externals/wxWidgets3/CMakeLists.txt index 29d349f179..5b9891bb11 100644 --- a/Externals/wxWidgets3/CMakeLists.txt +++ b/Externals/wxWidgets3/CMakeLists.txt @@ -1,4 +1,4 @@ -# gtk, msw, osx and shared files as of r67291 +# gtk, msw, osx and shared files as of r70933 set(SRCS_AUI "src/aui/auibar.cpp" @@ -11,6 +11,7 @@ set(SRCS_AUI set(SRCS_COMMON "src/common/accelcmn.cpp" #"src/common/accesscmn.cpp" + "src/common/affinematrix2d.cpp" "src/common/anidecod.cpp" "src/common/animatecmn.cpp" "src/common/any.cpp" @@ -215,6 +216,7 @@ set(SRCS_COMMON "src/common/textcmn.cpp" "src/common/textentrycmn.cpp" "src/common/textfile.cpp" + "src/common/time.cpp" "src/common/timercmn.cpp" "src/common/timerimpl.cpp" "src/common/tokenzr.cpp" @@ -233,6 +235,7 @@ set(SRCS_COMMON "src/common/valnum.cpp" "src/common/valtext.cpp" "src/common/variant.cpp" + #"src/common/webview.cpp" "src/common/wfstream.cpp" "src/common/wincmn.cpp" "src/common/windowid.cpp" @@ -247,25 +250,9 @@ set(SRCS_COMMON "src/common/zipstrm.cpp" "src/common/zstream.cpp") -set(SRCS_EXPAT - #"src/expat/lib/xmlparse.c" - #"src/expat/lib/xmlrole.c" - #"src/expat/lib/xmltok.c" - #"src/expat/lib/xmltok_impl.c" - #"src/expat/lib/xmltok_ns.c" - #"src/expat/xmlwf/codepage.c" - #"src/expat/xmlwf/ct.c" - #"src/expat/xmlwf/readfilemap.c" - #"src/expat/xmlwf/unixfilemap.c" - #"src/expat/xmlwf/win32filemap.c" - #"src/expat/xmlwf/xmlfile.c" - #"src/expat/xmlwf/xmlmime.c" - #"src/expat/xmlwf/xmlwf.c" - #"src/expat/xmlwf/xmlwin32url.cxx" -) - set(SRCS_GENERIC "src/generic/aboutdlgg.cpp" + "src/generic/bannerwindow.cpp" "src/generic/bmpcboxg.cpp" "src/generic/busyinfo.cpp" "src/generic/buttonbar.cpp" @@ -310,7 +297,6 @@ set(SRCS_GENERIC "src/generic/notifmsgg.cpp" "src/generic/numdlgg.cpp" "src/generic/odcombo.cpp" - "src/generic/panelg.cpp" "src/generic/printps.cpp" "src/generic/prntdlgg.cpp" "src/generic/progdlgg.cpp" @@ -331,12 +317,14 @@ set(SRCS_GENERIC "src/generic/statusbr.cpp" "src/generic/tabg.cpp" "src/generic/textdlgg.cpp" + "src/generic/timectrlg.cpp" #"src/generic/timer.cpp" "src/generic/tipdlg.cpp" "src/generic/tipwin.cpp" "src/generic/toolbkg.cpp" "src/generic/treebkg.cpp" "src/generic/treectlg.cpp" + "src/generic/treelist.cpp" "src/generic/vlbox.cpp" "src/generic/vscroll.cpp" "src/generic/wizard.cpp") @@ -359,9 +347,10 @@ set(SRCS_GENERICOSX set(SRCS_GTK "src/gtk/aboutdlg.cpp" "src/gtk/animate.cpp" + "src/gtk/anybutton.cpp" "src/gtk/app.cpp" "src/gtk/artgtk.cpp" - "src/gtk/assertdlg_gtk.c" + "src/gtk/assertdlg_gtk.cpp" "src/gtk/bitmap.cpp" "src/gtk/bmpbuttn.cpp" "src/gtk/bmpcbox.cpp" @@ -412,6 +401,7 @@ set(SRCS_GTK "src/gtk/mnemonics.cpp" "src/gtk/msgdlg.cpp" "src/gtk/nativewin.cpp" + "src/gtk/nonownedwnd.cpp" "src/gtk/notebook.cpp" "src/gtk/pen.cpp" "src/gtk/popupwin.cpp" @@ -442,90 +432,14 @@ set(SRCS_GTK "src/gtk/toplevel.cpp" "src/gtk/treeentry_gtk.c" "src/gtk/utilsgtk.cpp" + #"src/gtk/webview_webkit.cpp" "src/gtk/win_gtk.cpp" "src/gtk/window.cpp") -set(SRCS_HTML - "src/html/chm.cpp" - "src/html/helpctrl.cpp" - "src/html/helpdata.cpp" - "src/html/helpdlg.cpp" - "src/html/helpfrm.cpp" - "src/html/helpwnd.cpp" - "src/html/htmlcell.cpp" - #"src/html/htmlctrl/webkit/webkit.mm" - "src/html/htmlfilt.cpp" - "src/html/htmlpars.cpp" - "src/html/htmltag.cpp" - "src/html/htmlwin.cpp" - "src/html/htmprint.cpp" - "src/html/m_dflist.cpp" - "src/html/m_fonts.cpp" - "src/html/m_hline.cpp" - "src/html/m_image.cpp" - "src/html/m_layout.cpp" - "src/html/m_links.cpp" - "src/html/m_list.cpp" - "src/html/m_pre.cpp" - "src/html/m_span.cpp" - "src/html/m_style.cpp" - "src/html/m_tables.cpp" - "src/html/styleparams.cpp" - "src/html/winpars.cpp") - -set(SRCS_JPEG - "src/jpeg/jcapimin.c" - "src/jpeg/jcapistd.c" - "src/jpeg/jccoefct.c" - "src/jpeg/jccolor.c" - "src/jpeg/jcdctmgr.c" - "src/jpeg/jchuff.c" - "src/jpeg/jcinit.c" - "src/jpeg/jcmainct.c" - "src/jpeg/jcmarker.c" - "src/jpeg/jcmaster.c" - "src/jpeg/jcomapi.c" - "src/jpeg/jcparam.c" - "src/jpeg/jcphuff.c" - "src/jpeg/jcprepct.c" - "src/jpeg/jcsample.c" - "src/jpeg/jctrans.c" - "src/jpeg/jdapimin.c" - "src/jpeg/jdapistd.c" - "src/jpeg/jdatadst.c" - "src/jpeg/jdatasrc.c" - "src/jpeg/jdcoefct.c" - "src/jpeg/jdcolor.c" - "src/jpeg/jddctmgr.c" - "src/jpeg/jdhuff.c" - "src/jpeg/jdinput.c" - "src/jpeg/jdmainct.c" - "src/jpeg/jdmarker.c" - "src/jpeg/jdmaster.c" - "src/jpeg/jdmerge.c" - "src/jpeg/jdphuff.c" - "src/jpeg/jdpostct.c" - "src/jpeg/jdsample.c" - "src/jpeg/jdtrans.c" - "src/jpeg/jerror.c" - "src/jpeg/jfdctflt.c" - "src/jpeg/jfdctfst.c" - "src/jpeg/jfdctint.c" - "src/jpeg/jidctflt.c" - "src/jpeg/jidctfst.c" - "src/jpeg/jidctint.c" - "src/jpeg/jidctred.c" - "src/jpeg/jmemansi.c" - "src/jpeg/jmemmgr.c" - "src/jpeg/jmemname.c" - "src/jpeg/jmemnobs.c" - "src/jpeg/jquant1.c" - "src/jpeg/jquant2.c" - "src/jpeg/jutils.c") - set(SRCS_MSW "src/msw/aboutdlg.cpp" "src/msw/accel.cpp" + "src/msw/anybutton.cpp" "src/msw/app.cpp" "src/msw/artmsw.cpp" "src/msw/basemsw.cpp" @@ -551,6 +465,7 @@ set(SRCS_MSW "src/msw/data.cpp" "src/msw/datecontrols.cpp" "src/msw/datectrl.cpp" + "src/msw/datetimectrl.cpp" "src/msw/dc.cpp" "src/msw/dcclient.cpp" "src/msw/dcmemory.cpp" @@ -608,6 +523,7 @@ set(SRCS_MSW "src/msw/mslu.cpp" "src/msw/nativdlg.cpp" "src/msw/nativewin.cpp" + "src/msw/nonownedwnd.cpp" "src/msw/notebook.cpp" "src/msw/notifmsg.cpp" "src/msw/ole/access.cpp" @@ -655,6 +571,7 @@ set(SRCS_MSW "src/msw/textentry.cpp" "src/msw/tglbtn.cpp" "src/msw/thread.cpp" + "src/msw/timectrl.cpp" "src/msw/timer.cpp" "src/msw/toolbar.cpp" "src/msw/tooltip.cpp" @@ -668,6 +585,7 @@ set(SRCS_MSW "src/msw/uxtheme.cpp" "src/msw/version.rc" "src/msw/volume.cpp" + #"src/msw/webview_ie.cpp" "src/msw/wince/checklst.cpp" "src/msw/wince/choicece.cpp" "src/msw/wince/crt.cpp" @@ -684,6 +602,7 @@ set(SRCS_MSW set(SRCS_OSX "src/osx/accel.cpp" + "src/osx/anybutton_osx.cpp" "src/osx/artmac.cpp" "src/osx/bmpbuttn_osx.cpp" "src/osx/brush.cpp" @@ -693,6 +612,8 @@ set(SRCS_OSX "src/osx/choice_osx.cpp" "src/osx/combobox_osx.cpp" "src/osx/dataview_osx.cpp" + "src/osx/datectrl_osx.cpp" + "src/osx/datetimectrl_osx.cpp" "src/osx/dialog_osx.cpp" "src/osx/dnd_osx.cpp" "src/osx/fontutil.cpp" @@ -722,12 +643,15 @@ set(SRCS_OSX "src/osx/textctrl_osx.cpp" "src/osx/textentry_osx.cpp" "src/osx/tglbtn_osx.cpp" + "src/osx/timectrl_osx.cpp" "src/osx/toolbar_osx.cpp" "src/osx/toplevel_osx.cpp" "src/osx/uiaction_osx.cpp" "src/osx/utils_osx.cpp" + #"src/osx/webview_webkit.mm" "src/osx/window_osx.cpp" #"src/osx/carbon/aboutdlg.cpp" + "src/osx/carbon/anybutton.cpp" "src/osx/carbon/app.cpp" #"src/osx/carbon/bmpbuttn.cpp" #"src/osx/carbon/button.cpp" @@ -805,12 +729,14 @@ set(SRCS_OSX "src/osx/carbon/utilscocoa.mm" #"src/osx/carbon/window.cpp" "src/osx/cocoa/aboutdlg.mm" + "src/osx/cocoa/anybutton.mm" "src/osx/cocoa/button.mm" "src/osx/cocoa/checkbox.mm" "src/osx/cocoa/choice.mm" "src/osx/cocoa/colour.mm" "src/osx/cocoa/combobox.mm" "src/osx/cocoa/dataview.mm" + "src/osx/cocoa/datetimectrl.mm" "src/osx/cocoa/dialog.mm" "src/osx/cocoa/dirdlg.mm" "src/osx/cocoa/dnd.mm" @@ -878,221 +804,6 @@ set(SRCS_OSX #"src/osx/iphone/window.mm" ) -set(SRCS_PNG - "src/png/png.c" - "src/png/pngerror.c" - "src/png/pngget.c" - "src/png/pngmem.c" - "src/png/pngpread.c" - "src/png/pngread.c" - "src/png/pngrio.c" - "src/png/pngrtran.c" - "src/png/pngrutil.c" - "src/png/pngset.c" - "src/png/pngtrans.c" - "src/png/pngwio.c" - "src/png/pngwrite.c" - "src/png/pngwtran.c" - "src/png/pngwutil.c") - -set(SRCS_PROPGRID - "src/propgrid/advprops.cpp" - "src/propgrid/editors.cpp" - "src/propgrid/manager.cpp" - "src/propgrid/property.cpp" - "src/propgrid/propgrid.cpp" - "src/propgrid/propgridiface.cpp" - "src/propgrid/propgridpagestate.cpp" - "src/propgrid/props.cpp") - -set(SRCS_REGEX - "src/regex/regcomp.c" - "src/regex/regerror.c" - "src/regex/regexec.c" - "src/regex/regfree.c") - -set(SRCS_RIBBON - "src/ribbon/art_aui.cpp" - "src/ribbon/art_internal.cpp" - "src/ribbon/art_msw.cpp" - "src/ribbon/bar.cpp" - "src/ribbon/buttonbar.cpp" - "src/ribbon/control.cpp" - "src/ribbon/gallery.cpp" - "src/ribbon/page.cpp" - "src/ribbon/panel.cpp" - "src/ribbon/toolbar.cpp") - -set(SRCS_RICHTEXT - #"src/richtext/richtextbackgroundpage.cpp" - #"src/richtext/richtextborderspage.cpp" - "src/richtext/richtextbuffer.cpp" - #"src/richtext/richtextbulletspage.cpp" - "src/richtext/richtextctrl.cpp" - #"src/richtext/richtextfontpage.cpp" - "src/richtext/richtextformatdlg.cpp" - "src/richtext/richtexthtml.cpp" - "src/richtext/richtextimagedlg.cpp" - #"src/richtext/richtextindentspage.cpp" - #"src/richtext/richtextliststylepage.cpp" - #"src/richtext/richtextmarginspage.cpp" - "src/richtext/richtextprint.cpp" - #"src/richtext/richtextsizepage.cpp" - "src/richtext/richtextstyledlg.cpp" - #"src/richtext/richtextstylepage.cpp" - "src/richtext/richtextstyles.cpp" - "src/richtext/richtextsymboldlg.cpp" - #"src/richtext/richtexttabspage.cpp" - "src/richtext/richtextxml.cpp") - -set(SRCS_STC - "src/stc/PlatWX.cpp" - "src/stc/ScintillaWX.cpp" - "src/stc/scintilla/src/AutoComplete.cxx" - "src/stc/scintilla/src/CallTip.cxx" - "src/stc/scintilla/src/CellBuffer.cxx" - "src/stc/scintilla/src/CharClassify.cxx" - "src/stc/scintilla/src/ContractionState.cxx" - "src/stc/scintilla/src/Decoration.cxx" - "src/stc/scintilla/src/Document.cxx" - "src/stc/scintilla/src/DocumentAccessor.cxx" - "src/stc/scintilla/src/Editor.cxx" - "src/stc/scintilla/src/ExternalLexer.cxx" - "src/stc/scintilla/src/Indicator.cxx" - "src/stc/scintilla/src/KeyMap.cxx" - "src/stc/scintilla/src/KeyWords.cxx" - "src/stc/scintilla/src/LexAPDL.cxx" - "src/stc/scintilla/src/LexASY.cxx" - "src/stc/scintilla/src/LexAU3.cxx" - "src/stc/scintilla/src/LexAVE.cxx" - "src/stc/scintilla/src/LexAbaqus.cxx" - "src/stc/scintilla/src/LexAda.cxx" - "src/stc/scintilla/src/LexAsm.cxx" - "src/stc/scintilla/src/LexAsn1.cxx" - "src/stc/scintilla/src/LexBaan.cxx" - "src/stc/scintilla/src/LexBash.cxx" - "src/stc/scintilla/src/LexBasic.cxx" - "src/stc/scintilla/src/LexBullant.cxx" - "src/stc/scintilla/src/LexCLW.cxx" - "src/stc/scintilla/src/LexCOBOL.cxx" - "src/stc/scintilla/src/LexCPP.cxx" - "src/stc/scintilla/src/LexCSS.cxx" - "src/stc/scintilla/src/LexCaml.cxx" - "src/stc/scintilla/src/LexCmake.cxx" - "src/stc/scintilla/src/LexConf.cxx" - "src/stc/scintilla/src/LexCrontab.cxx" - "src/stc/scintilla/src/LexCsound.cxx" - "src/stc/scintilla/src/LexD.cxx" - "src/stc/scintilla/src/LexEScript.cxx" - "src/stc/scintilla/src/LexEiffel.cxx" - "src/stc/scintilla/src/LexErlang.cxx" - "src/stc/scintilla/src/LexFlagship.cxx" - "src/stc/scintilla/src/LexForth.cxx" - "src/stc/scintilla/src/LexFortran.cxx" - "src/stc/scintilla/src/LexGAP.cxx" - "src/stc/scintilla/src/LexGui4Cli.cxx" - "src/stc/scintilla/src/LexHTML.cxx" - "src/stc/scintilla/src/LexHaskell.cxx" - "src/stc/scintilla/src/LexInno.cxx" - "src/stc/scintilla/src/LexKix.cxx" - "src/stc/scintilla/src/LexLisp.cxx" - "src/stc/scintilla/src/LexLout.cxx" - "src/stc/scintilla/src/LexLua.cxx" - "src/stc/scintilla/src/LexMMIXAL.cxx" - "src/stc/scintilla/src/LexMPT.cxx" - "src/stc/scintilla/src/LexMSSQL.cxx" - "src/stc/scintilla/src/LexMagik.cxx" - "src/stc/scintilla/src/LexMarkdown.cxx" - "src/stc/scintilla/src/LexMatlab.cxx" - "src/stc/scintilla/src/LexMetapost.cxx" - "src/stc/scintilla/src/LexMySQL.cxx" - "src/stc/scintilla/src/LexNimrod.cxx" - "src/stc/scintilla/src/LexNsis.cxx" - "src/stc/scintilla/src/LexOpal.cxx" - "src/stc/scintilla/src/LexOthers.cxx" - "src/stc/scintilla/src/LexPB.cxx" - "src/stc/scintilla/src/LexPLM.cxx" - "src/stc/scintilla/src/LexPOV.cxx" - "src/stc/scintilla/src/LexPS.cxx" - "src/stc/scintilla/src/LexPascal.cxx" - "src/stc/scintilla/src/LexPerl.cxx" - "src/stc/scintilla/src/LexPowerPro.cxx" - "src/stc/scintilla/src/LexPowerShell.cxx" - "src/stc/scintilla/src/LexProgress.cxx" - "src/stc/scintilla/src/LexPython.cxx" - "src/stc/scintilla/src/LexR.cxx" - "src/stc/scintilla/src/LexRebol.cxx" - "src/stc/scintilla/src/LexRuby.cxx" - "src/stc/scintilla/src/LexSML.cxx" - "src/stc/scintilla/src/LexSQL.cxx" - "src/stc/scintilla/src/LexScriptol.cxx" - "src/stc/scintilla/src/LexSmalltalk.cxx" - "src/stc/scintilla/src/LexSorcus.cxx" - "src/stc/scintilla/src/LexSpecman.cxx" - "src/stc/scintilla/src/LexSpice.cxx" - "src/stc/scintilla/src/LexTACL.cxx" - "src/stc/scintilla/src/LexTADS3.cxx" - "src/stc/scintilla/src/LexTAL.cxx" - "src/stc/scintilla/src/LexTCL.cxx" - "src/stc/scintilla/src/LexTeX.cxx" - "src/stc/scintilla/src/LexVB.cxx" - "src/stc/scintilla/src/LexVHDL.cxx" - "src/stc/scintilla/src/LexVerilog.cxx" - "src/stc/scintilla/src/LexYAML.cxx" - "src/stc/scintilla/src/LineMarker.cxx" - "src/stc/scintilla/src/PerLine.cxx" - "src/stc/scintilla/src/PositionCache.cxx" - "src/stc/scintilla/src/PropSet.cxx" - "src/stc/scintilla/src/RESearch.cxx" - "src/stc/scintilla/src/RunStyles.cxx" - "src/stc/scintilla/src/ScintillaBase.cxx" - "src/stc/scintilla/src/Selection.cxx" - "src/stc/scintilla/src/Style.cxx" - "src/stc/scintilla/src/StyleContext.cxx" - "src/stc/scintilla/src/UniConversion.cxx" - "src/stc/scintilla/src/ViewStyle.cxx" - "src/stc/scintilla/src/WindowAccessor.cxx" - "src/stc/scintilla/src/XPM.cxx" - "src/stc/stc.cpp") - -set(SRCS_TIFF - "src/tiff/libtiff/tif_aux.c" - "src/tiff/libtiff/tif_close.c" - "src/tiff/libtiff/tif_codec.c" - "src/tiff/libtiff/tif_color.c" - "src/tiff/libtiff/tif_compress.c" - "src/tiff/libtiff/tif_dir.c" - "src/tiff/libtiff/tif_dirinfo.c" - "src/tiff/libtiff/tif_dirread.c" - "src/tiff/libtiff/tif_dirwrite.c" - "src/tiff/libtiff/tif_dumpmode.c" - "src/tiff/libtiff/tif_error.c" - "src/tiff/libtiff/tif_extension.c" - "src/tiff/libtiff/tif_fax3.c" - "src/tiff/libtiff/tif_fax3sm.c" - "src/tiff/libtiff/tif_flush.c" - "src/tiff/libtiff/tif_getimage.c" - "src/tiff/libtiff/tif_jpeg.c" - "src/tiff/libtiff/tif_luv.c" - "src/tiff/libtiff/tif_lzw.c" - "src/tiff/libtiff/tif_next.c" - "src/tiff/libtiff/tif_ojpeg.c" - "src/tiff/libtiff/tif_open.c" - "src/tiff/libtiff/tif_packbits.c" - "src/tiff/libtiff/tif_pixarlog.c" - "src/tiff/libtiff/tif_predict.c" - "src/tiff/libtiff/tif_print.c" - "src/tiff/libtiff/tif_read.c" - "src/tiff/libtiff/tif_strip.c" - "src/tiff/libtiff/tif_swab.c" - "src/tiff/libtiff/tif_thunder.c" - "src/tiff/libtiff/tif_tile.c" - "src/tiff/libtiff/tif_unix.c" - "src/tiff/libtiff/tif_version.c" - "src/tiff/libtiff/tif_warning.c" - "src/tiff/libtiff/tif_write.c" - "src/tiff/libtiff/tif_zip.c") - set(SRCS_UNIX "src/unix/apptraits.cpp" "src/unix/appunix.cpp" @@ -1127,87 +838,6 @@ set(SRCS_UNIXGTK "src/unix/uiactionx11.cpp" "src/unix/utilsx11.cpp") -set(SRCS_XRC - "src/xml/xml.cpp" - "src/xrc/xh_animatctrl.cpp" - "src/xrc/xh_bmp.cpp" - "src/xrc/xh_bmpbt.cpp" - "src/xrc/xh_bmpcbox.cpp" - "src/xrc/xh_bttn.cpp" - "src/xrc/xh_cald.cpp" - "src/xrc/xh_chckb.cpp" - "src/xrc/xh_chckl.cpp" - "src/xrc/xh_choic.cpp" - "src/xrc/xh_choicbk.cpp" - "src/xrc/xh_clrpicker.cpp" - "src/xrc/xh_cmdlinkbn.cpp" - "src/xrc/xh_collpane.cpp" - "src/xrc/xh_combo.cpp" - "src/xrc/xh_comboctrl.cpp" - "src/xrc/xh_datectrl.cpp" - "src/xrc/xh_dirpicker.cpp" - "src/xrc/xh_dlg.cpp" - "src/xrc/xh_editlbox.cpp" - "src/xrc/xh_filectrl.cpp" - "src/xrc/xh_filepicker.cpp" - "src/xrc/xh_fontpicker.cpp" - "src/xrc/xh_frame.cpp" - "src/xrc/xh_gauge.cpp" - "src/xrc/xh_gdctl.cpp" - "src/xrc/xh_grid.cpp" - "src/xrc/xh_html.cpp" - "src/xrc/xh_htmllbox.cpp" - "src/xrc/xh_hyperlink.cpp" - "src/xrc/xh_listb.cpp" - "src/xrc/xh_listbk.cpp" - "src/xrc/xh_listc.cpp" - "src/xrc/xh_mdi.cpp" - "src/xrc/xh_menu.cpp" - "src/xrc/xh_notbk.cpp" - "src/xrc/xh_odcombo.cpp" - "src/xrc/xh_panel.cpp" - "src/xrc/xh_propdlg.cpp" - "src/xrc/xh_radbt.cpp" - "src/xrc/xh_radbx.cpp" - "src/xrc/xh_richtext.cpp" - "src/xrc/xh_scrol.cpp" - "src/xrc/xh_scwin.cpp" - "src/xrc/xh_sizer.cpp" - "src/xrc/xh_slidr.cpp" - "src/xrc/xh_spin.cpp" - "src/xrc/xh_split.cpp" - "src/xrc/xh_srchctrl.cpp" - "src/xrc/xh_statbar.cpp" - "src/xrc/xh_stbmp.cpp" - "src/xrc/xh_stbox.cpp" - "src/xrc/xh_stlin.cpp" - "src/xrc/xh_sttxt.cpp" - "src/xrc/xh_text.cpp" - "src/xrc/xh_tglbtn.cpp" - "src/xrc/xh_toolb.cpp" - "src/xrc/xh_toolbk.cpp" - "src/xrc/xh_tree.cpp" - "src/xrc/xh_treebk.cpp" - "src/xrc/xh_unkwn.cpp" - "src/xrc/xh_wizrd.cpp" - "src/xrc/xmladv.cpp" - "src/xrc/xmlres.cpp" - "src/xrc/xmlrsall.cpp") - -set(SRCS_ZLIB - "src/zlib/adler32.c" - "src/zlib/compress.c" - "src/zlib/crc32.c" - "src/zlib/deflate.c" - "src/zlib/gzio.c" - "src/zlib/infback.c" - "src/zlib/inffast.c" - "src/zlib/inflate.c" - "src/zlib/inftrees.c" - "src/zlib/trees.c" - "src/zlib/uncompr.c" - "src/zlib/zutil.c") - include_directories(.) include_directories(include) @@ -1217,44 +847,50 @@ set(SRCS ${SRCS_GENERIC}) if(${CMAKE_SYSTEM_NAME} MATCHES "Darwin") + add_definitions(-D__WXOSX_COCOA__) set(SRCS ${SRCS} ${SRCS_GENERICOSX} ${SRCS_OSX} ${SRCS_UNIX}) + include_directories(../libpng) + add_subdirectory(../libpng ../libpng) + set(LIBS + png + iconv + ${APPKIT_LIBRARY} + ${APPSERV_LIBRARY} + ${ATB_LIBRARY} + ${CARBON_LIBRARY} + ${COCOA_LIBRARY} + ${COREFUND_LIBRARY} + ${CORESERV_LIBRARY} + ${IOK_LIBRARY} + ${QUICKTIME_LIBRARY}) elseif(${CMAKE_SYSTEM_NAME} MATCHES "Linux") + add_definitions(-D__WXGTK__) set(SRCS ${SRCS} ${SRCS_GENERICGTK} ${SRCS_GTK} ${SRCS_UNIX} ${SRCS_UNIXGTK}) + set(LIBS + png + ${GTHREAD2_LIBRARIES} + ${PANGOCAIRO_LIBRARIES} + ${GTK2_LIBRARIES}) else() + add_definitions(-D__WXMSW__) set(SRCS ${SRCS} ${SRCS_MSW}) endif() -add_definitions(-D__WXOSX_COCOA__) add_definitions(-DWXBUILDING) add_definitions(-Wno-deprecated-declarations) add_definitions(-Wno-shadow) -set(LIBS - iconv - ${APPKIT_LIBRARY} - ${APPSERV_LIBRARY} - ${ATB_LIBRARY} - ${CARBON_LIBRARY} - ${COCOA_LIBRARY} - ${COREFUND_LIBRARY} - ${CORESERV_LIBRARY} - ${IOK_LIBRARY} - ${QUICKTIME_LIBRARY} - ) -include_directories(../libpng) -add_subdirectory(../libpng ../libpng) -list(APPEND LIBS png) - -add_library(wx STATIC ${SRCS}) +enable_precompiled_headers(include/wx/wxprec.h src/common/dummy.cpp SRCS) +add_library(wx STATIC ${PNG_SRCS} ${SRCS}) target_link_libraries(wx ${LIBS}) diff --git a/Externals/wxWidgets3/SConscript b/Externals/wxWidgets3/SConscript index 4385282e66..c894dcb2a0 100644 --- a/Externals/wxWidgets3/SConscript +++ b/Externals/wxWidgets3/SConscript @@ -13,7 +13,7 @@ wxenv = env.Clone() wxenv['CCFLAGS'] += ['-Wno-deprecated-declarations', '-Wno-shadow'] wxenv['CPPDEFINES'] += ['WXBUILDING'] -# gtk, msw, osx and shared files as of r67291 +# gtk, msw, osx and shared files as of r70933 aui = [ 'src/aui/auibar.cpp', @@ -27,6 +27,7 @@ aui = [ common = [ 'src/common/accelcmn.cpp', #'src/common/accesscmn.cpp', + 'src/common/affinematrix2d.cpp', 'src/common/anidecod.cpp', 'src/common/animatecmn.cpp', 'src/common/any.cpp', @@ -231,6 +232,7 @@ common = [ 'src/common/textcmn.cpp', 'src/common/textentrycmn.cpp', 'src/common/textfile.cpp', + 'src/common/time.cpp', 'src/common/timercmn.cpp', 'src/common/timerimpl.cpp', 'src/common/tokenzr.cpp', @@ -249,6 +251,7 @@ common = [ 'src/common/valnum.cpp', 'src/common/valtext.cpp', 'src/common/variant.cpp', + #'src/common/webview.cpp', 'src/common/wfstream.cpp', 'src/common/wincmn.cpp', 'src/common/windowid.cpp', @@ -264,25 +267,9 @@ common = [ 'src/common/zstream.cpp', ] -expat = [ - #'src/expat/lib/xmlparse.c', - #'src/expat/lib/xmlrole.c', - #'src/expat/lib/xmltok.c', - #'src/expat/lib/xmltok_impl.c', - #'src/expat/lib/xmltok_ns.c', - #'src/expat/xmlwf/codepage.c', - #'src/expat/xmlwf/ct.c', - #'src/expat/xmlwf/readfilemap.c', - #'src/expat/xmlwf/unixfilemap.c', - #'src/expat/xmlwf/win32filemap.c', - #'src/expat/xmlwf/xmlfile.c', - #'src/expat/xmlwf/xmlmime.c', - #'src/expat/xmlwf/xmlwf.c', - #'src/expat/xmlwf/xmlwin32url.cxx', - ] - generic = [ 'src/generic/aboutdlgg.cpp', + 'src/generic/bannerwindow.cpp', 'src/generic/bmpcboxg.cpp', 'src/generic/busyinfo.cpp', 'src/generic/buttonbar.cpp', @@ -327,7 +314,6 @@ generic = [ 'src/generic/notifmsgg.cpp', 'src/generic/numdlgg.cpp', 'src/generic/odcombo.cpp', - 'src/generic/panelg.cpp', 'src/generic/printps.cpp', 'src/generic/prntdlgg.cpp', 'src/generic/progdlgg.cpp', @@ -348,12 +334,14 @@ generic = [ 'src/generic/statusbr.cpp', 'src/generic/tabg.cpp', 'src/generic/textdlgg.cpp', + 'src/generic/timectrlg.cpp', #'src/generic/timer.cpp', 'src/generic/tipdlg.cpp', 'src/generic/tipwin.cpp', 'src/generic/toolbkg.cpp', 'src/generic/treebkg.cpp', 'src/generic/treectlg.cpp', + 'src/generic/treelist.cpp', 'src/generic/vlbox.cpp', 'src/generic/vscroll.cpp', 'src/generic/wizard.cpp', @@ -379,9 +367,10 @@ genericosx = [ gtk = [ 'src/gtk/aboutdlg.cpp', 'src/gtk/animate.cpp', + 'src/gtk/anybutton.cpp', 'src/gtk/app.cpp', 'src/gtk/artgtk.cpp', - 'src/gtk/assertdlg_gtk.c', + 'src/gtk/assertdlg_gtk.cpp', 'src/gtk/bitmap.cpp', 'src/gtk/bmpbuttn.cpp', 'src/gtk/bmpcbox.cpp', @@ -432,6 +421,7 @@ gtk = [ 'src/gtk/mnemonics.cpp', 'src/gtk/msgdlg.cpp', 'src/gtk/nativewin.cpp', + 'src/gtk/nonownedwnd.cpp', 'src/gtk/notebook.cpp', 'src/gtk/pen.cpp', 'src/gtk/popupwin.cpp', @@ -462,93 +452,15 @@ gtk = [ 'src/gtk/toplevel.cpp', 'src/gtk/treeentry_gtk.c', 'src/gtk/utilsgtk.cpp', + #'src/gtk/webview_webkit.cpp', 'src/gtk/win_gtk.cpp', 'src/gtk/window.cpp', ] -html = [ - 'src/html/chm.cpp', - 'src/html/helpctrl.cpp', - 'src/html/helpdata.cpp', - 'src/html/helpdlg.cpp', - 'src/html/helpfrm.cpp', - 'src/html/helpwnd.cpp', - 'src/html/htmlcell.cpp', - #'src/html/htmlctrl/webkit/webkit.mm', - 'src/html/htmlfilt.cpp', - 'src/html/htmlpars.cpp', - 'src/html/htmltag.cpp', - 'src/html/htmlwin.cpp', - 'src/html/htmprint.cpp', - 'src/html/m_dflist.cpp', - 'src/html/m_fonts.cpp', - 'src/html/m_hline.cpp', - 'src/html/m_image.cpp', - 'src/html/m_layout.cpp', - 'src/html/m_links.cpp', - 'src/html/m_list.cpp', - 'src/html/m_pre.cpp', - 'src/html/m_span.cpp', - 'src/html/m_style.cpp', - 'src/html/m_tables.cpp', - 'src/html/styleparams.cpp', - 'src/html/winpars.cpp', - ] - -jpeg = [ - 'src/jpeg/jcapimin.c', - 'src/jpeg/jcapistd.c', - 'src/jpeg/jccoefct.c', - 'src/jpeg/jccolor.c', - 'src/jpeg/jcdctmgr.c', - 'src/jpeg/jchuff.c', - 'src/jpeg/jcinit.c', - 'src/jpeg/jcmainct.c', - 'src/jpeg/jcmarker.c', - 'src/jpeg/jcmaster.c', - 'src/jpeg/jcomapi.c', - 'src/jpeg/jcparam.c', - 'src/jpeg/jcphuff.c', - 'src/jpeg/jcprepct.c', - 'src/jpeg/jcsample.c', - 'src/jpeg/jctrans.c', - 'src/jpeg/jdapimin.c', - 'src/jpeg/jdapistd.c', - 'src/jpeg/jdatadst.c', - 'src/jpeg/jdatasrc.c', - 'src/jpeg/jdcoefct.c', - 'src/jpeg/jdcolor.c', - 'src/jpeg/jddctmgr.c', - 'src/jpeg/jdhuff.c', - 'src/jpeg/jdinput.c', - 'src/jpeg/jdmainct.c', - 'src/jpeg/jdmarker.c', - 'src/jpeg/jdmaster.c', - 'src/jpeg/jdmerge.c', - 'src/jpeg/jdphuff.c', - 'src/jpeg/jdpostct.c', - 'src/jpeg/jdsample.c', - 'src/jpeg/jdtrans.c', - 'src/jpeg/jerror.c', - 'src/jpeg/jfdctflt.c', - 'src/jpeg/jfdctfst.c', - 'src/jpeg/jfdctint.c', - 'src/jpeg/jidctflt.c', - 'src/jpeg/jidctfst.c', - 'src/jpeg/jidctint.c', - 'src/jpeg/jidctred.c', - 'src/jpeg/jmemansi.c', - 'src/jpeg/jmemmgr.c', - 'src/jpeg/jmemname.c', - 'src/jpeg/jmemnobs.c', - 'src/jpeg/jquant1.c', - 'src/jpeg/jquant2.c', - 'src/jpeg/jutils.c', - ] - msw = [ 'src/msw/aboutdlg.cpp', 'src/msw/accel.cpp', + 'src/msw/anybutton.cpp', 'src/msw/app.cpp', 'src/msw/artmsw.cpp', 'src/msw/basemsw.cpp', @@ -574,6 +486,7 @@ msw = [ 'src/msw/data.cpp', 'src/msw/datecontrols.cpp', 'src/msw/datectrl.cpp', + 'src/msw/datetimectrl.cpp', 'src/msw/dc.cpp', 'src/msw/dcclient.cpp', 'src/msw/dcmemory.cpp', @@ -631,6 +544,7 @@ msw = [ 'src/msw/mslu.cpp', 'src/msw/nativdlg.cpp', 'src/msw/nativewin.cpp', + 'src/msw/nonownedwnd.cpp', 'src/msw/notebook.cpp', 'src/msw/notifmsg.cpp', 'src/msw/ole/access.cpp', @@ -678,6 +592,7 @@ msw = [ 'src/msw/textentry.cpp', 'src/msw/tglbtn.cpp', 'src/msw/thread.cpp', + 'src/msw/timectrl.cpp', 'src/msw/timer.cpp', 'src/msw/toolbar.cpp', 'src/msw/tooltip.cpp', @@ -691,6 +606,7 @@ msw = [ 'src/msw/uxtheme.cpp', 'src/msw/version.rc', 'src/msw/volume.cpp', + #'src/msw/webview_ie.cpp', 'src/msw/wince/checklst.cpp', 'src/msw/wince/choicece.cpp', 'src/msw/wince/crt.cpp', @@ -708,6 +624,7 @@ msw = [ osx = [ 'src/osx/accel.cpp', + 'src/osx/anybutton_osx.cpp', 'src/osx/artmac.cpp', 'src/osx/bmpbuttn_osx.cpp', 'src/osx/brush.cpp', @@ -717,6 +634,8 @@ osx = [ 'src/osx/choice_osx.cpp', 'src/osx/combobox_osx.cpp', 'src/osx/dataview_osx.cpp', + 'src/osx/datectrl_osx.cpp', + 'src/osx/datetimectrl_osx.cpp', 'src/osx/dialog_osx.cpp', 'src/osx/dnd_osx.cpp', 'src/osx/fontutil.cpp', @@ -746,12 +665,15 @@ osx = [ 'src/osx/textctrl_osx.cpp', 'src/osx/textentry_osx.cpp', 'src/osx/tglbtn_osx.cpp', + 'src/osx/timectrl_osx.cpp', 'src/osx/toolbar_osx.cpp', 'src/osx/toplevel_osx.cpp', 'src/osx/uiaction_osx.cpp', 'src/osx/utils_osx.cpp', + #'src/osx/webview_webkit.mm', 'src/osx/window_osx.cpp', #'src/osx/carbon/aboutdlg.cpp', + 'src/osx/carbon/anybutton.cpp', 'src/osx/carbon/app.cpp', #'src/osx/carbon/bmpbuttn.cpp', #'src/osx/carbon/button.cpp', @@ -829,12 +751,14 @@ osx = [ 'src/osx/carbon/utilscocoa.mm', #'src/osx/carbon/window.cpp', 'src/osx/cocoa/aboutdlg.mm', + 'src/osx/cocoa/anybutton.mm', 'src/osx/cocoa/button.mm', 'src/osx/cocoa/checkbox.mm', 'src/osx/cocoa/choice.mm', 'src/osx/cocoa/colour.mm', 'src/osx/cocoa/combobox.mm', 'src/osx/cocoa/dataview.mm', + 'src/osx/cocoa/datetimectrl.mm', 'src/osx/cocoa/dialog.mm', 'src/osx/cocoa/dirdlg.mm', 'src/osx/cocoa/dnd.mm', @@ -902,228 +826,6 @@ osx = [ #'src/osx/iphone/window.mm', ] -png = [ - 'src/png/png.c', - 'src/png/pngerror.c', - 'src/png/pngget.c', - 'src/png/pngmem.c', - 'src/png/pngpread.c', - 'src/png/pngread.c', - 'src/png/pngrio.c', - 'src/png/pngrtran.c', - 'src/png/pngrutil.c', - 'src/png/pngset.c', - 'src/png/pngtrans.c', - 'src/png/pngwio.c', - 'src/png/pngwrite.c', - 'src/png/pngwtran.c', - 'src/png/pngwutil.c', - ] - -propgrid = [ - 'src/propgrid/advprops.cpp', - 'src/propgrid/editors.cpp', - 'src/propgrid/manager.cpp', - 'src/propgrid/property.cpp', - 'src/propgrid/propgrid.cpp', - 'src/propgrid/propgridiface.cpp', - 'src/propgrid/propgridpagestate.cpp', - 'src/propgrid/props.cpp', - ] - -regex = [ - 'src/regex/regcomp.c', - 'src/regex/regerror.c', - 'src/regex/regexec.c', - 'src/regex/regfree.c', - ] - -ribbon = [ - 'src/ribbon/art_aui.cpp', - 'src/ribbon/art_internal.cpp', - 'src/ribbon/art_msw.cpp', - 'src/ribbon/bar.cpp', - 'src/ribbon/buttonbar.cpp', - 'src/ribbon/control.cpp', - 'src/ribbon/gallery.cpp', - 'src/ribbon/page.cpp', - 'src/ribbon/panel.cpp', - 'src/ribbon/toolbar.cpp', - ] - -richtext = [ - #'src/richtext/richtextbackgroundpage.cpp', - #'src/richtext/richtextborderspage.cpp', - 'src/richtext/richtextbuffer.cpp', - #'src/richtext/richtextbulletspage.cpp', - 'src/richtext/richtextctrl.cpp', - #'src/richtext/richtextfontpage.cpp', - 'src/richtext/richtextformatdlg.cpp', - 'src/richtext/richtexthtml.cpp', - 'src/richtext/richtextimagedlg.cpp', - #'src/richtext/richtextindentspage.cpp', - #'src/richtext/richtextliststylepage.cpp', - #'src/richtext/richtextmarginspage.cpp', - 'src/richtext/richtextprint.cpp', - #'src/richtext/richtextsizepage.cpp', - 'src/richtext/richtextstyledlg.cpp', - #'src/richtext/richtextstylepage.cpp', - 'src/richtext/richtextstyles.cpp', - 'src/richtext/richtextsymboldlg.cpp', - #'src/richtext/richtexttabspage.cpp', - 'src/richtext/richtextxml.cpp', - ] - -stc = [ - 'src/stc/PlatWX.cpp', - 'src/stc/ScintillaWX.cpp', - 'src/stc/scintilla/src/AutoComplete.cxx', - 'src/stc/scintilla/src/CallTip.cxx', - 'src/stc/scintilla/src/CellBuffer.cxx', - 'src/stc/scintilla/src/CharClassify.cxx', - 'src/stc/scintilla/src/ContractionState.cxx', - 'src/stc/scintilla/src/Decoration.cxx', - 'src/stc/scintilla/src/Document.cxx', - 'src/stc/scintilla/src/DocumentAccessor.cxx', - 'src/stc/scintilla/src/Editor.cxx', - 'src/stc/scintilla/src/ExternalLexer.cxx', - 'src/stc/scintilla/src/Indicator.cxx', - 'src/stc/scintilla/src/KeyMap.cxx', - 'src/stc/scintilla/src/KeyWords.cxx', - 'src/stc/scintilla/src/LexAPDL.cxx', - 'src/stc/scintilla/src/LexASY.cxx', - 'src/stc/scintilla/src/LexAU3.cxx', - 'src/stc/scintilla/src/LexAVE.cxx', - 'src/stc/scintilla/src/LexAbaqus.cxx', - 'src/stc/scintilla/src/LexAda.cxx', - 'src/stc/scintilla/src/LexAsm.cxx', - 'src/stc/scintilla/src/LexAsn1.cxx', - 'src/stc/scintilla/src/LexBaan.cxx', - 'src/stc/scintilla/src/LexBash.cxx', - 'src/stc/scintilla/src/LexBasic.cxx', - 'src/stc/scintilla/src/LexBullant.cxx', - 'src/stc/scintilla/src/LexCLW.cxx', - 'src/stc/scintilla/src/LexCOBOL.cxx', - 'src/stc/scintilla/src/LexCPP.cxx', - 'src/stc/scintilla/src/LexCSS.cxx', - 'src/stc/scintilla/src/LexCaml.cxx', - 'src/stc/scintilla/src/LexCmake.cxx', - 'src/stc/scintilla/src/LexConf.cxx', - 'src/stc/scintilla/src/LexCrontab.cxx', - 'src/stc/scintilla/src/LexCsound.cxx', - 'src/stc/scintilla/src/LexD.cxx', - 'src/stc/scintilla/src/LexEScript.cxx', - 'src/stc/scintilla/src/LexEiffel.cxx', - 'src/stc/scintilla/src/LexErlang.cxx', - 'src/stc/scintilla/src/LexFlagship.cxx', - 'src/stc/scintilla/src/LexForth.cxx', - 'src/stc/scintilla/src/LexFortran.cxx', - 'src/stc/scintilla/src/LexGAP.cxx', - 'src/stc/scintilla/src/LexGui4Cli.cxx', - 'src/stc/scintilla/src/LexHTML.cxx', - 'src/stc/scintilla/src/LexHaskell.cxx', - 'src/stc/scintilla/src/LexInno.cxx', - 'src/stc/scintilla/src/LexKix.cxx', - 'src/stc/scintilla/src/LexLisp.cxx', - 'src/stc/scintilla/src/LexLout.cxx', - 'src/stc/scintilla/src/LexLua.cxx', - 'src/stc/scintilla/src/LexMMIXAL.cxx', - 'src/stc/scintilla/src/LexMPT.cxx', - 'src/stc/scintilla/src/LexMSSQL.cxx', - 'src/stc/scintilla/src/LexMagik.cxx', - 'src/stc/scintilla/src/LexMarkdown.cxx', - 'src/stc/scintilla/src/LexMatlab.cxx', - 'src/stc/scintilla/src/LexMetapost.cxx', - 'src/stc/scintilla/src/LexMySQL.cxx', - 'src/stc/scintilla/src/LexNimrod.cxx', - 'src/stc/scintilla/src/LexNsis.cxx', - 'src/stc/scintilla/src/LexOpal.cxx', - 'src/stc/scintilla/src/LexOthers.cxx', - 'src/stc/scintilla/src/LexPB.cxx', - 'src/stc/scintilla/src/LexPLM.cxx', - 'src/stc/scintilla/src/LexPOV.cxx', - 'src/stc/scintilla/src/LexPS.cxx', - 'src/stc/scintilla/src/LexPascal.cxx', - 'src/stc/scintilla/src/LexPerl.cxx', - 'src/stc/scintilla/src/LexPowerPro.cxx', - 'src/stc/scintilla/src/LexPowerShell.cxx', - 'src/stc/scintilla/src/LexProgress.cxx', - 'src/stc/scintilla/src/LexPython.cxx', - 'src/stc/scintilla/src/LexR.cxx', - 'src/stc/scintilla/src/LexRebol.cxx', - 'src/stc/scintilla/src/LexRuby.cxx', - 'src/stc/scintilla/src/LexSML.cxx', - 'src/stc/scintilla/src/LexSQL.cxx', - 'src/stc/scintilla/src/LexScriptol.cxx', - 'src/stc/scintilla/src/LexSmalltalk.cxx', - 'src/stc/scintilla/src/LexSorcus.cxx', - 'src/stc/scintilla/src/LexSpecman.cxx', - 'src/stc/scintilla/src/LexSpice.cxx', - 'src/stc/scintilla/src/LexTACL.cxx', - 'src/stc/scintilla/src/LexTADS3.cxx', - 'src/stc/scintilla/src/LexTAL.cxx', - 'src/stc/scintilla/src/LexTCL.cxx', - 'src/stc/scintilla/src/LexTeX.cxx', - 'src/stc/scintilla/src/LexVB.cxx', - 'src/stc/scintilla/src/LexVHDL.cxx', - 'src/stc/scintilla/src/LexVerilog.cxx', - 'src/stc/scintilla/src/LexYAML.cxx', - 'src/stc/scintilla/src/LineMarker.cxx', - 'src/stc/scintilla/src/PerLine.cxx', - 'src/stc/scintilla/src/PositionCache.cxx', - 'src/stc/scintilla/src/PropSet.cxx', - 'src/stc/scintilla/src/RESearch.cxx', - 'src/stc/scintilla/src/RunStyles.cxx', - 'src/stc/scintilla/src/ScintillaBase.cxx', - 'src/stc/scintilla/src/Selection.cxx', - 'src/stc/scintilla/src/Style.cxx', - 'src/stc/scintilla/src/StyleContext.cxx', - 'src/stc/scintilla/src/UniConversion.cxx', - 'src/stc/scintilla/src/ViewStyle.cxx', - 'src/stc/scintilla/src/WindowAccessor.cxx', - 'src/stc/scintilla/src/XPM.cxx', - 'src/stc/stc.cpp', - ] - -tiff = [ - 'src/tiff/libtiff/tif_aux.c', - 'src/tiff/libtiff/tif_close.c', - 'src/tiff/libtiff/tif_codec.c', - 'src/tiff/libtiff/tif_color.c', - 'src/tiff/libtiff/tif_compress.c', - 'src/tiff/libtiff/tif_dir.c', - 'src/tiff/libtiff/tif_dirinfo.c', - 'src/tiff/libtiff/tif_dirread.c', - 'src/tiff/libtiff/tif_dirwrite.c', - 'src/tiff/libtiff/tif_dumpmode.c', - 'src/tiff/libtiff/tif_error.c', - 'src/tiff/libtiff/tif_extension.c', - 'src/tiff/libtiff/tif_fax3.c', - 'src/tiff/libtiff/tif_fax3sm.c', - 'src/tiff/libtiff/tif_flush.c', - 'src/tiff/libtiff/tif_getimage.c', - 'src/tiff/libtiff/tif_jpeg.c', - 'src/tiff/libtiff/tif_luv.c', - 'src/tiff/libtiff/tif_lzw.c', - 'src/tiff/libtiff/tif_next.c', - 'src/tiff/libtiff/tif_ojpeg.c', - 'src/tiff/libtiff/tif_open.c', - 'src/tiff/libtiff/tif_packbits.c', - 'src/tiff/libtiff/tif_pixarlog.c', - 'src/tiff/libtiff/tif_predict.c', - 'src/tiff/libtiff/tif_print.c', - 'src/tiff/libtiff/tif_read.c', - 'src/tiff/libtiff/tif_strip.c', - 'src/tiff/libtiff/tif_swab.c', - 'src/tiff/libtiff/tif_thunder.c', - 'src/tiff/libtiff/tif_tile.c', - 'src/tiff/libtiff/tif_unix.c', - 'src/tiff/libtiff/tif_version.c', - 'src/tiff/libtiff/tif_warning.c', - 'src/tiff/libtiff/tif_write.c', - 'src/tiff/libtiff/tif_zip.c', - ] - unix = [ 'src/unix/apptraits.cpp', 'src/unix/appunix.cpp', @@ -1160,89 +862,6 @@ unixgtk = [ 'src/unix/utilsx11.cpp', ] -xrc = [ - 'src/xml/xml.cpp', - 'src/xrc/xh_animatctrl.cpp', - 'src/xrc/xh_bmp.cpp', - 'src/xrc/xh_bmpbt.cpp', - 'src/xrc/xh_bmpcbox.cpp', - 'src/xrc/xh_bttn.cpp', - 'src/xrc/xh_cald.cpp', - 'src/xrc/xh_chckb.cpp', - 'src/xrc/xh_chckl.cpp', - 'src/xrc/xh_choic.cpp', - 'src/xrc/xh_choicbk.cpp', - 'src/xrc/xh_clrpicker.cpp', - 'src/xrc/xh_cmdlinkbn.cpp', - 'src/xrc/xh_collpane.cpp', - 'src/xrc/xh_combo.cpp', - 'src/xrc/xh_comboctrl.cpp', - 'src/xrc/xh_datectrl.cpp', - 'src/xrc/xh_dirpicker.cpp', - 'src/xrc/xh_dlg.cpp', - 'src/xrc/xh_editlbox.cpp', - 'src/xrc/xh_filectrl.cpp', - 'src/xrc/xh_filepicker.cpp', - 'src/xrc/xh_fontpicker.cpp', - 'src/xrc/xh_frame.cpp', - 'src/xrc/xh_gauge.cpp', - 'src/xrc/xh_gdctl.cpp', - 'src/xrc/xh_grid.cpp', - 'src/xrc/xh_html.cpp', - 'src/xrc/xh_htmllbox.cpp', - 'src/xrc/xh_hyperlink.cpp', - 'src/xrc/xh_listb.cpp', - 'src/xrc/xh_listbk.cpp', - 'src/xrc/xh_listc.cpp', - 'src/xrc/xh_mdi.cpp', - 'src/xrc/xh_menu.cpp', - 'src/xrc/xh_notbk.cpp', - 'src/xrc/xh_odcombo.cpp', - 'src/xrc/xh_panel.cpp', - 'src/xrc/xh_propdlg.cpp', - 'src/xrc/xh_radbt.cpp', - 'src/xrc/xh_radbx.cpp', - 'src/xrc/xh_richtext.cpp', - 'src/xrc/xh_scrol.cpp', - 'src/xrc/xh_scwin.cpp', - 'src/xrc/xh_sizer.cpp', - 'src/xrc/xh_slidr.cpp', - 'src/xrc/xh_spin.cpp', - 'src/xrc/xh_split.cpp', - 'src/xrc/xh_srchctrl.cpp', - 'src/xrc/xh_statbar.cpp', - 'src/xrc/xh_stbmp.cpp', - 'src/xrc/xh_stbox.cpp', - 'src/xrc/xh_stlin.cpp', - 'src/xrc/xh_sttxt.cpp', - 'src/xrc/xh_text.cpp', - 'src/xrc/xh_tglbtn.cpp', - 'src/xrc/xh_toolb.cpp', - 'src/xrc/xh_toolbk.cpp', - 'src/xrc/xh_tree.cpp', - 'src/xrc/xh_treebk.cpp', - 'src/xrc/xh_unkwn.cpp', - 'src/xrc/xh_wizrd.cpp', - 'src/xrc/xmladv.cpp', - 'src/xrc/xmlres.cpp', - 'src/xrc/xmlrsall.cpp', - ] - -zlib = [ - 'src/zlib/adler32.c', - 'src/zlib/compress.c', - 'src/zlib/crc32.c', - 'src/zlib/deflate.c', - 'src/zlib/gzio.c', - 'src/zlib/infback.c', - 'src/zlib/inffast.c', - 'src/zlib/inflate.c', - 'src/zlib/inftrees.c', - 'src/zlib/trees.c', - 'src/zlib/uncompr.c', - 'src/zlib/zutil.c', - ] - files = aui + common + generic if sys.platform == 'win32': diff --git a/Externals/wxWidgets3/build/msw/wx_base.vcxproj b/Externals/wxWidgets3/build/msw/wx_base.vcxproj new file mode 100644 index 0000000000..d99f6f8b94 --- /dev/null +++ b/Externals/wxWidgets3/build/msw/wx_base.vcxproj @@ -0,0 +1,1686 @@ + + + + + Debug + Win32 + + + Debug + x64 + + + Release + Win32 + + + Release + x64 + + + DebugFast + Win32 + + + DebugFast + x64 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + true + true + true + true + true + true + + + true + true + true + true + true + true + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + true + true + true + true + true + true + + + true + true + true + true + true + true + + + + + + + + + + + + + true + true + true + true + true + true + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Create + Create + Create + Create + Create + Create + + + + + + true + true + true + true + true + true + + + + + + true + true + true + true + true + true + + + NotUsing + NotUsing + NotUsing + NotUsing + NotUsing + NotUsing + + + + + + + + + + + + + + + + + + + + + + + true + true + true + true + true + true + + + + + + true + true + true + true + true + true + + + + + + + + + + + + + + + + + + + + + + + + + + + + true + true + true + true + true + true + + + true + true + true + true + true + true + + + true + true + true + true + true + true + + + true + true + true + true + true + true + + + + true + true + true + true + true + true + + + true + true + true + true + true + true + + + true + true + true + true + true + true + + + true + true + true + true + true + true + + + + + + + + + + + + + true + true + true + true + true + true + + + + true + true + true + true + true + true + + + true + true + true + true + true + true + + + + + + + + + + + + + + + + + + + + + + + + + + + + + true + true + true + true + true + true + + + + + + + + + + + + + + + + true + true + true + true + true + true + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + true + true + true + true + true + true + + + + + + + + + + + + true + true + true + true + true + true + + + true + true + true + true + true + true + + + true + true + true + true + true + true + + + + + + true + true + true + true + true + true + + + + + + + + + true + true + true + true + true + true + + + + + + + true + true + true + true + true + true + + + + + + + + true + true + true + true + true + true + + + + + + + + true + true + true + true + true + true + + + + + + + + true + true + true + true + true + true + + + + + + + + true + true + true + true + true + true + + + + true + true + true + true + true + true + + + + true + true + true + true + true + true + + + true + true + true + true + true + true + + + + + + true + true + true + true + true + true + + + + true + true + true + true + true + true + + + true + true + true + true + true + true + + + + + true + true + true + true + true + true + + + + + + true + true + true + true + true + true + + + + + + + true + true + true + true + true + true + + + + + + + + + + + + + + true + true + true + true + true + true + + + + + + + + true + true + true + true + true + true + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + true + true + true + true + true + true + + + + + + + + + + + + + + + + + true + true + true + true + true + true + + + + + + + true + true + true + true + true + true + + + true + true + true + true + true + true + + + true + true + true + true + true + true + + + + + + true + true + true + true + true + true + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + true + true + true + true + true + true + + + + true + true + true + true + true + true + + + + + + + + + true + true + true + true + true + true + + + + + {01573c36-ac6e-49f6-94ba-572517eb9740} + + + {3e1339f5-9311-4122-9442-369702e8fcad} + + + + wxWidgets + {1C8436C9-DBAF-42BE-83BC-CF3EC9175ABE} + wxBase28 + + + + StaticLibrary + Unicode + + + StaticLibrary + Unicode + + + StaticLibrary + Unicode + + + StaticLibrary + Unicode + + + StaticLibrary + Unicode + + + StaticLibrary + Unicode + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + __WXDEBUG__;%(PreprocessorDefinitions) + + + + + + + + + + __WXDEBUG__;%(PreprocessorDefinitions) + + + + + + + + + \ No newline at end of file diff --git a/Externals/wxWidgets3/build/msw/wx_base.vcxproj.filters b/Externals/wxWidgets3/build/msw/wx_base.vcxproj.filters new file mode 100644 index 0000000000..e11b02d82e --- /dev/null +++ b/Externals/wxWidgets3/build/msw/wx_base.vcxproj.filters @@ -0,0 +1,3425 @@ + + + + + {ea19c29f-6825-47dc-b54d-ee464810b353} + + + {e1077817-0cf8-4a28-b86f-34e85984db45} + + + {887bf107-6891-4a1f-a32f-5be1aafc0535} + + + {303d663d-e46a-4394-9423-5d6bd35169f9} + + + {dab87ac5-435c-4c4c-a685-966df965635c} + + + {dd338b6e-5f9c-42f6-b1c3-e4db2c484490} + + + {7a3796f6-d621-4a89-a785-d0ec354b9652} + + + {3112ece1-9900-49c2-b90d-7e9c956d3cfb} + + + {6f4ef8f1-41e1-4bd6-8940-ac03c6b9218c} + + + {c4049f2a-35bb-494f-a789-c83ed28f18f1} + + + {302035ca-b308-4626-83f9-60c08f3015c9} + + + + + Setup Headers + + + Setup Headers + + + Setup Headers + + + Setup Headers + + + Headers + + + Headers + + + Headers + + + Headers + + + Headers + + + Headers + + + Headers + + + Headers + + + Headers + + + Headers + + + Headers + + + Headers + + + Headers + + + Headers + + + Headers + + + Headers + + + Headers + + + Headers + + + Headers + + + Headers + + + Headers + + + Headers + + + Headers + + + Headers + + + Headers + + + Headers + + + Headers + + + Headers + + + Headers + + + Headers + + + Headers + + + Headers + + + Headers + + + Headers + + + Headers + + + Headers + + + Headers + + + Headers + + + Headers + + + Headers + + + Headers + + + Headers + + + Headers + + + Headers + + + Headers + + + Headers + + + Headers + + + Headers + + + Headers + + + Headers + + + Headers + + + Headers + + + Headers + + + Headers + + + Headers + + + Headers + + + Headers + + + Headers + + + Headers + + + Headers + + + Headers + + + Headers + + + Headers + + + Headers + + + Headers + + + Headers + + + Headers + + + Headers + + + Headers + + + Headers + + + Headers + + + Headers + + + Headers + + + Headers + + + Headers + + + Headers + + + Headers + + + Headers + + + Headers + + + Headers + + + Headers + + + Headers + + + Headers + + + Headers + + + Headers + + + Headers + + + Headers + + + Headers + + + Headers + + + Headers + + + Headers + + + Headers + + + Headers + + + Headers + + + Headers + + + Headers + + + Headers + + + Headers + + + Headers + + + Headers + + + Headers + + + Headers + + + Headers + + + Headers + + + Headers + + + Headers + + + Headers + + + Headers + + + Headers + + + Headers + + + Headers + + + Headers + + + Headers + + + Headers + + + Headers + + + Headers + + + Headers + + + Headers + + + Headers + + + Headers + + + Headers + + + Headers + + + Headers + + + Headers + + + Headers + + + Headers + + + Headers + + + Headers + + + Headers + + + Headers + + + Headers + + + Headers + + + Headers + + + Headers + + + Headers + + + Headers + + + Headers + + + Headers + + + Headers + + + Headers + + + Headers + + + Headers + + + Headers + + + Headers + + + Headers + + + Headers + + + Headers + + + Headers + + + Headers + + + Headers + + + Headers + + + Headers + + + Headers + + + Headers + + + Headers + + + Headers + + + Headers + + + Headers + + + Headers + + + Headers + + + Headers + + + Headers + + + Headers + + + Headers + + + Headers + + + Headers + + + Headers + + + Headers + + + Headers + + + Headers + + + Headers + + + Headers + + + Headers + + + Headers + + + Headers + + + Headers + + + Headers + + + Headers + + + Headers + + + Headers + + + Headers + + + Headers + + + Headers + + + Headers + + + Headers + + + Headers + + + Headers + + + Headers + + + Headers + + + Headers + + + Headers + + + Headers + + + Headers + + + Headers + + + Headers + + + Headers + + + Headers + + + Headers + + + Headers + + + Headers + + + Headers + + + Headers + + + Headers + + + Headers + + + Headers + + + Headers + + + Headers + + + Headers + + + Headers + + + Headers + + + Headers + + + Headers + + + Headers + + + Headers + + + Headers + + + Headers + + + Headers + + + Headers + + + Headers + + + Headers + + + Headers + + + Headers + + + Headers + + + Headers + + + Headers + + + Headers + + + Headers + + + Headers + + + Headers + + + Headers + + + Headers + + + Headers + + + Headers + + + Headers + + + Headers + + + Headers + + + Headers + + + Headers + + + Headers + + + Headers + + + Headers + + + Headers + + + Headers + + + Headers + + + Headers + + + Headers + + + Headers + + + Headers + + + Headers + + + Headers + + + Headers + + + Headers + + + Headers + + + Headers + + + Headers + + + Headers + + + Headers + + + Headers + + + Headers + + + Headers + + + Headers + + + Headers + + + Headers + + + Headers + + + Headers + + + Headers + + + Headers + + + Headers + + + Headers + + + Headers + + + Headers + + + Headers + + + Headers + + + Headers + + + Headers + + + Headers + + + Headers + + + Headers + + + Headers + + + Headers + + + Headers + + + Headers + + + Headers + + + Headers + + + Headers + + + Headers + + + Headers + + + Headers + + + Headers + + + Headers + + + Headers + + + Headers + + + Headers + + + Headers + + + Headers + + + Headers + + + Headers + + + Headers + + + Headers + + + Headers + + + Headers + + + Headers + + + Headers + + + Headers + + + Headers + + + Headers + + + Headers + + + Headers + + + Headers + + + Headers + + + Headers + + + Headers + + + Headers + + + Headers + + + Headers + + + Headers + + + Headers + + + Headers + + + Headers + + + Headers + + + Headers + + + Headers + + + Headers + + + Headers + + + Headers + + + Headers + + + Headers + + + Headers + + + Headers + + + Headers + + + Headers + + + Headers + + + Headers + + + Headers + + + Headers + + + Headers + + + Headers + + + Headers + + + Headers + + + Headers + + + Headers + + + Headers + + + Headers + + + Headers + + + Headers + + + Headers + + + Headers + + + Headers + + + Headers + + + Headers + + + Headers + + + Headers + + + Headers + + + Headers + + + Headers + + + Headers + + + Headers + + + Headers + + + Headers + + + Headers + + + Headers + + + Headers + + + Headers + + + Headers + + + Headers + + + Headers + + + Headers + + + Headers + + + Headers + + + Headers + + + Headers + + + Headers + + + Headers + + + Headers + + + Headers + + + Headers + + + Headers + + + Headers + + + Headers + + + Headers + + + Headers + + + Headers + + + Headers + + + Headers + + + Headers + + + Headers + + + Headers + + + Headers + + + Headers + + + Headers + + + Headers + + + Headers + + + Headers + + + Headers + + + Headers + + + Headers + + + Headers + + + Headers + + + Headers + + + Headers + + + Headers + + + Headers + + + Headers + + + Headers + + + Headers\MSW + + + Headers\MSW + + + Headers\MSW + + + Headers\MSW + + + Headers\MSW + + + Headers\MSW + + + Headers\MSW + + + Headers\MSW + + + Headers\MSW + + + Headers\MSW + + + Headers\MSW + + + Headers\MSW + + + Headers\MSW + + + Headers\MSW + + + Headers\MSW + + + Headers\MSW + + + Headers\MSW + + + Headers\MSW + + + Headers\MSW + + + Headers\MSW + + + Headers\MSW + + + Headers\MSW + + + Headers\MSW + + + Headers\MSW + + + Headers\MSW + + + Headers\MSW + + + Headers\MSW + + + Headers\MSW + + + Headers\MSW + + + Headers\MSW + + + Headers\MSW + + + Headers\MSW + + + Headers\MSW + + + Headers\MSW + + + Headers\MSW + + + Headers\MSW + + + Headers\MSW + + + Headers\MSW + + + Headers\MSW + + + Headers\MSW + + + Headers\MSW + + + Headers\MSW + + + Headers\MSW + + + Headers\MSW + + + Headers\MSW + + + Headers\MSW + + + Headers\MSW + + + Headers\MSW + + + Headers\MSW + + + Headers\MSW + + + Headers\MSW + + + Headers\MSW + + + Headers\MSW + + + Headers\MSW + + + Headers\MSW + + + Headers\MSW + + + Headers\MSW + + + Headers\MSW + + + Headers\MSW + + + Headers\MSW + + + Headers\MSW + + + Headers\MSW + + + Headers\MSW + + + Headers\MSW + + + Headers\MSW + + + Headers\MSW + + + Headers\MSW + + + Headers\MSW + + + Headers\MSW + + + Headers\MSW + + + Headers\MSW + + + Headers\MSW + + + Headers\MSW + + + Headers\MSW + + + Headers\MSW + + + Headers\MSW + + + Headers\MSW + + + Headers\MSW + + + Headers\MSW + + + Headers\MSW + + + Headers\MSW + + + Headers\MSW + + + Headers\MSW + + + Headers\MSW + + + Headers\MSW + + + Headers\MSW + + + Headers\MSW + + + Headers\MSW + + + Headers\MSW + + + Headers\MSW + + + Headers\MSW + + + Headers\MSW + + + Headers\MSW + + + Headers\MSW + + + Headers\MSW + + + Headers\MSW + + + Headers\MSW + + + Headers\MSW + + + Headers\MSW + + + Headers\MSW + + + Headers\MSW + + + Headers\MSW + + + Headers\MSW + + + Headers\MSW + + + Headers\MSW + + + Headers\MSW + + + Headers\MSW + + + Headers\MSW + + + Headers\MSW + + + Headers\MSW + + + Headers\MSW + + + Headers\MSW + + + Headers\MSW + + + Headers\MSW + + + Headers\MSW + + + Headers\MSW + + + Headers\MSW + + + Headers\MSW + + + Headers\MSW + + + Headers\MSW + + + Headers\MSW + + + Headers\MSW + + + Headers\MSW + + + Headers\MSW + + + Headers\MSW + + + Headers\MSW + + + Headers\MSW + + + Headers\MSW + + + Headers\MSW + + + Headers\MSW + + + Headers\MSW\private + + + Headers\MSW\private + + + Headers\MSW\private + + + Headers\MSW\private + + + Headers\MSW\private + + + Headers\MSW\private + + + Headers\MSW\private + + + Headers\MSW\private + + + Headers\MSW\private + + + Headers\MSW\private + + + Headers\MSW + + + Headers\MSW + + + Headers\MSW + + + Headers\Generic + + + Headers\Generic + + + Headers\Generic + + + Headers\Generic + + + Headers\Generic + + + Headers\Generic + + + Headers\Generic + + + Headers\Generic + + + Headers\Generic + + + Headers\Generic + + + Headers\Generic + + + Headers\Generic + + + Headers\Generic + + + Headers\Generic + + + Headers\Generic + + + Headers\Generic + + + Headers\Generic + + + Headers\Generic + + + Headers\Generic + + + Headers\Generic + + + Headers\Generic + + + Headers\Generic + + + Headers\Generic + + + Headers\Generic + + + Headers\Generic + + + Headers\Generic + + + Headers\Generic + + + Headers\Generic + + + Headers\Generic + + + Headers\Generic + + + Headers\Generic + + + Headers\Generic + + + Headers\Generic + + + Headers\Generic + + + Headers\Generic + + + Headers\Generic + + + Headers\Generic + + + Headers\Generic + + + Headers\Generic + + + Headers\Generic + + + Headers\Generic + + + Headers\Generic + + + Headers\Generic + + + Headers\Generic + + + Headers\Generic + + + Headers\Generic + + + Headers\Generic + + + Headers\Generic + + + Headers\Generic + + + Headers\Generic + + + Headers\Generic + + + Headers\Generic + + + Headers\Generic + + + Headers\Generic + + + Headers\Generic + + + Headers\Generic + + + Headers\Generic + + + Headers\Generic + + + Headers\Generic + + + Headers\Generic + + + Headers\Generic + + + Headers\Generic + + + Headers\Generic + + + Headers\Generic + + + Headers\Generic + + + Headers\Generic + + + Headers\Generic + + + Headers\Generic + + + Headers\Generic + + + Headers\Generic + + + Headers\Generic + + + Headers\Generic + + + Headers\Generic + + + Headers\MSW\ole + + + Headers\MSW\ole + + + Headers\MSW\ole + + + Headers\MSW\ole + + + Headers\MSW\ole + + + Headers\MSW\ole + + + Headers\MSW\ole + + + Headers\MSW\ole + + + Headers\MSW\ole + + + Headers\MSW\ole + + + + + AUI + + + AUI + + + AUI + + + AUI + + + AUI + + + AUI + + + Common + + + Common + + + Common + + + Common + + + Common + + + Common + + + Common + + + Common + + + Common + + + Common + + + Common + + + Common + + + Common + + + Common + + + Common + + + Common + + + Common + + + Common + + + Common + + + Common + + + Common + + + Common + + + Common + + + Common + + + Common + + + Common + + + Common + + + Common + + + Common + + + Common + + + Common + + + Common + + + Common + + + Common + + + Common + + + Common + + + Common + + + Common + + + Common + + + Common + + + Common + + + Common + + + Common + + + Common + + + Common + + + Common + + + Common + + + Common + + + Common + + + Common + + + Common + + + Common + + + Common + + + Common + + + Common + + + Common + + + Common + + + Common + + + Common + + + Common + + + Common + + + Common + + + Common + + + Common + + + Common + + + Common + + + Common + + + Common + + + Common + + + Common + + + Common + + + Common + + + Common + + + Common + + + Common + + + Common + + + Common + + + Common + + + Common + + + Common + + + Common + + + Common + + + Common + + + Common + + + Common + + + Common + + + Common + + + Common + + + Common + + + Common + + + Common + + + Common + + + Common + + + Common + + + Common + + + Common + + + Common + + + Common + + + Common + + + Common + + + Common + + + Common + + + Common + + + Common + + + Common + + + Common + + + Common + + + Common + + + Common + + + Common + + + Common + + + Common + + + Common + + + Common + + + Common + + + Common + + + Common + + + Common + + + Common + + + Common + + + Common + + + Common + + + Common + + + Common + + + Common + + + Common + + + Common + + + Common + + + Common + + + Common + + + Common + + + Common + + + Common + + + Common + + + Common + + + Common + + + Common + + + Common + + + Common + + + Common + + + Common + + + Common + + + Common + + + Common + + + Common + + + Common + + + Common + + + Common + + + Common + + + Common + + + Common + + + Common + + + Common + + + Common + + + Common + + + Common + + + Common + + + Common + + + Common + + + Common + + + Common + + + Common + + + Common + + + Common + + + Common + + + Common + + + Common + + + Common + + + Common + + + Common + + + Common + + + Common + + + Common + + + Common + + + Common + + + Common + + + Common + + + Common + + + Common + + + Common + + + Common + + + Common + + + Common + + + Common + + + Common + + + Common + + + Common + + + Common + + + Common + + + Common + + + Common + + + Common + + + Common + + + Common + + + Common + + + Common + + + Common + + + Common + + + Common + + + Common + + + Common + + + Common + + + Common + + + Common + + + Common + + + Common + + + Common + + + Common + + + Common + + + Common + + + Common + + + Common + + + Common + + + Common + + + Common + + + Common + + + Common + + + Common + + + Common + + + Common + + + Common + + + Common + + + Common + + + Common + + + Common + + + Common + + + Common + + + Common + + + Common + + + Common + + + Common + + + Common + + + Common + + + Common + + + Common + + + Common + + + Common + + + Common + + + Common + + + Common + + + Common + + + Common + + + Common + + + Common + + + Generic + + + Generic + + + Generic + + + Generic + + + Generic + + + Generic + + + Generic + + + Generic + + + Generic + + + Generic + + + Generic + + + Generic + + + Generic + + + Generic + + + Generic + + + Generic + + + Generic + + + Generic + + + Generic + + + Generic + + + Generic + + + Generic + + + Generic + + + Generic + + + Generic + + + Generic + + + Generic + + + Generic + + + Generic + + + Generic + + + Generic + + + Generic + + + Generic + + + Generic + + + Generic + + + Generic + + + Generic + + + Generic + + + Generic + + + Generic + + + Generic + + + Generic + + + Generic + + + Generic + + + Generic + + + Generic + + + Generic + + + Generic + + + Generic + + + Generic + + + Generic + + + Generic + + + Generic + + + Generic + + + Generic + + + Generic + + + Generic + + + Generic + + + Generic + + + Generic + + + Generic + + + Generic + + + Generic + + + Generic + + + Generic + + + Generic + + + Generic + + + Generic + + + Generic + + + Generic + + + Generic + + + Generic + + + Generic + + + Generic + + + Generic + + + Generic + + + Generic + + + Generic + + + Generic + + + Generic + + + Generic + + + Generic + + + Generic + + + Generic + + + Generic + + + Generic + + + Generic + + + Generic + + + Generic + + + MSW + + + MSW + + + MSW + + + MSW + + + MSW + + + MSW + + + MSW + + + MSW + + + MSW + + + MSW + + + MSW + + + MSW + + + MSW + + + MSW + + + MSW + + + MSW + + + MSW + + + MSW + + + MSW + + + MSW + + + MSW + + + MSW + + + MSW + + + MSW + + + MSW + + + MSW + + + MSW + + + MSW + + + MSW + + + MSW + + + MSW + + + MSW + + + MSW + + + MSW + + + MSW + + + MSW + + + MSW + + + MSW + + + MSW + + + MSW + + + MSW + + + MSW + + + MSW + + + MSW + + + MSW + + + MSW + + + MSW + + + MSW + + + MSW + + + MSW + + + MSW + + + MSW + + + MSW + + + MSW + + + MSW + + + MSW + + + MSW + + + MSW + + + MSW + + + MSW + + + MSW + + + MSW + + + MSW + + + MSW + + + MSW + + + MSW + + + MSW + + + MSW + + + MSW + + + MSW + + + MSW + + + MSW + + + MSW + + + MSW + + + MSW + + + MSW + + + MSW + + + MSW + + + MSW + + + MSW + + + MSW + + + MSW + + + MSW + + + MSW + + + MSW + + + MSW + + + MSW + + + MSW + + + MSW + + + MSW + + + MSW + + + MSW + + + MSW + + + MSW + + + MSW + + + MSW + + + MSW + + + MSW + + + MSW + + + MSW + + + MSW + + + MSW + + + MSW + + + MSW + + + MSW + + + MSW + + + MSW + + + MSW + + + MSW + + + MSW + + + MSW + + + MSW + + + MSW + + + MSW + + + MSW + + + MSW + + + MSW + + + MSW + + + MSW + + + MSW + + + MSW + + + MSW + + + MSW + + + MSW + + + MSW + + + MSW + + + MSW + + + MSW + + + MSW + + + MSW + + + MSW + + + MSW + + + MSW + + + MSW + + + MSW + + + MSW + + + MSW + + + MSW + + + MSW + + + MSW + + + MSW + + + MSW + + + MSW + + + MSW\ole + + + MSW\ole + + + MSW\ole + + + MSW\ole + + + MSW\ole + + + MSW\ole + + + MSW\ole + + + MSW\ole + + + + + Common + + + + + + MSW + + + \ No newline at end of file diff --git a/Externals/wxWidgets3/build_wx.sh b/Externals/wxWidgets3/build_wx.sh new file mode 100755 index 0000000000..2173572bfa --- /dev/null +++ b/Externals/wxWidgets3/build_wx.sh @@ -0,0 +1,19 @@ +#!/bin/bash + +svn co -r 70933 http://svn.wxwidgets.org/svn/wx/wxWidgets/trunk wxWidgets +cd wxWidgets + +case $OSTYPE in +darwin*) +BACKEND="osx_cocoa" +;; +linux*) +BACKEND="gtk" +;; +esac + +mkdir build-local +cd build-local + +../configure --with-$BACKEND --disable-shared --enable-unicode --disable-compat28 --disable-exceptions --disable-fswatcher --without-regex --without-expat --disable-xml --disable-ribbon --disable-propgrid --disable-stc --disable-html --disable-richtext --without-libjpeg --without-libtiff --disable-webview --disable-markup +make diff --git a/Externals/wxWidgets3/include/wx/aboutdlg.h b/Externals/wxWidgets3/include/wx/aboutdlg.h index 0becacd2a0..0552f91fd1 100644 --- a/Externals/wxWidgets3/include/wx/aboutdlg.h +++ b/Externals/wxWidgets3/include/wx/aboutdlg.h @@ -3,7 +3,7 @@ // Purpose: declaration of wxAboutDialog class // Author: Vadim Zeitlin // Created: 2006-10-07 -// RCS-ID: $Id: aboutdlg.h 61534 2009-07-25 22:53:23Z VZ $ +// RCS-ID: $Id: aboutdlg.h 67681 2011-05-03 16:29:04Z DS $ // Copyright: (c) 2006 Vadim Zeitlin // Licence: wxWindows licence /////////////////////////////////////////////////////////////////////////////// @@ -69,7 +69,7 @@ public: // icon to be shown in the dialog, defaults to the main frame icon void SetIcon(const wxIcon& icon) { m_icon = icon; } - bool HasIcon() const { return m_icon.Ok(); } + bool HasIcon() const { return m_icon.IsOk(); } wxIcon GetIcon() const; // web site for the program and its description (defaults to URL itself if diff --git a/Externals/wxWidgets3/include/wx/accel.h b/Externals/wxWidgets3/include/wx/accel.h index f4edd93047..200feffe4d 100644 --- a/Externals/wxWidgets3/include/wx/accel.h +++ b/Externals/wxWidgets3/include/wx/accel.h @@ -4,7 +4,7 @@ // Author: Julian Smart, Robert Roebling, Vadim Zeitlin // Modified by: // Created: 31.05.01 (extracted from other files) -// RCS-ID: $Id: accel.h 67280 2011-03-22 14:17:38Z DS $ +// RCS-ID: $Id: accel.h 68718 2011-08-16 11:55:39Z SC $ // Copyright: (c) wxWidgets team // Licence: wxWindows licence /////////////////////////////////////////////////////////////////////////////// @@ -34,10 +34,11 @@ enum wxAcceleratorEntryFlags wxACCEL_CTRL = 0x0002, // hold Ctrl key down wxACCEL_SHIFT = 0x0004, // hold Shift key down #if defined(__WXMAC__) || defined(__WXCOCOA__) - wxACCEL_CMD = 0x0008 // Command key on OS X + wxACCEL_RAW_CTRL= 0x0008, // #else - wxACCEL_CMD = wxACCEL_CTRL + wxACCEL_RAW_CTRL= wxACCEL_CTRL, #endif + wxACCEL_CMD = wxACCEL_CTRL }; // ---------------------------------------------------------------------------- diff --git a/Externals/wxWidgets3/include/wx/affinematrix2d.h b/Externals/wxWidgets3/include/wx/affinematrix2d.h new file mode 100644 index 0000000000..6516cd46f5 --- /dev/null +++ b/Externals/wxWidgets3/include/wx/affinematrix2d.h @@ -0,0 +1,51 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/affinematrix2d.h +// Purpose: wxAffineMatrix2D class. +// Author: Based on wxTransformMatrix by Chris Breeze, Julian Smart +// Created: 2011-04-05 +// Copyright: (c) wxWidgets team +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_AFFINEMATRIX2D_H_ +#define _WX_AFFINEMATRIX2D_H_ + +#include "wx/defs.h" + +#if wxUSE_GEOMETRY + +#include "wx/affinematrix2dbase.h" + +// A simple implementation of wxAffineMatrix2DBase interface done entirely in +// wxWidgets. +class WXDLLIMPEXP_CORE wxAffineMatrix2D : public wxAffineMatrix2DBase +{ +public: + wxAffineMatrix2D() : m_11(1), m_12(0), + m_21(0), m_22(1), + m_tx(0), m_ty(0) + { + } + + // Implement base class pure virtual methods. + virtual void Set(const wxMatrix2D& mat2D, const wxPoint2DDouble& tr); + virtual void Get(wxMatrix2D* mat2D, wxPoint2DDouble* tr) const; + virtual void Concat(const wxAffineMatrix2DBase& t); + virtual bool Invert(); + virtual bool IsIdentity() const; + virtual bool IsEqual(const wxAffineMatrix2DBase& t) const; + virtual void Translate(wxDouble dx, wxDouble dy); + virtual void Scale(wxDouble xScale, wxDouble yScale); + virtual void Rotate(wxDouble ccRadians); + +protected: + virtual wxPoint2DDouble DoTransformPoint(const wxPoint2DDouble& p) const; + virtual wxPoint2DDouble DoTransformDistance(const wxPoint2DDouble& p) const; + +private: + wxDouble m_11, m_12, m_21, m_22, m_tx, m_ty; +}; + +#endif // wxUSE_GEOMETRY + +#endif // _WX_AFFINEMATRIX2D_H_ diff --git a/Externals/wxWidgets3/include/wx/affinematrix2dbase.h b/Externals/wxWidgets3/include/wx/affinematrix2dbase.h new file mode 100644 index 0000000000..94b1955aa3 --- /dev/null +++ b/Externals/wxWidgets3/include/wx/affinematrix2dbase.h @@ -0,0 +1,127 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/affinematrix2dbase.h +// Purpose: Common interface for 2D transformation matrices. +// Author: Catalin Raceanu +// Created: 2011-04-06 +// Copyright: (c) wxWidgets team +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_AFFINEMATRIX2DBASE_H_ +#define _WX_AFFINEMATRIX2DBASE_H_ + +#include "wx/defs.h" + +#if wxUSE_GEOMETRY + +#include "wx/geometry.h" + +struct wxMatrix2D +{ + wxMatrix2D(wxDouble v11 = 1, + wxDouble v12 = 0, + wxDouble v21 = 0, + wxDouble v22 = 1) + { + m_11 = v11; m_12 = v12; + m_21 = v21; m_22 = v22; + } + + wxDouble m_11, m_12, m_21, m_22; +}; + +// A 2x3 matrix representing an affine 2D transformation. +// +// This is an abstract base class implemented by wxAffineMatrix2D only so far, +// but in the future we also plan to derive wxGraphicsMatrix from it (it should +// also be documented then as currently only wxAffineMatrix2D itself is). +class WXDLLIMPEXP_CORE wxAffineMatrix2DBase +{ +public: + wxAffineMatrix2DBase() {} + virtual ~wxAffineMatrix2DBase() {} + + // sets the matrix to the respective values + virtual void Set(const wxMatrix2D& mat2D, const wxPoint2DDouble& tr) = 0; + + // gets the component valuess of the matrix + virtual void Get(wxMatrix2D* mat2D, wxPoint2DDouble* tr) const = 0; + + // concatenates the matrix + virtual void Concat(const wxAffineMatrix2DBase& t) = 0; + + // makes this the inverse matrix + virtual bool Invert() = 0; + + // return true if this is the identity matrix + virtual bool IsIdentity() const = 0; + + // returns true if the elements of the transformation matrix are equal ? + virtual bool IsEqual(const wxAffineMatrix2DBase& t) const = 0; + bool operator==(const wxAffineMatrix2DBase& t) const { return IsEqual(t); } + bool operator!=(const wxAffineMatrix2DBase& t) const { return !IsEqual(t); } + + + // + // transformations + // + + // add the translation to this matrix + virtual void Translate(wxDouble dx, wxDouble dy) = 0; + + // add the scale to this matrix + virtual void Scale(wxDouble xScale, wxDouble yScale) = 0; + + // add the rotation to this matrix (counter clockwise, radians) + virtual void Rotate(wxDouble ccRadians) = 0; + + // add mirroring to this matrix + void Mirror(int direction = wxHORIZONTAL) + { + wxDouble x = (direction & wxHORIZONTAL) ? -1 : 1; + wxDouble y = (direction & wxVERTICAL) ? -1 : 1; + Scale(x, y); + } + + + // applies that matrix to the point + wxPoint2DDouble TransformPoint(const wxPoint2DDouble& src) const + { + return DoTransformPoint(src); + } + + void TransformPoint(wxDouble* x, wxDouble* y) const + { + wxCHECK_RET( x && y, "Can't be NULL" ); + + const wxPoint2DDouble dst = DoTransformPoint(wxPoint2DDouble(*x, *y)); + *x = dst.m_x; + *y = dst.m_y; + } + + // applies the matrix except for translations + wxPoint2DDouble TransformDistance(const wxPoint2DDouble& src) const + { + return DoTransformDistance(src); + } + + void TransformDistance(wxDouble* dx, wxDouble* dy) const + { + wxCHECK_RET( dx && dy, "Can't be NULL" ); + + const wxPoint2DDouble + dst = DoTransformDistance(wxPoint2DDouble(*dx, *dy)); + *dx = dst.m_x; + *dy = dst.m_y; + } + +protected: + virtual + wxPoint2DDouble DoTransformPoint(const wxPoint2DDouble& p) const = 0; + virtual + wxPoint2DDouble DoTransformDistance(const wxPoint2DDouble& p) const = 0; +}; + +#endif // wxUSE_GEOMETRY + +#endif // _WX_AFFINEMATRIX2DBASE_H_ diff --git a/Externals/wxWidgets3/include/wx/anybutton.h b/Externals/wxWidgets3/include/wx/anybutton.h new file mode 100644 index 0000000000..4275c6bfd8 --- /dev/null +++ b/Externals/wxWidgets3/include/wx/anybutton.h @@ -0,0 +1,200 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/anybutton.h +// Purpose: wxAnyButtonBase class +// Author: Vadim Zetlin +// Created: 2000-08-15 (extracted from button.h) +// RCS-ID: $Id: anybutton.h 70345 2012-01-15 01:05:28Z VZ $ +// Copyright: (c) Vadim Zetlin +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_ANYBUTTON_H_BASE_ +#define _WX_ANYBUTTON_H_BASE_ + +#include "wx/defs.h" + +#ifdef wxHAS_ANY_BUTTON + +// ---------------------------------------------------------------------------- +// wxAnyButton specific flags +// ---------------------------------------------------------------------------- + +// These flags affect label alignment +#define wxBU_LEFT 0x0040 +#define wxBU_TOP 0x0080 +#define wxBU_RIGHT 0x0100 +#define wxBU_BOTTOM 0x0200 +#define wxBU_ALIGN_MASK ( wxBU_LEFT | wxBU_TOP | wxBU_RIGHT | wxBU_BOTTOM ) + +// These two flags are obsolete +#define wxBU_NOAUTODRAW 0x0000 +#define wxBU_AUTODRAW 0x0004 + +// by default, the buttons will be created with some (system dependent) +// minimal size to make them look nicer, giving this style will make them as +// small as possible +#define wxBU_EXACTFIT 0x0001 + +// this flag can be used to disable using the text label in the button: it is +// mostly useful when creating buttons showing bitmap and having stock id as +// without it both the standard label corresponding to the stock id and the +// bitmap would be shown +#define wxBU_NOTEXT 0x0002 + + +#include "wx/bitmap.h" +#include "wx/control.h" + +// ---------------------------------------------------------------------------- +// wxAnyButton: common button functionality +// ---------------------------------------------------------------------------- + +class WXDLLIMPEXP_CORE wxAnyButtonBase : public wxControl +{ +public: + wxAnyButtonBase() { } + + // show the image in the button in addition to the label: this method is + // supported on all (major) platforms + void SetBitmap(const wxBitmap& bitmap, wxDirection dir = wxLEFT) + { + SetBitmapLabel(bitmap); + SetBitmapPosition(dir); + } + + wxBitmap GetBitmap() const { return DoGetBitmap(State_Normal); } + + // Methods for setting individual images for different states: normal, + // selected (meaning pushed or pressed), focused (meaning normal state for + // a focused button), disabled or hover (a.k.a. hot or current). + // + // Remember that SetBitmap() itself must be called before any other + // SetBitmapXXX() methods (except for SetBitmapLabel() which is a synonym + // for it anyhow) and that all bitmaps passed to these functions should be + // of the same size. + void SetBitmapLabel(const wxBitmap& bitmap) + { DoSetBitmap(bitmap, State_Normal); } + void SetBitmapPressed(const wxBitmap& bitmap) + { DoSetBitmap(bitmap, State_Pressed); } + void SetBitmapDisabled(const wxBitmap& bitmap) + { DoSetBitmap(bitmap, State_Disabled); } + void SetBitmapCurrent(const wxBitmap& bitmap) + { DoSetBitmap(bitmap, State_Current); } + void SetBitmapFocus(const wxBitmap& bitmap) + { DoSetBitmap(bitmap, State_Focused); } + + wxBitmap GetBitmapLabel() const { return DoGetBitmap(State_Normal); } + wxBitmap GetBitmapPressed() const { return DoGetBitmap(State_Pressed); } + wxBitmap GetBitmapDisabled() const { return DoGetBitmap(State_Disabled); } + wxBitmap GetBitmapCurrent() const { return DoGetBitmap(State_Current); } + wxBitmap GetBitmapFocus() const { return DoGetBitmap(State_Focused); } + + + // set the margins around the image + void SetBitmapMargins(wxCoord x, wxCoord y) { DoSetBitmapMargins(x, y); } + void SetBitmapMargins(const wxSize& sz) { DoSetBitmapMargins(sz.x, sz.y); } + wxSize GetBitmapMargins() { return DoGetBitmapMargins(); } + + // set the image position relative to the text, i.e. wxLEFT means that the + // image is to the left of the text (this is the default) + void SetBitmapPosition(wxDirection dir); + + + // Buttons on MSW can look bad if they are not native colours, because + // then they become owner-drawn and not theme-drawn. Disable it here + // in wxAnyButtonBase to make it consistent. + virtual bool ShouldInheritColours() const { return false; } + + // wxUniv-compatible and deprecated equivalents to SetBitmapXXX() +#if WXWIN_COMPATIBILITY_2_8 + void SetImageLabel(const wxBitmap& bitmap) { SetBitmap(bitmap); } + void SetImageMargins(wxCoord x, wxCoord y) { SetBitmapMargins(x, y); } +#endif // WXWIN_COMPATIBILITY_2_8 + + // backwards compatible names for pressed/current bitmaps: they're not + // deprecated as there is nothing really wrong with using them and no real + // advantage to using the new names but the new names are still preferred + wxBitmap GetBitmapSelected() const { return GetBitmapPressed(); } + wxBitmap GetBitmapHover() const { return GetBitmapCurrent(); } + + void SetBitmapSelected(const wxBitmap& bitmap) { SetBitmapPressed(bitmap); } + void SetBitmapHover(const wxBitmap& bitmap) { SetBitmapCurrent(bitmap); } + + + // this enum is not part of wx public API, it is public because it is used + // in non wxAnyButton-derived classes internally + // + // also notice that MSW code relies on the values of the enum elements, do + // not change them without revising src/msw/button.cpp + enum State + { + State_Normal, + State_Current, // a.k.a. hot or "hovering" + State_Pressed, // a.k.a. "selected" in public API for some reason + State_Disabled, + State_Focused, + State_Max + }; + + // return true if this button shouldn't show the text label, either because + // it doesn't have it or because it was explicitly disabled with wxBU_NOTEXT + bool DontShowLabel() const + { + return HasFlag(wxBU_NOTEXT) || GetLabel().empty(); + } + + // return true if we do show the label + bool ShowsLabel() const + { + return !DontShowLabel(); + } + +protected: + // choose the default border for this window + virtual wxBorder GetDefaultBorder() const { return wxBORDER_NONE; } + + virtual wxBitmap DoGetBitmap(State WXUNUSED(which)) const + { return wxBitmap(); } + virtual void DoSetBitmap(const wxBitmap& WXUNUSED(bitmap), + State WXUNUSED(which)) + { } + + virtual wxSize DoGetBitmapMargins() const + { return wxSize(0, 0); } + + virtual void DoSetBitmapMargins(wxCoord WXUNUSED(x), wxCoord WXUNUSED(y)) + { } + + virtual void DoSetBitmapPosition(wxDirection WXUNUSED(dir)) + { } + + virtual bool DoGetAuthNeeded() const { return false; } + virtual void DoSetAuthNeeded(bool WXUNUSED(show)) { } + + + wxDECLARE_NO_COPY_CLASS(wxAnyButtonBase); +}; + +#if defined(__WXUNIVERSAL__) + #include "wx/univ/anybutton.h" +#elif defined(__WXMSW__) + #include "wx/msw/anybutton.h" +//#elif defined(__WXMOTIF__) +// #include "wx/motif/anybutton.h" +#elif defined(__WXGTK20__) + #include "wx/gtk/anybutton.h" +//#elif defined(__WXGTK__) +// #include "wx/gtk1/anybutton.h" +#elif defined(__WXMAC__) + #include "wx/osx/anybutton.h" +//#elif defined(__WXCOCOA__) +// #include "wx/cocoa/anybutton.h" +//#elif defined(__WXPM__) +// #include "wx/os2/anybutton.h" +#else + typedef wxAnyButtonBase wxAnyButton; +#endif + +#endif // wxHAS_ANY_BUTTON + +#endif // _WX_ANYBUTTON_H_BASE_ diff --git a/Externals/wxWidgets3/include/wx/app.h b/Externals/wxWidgets3/include/wx/app.h index d4b1fae4f1..64f1220629 100644 --- a/Externals/wxWidgets3/include/wx/app.h +++ b/Externals/wxWidgets3/include/wx/app.h @@ -5,7 +5,7 @@ // Author: Julian Smart // Modified by: // Created: 01/02/97 -// RCS-ID: $Id: app.h 66648 2011-01-08 06:42:41Z PC $ +// RCS-ID: $Id: app.h 70353 2012-01-15 14:46:41Z VZ $ // Copyright: (c) Julian Smart // Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// @@ -18,6 +18,7 @@ // ---------------------------------------------------------------------------- #include "wx/event.h" // for the base class +#include "wx/eventfilter.h" // (and another one) #include "wx/build.h" #include "wx/cmdargs.h" // for wxCmdLineArgsArray used by wxApp::argv #include "wx/init.h" // we must declare wxEntry() @@ -70,7 +71,8 @@ extern WXDLLIMPEXP_DATA_BASE(wxList) wxPendingDelete; // wxAppConsoleBase: wxApp for non-GUI applications // ---------------------------------------------------------------------------- -class WXDLLIMPEXP_BASE wxAppConsoleBase : public wxEvtHandler +class WXDLLIMPEXP_BASE wxAppConsoleBase : public wxEvtHandler, + public wxEventFilter { public: // ctor and dtor @@ -238,13 +240,8 @@ public: // event processing functions // -------------------------- - // this method allows to filter all the events processed by the program, so - // you should try to return quickly from it to avoid slowing down the - // program to the crawl - // - // return value should be -1 to continue with the normal event processing, - // or TRUE or FALSE to stop further processing and pretend that the event - // had been already processed or won't be processed at all, respectively + // Implement the inherited wxEventFilter method but just return -1 from it + // to indicate that default processing should take place. virtual int FilterEvent(wxEvent& event); // return true if we're running event loop, i.e. if the events can @@ -595,10 +592,10 @@ public: // ------------------------------------------------------------------------ // Get display mode that is used use. This is only used in framebuffer - // wxWin ports (such as wxMGL or wxDFB). + // wxWin ports such as wxDFB. virtual wxVideoMode GetDisplayMode() const; // Set display mode to use. This is only used in framebuffer wxWin - // ports (such as wxMGL or wxDFB). This method should be called from + // ports such as wxDFB. This method should be called from // wxApp::OnInitGui virtual bool SetDisplayMode(const wxVideoMode& WXUNUSED(info)) { return true; } @@ -684,14 +681,10 @@ protected: // now include the declaration of the real class // ---------------------------------------------------------------------------- -#if defined(__WXPALMOS__) - #include "wx/palmos/app.h" -#elif defined(__WXMSW__) +#if defined(__WXMSW__) #include "wx/msw/app.h" #elif defined(__WXMOTIF__) #include "wx/motif/app.h" -#elif defined(__WXMGL__) - #include "wx/mgl/app.h" #elif defined(__WXDFB__) #include "wx/dfb/app.h" #elif defined(__WXGTK20__) diff --git a/Externals/wxWidgets3/include/wx/apptrait.h b/Externals/wxWidgets3/include/wx/apptrait.h index 2e29c20e5b..4dbf8d218c 100644 --- a/Externals/wxWidgets3/include/wx/apptrait.h +++ b/Externals/wxWidgets3/include/wx/apptrait.h @@ -4,7 +4,7 @@ // Author: Vadim Zeitlin // Modified by: // Created: 19.06.2003 -// RCS-ID: $Id: apptrait.h 61488 2009-07-21 14:16:44Z VZ $ +// RCS-ID: $Id: apptrait.h 70345 2012-01-15 01:05:28Z VZ $ // Copyright: (c) 2003 Vadim Zeitlin // Licence: wxWindows licence /////////////////////////////////////////////////////////////////////////////// @@ -177,9 +177,7 @@ private: // NB: test for __UNIX__ before __WXMAC__ as under Darwin we want to use the // Unix code (and otherwise __UNIX__ wouldn't be defined) // ABX: check __WIN32__ instead of __WXMSW__ for the same MSWBase in any Win32 port -#if defined(__WXPALMOS__) - #include "wx/palmos/apptbase.h" -#elif defined(__WIN32__) +#if defined(__WIN32__) #include "wx/msw/apptbase.h" #elif defined(__UNIX__) && !defined(__EMX__) #include "wx/unix/apptbase.h" @@ -274,9 +272,7 @@ public: // ---------------------------------------------------------------------------- // ABX: check __WIN32__ instead of __WXMSW__ for the same MSWBase in any Win32 port -#if defined(__WXPALMOS__) - #include "wx/palmos/apptrait.h" -#elif defined(__WIN32__) +#if defined(__WIN32__) #include "wx/msw/apptrait.h" #elif defined(__OS2__) #include "wx/os2/apptrait.h" diff --git a/Externals/wxWidgets3/include/wx/arrstr.h b/Externals/wxWidgets3/include/wx/arrstr.h index ad8a52e62c..76343c71e5 100644 --- a/Externals/wxWidgets3/include/wx/arrstr.h +++ b/Externals/wxWidgets3/include/wx/arrstr.h @@ -4,7 +4,7 @@ // Author: Mattia Barbon and Vadim Zeitlin // Modified by: // Created: 07/07/03 -// RCS-ID: $Id: arrstr.h 66724 2011-01-20 08:38:36Z SC $ +// RCS-ID: $Id: arrstr.h 67343 2011-03-30 14:16:04Z VZ $ // Copyright: (c) 2003 Vadim Zeitlin // Licence: wxWindows licence /////////////////////////////////////////////////////////////////////////////// @@ -28,7 +28,7 @@ inline int wxCMPFUNC_CONV wxStringSortDescending(wxString* s1, wxString* s2) return wxStringSortAscending(s2, s1); } -#if wxUSE_STL +#if wxUSE_STD_CONTAINERS #include "wx/dynarray.h" @@ -100,7 +100,7 @@ private: } }; -#else // if !wxUSE_STL +#else // if !wxUSE_STD_CONTAINERS // this shouldn't be defined for compilers not supporting template methods or // without std::distance() @@ -384,7 +384,7 @@ public: { Copy(array); } }; -#endif // !wxUSE_STL +#endif // !wxUSE_STD_CONTAINERS // this class provides a temporary wxString* from a // wxArrayString diff --git a/Externals/wxWidgets3/include/wx/atomic.h b/Externals/wxWidgets3/include/wx/atomic.h index 38b0f8171f..0c53ebef93 100644 --- a/Externals/wxWidgets3/include/wx/atomic.h +++ b/Externals/wxWidgets3/include/wx/atomic.h @@ -3,7 +3,7 @@ // Purpose: functions to manipulate atomically integers and pointers // Author: Armel Asselin // Created: 12/13/2006 -// RCS-ID: $Id: atomic.h 53954 2008-06-02 20:42:23Z VZ $ +// RCS-ID: $Id: atomic.h 70808 2012-03-04 20:31:42Z VZ $ // Copyright: (c) Armel Asselin // Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// @@ -43,7 +43,7 @@ inline wxUint32 wxAtomicDec (wxUint32 &value) } -#elif defined(__WXMSW__) +#elif defined(__WINDOWS__) // include standard Windows headers #include "wx/msw/wrapwin.h" diff --git a/Externals/wxWidgets3/include/wx/aui/auibar.h b/Externals/wxWidgets3/include/wx/aui/auibar.h index d73b8caed1..3440840a3b 100644 --- a/Externals/wxWidgets3/include/wx/aui/auibar.h +++ b/Externals/wxWidgets3/include/wx/aui/auibar.h @@ -4,7 +4,7 @@ // Author: Benjamin I. Williams // Modified by: // Created: 2008-08-04 -// RCS-ID: $Id: auibar.h 66546 2011-01-03 18:43:30Z VZ $ +// RCS-ID: $Id: auibar.h 69594 2011-10-30 16:51:10Z VZ $ // Copyright: (C) Copyright 2005, Kirix Corporation, All Rights Reserved. // Licence: wxWindows Library Licence, Version 3.1 /////////////////////////////////////////////////////////////////////////////// @@ -65,44 +65,44 @@ enum wxAuiToolBarToolTextOrientation class WXDLLIMPEXP_AUI wxAuiToolBarEvent : public wxNotifyEvent { public: - wxAuiToolBarEvent(wxEventType command_type = wxEVT_NULL, - int win_id = 0) - : wxNotifyEvent(command_type, win_id) + wxAuiToolBarEvent(wxEventType commandType = wxEVT_NULL, + int winId = 0) + : wxNotifyEvent(commandType, winId) { - is_dropdown_clicked = false; - click_pt = wxPoint(-1, -1); - rect = wxRect(-1,-1, 0, 0); - tool_id = -1; + m_isDropdownClicked = false; + m_clickPt = wxPoint(-1, -1); + m_rect = wxRect(-1,-1, 0, 0); + m_toolId = -1; } #ifndef SWIG wxAuiToolBarEvent(const wxAuiToolBarEvent& c) : wxNotifyEvent(c) { - is_dropdown_clicked = c.is_dropdown_clicked; - click_pt = c.click_pt; - rect = c.rect; - tool_id = c.tool_id; + m_isDropdownClicked = c.m_isDropdownClicked; + m_clickPt = c.m_clickPt; + m_rect = c.m_rect; + m_toolId = c.m_toolId; } #endif wxEvent *Clone() const { return new wxAuiToolBarEvent(*this); } - bool IsDropDownClicked() const { return is_dropdown_clicked; } - void SetDropDownClicked(bool c) { is_dropdown_clicked = c; } + bool IsDropDownClicked() const { return m_isDropdownClicked; } + void SetDropDownClicked(bool c) { m_isDropdownClicked = c; } - wxPoint GetClickPoint() const { return click_pt; } - void SetClickPoint(const wxPoint& p) { click_pt = p; } + wxPoint GetClickPoint() const { return m_clickPt; } + void SetClickPoint(const wxPoint& p) { m_clickPt = p; } - wxRect GetItemRect() const { return rect; } - void SetItemRect(const wxRect& r) { rect = r; } + wxRect GetItemRect() const { return m_rect; } + void SetItemRect(const wxRect& r) { m_rect = r; } - int GetToolId() const { return tool_id; } - void SetToolId(int toolid) { tool_id = toolid; } + int GetToolId() const { return m_toolId; } + void SetToolId(int toolId) { m_toolId = toolId; } private: - bool is_dropdown_clicked; - wxPoint click_pt; - wxRect rect; - int tool_id; + bool m_isDropdownClicked; + wxPoint m_clickPt; + wxRect m_rect; + int m_toolId; private: DECLARE_DYNAMIC_CLASS_NO_ASSIGN(wxAuiToolBarEvent) @@ -117,18 +117,18 @@ public: wxAuiToolBarItem() { - window = NULL; - sizer_item = NULL; - spacer_pixels = 0; - toolid = 0; - kind = wxITEM_NORMAL; - state = 0; // normal, enabled - proportion = 0; - active = true; - dropdown = true; - sticky = true; - user_data = 0; - alignment = wxALIGN_CENTER; + m_window = NULL; + m_sizerItem = NULL; + m_spacerPixels = 0; + m_toolId = 0; + m_kind = wxITEM_NORMAL; + m_state = 0; // normal, enabled + m_proportion = 0; + m_active = true; + m_dropDown = true; + m_sticky = true; + m_userData = 0; + m_alignment = wxALIGN_CENTER; } wxAuiToolBarItem(const wxAuiToolBarItem& c) @@ -144,106 +144,106 @@ public: void Assign(const wxAuiToolBarItem& c) { - window = c.window; - label = c.label; - bitmap = c.bitmap; - disabled_bitmap = c.disabled_bitmap; - hover_bitmap = c.hover_bitmap; - short_help = c.short_help; - long_help = c.long_help; - sizer_item = c.sizer_item; - min_size = c.min_size; - spacer_pixels = c.spacer_pixels; - toolid = c.toolid; - kind = c.kind; - state = c.state; - proportion = c.proportion; - active = c.active; - dropdown = c.dropdown; - sticky = c.sticky; - user_data = c.user_data; - alignment = c.alignment; + m_window = c.m_window; + m_label = c.m_label; + m_bitmap = c.m_bitmap; + m_disabledBitmap = c.m_disabledBitmap; + m_hoverBitmap = c.m_hoverBitmap; + m_shortHelp = c.m_shortHelp; + m_longHelp = c.m_longHelp; + m_sizerItem = c.m_sizerItem; + m_minSize = c.m_minSize; + m_spacerPixels = c.m_spacerPixels; + m_toolId = c.m_toolId; + m_kind = c.m_kind; + m_state = c.m_state; + m_proportion = c.m_proportion; + m_active = c.m_active; + m_dropDown = c.m_dropDown; + m_sticky = c.m_sticky; + m_userData = c.m_userData; + m_alignment = c.m_alignment; } - void SetWindow(wxWindow* w) { window = w; } - wxWindow* GetWindow() { return window; } + void SetWindow(wxWindow* w) { m_window = w; } + wxWindow* GetWindow() { return m_window; } - void SetId(int new_id) { toolid = new_id; } - int GetId() const { return toolid; } + void SetId(int newId) { m_toolId = newId; } + int GetId() const { return m_toolId; } - void SetKind(int new_kind) { kind = new_kind; } - int GetKind() const { return kind; } + void SetKind(int newKind) { m_kind = newKind; } + int GetKind() const { return m_kind; } - void SetState(int new_state) { state = new_state; } - int GetState() const { return state; } + void SetState(int newState) { m_state = newState; } + int GetState() const { return m_state; } - void SetSizerItem(wxSizerItem* s) { sizer_item = s; } - wxSizerItem* GetSizerItem() const { return sizer_item; } + void SetSizerItem(wxSizerItem* s) { m_sizerItem = s; } + wxSizerItem* GetSizerItem() const { return m_sizerItem; } - void SetLabel(const wxString& s) { label = s; } - const wxString& GetLabel() const { return label; } + void SetLabel(const wxString& s) { m_label = s; } + const wxString& GetLabel() const { return m_label; } - void SetBitmap(const wxBitmap& bmp) { bitmap = bmp; } - const wxBitmap& GetBitmap() const { return bitmap; } + void SetBitmap(const wxBitmap& bmp) { m_bitmap = bmp; } + const wxBitmap& GetBitmap() const { return m_bitmap; } - void SetDisabledBitmap(const wxBitmap& bmp) { disabled_bitmap = bmp; } - const wxBitmap& GetDisabledBitmap() const { return disabled_bitmap; } + void SetDisabledBitmap(const wxBitmap& bmp) { m_disabledBitmap = bmp; } + const wxBitmap& GetDisabledBitmap() const { return m_disabledBitmap; } - void SetHoverBitmap(const wxBitmap& bmp) { hover_bitmap = bmp; } - const wxBitmap& GetHoverBitmap() const { return hover_bitmap; } + void SetHoverBitmap(const wxBitmap& bmp) { m_hoverBitmap = bmp; } + const wxBitmap& GetHoverBitmap() const { return m_hoverBitmap; } - void SetShortHelp(const wxString& s) { short_help = s; } - const wxString& GetShortHelp() const { return short_help; } + void SetShortHelp(const wxString& s) { m_shortHelp = s; } + const wxString& GetShortHelp() const { return m_shortHelp; } - void SetLongHelp(const wxString& s) { long_help = s; } - const wxString& GetLongHelp() const { return long_help; } + void SetLongHelp(const wxString& s) { m_longHelp = s; } + const wxString& GetLongHelp() const { return m_longHelp; } - void SetMinSize(const wxSize& s) { min_size = s; } - const wxSize& GetMinSize() const { return min_size; } + void SetMinSize(const wxSize& s) { m_minSize = s; } + const wxSize& GetMinSize() const { return m_minSize; } - void SetSpacerPixels(int s) { spacer_pixels = s; } - int GetSpacerPixels() const { return spacer_pixels; } + void SetSpacerPixels(int s) { m_spacerPixels = s; } + int GetSpacerPixels() const { return m_spacerPixels; } - void SetProportion(int p) { proportion = p; } - int GetProportion() const { return proportion; } + void SetProportion(int p) { m_proportion = p; } + int GetProportion() const { return m_proportion; } - void SetActive(bool b) { active = b; } - bool IsActive() const { return active; } + void SetActive(bool b) { m_active = b; } + bool IsActive() const { return m_active; } - void SetHasDropDown(bool b) { dropdown = b; } - bool HasDropDown() const { return dropdown; } + void SetHasDropDown(bool b) { m_dropDown = b; } + bool HasDropDown() const { return m_dropDown; } - void SetSticky(bool b) { sticky = b; } - bool IsSticky() const { return sticky; } + void SetSticky(bool b) { m_sticky = b; } + bool IsSticky() const { return m_sticky; } - void SetUserData(long l) { user_data = l; } - long GetUserData() const { return user_data; } + void SetUserData(long l) { m_userData = l; } + long GetUserData() const { return m_userData; } - void SetAlignment(int l) { alignment = l; } - int GetAlignment() const { return alignment; } + void SetAlignment(int l) { m_alignment = l; } + int GetAlignment() const { return m_alignment; } private: - wxWindow* window; // item's associated window - wxString label; // label displayed on the item - wxBitmap bitmap; // item's bitmap - wxBitmap disabled_bitmap; // item's disabled bitmap - wxBitmap hover_bitmap; // item's hover bitmap - wxString short_help; // short help (for tooltip) - wxString long_help; // long help (for status bar) - wxSizerItem* sizer_item; // sizer item - wxSize min_size; // item's minimum size - int spacer_pixels; // size of a spacer - int toolid; // item's id - int kind; // item's kind - int state; // state - int proportion; // proportion - bool active; // true if the item is currently active - bool dropdown; // true if the item has a dropdown button - bool sticky; // overrides button states if true (always active) - long user_data; // user-specified data - int alignment; // sizer alignment flag, defaults to wxCENTER, may be wxEXPAND or any other + wxWindow* m_window; // item's associated window + wxString m_label; // label displayed on the item + wxBitmap m_bitmap; // item's bitmap + wxBitmap m_disabledBitmap; // item's disabled bitmap + wxBitmap m_hoverBitmap; // item's hover bitmap + wxString m_shortHelp; // short help (for tooltip) + wxString m_longHelp; // long help (for status bar) + wxSizerItem* m_sizerItem; // sizer item + wxSize m_minSize; // item's minimum size + int m_spacerPixels; // size of a spacer + int m_toolId; // item's id + int m_kind; // item's kind + int m_state; // state + int m_proportion; // proportion + bool m_active; // true if the item is currently active + bool m_dropDown; // true if the item has a dropdown button + bool m_sticky; // overrides button states if true (always active) + long m_userData; // user-specified data + int m_alignment; // sizer alignment flag, defaults to wxCENTER, may be wxEXPAND or any other }; #ifndef SWIG @@ -325,8 +325,8 @@ public: wxWindow* wnd, const wxAuiToolBarItem& item) = 0; - virtual int GetElementSize(int element_id) = 0; - virtual void SetElementSize(int element_id, int size) = 0; + virtual int GetElementSize(int elementId) = 0; + virtual void SetElementSize(int elementId, int size) = 0; virtual int ShowDropDown( wxWindow* wnd, @@ -407,30 +407,30 @@ public: const wxAuiToolBarItem& item); virtual int GetElementSize(int element); - virtual void SetElementSize(int element_id, int size); + virtual void SetElementSize(int elementId, int size); virtual int ShowDropDown(wxWindow* wnd, const wxAuiToolBarItemArray& items); protected: - wxBitmap m_button_dropdown_bmp; - wxBitmap m_disabled_button_dropdown_bmp; - wxBitmap m_overflow_bmp; - wxBitmap m_disabled_overflow_bmp; - wxColour m_base_colour; - wxColour m_highlight_colour; + wxBitmap m_buttonDropDownBmp; + wxBitmap m_disabledButtonDropDownBmp; + wxBitmap m_overflowBmp; + wxBitmap m_disabledOverflowBmp; + wxColour m_baseColour; + wxColour m_highlightColour; wxFont m_font; unsigned int m_flags; - int m_text_orientation; + int m_textOrientation; - wxPen m_gripper_pen1; - wxPen m_gripper_pen2; - wxPen m_gripper_pen3; + wxPen m_gripperPen1; + wxPen m_gripperPen2; + wxPen m_gripperPen3; - int m_separator_size; - int m_gripper_size; - int m_overflow_size; + int m_separatorSize; + int m_gripperSize; + int m_overflowSize; }; @@ -456,40 +456,40 @@ public: bool SetFont(const wxFont& font); - wxAuiToolBarItem* AddTool(int tool_id, + wxAuiToolBarItem* AddTool(int toolId, const wxString& label, const wxBitmap& bitmap, - const wxString& short_help_string = wxEmptyString, + const wxString& shortHelpString = wxEmptyString, wxItemKind kind = wxITEM_NORMAL); - wxAuiToolBarItem* AddTool(int tool_id, + wxAuiToolBarItem* AddTool(int toolId, const wxString& label, const wxBitmap& bitmap, - const wxBitmap& disabled_bitmap, + const wxBitmap& disabledBitmap, wxItemKind kind, - const wxString& short_help_string, - const wxString& long_help_string, - wxObject* client_data); + const wxString& shortHelpString, + const wxString& longHelpString, + wxObject* clientData); - wxAuiToolBarItem* AddTool(int tool_id, + wxAuiToolBarItem* AddTool(int toolId, const wxBitmap& bitmap, - const wxBitmap& disabled_bitmap, + const wxBitmap& disabledBitmap, bool toggle = false, - wxObject* client_data = NULL, - const wxString& short_help_string = wxEmptyString, - const wxString& long_help_string = wxEmptyString) + wxObject* clientData = NULL, + const wxString& shortHelpString = wxEmptyString, + const wxString& longHelpString = wxEmptyString) { - return AddTool(tool_id, + return AddTool(toolId, wxEmptyString, bitmap, - disabled_bitmap, + disabledBitmap, toggle ? wxITEM_CHECK : wxITEM_NORMAL, - short_help_string, - long_help_string, - client_data); + shortHelpString, + longHelpString, + clientData); } - wxAuiToolBarItem* AddLabel(int tool_id, + wxAuiToolBarItem* AddLabel(int toolId, const wxString& label = wxEmptyString, const int width = -1); wxAuiToolBarItem* AddControl(wxControl* control, @@ -500,22 +500,22 @@ public: bool Realize(); - wxControl* FindControl(int window_id); + wxControl* FindControl(int windowId); wxAuiToolBarItem* FindToolByPosition(wxCoord x, wxCoord y) const; wxAuiToolBarItem* FindToolByIndex(int idx) const; - wxAuiToolBarItem* FindTool(int tool_id) const; + wxAuiToolBarItem* FindTool(int toolId) const; void ClearTools() { Clear() ; } void Clear(); - bool DeleteTool(int tool_id); - bool DeleteByIndex(int tool_id); + bool DeleteTool(int toolId); + bool DeleteByIndex(int toolId); size_t GetToolCount() const; - int GetToolPos(int tool_id) const { return GetToolIndex(tool_id); } - int GetToolIndex(int tool_id) const; - bool GetToolFits(int tool_id) const; - wxRect GetToolRect(int tool_id) const; - bool GetToolFitsByIndex(int tool_id) const; + int GetToolPos(int toolId) const { return GetToolIndex(toolId); } + int GetToolIndex(int toolId) const; + bool GetToolFits(int toolId) const; + wxRect GetToolRect(int toolId) const; + bool GetToolFitsByIndex(int toolId) const; bool GetToolBarFits() const; void SetMargins(const wxSize& size) { SetMargins(size.x, size.x, size.y, size.y); } @@ -531,14 +531,14 @@ public: bool GetGripperVisible() const; void SetGripperVisible(bool visible); - void ToggleTool(int tool_id, bool state); - bool GetToolToggled(int tool_id) const; + void ToggleTool(int toolId, bool state); + bool GetToolToggled(int toolId) const; - void EnableTool(int tool_id, bool state); - bool GetToolEnabled(int tool_id) const; + void EnableTool(int toolId, bool state); + bool GetToolEnabled(int toolId) const; - void SetToolDropDown(int tool_id, bool dropdown); - bool GetToolDropDown(int tool_id) const; + void SetToolDropDown(int toolId, bool dropdown); + bool GetToolDropDown(int toolId) const; void SetToolBorderPadding(int padding); int GetToolBorderPadding() const; @@ -549,34 +549,37 @@ public: void SetToolPacking(int packing); int GetToolPacking() const; - void SetToolProportion(int tool_id, int proportion); - int GetToolProportion(int tool_id) const; + void SetToolProportion(int toolId, int proportion); + int GetToolProportion(int toolId) const; void SetToolSeparation(int separation); int GetToolSeparation() const; - void SetToolSticky(int tool_id, bool sticky); - bool GetToolSticky(int tool_id) const; + void SetToolSticky(int toolId, bool sticky); + bool GetToolSticky(int toolId) const; - wxString GetToolLabel(int tool_id) const; - void SetToolLabel(int tool_id, const wxString& label); + wxString GetToolLabel(int toolId) const; + void SetToolLabel(int toolId, const wxString& label); - wxBitmap GetToolBitmap(int tool_id) const; - void SetToolBitmap(int tool_id, const wxBitmap& bitmap); + wxBitmap GetToolBitmap(int toolId) const; + void SetToolBitmap(int toolId, const wxBitmap& bitmap); - wxString GetToolShortHelp(int tool_id) const; - void SetToolShortHelp(int tool_id, const wxString& help_string); + wxString GetToolShortHelp(int toolId) const; + void SetToolShortHelp(int toolId, const wxString& helpString); - wxString GetToolLongHelp(int tool_id) const; - void SetToolLongHelp(int tool_id, const wxString& help_string); + wxString GetToolLongHelp(int toolId) const; + void SetToolLongHelp(int toolId, const wxString& helpString); void SetCustomOverflowItems(const wxAuiToolBarItemArray& prepend, const wxAuiToolBarItemArray& append); // get size of hint rectangle for a particular dock location - wxSize GetHintSize(int dock_direction) const; + wxSize GetHintSize(int dockDirection) const; bool IsPaneValid(const wxAuiPaneInfo& pane) const; + // Override to call DoIdleUpdate(). + virtual void UpdateWindowUI(long flags = wxUPDATE_UI_NONE); + protected: virtual void OnCustomRender(wxDC& WXUNUSED(dc), @@ -624,30 +627,30 @@ protected: wxAuiToolBarItemArray m_items; // array of toolbar items wxAuiToolBarArt* m_art; // art provider wxBoxSizer* m_sizer; // main sizer for toolbar - wxAuiToolBarItem* m_action_item; // item that's being acted upon (pressed) - wxAuiToolBarItem* m_tip_item; // item that has its tooltip shown + wxAuiToolBarItem* m_actionItem; // item that's being acted upon (pressed) + wxAuiToolBarItem* m_tipItem; // item that has its tooltip shown wxBitmap m_bitmap; // double-buffer bitmap - wxSizerItem* m_gripper_sizer_item; - wxSizerItem* m_overflow_sizer_item; - wxSize m_absolute_min_size; - wxPoint m_action_pos; // position of left-mouse down - wxAuiToolBarItemArray m_custom_overflow_prepend; - wxAuiToolBarItemArray m_custom_overflow_append; + wxSizerItem* m_gripperSizerItem; + wxSizerItem* m_overflowSizerItem; + wxSize m_absoluteMinSize; + wxPoint m_actionPos; // position of left-mouse down + wxAuiToolBarItemArray m_customOverflowPrepend; + wxAuiToolBarItemArray m_customOverflowAppend; - int m_button_width; - int m_button_height; - int m_sizer_element_count; - int m_left_padding; - int m_right_padding; - int m_top_padding; - int m_bottom_padding; - int m_tool_packing; - int m_tool_border_padding; - int m_tool_text_orientation; - int m_overflow_state; + int m_buttonWidth; + int m_buttonHeight; + int m_sizerElementCount; + int m_leftPadding; + int m_rightPadding; + int m_topPadding; + int m_bottomPadding; + int m_toolPacking; + int m_toolBorderPadding; + int m_toolTextOrientation; + int m_overflowState; bool m_dragging; - bool m_gripper_visible; - bool m_overflow_visible; + bool m_gripperVisible; + bool m_overflowVisible; long m_style; bool RealizeHelper(wxClientDC& dc, bool horizontal); diff --git a/Externals/wxWidgets3/include/wx/aui/auibook.h b/Externals/wxWidgets3/include/wx/aui/auibook.h index 5fa37345d2..e8e4527ff6 100644 --- a/Externals/wxWidgets3/include/wx/aui/auibook.h +++ b/Externals/wxWidgets3/include/wx/aui/auibook.h @@ -24,7 +24,7 @@ #include "wx/aui/framemanager.h" #include "wx/aui/dockart.h" #include "wx/aui/floatpane.h" -#include "wx/control.h" +#include "wx/bookctrl.h" class wxAuiNotebook; @@ -60,40 +60,28 @@ enum wxAuiNotebookOption // aui notebook event class -class WXDLLIMPEXP_AUI wxAuiNotebookEvent : public wxNotifyEvent +class WXDLLIMPEXP_AUI wxAuiNotebookEvent : public wxBookCtrlEvent { public: - wxAuiNotebookEvent(wxEventType command_type = wxEVT_NULL, - int win_id = 0) - : wxNotifyEvent(command_type, win_id) + wxAuiNotebookEvent(wxEventType commandType = wxEVT_NULL, + int winId = 0) + : wxBookCtrlEvent(commandType, winId) { - old_selection = -1; - selection = -1; - drag_source = NULL; + m_dragSource = NULL; } #ifndef SWIG - wxAuiNotebookEvent(const wxAuiNotebookEvent& c) : wxNotifyEvent(c) + wxAuiNotebookEvent(const wxAuiNotebookEvent& c) : wxBookCtrlEvent(c) { - old_selection = c.old_selection; - selection = c.selection; - drag_source = c.drag_source; + m_dragSource = c.m_dragSource; } #endif wxEvent *Clone() const { return new wxAuiNotebookEvent(*this); } - void SetSelection(int s) { selection = s; m_commandInt = s; } - int GetSelection() const { return selection; } + void SetDragSource(wxAuiNotebook* s) { m_dragSource = s; } + wxAuiNotebook* GetDragSource() const { return m_dragSource; } - void SetOldSelection(int s) { old_selection = s; } - int GetOldSelection() const { return old_selection; } - - void SetDragSource(wxAuiNotebook* s) { drag_source = s; } - wxAuiNotebook* GetDragSource() const { return drag_source; } - -public: - int old_selection; - int selection; - wxAuiNotebook* drag_source; +private: + wxAuiNotebook* m_dragSource; #ifndef SWIG private: @@ -117,10 +105,10 @@ class WXDLLIMPEXP_AUI wxAuiTabContainerButton public: int id; // button's id - int cur_state; // current state (normal, hover, pressed, etc.) + int curState; // current state (normal, hover, pressed, etc.) int location; // buttons location (wxLEFT, wxRIGHT, or wxCENTER) wxBitmap bitmap; // button's hover bitmap - wxBitmap dis_bitmap; // button's disabled bitmap + wxBitmap disBitmap; // button's disabled bitmap wxRect rect; // button's hit rectangle }; @@ -143,12 +131,14 @@ public: virtual wxAuiTabArt* Clone() = 0; virtual void SetFlags(unsigned int flags) = 0; - virtual void SetSizingInfo(const wxSize& tab_ctrl_size, - size_t tab_count) = 0; + virtual void SetSizingInfo(const wxSize& tabCtrlSize, + size_t tabCount) = 0; virtual void SetNormalFont(const wxFont& font) = 0; virtual void SetSelectedFont(const wxFont& font) = 0; virtual void SetMeasuringFont(const wxFont& font) = 0; + virtual void SetColour(const wxColour& colour) = 0; + virtual void SetActiveColour(const wxColour& colour) = 0; virtual void DrawBackground( wxDC& dc, @@ -158,20 +148,20 @@ public: virtual void DrawTab(wxDC& dc, wxWindow* wnd, const wxAuiNotebookPage& pane, - const wxRect& in_rect, - int close_button_state, - wxRect* out_tab_rect, - wxRect* out_button_rect, - int* x_extent) = 0; + const wxRect& inRect, + int closeButtonState, + wxRect* outTabRect, + wxRect* outButtonRect, + int* xExtent) = 0; virtual void DrawButton( wxDC& dc, wxWindow* wnd, - const wxRect& in_rect, - int bitmap_id, - int button_state, + const wxRect& inRect, + int bitmapId, + int buttonState, int orientation, - wxRect* out_rect) = 0; + wxRect* outRect) = 0; virtual wxSize GetTabSize( wxDC& dc, @@ -179,20 +169,20 @@ public: const wxString& caption, const wxBitmap& bitmap, bool active, - int close_button_state, - int* x_extent) = 0; + int closeButtonState, + int* xExtent) = 0; virtual int ShowDropDown( wxWindow* wnd, const wxAuiNotebookPageArray& items, - int active_idx) = 0; + int activeIdx) = 0; virtual int GetIndentSize() = 0; virtual int GetBestTabCtrlSize( wxWindow* wnd, const wxAuiNotebookPageArray& pages, - const wxSize& required_bmp_size) = 0; + const wxSize& requiredBmpSize) = 0; }; @@ -206,12 +196,14 @@ public: wxAuiTabArt* Clone(); void SetFlags(unsigned int flags); - void SetSizingInfo(const wxSize& tab_ctrl_size, - size_t tab_count); + void SetSizingInfo(const wxSize& tabCtrlSize, + size_t tabCount); void SetNormalFont(const wxFont& font); void SetSelectedFont(const wxFont& font); void SetMeasuringFont(const wxFont& font); + void SetColour(const wxColour& colour); + void SetActiveColour(const wxColour& colour); void DrawBackground( wxDC& dc, @@ -221,20 +213,20 @@ public: void DrawTab(wxDC& dc, wxWindow* wnd, const wxAuiNotebookPage& pane, - const wxRect& in_rect, - int close_button_state, - wxRect* out_tab_rect, - wxRect* out_button_rect, - int* x_extent); + const wxRect& inRect, + int closeButtonState, + wxRect* outTabRect, + wxRect* outButtonRect, + int* xExtent); void DrawButton( wxDC& dc, wxWindow* wnd, - const wxRect& in_rect, - int bitmap_id, - int button_state, + const wxRect& inRect, + int bitmapId, + int buttonState, int orientation, - wxRect* out_rect); + wxRect* outRect); int GetIndentSize(); @@ -244,38 +236,39 @@ public: const wxString& caption, const wxBitmap& bitmap, bool active, - int close_button_state, - int* x_extent); + int closeButtonState, + int* xExtent); int ShowDropDown( wxWindow* wnd, const wxAuiNotebookPageArray& items, - int active_idx); + int activeIdx); int GetBestTabCtrlSize(wxWindow* wnd, const wxAuiNotebookPageArray& pages, - const wxSize& required_bmp_size); + const wxSize& requiredBmpSize); protected: - wxFont m_normal_font; - wxFont m_selected_font; - wxFont m_measuring_font; - wxColour m_base_colour; - wxPen m_base_colour_pen; - wxPen m_border_pen; - wxBrush m_base_colour_brush; - wxBitmap m_active_close_bmp; - wxBitmap m_disabled_close_bmp; - wxBitmap m_active_left_bmp; - wxBitmap m_disabled_left_bmp; - wxBitmap m_active_right_bmp; - wxBitmap m_disabled_right_bmp; - wxBitmap m_active_windowlist_bmp; - wxBitmap m_disabled_windowlist_bmp; + wxFont m_normalFont; + wxFont m_selectedFont; + wxFont m_measuringFont; + wxColour m_baseColour; + wxPen m_baseColourPen; + wxPen m_borderPen; + wxBrush m_baseColourBrush; + wxColour m_activeColour; + wxBitmap m_activeCloseBmp; + wxBitmap m_disabledCloseBmp; + wxBitmap m_activeLeftBmp; + wxBitmap m_disabledLeftBmp; + wxBitmap m_activeRightBmp; + wxBitmap m_disabledRightBmp; + wxBitmap m_activeWindowListBmp; + wxBitmap m_disabledWindowListBmp; - int m_fixed_tab_width; - int m_tab_ctrl_height; + int m_fixedTabWidth; + int m_tabCtrlHeight; unsigned int m_flags; }; @@ -291,12 +284,14 @@ public: wxAuiTabArt* Clone(); void SetFlags(unsigned int flags); - void SetSizingInfo(const wxSize& tab_ctrl_size, - size_t tab_count); + void SetSizingInfo(const wxSize& tabCtrlSize, + size_t tabCount); void SetNormalFont(const wxFont& font); void SetSelectedFont(const wxFont& font); void SetMeasuringFont(const wxFont& font); + void SetColour(const wxColour& colour); + void SetActiveColour(const wxColour& colour); void DrawBackground( wxDC& dc, @@ -306,20 +301,20 @@ public: void DrawTab(wxDC& dc, wxWindow* wnd, const wxAuiNotebookPage& pane, - const wxRect& in_rect, - int close_button_state, - wxRect* out_tab_rect, - wxRect* out_button_rect, - int* x_extent); + const wxRect& inRect, + int closeButtonState, + wxRect* outTabRect, + wxRect* outButtonRect, + int* xExtent); void DrawButton( wxDC& dc, wxWindow* wnd, - const wxRect& in_rect, - int bitmap_id, - int button_state, + const wxRect& inRect, + int bitmapId, + int buttonState, int orientation, - wxRect* out_rect); + wxRect* outRect); int GetIndentSize(); @@ -329,38 +324,38 @@ public: const wxString& caption, const wxBitmap& bitmap, bool active, - int close_button_state, - int* x_extent); + int closeButtonState, + int* xExtent); int ShowDropDown( wxWindow* wnd, const wxAuiNotebookPageArray& items, - int active_idx); + int activeIdx); int GetBestTabCtrlSize(wxWindow* wnd, const wxAuiNotebookPageArray& pages, - const wxSize& required_bmp_size); + const wxSize& requiredBmpSize); protected: - wxFont m_normal_font; - wxFont m_selected_font; - wxFont m_measuring_font; - wxPen m_normal_bkpen; - wxPen m_selected_bkpen; - wxBrush m_normal_bkbrush; - wxBrush m_selected_bkbrush; - wxBrush m_bkbrush; - wxBitmap m_active_close_bmp; - wxBitmap m_disabled_close_bmp; - wxBitmap m_active_left_bmp; - wxBitmap m_disabled_left_bmp; - wxBitmap m_active_right_bmp; - wxBitmap m_disabled_right_bmp; - wxBitmap m_active_windowlist_bmp; - wxBitmap m_disabled_windowlist_bmp; + wxFont m_normalFont; + wxFont m_selectedFont; + wxFont m_measuringFont; + wxPen m_normalBkPen; + wxPen m_selectedBkPen; + wxBrush m_normalBkBrush; + wxBrush m_selectedBkBrush; + wxBrush m_bkBrush; + wxBitmap m_activeCloseBmp; + wxBitmap m_disabledCloseBmp; + wxBitmap m_activeLeftBmp; + wxBitmap m_disabledLeftBmp; + wxBitmap m_activeRightBmp; + wxBitmap m_disabledRightBmp; + wxBitmap m_activeWindowListBmp; + wxBitmap m_disabledWindowListBmp; - int m_fixed_tab_width; + int m_fixedTabWidth; unsigned int m_flags; }; @@ -387,7 +382,7 @@ public: bool AddPage(wxWindow* page, const wxAuiNotebookPage& info); bool InsertPage(wxWindow* page, const wxAuiNotebookPage& info, size_t idx); - bool MovePage(wxWindow* page, size_t new_idx); + bool MovePage(wxWindow* page, size_t newIdx); bool RemovePage(wxWindow* page); bool SetActivePage(wxWindow* page); bool SetActivePage(size_t page); @@ -401,17 +396,19 @@ public: wxAuiNotebookPage& GetPage(size_t idx); const wxAuiNotebookPage& GetPage(size_t idx) const; wxAuiNotebookPageArray& GetPages(); - void SetNormalFont(const wxFont& normal_font); - void SetSelectedFont(const wxFont& selected_font); - void SetMeasuringFont(const wxFont& measuring_font); + void SetNormalFont(const wxFont& normalFont); + void SetSelectedFont(const wxFont& selectedFont); + void SetMeasuringFont(const wxFont& measuringFont); + void SetColour(const wxColour& colour); + void SetActiveColour(const wxColour& colour); void DoShowHide(); void SetRect(const wxRect& rect); void RemoveButton(int id); void AddButton(int id, int location, - const wxBitmap& normal_bitmap = wxNullBitmap, - const wxBitmap& disabled_bitmap = wxNullBitmap); + const wxBitmap& normalBitmap = wxNullBitmap, + const wxBitmap& disabledBitmap = wxNullBitmap); size_t GetTabOffset() const; void SetTabOffset(size_t offset); @@ -431,9 +428,9 @@ protected: wxAuiTabArt* m_art; wxAuiNotebookPageArray m_pages; wxAuiTabContainerButtonArray m_buttons; - wxAuiTabContainerButtonArray m_tab_close_buttons; + wxAuiTabContainerButtonArray m_tabCloseButtons; wxRect m_rect; - size_t m_tab_offset; + size_t m_tabOffset; unsigned int m_flags; }; @@ -452,7 +449,7 @@ public: ~wxAuiTabCtrl(); - bool IsDragging() const { return m_is_dragging; } + bool IsDragging() const { return m_isDragging; } protected: // choose the default border for this window @@ -478,11 +475,11 @@ protected: protected: - wxPoint m_click_pt; - wxWindow* m_click_tab; - bool m_is_dragging; - wxAuiTabContainerButton* m_hover_button; - wxAuiTabContainerButton* m_pressed_button; + wxPoint m_clickPt; + wxWindow* m_clickTab; + bool m_isDragging; + wxAuiTabContainerButton* m_hoverButton; + wxAuiTabContainerButton* m_pressedButton; #ifndef SWIG DECLARE_CLASS(wxAuiTabCtrl) @@ -493,18 +490,22 @@ protected: -class WXDLLIMPEXP_AUI wxAuiNotebook : public wxControl +class WXDLLIMPEXP_AUI wxAuiNotebook : public wxNavigationEnabled { public: - wxAuiNotebook(); + wxAuiNotebook() { Init(); } wxAuiNotebook(wxWindow* parent, wxWindowID id = wxID_ANY, const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize, - long style = wxAUI_NB_DEFAULT_STYLE); + long style = wxAUI_NB_DEFAULT_STYLE) + { + Init(); + Create(parent, id, pos, size, style); + } virtual ~wxAuiNotebook(); @@ -526,7 +527,7 @@ public: bool select = false, const wxBitmap& bitmap = wxNullBitmap); - bool InsertPage(size_t page_idx, + bool InsertPage(size_t pageIdx, wxWindow* page, const wxString& caption, bool select = false, @@ -536,16 +537,16 @@ public: bool RemovePage(size_t page); size_t GetPageCount() const; - wxWindow* GetPage(size_t page_idx) const; - int GetPageIndex(wxWindow* page_wnd) const; + wxWindow* GetPage(size_t pageIdx) const; + int GetPageIndex(wxWindow* pageWnd) const; bool SetPageText(size_t page, const wxString& text); - wxString GetPageText(size_t page_idx) const; + wxString GetPageText(size_t pageIdx) const; bool SetPageBitmap(size_t page, const wxBitmap& bitmap); - wxBitmap GetPageBitmap(size_t page_idx) const; + wxBitmap GetPageBitmap(size_t pageIdx) const; - size_t SetSelection(size_t new_page); + int SetSelection(size_t newPage); int GetSelection() const; virtual void Split(size_t page, int direction); @@ -585,7 +586,28 @@ public: // Redo sizing after thawing virtual void Thaw(); + //wxBookCtrlBase functions + + virtual void SetPageSize (const wxSize &size); + virtual int HitTest (const wxPoint &pt, long *flags=NULL) const; + + virtual int GetPageImage(size_t n) const; + virtual bool SetPageImage(size_t n, int imageId); + + wxWindow* GetCurrentPage () const; + + virtual int ChangeSelection(size_t n); + + virtual bool AddPage(wxWindow *page, const wxString &text, bool select, + int imageId); + virtual bool DeleteAllPages(); + virtual bool InsertPage(size_t index, wxWindow *page, const wxString &text, + bool select, int imageId); + protected: + // Common part of all ctors. + void Init(); + // choose the default border for this window virtual wxBorder GetDefaultBorder() const { return wxBORDER_NONE; } @@ -598,12 +620,18 @@ protected: virtual int CalculateTabCtrlHeight(); virtual wxSize CalculateNewSplitSize(); + // remove the page and return a pointer to it + virtual wxWindow *DoRemovePage(size_t WXUNUSED(page)) { return NULL; } + + //A general selection function + virtual int DoModifySelection(size_t n, bool events); + protected: void DoSizing(); void InitNotebook(long style); wxAuiTabCtrl* GetTabCtrlFromPoint(const wxPoint& pt); - wxWindow* GetTabFrameFromTabCtrl(wxWindow* tab_ctrl); + wxWindow* GetTabFrameFromTabCtrl(wxWindow* tabCtrl); wxAuiTabCtrl* GetActiveTabCtrl(); bool FindTab(wxWindow* page, wxAuiTabCtrl** ctrl, int* idx); void RemoveEmptyTabFrames(); @@ -618,6 +646,7 @@ protected: void OnTabBeginDrag(wxAuiNotebookEvent& evt); void OnTabDragMotion(wxAuiNotebookEvent& evt); void OnTabEndDrag(wxAuiNotebookEvent& evt); + void OnTabCancelDrag(wxAuiNotebookEvent& evt); void OnTabButton(wxAuiNotebookEvent& evt); void OnTabMiddleDown(wxAuiNotebookEvent& evt); void OnTabMiddleUp(wxAuiNotebookEvent& evt); @@ -638,26 +667,23 @@ protected: wxAuiManager m_mgr; wxAuiTabContainer m_tabs; - int m_curpage; - int m_tab_id_counter; - wxWindow* m_dummy_wnd; + int m_curPage; + int m_tabIdCounter; + wxWindow* m_dummyWnd; - wxSize m_requested_bmp_size; - int m_requested_tabctrl_height; - wxFont m_selected_font; - wxFont m_normal_font; - int m_tab_ctrl_height; + wxSize m_requestedBmpSize; + int m_requestedTabCtrlHeight; + wxFont m_selectedFont; + wxFont m_normalFont; + int m_tabCtrlHeight; - int m_last_drag_x; + int m_lastDragX; unsigned int m_flags; #ifndef SWIG DECLARE_CLASS(wxAuiNotebook) DECLARE_EVENT_TABLE() #endif - - WX_DECLARE_CONTROL_CONTAINER(); - }; diff --git a/Externals/wxWidgets3/include/wx/aui/dockart.h b/Externals/wxWidgets3/include/wx/aui/dockart.h index beaa0dc9fa..fbc2ba7593 100644 --- a/Externals/wxWidgets3/include/wx/aui/dockart.h +++ b/Externals/wxWidgets3/include/wx/aui/dockart.h @@ -4,7 +4,7 @@ // Author: Benjamin I. Williams // Modified by: // Created: 2005-05-17 -// RCS-ID: $Id: dockart.h 66670 2011-01-12 13:39:36Z VZ $ +// RCS-ID: $Id: dockart.h 69590 2011-10-30 14:20:03Z VZ $ // Copyright: (C) Copyright 2005, Kirix Corporation, All Rights Reserved. // Licence: wxWindows Library Licence, Version 3.1 /////////////////////////////////////////////////////////////////////////////// @@ -37,7 +37,7 @@ public: virtual ~wxAuiDockArt() { } virtual int GetMetric(int id) = 0; - virtual void SetMetric(int id, int new_val) = 0; + virtual void SetMetric(int id, int newVal) = 0; virtual void SetFont(int id, const wxFont& font) = 0; virtual wxFont GetFont(int id) = 0; virtual wxColour GetColour(int id) = 0; @@ -74,7 +74,7 @@ public: virtual void DrawPaneButton(wxDC& dc, wxWindow* window, int button, - int button_state, + int buttonState, const wxRect& rect, wxAuiPaneInfo& pane) = 0; }; @@ -90,8 +90,8 @@ public: wxAuiDefaultDockArt(); - int GetMetric(int metric_id); - void SetMetric(int metric_id, int new_val); + int GetMetric(int metricId); + void SetMetric(int metricId, int newVal); wxColour GetColour(int id); void SetColour(int id, const wxColor& colour); void SetFont(int id, const wxFont& font); @@ -126,7 +126,7 @@ public: void DrawPaneButton(wxDC& dc, wxWindow *window, int button, - int button_state, + int buttonState, const wxRect& rect, wxAuiPaneInfo& pane); @@ -142,35 +142,35 @@ protected: protected: - wxPen m_border_pen; - wxBrush m_sash_brush; - wxBrush m_background_brush; - wxBrush m_gripper_brush; - wxFont m_caption_font; - wxBitmap m_inactive_close_bitmap; - wxBitmap m_inactive_pin_bitmap; - wxBitmap m_inactive_maximize_bitmap; - wxBitmap m_inactive_restore_bitmap; - wxBitmap m_active_close_bitmap; - wxBitmap m_active_pin_bitmap; - wxBitmap m_active_maximize_bitmap; - wxBitmap m_active_restore_bitmap; - wxPen m_gripper_pen1; - wxPen m_gripper_pen2; - wxPen m_gripper_pen3; - wxColour m_base_colour; - wxColour m_active_caption_colour; - wxColour m_active_caption_gradient_colour; - wxColour m_active_caption_text_colour; - wxColour m_inactive_caption_colour; - wxColour m_inactive_caption_gradient_colour; - wxColour m_inactive_caption_text_colour; - int m_border_size; - int m_caption_size; - int m_sash_size; - int m_button_size; - int m_gripper_size; - int m_gradient_type; + wxPen m_borderPen; + wxBrush m_sashBrush; + wxBrush m_backgroundBrush; + wxBrush m_gripperBrush; + wxFont m_captionFont; + wxBitmap m_inactiveCloseBitmap; + wxBitmap m_inactivePinBitmap; + wxBitmap m_inactiveMaximizeBitmap; + wxBitmap m_inactiveRestoreBitmap; + wxBitmap m_activeCloseBitmap; + wxBitmap m_activePinBitmap; + wxBitmap m_activeMaximizeBitmap; + wxBitmap m_activeRestoreBitmap; + wxPen m_gripperPen1; + wxPen m_gripperPen2; + wxPen m_gripperPen3; + wxColour m_baseColour; + wxColour m_activeCaptionColour; + wxColour m_activeCaptionGradientColour; + wxColour m_activeCaptionTextColour; + wxColour m_inactiveCaptionColour; + wxColour m_inactiveCaptionGradientColour; + wxColour m_inactiveCaptionTextColour; + int m_borderSize; + int m_captionSize; + int m_sashSize; + int m_buttonSize; + int m_gripperSize; + int m_gradientType; }; diff --git a/Externals/wxWidgets3/include/wx/aui/floatpane.h b/Externals/wxWidgets3/include/wx/aui/floatpane.h index 76d1cb54b2..d88614555d 100644 --- a/Externals/wxWidgets3/include/wx/aui/floatpane.h +++ b/Externals/wxWidgets3/include/wx/aui/floatpane.h @@ -4,7 +4,7 @@ // Author: Benjamin I. Williams // Modified by: // Created: 2005-05-17 -// RCS-ID: $Id: floatpane.h 61724 2009-08-21 10:41:26Z VZ $ +// RCS-ID: $Id: floatpane.h 69590 2011-10-30 14:20:03Z VZ $ // Copyright: (C) Copyright 2005, Kirix Corporation, All Rights Reserved. // Licence: wxWindows Library Licence, Version 3.1 /////////////////////////////////////////////////////////////////////////////// @@ -33,7 +33,7 @@ class WXDLLIMPEXP_AUI wxAuiFloatingFrame : public wxAuiFloatingFrameBaseClass { public: wxAuiFloatingFrame(wxWindow* parent, - wxAuiManager* owner_mgr, + wxAuiManager* ownerMgr, const wxAuiPaneInfo& pane, wxWindowID id = wxID_ANY, long style = wxRESIZE_BORDER | wxSYSTEM_MENU | wxCAPTION | @@ -46,7 +46,7 @@ public: protected: virtual void OnMoveStart(); - virtual void OnMoving(const wxRect& window_rect, wxDirection dir); + virtual void OnMoving(const wxRect& windowRect, wxDirection dir); virtual void OnMoveFinished(); private: @@ -58,16 +58,16 @@ private: static bool isMouseDown(); private: - wxWindow* m_pane_window; // pane window being managed - bool m_solid_drag; // true if system uses solid window drag + wxWindow* m_paneWindow; // pane window being managed + bool m_solidDrag; // true if system uses solid window drag bool m_moving; - wxRect m_last_rect; - wxRect m_last2_rect; - wxRect m_last3_rect; - wxSize m_last_size; + wxRect m_lastRect; + wxRect m_last2Rect; + wxRect m_last3Rect; + wxSize m_lastSize; wxDirection m_lastDirection; - wxWeakRef m_owner_mgr; + wxWeakRef m_ownerMgr; wxAuiManager m_mgr; #ifndef SWIG diff --git a/Externals/wxWidgets3/include/wx/aui/framemanager.h b/Externals/wxWidgets3/include/wx/aui/framemanager.h index 211171ebb6..c11491617f 100644 --- a/Externals/wxWidgets3/include/wx/aui/framemanager.h +++ b/Externals/wxWidgets3/include/wx/aui/framemanager.h @@ -4,7 +4,7 @@ // Author: Benjamin I. Williams // Modified by: // Created: 2005-05-17 -// RCS-ID: $Id: framemanager.h 66673 2011-01-12 18:04:39Z PC $ +// RCS-ID: $Id: framemanager.h 70807 2012-03-04 20:31:34Z VZ $ // Copyright: (C) Copyright 2005, Kirix Corporation, All Rights Reserved. // Licence: wxWindows Library Licence, Version 3.1 /////////////////////////////////////////////////////////////////////////////// @@ -458,7 +458,7 @@ class WXDLLIMPEXP_AUI wxAuiManager : public wxEvtHandler public: - wxAuiManager(wxWindow* managed_wnd = NULL, + wxAuiManager(wxWindow* managedWnd = NULL, unsigned int flags = wxAUI_MGR_DEFAULT); virtual ~wxAuiManager(); void UnInit(); @@ -466,12 +466,12 @@ public: void SetFlags(unsigned int flags); unsigned int GetFlags() const; - void SetManagedWindow(wxWindow* managed_wnd); + void SetManagedWindow(wxWindow* managedWnd); wxWindow* GetManagedWindow() const; static wxAuiManager* GetManager(wxWindow* window); - void SetArtProvider(wxAuiDockArt* art_provider); + void SetArtProvider(wxAuiDockArt* artProvider); wxAuiDockArt* GetArtProvider() const; wxAuiPaneInfo& GetPane(wxWindow* window); @@ -479,35 +479,35 @@ public: wxAuiPaneInfoArray& GetAllPanes(); bool AddPane(wxWindow* window, - const wxAuiPaneInfo& pane_info); + const wxAuiPaneInfo& paneInfo); bool AddPane(wxWindow* window, - const wxAuiPaneInfo& pane_info, - const wxPoint& drop_pos); + const wxAuiPaneInfo& paneInfo, + const wxPoint& dropPos); bool AddPane(wxWindow* window, int direction = wxLEFT, const wxString& caption = wxEmptyString); bool InsertPane(wxWindow* window, - const wxAuiPaneInfo& insert_location, - int insert_level = wxAUI_INSERT_PANE); + const wxAuiPaneInfo& insertLocation, + int insertLevel = wxAUI_INSERT_PANE); bool DetachPane(wxWindow* window); void Update(); wxString SavePaneInfo(wxAuiPaneInfo& pane); - void LoadPaneInfo(wxString pane_part, wxAuiPaneInfo &pane); + void LoadPaneInfo(wxString panePart, wxAuiPaneInfo &pane); wxString SavePerspective(); bool LoadPerspective(const wxString& perspective, bool update = true); - void SetDockSizeConstraint(double width_pct, double height_pct); - void GetDockSizeConstraint(double* width_pct, double* height_pct) const; + void SetDockSizeConstraint(double widthPct, double heightPct); + void GetDockSizeConstraint(double* widthPct, double* heightPct) const; - void ClosePane(wxAuiPaneInfo& pane_info); - void MaximizePane(wxAuiPaneInfo& pane_info); - void RestorePane(wxAuiPaneInfo& pane_info); + void ClosePane(wxAuiPaneInfo& paneInfo); + void MaximizePane(wxAuiPaneInfo& paneInfo); + void RestorePane(wxAuiPaneInfo& paneInfo); void RestoreMaximizedPane(); public: @@ -516,16 +516,16 @@ public: virtual bool CanDockPanel(const wxAuiPaneInfo & p); void StartPaneDrag( - wxWindow* pane_window, + wxWindow* paneWindow, const wxPoint& offset); wxRect CalculateHintRect( - wxWindow* pane_window, + wxWindow* paneWindow, const wxPoint& pt, const wxPoint& offset); void DrawHintRect( - wxWindow* pane_window, + wxWindow* paneWindow, const wxPoint& pt, const wxPoint& offset); @@ -552,26 +552,26 @@ protected: wxAuiDockInfo& dock, wxAuiPaneInfo& pane, wxAuiDockUIPartArray& uiparts, - bool spacer_only); + bool spacerOnly); void LayoutAddDock(wxSizer* container, wxAuiDockInfo& dock, - wxAuiDockUIPartArray& uiparts, - bool spacer_only); + wxAuiDockUIPartArray& uiParts, + bool spacerOnly); wxSizer* LayoutAll(wxAuiPaneInfoArray& panes, wxAuiDockInfoArray& docks, - wxAuiDockUIPartArray& uiparts, - bool spacer_only = false); + wxAuiDockUIPartArray & uiParts, + bool spacerOnly = false); virtual bool ProcessDockResult(wxAuiPaneInfo& target, - const wxAuiPaneInfo& new_pos); + const wxAuiPaneInfo& newPos); bool DoDrop(wxAuiDockInfoArray& docks, wxAuiPaneInfoArray& panes, wxAuiPaneInfo& drop, const wxPoint& pt, - const wxPoint& action_offset = wxPoint(0,0)); + const wxPoint& actionOffset = wxPoint(0,0)); wxAuiDockUIPart* HitTest(int x, int y); wxAuiDockUIPart* GetPanePart(wxWindow* pane); @@ -585,7 +585,7 @@ protected: void Render(wxDC* dc); void Repaint(wxDC* dc = NULL); void ProcessMgrEvent(wxAuiManagerEvent& event); - void UpdateButtonOnScreen(wxAuiDockUIPart* button_ui_part, + void UpdateButtonOnScreen(wxAuiDockUIPart* buttonUiPart, const wxMouseEvent& event); void GetPanePositionsAndSizes(wxAuiDockInfo& dock, wxArrayInt& positions, @@ -594,6 +594,8 @@ protected: /// Ends a resize action, or for live update, resizes the sash bool DoEndResizeAction(wxMouseEvent& event); + void SetActivePane(wxWindow* active_pane); + public: // public events (which can be invoked externally) @@ -636,29 +638,29 @@ protected: wxAuiPaneInfoArray m_panes; // array of panes structures wxAuiDockInfoArray m_docks; // array of docks structures - wxAuiDockUIPartArray m_uiparts; // array of UI parts (captions, buttons, etc) + wxAuiDockUIPartArray m_uiParts; // array of UI parts (captions, buttons, etc) int m_action; // current mouse action - wxPoint m_action_start; // position where the action click started - wxPoint m_action_offset; // offset from upper left of the item clicked - wxAuiDockUIPart* m_action_part; // ptr to the part the action happened to - wxWindow* m_action_window; // action frame or window (NULL if none) - wxRect m_action_hintrect; // hint rectangle for the action - wxRect m_last_rect; - wxAuiDockUIPart* m_hover_button;// button uipart being hovered over - wxRect m_last_hint; // last hint rectangle - wxPoint m_last_mouse_move; // last mouse move position (see OnMotion) + wxPoint m_actionStart; // position where the action click started + wxPoint m_actionOffset; // offset from upper left of the item clicked + wxAuiDockUIPart* m_actionPart; // ptr to the part the action happened to + wxWindow* m_actionWindow; // action frame or window (NULL if none) + wxRect m_actionHintRect; // hint rectangle for the action + wxRect m_lastRect; + wxAuiDockUIPart* m_hoverButton;// button uipart being hovered over + wxRect m_lastHint; // last hint rectangle + wxPoint m_lastMouseMove; // last mouse move position (see OnMotion) int m_currentDragItem; bool m_skipping; - bool m_has_maximized; + bool m_hasMaximized; - double m_dock_constraint_x; // 0.0 .. 1.0; max pct of window width a dock can consume - double m_dock_constraint_y; // 0.0 .. 1.0; max pct of window height a dock can consume + double m_dockConstraintX; // 0.0 .. 1.0; max pct of window width a dock can consume + double m_dockConstraintY; // 0.0 .. 1.0; max pct of window height a dock can consume - wxFrame* m_hint_wnd; // transparent hint window, if supported by platform - wxTimer m_hint_fadetimer; // transparent fade timer - wxByte m_hint_fadeamt; // transparent fade amount - wxByte m_hint_fademax; // maximum value of hint fade + wxFrame* m_hintWnd; // transparent hint window, if supported by platform + wxTimer m_hintFadeTimer; // transparent fade timer + wxByte m_hintFadeAmt; // transparent fade amount + wxByte m_hintFadeMax; // maximum value of hint fade void* m_reserved; @@ -839,6 +841,7 @@ wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_AUI, wxEVT_AUI_PANE_BUTTON, wxAuiManagerEv wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_AUI, wxEVT_AUI_PANE_CLOSE, wxAuiManagerEvent ); wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_AUI, wxEVT_AUI_PANE_MAXIMIZE, wxAuiManagerEvent ); wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_AUI, wxEVT_AUI_PANE_RESTORE, wxAuiManagerEvent ); +wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_AUI, wxEVT_AUI_PANE_ACTIVATED, wxAuiManagerEvent ); wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_AUI, wxEVT_AUI_RENDER, wxAuiManagerEvent ); wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_AUI, wxEVT_AUI_FIND_MANAGER, wxAuiManagerEvent ); @@ -855,6 +858,8 @@ typedef void (wxEvtHandler::*wxAuiManagerEventFunction)(wxAuiManagerEvent&); wx__DECLARE_EVT0(wxEVT_AUI_PANE_MAXIMIZE, wxAuiManagerEventHandler(func)) #define EVT_AUI_PANE_RESTORE(func) \ wx__DECLARE_EVT0(wxEVT_AUI_PANE_RESTORE, wxAuiManagerEventHandler(func)) +#define EVT_AUI_PANE_ACTIVATED(func) \ + wx__DECLARE_EVT0(wxEVT_AUI_PANE_ACTIVATED, wxAuiManagerEventHandler(func)) #define EVT_AUI_RENDER(func) \ wx__DECLARE_EVT0(wxEVT_AUI_RENDER, wxAuiManagerEventHandler(func)) #define EVT_AUI_FIND_MANAGER(func) \ @@ -866,6 +871,7 @@ typedef void (wxEvtHandler::*wxAuiManagerEventFunction)(wxAuiManagerEvent&); %constant wxEventType wxEVT_AUI_PANE_CLOSE; %constant wxEventType wxEVT_AUI_PANE_MAXIMIZE; %constant wxEventType wxEVT_AUI_PANE_RESTORE; +%constant wxEventType wxEVT_AUI_PANE_ACTIVATED; %constant wxEventType wxEVT_AUI_RENDER; %constant wxEventType wxEVT_AUI_FIND_MANAGER; @@ -874,6 +880,7 @@ typedef void (wxEvtHandler::*wxAuiManagerEventFunction)(wxAuiManagerEvent&); EVT_AUI_PANE_CLOSE = wx.PyEventBinder( wxEVT_AUI_PANE_CLOSE ) EVT_AUI_PANE_MAXIMIZE = wx.PyEventBinder( wxEVT_AUI_PANE_MAXIMIZE ) EVT_AUI_PANE_RESTORE = wx.PyEventBinder( wxEVT_AUI_PANE_RESTORE ) + EVT_AUI_PANE_ACTIVATED = wx.PyEventBinder( wxEVT_AUI_PANE_ACTIVATED ) EVT_AUI_RENDER = wx.PyEventBinder( wxEVT_AUI_RENDER ) EVT_AUI_FIND_MANAGER = wx.PyEventBinder( wxEVT_AUI_FIND_MANAGER ) } diff --git a/Externals/wxWidgets3/include/wx/aui/tabmdi.h b/Externals/wxWidgets3/include/wx/aui/tabmdi.h index ce9d812348..6a680845b3 100644 --- a/Externals/wxWidgets3/include/wx/aui/tabmdi.h +++ b/Externals/wxWidgets3/include/wx/aui/tabmdi.h @@ -4,7 +4,7 @@ // Author: Hans Van Leemputten // Modified by: Benjamin I. Williams / Kirix Corporation // Created: 29/07/2002 -// RCS-ID: $Id: tabmdi.h 67254 2011-03-20 00:14:35Z DS $ +// RCS-ID: $Id: tabmdi.h 70909 2012-03-15 13:49:54Z VZ $ // Copyright: (c) Hans Van Leemputten // Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// @@ -101,6 +101,7 @@ protected: void AddWindowMenu(wxMenuBar *pMenuBar); void DoHandleMenu(wxCommandEvent &event); + void DoHandleUpdateUI(wxUpdateUIEvent &event); #endif // wxUSE_MENUS virtual bool ProcessEvent(wxEvent& event); @@ -138,7 +139,7 @@ public: const wxString& name = wxFrameNameStr); #if wxUSE_MENUS - virtual void SetMenuBar(wxMenuBar *menu_bar); + virtual void SetMenuBar(wxMenuBar *menuBar); virtual wxMenuBar *GetMenuBar() const; #endif // wxUSE_MENUS @@ -199,7 +200,7 @@ public: protected: void Init(); - virtual void DoSetSize(int x, int y, int width, int height, int size_flags); + virtual void DoSetSize(int x, int y, int width, int height, int sizeFlags); virtual void DoMoveWindow(int x, int y, int width, int height); // no size hints @@ -215,12 +216,12 @@ public: protected: wxAuiMDIParentFrame* m_pMDIParentFrame; - wxRect m_mdi_newrect; - wxRect m_mdi_currect; + wxRect m_mdiNewRect; + wxRect m_mdiCurRect; wxString m_title; wxIcon m_icon; - wxIconBundle m_icon_bundle; - bool m_activate_on_create; + wxIconBundle m_iconBundle; + bool m_activateOnCreate; #if wxUSE_MENUS wxMenuBar* m_pMenuBar; @@ -244,7 +245,6 @@ class WXDLLIMPEXP_AUI wxAuiMDIClientWindow : public wxAuiNotebook public: wxAuiMDIClientWindow(); wxAuiMDIClientWindow(wxAuiMDIParentFrame *parent, long style = 0); - ~wxAuiMDIClientWindow(); virtual bool CreateClient(wxAuiMDIParentFrame *parent, long style = wxVSCROLL | wxHSCROLL); @@ -253,7 +253,7 @@ public: protected: - void PageChanged(int old_selection, int new_selection); + void PageChanged(int oldSelection, int newSelection); void OnPageClose(wxAuiNotebookEvent& evt); void OnPageChanged(wxAuiNotebookEvent& evt); void OnSize(wxSizeEvent& evt); diff --git a/Externals/wxWidgets3/include/wx/bannerwindow.h b/Externals/wxWidgets3/include/wx/bannerwindow.h new file mode 100644 index 0000000000..1ce3bc3170 --- /dev/null +++ b/Externals/wxWidgets3/include/wx/bannerwindow.h @@ -0,0 +1,145 @@ +/////////////////////////////////////////////////////////////////////////////// +// Name: wx/bannerwindow.h +// Purpose: wxBannerWindow class declaration +// Author: Vadim Zeitlin +// Created: 2011-08-16 +// RCS-ID: $Id: bannerwindow.h 69859 2011-11-28 18:58:52Z VZ $ +// Copyright: (c) 2011 Vadim Zeitlin +// Licence: wxWindows licence +/////////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_BANNERWINDOW_H_ +#define _WX_BANNERWINDOW_H_ + +#include "wx/defs.h" + +#if wxUSE_BANNERWINDOW + +#include "wx/bitmap.h" +#include "wx/event.h" +#include "wx/window.h" + +class WXDLLIMPEXP_FWD_CORE wxBitmap; +class WXDLLIMPEXP_FWD_CORE wxColour; +class WXDLLIMPEXP_FWD_CORE wxDC; + +extern WXDLLIMPEXP_DATA_ADV(const char) wxBannerWindowNameStr[]; + +// ---------------------------------------------------------------------------- +// A simple banner window showing either a bitmap or text. +// ---------------------------------------------------------------------------- + +class WXDLLIMPEXP_ADV wxBannerWindow : public wxWindow +{ +public: + // Default constructor, use Create() later. + wxBannerWindow() { Init(); } + + // Convenient constructor that should be used in the majority of cases. + // + // The banner orientation changes how the text in it is displayed and also + // defines where is the bitmap truncated if it's too big to fit but doesn't + // do anything for the banner position, this is supposed to be taken care + // of in the usual way, e.g. using sizers. + wxBannerWindow(wxWindow* parent, wxDirection dir = wxLEFT) + { + Init(); + + Create(parent, wxID_ANY, dir); + } + + // Full constructor provided for consistency with the other classes only. + wxBannerWindow(wxWindow* parent, + wxWindowID winid, + wxDirection dir = wxLEFT, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + long style = 0, + const wxString& name = wxBannerWindowNameStr) + { + Init(); + + Create(parent, winid, dir, pos, size, style, name); + } + + // Can be only called on objects created with the default constructor. + bool Create(wxWindow* parent, + wxWindowID winid, + wxDirection dir = wxLEFT, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + long style = 0, + const wxString& name = wxBannerWindowNameStr); + + + // Provide an existing bitmap to show. For wxLEFT orientation the bitmap is + // truncated from the top, for wxTOP and wxBOTTOM -- from the right and for + // wxRIGHT -- from the bottom, so put the most important part of the bitmap + // information in the opposite direction. + void SetBitmap(const wxBitmap& bmp); + + // Set the text to display. This is mutually exclusive with SetBitmap(). + // Title is rendered in bold and should be single line, message can have + // multiple lines but is not wrapped automatically. + void SetText(const wxString& title, const wxString& message); + + // Set the colours between which the gradient runs. This can be combined + // with SetText() but not SetBitmap(). + void SetGradient(const wxColour& start, const wxColour& end); + +protected: + virtual wxSize DoGetBestClientSize() const; + +private: + // Common part of all constructors. + void Init(); + + // Fully invalidates the window. + void OnSize(wxSizeEvent& event); + + // Redraws the window using either m_bitmap or m_title/m_message. + void OnPaint(wxPaintEvent& event); + + // Helper of OnPaint(): draw the bitmap at the correct position depending + // on our orientation. + void DrawBitmapBackground(wxDC& dc); + + // Helper of OnPaint(): draw the text in the appropriate direction. + void DrawBannerTextLine(wxDC& dc, const wxString& str, const wxPoint& pos); + + // Return the font to use for the title. Currently this is hardcoded as a + // larger bold version of the standard window font but could be made + // configurable in the future. + wxFont GetTitleFont() const; + + // Return the colour to use for extending the bitmap. Non-const as it + // updates m_colBitmapBg if needed. + wxColour GetBitmapBg(); + + + // The window side along which the banner is laid out. + wxDirection m_direction; + + // If valid, this bitmap is drawn as is. + wxBitmap m_bitmap; + + // If bitmap is valid, this is the colour we use to extend it if the bitmap + // is smaller than this window. It is computed on demand by GetBitmapBg(). + wxColour m_colBitmapBg; + + // The title and main message to draw, used if m_bitmap is invalid. + wxString m_title, + m_message; + + // Start and stop gradient colours, only used when drawing text. + wxColour m_colStart, + m_colEnd; + + wxDECLARE_EVENT_TABLE(); + + wxDECLARE_NO_COPY_CLASS(wxBannerWindow); +}; + +#endif // wxUSE_BANNERWINDOW + +#endif // _WX_BANNERWINDOW_H_ diff --git a/Externals/wxWidgets3/include/wx/bitmap.h b/Externals/wxWidgets3/include/wx/bitmap.h index 73c7ba965e..ab9046803c 100644 --- a/Externals/wxWidgets3/include/wx/bitmap.h +++ b/Externals/wxWidgets3/include/wx/bitmap.h @@ -4,7 +4,7 @@ // Author: Vaclav Slavik // Modified by: // Created: 22.04.01 -// RCS-ID: $Id: bitmap.h 66086 2010-11-10 13:51:51Z VZ $ +// RCS-ID: $Id: bitmap.h 70353 2012-01-15 14:46:41Z VZ $ // Copyright: (c) wxWidgets team // Licence: wxWindows licence /////////////////////////////////////////////////////////////////////////////// @@ -68,8 +68,7 @@ protected: virtual bool InitFromMonoBitmap(const wxBitmap& bitmap) = 0; }; -#if defined(__WXMGL__) || \ - defined(__WXDFB__) || \ +#if defined(__WXDFB__) || \ defined(__WXMAC__) || \ defined(__WXGTK__) || \ defined(__WXCOCOA__) || \ @@ -84,9 +83,9 @@ protected: #define wxBITMAP_SCREEN_DEPTH (-1) -// All ports except wxMSW,wxOS2,wxPalmOS use wxBitmapHandler and wxBitmapBase as base class -// for wxBitmapHandler; wxMSW,wxOS2,wxPalmOS use wxGDIImageHandler as base class -// since it allows some code reuse there. +// All ports except wxMSW and wxOS2 use wxBitmapHandler and wxBitmapBase as +// base class for wxBitmapHandler; wxMSW and wxOS2 use wxGDIImageHandler as +// base class since it allows some code reuse there. #if wxUSE_BITMAP_BASE // ---------------------------------------------------------------------------- @@ -237,10 +236,7 @@ protected: // the wxBITMAP_DEFAULT_TYPE constant defines the default argument value // for wxBitmap's ctor and wxBitmap::LoadFile() functions. -#if defined(__WXPALMOS__) - #define wxBITMAP_DEFAULT_TYPE wxBITMAP_TYPE_BMP_RESOURCE - #include "wx/palmos/bitmap.h" -#elif defined(__WXMSW__) +#if defined(__WXMSW__) #define wxBITMAP_DEFAULT_TYPE wxBITMAP_TYPE_BMP_RESOURCE #include "wx/msw/bitmap.h" #elif defined(__WXMOTIF__) @@ -255,11 +251,8 @@ protected: #elif defined(__WXX11__) #define wxBITMAP_DEFAULT_TYPE wxBITMAP_TYPE_XPM #include "wx/x11/bitmap.h" -#elif defined(__WXMGL__) - #define wxBITMAP_DEFAULT_TYPE wxBITMAP_TYPE_RESOURCE - #include "wx/mgl/bitmap.h" #elif defined(__WXDFB__) - #define wxBITMAP_DEFAULT_TYPE wxBITMAP_TYPE_RESOURCE + #define wxBITMAP_DEFAULT_TYPE wxBITMAP_TYPE_BMP_RESOURCE #include "wx/dfb/bitmap.h" #elif defined(__WXMAC__) #define wxBITMAP_DEFAULT_TYPE wxBITMAP_TYPE_PICT_RESOURCE @@ -287,7 +280,7 @@ ConvertToDisabled(unsigned char brightness) const #endif // wxUSE_IMAGE // we must include generic mask.h after wxBitmap definition -#if defined(__WXMGL__) || defined(__WXDFB__) +#if defined(__WXDFB__) #define wxUSE_GENERIC_MASK 1 #else #define wxUSE_GENERIC_MASK 0 diff --git a/Externals/wxWidgets3/include/wx/bmpbuttn.h b/Externals/wxWidgets3/include/wx/bmpbuttn.h index 2b6c39fcd4..c2632b88f6 100644 --- a/Externals/wxWidgets3/include/wx/bmpbuttn.h +++ b/Externals/wxWidgets3/include/wx/bmpbuttn.h @@ -4,7 +4,7 @@ // Author: Vadim Zeitlin // Modified by: // Created: 25.08.00 -// RCS-ID: $Id: bmpbuttn.h 67254 2011-03-20 00:14:35Z DS $ +// RCS-ID: $Id: bmpbuttn.h 70345 2012-01-15 01:05:28Z VZ $ // Copyright: (c) 2000 Vadim Zeitlin // Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// @@ -130,8 +130,6 @@ protected: #include "wx/cocoa/bmpbuttn.h" #elif defined(__WXPM__) #include "wx/os2/bmpbuttn.h" -#elif defined(__WXPALMOS__) - #include "wx/palmos/bmpbuttn.h" #endif #endif // wxUSE_BMPBUTTON diff --git a/Externals/wxWidgets3/include/wx/bookctrl.h b/Externals/wxWidgets3/include/wx/bookctrl.h index 471c278ff6..b3a6809690 100644 --- a/Externals/wxWidgets3/include/wx/bookctrl.h +++ b/Externals/wxWidgets3/include/wx/bookctrl.h @@ -4,7 +4,7 @@ // Author: Vadim Zeitlin // Modified by: // Created: 19.08.03 -// RCS-ID: $Id: bookctrl.h 65967 2010-10-31 13:33:34Z VZ $ +// RCS-ID: $Id: bookctrl.h 69082 2011-09-14 08:24:06Z SJL $ // Copyright: (c) 2003 Vadim Zeitlin // Licence: wxWindows licence /////////////////////////////////////////////////////////////////////////////// @@ -22,6 +22,7 @@ #include "wx/control.h" #include "wx/dynarray.h" +#include "wx/withimages.h" WX_DEFINE_EXPORTED_ARRAY_PTR(wxWindow *, wxArrayPages); @@ -54,7 +55,8 @@ enum // wxBookCtrlBase // ---------------------------------------------------------------------------- -class WXDLLIMPEXP_CORE wxBookCtrlBase : public wxControl +class WXDLLIMPEXP_CORE wxBookCtrlBase : public wxControl, + public wxWithImages { public: // construction @@ -85,9 +87,6 @@ public: long style = 0, const wxString& name = wxEmptyString); - // dtor - virtual ~wxBookCtrlBase(); - // accessors // --------- @@ -106,7 +105,7 @@ public: } // get the currently selected page or wxNOT_FOUND if none - int GetSelection() const { return m_selection; } + virtual int GetSelection() const { return m_selection; } // set/get the title of a page virtual bool SetPageText(size_t n, const wxString& strText) = 0; @@ -117,15 +116,6 @@ public: // images belong to the same image list) // --------------------------------------------------------------------- - // sets the image list to use, it is *not* deleted by the control - virtual void SetImageList(wxImageList *imageList); - - // as SetImageList() but we will delete the image list ourselves - void AssignImageList(wxImageList *imageList); - - // get pointer (may be NULL) to the associated image list - wxImageList* GetImageList() const { return m_imageList; } - // sets/returns item's image index in the current image list virtual int GetPageImage(size_t n) const = 0; virtual bool SetPageImage(size_t n, int imageId) = 0; @@ -191,7 +181,7 @@ public: virtual bool AddPage(wxWindow *page, const wxString& text, bool bSelect = false, - int imageId = -1) + int imageId = NO_IMAGE) { DoInvalidateBestSize(); return InsertPage(GetPageCount(), page, text, bSelect, imageId); @@ -202,7 +192,7 @@ public: wxWindow *page, const wxString& text, bool bSelect = false, - int imageId = -1) = 0; + int imageId = NO_IMAGE) = 0; // set the currently selected page, return the index of the previously // selected one (or wxNOT_FOUND on error) @@ -320,12 +310,6 @@ protected: // the array of all pages of this control wxArrayPages m_pages; - // the associated image list or NULL - wxImageList *m_imageList; - - // true if we must delete m_imageList - bool m_ownsImageList; - // get the page area virtual wxRect GetPageRect() const; diff --git a/Externals/wxWidgets3/include/wx/brush.h b/Externals/wxWidgets3/include/wx/brush.h index 0791d38002..7dbb89425d 100644 --- a/Externals/wxWidgets3/include/wx/brush.h +++ b/Externals/wxWidgets3/include/wx/brush.h @@ -4,7 +4,7 @@ // Author: Julian Smart // Modified by: // Created: -// RCS-ID: $Id: brush.h 66054 2010-11-07 13:16:20Z VZ $ +// RCS-ID: $Id: brush.h 70353 2012-01-15 14:46:41Z VZ $ // Copyright: Julian Smart // Licence: wxWindows Licence ///////////////////////////////////////////////////////////////////////////// @@ -70,9 +70,7 @@ public: } }; -#if defined(__WXPALMOS__) - #include "wx/palmos/brush.h" -#elif defined(__WXMSW__) +#if defined(__WXMSW__) #include "wx/msw/brush.h" #elif defined(__WXMOTIF__) || defined(__WXX11__) #include "wx/x11/brush.h" @@ -80,8 +78,6 @@ public: #include "wx/gtk/brush.h" #elif defined(__WXGTK__) #include "wx/gtk1/brush.h" -#elif defined(__WXMGL__) - #include "wx/mgl/brush.h" #elif defined(__WXDFB__) #include "wx/dfb/brush.h" #elif defined(__WXMAC__) diff --git a/Externals/wxWidgets3/include/wx/buffer.h b/Externals/wxWidgets3/include/wx/buffer.h index 161e935af6..8b57207f1d 100644 --- a/Externals/wxWidgets3/include/wx/buffer.h +++ b/Externals/wxWidgets3/include/wx/buffer.h @@ -4,7 +4,7 @@ // Author: Vadim Zeitlin // Modified by: // Created: 12.04.99 -// RCS-ID: $Id: buffer.h 66780 2011-01-27 11:00:26Z SC $ +// RCS-ID: $Id: buffer.h 70417 2012-01-20 22:11:51Z VZ $ // Copyright: (c) 1998 Vadim Zeitlin // Licence: wxWindows licence /////////////////////////////////////////////////////////////////////////////// @@ -15,9 +15,7 @@ #include "wx/chartype.h" #include "wx/wxcrtbase.h" -#ifndef __WXPALMOS5__ #include // malloc() and free() -#endif // ! __WXPALMOS5__ class WXDLLIMPEXP_FWD_BASE wxCStrData; @@ -314,6 +312,10 @@ public: if ( !str ) return false; + // For consistency with the ctor taking just the length, NUL-terminate + // the buffer. + str[len] = (CharType)0; + if ( this->m_data == this->GetNullData() ) { this->m_data = new Data(str, len); @@ -537,6 +539,8 @@ public: size_t GetBufSize() const { return m_bufdata->m_size; } size_t GetDataLen() const { return m_bufdata->m_len; } + bool IsEmpty() const { return GetDataLen() == 0; } + void SetBufSize(size_t size) { m_bufdata->ResizeIfNeeded(size); } void SetDataLen(size_t len) { @@ -544,6 +548,8 @@ public: m_bufdata->m_len = len; } + void Clear() { SetDataLen(0); } + // Ensure the buffer is big enough and return a pointer to it void *GetWriteBuf(size_t sizeNeeded) { diff --git a/Externals/wxWidgets3/include/wx/build.h b/Externals/wxWidgets3/include/wx/build.h index a82e56db81..ac0393fb99 100644 --- a/Externals/wxWidgets3/include/wx/build.h +++ b/Externals/wxWidgets3/include/wx/build.h @@ -4,7 +4,7 @@ // Author: Vadim Zeitlin, Vaclav Slavik // Modified by: // Created: 07.05.02 -// RCS-ID: $Id: build.h 64531 2010-06-09 13:23:13Z FM $ +// RCS-ID: $Id: build.h 67343 2011-03-30 14:16:04Z VZ $ // Copyright: (c) 2002 Vadim Zeitlin // Licence: wxWindows licence /////////////////////////////////////////////////////////////////////////////// @@ -85,7 +85,7 @@ #endif // deriving wxWin containers from STL ones changes them completely: -#if wxUSE_STL +#if wxUSE_STD_CONTAINERS #define __WX_BO_STL ",STL containers" #else #define __WX_BO_STL ",wx containers" diff --git a/Externals/wxWidgets3/include/wx/button.h b/Externals/wxWidgets3/include/wx/button.h index d69cbe4b58..d164eee800 100644 --- a/Externals/wxWidgets3/include/wx/button.h +++ b/Externals/wxWidgets3/include/wx/button.h @@ -4,7 +4,7 @@ // Author: Vadim Zetlin // Modified by: // Created: 15.08.00 -// RCS-ID: $Id: button.h 65680 2010-09-30 11:44:45Z VZ $ +// RCS-ID: $Id: button.h 70345 2012-01-15 01:05:28Z VZ $ // Copyright: (c) Vadim Zetlin // Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// @@ -14,44 +14,9 @@ #include "wx/defs.h" -// ---------------------------------------------------------------------------- -// wxButton flags shared with other classes -// ---------------------------------------------------------------------------- - -#if wxUSE_TOGGLEBTN || wxUSE_BUTTON - -// These flags affect label alignment -#define wxBU_LEFT 0x0040 -#define wxBU_TOP 0x0080 -#define wxBU_RIGHT 0x0100 -#define wxBU_BOTTOM 0x0200 -#define wxBU_ALIGN_MASK ( wxBU_LEFT | wxBU_TOP | wxBU_RIGHT | wxBU_BOTTOM ) -#endif - #if wxUSE_BUTTON -// ---------------------------------------------------------------------------- -// wxButton specific flags -// ---------------------------------------------------------------------------- - -// These two flags are obsolete -#define wxBU_NOAUTODRAW 0x0000 -#define wxBU_AUTODRAW 0x0004 - -// by default, the buttons will be created with some (system dependent) -// minimal size to make them look nicer, giving this style will make them as -// small as possible -#define wxBU_EXACTFIT 0x0001 - -// this flag can be used to disable using the text label in the button: it is -// mostly useful when creating buttons showing bitmap and having stock id as -// without it both the standard label corresponding to the stock id and the -// bitmap would be shown -#define wxBU_NOTEXT 0x0002 - - -#include "wx/bitmap.h" -#include "wx/control.h" +#include "wx/anybutton.h" extern WXDLLIMPEXP_DATA_CORE(const char) wxButtonNameStr[]; @@ -59,7 +24,7 @@ extern WXDLLIMPEXP_DATA_CORE(const char) wxButtonNameStr[]; // wxButton: a push button // ---------------------------------------------------------------------------- -class WXDLLIMPEXP_CORE wxButtonBase : public wxControl +class WXDLLIMPEXP_CORE wxButtonBase : public wxAnyButton { public: wxButtonBase() { } @@ -70,132 +35,15 @@ public: void SetAuthNeeded(bool show = true) { DoSetAuthNeeded(show); } bool GetAuthNeeded() const { return DoGetAuthNeeded(); } - // show the image in the button in addition to the label: this method is - // supported on all (major) platforms - void SetBitmap(const wxBitmap& bitmap, wxDirection dir = wxLEFT) - { - SetBitmapLabel(bitmap); - SetBitmapPosition(dir); - } - - wxBitmap GetBitmap() const { return DoGetBitmap(State_Normal); } - - // Methods for setting individual images for different states: normal, - // selected (meaning pushed or pressed), focused (meaning normal state for - // a focused button), disabled or hover (a.k.a. hot or current). - // - // Remember that SetBitmap() itself must be called before any other - // SetBitmapXXX() methods (except for SetBitmapLabel() which is a synonym - // for it anyhow) and that all bitmaps passed to these functions should be - // of the same size. - void SetBitmapLabel(const wxBitmap& bitmap) - { DoSetBitmap(bitmap, State_Normal); } - void SetBitmapPressed(const wxBitmap& bitmap) - { DoSetBitmap(bitmap, State_Pressed); } - void SetBitmapDisabled(const wxBitmap& bitmap) - { DoSetBitmap(bitmap, State_Disabled); } - void SetBitmapCurrent(const wxBitmap& bitmap) - { DoSetBitmap(bitmap, State_Current); } - void SetBitmapFocus(const wxBitmap& bitmap) - { DoSetBitmap(bitmap, State_Focused); } - - wxBitmap GetBitmapLabel() const { return DoGetBitmap(State_Normal); } - wxBitmap GetBitmapPressed() const { return DoGetBitmap(State_Pressed); } - wxBitmap GetBitmapDisabled() const { return DoGetBitmap(State_Disabled); } - wxBitmap GetBitmapCurrent() const { return DoGetBitmap(State_Current); } - wxBitmap GetBitmapFocus() const { return DoGetBitmap(State_Focused); } - - - // set the margins around the image - void SetBitmapMargins(wxCoord x, wxCoord y) { DoSetBitmapMargins(x, y); } - void SetBitmapMargins(const wxSize& sz) { DoSetBitmapMargins(sz.x, sz.y); } - wxSize GetBitmapMargins() { return DoGetBitmapMargins(); } - - // set the image position relative to the text, i.e. wxLEFT means that the - // image is to the left of the text (this is the default) - void SetBitmapPosition(wxDirection dir); - - // make this button the default button in its top level window // // returns the old default item (possibly NULL) virtual wxWindow *SetDefault(); - // Buttons on MSW can look bad if they are not native colours, because - // then they become owner-drawn and not theme-drawn. Disable it here - // in wxButtonBase to make it consistent. - virtual bool ShouldInheritColours() const { return false; } - // returns the default button size for this platform static wxSize GetDefaultSize(); - // wxUniv-compatible and deprecated equivalents to SetBitmapXXX() -#if WXWIN_COMPATIBILITY_2_8 - void SetImageLabel(const wxBitmap& bitmap) { SetBitmap(bitmap); } - void SetImageMargins(wxCoord x, wxCoord y) { SetBitmapMargins(x, y); } -#endif // WXWIN_COMPATIBILITY_2_8 - - // backwards compatible names for pressed/current bitmaps: they're not - // deprecated as there is nothing really wrong with using them and no real - // advantage to using the new names but the new names are still preferred - wxBitmap GetBitmapSelected() const { return GetBitmapPressed(); } - wxBitmap GetBitmapHover() const { return GetBitmapCurrent(); } - - void SetBitmapSelected(const wxBitmap& bitmap) { SetBitmapPressed(bitmap); } - void SetBitmapHover(const wxBitmap& bitmap) { SetBitmapCurrent(bitmap); } - - - // this enum is not part of wx public API, it is public because it is used - // in non wxButton-derived classes internally - // - // also notice that MSW code relies on the values of the enum elements, do - // not change them without revising src/msw/button.cpp - enum State - { - State_Normal, - State_Current, // a.k.a. hot or "hovering" - State_Pressed, // a.k.a. "selected" in public API for some reason - State_Disabled, - State_Focused, - State_Max - }; - - // return true if this button shouldn't show the text label, either because - // it doesn't have it or because it was explicitly disabled with wxBU_NOTEXT - bool DontShowLabel() const - { - return HasFlag(wxBU_NOTEXT) || GetLabel().empty(); - } - - // return true if we do show the label - bool ShowsLabel() const - { - return !DontShowLabel(); - } - protected: - // choose the default border for this window - virtual wxBorder GetDefaultBorder() const { return wxBORDER_NONE; } - - virtual bool DoGetAuthNeeded() const { return false; } - virtual void DoSetAuthNeeded(bool WXUNUSED(show)) { } - - virtual wxBitmap DoGetBitmap(State WXUNUSED(which)) const - { return wxBitmap(); } - virtual void DoSetBitmap(const wxBitmap& WXUNUSED(bitmap), - State WXUNUSED(which)) - { } - - virtual wxSize DoGetBitmapMargins() const - { return wxSize(0, 0); } - - virtual void DoSetBitmapMargins(wxCoord WXUNUSED(x), wxCoord WXUNUSED(y)) - { } - - virtual void DoSetBitmapPosition(wxDirection WXUNUSED(dir)) - { } - - wxDECLARE_NO_COPY_CLASS(wxButtonBase); }; @@ -215,11 +63,8 @@ protected: #include "wx/cocoa/button.h" #elif defined(__WXPM__) #include "wx/os2/button.h" -#elif defined(__WXPALMOS__) - #include "wx/palmos/button.h" #endif #endif // wxUSE_BUTTON -#endif - // _WX_BUTTON_H_BASE_ +#endif // _WX_BUTTON_H_BASE_ diff --git a/Externals/wxWidgets3/include/wx/cairo.h b/Externals/wxWidgets3/include/wx/cairo.h index 2518a89a21..eb83424aa3 100644 --- a/Externals/wxWidgets3/include/wx/cairo.h +++ b/Externals/wxWidgets3/include/wx/cairo.h @@ -3,7 +3,7 @@ // Purpose: Cairo library // Author: Anthony Bretaudeau // Created: 2007-08-25 -// RCS-ID: $Id: cairo.h 67232 2011-03-18 15:10:15Z DS $ +// RCS-ID: $Id: cairo.h 68935 2011-08-27 23:26:53Z RD $ // Copyright: (c) Anthony Bretaudeau // Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// @@ -16,129 +16,13 @@ #include "wx/dynlib.h" #include - -class wxCairoLibrary +extern "C" { -public: - // return the pointer to the global instance of this class or NULL if we - // failed to load/initialize it - static wxCairoLibrary *Get(); + +bool wxCairoInit(); +void wxCairoCleanUp(); - - // for internal use only - static void CleanUp(); - -private: - // the single wxCairoLibrary instance or NULL - static wxCairoLibrary *ms_lib; - - wxCairoLibrary(); - ~wxCairoLibrary(); - - bool IsOk(); - bool InitializeMethods(); - - wxDynamicLibrary m_libCairo; - wxDynamicLibrary m_libPangoCairo; - - // true if we successfully loaded the libraries and can use them - // - // note that this field must have this name as it's used by wxDL_XXX macros - bool m_ok; - -public: - wxDL_VOIDMETHOD_DEFINE( cairo_arc, - (cairo_t *cr, double xc, double yc, double radius, double angle1, double angle2), (cr, xc, yc, radius, angle1, angle2) ) - wxDL_VOIDMETHOD_DEFINE( cairo_arc_negative, - (cairo_t *cr, double xc, double yc, double radius, double angle1, double angle2), (cr, xc, yc, radius, angle1, angle2) ) - wxDL_VOIDMETHOD_DEFINE( cairo_clip, - (cairo_t *cr), (cr) ) - wxDL_VOIDMETHOD_DEFINE( cairo_close_path, - (cairo_t *cr), (cr) ) - wxDL_METHOD_DEFINE( cairo_t*, cairo_create, - (cairo_surface_t *target), (target), NULL) - wxDL_VOIDMETHOD_DEFINE( cairo_curve_to, - (cairo_t *cr, double x1, double y1, double x2, double y2, double x3, double y3), (cr, x1, y1, x2, y2, x3, y3) ) - wxDL_VOIDMETHOD_DEFINE( cairo_destroy, - (cairo_t *cr), (cr) ) - wxDL_VOIDMETHOD_DEFINE( cairo_fill, - (cairo_t *cr), (cr) ) - wxDL_VOIDMETHOD_DEFINE( cairo_fill_preserve, - (cairo_t *cr), (cr) ) - wxDL_METHOD_DEFINE( cairo_surface_t*, cairo_get_target, - (cairo_t *cr), (cr), NULL) - wxDL_METHOD_DEFINE( cairo_surface_t*, cairo_image_surface_create_for_data, - (unsigned char *data, cairo_format_t format, int width, int height, int stride), (data, format, width, height, stride), NULL) - wxDL_VOIDMETHOD_DEFINE( cairo_line_to, - (cairo_t *cr, double x, double y), (cr, x, y) ) - wxDL_VOIDMETHOD_DEFINE( cairo_move_to, - (cairo_t *cr, double x, double y), (cr, x, y) ) - wxDL_VOIDMETHOD_DEFINE( cairo_new_path, - (cairo_t *cr), (cr) ) - wxDL_VOIDMETHOD_DEFINE( cairo_paint, - (cairo_t *cr), (cr) ) - wxDL_VOIDMETHOD_DEFINE( cairo_pattern_add_color_stop_rgba, - (cairo_pattern_t *pattern, double offset, double red, double green, double blue, double alpha), (pattern, offset, red, green, blue, alpha) ) - wxDL_METHOD_DEFINE( cairo_pattern_t*, cairo_pattern_create_for_surface, - (cairo_surface_t *surface), (surface), NULL) - wxDL_METHOD_DEFINE( cairo_pattern_t*, cairo_pattern_create_linear, - (double x0, double y0, double x1, double y1), (x0, y0, x1, y1), NULL) - wxDL_METHOD_DEFINE( cairo_pattern_t*, cairo_pattern_create_radial, - (double cx0, double cy0, double radius0, double cx1, double cy1, double radius1), (cx0, cy0, radius0, cx1, cy1, radius1), NULL) - wxDL_VOIDMETHOD_DEFINE( cairo_pattern_destroy, - (cairo_pattern_t *pattern), (pattern) ) - wxDL_VOIDMETHOD_DEFINE( cairo_pattern_set_extend, - (cairo_pattern_t *pattern, cairo_extend_t extend), (pattern, extend) ) - wxDL_VOIDMETHOD_DEFINE( cairo_pattern_set_filter, - (cairo_pattern_t *pattern, cairo_filter_t filter), (pattern, filter) ) - wxDL_VOIDMETHOD_DEFINE( cairo_rectangle, - (cairo_t *cr, double x, double y, double width, double height), (cr, x, y, width, height) ) - wxDL_METHOD_DEFINE( cairo_t*, cairo_reference, - (cairo_t *cr), (cr), NULL ) - wxDL_VOIDMETHOD_DEFINE( cairo_reset_clip, - (cairo_t *cr), (cr) ) - wxDL_VOIDMETHOD_DEFINE( cairo_restore, - (cairo_t *cr), (cr) ) - wxDL_VOIDMETHOD_DEFINE( cairo_rotate, - (cairo_t *cr, double angle), (cr, angle) ) - wxDL_VOIDMETHOD_DEFINE( cairo_save, - (cairo_t *cr), (cr) ) - wxDL_VOIDMETHOD_DEFINE( cairo_scale, - (cairo_t *cr, double sx, double sy), (cr, sx, sy) ) - wxDL_VOIDMETHOD_DEFINE( cairo_set_dash, - (cairo_t *cr, const double *dashes, int num_dashes, double offset), (cr, dashes, num_dashes, offset) ) - wxDL_VOIDMETHOD_DEFINE( cairo_set_fill_rule, - (cairo_t *cr, cairo_fill_rule_t fill_rule), (cr, fill_rule) ) - wxDL_VOIDMETHOD_DEFINE( cairo_set_line_cap, - (cairo_t *cr, cairo_line_cap_t line_cap), (cr, line_cap) ) - wxDL_VOIDMETHOD_DEFINE( cairo_set_line_join, - (cairo_t *cr, cairo_line_join_t line_join), (cr, line_join) ) - wxDL_VOIDMETHOD_DEFINE( cairo_set_line_width, - (cairo_t *cr, double width), (cr, width) ) - wxDL_VOIDMETHOD_DEFINE( cairo_set_operator, - (cairo_t *cr, cairo_operator_t op), (cr, op) ) - wxDL_VOIDMETHOD_DEFINE( cairo_set_source, - (cairo_t *cr, cairo_pattern_t *source), (cr, source) ) - wxDL_VOIDMETHOD_DEFINE( cairo_set_source_rgba, - (cairo_t *cr, double red, double green, double blue, double alpha), (cr, red, green, blue, alpha) ) - wxDL_VOIDMETHOD_DEFINE( cairo_stroke, - (cairo_t *cr), (cr) ) - wxDL_VOIDMETHOD_DEFINE( cairo_stroke_preserve, - (cairo_t *cr), (cr) ) - wxDL_METHOD_DEFINE( cairo_surface_t*, cairo_surface_create_similar, - (cairo_surface_t *other, cairo_content_t content, int width, int height), (other, content, width, height), NULL) - wxDL_VOIDMETHOD_DEFINE( cairo_surface_destroy, - (cairo_surface_t *surface), (surface) ) - wxDL_VOIDMETHOD_DEFINE( cairo_translate, - (cairo_t *cr, double tx, double ty), (cr, tx, ty) ) - - wxDL_VOIDMETHOD_DEFINE( pango_cairo_update_layout, - (cairo_t *cr, PangoLayout *layout), (cr, layout) ) - wxDL_VOIDMETHOD_DEFINE( pango_cairo_show_layout, - (cairo_t *cr, PangoLayout *layout), (cr, layout) ) - - wxDECLARE_NO_COPY_CLASS(wxCairoLibrary); -}; +} #endif // wxUSE_CAIRO diff --git a/Externals/wxWidgets3/include/wx/calctrl.h b/Externals/wxWidgets3/include/wx/calctrl.h index 801edf0959..7c2921d8e0 100644 --- a/Externals/wxWidgets3/include/wx/calctrl.h +++ b/Externals/wxWidgets3/include/wx/calctrl.h @@ -4,7 +4,7 @@ // Author: Vadim Zeitlin // Modified by: // Created: 29.12.99 -// RCS-ID: $Id: calctrl.h 58718 2009-02-07 18:59:25Z VZ $ +// RCS-ID: $Id: calctrl.h 67681 2011-05-03 16:29:04Z DS $ // Copyright: (c) 1999 Vadim Zeitlin // Licence: wxWindows licence /////////////////////////////////////////////////////////////////////////////// @@ -112,10 +112,10 @@ public: void SetHoliday(bool holiday) { m_holiday = holiday; } // accessors - bool HasTextColour() const { return m_colText.Ok(); } - bool HasBackgroundColour() const { return m_colBack.Ok(); } - bool HasBorderColour() const { return m_colBorder.Ok(); } - bool HasFont() const { return m_font.Ok(); } + bool HasTextColour() const { return m_colText.IsOk(); } + bool HasBackgroundColour() const { return m_colBack.IsOk(); } + bool HasBorderColour() const { return m_colBorder.IsOk(); } + bool HasFont() const { return m_font.IsOk(); } bool HasBorder() const { return m_border != wxCAL_BORDER_NONE; } bool IsHoliday() const { return m_holiday; } diff --git a/Externals/wxWidgets3/include/wx/chartype.h b/Externals/wxWidgets3/include/wx/chartype.h index 41eb59d9d6..d122b4c71c 100644 --- a/Externals/wxWidgets3/include/wx/chartype.h +++ b/Externals/wxWidgets3/include/wx/chartype.h @@ -4,7 +4,7 @@ * Author: Joel Farley, Ove Kåven * Modified by: Vadim Zeitlin, Robert Roebling, Ron Lee * Created: 1998/06/12 - * RCS-ID: $Id: chartype.h 66968 2011-02-19 13:44:19Z VZ $ + * RCS-ID: $Id: chartype.h 70345 2012-01-15 01:05:28Z VZ $ * Copyright: (c) 1998-2006 wxWidgets dev team * Licence: wxWindows licence */ @@ -105,8 +105,6 @@ #define wxHAVE_TCHAR_SUPPORT #elif defined(__DMC__) #define wxHAVE_TCHAR_SUPPORT -#elif defined(__WXPALMOS__) - #include #elif defined(__MINGW32__) && wxCHECK_W32API_VERSION( 1, 0 ) #define wxHAVE_TCHAR_SUPPORT #include diff --git a/Externals/wxWidgets3/include/wx/checkbox.h b/Externals/wxWidgets3/include/wx/checkbox.h index f3dc6ddc52..507bf31fea 100644 --- a/Externals/wxWidgets3/include/wx/checkbox.h +++ b/Externals/wxWidgets3/include/wx/checkbox.h @@ -4,7 +4,7 @@ // Author: Vadim Zeitlin // Modified by: // Created: 07.09.00 -// RCS-ID: $Id: checkbox.h 65942 2010-10-28 14:23:09Z VZ $ +// RCS-ID: $Id: checkbox.h 70345 2012-01-15 01:05:28Z VZ $ // Copyright: (c) wxWidgets team // Licence: wxWindows licence /////////////////////////////////////////////////////////////////////////////// @@ -41,18 +41,6 @@ */ #define wxCHK_ALLOW_3RD_STATE_FOR_USER 0x2000 -/* - * The possible states of a 3-state checkbox (Compatible - * with the 2-state checkbox). - */ -enum wxCheckBoxState -{ - wxCHK_UNCHECKED, - wxCHK_CHECKED, - wxCHK_UNDETERMINED /* 3-state checkbox only */ -}; - - extern WXDLLIMPEXP_DATA_CORE(const char) wxCheckBoxNameStr[]; // ---------------------------------------------------------------------------- @@ -196,8 +184,6 @@ private: #elif defined(__WXPM__) #undef wxHAS_3STATE_CHECKBOX #include "wx/os2/checkbox.h" -#elif defined(__WXPALMOS__) - #include "wx/palmos/checkbox.h" #endif #endif // wxUSE_CHECKBOX diff --git a/Externals/wxWidgets3/include/wx/chkconf.h b/Externals/wxWidgets3/include/wx/chkconf.h index 723c71fb67..80f104911b 100644 --- a/Externals/wxWidgets3/include/wx/chkconf.h +++ b/Externals/wxWidgets3/include/wx/chkconf.h @@ -4,7 +4,7 @@ * Author: Vadim Zeitlin * Modified by: * Created: 09.08.00 - * RCS-ID: $Id: chkconf.h 67280 2011-03-22 14:17:38Z DS $ + * RCS-ID: $Id: chkconf.h 70703 2012-02-26 20:24:25Z VZ $ * Copyright: (c) 2000 Vadim Zeitlin * Licence: wxWindows licence */ @@ -57,11 +57,6 @@ global features */ -/* GUI build by default */ -#if !defined(wxUSE_GUI) -# define wxUSE_GUI 1 -#endif /* !defined(wxUSE_GUI) */ - /* If we're compiling without support for threads/exceptions we have to disable the corresponding features. @@ -299,6 +294,22 @@ # endif #endif /* !defined(wxUSE_SOCKETS) */ +#ifndef wxUSE_STD_CONTAINERS +# ifdef wxABORT_ON_CONFIG_ERROR +# error "wxUSE_STD_CONTAINERS must be defined, please read comment near the top of this file." +# else +# define wxUSE_STD_CONTAINERS 0 +# endif +#endif /* !defined(wxUSE_STD_CONTAINERS) */ + +#ifndef wxUSE_STD_STRING_CONV_IN_WXSTRING +# ifdef wxABORT_ON_CONFIG_ERROR +# error "wxUSE_STD_STRING_CONV_IN_WXSTRING must be defined, please read comment near the top of this file." +# else +# define wxUSE_STD_STRING_CONV_IN_WXSTRING 0 +# endif +#endif /* !defined(wxUSE_STD_STRING_CONV_IN_WXSTRING) */ + #ifndef wxUSE_STREAMS # ifdef wxABORT_ON_CONFIG_ERROR # error "wxUSE_STREAMS must be defined, please read comment near the top of this file." @@ -599,6 +610,14 @@ # endif #endif /* !defined(wxUSE_DATEPICKCTRL) */ +#ifndef wxUSE_DC_TRANSFORM_MATRIX +# ifdef wxABORT_ON_CONFIG_ERROR +# error "wxUSE_DC_TRANSFORM_MATRIX must be defined, please read comment near the top of this file." +# else +# define wxUSE_DC_TRANSFORM_MATRIX 1 +# endif +#endif /* wxUSE_DC_TRANSFORM_MATRIX */ + #ifndef wxUSE_DIRPICKERCTRL # ifdef wxABORT_ON_CONFIG_ERROR # error "wxUSE_DIRPICKERCTRL must be defined, please read comment near the top of this file." @@ -729,7 +748,7 @@ #endif /* !defined(wxUSE_HTML) */ #ifndef wxUSE_LIBMSPACK -# if !defined(__UNIX__) || defined(__WXPALMOS__) +# if !defined(__UNIX__) /* set to 0 on platforms that don't have libmspack */ # define wxUSE_LIBMSPACK 0 # else @@ -955,7 +974,15 @@ # else # define wxUSE_RICHMSGDLG 0 # endif -#endif /* !defined(wxUSE_RIBBON) */ +#endif /* !defined(wxUSE_RICHMSGDLG) */ + +#ifndef wxUSE_RICHTOOLTIP +# ifdef wxABORT_ON_CONFIG_ERROR +# error "wxUSE_RICHTOOLTIP must be defined, please read comment near the top of this file." +# else +# define wxUSE_RICHTOOLTIP 0 +# endif +#endif /* !defined(wxUSE_RICHTOOLTIP) */ #ifndef wxUSE_SASH # ifdef wxABORT_ON_CONFIG_ERROR @@ -1077,6 +1104,14 @@ # endif #endif /* !defined(wxUSE_TEXTCTRL) */ +#ifndef wxUSE_TIMEPICKCTRL +# ifdef wxABORT_ON_CONFIG_ERROR +# error "wxUSE_TIMEPICKCTRL must be defined, please read comment near the top of this file." +# else +# define wxUSE_TIMEPICKCTRL 0 +# endif +#endif /* !defined(wxUSE_TIMEPICKCTRL) */ + #ifndef wxUSE_TIPWINDOW # ifdef wxABORT_ON_CONFIG_ERROR # error "wxUSE_TIPWINDOW must be defined, please read comment near the top of this file." @@ -1109,6 +1144,14 @@ # endif #endif /* !defined(wxUSE_TREECTRL) */ +#ifndef wxUSE_TREELISTCTRL +# ifdef wxABORT_ON_CONFIG_ERROR +# error "wxUSE_TREELISTCTRL must be defined, please read comment near the top of this file." +# else +# define wxUSE_TREELISTCTRL 0 +# endif +#endif /* !defined(wxUSE_TREELISTCTRL) */ + #ifndef wxUSE_UIACTIONSIMULATOR # ifdef wxABORT_ON_CONFIG_ERROR # error "wxUSE_UIACTIONSIMULATOR must be defined, please read comment near the top of this file." @@ -1125,6 +1168,14 @@ # endif #endif /* !defined(wxUSE_VALIDATORS) */ +#ifndef wxUSE_WEBVIEW +# ifdef wxABORT_ON_CONFIG_ERROR +# error "wxUSE_WEBVIEW must be defined, please read comment near the top of this file." +# else +# define wxUSE_WEBVIEW 0 +# endif +#endif /* !defined(wxUSE_WEBVIEW) */ + #ifndef wxUSE_WXHTML_HELP # ifdef wxABORT_ON_CONFIG_ERROR # error "wxUSE_WXHTML_HELP must be defined, please read comment near the top of this file." @@ -1150,9 +1201,7 @@ checks use wxUSE_XXX symbols in #if tests. */ -#if defined(__WXPALMOS__) -# include "wx/palmos/chkconf.h" -#elif defined(__WXWINCE__) +#if defined(__WXWINCE__) # include "wx/msw/wince/chkconf.h" #elif defined(__WXMSW__) # include "wx/msw/chkconf.h" @@ -1164,14 +1213,14 @@ # include "wx/osx/chkconf.h" #elif defined(__OS2__) # include "wx/os2/chkconf.h" -#elif defined(__WXMGL__) -# include "wx/mgl/chkconf.h" #elif defined(__WXDFB__) # include "wx/dfb/chkconf.h" #elif defined(__WXMOTIF__) # include "wx/motif/chkconf.h" #elif defined(__WXX11__) # include "wx/x11/chkconf.h" +#elif defined(__WXANDROID__) +# include "wx/android/chkconf.h" #endif /* @@ -1439,7 +1488,8 @@ wxUSE_STATUSBAR || \ wxUSE_TEXTCTRL || \ wxUSE_TOOLBAR || \ - wxUSE_TREECTRL + wxUSE_TREECTRL || \ + wxUSE_TREELISTCTRL # if !wxUSE_CONTROLS # ifdef wxABORT_ON_CONFIG_ERROR # error "wxUSE_CONTROLS unset but some controls used" @@ -1582,9 +1632,7 @@ #ifndef wxUSE_NATIVE_STATUSBAR # define wxUSE_NATIVE_STATUSBAR 0 #elif wxUSE_NATIVE_STATUSBAR -# if defined(__WXUNIVERSAL__) || !( defined(__WXMSW__) || \ - defined(__WXMAC__) || \ - defined(__WXPALMOS__) ) +# if defined(__WXUNIVERSAL__) || !(defined(__WXMSW__) || defined(__WXMAC__)) # undef wxUSE_NATIVE_STATUSBAR # define wxUSE_NATIVE_STATUSBAR 0 # endif @@ -1672,16 +1720,16 @@ # endif #endif /* wxUSE_CALENDARCTRL */ -#if wxUSE_DATEPICKCTRL +#if wxUSE_DATEPICKCTRL || wxUSE_TIMEPICKCTRL # if !wxUSE_DATETIME # ifdef wxABORT_ON_CONFIG_ERROR -# error "wxDatePickerCtrl requires wxUSE_DATETIME" +# error "wxDatePickerCtrl and wxTimePickerCtrl requires wxUSE_DATETIME" # else # undef wxUSE_DATETIME # define wxUSE_DATETIME 1 # endif # endif -#endif /* wxUSE_DATEPICKCTRL */ +#endif /* wxUSE_DATEPICKCTRL || wxUSE_TIMEPICKCTRL */ #if wxUSE_CHECKLISTBOX # if !wxUSE_LISTBOX @@ -1705,6 +1753,17 @@ # endif #endif /* wxUSE_CHOICEDLG */ +#if wxUSE_FILECTRL +# if !wxUSE_DATETIME +# ifdef wxABORT_ON_CONFIG_ERROR +# error "wxFileCtrl requires wxDateTime" +# else +# undef wxUSE_DATETIME +# define wxUSE_DATETIME 1 +# endif +# endif +#endif /* wxUSE_FILECTRL */ + #if wxUSE_HELP # if !wxUSE_BMPBUTTON # ifdef wxABORT_ON_CONFIG_ERROR @@ -1935,7 +1994,7 @@ #endif /* wxUSE_FILEDLG */ #if !wxUSE_GAUGE || !wxUSE_BUTTON -# if wxUSE_PROGRESSDLG && !defined(__WXPALMOS__) +# if wxUSE_PROGRESSDLG # ifdef wxABORT_ON_CONFIG_ERROR # error "Generic progress dialog requires wxUSE_GAUGE and wxUSE_BUTTON" # else @@ -1977,7 +2036,7 @@ #endif #if !wxUSE_IMAGLIST -# if wxUSE_TREECTRL || wxUSE_NOTEBOOK || wxUSE_LISTCTRL +# if wxUSE_TREECTRL || wxUSE_NOTEBOOK || wxUSE_LISTCTRL || wxUSE_TREELISTCTRL # ifdef wxABORT_ON_CONFIG_ERROR # error "wxImageList must be compiled as well" # else @@ -1996,7 +2055,7 @@ # define wxUSE_RADIOBTN 1 # endif # endif -# if !wxUSE_STATBOX && !defined(__WXPALMOS__) +# if !wxUSE_STATBOX # ifdef wxABORT_ON_CONFIG_ERROR # error "wxUSE_RADIOBOX requires wxUSE_STATBOX" # else @@ -2104,6 +2163,24 @@ # endif #endif /* wxUSE_VARIANT */ +#if wxUSE_TREELISTCTRL && !wxUSE_DATAVIEWCTRL +# ifdef wxABORT_ON_CONFIG_ERROR +# error "wxUSE_TREELISTCTRL requires wxDataViewCtrl" +# else +# undef wxUSE_TREELISTCTRL +# define wxUSE_TREELISTCTRL 0 +# endif +#endif /* wxUSE_TREELISTCTRL */ + +#if wxUSE_WEBVIEW && !(wxUSE_WEBVIEW_WEBKIT || wxUSE_WEBVIEW_IE) +# ifdef wxABORT_ON_CONFIG_ERROR +# error "wxUSE_WEBVIEW requires at least one backend" +# else +# undef wxUSE_WEBVIEW +# define wxUSE_WEBVIEW 0 +# endif +#endif /* wxUSE_WEBVIEW && !any web view backend */ + #endif /* wxUSE_GUI */ #endif /* _WX_CHKCONF_H_ */ diff --git a/Externals/wxWidgets3/include/wx/choice.h b/Externals/wxWidgets3/include/wx/choice.h index e1f9c20456..e7854fb3cc 100644 --- a/Externals/wxWidgets3/include/wx/choice.h +++ b/Externals/wxWidgets3/include/wx/choice.h @@ -4,7 +4,7 @@ // Author: Vadim Zeitlin // Modified by: // Created: 26.07.99 -// RCS-ID: $Id: choice.h 58757 2009-02-08 11:45:59Z VZ $ +// RCS-ID: $Id: choice.h 70345 2012-01-15 01:05:28Z VZ $ // Copyright: (c) wxWidgets team // Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// @@ -84,8 +84,6 @@ private: #include "wx/cocoa/choice.h" #elif defined(__WXPM__) #include "wx/os2/choice.h" -#elif defined(__WXPALMOS__) - #include "wx/palmos/choice.h" #endif #endif // wxUSE_CHOICE diff --git a/Externals/wxWidgets3/include/wx/choicebk.h b/Externals/wxWidgets3/include/wx/choicebk.h index 322d931d66..abd37cbb7d 100644 --- a/Externals/wxWidgets3/include/wx/choicebk.h +++ b/Externals/wxWidgets3/include/wx/choicebk.h @@ -4,7 +4,7 @@ // Author: Vadim Zeitlin // Modified by: Wlodzimierz ABX Skiba from wx/listbook.h // Created: 15.09.04 -// RCS-ID: $Id: choicebk.h 66233 2010-11-22 01:23:21Z VZ $ +// RCS-ID: $Id: choicebk.h 68810 2011-08-21 14:08:49Z VZ $ // Copyright: (c) Vadim Zeitlin, Wlodzimierz Skiba // Licence: wxWindows licence /////////////////////////////////////////////////////////////////////////////// @@ -68,7 +68,7 @@ public: wxWindow *page, const wxString& text, bool bSelect = false, - int imageId = -1); + int imageId = NO_IMAGE); virtual int SetSelection(size_t n) { return DoSetSelection(n, SetSelection_SendEvent); } virtual int ChangeSelection(size_t n) { return DoSetSelection(n); } diff --git a/Externals/wxWidgets3/include/wx/clipbrd.h b/Externals/wxWidgets3/include/wx/clipbrd.h index 9ba7f3734b..f9ff4df6af 100644 --- a/Externals/wxWidgets3/include/wx/clipbrd.h +++ b/Externals/wxWidgets3/include/wx/clipbrd.h @@ -4,7 +4,7 @@ // Author: Vadim Zeitlin // Modified by: // Created: 19.10.99 -// RCS-ID: $Id: clipbrd.h 61485 2009-07-20 23:54:08Z VZ $ +// RCS-ID: $Id: clipbrd.h 70353 2012-01-15 14:46:41Z VZ $ // Copyright: (c) wxWidgets Team // Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// @@ -160,8 +160,6 @@ typedef void (wxEvtHandler::*wxClipboardEventFunction)(wxClipboardEvent&); #include "wx/gtk1/clipbrd.h" #elif defined(__WXX11__) #include "wx/x11/clipbrd.h" -#elif defined(__WXMGL__) - #include "wx/mgl/clipbrd.h" #elif defined(__WXMAC__) #include "wx/osx/clipbrd.h" #elif defined(__WXCOCOA__) diff --git a/Externals/wxWidgets3/include/wx/cmdline.h b/Externals/wxWidgets3/include/wx/cmdline.h index af67c9c558..8d02fa3a68 100644 --- a/Externals/wxWidgets3/include/wx/cmdline.h +++ b/Externals/wxWidgets3/include/wx/cmdline.h @@ -5,7 +5,7 @@ // Author: Vadim Zeitlin // Modified by: // Created: 04.01.00 -// RCS-ID: $Id: cmdline.h 66253 2010-11-24 00:42:53Z VZ $ +// RCS-ID: $Id: cmdline.h 69797 2011-11-22 13:18:58Z VZ $ // Copyright: (c) 2000 Vadim Zeitlin // Licence: wxWindows licence /////////////////////////////////////////////////////////////////////////////// @@ -183,12 +183,25 @@ public: void AddSwitch(const wxString& name, const wxString& lng = wxEmptyString, const wxString& desc = wxEmptyString, int flags = 0); + void AddLongSwitch(const wxString& lng, + const wxString& desc = wxEmptyString, + int flags = 0) + { + AddSwitch(wxString(), lng, desc, flags); + } // an option taking a value of the given type void AddOption(const wxString& name, const wxString& lng = wxEmptyString, const wxString& desc = wxEmptyString, wxCmdLineParamType type = wxCMD_LINE_VAL_STRING, int flags = 0); + void AddLongOption(const wxString& lng, + const wxString& desc = wxEmptyString, + wxCmdLineParamType type = wxCMD_LINE_VAL_STRING, + int flags = 0) + { + AddOption(wxString(), lng, desc, type, flags); + } // a parameter void AddParam(const wxString& desc = wxEmptyString, diff --git a/Externals/wxWidgets3/include/wx/cmdproc.h b/Externals/wxWidgets3/include/wx/cmdproc.h index dc738da629..e1692cbef5 100644 --- a/Externals/wxWidgets3/include/wx/cmdproc.h +++ b/Externals/wxWidgets3/include/wx/cmdproc.h @@ -4,7 +4,7 @@ // Author: Julian Smart (extracted from docview.h by VZ) // Modified by: // Created: 05.11.00 -// RCS-ID: $Id: cmdproc.h 58757 2009-02-08 11:45:59Z VZ $ +// RCS-ID: $Id: cmdproc.h 70459 2012-01-25 00:05:09Z VZ $ // Copyright: (c) wxWidgets team // Licence: wxWindows licence /////////////////////////////////////////////////////////////////////////////// @@ -97,10 +97,7 @@ public: virtual void ClearCommands(); // Has the current project been changed? - virtual bool IsDirty() const - { - return m_currentCommand && (m_lastSavedCommand != m_currentCommand); - } + virtual bool IsDirty() const; // Mark the current command as the one where the last save took place void MarkAsSaved() diff --git a/Externals/wxWidgets3/include/wx/cmndata.h b/Externals/wxWidgets3/include/wx/cmndata.h index e803f49711..ce330fde5e 100644 --- a/Externals/wxWidgets3/include/wx/cmndata.h +++ b/Externals/wxWidgets3/include/wx/cmndata.h @@ -4,7 +4,7 @@ // Author: Julian Smart and others // Modified by: // Created: 01/02/97 -// RCS-ID: $Id: cmndata.h 66615 2011-01-07 05:26:57Z PC $ +// RCS-ID: $Id: cmndata.h 70636 2012-02-20 21:55:55Z VZ $ // Copyright: (c) // Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// @@ -189,7 +189,7 @@ public: // Is this data OK for showing the print dialog? bool Ok() const { return IsOk(); } - bool IsOk() const { return m_printData.Ok() ; } + bool IsOk() const { return m_printData.IsOk() ; } wxPrintData& GetPrintData() { return m_printData; } void SetPrintData(const wxPrintData& printData) { m_printData = printData; } @@ -249,7 +249,7 @@ public: // Is this data OK for showing the page setup dialog? bool Ok() const { return IsOk(); } - bool IsOk() const { return m_printData.Ok() ; } + bool IsOk() const { return m_printData.IsOk() ; } // If a corresponding paper type is found in the paper database, will set the m_printData // paper size id member as well. @@ -280,7 +280,7 @@ public: // Use paper id in wxPrintData to set this object's paper size void CalculatePaperSizeFromId(); - wxPageSetupDialogData& operator=(const wxPageSetupData& data); + wxPageSetupDialogData& operator=(const wxPageSetupDialogData& data); wxPageSetupDialogData& operator=(const wxPrintData& data); wxPrintData& GetPrintData() { return m_printData; } diff --git a/Externals/wxWidgets3/include/wx/cocoa/chkconf.h b/Externals/wxWidgets3/include/wx/cocoa/chkconf.h index 450df1692d..0b2516cc44 100644 --- a/Externals/wxWidgets3/include/wx/cocoa/chkconf.h +++ b/Externals/wxWidgets3/include/wx/cocoa/chkconf.h @@ -3,7 +3,7 @@ * Purpose: wxCocoa-specific config settings checks * Author: Vadim Zeitlin * Created: 2008-09-11 - * RCS-ID: $Id: chkconf.h 55546 2008-09-11 11:20:33Z VZ $ + * RCS-ID: $Id: chkconf.h 67497 2011-04-15 19:18:34Z DS $ * Copyright: (c) 2008 Vadim Zeitlin * Licence: wxWindows licence */ @@ -19,4 +19,4 @@ #undef wxUSE_LOG_DIALOG #define wxUSE_LOG_DIALOG 0 -#endif // _WX_COCOA_CHKCONF_H_ +#endif /* _WX_COCOA_CHKCONF_H_ */ diff --git a/Externals/wxWidgets3/include/wx/cocoa/dc.h b/Externals/wxWidgets3/include/wx/cocoa/dc.h index 4c043ce8e7..e388eccaec 100644 --- a/Externals/wxWidgets3/include/wx/cocoa/dc.h +++ b/Externals/wxWidgets3/include/wx/cocoa/dc.h @@ -4,7 +4,7 @@ // Author: David Elliott // Modified by: // Created: 2003/04/01 -// RCS-ID: $Id: dc.h 58757 2009-02-08 11:45:59Z VZ $ +// RCS-ID: $Id: dc.h 70165 2011-12-29 14:42:13Z SN $ // Copyright: (c) 2003 David Elliott // Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// @@ -80,10 +80,10 @@ public: virtual void Clear(); virtual bool StartDoc( const wxString& WXUNUSED(message) ) { return true; } - virtual void EndDoc(void) {}; + virtual void EndDoc(void) {} - virtual void StartPage(void) {}; - virtual void EndPage(void) {}; + virtual void StartPage(void) {} + virtual void EndPage(void) {} virtual void SetFont(const wxFont& font); virtual void SetPen(const wxPen& pen); diff --git a/Externals/wxWidgets3/include/wx/cocoa/font.h b/Externals/wxWidgets3/include/wx/cocoa/font.h index 3f61c4fd1b..4783532b44 100644 --- a/Externals/wxWidgets3/include/wx/cocoa/font.h +++ b/Externals/wxWidgets3/include/wx/cocoa/font.h @@ -4,7 +4,7 @@ // Author: Julian Smart // Modified by: // Created: 01/02/97 -// RCS-ID: $Id: font.h 67254 2011-03-20 00:14:35Z DS $ +// RCS-ID: $Id: font.h 70445 2012-01-23 11:28:21Z VZ $ // Copyright: (c) Julian Smart // Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// @@ -75,6 +75,19 @@ public: SetPixelSize(pixelSize); } + wxFont(int pointSize, + wxFontFamily family, + int flags = wxFONTFLAG_DEFAULT, + const wxString& face = wxEmptyString, + wxFontEncoding encoding = wxFONTENCODING_DEFAULT) + { + Create(pointSize, family, + GetStyleFromFlags(flags), + GetWeightFromFlags(flags), + GetUnderlinedFromFlags(flags), + face, encoding); + } + /*! @abstract Construction with opaque wxNativeFontInfo */ wxFont(const wxNativeFontInfo& info) diff --git a/Externals/wxWidgets3/include/wx/cocoa/notebook.h b/Externals/wxWidgets3/include/wx/cocoa/notebook.h index 46be4d570c..fade3ac3a6 100644 --- a/Externals/wxWidgets3/include/wx/cocoa/notebook.h +++ b/Externals/wxWidgets3/include/wx/cocoa/notebook.h @@ -4,7 +4,7 @@ // Author: David Elliott // Modified by: // Created: 2004/04/08 -// RCS-ID: $Id: notebook.h 65930 2010-10-27 16:54:24Z VZ $ +// RCS-ID: $Id: notebook.h 68810 2011-08-21 14:08:49Z VZ $ // Copyright: (c) 2004 David Elliott // Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// @@ -97,7 +97,7 @@ public: wxNotebookPage *win, const wxString& strText, bool bSelect = false, - int imageId = -1 ); + int imageId = NO_IMAGE ); protected: }; diff --git a/Externals/wxWidgets3/include/wx/cocoa/sound.h b/Externals/wxWidgets3/include/wx/cocoa/sound.h index 2d22dfdff3..09bc45523d 100644 --- a/Externals/wxWidgets3/include/wx/cocoa/sound.h +++ b/Externals/wxWidgets3/include/wx/cocoa/sound.h @@ -5,7 +5,7 @@ // Authors: David Elliott, Ryan Norton // Modified by: // Created: 2004-10-02 -// RCS-ID: $Id: sound.h 67254 2011-03-20 00:14:35Z DS $ +// RCS-ID: $Id: sound.h 69178 2011-09-21 15:08:02Z VZ $ // Copyright: (c) 2004 David Elliott, Ryan Norton // Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// @@ -25,7 +25,7 @@ public: wxSound(const wxString& fileName, bool isResource = false) : m_cocoaNSSound(NULL) { Create(fileName, isResource); } - wxSound(int size, const wxByte* data) + wxSound(size_t size, const void* data) : m_cocoaNSSound(NULL) { LoadWAV(data,size,true); } wxSound(const wxSound& sound); // why not? @@ -43,7 +43,7 @@ public: { return m_cocoaNSSound; } protected: bool DoPlay(unsigned flags) const; - bool LoadWAV(const wxUint8 *data, size_t length, bool copyData); + bool LoadWAV(const void* data, size_t length, bool copyData); private: WX_NSSound m_cocoaNSSound; static const wxObjcAutoRefFromAlloc sm_cocoaDelegate; diff --git a/Externals/wxWidgets3/include/wx/colordlg.h b/Externals/wxWidgets3/include/wx/colordlg.h index 1b339788d2..4632e99698 100644 --- a/Externals/wxWidgets3/include/wx/colordlg.h +++ b/Externals/wxWidgets3/include/wx/colordlg.h @@ -4,7 +4,7 @@ // Author: Vadim Zeitiln // Modified by: // Created: 01/02/97 -// RCS-ID: $Id: colordlg.h 66615 2011-01-07 05:26:57Z PC $ +// RCS-ID: $Id: colordlg.h 70345 2012-01-15 01:05:28Z VZ $ // Copyright: (c) wxWidgets team // Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// @@ -24,8 +24,6 @@ #include "wx/osx/colordlg.h" #elif defined(__WXGTK20__) && !defined(__WXUNIVERSAL__) #include "wx/gtk/colordlg.h" -#elif defined(__WXPALMOS__) - #include "wx/palmos/colordlg.h" #else #include "wx/generic/colrdlgg.h" diff --git a/Externals/wxWidgets3/include/wx/colour.h b/Externals/wxWidgets3/include/wx/colour.h index 08dd20910c..0c9cf08565 100644 --- a/Externals/wxWidgets3/include/wx/colour.h +++ b/Externals/wxWidgets3/include/wx/colour.h @@ -4,7 +4,7 @@ // Author: Julian Smart // Modified by: Francesco Montorsi // Created: -// RCS-ID: $Id: colour.h 66966 2011-02-19 12:32:59Z VZ $ +// RCS-ID: $Id: colour.h 70353 2012-01-15 14:46:41Z VZ $ // Copyright: Julian Smart // Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// @@ -213,9 +213,7 @@ WXDLLIMPEXP_CORE bool wxFromString(const wxString& str, wxColourBase* col); -#if defined(__WXPALMOS__) - #include "wx/generic/colour.h" -#elif defined(__WXMSW__) +#if defined(__WXMSW__) #include "wx/msw/colour.h" #elif defined(__WXMOTIF__) #include "wx/motif/colour.h" @@ -223,8 +221,6 @@ WXDLLIMPEXP_CORE bool wxFromString(const wxString& str, wxColourBase* col); #include "wx/gtk/colour.h" #elif defined(__WXGTK__) #include "wx/gtk1/colour.h" -#elif defined(__WXMGL__) - #include "wx/generic/colour.h" #elif defined(__WXDFB__) #include "wx/generic/colour.h" #elif defined(__WXX11__) diff --git a/Externals/wxWidgets3/include/wx/combo.h b/Externals/wxWidgets3/include/wx/combo.h index 98a6094ff7..f624f7cd59 100644 --- a/Externals/wxWidgets3/include/wx/combo.h +++ b/Externals/wxWidgets3/include/wx/combo.h @@ -4,7 +4,7 @@ // Author: Jaakko Salli // Modified by: // Created: Apr-30-2006 -// RCS-ID: $Id: combo.h 67280 2011-03-22 14:17:38Z DS $ +// RCS-ID: $Id: combo.h 69942 2011-12-07 14:05:11Z VZ $ // Copyright: (c) Jaakko Salli // Licence: wxWindows licence /////////////////////////////////////////////////////////////////////////////// @@ -560,7 +560,8 @@ protected: // Standard textctrl positioning routine. Just give it platform-dependant // textctrl coordinate adjustment. - virtual void PositionTextCtrl( int textCtrlXAdjust, int textCtrlYAdjust ); + virtual void PositionTextCtrl( int textCtrlXAdjust = 0, + int textCtrlYAdjust = 0); // event handlers void OnSizeEvent( wxSizeEvent& event ); @@ -641,7 +642,7 @@ protected: // main (ie. topmost) window of a composite control (default = this) wxWindow* m_mainCtrlWnd; - // used to prevent immediate re-popupping incase closed popup + // used to prevent immediate re-popupping in case closed popup // by clicking on the combo control (needed because of inconsistent // transient implementation across platforms). wxLongLong m_timeCanAcceptClick; @@ -767,6 +768,13 @@ public: // Return true for success. virtual bool Create(wxWindow* parent) = 0; + // Calls Destroy() for the popup control (i.e. one returned by + // GetControl()) and makes sure that 'this' is deleted at the end. + // Default implementation works for both cases where popup control + // class is multiple inherited or created on heap as a separate + // object. + virtual void DestroyPopup(); + // We must have an associated control which is subclassed by the combobox. virtual wxWindow *GetControl() = 0; diff --git a/Externals/wxWidgets3/include/wx/combobox.h b/Externals/wxWidgets3/include/wx/combobox.h index 63ae722bea..a28dae2454 100644 --- a/Externals/wxWidgets3/include/wx/combobox.h +++ b/Externals/wxWidgets3/include/wx/combobox.h @@ -4,7 +4,7 @@ // Author: Vadim Zeitlin // Modified by: // Created: 24.12.00 -// RCS-ID: $Id: combobox.h 63242 2010-01-24 01:00:45Z VZ $ +// RCS-ID: $Id: combobox.h 70165 2011-12-29 14:42:13Z SN $ // Copyright: (c) 1996-2000 wxWidgets team // Licence: wxWindows licence /////////////////////////////////////////////////////////////////////////////// @@ -36,7 +36,13 @@ public: wxItemContainer::Clear(); } - bool IsEmpty() const { return wxItemContainer::IsEmpty(); } + // IsEmpty() is ambiguous because we inherit it from both wxItemContainer + // and wxTextEntry, and even if defined it here to help the compiler with + // choosing one of them, it would still be confusing for the human users of + // this class. So instead define the clearly named methods below and leave + // IsEmpty() ambiguous to trigger a compilation error if it's used. + bool IsListEmpty() const { return wxItemContainer::IsEmpty(); } + bool IsTextEmpty() const { return wxTextEntry::IsEmpty(); } // also bring in GetSelection() versions of both base classes in scope // @@ -47,8 +53,8 @@ public: virtual int GetSelection() const = 0; virtual void GetSelection(long *from, long *to) const = 0; - virtual void Popup() { wxFAIL_MSG( wxT("Not implemented") ); }; - virtual void Dismiss() { wxFAIL_MSG( wxT("Not implemented") ); }; + virtual void Popup() { wxFAIL_MSG( wxT("Not implemented") ); } + virtual void Dismiss() { wxFAIL_MSG( wxT("Not implemented") ); } // may return value different from GetSelection() when the combobox // dropdown is shown and the user selected, but not yet accepted, a value diff --git a/Externals/wxWidgets3/include/wx/compositewin.h b/Externals/wxWidgets3/include/wx/compositewin.h index 390607d71f..2c6503aaeb 100644 --- a/Externals/wxWidgets3/include/wx/compositewin.h +++ b/Externals/wxWidgets3/include/wx/compositewin.h @@ -3,7 +3,7 @@ // Purpose: wxCompositeWindow<> declaration // Author: Vadim Zeitlin // Created: 2011-01-02 -// RCS-ID: $Id: compositewin.h 66931 2011-02-16 23:45:04Z VZ $ +// RCS-ID: $Id: compositewin.h 69470 2011-10-19 16:20:01Z VS $ // Copyright: (c) 2011 Vadim Zeitlin // Licence: wxWindows licence /////////////////////////////////////////////////////////////////////////////// @@ -12,22 +12,15 @@ #define _WX_COMPOSITEWIN_H_ #include "wx/window.h" +#include "wx/containr.h" + +class WXDLLIMPEXP_FWD_CORE wxToolTip; // NB: This is an experimental and, as for now, undocumented class used only by // wxWidgets itself internally. Don't use it in your code until its API is // officially stabilized unless you are ready to change it with the next // wxWidgets release. -// FIXME-VC6: This compiler can't compile DoSetForAllParts() template function, -// it can't determine whether the deduced type should be "T" or "const T&". And -// without this function wxCompositeWindow is pretty useless so simply disable -// this code for it, this does mean that setting colours/fonts/... for -// composite controls won't work in the library compiled with it but so far -// this only affects the generic wxDatePickerCtrl which is not used by default -// under MSW anyhow so it doesn't seem to be worth it to spend time and uglify -// the code to fix it. -#ifndef __VISUALC6__ - // ---------------------------------------------------------------------------- // wxCompositeWindow is a helper for implementing composite windows: to define // a class using subwindows, simply inherit from it specialized with the real @@ -42,7 +35,25 @@ public: typedef W BaseWindowClass; // Default ctor doesn't do anything. - wxCompositeWindow() { } + wxCompositeWindow() + { + this->Connect + ( + wxEVT_CREATE, + wxWindowCreateEventHandler(wxCompositeWindow::OnWindowCreate) + ); + + } + +#ifndef __VISUALC6__ + // FIXME-VC6: This compiler can't compile DoSetForAllParts() template function, + // it can't determine whether the deduced type should be "T" or "const T&". And + // without this function wxCompositeWindow is pretty useless so simply disable + // this code for it, this does mean that setting colours/fonts/... for + // composite controls won't work in the library compiled with it but so far + // this only affects the generic wxDatePickerCtrl which is not used by default + // under MSW anyhow so it doesn't seem to be worth it to spend time and uglify + // the code to fix it. // Override all wxWindow methods which must be forwarded to the composite // window parts. @@ -59,7 +70,7 @@ public: if ( !BaseWindowClass::SetForegroundColour(colour) ) return false; - DoSetForAllParts(&wxWindowBase::SetForegroundColour, colour); + SetForAllParts(&wxWindowBase::SetForegroundColour, colour); return true; } @@ -69,7 +80,7 @@ public: if ( !BaseWindowClass::SetBackgroundColour(colour) ) return false; - DoSetForAllParts(&wxWindowBase::SetBackgroundColour, colour); + SetForAllParts(&wxWindowBase::SetBackgroundColour, colour); return true; } @@ -79,7 +90,7 @@ public: if ( !BaseWindowClass::SetFont(font) ) return false; - DoSetForAllParts(&wxWindowBase::SetFont, font); + SetForAllParts(&wxWindowBase::SetFont, font); return true; } @@ -89,18 +100,112 @@ public: if ( !BaseWindowClass::SetCursor(cursor) ) return false; - DoSetForAllParts(&wxWindowBase::SetCursor, cursor); + SetForAllParts(&wxWindowBase::SetCursor, cursor); return true; } +#if wxUSE_TOOLTIPS + virtual void DoSetToolTip(wxToolTip *tip) + { + BaseWindowClass::DoSetToolTip(tip); + + SetForAllParts(&wxWindowBase::CopyToolTip, tip); + } +#endif // wxUSE_TOOLTIPS + +#endif // !__VISUALC6__ + + virtual void SetFocus() + { + wxSetFocusToChild(this, NULL); + } + private: // Must be implemented by the derived class to return all children to which // the public methods we override should forward to. virtual wxWindowList GetCompositeWindowParts() const = 0; + void OnWindowCreate(wxWindowCreateEvent& event) + { + event.Skip(); + + // Attach a few event handlers to all parts of the composite window. + // This makes the composite window behave more like a simple control + // and allows other code (such as wxDataViewCtrl's inline editing + // support) to hook into its event processing. + + wxWindow *child = event.GetWindow(); + if ( child == this ) + return; // not a child, we don't want to Connect() to ourselves + + // Always capture wxEVT_KILL_FOCUS: + child->Connect(wxEVT_KILL_FOCUS, + wxFocusEventHandler(wxCompositeWindow::OnKillFocus), + NULL, this); + + // Some events should be only handled for non-toplevel children. For + // example, we want to close the control in wxDataViewCtrl when Enter + // is pressed in the inline editor, but not when it's pressed in a + // popup dialog it opens. + wxWindow *win = child; + while ( win && win != this ) + { + if ( win->IsTopLevel() ) + return; + win = win->GetParent(); + } + + child->Connect(wxEVT_CHAR, + wxKeyEventHandler(wxCompositeWindow::OnChar), + NULL, this); + } + + void OnChar(wxKeyEvent& event) + { + if ( !this->ProcessWindowEvent(event) ) + event.Skip(); + } + + void OnKillFocus(wxFocusEvent& event) + { + // Ignore focus changes within the composite control: + wxWindow *win = event.GetWindow(); + while ( win ) + { + if ( win == this ) + { + event.Skip(); + return; + } + + // Note that we don't use IsTopLevel() check here, because we do + // want to ignore focus changes going to toplevel window that have + // the composite control as its parent; these would typically be + // some kind of control's popup window. + win = win->GetParent(); + } + + // The event shouldn't be ignored, forward it to the main control: + if ( !this->ProcessWindowEvent(event) ) + event.Skip(); + } + +#ifndef __VISUALC6__ template - void DoSetForAllParts(bool (wxWindowBase::*func)(const T&), const T& arg) + void SetForAllParts(bool (wxWindowBase::*func)(const T&), const T& arg) + { + DoSetForAllParts(func, arg); + } + + template + void SetForAllParts(bool (wxWindowBase::*func)(T*), T* arg) + { + DoSetForAllParts(func, arg); + } + + template + void DoSetForAllParts(bool (wxWindowBase::*func)(T), T arg) { // Simply call the setters for all parts of this composite window. const wxWindowList parts = GetCompositeWindowParts(); @@ -110,20 +215,16 @@ private: { wxWindow * const child = *i; - (child->*func)(arg); + // Allow NULL elements in the list, this makes the code of derived + // composite controls which may have optionally shown children + // simpler and it doesn't cost us much here. + if ( child ) + (child->*func)(arg); } } +#endif // !__VISUALC6__ wxDECLARE_NO_COPY_TEMPLATE_CLASS(wxCompositeWindow, W); }; -#else // __VISUALC6__ - -template -class wxCompositeWindow : public W -{ -}; - -#endif // !__VISUALC6__/__VISUALC6__ - #endif // _WX_COMPOSITEWIN_H_ diff --git a/Externals/wxWidgets3/include/wx/config.h b/Externals/wxWidgets3/include/wx/config.h index 3c2dbad63a..672e0a5cf2 100644 --- a/Externals/wxWidgets3/include/wx/config.h +++ b/Externals/wxWidgets3/include/wx/config.h @@ -5,7 +5,7 @@ // Modified by: // Created: // Copyright: (c) Julian Smart -// RCS-ID: $Id: config.h 67254 2011-03-20 00:14:35Z DS $ +// RCS-ID: $Id: config.h 70808 2012-03-04 20:31:42Z VZ $ // Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// @@ -22,15 +22,12 @@ // under Windows we prefer to use the native implementation but can be forced // to use the file-based one -#if defined(__WXMSW__) && wxUSE_CONFIG_NATIVE +#if defined(__WINDOWS__) && wxUSE_CONFIG_NATIVE #include "wx/msw/regconf.h" #define wxConfig wxRegConfig #elif defined(__WXOS2__) && wxUSE_CONFIG_NATIVE #include "wx/os2/iniconf.h" #define wxConfig wxIniConfig -#elif defined(__WXPALMOS__) && wxUSE_CONFIG_NATIVE - #include "wx/palmos/prefconf.h" - #define wxConfig wxPrefConfig #else // either we're under Unix or wish to always use config files #include "wx/fileconf.h" #define wxConfig wxFileConfig diff --git a/Externals/wxWidgets3/include/wx/containr.h b/Externals/wxWidgets3/include/wx/containr.h index c961a772da..a509df834c 100644 --- a/Externals/wxWidgets3/include/wx/containr.h +++ b/Externals/wxWidgets3/include/wx/containr.h @@ -1,12 +1,11 @@ /////////////////////////////////////////////////////////////////////////////// // Name: wx/containr.h -// Purpose: wxControlContainer class declration: a "mix-in" class which -// implements the TAB navigation between the controls +// Purpose: wxControlContainer and wxNavigationEnabled declarations // Author: Vadim Zeitlin // Modified by: // Created: 06.08.01 -// RCS-ID: $Id: containr.h 61508 2009-07-23 20:30:22Z VZ $ -// Copyright: (c) 2001 Vadim Zeitlin +// RCS-ID: $Id: containr.h 70805 2012-03-04 09:42:51Z SC $ +// Copyright: (c) 2001, 2011 Vadim Zeitlin // Licence: wxWindows licence /////////////////////////////////////////////////////////////////////////////// @@ -15,16 +14,20 @@ #include "wx/defs.h" +#ifndef wxHAS_NATIVE_TAB_TRAVERSAL + // We need wxEVT_XXX declarations in this case. + #include "wx/event.h" +#endif + class WXDLLIMPEXP_FWD_CORE wxWindow; class WXDLLIMPEXP_FWD_CORE wxWindowBase; /* - Implementation note: wxControlContainer is not a real mix-in but rather - a class meant to be aggregated with (and not inherited from). Although - logically it should be a mix-in, doing it like this has no advantage from - the point of view of the existing code but does have some problems (we'd - need to play tricks with event handlers which may be difficult to do - safely). The price we pay for this simplicity is the ugly macros below. + This header declares wxControlContainer class however it's not a real + container of controls but rather just a helper used to implement TAB + navigation among the window children. You should rarely need to use it + directly, derive from the documented public wxNavigationEnabled<> class to + implement TAB navigation in a custom composite window. */ // ---------------------------------------------------------------------------- @@ -102,6 +105,161 @@ private: bool m_inSetFocus; }; +#ifdef wxHAS_NATIVE_TAB_TRAVERSAL + +// ---------------------------------------------------------------------------- +// wxControlContainer for native TAB navigation +// ---------------------------------------------------------------------------- + +// this must be a real class as we forward-declare it elsewhere +class WXDLLIMPEXP_CORE wxControlContainer : public wxControlContainerBase +{ +protected: + // set the focus to the child which had it the last time + virtual bool SetFocusToChild(); +}; + +#else // !wxHAS_NATIVE_TAB_TRAVERSAL + +// ---------------------------------------------------------------------------- +// wxControlContainer for TAB navigation implemented in wx itself +// ---------------------------------------------------------------------------- + +class WXDLLIMPEXP_CORE wxControlContainer : public wxControlContainerBase +{ +public: + // default ctor, SetContainerWindow() must be called later + wxControlContainer(); + + // the methods to be called from the window event handlers + void HandleOnNavigationKey(wxNavigationKeyEvent& event); + void HandleOnFocus(wxFocusEvent& event); + void HandleOnWindowDestroy(wxWindowBase *child); + + // called from OnChildFocus() handler, i.e. when one of our (grand) + // children gets the focus + void SetLastFocus(wxWindow *win); + +protected: + + wxDECLARE_NO_COPY_CLASS(wxControlContainer); +}; + +#endif // wxHAS_NATIVE_TAB_TRAVERSAL/!wxHAS_NATIVE_TAB_TRAVERSAL + +// this function is for wxWidgets internal use only +extern WXDLLIMPEXP_CORE bool wxSetFocusToChild(wxWindow *win, wxWindow **child); + +// ---------------------------------------------------------------------------- +// wxNavigationEnabled: Derive from this class to support keyboard navigation +// among window children in a wxWindow-derived class. The details of this class +// don't matter, you just need to derive from it to make navigation work. +// ---------------------------------------------------------------------------- + +// The template parameter W must be a wxWindow-derived class. +template +class wxNavigationEnabled : public W +{ +public: + typedef W BaseWindowClass; + + wxNavigationEnabled() + { + m_container.SetContainerWindow(this); + +#ifndef wxHAS_NATIVE_TAB_TRAVERSAL + BaseWindowClass::Connect(wxEVT_NAVIGATION_KEY, + wxNavigationKeyEventHandler(wxNavigationEnabled::OnNavigationKey)); + + BaseWindowClass::Connect(wxEVT_SET_FOCUS, + wxFocusEventHandler(wxNavigationEnabled::OnFocus)); + + BaseWindowClass::Connect(wxEVT_CHILD_FOCUS, + wxChildFocusEventHandler(wxNavigationEnabled::OnChildFocus)); +#endif // !wxHAS_NATIVE_TAB_TRAVERSAL + } + + WXDLLIMPEXP_INLINE_CORE virtual bool AcceptsFocus() const + { + return m_container.AcceptsFocus(); + } + + WXDLLIMPEXP_INLINE_CORE virtual bool AcceptsFocusRecursively() const + { + return m_container.AcceptsFocusRecursively(); + } + + WXDLLIMPEXP_INLINE_CORE virtual bool AcceptsFocusFromKeyboard() const + { + return m_container.AcceptsFocusFromKeyboard(); + } + + WXDLLIMPEXP_INLINE_CORE virtual void AddChild(wxWindowBase *child) + { + BaseWindowClass::AddChild(child); + + m_container.UpdateCanFocus(); + } + + WXDLLIMPEXP_INLINE_CORE virtual void RemoveChild(wxWindowBase *child) + { +#ifndef wxHAS_NATIVE_TAB_TRAVERSAL + m_container.HandleOnWindowDestroy(child); +#endif // !wxHAS_NATIVE_TAB_TRAVERSAL + + BaseWindowClass::RemoveChild(child); + + m_container.UpdateCanFocus(); + } + + WXDLLIMPEXP_INLINE_CORE virtual void SetFocus() + { + if ( !m_container.DoSetFocus() ) + BaseWindowClass::SetFocus(); + } + + void SetFocusIgnoringChildren() + { + BaseWindowClass::SetFocus(); + } + + void AcceptFocus(bool acceptFocus) + { + m_container.SetCanFocus(acceptFocus); + } + +protected: +#ifndef wxHAS_NATIVE_TAB_TRAVERSAL + void OnNavigationKey(wxNavigationKeyEvent& event) + { + m_container.HandleOnNavigationKey(event); + } + + void OnFocus(wxFocusEvent& event) + { + m_container.HandleOnFocus(event); + } + + void OnChildFocus(wxChildFocusEvent& event) + { + m_container.SetLastFocus(event.GetWindow()); + event.Skip(); + } +#endif // !wxHAS_NATIVE_TAB_TRAVERSAL + + wxControlContainer m_container; + + + wxDECLARE_NO_COPY_TEMPLATE_CLASS(wxNavigationEnabled, W); +}; + +// ---------------------------------------------------------------------------- +// Compatibility macros from now on, do NOT use them and preferably do not even +// look at them. +// ---------------------------------------------------------------------------- + +#if WXWIN_COMPATIBILITY_2_8 + // common part of WX_DECLARE_CONTROL_CONTAINER in the native and generic cases, // it should be used in the wxWindow-derived class declaration #define WX_DECLARE_CONTROL_CONTAINER_BASE() \ @@ -156,20 +314,9 @@ protected: \ return m_container.AcceptsFocusFromKeyboard(); \ } + #ifdef wxHAS_NATIVE_TAB_TRAVERSAL -// ---------------------------------------------------------------------------- -// wxControlContainer for native TAB navigation -// ---------------------------------------------------------------------------- - -// this must be a real class as we forward-declare it elsewhere -class WXDLLIMPEXP_CORE wxControlContainer : public wxControlContainerBase -{ -protected: - // set the focus to the child which had it the last time - virtual bool SetFocusToChild(); -}; - #define WX_EVENT_TABLE_CONTROL_CONTAINER(classname) #define WX_DECLARE_CONTROL_CONTAINER WX_DECLARE_CONTROL_CONTAINER_BASE @@ -191,38 +338,6 @@ protected: #else // !wxHAS_NATIVE_TAB_TRAVERSAL -class WXDLLIMPEXP_FWD_CORE wxFocusEvent; -class WXDLLIMPEXP_FWD_CORE wxNavigationKeyEvent; - -// ---------------------------------------------------------------------------- -// wxControlContainer for TAB navigation implemented in wx itself -// ---------------------------------------------------------------------------- - -class WXDLLIMPEXP_CORE wxControlContainer : public wxControlContainerBase -{ -public: - // default ctor, SetContainerWindow() must be called later - wxControlContainer(); - - // the methods to be called from the window event handlers - void HandleOnNavigationKey(wxNavigationKeyEvent& event); - void HandleOnFocus(wxFocusEvent& event); - void HandleOnWindowDestroy(wxWindowBase *child); - - // called from OnChildFocus() handler, i.e. when one of our (grand) - // children gets the focus - void SetLastFocus(wxWindow *win); - -protected: - - wxDECLARE_NO_COPY_CLASS(wxControlContainer); -}; - -// ---------------------------------------------------------------------------- -// macros which may be used by the classes wishing to implement TAB navigation -// among their children -// ---------------------------------------------------------------------------- - // declare the methods to be forwarded #define WX_DECLARE_CONTROL_CONTAINER() \ WX_DECLARE_CONTROL_CONTAINER_BASE(); \ @@ -274,7 +389,6 @@ public: \ #endif // wxHAS_NATIVE_TAB_TRAVERSAL/!wxHAS_NATIVE_TAB_TRAVERSAL -// this function is for wxWidgets internal use only -extern bool wxSetFocusToChild(wxWindow *win, wxWindow **child); +#endif // WXWIN_COMPATIBILITY_2_8 #endif // _WX_CONTAINR_H_ diff --git a/Externals/wxWidgets3/include/wx/control.h b/Externals/wxWidgets3/include/wx/control.h index 6c859b6868..778ec1870e 100644 --- a/Externals/wxWidgets3/include/wx/control.h +++ b/Externals/wxWidgets3/include/wx/control.h @@ -4,7 +4,7 @@ // Author: Vadim Zeitlin // Modified by: // Created: 26.07.99 -// RCS-ID: $Id: control.h 67062 2011-02-27 12:48:07Z VZ $ +// RCS-ID: $Id: control.h 70345 2012-01-15 01:05:28Z VZ $ // Copyright: (c) wxWidgets team // Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// @@ -221,8 +221,6 @@ protected: #if defined(__WXUNIVERSAL__) #include "wx/univ/control.h" -#elif defined(__WXPALMOS__) - #include "wx/palmos/control.h" #elif defined(__WXMSW__) #include "wx/msw/control.h" #elif defined(__WXMOTIF__) diff --git a/Externals/wxWidgets3/include/wx/convauto.h b/Externals/wxWidgets3/include/wx/convauto.h index ac5f02d7f1..0d9303959d 100644 --- a/Externals/wxWidgets3/include/wx/convauto.h +++ b/Externals/wxWidgets3/include/wx/convauto.h @@ -3,7 +3,7 @@ // Purpose: wxConvAuto class declaration // Author: Vadim Zeitlin // Created: 2006-04-03 -// RCS-ID: $Id: convauto.h 63991 2010-04-16 10:43:18Z VS $ +// RCS-ID: $Id: convauto.h 69675 2011-11-05 11:23:41Z VZ $ // Copyright: (c) 2006 Vadim Zeitlin // Licence: wxWindows licence /////////////////////////////////////////////////////////////////////////////// @@ -18,6 +18,18 @@ // wxConvAuto: uses BOM to automatically detect input encoding // ---------------------------------------------------------------------------- +// All currently recognized BOM values. +enum wxBOM +{ + wxBOM_Unknown = -1, + wxBOM_None, + wxBOM_UTF32BE, + wxBOM_UTF32LE, + wxBOM_UTF16BE, + wxBOM_UTF16LE, + wxBOM_UTF8 +}; + class WXDLLIMPEXP_BASE wxConvAuto : public wxMBConv { public: @@ -69,29 +81,27 @@ public: virtual wxMBConv *Clone() const { return new wxConvAuto(*this); } -private: - // all currently recognized BOM values - enum BOMType - { - BOM_Unknown = -1, - BOM_None, - BOM_UTF32BE, - BOM_UTF32LE, - BOM_UTF16BE, - BOM_UTF16LE, - BOM_UTF8 - }; - // return the BOM type of this buffer - static BOMType DetectBOM(const char *src, size_t srcLen); + static wxBOM DetectBOM(const char *src, size_t srcLen); + // return the characters composing the given BOM. + static const char* GetBOMChars(wxBOM bomType, size_t* count); + + wxBOM GetBOM() const + { + return m_bomType; + } + +private: // common part of all ctors void Init() { - // no need to initialize m_bomType and m_consumedBOM here, this will be - // done when m_conv is created + // We don't initialize m_encDefault here as different ctors do it + // differently. m_conv = NULL; + m_bomType = wxBOM_Unknown; m_ownsConv = false; + m_consumedBOM = false; } // initialize m_conv with the UTF-8 conversion @@ -102,7 +112,7 @@ private: } // create the correct conversion object for the given BOM type - void InitFromBOM(BOMType bomType); + void InitFromBOM(wxBOM bomType); // create the correct conversion object for the BOM present in the // beginning of the buffer @@ -128,7 +138,7 @@ private: wxFontEncoding m_encDefault; // our BOM type - BOMType m_bomType; + wxBOM m_bomType; // true if we allocated m_conv ourselves, false if we just use an existing // global conversion diff --git a/Externals/wxWidgets3/include/wx/cppunit.h b/Externals/wxWidgets3/include/wx/cppunit.h index 831b6891a0..7c5a114bf5 100644 --- a/Externals/wxWidgets3/include/wx/cppunit.h +++ b/Externals/wxWidgets3/include/wx/cppunit.h @@ -3,7 +3,7 @@ // Purpose: wrapper header for CppUnit headers // Author: Vadim Zeitlin // Created: 15.02.04 -// RCS-ID: $Id: cppunit.h 66711 2011-01-19 10:47:49Z VZ $ +// RCS-ID: $Id: cppunit.h 69241 2011-09-30 14:00:52Z JJ $ // Copyright: (c) 2004 Vadim Zeitlin // Licence: wxWindows Licence ///////////////////////////////////////////////////////////////////////////// @@ -200,6 +200,10 @@ WX_CPPUNIT_ALLOW_EQUALS_TO_INT(short) WX_CPPUNIT_ALLOW_EQUALS_TO_INT(unsigned) WX_CPPUNIT_ALLOW_EQUALS_TO_INT(unsigned long) +#if defined( __VMS ) && defined( __ia64 ) +WX_CPPUNIT_ALLOW_EQUALS_TO_INT(std::basic_streambuf::pos_type); +#endif + #ifdef wxHAS_LONG_LONG_T_DIFFERENT_FROM_LONG WX_CPPUNIT_ALLOW_EQUALS_TO_INT(wxLongLong_t) WX_CPPUNIT_ALLOW_EQUALS_TO_INT(unsigned wxLongLong_t) diff --git a/Externals/wxWidgets3/include/wx/ctrlsub.h b/Externals/wxWidgets3/include/wx/ctrlsub.h index 70a69d1103..198aae24c6 100644 --- a/Externals/wxWidgets3/include/wx/ctrlsub.h +++ b/Externals/wxWidgets3/include/wx/ctrlsub.h @@ -4,7 +4,7 @@ // Author: Vadim Zeitlin // Modified by: // Created: 22.10.99 -// RCS-ID: $Id: ctrlsub.h 65040 2010-07-22 12:09:15Z VZ $ +// RCS-ID: $Id: ctrlsub.h 68460 2011-07-30 11:30:08Z VZ $ // Copyright: (c) wxWidgets team // Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// @@ -395,41 +395,48 @@ private: wxClientDataType m_clientDataItemsType; }; -// this macro must (unfortunately) be used in any class deriving from both -// wxItemContainer and wxControl because otherwise there is ambiguity when -// calling GetClientXXX() functions -- the compiler can't choose between the -// two versions -#define wxCONTROL_ITEMCONTAINER_CLIENTDATAOBJECT_RECAST \ - void SetClientData(void *data) \ - { wxEvtHandler::SetClientData(data); } \ - void *GetClientData() const \ - { return wxEvtHandler::GetClientData(); } \ - void SetClientObject(wxClientData *data) \ - { wxEvtHandler::SetClientObject(data); } \ - wxClientData *GetClientObject() const \ - { return wxEvtHandler::GetClientObject(); } \ - void SetClientData(unsigned int n, void* clientData) \ - { wxItemContainer::SetClientData(n, clientData); } \ - void* GetClientData(unsigned int n) const \ - { return wxItemContainer::GetClientData(n); } \ - void SetClientObject(unsigned int n, wxClientData* clientData) \ - { wxItemContainer::SetClientObject(n, clientData); } \ - wxClientData* GetClientObject(unsigned int n) const \ - { return wxItemContainer::GetClientObject(n); } +// Inheriting directly from a wxWindow-derived class and wxItemContainer +// unfortunately introduces an ambiguity for all GetClientXXX() methods as they +// are inherited twice: the "global" versions from wxWindow and the per-item +// versions taking the index from wxItemContainer. +// +// So we need to explicitly resolve them and this helper template class is +// provided to do it. To use it, simply inherit from wxWindowWithItems instead of Window and Container interface directly. +template +class wxWindowWithItems : public W, public C +{ +public: + typedef W BaseWindowClass; + typedef C BaseContainerInterface; -class WXDLLIMPEXP_CORE wxControlWithItemsBase : public wxControl, - public wxItemContainer + wxWindowWithItems() { } + + void SetClientData(void *data) + { BaseWindowClass::SetClientData(data); } + void *GetClientData() const + { return BaseWindowClass::GetClientData(); } + void SetClientObject(wxClientData *data) + { BaseWindowClass::SetClientObject(data); } + wxClientData *GetClientObject() const + { return BaseWindowClass::GetClientObject(); } + + void SetClientData(unsigned int n, void* clientData) + { wxItemContainer::SetClientData(n, clientData); } + void* GetClientData(unsigned int n) const + { return wxItemContainer::GetClientData(n); } + void SetClientObject(unsigned int n, wxClientData* clientData) + { wxItemContainer::SetClientObject(n, clientData); } + wxClientData* GetClientObject(unsigned int n) const + { return wxItemContainer::GetClientObject(n); } +}; + +class WXDLLIMPEXP_CORE wxControlWithItemsBase : + public wxWindowWithItems { public: wxControlWithItemsBase() { } - // we have to redefine these functions here to avoid ambiguities in classes - // deriving from us which would arise otherwise because both base classses - // have the methods with the same names - hopefully, a smart compiler can - // optimize away these simple inline wrappers so we don't suffer much from - // this - wxCONTROL_ITEMCONTAINER_CLIENTDATAOBJECT_RECAST - // usually the controls like list/combo boxes have their own background // colour virtual bool ShouldInheritColours() const { return false; } diff --git a/Externals/wxWidgets3/include/wx/cursor.h b/Externals/wxWidgets3/include/wx/cursor.h index 82bd282b45..a0ce868609 100644 --- a/Externals/wxWidgets3/include/wx/cursor.h +++ b/Externals/wxWidgets3/include/wx/cursor.h @@ -5,7 +5,7 @@ // Modified by: // Created: // Copyright: (c) Julian Smart -// RCS-ID: $Id: cursor.h 60648 2009-05-16 10:42:48Z FM $ +// RCS-ID: $Id: cursor.h 70353 2012-01-15 14:46:41Z VZ $ // Licence: wxWindows Licence ///////////////////////////////////////////////////////////////////////////// @@ -34,10 +34,7 @@ public: */ -#if defined(__WXPALMOS__) - #define wxCURSOR_DEFAULT_TYPE wxBITMAP_TYPE_CUR_RESOURCE - #include "wx/palmos/cursor.h" -#elif defined(__WXMSW__) +#if defined(__WXMSW__) #define wxCURSOR_DEFAULT_TYPE wxBITMAP_TYPE_CUR_RESOURCE #include "wx/msw/cursor.h" #elif defined(__WXMOTIF__) @@ -52,9 +49,6 @@ public: #elif defined(__WXX11__) #define wxCURSOR_DEFAULT_TYPE wxBITMAP_TYPE_XPM #include "wx/x11/cursor.h" -#elif defined(__WXMGL__) - #define wxCURSOR_DEFAULT_TYPE wxBITMAP_TYPE_CUR_RESOURCE - #include "wx/mgl/cursor.h" #elif defined(__WXDFB__) #define wxCURSOR_DEFAULT_TYPE wxBITMAP_TYPE_CUR_RESOURCE #include "wx/dfb/cursor.h" @@ -62,7 +56,7 @@ public: #define wxCURSOR_DEFAULT_TYPE wxBITMAP_TYPE_MACCURSOR_RESOURCE #include "wx/osx/cursor.h" #elif defined(__WXCOCOA__) - #define wxCURSOR_DEFAULT_TYPE 0 + #define wxCURSOR_DEFAULT_TYPE wxBITMAP_TYPE_MACCURSOR_RESOURCE #include "wx/cocoa/cursor.h" #elif defined(__WXPM__) #define wxCURSOR_DEFAULT_TYPE wxBITMAP_TYPE_CUR_RESOURCE diff --git a/Externals/wxWidgets3/include/wx/custombgwin.h b/Externals/wxWidgets3/include/wx/custombgwin.h new file mode 100644 index 0000000000..62ef32261f --- /dev/null +++ b/Externals/wxWidgets3/include/wx/custombgwin.h @@ -0,0 +1,53 @@ +/////////////////////////////////////////////////////////////////////////////// +// Name: wx/custombgwin.h +// Purpose: Class adding support for custom window backgrounds. +// Author: Vadim Zeitlin +// Created: 2011-10-10 +// RCS-ID: $Id: custombgwin.h 69930 2011-12-04 23:57:36Z VZ $ +// Copyright: (c) 2011 Vadim Zeitlin +// Licence: wxWindows licence +/////////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_CUSTOMBGWIN_H_ +#define _WX_CUSTOMBGWIN_H_ + +// ---------------------------------------------------------------------------- +// wxCustomBackgroundWindow: Adds support for custom backgrounds to any +// wxWindow-derived class. +// ---------------------------------------------------------------------------- + +class wxCustomBackgroundWindowBase +{ +public: + // Trivial default ctor. + wxCustomBackgroundWindowBase() { } + + // Also a trivial but virtual -- to suppress g++ warnings -- dtor. + virtual ~wxCustomBackgroundWindowBase() { } + + // Use the given bitmap to tile the background of this window. This bitmap + // will show through any transparent children. + // + // Notice that you must not prevent the base class EVT_ERASE_BACKGROUND + // handler from running (i.e. not to handle this event yourself) for this + // to work. + void SetBackgroundBitmap(const wxBitmap& bmp) + { + DoSetBackgroundBitmap(bmp); + } + +protected: + virtual void DoSetBackgroundBitmap(const wxBitmap& bmp) = 0; + + wxDECLARE_NO_COPY_CLASS(wxCustomBackgroundWindowBase); +}; + +#if defined(__WXUNIVERSAL__) + #include "wx/univ/custombgwin.h" +#elif defined(__WXMSW__) + #include "wx/msw/custombgwin.h" +#else + #include "wx/generic/custombgwin.h" +#endif + +#endif // _WX_CUSTOMBGWIN_H_ diff --git a/Externals/wxWidgets3/include/wx/dataview.h b/Externals/wxWidgets3/include/wx/dataview.h index cc9d85efa9..3e81791cd0 100644 --- a/Externals/wxWidgets3/include/wx/dataview.h +++ b/Externals/wxWidgets3/include/wx/dataview.h @@ -4,7 +4,7 @@ // Author: Robert Roebling // Modified by: Bo Yang // Created: 08.01.06 -// RCS-ID: $Id: dataview.h 66783 2011-01-27 11:53:51Z SC $ +// RCS-ID: $Id: dataview.h 70377 2012-01-17 14:05:17Z VS $ // Copyright: (c) Robert Roebling // Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// @@ -21,9 +21,11 @@ #include "wx/variant.h" #include "wx/dynarray.h" #include "wx/icon.h" +#include "wx/itemid.h" #include "wx/weakref.h" #include "wx/vector.h" #include "wx/dataobj.h" +#include "wx/withimages.h" class WXDLLIMPEXP_FWD_CORE wxImageList; @@ -44,7 +46,6 @@ class WXDLLIMPEXP_FWD_CORE wxImageList; // wxDataViewCtrl globals // ---------------------------------------------------------------------------- -class WXDLLIMPEXP_FWD_ADV wxDataViewItem; class WXDLLIMPEXP_FWD_ADV wxDataViewModel; class WXDLLIMPEXP_FWD_ADV wxDataViewCtrl; class WXDLLIMPEXP_FWD_ADV wxDataViewColumn; @@ -78,33 +79,14 @@ extern WXDLLIMPEXP_DATA_ADV(const char) wxDataViewCtrlNameStr[]; // wxDataViewItem // --------------------------------------------------------- -class WXDLLIMPEXP_ADV wxDataViewItem +// Make it a class and not a typedef to allow forward declaring it. +class wxDataViewItem : public wxItemId { public: - wxDataViewItem( void* id = NULL ) - { m_id = id; } - wxDataViewItem( const wxDataViewItem &item ) - { m_id = item.m_id; } - bool IsOk() const { return m_id != NULL; } - void* GetID() const { return m_id; } - operator const void* () const { return m_id; } - -private: - void* m_id; + wxDataViewItem() : wxItemId() { } + wxEXPLICIT wxDataViewItem(void* pItem) : wxItemId(pItem) { } }; -inline -bool operator==(const wxDataViewItem& left, const wxDataViewItem& right) -{ - return left.GetID() == right.GetID(); -} - -inline -bool operator!=(const wxDataViewItem& left, const wxDataViewItem& right) -{ - return !(left == right); -} - WX_DEFINE_ARRAY(wxDataViewItem, wxDataViewItemArray); // --------------------------------------------------------- @@ -161,16 +143,20 @@ public: void SetColour(const wxColour& colour) { m_colour = colour; } void SetBold( bool set ) { m_bold = set; } void SetItalic( bool set ) { m_italic = set; } + void SetBackgroundColour(const wxColour& colour) { m_bgColour = colour; } // accessors - bool HasColour() const { return m_colour.Ok(); } + bool HasColour() const { return m_colour.IsOk(); } const wxColour& GetColour() const { return m_colour; } bool HasFont() const { return m_bold || m_italic; } bool GetBold() const { return m_bold; } bool GetItalic() const { return m_italic; } - bool IsDefault() const { return !(HasColour() || HasFont()); } + bool HasBackgroundColour() const { return m_bgColour.IsOk(); } + const wxColour& GetBackgroundColour() const { return m_bgColour; } + + bool IsDefault() const { return !(HasColour() || HasFont() || HasBackgroundColour()); } // Return the font based on the given one with this attribute applied to it. wxFont GetEffectiveFont(const wxFont& font) const; @@ -179,6 +165,7 @@ private: wxColour m_colour; bool m_bold; bool m_italic; + wxColour m_bgColour; }; @@ -681,7 +668,18 @@ public: wxDataViewItem GetCurrentItem() const; void SetCurrentItem(const wxDataViewItem& item); - virtual wxDataViewItem GetSelection() const = 0; + // Currently focused column of the current item or NULL if no column has focus + virtual wxDataViewColumn *GetCurrentColumn() const = 0; + + // Selection: both GetSelection() and GetSelections() can be used for the + // controls both with and without wxDV_MULTIPLE style. For single selection + // controls GetSelections() is not very useful however. And for multi + // selection controls GetSelection() returns an invalid item if more than + // one item is selected. Use GetSelectedItemsCount() or HasSelection() to + // check if any items are selected at all. + virtual int GetSelectedItemsCount() const = 0; + bool HasSelection() const { return GetSelectedItemsCount() != 0; } + wxDataViewItem GetSelection() const; virtual int GetSelections( wxDataViewItemArray & sel ) const = 0; virtual void SetSelections( const wxDataViewItemArray & sel ) = 0; virtual void Select( const wxDataViewItem & item ) = 0; @@ -701,6 +699,13 @@ public: virtual void HitTest( const wxPoint & point, wxDataViewItem &item, wxDataViewColumn* &column ) const = 0; virtual wxRect GetItemRect( const wxDataViewItem & item, const wxDataViewColumn *column = NULL ) const = 0; + virtual bool SetRowHeight( int WXUNUSED(rowHeight) ) { return false; } + + virtual void EditItem(const wxDataViewItem& item, const wxDataViewColumn *column) = 0; + + // Use EditItem() instead + wxDEPRECATED( void StartEditor(const wxDataViewItem& item, unsigned int column) ); + #if wxUSE_DRAG_AND_DROP virtual bool EnableDragSource(const wxDataFormat& WXUNUSED(format)) { return false; } @@ -757,7 +762,8 @@ public: m_column(NULL), m_pos(-1,-1), m_cacheFrom(0), - m_cacheTo(0) + m_cacheTo(0), + m_editCancelled(false) #if wxUSE_DRAG_AND_DROP , m_dataObject(NULL), m_dataBuffer(NULL), @@ -774,7 +780,8 @@ public: m_column(event.m_column), m_pos(event.m_pos), m_cacheFrom(event.m_cacheFrom), - m_cacheTo(event.m_cacheTo) + m_cacheTo(event.m_cacheTo), + m_editCancelled(event.m_editCancelled) #if wxUSE_DRAG_AND_DROP , m_dataObject(event.m_dataObject), m_dataFormat(event.m_dataFormat), @@ -795,6 +802,10 @@ public: const wxVariant &GetValue() const { return m_value; } void SetValue( const wxVariant &value ) { m_value = value; } + // for wxEVT_COMMAND_DATAVIEW_ITEM_EDITING_DONE only + bool IsEditCancelled() const { return m_editCancelled; } + void SetEditCanceled(bool editCancelled) { m_editCancelled = editCancelled; } + // for wxEVT_DATAVIEW_COLUMN_HEADER_CLICKED only void SetDataViewColumn( wxDataViewColumn *col ) { m_column = col; } wxDataViewColumn *GetDataViewColumn() const { return m_column; } @@ -834,6 +845,7 @@ protected: wxPoint m_pos; int m_cacheFrom; int m_cacheTo; + bool m_editCancelled; #if wxUSE_DRAG_AND_DROP wxDataObject *m_dataObject; @@ -1202,7 +1214,7 @@ public: virtual bool HasDefaultCompare() const { return true; } virtual unsigned int GetColumnCount() const - { return 1; }; + { return 1; } virtual wxString GetColumnType( unsigned int WXUNUSED(col) ) const { return wxT("wxDataViewIconText"); } @@ -1216,10 +1228,11 @@ public: //----------------------------------------------------------------------------- -class WXDLLIMPEXP_ADV wxDataViewTreeCtrl: public wxDataViewCtrl +class WXDLLIMPEXP_ADV wxDataViewTreeCtrl: public wxDataViewCtrl, + public wxWithImages { public: - wxDataViewTreeCtrl() { Init(); } + wxDataViewTreeCtrl() { } wxDataViewTreeCtrl(wxWindow *parent, wxWindowID id, const wxPoint& pos = wxDefaultPosition, @@ -1227,13 +1240,9 @@ public: long style = wxDV_NO_HEADER | wxDV_ROW_LINES, const wxValidator& validator = wxDefaultValidator) { - Init(); - Create(parent, id, pos, size, style, validator); } - virtual ~wxDataViewTreeCtrl(); - bool Create(wxWindow *parent, wxWindowID id, const wxPoint& pos = wxDefaultPosition, @@ -1249,24 +1258,21 @@ public: bool IsContainer( const wxDataViewItem& item ) const { return GetStore()->IsContainer(item); } - void SetImageList( wxImageList *imagelist ); - wxImageList* GetImageList() { return m_imageList; } - wxDataViewItem AppendItem( const wxDataViewItem& parent, - const wxString &text, int icon = -1, wxClientData *data = NULL ); + const wxString &text, int icon = NO_IMAGE, wxClientData *data = NULL ); wxDataViewItem PrependItem( const wxDataViewItem& parent, - const wxString &text, int icon = -1, wxClientData *data = NULL ); + const wxString &text, int icon = NO_IMAGE, wxClientData *data = NULL ); wxDataViewItem InsertItem( const wxDataViewItem& parent, const wxDataViewItem& previous, - const wxString &text, int icon = -1, wxClientData *data = NULL ); + const wxString &text, int icon = NO_IMAGE, wxClientData *data = NULL ); wxDataViewItem PrependContainer( const wxDataViewItem& parent, - const wxString &text, int icon = -1, int expanded = -1, + const wxString &text, int icon = NO_IMAGE, int expanded = NO_IMAGE, wxClientData *data = NULL ); wxDataViewItem AppendContainer( const wxDataViewItem& parent, - const wxString &text, int icon = -1, int expanded = -1, + const wxString &text, int icon = NO_IMAGE, int expanded = NO_IMAGE, wxClientData *data = NULL ); wxDataViewItem InsertContainer( const wxDataViewItem& parent, const wxDataViewItem& previous, - const wxString &text, int icon = -1, int expanded = -1, + const wxString &text, int icon = NO_IMAGE, int expanded = NO_IMAGE, wxClientData *data = NULL ); wxDataViewItem GetNthChild( const wxDataViewItem& parent, unsigned int pos ) const @@ -1296,14 +1302,6 @@ public: void OnCollapsed( wxDataViewEvent &event ); void OnSize( wxSizeEvent &event ); -private: - void Init() - { - m_imageList = NULL; - } - - wxImageList *m_imageList; - private: DECLARE_EVENT_TABLE() DECLARE_DYNAMIC_CLASS_NO_ASSIGN(wxDataViewTreeCtrl) diff --git a/Externals/wxWidgets3/include/wx/datectrl.h b/Externals/wxWidgets3/include/wx/datectrl.h index 576db17f48..8b16f0a9f2 100644 --- a/Externals/wxWidgets3/include/wx/datectrl.h +++ b/Externals/wxWidgets3/include/wx/datectrl.h @@ -4,7 +4,7 @@ // Author: Vadim Zeitlin // Modified by: // Created: 2005-01-09 -// RCS-ID: $Id: datectrl.h 61508 2009-07-23 20:30:22Z VZ $ +// RCS-ID: $Id: datectrl.h 70345 2012-01-15 01:05:28Z VZ $ // Copyright: (c) 2005 Vadim Zeitlin // Licence: wxWindows licence /////////////////////////////////////////////////////////////////////////////// @@ -16,8 +16,7 @@ #if wxUSE_DATEPICKCTRL -#include "wx/control.h" // the base class -#include "wx/datetime.h" +#include "wx/datetimectrl.h" // the base class #define wxDatePickerCtrlNameStr wxT("datectrl") @@ -46,7 +45,7 @@ enum // wxDatePickerCtrl: allow the user to enter the date // ---------------------------------------------------------------------------- -class WXDLLIMPEXP_ADV wxDatePickerCtrlBase : public wxControl +class WXDLLIMPEXP_ADV wxDatePickerCtrlBase : public wxDateTimePickerCtrl { public: /* @@ -63,23 +62,26 @@ public: const wxString& name = wxDatePickerCtrlNameStr); */ - // set/get the date - virtual void SetValue(const wxDateTime& dt) = 0; - virtual wxDateTime GetValue() const = 0; + /* + We inherit the methods to set/get the date from the base class. - // set/get the allowed valid range for the dates, if either/both of them - // are invalid, there is no corresponding limit and if neither is set - // GetRange() returns false + virtual void SetValue(const wxDateTime& dt) = 0; + virtual wxDateTime GetValue() const = 0; + */ + + // And add methods to set/get the allowed valid range for the dates. If + // either/both of them are invalid, there is no corresponding limit and if + // neither is set, GetRange() returns false. virtual void SetRange(const wxDateTime& dt1, const wxDateTime& dt2) = 0; virtual bool GetRange(wxDateTime *dt1, wxDateTime *dt2) const = 0; }; -#if defined(__WXPALMOS__) - #include "wx/palmos/datectrl.h" +#if defined(__WXMSW__) && !defined(__WXUNIVERSAL__) + #include "wx/msw/datectrl.h" #define wxHAS_NATIVE_DATEPICKCTRL -#elif defined(__WXMSW__) && !defined(__WXUNIVERSAL__) - #include "wx/msw/datectrl.h" +#elif defined(__WXOSX_COCOA__) && !defined(__WXUNIVERSAL__) + #include "wx/osx/datectrl.h" #define wxHAS_NATIVE_DATEPICKCTRL #else diff --git a/Externals/wxWidgets3/include/wx/dateevt.h b/Externals/wxWidgets3/include/wx/dateevt.h index 8833bdd0de..7b10dd63b7 100644 --- a/Externals/wxWidgets3/include/wx/dateevt.h +++ b/Externals/wxWidgets3/include/wx/dateevt.h @@ -4,7 +4,7 @@ // Author: Vadim Zeitlin // Modified by: // Created: 2005-01-10 -// RCS-ID: $Id: dateevt.h 58718 2009-02-07 18:59:25Z VZ $ +// RCS-ID: $Id: dateevt.h 69224 2011-09-29 13:43:15Z VZ $ // Copyright: (c) 2005 Vadim Zeitlin // Licence: wxWindows licence /////////////////////////////////////////////////////////////////////////////// @@ -17,7 +17,7 @@ #include "wx/window.h" // ---------------------------------------------------------------------------- -// wxDateEvent: used by wxCalendarCtrl and wxDatePickerCtrl +// wxDateEvent: used by wxCalendarCtrl, wxDatePickerCtrl and wxTimePickerCtrl. // ---------------------------------------------------------------------------- class WXDLLIMPEXP_ADV wxDateEvent : public wxCommandEvent @@ -48,6 +48,7 @@ private: // ---------------------------------------------------------------------------- wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_ADV, wxEVT_DATE_CHANGED, wxDateEvent); +wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_ADV, wxEVT_TIME_CHANGED, wxDateEvent); typedef void (wxEvtHandler::*wxDateEventFunction)(wxDateEvent&); @@ -57,5 +58,8 @@ typedef void (wxEvtHandler::*wxDateEventFunction)(wxDateEvent&); #define EVT_DATE_CHANGED(id, fn) \ wx__DECLARE_EVT1(wxEVT_DATE_CHANGED, id, wxDateEventHandler(fn)) +#define EVT_TIME_CHANGED(id, fn) \ + wx__DECLARE_EVT1(wxEVT_TIME_CHANGED, id, wxDateEventHandler(fn)) + #endif // _WX_DATEEVT_H_ diff --git a/Externals/wxWidgets3/include/wx/datetime.h b/Externals/wxWidgets3/include/wx/datetime.h index 448f6575d1..79cf5f1b7a 100644 --- a/Externals/wxWidgets3/include/wx/datetime.h +++ b/Externals/wxWidgets3/include/wx/datetime.h @@ -5,7 +5,7 @@ // Author: Vadim Zeitlin // Modified by: // Created: 10.02.99 -// RCS-ID: $Id: datetime.h 67280 2011-03-22 14:17:38Z DS $ +// RCS-ID: $Id: datetime.h 70796 2012-03-04 00:29:31Z VZ $ // Copyright: (c) 1998 Vadim Zeitlin // Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// @@ -19,7 +19,7 @@ #ifdef __WXWINCE__ #include "wx/msw/wince/time.h" -#elif !defined(__WXPALMOS5__) +#else #include #endif // OS @@ -31,7 +31,7 @@ class WXDLLIMPEXP_FWD_BASE wxDateTime; class WXDLLIMPEXP_FWD_BASE wxTimeSpan; class WXDLLIMPEXP_FWD_BASE wxDateSpan; -#ifdef __WXMSW__ +#ifdef __WINDOWS__ struct _SYSTEMTIME; #endif @@ -53,27 +53,6 @@ struct _SYSTEMTIME; * 5. wxDateTimeHolidayAuthority for Easter and other christian feasts */ -/* Two wrapper functions for thread safety */ -#ifdef HAVE_LOCALTIME_R -#define wxLocaltime_r localtime_r -#else -WXDLLIMPEXP_BASE struct tm *wxLocaltime_r(const time_t*, struct tm*); -#if wxUSE_THREADS && !defined(__WINDOWS__) && !defined(__WATCOMC__) - // On Windows, localtime _is_ threadsafe! -#warning using pseudo thread-safe wrapper for localtime to emulate localtime_r -#endif -#endif - -#ifdef HAVE_GMTIME_R -#define wxGmtime_r gmtime_r -#else -WXDLLIMPEXP_BASE struct tm *wxGmtime_r(const time_t*, struct tm*); -#if wxUSE_THREADS && !defined(__WINDOWS__) && !defined(__WATCOMC__) - // On Windows, gmtime _is_ threadsafe! -#warning using pseudo thread-safe wrapper for gmtime to emulate gmtime_r -#endif -#endif - /* The three (main) classes declared in this header represent: @@ -627,7 +606,7 @@ public: wxDateTime_t minute = 0, wxDateTime_t second = 0, wxDateTime_t millisec = 0); -#ifdef __WXMSW__ +#ifdef __WINDOWS__ wxDateTime(const struct _SYSTEMTIME& st) { SetFromMSWSysTime(st); @@ -949,7 +928,7 @@ public: // SYSTEMTIME format // ------------------------------------------------------------------------ -#ifdef __WXMSW__ +#ifdef __WINDOWS__ // convert SYSTEMTIME to wxDateTime wxDateTime& SetFromMSWSysTime(const struct _SYSTEMTIME& st); @@ -959,7 +938,7 @@ public: // same as above but only take date part into account, time is always zero wxDateTime& SetFromMSWSysDate(const struct _SYSTEMTIME& st); void GetAsMSWSysDate(struct _SYSTEMTIME* st) const; -#endif // __WXMSW__ +#endif // __WINDOWS__ // comparison (see also functions below for operator versions) // ------------------------------------------------------------------------ diff --git a/Externals/wxWidgets3/include/wx/datetimectrl.h b/Externals/wxWidgets3/include/wx/datetimectrl.h new file mode 100644 index 0000000000..8632d5f12e --- /dev/null +++ b/Externals/wxWidgets3/include/wx/datetimectrl.h @@ -0,0 +1,48 @@ +/////////////////////////////////////////////////////////////////////////////// +// Name: wx/timectrl.h +// Purpose: Declaration of wxDateTimePickerCtrl class. +// Author: Vadim Zeitlin +// Created: 2011-09-22 +// RCS-ID: $Id: datetimectrl.h 70071 2011-12-20 21:27:14Z VZ $ +// Copyright: (c) 2011 Vadim Zeitlin +// Licence: wxWindows licence +/////////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_DATETIME_CTRL_H_ +#define _WX_DATETIME_CTRL_H_ + +#include "wx/defs.h" + +#if wxUSE_DATEPICKCTRL || wxUSE_TIMEPICKCTRL + +#define wxNEEDS_DATETIMEPICKCTRL + +#include "wx/control.h" // the base class + +#include "wx/datetime.h" + +// ---------------------------------------------------------------------------- +// wxDateTimePickerCtrl: Private common base class of wx{Date,Time}PickerCtrl. +// ---------------------------------------------------------------------------- + +// This class is an implementation detail and should not be used directly, only +// use the documented API of wxDateTimePickerCtrl and wxTimePickerCtrl. +class WXDLLIMPEXP_ADV wxDateTimePickerCtrlBase : public wxControl +{ +public: + // Set/get the date or time (in the latter case, time part is ignored). + virtual void SetValue(const wxDateTime& dt) = 0; + virtual wxDateTime GetValue() const = 0; +}; + +#if defined(__WXMSW__) && !defined(__WXUNIVERSAL__) + #include "wx/msw/datetimectrl.h" +#elif defined(__WXOSX_COCOA__) && !defined(__WXUNIVERSAL__) + #include "wx/osx/datetimectrl.h" +#else + typedef wxDateTimePickerCtrlBase wxDateTimePickerCtrl; +#endif + +#endif // wxUSE_DATEPICKCTRL || wxUSE_TIMEPICKCTRL + +#endif // _WX_DATETIME_CTRL_H_ diff --git a/Externals/wxWidgets3/include/wx/dc.h b/Externals/wxWidgets3/include/wx/dc.h index 974666f5d2..2e66988c37 100644 --- a/Externals/wxWidgets3/include/wx/dc.h +++ b/Externals/wxWidgets3/include/wx/dc.h @@ -4,7 +4,7 @@ // Author: Vadim Zeitlin // Modified by: // Created: 05/25/99 -// RCS-ID: $Id: dc.h 67063 2011-02-27 12:48:13Z VZ $ +// RCS-ID: $Id: dc.h 68935 2011-08-27 23:26:53Z RD $ // Copyright: (c) wxWidgets team // Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// @@ -30,6 +30,7 @@ #include "wx/math.h" #include "wx/image.h" #include "wx/region.h" +#include "wx/affinematrix2d.h" #define wxUSE_NEW_DC 1 @@ -42,6 +43,10 @@ class WXDLLIMPEXP_FWD_CORE wxMemoryDC; class WXDLLIMPEXP_FWD_CORE wxPrinterDC; class WXDLLIMPEXP_FWD_CORE wxPrintData; +#if wxUSE_GRAPHICS_CONTEXT +class WXDLLIMPEXP_FWD_CORE wxGraphicsContext; +#endif + // Logical ops enum wxRasterOperationMode { @@ -470,7 +475,7 @@ public: } virtual void SetLogicalScale(double x, double y); - virtual void GetLogicalScale(double *x, double *y) + virtual void GetLogicalScale(double *x, double *y) const { if ( x ) *x = m_logicalScaleX; if ( y ) *y = m_logicalScaleY; @@ -490,6 +495,20 @@ public: if ( y ) *y = m_deviceOriginY; } +#if wxUSE_DC_TRANSFORM_MATRIX + // Transform matrix support is not available in most ports right now + // (currently only wxMSW provides it) so do nothing in these methods by + // default. + virtual bool CanUseTransformMatrix() const + { return false; } + virtual bool SetTransformMatrix(const wxAffineMatrix2D& WXUNUSED(matrix)) + { return false; } + virtual wxAffineMatrix2D GetTransformMatrix() const + { return wxAffineMatrix2D(); } + virtual void ResetTransformMatrix() + { } +#endif // wxUSE_DC_TRANSFORM_MATRIX + virtual void SetDeviceLocalOrigin( wxCoord x, wxCoord y ); virtual void ComputeScaleAndOrigin(); @@ -497,6 +516,19 @@ public: // this needs to overidden if the axis is inverted virtual void SetAxisOrientation(bool xLeftRight, bool yBottomUp); +#ifdef __WXMSW__ + // Native Windows functions using the underlying HDC don't honour GDI+ + // transformations which may be applied to it. Using this function we can + // transform the coordinates manually before passing them to such functions + // (as in e.g. wxRendererMSW code). It doesn't do anything if this is not a + // wxGCDC. + virtual wxRect MSWApplyGDIPlusTransform(const wxRect& r) const + { + return r; + } +#endif // __WXMSW__ + + // --------------------------------------------------------- // the actual drawing API @@ -612,6 +644,13 @@ public: virtual int GetResolution() const { return -1; } +#if wxUSE_GRAPHICS_CONTEXT + virtual wxGraphicsContext* GetGraphicsContext() const + { return NULL; } + virtual void SetGraphicsContext( wxGraphicsContext* WXUNUSED(ctx) ) + {} +#endif + private: wxDC *m_owner; @@ -981,7 +1020,7 @@ public: void SetLogicalScale(double x, double y) { m_pimpl->SetLogicalScale( x, y ); } - void GetLogicalScale(double *x, double *y) + void GetLogicalScale(double *x, double *y) const { m_pimpl->GetLogicalScale( x, y ); } void SetLogicalOrigin(wxCoord x, wxCoord y) @@ -1001,6 +1040,20 @@ public: void SetAxisOrientation(bool xLeftRight, bool yBottomUp) { m_pimpl->SetAxisOrientation(xLeftRight, yBottomUp); } +#if wxUSE_DC_TRANSFORM_MATRIX + bool CanUseTransformMatrix() const + { return m_pimpl->CanUseTransformMatrix(); } + + bool SetTransformMatrix(const wxAffineMatrix2D &matrix) + { return m_pimpl->SetTransformMatrix(matrix); } + + wxAffineMatrix2D GetTransformMatrix() const + { return m_pimpl->GetTransformMatrix(); } + + void ResetTransformMatrix() + { m_pimpl->ResetTransformMatrix(); } +#endif // wxUSE_DC_TRANSFORM_MATRIX + // mostly internal void SetDeviceLocalOrigin( wxCoord x, wxCoord y ) { m_pimpl->SetDeviceLocalOrigin( x, y ); } @@ -1287,6 +1340,17 @@ public: TempHDC GetTempHDC() { return TempHDC(*this); } #endif // __WXMSW__ +#if wxUSE_GRAPHICS_CONTEXT + virtual wxGraphicsContext* GetGraphicsContext() const + { + return m_pimpl->GetGraphicsContext(); + } + virtual void SetGraphicsContext( wxGraphicsContext* ctx ) + { + m_pimpl->SetGraphicsContext(ctx); + } +#endif + protected: // ctor takes ownership of the pointer wxDC(wxDCImpl *pimpl) : m_pimpl(pimpl) { } @@ -1315,13 +1379,13 @@ public: ~wxDCTextColourChanger() { - if ( m_colFgOld.Ok() ) + if ( m_colFgOld.IsOk() ) m_dc.SetTextForeground(m_colFgOld); } void Set(const wxColour& col) { - if ( !m_colFgOld.Ok() ) + if ( !m_colFgOld.IsOk() ) m_colFgOld = m_dc.GetTextForeground(); m_dc.SetTextForeground(col); } @@ -1349,7 +1413,7 @@ public: ~wxDCPenChanger() { - if ( m_penOld.Ok() ) + if ( m_penOld.IsOk() ) m_dc.SetPen(m_penOld); } @@ -1376,7 +1440,7 @@ public: ~wxDCBrushChanger() { - if ( m_brushOld.Ok() ) + if ( m_brushOld.IsOk() ) m_dc.SetBrush(m_brushOld); } @@ -1432,14 +1496,14 @@ public: void Set(const wxFont& font) { - if ( !m_fontOld.Ok() ) + if ( !m_fontOld.IsOk() ) m_fontOld = m_dc.GetFont(); m_dc.SetFont(font); } ~wxDCFontChanger() { - if ( m_fontOld.Ok() ) + if ( m_fontOld.IsOk() ) m_dc.SetFont(m_fontOld); } diff --git a/Externals/wxWidgets3/include/wx/dcgraph.h b/Externals/wxWidgets3/include/wx/dcgraph.h index 071c1d68b3..b636f239de 100644 --- a/Externals/wxWidgets3/include/wx/dcgraph.h +++ b/Externals/wxWidgets3/include/wx/dcgraph.h @@ -5,7 +5,7 @@ // Modified by: // Created: // Copyright: (c) Stefan Csomor -// RCS-ID: $Id: dcgraph.h 67254 2011-03-20 00:14:35Z DS $ +// RCS-ID: $Id: dcgraph.h 68935 2011-08-27 23:26:53Z RD $ // Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// @@ -29,10 +29,15 @@ public: #if wxUSE_PRINTING_ARCHITECTURE wxGCDC( const wxPrinterDC& dc ); #endif +#if defined(__WXMSW__) && wxUSE_ENH_METAFILE + wxGCDC( const wxEnhMetaFileDC& dc ); +#endif + wxGCDC(wxGraphicsContext* context); + wxGCDC(); virtual ~wxGCDC(); - wxGraphicsContext* GetGraphicsContext(); + wxGraphicsContext* GetGraphicsContext() const; void SetGraphicsContext( wxGraphicsContext* ctx ); #ifdef __WXMSW__ @@ -55,6 +60,9 @@ public: wxGCDCImpl( wxDC *owner, const wxMemoryDC& dc ); #if wxUSE_PRINTING_ARCHITECTURE wxGCDCImpl( wxDC *owner, const wxPrinterDC& dc ); +#endif +#if defined(__WXMSW__) && wxUSE_ENH_METAFILE + wxGCDCImpl( wxDC *owner, const wxEnhMetaFileDC& dc ); #endif wxGCDCImpl( wxDC *owner ); @@ -103,7 +111,7 @@ public: virtual void ComputeScaleAndOrigin(); - wxGraphicsContext* GetGraphicsContext() { return m_graphicContext; } + wxGraphicsContext* GetGraphicsContext() const { return m_graphicContext; } virtual void SetGraphicsContext( wxGraphicsContext* ctx ); // the true implementations @@ -193,6 +201,10 @@ public: virtual bool DoGetPartialTextExtents(const wxString& text, wxArrayInt& widths) const; +#ifdef __WXMSW__ + virtual wxRect MSWApplyGDIPlusTransform(const wxRect& r) const; +#endif // __WXMSW__ + protected: // scaling variables bool m_logicalFunctionSupported; diff --git a/Externals/wxWidgets3/include/wx/dde.h b/Externals/wxWidgets3/include/wx/dde.h index a39678c697..1c15a1f3ce 100644 --- a/Externals/wxWidgets3/include/wx/dde.h +++ b/Externals/wxWidgets3/include/wx/dde.h @@ -5,7 +5,7 @@ // Modified by: // Created: // Copyright: (c) Julian Smart -// RCS-ID: $Id: dde.h 47254 2007-07-09 10:09:52Z VS $ +// RCS-ID: $Id: dde.h 70808 2012-03-04 20:31:42Z VZ $ // Licence: wxWindows Licence ///////////////////////////////////////////////////////////////////////////// @@ -22,10 +22,10 @@ WX_DECLARE_USER_EXPORTED_LIST(wxDDEClient, wxDDEClientList, WXDLLIMPEXP_BASE); WX_DECLARE_USER_EXPORTED_LIST(wxDDEServer, wxDDEServerList, WXDLLIMPEXP_BASE); WX_DECLARE_USER_EXPORTED_LIST(wxDDEConnection, wxDDEConnectionList, WXDLLIMPEXP_BASE); -#if defined(__WXMSW__) +#if defined(__WINDOWS__) #include "wx/msw/dde.h" #else - #error DDE is only supported on MSW + #error DDE is only supported under Windows #endif #endif diff --git a/Externals/wxWidgets3/include/wx/debug.h b/Externals/wxWidgets3/include/wx/debug.h index f66cf4681e..589ae85f67 100644 --- a/Externals/wxWidgets3/include/wx/debug.h +++ b/Externals/wxWidgets3/include/wx/debug.h @@ -3,7 +3,7 @@ // Purpose: Misc debug functions and macros // Author: Vadim Zeitlin // Created: 29/01/98 -// RCS-ID: $Id: debug.h 67280 2011-03-22 14:17:38Z DS $ +// RCS-ID: $Id: debug.h 70345 2012-01-15 01:05:28Z VZ $ // Copyright: (c) 1998-2009 Vadim Zeitlin // Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// @@ -11,7 +11,7 @@ #ifndef _WX_DEBUG_H_ #define _WX_DEBUG_H_ -#if !defined(__WXPALMOS5__) && !defined(__WXWINCE__) +#if !defined(__WXWINCE__) #include #endif // systems without assert.h @@ -162,7 +162,7 @@ inline void wxDisableAsserts() { wxSetAssertHandler(NULL); } /* wxOnAssert() is used by the debugging macros defined below. Different - overloads are needed because these macros can be used with or without _T(). + overloads are needed because these macros can be used with or without wxT(). All of them are implemented in src/common/appcmn.cpp and unconditionally call wxTheAssertHandler so the caller must check that it is non-NULL @@ -172,7 +172,7 @@ inline void wxDisableAsserts() { wxSetAssertHandler(NULL); } #if wxUSE_UNICODE // these overloads are the ones typically used by debugging macros: we have to -// provide wxChar* msg version because it's common to use _T() in the macros +// provide wxChar* msg version because it's common to use wxT() in the macros // and finally, we can't use const wx(char)* msg = NULL, because that would // be ambiguous // @@ -299,6 +299,13 @@ extern void WXDLLIMPEXP_BASE wxOnAssert(const char *file, #define wxASSERT_LEVEL_2(cond) #endif +// This is simply a wrapper for the standard abort() which is not available +// under all platforms. +// +// It isn't really debug-related but there doesn't seem to be any better place +// for it, so declare it here and define it in appbase.cpp, together with +// wxTrap(). +extern void WXDLLIMPEXP_BASE wxAbort(); /* wxCHECK macros always check their conditions, setting debug level to 0 only diff --git a/Externals/wxWidgets3/include/wx/defs.h b/Externals/wxWidgets3/include/wx/defs.h index 42fa627b78..bb6afaa107 100644 --- a/Externals/wxWidgets3/include/wx/defs.h +++ b/Externals/wxWidgets3/include/wx/defs.h @@ -4,7 +4,7 @@ * Author: Julian Smart and others * Modified by: Ryan Norton (Converted to C) * Created: 01/02/97 - * RCS-ID: $Id: defs.h 66711 2011-01-19 10:47:49Z VZ $ + * RCS-ID: $Id: defs.h 70353 2012-01-15 14:46:41Z VZ $ * Copyright: (c) Julian Smart * Licence: wxWindows licence */ @@ -14,8 +14,10 @@ #ifndef _WX_DEFS_H_ #define _WX_DEFS_H_ -// NOTE: this symbol will be replaced with "WXWIN_COMPATIBILITY_3_0" as soon -// as the development branch for 3.1 is created +/* + NOTE: this symbol will be replaced with "WXWIN_COMPATIBILITY_3_0" as soon + as the development branch for 3.1 is created + */ #define FUTURE_WXWIN_COMPATIBILITY_3_0 1 #define wxDEPRECATED_FUTURE( x ) x @@ -29,11 +31,8 @@ /* Make sure the environment is set correctly */ # if defined(__WXMSW__) && defined(__X__) # error "Target can't be both X and Windows" -# elif defined(__WXMSW__) && defined(__PALMOS__) -# error "Target can't be both PalmOS and Windows" # elif !defined(__WXMOTIF__) && \ !defined(__WXMSW__) && \ - !defined(__WXPALMOS__)&& \ !defined(__WXGTK__) && \ !defined(__WXPM__) && \ !defined(__WXOSX_CARBON__) && \ @@ -41,7 +40,6 @@ !defined(__WXOSX_IPHONE__) && \ !defined(__WXCOCOA__) && \ !defined(__X__) && \ - !defined(__WXMGL__) && \ !defined(__WXDFB__) && \ !defined(__WXX11__) && \ wxUSE_GUI @@ -79,8 +77,10 @@ # pragma warning(disable:4514) /* unreferenced inline func has been removed */ # pragma warning(disable:4710) /* function not inlined */ - // TODO: this warning should really be enabled as it can be genuinely - // useful, check where does it occur in wxWidgets + /* + TODO: this warning should really be enabled as it can be genuinely + useful, check where does it occur in wxWidgets + */ #pragma warning(disable: 4127) /* conditional expression is constant */ /* There are too many false positivies for this one, particularly when @@ -89,6 +89,16 @@ class 'bar'" */ # pragma warning(disable:4251) + /* + This is a similar warning which occurs when deriving from standard + containers. MSDN even mentions that it can be ignored in this case + (albeit only in debug build while the warning is the same in release + too and seems equally harmless). + */ +#if wxUSE_STD_CONTAINERS +# pragma warning(disable:4275) +#endif /* wxUSE_STD_CONTAINERS */ + # ifdef __VISUALC5__ /* For VC++ 5.0 for release mode, the warning 'C4702: unreachable code */ /* is buggy, and occurs for code that does actually get executed */ @@ -115,7 +125,7 @@ */ #ifdef __VISUALC6__ #pragma warning(disable: 4284) - #endif // VC6 + #endif /* VC6 */ /* When compiling with VC++ 7 /Wp64 option we get thousands of warnings for @@ -388,15 +398,15 @@ typedef short int WXTYPE; #ifndef HAVE_WOSTREAM - // Mingw <= 3.4 and all versions of Cygwin as well as any gcc version (so - // far) targeting PalmOS don't have std::wostream - #if defined(__PALMOS__) || \ - (defined(__MINGW32__) && !wxCHECK_GCC_VERSION(4, 0)) || \ + /* + Mingw <= 3.4 and all versions of Cygwin don't have std::wostream + */ + #if (defined(__MINGW32__) && !wxCHECK_GCC_VERSION(4, 0)) || \ defined(__CYGWIN__) #define wxNO_WOSTREAM #endif - // VC++ doesn't have it in the old iostream library + /* VC++ doesn't have it in the old iostream library */ #if defined(__VISUALC__) && wxUSE_IOSTREAMH #define wxNO_WOSTREAM #endif @@ -408,12 +418,12 @@ typedef short int WXTYPE; #undef wxNO_WOSTREAM #endif /* HAVE_WOSTREAM */ -// ---------------------------------------------------------------------------- -// other C++ features -// ---------------------------------------------------------------------------- +/* ---------------------------------------------------------------------------- */ +/* other C++ features */ +/* ---------------------------------------------------------------------------- */ #ifndef HAVE_PARTIAL_SPECIALIZATION - // be optimistic by default + /* be optimistic by default */ #define HAVE_PARTIAL_SPECIALIZATION #endif @@ -421,17 +431,17 @@ typedef short int WXTYPE; #if __VISUALC__ < 1310 #undef HAVE_PARTIAL_SPECIALIZATION #endif -#endif // __VISUALC__ +#endif /* __VISUALC__ */ #ifndef HAVE_TEMPLATE_OVERLOAD_RESOLUTION - // assume the compiler can use type or const expressions as template - // arguments if it supports partial specialization -- except if it's a - // Borland one which can't + /* assume the compiler can use type or const expressions as template + arguments if it supports partial specialization -- except if it's a + Borland one which can't */ #if defined(HAVE_PARTIAL_SPECIALIZATION) && !defined(__BORLANDC__) #define HAVE_TEMPLATE_OVERLOAD_RESOLUTION - #endif // __BORLANDC__ -#endif // !defined(HAVE_TEMPLATE_OVERLOAD_RESOLUTION) + #endif /* (HAVE_PARTIAL_SPECIALIZATION) && !defined(__BORLANDC__) */ +#endif /* !defined(HAVE_TEMPLATE_OVERLOAD_RESOLUTION) */ /* ---------------------------------------------------------------------------- */ /* portable calling conventions macros */ @@ -513,15 +523,14 @@ typedef short int WXTYPE; #define wxDEPRECATED(x) x #endif -/* - explicitly specifying inline allows gcc < 3.4 to - handle the deprecation attribute even in the constructor. - doesn't seem to work on Apple's gcc 4.0.1 unless using -O0 -*/ -#if wxCHECK_GCC_VERSION(3, 4) || defined( __DARWIN__ ) - #define wxDEPRECATED_CONSTRUCTOR(x) x -#else +#if defined(__GNUC__) && !wxCHECK_GCC_VERSION(3, 4) + /* + We need to add dummy "inline" to allow gcc < 3.4 to handle the + deprecation attribute on the constructors. + */ #define wxDEPRECATED_CONSTRUCTOR(x) wxDEPRECATED( inline x) +#else + #define wxDEPRECATED_CONSTRUCTOR(x) wxDEPRECATED(x) #endif /* @@ -564,7 +573,7 @@ typedef short int WXTYPE; /* NULL declaration: it must be defined as 0 for C++ programs (in particular, */ /* it must not be defined as "(void *)0" which is standard for C but completely */ /* breaks C++ code) */ -#if !defined(__HANDHELDPC__) && !defined(__PALMOS__) +#if !defined(__HANDHELDPC__) #include #endif @@ -767,7 +776,7 @@ enum { wxDefaultCoord = -1 }; /* define fixed length types */ /* ---------------------------------------------------------------------------- */ -#if defined(__WXPALMOS__) || defined(__MINGW32__) +#if defined(__MINGW32__) #if !defined(__MWERKS__) #include #endif @@ -819,19 +828,7 @@ typedef wxUint16 wxWord; */ /* 32bit */ -#ifdef __PALMOS__ - typedef int wxInt32; - typedef unsigned int wxUint32; - #define SIZEOF_INT 4 - #define SIZEOF_LONG 4 - #define SIZEOF_WCHAR_T 2 - #define SIZEOF_SIZE_T 4 - #ifdef __WXPALMOS6__ - #define wxSIZE_T_IS_UINT - #endif - #define SIZEOF_VOID_P 4 - #define SIZEOF_SIZE_T 4 -#elif defined(__WINDOWS__) +#if defined(__WINDOWS__) #if defined(__WIN32__) typedef int wxInt32; typedef unsigned int wxUint32; @@ -1018,14 +1015,6 @@ typedef wxUint32 wxDword; #error "The 64 bit integer support in CodeWarrior has been disabled." #error "See the documentation on the 'longlong' pragma." #endif -#elif defined(__WXPALMOS__) - #if defined(__WXPALMOS6__) - #define wxLongLong_t int64_t - #else - #define wxLongLong_t long long - #endif /* __WXPALMOS6__ */ - #define wxLongLongSuffix ll - #define wxLongLongFmtSpec "ll" #elif defined(__VISAGECPP__) && __IBMCPP__ >= 400 #define wxLongLong_t long long #elif (defined(SIZEOF_LONG_LONG) && SIZEOF_LONG_LONG >= 8) || \ @@ -1045,16 +1034,7 @@ typedef wxUint32 wxDword; #ifdef wxLongLong_t - - #ifdef __WXPALMOS__ - #if defined(__WXPALMOS6__) - #define wxULongLong_t uint64_t - #else - #define wxULongLong_t unsigned long long - #endif /* __WXPALMOS6__ */ - #else - #define wxULongLong_t unsigned wxLongLong_t - #endif + #define wxULongLong_t unsigned wxLongLong_t /* wxLL() and wxULL() macros allow to define 64 bit constants in a @@ -1064,8 +1044,10 @@ typedef wxUint32 wxDword; #define wxLL(x) wxCONCAT(x, wxLongLongSuffix) #define wxULL(x) wxCONCAT(x, wxCONCAT(u, wxLongLongSuffix)) #else - // Currently only Borland compiler has broken concatenation operator - // and this compiler is known to use [u]i64 suffix. + /* + Currently only Borland compiler has broken concatenation operator + and this compiler is known to use [u]i64 suffix. + */ #define wxLL(x) wxAPPEND_i64(x) #define wxULL(x) wxAPPEND_ui64(x) #endif @@ -1102,8 +1084,6 @@ typedef wxUint32 wxDword; #if defined(_SSIZE_T_) || defined(_SSIZE_T_DEFINED) #define HAVE_SSIZE_T #endif -#elif defined(__PALMOS__) - #define HAVE_SSIZE_T #elif wxCHECK_WATCOM_VERSION(1,4) #define HAVE_SSIZE_T #endif @@ -1114,7 +1094,7 @@ typedef wxUint32 wxDword; #ifdef __UNIX__ #include #endif -#else // !HAVE_SSIZE_T +#else /* !HAVE_SSIZE_T */ #if SIZEOF_SIZE_T == 4 typedef wxInt32 ssize_t; #elif SIZEOF_SIZE_T == 8 @@ -1127,11 +1107,13 @@ typedef wxUint32 wxDword; #define HAVE_SSIZE_T #endif -// we can't rely on Windows _W64 being defined as windows.h may not be included -// so define our own equivalent: this should be used with types like WXLPARAM -// or WXWPARAM which are 64 bit under Win64 to avoid warnings each time we cast -// it to a pointer or a handle (which results in hundreds of warnings as Win32 -// API often passes pointers in them) +/* + We can't rely on Windows _W64 being defined as windows.h may not be + included so define our own equivalent: this should be used with types + like WXLPARAM or WXWPARAM which are 64 bit under Win64 to avoid warnings + each time we cast it to a pointer or a handle (which results in hundreds + of warnings as Win32 API often passes pointers in them) + */ #if wxCHECK_VISUALC_VERSION(7) #define wxW64 __w64 #else @@ -1142,7 +1124,13 @@ typedef wxUint32 wxDword; Define signed and unsigned integral types big enough to contain all of long, size_t and void *. */ -#if SIZEOF_SIZE_T >= SIZEOF_VOID_P +#if SIZEOF_LONG >= SIZEOF_VOID_P + /* + Normal case when long is the largest integral type. + */ + typedef long wxIntPtr; + typedef unsigned long wxUIntPtr; +#elif SIZEOF_SIZE_T >= SIZEOF_VOID_P /* Win64 case: size_t is the only integral type big enough for "void *". @@ -1152,12 +1140,6 @@ typedef wxUint32 wxDword; */ typedef wxW64 ssize_t wxIntPtr; typedef size_t wxUIntPtr; -#elif SIZEOF_LONG >= SIZEOF_VOID_P - /* - Normal case when long is the largest integral type. - */ - typedef long wxIntPtr; - typedef unsigned long wxUIntPtr; #else /* This should never happen for the current architectures but if you're @@ -1447,12 +1429,12 @@ typedef double wxDouble; /* ---------------------------------------------------------------------------- */ #if defined(__GNUC__) && !wxCHECK_GCC_VERSION( 3, 4 ) - // GCC <= 3.4 has buggy template support + /* GCC <= 3.4 has buggy template support */ # define wxUSE_MEMBER_TEMPLATES 0 #endif #if defined(_MSC_VER) && _MSC_VER <= 1200 - // MSVC <= 6.0 has buggy template support + /* MSVC <= 6.0 has buggy template support */ # define wxUSE_MEMBER_TEMPLATES 0 # define wxUSE_FUNC_TEMPLATE_POINTER 0 #endif @@ -1532,9 +1514,11 @@ enum wxDirection enum wxAlignment { - // 0 is a valid wxAlignment value (both wxALIGN_LEFT and wxALIGN_TOP use - // it) so define a symbolic name for an invalid alignment value which can - // be assumed to be different from anything else + /* + 0 is a valid wxAlignment value (both wxALIGN_LEFT and wxALIGN_TOP + use it) so define a symbolic name for an invalid alignment value + which can be assumed to be different from anything else + */ wxALIGN_INVALID = -1, wxALIGN_NOT = 0x0000, @@ -1557,10 +1541,12 @@ enum wxAlignment /* misc. flags for wxSizer items */ enum wxSizerFlagBits { - // wxADJUST_MINSIZE doesn't do anything any more but we still define it for - // compatibility. Notice that it may be also predefined (as 0, hopefully) - // in the user code in order to use it even in !WXWIN_COMPATIBILITY_2_8 - // builds so don't redefine it in such case. + /* + wxADJUST_MINSIZE doesn't do anything any more but we still define + it for compatibility. Notice that it may be also predefined (as 0, + hopefully) in the user code in order to use it even in + !WXWIN_COMPATIBILITY_2_8 builds so don't redefine it in such case. + */ #if WXWIN_COMPATIBILITY_2_8 && !defined(wxADJUST_MINSIZE) wxADJUST_MINSIZE = 0, #endif @@ -1848,14 +1834,12 @@ enum wxBorder /* Old names for compatibility */ #define wxRA_HORIZONTAL wxHORIZONTAL #define wxRA_VERTICAL wxVERTICAL -#define wxRA_USE_CHECKBOX 0x0010 /* alternative native subcontrols (wxPalmOS) */ /* * wxRadioButton style flag */ #define wxRB_GROUP 0x0004 #define wxRB_SINGLE 0x0008 -#define wxRB_USE_CHECKBOX 0x0010 /* alternative native control (wxPalmOS) */ /* * wxScrollBar flags @@ -1929,12 +1913,12 @@ enum wxBorder #define wxICON_STOP wxICON_HAND #define wxICON_ASTERISK wxICON_INFORMATION -#define wxFORWARD 0x00001000 -#define wxBACKWARD 0x00002000 -#define wxRESET 0x00004000 -#define wxHELP 0x00008000 -#define wxMORE 0x00010000 -#define wxSETUP 0x00020000 +#define wxHELP 0x00001000 +#define wxFORWARD 0x00002000 +#define wxBACKWARD 0x00004000 +#define wxRESET 0x00008000 +#define wxMORE 0x00010000 +#define wxSETUP 0x00020000 #define wxICON_NONE 0x00040000 #define wxICON_MASK \ @@ -1945,29 +1929,37 @@ enum wxBorder */ enum wxBackgroundStyle { - // background is erased in the EVT_ERASE_BACKGROUND handler or using the - // system default background if no such handler is defined (this is the - // default style) + /* + background is erased in the EVT_ERASE_BACKGROUND handler or using + the system default background if no such handler is defined (this + is the default style) + */ wxBG_STYLE_ERASE, - // background is erased by the system, no EVT_ERASE_BACKGROUND event is - // generated at all + /* + background is erased by the system, no EVT_ERASE_BACKGROUND event + is generated at all + */ wxBG_STYLE_SYSTEM, - // background is erased in EVT_PAINT handler and not erased at all before - // it, this should be used if the paint handler paints over the entire - // window to avoid flicker + /* + background is erased in EVT_PAINT handler and not erased at all + before it, this should be used if the paint handler paints over + the entire window to avoid flicker + */ wxBG_STYLE_PAINT, - // this is a Mac-only style, don't use in portable code + /* this is a Mac-only style, don't use in portable code */ wxBG_STYLE_TRANSPARENT, - // this style is deprecated and doesn't do anything, don't use + /* this style is deprecated and doesn't do anything, don't use */ wxBG_STYLE_COLOUR, - // this style is deprecated and is synonymous with wxBG_STYLE_PAINT, use - // the new name + /* + this style is deprecated and is synonymous with + wxBG_STYLE_PAINT, use the new name + */ wxBG_STYLE_CUSTOM = wxBG_STYLE_PAINT }; @@ -2203,6 +2195,18 @@ enum wxItemKind wxITEM_MAX }; +/* + * The possible states of a 3-state checkbox (Compatible + * with the 2-state checkbox). + */ +enum wxCheckBoxState +{ + wxCHK_UNCHECKED, + wxCHK_CHECKED, + wxCHK_UNDETERMINED /* 3-state checkbox only */ +}; + + /* hit test results */ enum wxHitTest { @@ -2297,7 +2301,7 @@ enum wxDeprecatedGUIConstants wxTRANSPARENT, /* Brush & Pen Stippling. Note that a stippled pen cannot be dashed!! */ - /* Note also that stippling a Pen IS meaningfull, because a Line is */ + /* Note also that stippling a Pen IS meaningful, because a Line is */ wxSTIPPLE_MASK_OPAQUE, /* mask is used for blitting monochrome using text fore and back ground colors */ wxSTIPPLE_MASK, /* mask is used for masking areas in the stipple bitmap (TO DO) */ /* drawn with a Pen, and without any Brush -- and it can be stippled. */ @@ -2354,7 +2358,34 @@ enum wxKeyCode { WXK_NONE = 0, - WXK_BACK = 8, // backspace + WXK_CONTROL_A = 1, + WXK_CONTROL_B, + WXK_CONTROL_C, + WXK_CONTROL_D, + WXK_CONTROL_E, + WXK_CONTROL_F, + WXK_CONTROL_G, + WXK_CONTROL_H, + WXK_CONTROL_I, + WXK_CONTROL_J, + WXK_CONTROL_K, + WXK_CONTROL_L, + WXK_CONTROL_M, + WXK_CONTROL_N, + WXK_CONTROL_O, + WXK_CONTROL_P, + WXK_CONTROL_Q, + WXK_CONTROL_R, + WXK_CONTROL_S, + WXK_CONTROL_T, + WXK_CONTROL_U, + WXK_CONTROL_V, + WXK_CONTROL_W, + WXK_CONTROL_X, + WXK_CONTROL_Y, + WXK_CONTROL_Z, + + WXK_BACK = 8, /* backspace */ WXK_TAB = 9, WXK_RETURN = 13, WXK_ESCAPE = 27, @@ -2477,7 +2508,12 @@ enum wxKeyCode WXK_WINDOWS_LEFT, WXK_WINDOWS_RIGHT, WXK_WINDOWS_MENU , - WXK_COMMAND, +#ifdef __WXOSX__ + WXK_RAW_CONTROL, +#else + WXK_RAW_CONTROL = WXK_CONTROL, +#endif + WXK_COMMAND = WXK_CONTROL, /* Hardware-specific buttons */ WXK_SPECIAL1 = 193, @@ -2513,10 +2549,11 @@ enum wxKeyModifier wxMOD_META = 0x0008, wxMOD_WIN = wxMOD_META, #if defined(__WXMAC__) || defined(__WXCOCOA__) - wxMOD_CMD = wxMOD_META, + wxMOD_RAW_CONTROL = 0x0010, #else - wxMOD_CMD = wxMOD_CONTROL, + wxMOD_RAW_CONTROL = wxMOD_CONTROL, #endif + wxMOD_CMD = wxMOD_CONTROL, wxMOD_ALL = 0xffff }; @@ -2733,7 +2770,7 @@ typedef int (* LINKAGEMODE wxListIterateFunction)(void *current); #endif #if defined(__CYGWIN__) && defined(__WXMSW__) -# if wxUSE_STL || defined(wxUSE_STD_STRING) +# if wxUSE_STD_CONTAINERS || defined(wxUSE_STD_STRING) /* NASTY HACK because the gethostname in sys/unistd.h which the gnu stl includes and wx builds with by default clash with each other @@ -2786,7 +2823,7 @@ typedef void* WXDisplay; typedef const void * CFTypeRef; -// typedef const struct __CFString * CFStringRef; +/* typedef const struct __CFString * CFStringRef; */ #define DECLARE_WXOSX_OPAQUE_CFREF( name ) typedef struct __##name* name##Ref; #define DECLARE_WXOSX_OPAQUE_CONST_CFREF( name ) typedef const struct __##name* name##Ref; @@ -2964,42 +3001,7 @@ typedef WX_NSString* WXGLPixelFormat; #endif -#endif // __WXMAC__ - -#if defined(__WXPALMOS__) - -typedef void * WXHWND; -typedef void * WXHANDLE; -typedef void * WXHICON; -typedef void * WXHFONT; -typedef void * WXHMENU; -typedef void * WXHPEN; -typedef void * WXHBRUSH; -typedef void * WXHPALETTE; -typedef void * WXHCURSOR; -typedef void * WXHRGN; -typedef void * WXHACCEL; -typedef void * WXHINSTANCE; -typedef void * WXHBITMAP; -typedef void * WXHIMAGELIST; -typedef void * WXHGLOBAL; -typedef void * WXHDC; -typedef unsigned int WXUINT; -typedef unsigned long WXDWORD; -typedef unsigned short WXWORD; - -typedef unsigned long WXCOLORREF; -typedef struct tagMSG WXMSG; - -typedef WXHWND WXWINHANDLE; /* WinHandle of PalmOS */ -typedef WXWINHANDLE WXWidget; - -typedef void * WXFORMPTR; -typedef void * WXEVENTPTR; -typedef void * WXRECTANGLEPTR; - -#endif /* __WXPALMOS__ */ - +#endif /* __WXMAC__ */ /* ABX: check __WIN32__ instead of __WXMSW__ for the same MSWBase in any Win32 port */ #if defined(__WIN32__) @@ -3208,53 +3210,45 @@ typedef long WXPixel; /* safety catch in src/motif/colour.cpp */ #ifdef __WXGTK__ /* Stand-ins for GLIB types */ -typedef char gchar; -typedef signed char gint8; -typedef int gint; -typedef unsigned guint; -typedef unsigned long gulong; -typedef void* gpointer; typedef struct _GSList GSList; /* Stand-ins for GDK types */ typedef struct _GdkColor GdkColor; -typedef struct _GdkColormap GdkColormap; -typedef struct _GdkFont GdkFont; -typedef struct _GdkGC GdkGC; -typedef struct _GdkVisual GdkVisual; - -#ifdef __WXGTK20__ -typedef struct _GdkAtom *GdkAtom; -typedef struct _GdkDrawable GdkWindow; -typedef struct _GdkDrawable GdkBitmap; -typedef struct _GdkDrawable GdkPixmap; -#else /* GTK+ 1.2 */ -typedef gulong GdkAtom; -typedef struct _GdkWindow GdkWindow; -typedef struct _GdkWindow GdkBitmap; -typedef struct _GdkWindow GdkPixmap; -#endif /* GTK+ 1.2/2.0 */ - typedef struct _GdkCursor GdkCursor; -typedef struct _GdkRegion GdkRegion; typedef struct _GdkDragContext GdkDragContext; -#ifdef HAVE_XIM -typedef struct _GdkIC GdkIC; -typedef struct _GdkICAttr GdkICAttr; +#if defined(__WXGTK20__) + typedef struct _GdkAtom* GdkAtom; +#else + typedef unsigned long GdkAtom; +#endif + +#if !defined(__WXGTK30__) + typedef struct _GdkColormap GdkColormap; + typedef struct _GdkFont GdkFont; + typedef struct _GdkGC GdkGC; + typedef struct _GdkRegion GdkRegion; +#endif + +#if defined(__WXGTK30__) + typedef struct _GdkWindow GdkWindow; +#elif defined(__WXGTK20__) + typedef struct _GdkDrawable GdkWindow; + typedef struct _GdkDrawable GdkPixmap; +#else + typedef struct _GdkWindow GdkWindow; + typedef struct _GdkWindow GdkBitmap; + typedef struct _GdkWindow GdkPixmap; #endif /* Stand-ins for GTK types */ typedef struct _GtkWidget GtkWidget; typedef struct _GtkRcStyle GtkRcStyle; typedef struct _GtkAdjustment GtkAdjustment; -typedef struct _GtkList GtkList; typedef struct _GtkToolbar GtkToolbar; -typedef struct _GtkTooltips GtkTooltips; typedef struct _GtkNotebook GtkNotebook; typedef struct _GtkNotebookPage GtkNotebookPage; typedef struct _GtkAccelGroup GtkAccelGroup; -typedef struct _GtkItemFactory GtkItemFactory; typedef struct _GtkSelectionData GtkSelectionData; typedef struct _GtkTextBuffer GtkTextBuffer; typedef struct _GtkRange GtkRange; @@ -3282,10 +3276,6 @@ typedef struct _PangoLayout PangoLayout; typedef struct _PangoFontDescription PangoFontDescription; #endif -#ifdef __WXMGL__ -typedef struct window_t *WXWidget; -#endif /* MGL */ - #ifdef __WXDFB__ /* DirectFB doesn't have the concept of non-TLW window, so use something arbitrary */ @@ -3328,7 +3318,7 @@ typedef const void* WXWidget; private: \ classname& operator=(const classname&) -// deprecated variants _not_ requiring a semicolon after them +/* deprecated variants _not_ requiring a semicolon after them */ #define DECLARE_NO_COPY_CLASS(classname) \ wxDECLARE_NO_COPY_CLASS(classname); #define DECLARE_NO_COPY_TEMPLATE_CLASS(classname, arg) \ diff --git a/Externals/wxWidgets3/include/wx/dialog.h b/Externals/wxWidgets3/include/wx/dialog.h index 67191522a6..3ce0c53ccc 100644 --- a/Externals/wxWidgets3/include/wx/dialog.h +++ b/Externals/wxWidgets3/include/wx/dialog.h @@ -4,7 +4,7 @@ // Author: Vadim Zeitlin // Modified by: // Created: 29.06.99 -// RCS-ID: $Id: dialog.h 66087 2010-11-10 13:51:57Z VZ $ +// RCS-ID: $Id: dialog.h 70345 2012-01-15 01:05:28Z VZ $ // Copyright: (c) Vadim Zeitlin // Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// @@ -26,7 +26,7 @@ class wxTextSizerWrapper; // Also see the bit summary table in wx/toplevel.h. -#define wxDIALOG_NO_PARENT 0x0100 // Don't make owned by apps top window +#define wxDIALOG_NO_PARENT 0x00000020 // Don't make owned by apps top window #ifdef __WXWINCE__ #define wxDEFAULT_DIALOG_STYLE (wxCAPTION | wxMAXIMIZE | wxCLOSE_BOX | wxNO_BORDER) @@ -350,9 +350,7 @@ public: #if defined(__WXUNIVERSAL__) && !defined(__WXMICROWIN__) #include "wx/univ/dialog.h" #else - #if defined(__WXPALMOS__) - #include "wx/palmos/dialog.h" - #elif defined(__WXMSW__) + #if defined(__WXMSW__) #include "wx/msw/dialog.h" #elif defined(__WXMOTIF__) #include "wx/motif/dialog.h" @@ -394,5 +392,8 @@ typedef void (wxEvtHandler::*wxWindowModalDialogEventFunction)(wxWindowModalDial #define wxWindowModalDialogEventHandler(func) \ wxEVENT_HANDLER_CAST(wxWindowModalDialogEventFunction, func) +#define EVT_WINDOW_MODAL_DIALOG_CLOSED(winid, func) \ + wx__DECLARE_EVT1(wxEVT_WINDOW_MODAL_DIALOG_CLOSED, winid, wxWindowModalDialogEventHandler(func)) + #endif // _WX_DIALOG_H_BASE_ diff --git a/Externals/wxWidgets3/include/wx/dialup.h b/Externals/wxWidgets3/include/wx/dialup.h index f52303f2b0..ba591ebe71 100644 --- a/Externals/wxWidgets3/include/wx/dialup.h +++ b/Externals/wxWidgets3/include/wx/dialup.h @@ -4,7 +4,7 @@ // Author: Vadim Zeitlin // Modified by: // Created: 07.07.99 -// RCS-ID: $Id: dialup.h 58757 2009-02-08 11:45:59Z VZ $ +// RCS-ID: $Id: dialup.h 67384 2011-04-03 20:31:32Z DS $ // Copyright: (c) Vadim Zeitlin // Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// @@ -171,7 +171,7 @@ public: bool IsConnectedEvent() const { return GetEventType() == wxEVT_DIALUP_CONNECTED; } - // does this event come from wxDialUpManager::Dial() or from some extrenal + // does this event come from wxDialUpManager::Dial() or from some external // process (i.e. does it result from our own attempt to establish the // connection)? bool IsOwnEvent() const { return m_id != 0; } diff --git a/Externals/wxWidgets3/include/wx/dirdlg.h b/Externals/wxWidgets3/include/wx/dirdlg.h index 49f6d9630e..16f7beef5d 100644 --- a/Externals/wxWidgets3/include/wx/dirdlg.h +++ b/Externals/wxWidgets3/include/wx/dirdlg.h @@ -5,7 +5,7 @@ // Modified by: // Created: // Copyright: (c) Robert Roebling -// RCS-ID: $Id: dirdlg.h 54125 2008-06-11 19:17:41Z SC $ +// RCS-ID: $Id: dirdlg.h 70353 2012-01-15 14:46:41Z VZ $ // Licence: wxWindows Licence ///////////////////////////////////////////////////////////////////////////// @@ -116,9 +116,7 @@ protected: #include "wx/cocoa/dirdlg.h" // Native Cocoa #elif defined(__WXMOTIF__) || \ defined(__WXX11__) || \ - defined(__WXMGL__) || \ defined(__WXCOCOA__) || \ - defined(__WXPALMOS__) || \ defined(__WXPM__) #include "wx/generic/dirdlgg.h" // Other ports use generic implementation #define wxDirDialog wxGenericDirDialog diff --git a/Externals/wxWidgets3/include/wx/dlimpexp.h b/Externals/wxWidgets3/include/wx/dlimpexp.h index 9efcf5328a..1042938b40 100644 --- a/Externals/wxWidgets3/include/wx/dlimpexp.h +++ b/Externals/wxWidgets3/include/wx/dlimpexp.h @@ -4,7 +4,7 @@ * Author: Vadim Zeitlin * Modified by: * Created: 16.10.2003 (extracted from wx/defs.h) - * RCS-ID: $Id: dlimpexp.h 61944 2009-09-16 12:06:02Z PJC $ + * RCS-ID: $Id: dlimpexp.h 69049 2011-09-10 18:09:12Z SJL $ * Copyright: (c) 2003 Vadim Zeitlin * Licence: wxWindows licence */ @@ -22,14 +22,25 @@ #elif defined(__WINDOWS__) /* __declspec works in BC++ 5 and later, Watcom C++ 11.0 and later as well - as VC++ and gcc + as VC++. */ -# if defined(__VISUALC__) || defined(__BORLANDC__) || defined(__GNUC__) || defined(__WATCOMC__) +# if defined(__VISUALC__) || defined(__BORLANDC__) || defined(__WATCOMC__) # define WXEXPORT __declspec(dllexport) # define WXIMPORT __declspec(dllimport) -# else /* compiler doesn't support __declspec() */ -# define WXEXPORT -# define WXIMPORT + /* + While gcc also supports __declspec(dllexport), it creates unusably huge + DLL files since gcc 4.5 (while taking horribly long amounts of time), + see http://gcc.gnu.org/bugzilla/show_bug.cgi?id=43601. Because of this + we rely on binutils auto export/import support which seems to work + quite well for 4.5+. + */ +# elif defined(__GNUC__) && !wxCHECK_GCC_VERSION(4, 5) + /* + __declspec could be used here too but let's use the native + __attribute__ instead for clarity. + */ +# define WXEXPORT __attribute__((dllexport)) +# define WXIMPORT __attribute__((dllimport)) # endif #elif defined(__WXPM__) # if defined (__WATCOMC__) @@ -91,6 +102,7 @@ # define WXMAKINGDLL_RICHTEXT # define WXMAKINGDLL_MEDIA # define WXMAKINGDLL_STC +# define WXMAKINGDLL_WEBVIEW #endif /* WXMAKINGDLL */ /* @@ -263,6 +275,17 @@ # define WXDLLIMPEXP_DATA_STC(type) type #endif +#ifdef WXMAKINGDLL_WEBVIEW +# define WXDLLIMPEXP_WEBVIEW WXEXPORT +# define WXDLLIMPEXP_DATA_WEBVIEW(type) WXEXPORT type +#elif defined(WXUSINGDLL) +# define WXDLLIMPEXP_WEBVIEW WXIMPORT +# define WXDLLIMPEXP_DATA_WEBVIEW(type) WXIMPORT type +#else /* not making nor using DLL */ +# define WXDLLIMPEXP_WEBVIEW +# define WXDLLIMPEXP_DATA_WEBVIEW(type) type +#endif + /* GCC warns about using __attribute__ (and also __declspec in mingw32 case) on forward declarations while MSVC complains about forward declarations without @@ -284,6 +307,7 @@ #define WXDLLIMPEXP_FWD_RICHTEXT #define WXDLLIMPEXP_FWD_MEDIA #define WXDLLIMPEXP_FWD_STC + #define WXDLLIMPEXP_FWD_WEBVIEW #else #define WXDLLIMPEXP_FWD_BASE WXDLLIMPEXP_BASE #define WXDLLIMPEXP_FWD_NET WXDLLIMPEXP_NET @@ -299,6 +323,7 @@ #define WXDLLIMPEXP_FWD_RICHTEXT WXDLLIMPEXP_RICHTEXT #define WXDLLIMPEXP_FWD_MEDIA WXDLLIMPEXP_MEDIA #define WXDLLIMPEXP_FWD_STC WXDLLIMPEXP_STC + #define WXDLLIMPEXP_FWD_WEBVIEW WXDLLIMPEXP_WEBVIEW #endif /* for backwards compatibility, define suffix-less versions too */ diff --git a/Externals/wxWidgets3/include/wx/dlist.h b/Externals/wxWidgets3/include/wx/dlist.h index 164ed8680a..b69f617d9b 100644 --- a/Externals/wxWidgets3/include/wx/dlist.h +++ b/Externals/wxWidgets3/include/wx/dlist.h @@ -13,7 +13,7 @@ #include "wx/defs.h" #include "wx/utils.h" -#if wxUSE_STL +#if wxUSE_STD_CONTAINERS #include "wx/beforestd.h" #include @@ -199,7 +199,7 @@ public: } }; -#else // STL +#else // !wxUSE_STD_CONTAINERS template class wxDList @@ -845,6 +845,6 @@ public: } */ }; -#endif // wxUSE_STL/!wxUSE_STL +#endif // wxUSE_STD_CONTAINERS/!wxUSE_STD_CONTAINERS #endif // _WX_DLIST_H_ diff --git a/Externals/wxWidgets3/include/wx/docview.h b/Externals/wxWidgets3/include/wx/docview.h index 3f48964a03..e15414e65f 100644 --- a/Externals/wxWidgets3/include/wx/docview.h +++ b/Externals/wxWidgets3/include/wx/docview.h @@ -4,7 +4,7 @@ // Author: Julian Smart // Modified by: // Created: 01/02/97 -// RCS-ID: $Id: docview.h 67280 2011-03-22 14:17:38Z DS $ +// RCS-ID: $Id: docview.h 70098 2011-12-23 05:59:59Z PC $ // Copyright: (c) Julian Smart // Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// @@ -17,6 +17,7 @@ #if wxUSE_DOC_VIEW_ARCHITECTURE #include "wx/list.h" +#include "wx/dlist.h" #include "wx/string.h" #include "wx/frame.h" #include "wx/filehistory.h" @@ -172,6 +173,10 @@ public: // dialogs. Override if necessary. virtual wxWindow *GetDocumentWindow() const; + // Returns true if this document is a child document corresponding to a + // part of the parent document and not a disk file as usual. + bool IsChildDocument() const { return m_documentParent != NULL; } + protected: wxList m_documentViews; wxString m_documentFile; @@ -179,7 +184,12 @@ protected: wxString m_documentTypeName; wxDocTemplate* m_documentTemplate; bool m_documentModified; + + // if the document parent is non-NULL, it's a pseudo-document corresponding + // to a part of the parent document which can't be saved or loaded + // independently of its parent and is always closed when its parent is wxDocument* m_documentParent; + wxCommandProcessor* m_commandProcessor; bool m_savedYet; @@ -193,6 +203,10 @@ protected: wxString DoGetUserReadableName() const; private: + // list of all documents whose m_documentParent is this one + typedef wxDList DocsList; + DocsList m_childDocuments; + DECLARE_ABSTRACT_CLASS(wxDocument) wxDECLARE_NO_COPY_CLASS(wxDocument); }; @@ -386,6 +400,7 @@ public: void OnUpdateFileRevert(wxUpdateUIEvent& event); void OnUpdateFileNew(wxUpdateUIEvent& event); void OnUpdateFileSave(wxUpdateUIEvent& event); + void OnUpdateFileSaveAs(wxUpdateUIEvent& event); void OnUpdateUndo(wxUpdateUIEvent& event); void OnUpdateRedo(wxUpdateUIEvent& event); @@ -474,6 +489,13 @@ public: // Get the current document manager static wxDocManager* GetDocumentManager() { return sm_docManager; } +#if wxUSE_PRINTING_ARCHITECTURE + wxPageSetupDialogData& GetPageSetupDialogData() + { return m_pageSetupDialogData; } + const wxPageSetupDialogData& GetPageSetupDialogData() const + { return m_pageSetupDialogData; } +#endif // wxUSE_PRINTING_ARCHITECTURE + #if WXWIN_COMPATIBILITY_2_8 // deprecated, override GetDefaultName() instead wxDEPRECATED_BUT_USED_INTERNALLY( @@ -488,6 +510,11 @@ public: protected: + // Called when a file selected from the MRU list doesn't exist any more. + // The default behaviour is to remove the file from the MRU and notify the + // user about it but this method can be overridden to customize it. + virtual void OnMRUFileNotExist(unsigned n, const wxString& filename); + // Open the MRU file with the given index in our associated file history. void DoOpenMRUFile(unsigned n); #if wxUSE_PRINTING_ARCHITECTURE @@ -959,7 +986,7 @@ wxTransferStreamToFile(wxInputStream& stream, const wxString& filename); // these flags are not used anywhere by wxWidgets and kept only for an unlikely // case of existing user code using them for its own purposes -#ifdef WXWIN_COMPATIBILITY_2_8 +#if WXWIN_COMPATIBILITY_2_8 enum { wxDOC_SDI = 1, diff --git a/Externals/wxWidgets3/include/wx/dvrenderers.h b/Externals/wxWidgets3/include/wx/dvrenderers.h index 64054732ef..7c372739b8 100644 --- a/Externals/wxWidgets3/include/wx/dvrenderers.h +++ b/Externals/wxWidgets3/include/wx/dvrenderers.h @@ -3,7 +3,7 @@ // Purpose: Declare all wxDataViewCtrl classes // Author: Robert Roebling, Vadim Zeitlin // Created: 2009-11-08 (extracted from wx/dataview.h) -// RCS-ID: $Id: dvrenderers.h 67099 2011-03-01 12:16:49Z VS $ +// RCS-ID: $Id: dvrenderers.h 70050 2011-12-19 12:54:38Z VZ $ // Copyright: (c) 2006 Robert Roebling // (c) 2009 Vadim Zeitlin // Licence: wxWindows licence @@ -54,6 +54,21 @@ public: void SetIcon( const wxIcon &icon ) { m_icon = icon; } const wxIcon &GetIcon() const { return m_icon; } + bool IsSameAs(const wxDataViewIconText& other) const + { + return m_text == other.m_text && m_icon.IsSameAs(other.m_icon); + } + + bool operator==(const wxDataViewIconText& other) const + { + return IsSameAs(other); + } + + bool operator!=(const wxDataViewIconText& other) const + { + return !IsSameAs(other); + } + private: wxString m_text; wxIcon m_icon; @@ -61,19 +76,6 @@ private: DECLARE_DYNAMIC_CLASS(wxDataViewIconText) }; -inline -bool operator==(const wxDataViewIconText& left, const wxDataViewIconText& right) -{ - return left.GetText() == right.GetText() && - left.GetIcon().IsSameAs(right.GetIcon()); -} - -inline -bool operator!=(const wxDataViewIconText& left, const wxDataViewIconText& right) -{ - return !(left == right); -} - DECLARE_VARIANT_OBJECT_EXPORTED(wxDataViewIconText, WXDLLIMPEXP_ADV) // ---------------------------------------------------------------------------- @@ -145,11 +147,11 @@ public: // in-place editing virtual bool HasEditorCtrl() const { return false; } - virtual wxControl* CreateEditorCtrl(wxWindow * WXUNUSED(parent), - wxRect WXUNUSED(labelRect), - const wxVariant& WXUNUSED(value)) + virtual wxWindow* CreateEditorCtrl(wxWindow * WXUNUSED(parent), + wxRect WXUNUSED(labelRect), + const wxVariant& WXUNUSED(value)) { return NULL; } - virtual bool GetValueFromEditorCtrl(wxControl * WXUNUSED(editor), + virtual bool GetValueFromEditorCtrl(wxWindow * WXUNUSED(editor), wxVariant& WXUNUSED(value)) { return false; } @@ -157,7 +159,7 @@ public: virtual void CancelEditing(); virtual bool FinishEditing(); - wxControl *GetEditorCtrl() { return m_editorCtrl; } + wxWindow *GetEditorCtrl() { return m_editorCtrl; } virtual bool IsCustomRenderer() const { return false; } @@ -168,11 +170,12 @@ protected: wxString m_variantType; wxDataViewColumn *m_owner; - wxWeakRef m_editorCtrl; + wxWeakRef m_editorCtrl; wxDataViewItem m_item; // for m_editorCtrl - // internal utility: - const wxDataViewCtrl* GetView() const; + // internal utility, may be used anywhere the window associated with the + // renderer is required + wxDataViewCtrl* GetView() const; protected: DECLARE_DYNAMIC_CLASS_NO_COPY(wxDataViewRendererBase) @@ -225,23 +228,32 @@ public: // Return the size of the item appropriate to its current value. virtual wxSize GetSize() const = 0; - // Define virtual function which are called when the item is activated - // (double-clicked or Enter is pressed on it), clicked or the user starts - // to drag it: by default they all simply return false indicating that the - // events are not handled + // Define virtual function which are called when a key is pressed on the + // item, clicked or the user starts to drag it: by default they all simply + // return false indicating that the events are not handled - virtual bool Activate(const wxRect& WXUNUSED(cell), - wxDataViewModel *WXUNUSED(model), - const wxDataViewItem & WXUNUSED(item), - unsigned int WXUNUSED(col)) - { return false; } + virtual bool ActivateCell(const wxRect& cell, + wxDataViewModel *model, + const wxDataViewItem & item, + unsigned int col, + const wxMouseEvent* mouseEvent); - virtual bool LeftClick(const wxPoint& WXUNUSED(cursor), - const wxRect& WXUNUSED(cell), - wxDataViewModel *WXUNUSED(model), - const wxDataViewItem & WXUNUSED(item), - unsigned int WXUNUSED(col) ) - { return false; } + // Deprecated, use (and override) ActivateCell() instead + wxDEPRECATED_BUT_USED_INTERNALLY_INLINE( + virtual bool Activate(wxRect WXUNUSED(cell), + wxDataViewModel *WXUNUSED(model), + const wxDataViewItem & WXUNUSED(item), + unsigned int WXUNUSED(col)), + return false; ) + + // Deprecated, use (and override) ActivateCell() instead + wxDEPRECATED_BUT_USED_INTERNALLY_INLINE( + virtual bool LeftClick(wxPoint WXUNUSED(cursor), + wxRect WXUNUSED(cell), + wxDataViewModel *WXUNUSED(model), + const wxDataViewItem & WXUNUSED(item), + unsigned int WXUNUSED(col)), + return false; ) virtual bool StartDrag(const wxPoint& WXUNUSED(cursor), const wxRect& WXUNUSED(cell), @@ -278,6 +290,9 @@ public: // platform-specific classes. virtual wxDC *GetDC() = 0; + // To draw background use the background colour in wxDataViewItemAttr + virtual void RenderBackground(wxDC* dc, const wxRect& rect); + // Prepare DC to use attributes and call Render(). void WXCallRender(wxRect rect, wxDC *dc, int state); @@ -322,8 +337,8 @@ public: wxDataViewCellMode mode = wxDATAVIEW_CELL_EDITABLE, int alignment = wxDVR_DEFAULT_ALIGNMENT ); virtual bool HasEditorCtrl() const { return true; } - virtual wxControl* CreateEditorCtrl( wxWindow *parent, wxRect labelRect, const wxVariant &value ); - virtual bool GetValueFromEditorCtrl( wxControl* editor, wxVariant &value ); + virtual wxWindow* CreateEditorCtrl( wxWindow *parent, wxRect labelRect, const wxVariant &value ); + virtual bool GetValueFromEditorCtrl( wxWindow* editor, wxVariant &value ); virtual bool Render( wxRect rect, wxDC *dc, int state ); virtual wxSize GetSize() const; virtual bool SetValue( const wxVariant &value ); @@ -347,8 +362,8 @@ public: wxDataViewCellMode mode = wxDATAVIEW_CELL_EDITABLE, int alignment = wxDVR_DEFAULT_ALIGNMENT ); virtual bool HasEditorCtrl() const { return true; } - virtual wxControl* CreateEditorCtrl( wxWindow *parent, wxRect labelRect, const wxVariant &value ); - virtual bool GetValueFromEditorCtrl( wxControl* editor, wxVariant &value ); + virtual wxWindow* CreateEditorCtrl( wxWindow *parent, wxRect labelRect, const wxVariant &value ); + virtual bool GetValueFromEditorCtrl( wxWindow* editor, wxVariant &value ); virtual bool Render( wxRect rect, wxDC *dc, int state ); virtual wxSize GetSize() const; virtual bool SetValue( const wxVariant &value ); @@ -373,8 +388,8 @@ public: wxDataViewCellMode mode = wxDATAVIEW_CELL_EDITABLE, int alignment = wxDVR_DEFAULT_ALIGNMENT ); - virtual wxControl* CreateEditorCtrl( wxWindow *parent, wxRect labelRect, const wxVariant &value ); - virtual bool GetValueFromEditorCtrl( wxControl* editor, wxVariant &value ); + virtual wxWindow* CreateEditorCtrl( wxWindow *parent, wxRect labelRect, const wxVariant &value ); + virtual bool GetValueFromEditorCtrl( wxWindow* editor, wxVariant &value ); virtual bool SetValue( const wxVariant &value ); virtual bool GetValue( wxVariant &value ) const; @@ -383,6 +398,37 @@ public: #endif // generic or Carbon versions +#if defined(wxHAS_GENERIC_DATAVIEWCTRL) || defined(__WXGTK__) + +// ---------------------------------------------------------------------------- +// wxDataViewDateRenderer +// ---------------------------------------------------------------------------- + +#if wxUSE_DATEPICKCTRL +class WXDLLIMPEXP_ADV wxDataViewDateRenderer: public wxDataViewCustomRenderer +{ +public: + wxDataViewDateRenderer(const wxString &varianttype = wxT("datetime"), + wxDataViewCellMode mode = wxDATAVIEW_CELL_EDITABLE, + int align = wxDVR_DEFAULT_ALIGNMENT); + + virtual bool HasEditorCtrl() const { return true; } + virtual wxWindow *CreateEditorCtrl(wxWindow *parent, wxRect labelRect, const wxVariant &value); + virtual bool GetValueFromEditorCtrl(wxWindow* editor, wxVariant &value); + virtual bool SetValue(const wxVariant &value); + virtual bool GetValue(wxVariant& value) const; + virtual bool Render( wxRect cell, wxDC *dc, int state ); + virtual wxSize GetSize() const; + +private: + wxDateTime m_date; +}; +#else // !wxUSE_DATEPICKCTRL +typedef wxDataViewTextRenderer wxDataViewDateRenderer; +#endif + +#endif // generic or GTK+ versions + // this class is obsolete, its functionality was merged in // wxDataViewTextRenderer itself now, don't use it any more #define wxDataViewTextRendererAttr wxDataViewTextRenderer diff --git a/Externals/wxWidgets3/include/wx/dynarray.h b/Externals/wxWidgets3/include/wx/dynarray.h index 5a1e932668..09237e0a77 100644 --- a/Externals/wxWidgets3/include/wx/dynarray.h +++ b/Externals/wxWidgets3/include/wx/dynarray.h @@ -4,7 +4,7 @@ // Author: Vadim Zeitlin // Modified by: // Created: 12.09.97 -// RCS-ID: $Id: dynarray.h 56600 2008-10-30 15:57:18Z VZ $ +// RCS-ID: $Id: dynarray.h 69688 2011-11-05 15:20:32Z VS $ // Copyright: (c) 1998 Vadim Zeitlin // Licence: wxWindows licence /////////////////////////////////////////////////////////////////////////////// @@ -14,7 +14,7 @@ #include "wx/defs.h" -#if wxUSE_STL +#if wxUSE_STD_CONTAINERS #include "wx/beforestd.h" #include #include @@ -81,7 +81,7 @@ typedef int (wxCMPFUNC_CONV *CMPFUNC)(const void* pItem1, const void* pItem2); // you cast "SomeArray *" as "BaseArray *" and then delete it) // ---------------------------------------------------------------------------- -#if wxUSE_STL +#if wxUSE_STD_CONTAINERS template class wxArray_SortFunction @@ -151,7 +151,7 @@ public: \ e = rend(); \ for ( const_reverse_iterator i = b; i != e; ++i ) \ if ( *i == item ) \ - return (int)(i - b); \ + return (int)(e - i - 1); \ } \ else \ { \ @@ -203,12 +203,12 @@ public: \ } \ } -#else // if !wxUSE_STL +#else // if !wxUSE_STD_CONTAINERS #define _WX_DECLARE_BASEARRAY(T, name, classexp) \ classexp name \ { \ - typedef CMPFUNC SCMPFUNC; /* for compatibility wuth wxUSE_STL */ \ + typedef CMPFUNC SCMPFUNC; /* for compatibility wuth wxUSE_STD_CONTAINERS */ \ public: \ name(); \ name(const name& array); \ @@ -307,7 +307,7 @@ private: \ T *m_pItems; \ } -#endif // !wxUSE_STL +#endif // !wxUSE_STD_CONTAINERS // ============================================================================ // The private helper macros containing the core of the array classes @@ -325,7 +325,7 @@ private: \ // _WX_DEFINE_TYPEARRAY: array for simple types // ---------------------------------------------------------------------------- -#if wxUSE_STL +#if wxUSE_STD_CONTAINERS // in STL case we don't need the entire base arrays hack as standard container // don't suffer from alignment/storage problems as our home-grown do @@ -335,7 +335,7 @@ private: \ #define _WX_DEFINE_TYPEARRAY_PTR(T, name, base, classexp) \ _WX_DEFINE_TYPEARRAY(T, name, base, classexp) -#else // if !wxUSE_STL +#else // if !wxUSE_STD_CONTAINERS // common declaration used by both _WX_DEFINE_TYPEARRAY and // _WX_DEFINE_TYPEARRAY_PTR @@ -505,7 +505,7 @@ public: \ #define _WX_DEFINE_TYPEARRAY_PTR(T, name, base, classexp) \ _WX_DEFINE_TYPEARRAY_HELPER(T, name, base, classexp, _WX_PTROP_NONE) -#endif // !wxUSE_STL +#endif // !wxUSE_STD_CONTAINERS // ---------------------------------------------------------------------------- // _WX_DEFINE_SORTED_TYPEARRAY: sorted array for simple data types @@ -546,6 +546,8 @@ public: \ \ size_t Add(T lItem) \ { return base::Add(lItem, (CMPFUNC)m_fnCompare); } \ + void push_back(T lItem) \ + { Add(lItem); } \ \ void RemoveAt(size_t uiIndex, size_t nRemove = 1) \ { base::erase(begin() + uiIndex, begin() + uiIndex + nRemove); } \ @@ -636,7 +638,7 @@ private: \ // that wants to export a wxArray daubed with your own import/export goo. // // Finally, you can define the macro below as something special to modify the -// arrays defined by a simple WX_FOO_ARRAY as well. By default is is empty. +// arrays defined by a simple WX_FOO_ARRAY as well. By default is empty. #define wxARRAY_DEFAULT_EXPORT // ---------------------------------------------------------------------------- diff --git a/Externals/wxWidgets3/include/wx/dynlib.h b/Externals/wxWidgets3/include/wx/dynlib.h index 687794221d..4e4e411dbc 100644 --- a/Externals/wxWidgets3/include/wx/dynlib.h +++ b/Externals/wxWidgets3/include/wx/dynlib.h @@ -4,7 +4,7 @@ // Author: Guilhem Lavaux, Vadim Zeitlin, Vaclav Slavik // Modified by: // Created: 20/07/98 -// RCS-ID: $Id: dynlib.h 64139 2010-04-25 12:07:37Z VS $ +// RCS-ID: $Id: dynlib.h 70796 2012-03-04 00:29:31Z VZ $ // Copyright: (c) 1998 Guilhem Lavaux // Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// @@ -123,14 +123,14 @@ enum wxPluginCategory #define wxDL_INIT_FUNC(pfx, name, dynlib) \ pfx ## name = (name ## _t)(dynlib).RawGetSymbol(#name) -#ifdef __WXMSW__ +#ifdef __WINDOWS__ // same as wxDL_INIT_FUNC() but appends 'A' or 'W' to the function name, see // wxDynamicLibrary::GetSymbolAorW() #define wxDL_INIT_FUNC_AW(pfx, name, dynlib) \ pfx ## name = (name ## _t)(dynlib).GetSymbolAorW(#name) -#endif // __WXMSW__ +#endif // __WINDOWS__ // the following macros can be used to redirect a whole library to a class and // check at run-time if the library is present and contains all required @@ -304,7 +304,7 @@ public: #endif } -#ifdef __WXMSW__ +#ifdef __WINDOWS__ // this function is useful for loading functions from the standard Windows // DLLs: such functions have an 'A' (in ANSI build) or 'W' (in Unicode, or // wide character build) suffix if they take string parameters @@ -326,7 +326,7 @@ public: { return RawGetSymbolAorW(m_handle, name); } -#endif // __WXMSW__ +#endif // __WINDOWS__ // return all modules/shared libraries in the address space of this process // @@ -349,7 +349,7 @@ public: static wxString GetPluginsDirectory(); -#ifdef __WXMSW__ +#ifdef __WINDOWS__ // return the handle (HMODULE/HINSTANCE) of the DLL with the given name // and/or containing the specified address: for XP and later systems only // the address is used and the name is ignored but for the previous systems @@ -360,7 +360,7 @@ public: // need to be freed using FreeLibrary() but it also means that it can // become invalid if the DLL is unloaded static WXHMODULE MSWGetModuleHandle(const char *name, void *addr); -#endif // __WXMSW__ +#endif // __WINDOWS__ protected: // common part of GetSymbol() and HasSymbol() @@ -383,7 +383,7 @@ protected: wxDECLARE_NO_COPY_CLASS(wxDynamicLibrary); }; -#ifdef __WXMSW__ +#ifdef __WINDOWS__ // ---------------------------------------------------------------------------- // wxLoadedDLL is a MSW-only internal helper class allowing to dynamically bind @@ -404,7 +404,7 @@ public: } }; -#endif // __WXMSW__ +#endif // __WINDOWS__ // ---------------------------------------------------------------------------- // Interesting defines diff --git a/Externals/wxWidgets3/include/wx/encinfo.h b/Externals/wxWidgets3/include/wx/encinfo.h index 2b9b1896ab..bbe7229723 100644 --- a/Externals/wxWidgets3/include/wx/encinfo.h +++ b/Externals/wxWidgets3/include/wx/encinfo.h @@ -4,7 +4,7 @@ // Author: Vadim Zeitlin // Modified by: // Created: 19.09.2003 (extracted from wx/fontenc.h) -// RCS-ID: $Id: encinfo.h 52834 2008-03-26 15:06:00Z FM $ +// RCS-ID: $Id: encinfo.h 70353 2012-01-15 14:46:41Z VZ $ // Copyright: (c) 2003 Vadim Zeitlin // Licence: wxWindows licence /////////////////////////////////////////////////////////////////////////////// @@ -35,7 +35,6 @@ struct WXDLLIMPEXP_CORE wxNativeEncodingInfo { wxString facename; // may be empty meaning "any" -#ifndef __WXPALMOS__ wxFontEncoding encoding; // so that we know what this struct represents #if defined(__WXMSW__) || \ @@ -55,12 +54,9 @@ struct WXDLLIMPEXP_CORE wxNativeEncodingInfo xencoding; #elif defined(wxHAS_UTF8_FONTS) // ports using UTF-8 for text don't need encoding information for fonts -#elif defined(__WXMGL__) - int mglEncoding; #else #error "Unsupported toolkit" #endif -#endif // !__WXPALMOS__ // this struct is saved in config by wxFontMapper, so it should know to // serialise itself (implemented in platform-specific code) bool FromString(const wxString& s); diff --git a/Externals/wxWidgets3/include/wx/event.h b/Externals/wxWidgets3/include/wx/event.h index b08e545365..19610b0f18 100644 --- a/Externals/wxWidgets3/include/wx/event.h +++ b/Externals/wxWidgets3/include/wx/event.h @@ -4,7 +4,7 @@ // Author: Julian Smart // Modified by: // Created: 01/02/97 -// RCS-ID: $Id: event.h 66209 2010-11-19 07:51:15Z RD $ +// RCS-ID: $Id: event.h 70703 2012-02-26 20:24:25Z VZ $ // Copyright: (c) wxWidgets team // Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// @@ -39,6 +39,7 @@ class WXDLLIMPEXP_FWD_BASE wxList; class WXDLLIMPEXP_FWD_BASE wxEvent; +class WXDLLIMPEXP_FWD_BASE wxEventFilter; #if wxUSE_GUI class WXDLLIMPEXP_FWD_CORE wxDC; class WXDLLIMPEXP_FWD_CORE wxMenu; @@ -224,10 +225,13 @@ public: const wxObjectEventFunctor &other = static_cast< const wxObjectEventFunctor & >( functor ); - // FIXME-VC6: amazing but true: replacing "method == NULL" here - // with "!method" makes VC6 crash with an ICE in DLL build (only!) + // FIXME-VC6: amazing but true: replacing "m_method == 0" here + // with "!m_method" makes VC6 crash with an ICE in DLL build (only!) + // Also notice that using "NULL" instead of "0" results in warnings + // about "using NULL in arithmetics" from arm-linux-androideabi-g++ + // 4.4.3 used for wxAndroid build. - return ( m_method == other.m_method || other.m_method == NULL ) && + return ( m_method == other.m_method || other.m_method == 0 ) && ( m_handler == other.m_handler || other.m_handler == NULL ); } else @@ -615,8 +619,9 @@ extern WXDLLIMPEXP_BASE const wxEventType wxEVT_FIRST; extern WXDLLIMPEXP_BASE const wxEventType wxEVT_USER_FIRST; // Need events declared to do this +class WXDLLIMPEXP_FWD_BASE wxIdleEvent; +class WXDLLIMPEXP_FWD_BASE wxThreadEvent; class WXDLLIMPEXP_FWD_CORE wxCommandEvent; -class WXDLLIMPEXP_FWD_CORE wxThreadEvent; class WXDLLIMPEXP_FWD_CORE wxMouseEvent; class WXDLLIMPEXP_FWD_CORE wxFocusEvent; class WXDLLIMPEXP_FWD_CORE wxChildFocusEvent; @@ -649,7 +654,6 @@ class WXDLLIMPEXP_FWD_CORE wxPaletteChangedEvent; class WXDLLIMPEXP_FWD_CORE wxJoystickEvent; class WXDLLIMPEXP_FWD_CORE wxDropFilesEvent; class WXDLLIMPEXP_FWD_CORE wxInitDialogEvent; -class WXDLLIMPEXP_FWD_CORE wxIdleEvent; class WXDLLIMPEXP_FWD_CORE wxUpdateUIEvent; class WXDLLIMPEXP_FWD_CORE wxClipboardTextEvent; class WXDLLIMPEXP_FWD_CORE wxHelpEvent; @@ -678,7 +682,7 @@ wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE, wxEVT_COMMAND_COMBOBOX_DROPDOWN, wxCo wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE, wxEVT_COMMAND_COMBOBOX_CLOSEUP, wxCommandEvent); // Thread events -wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE, wxEVT_COMMAND_THREAD, wxThreadEvent); +wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_BASE, wxEVT_THREAD, wxThreadEvent); // Mouse event types wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE, wxEVT_LEFT_DOWN, wxMouseEvent); @@ -713,6 +717,10 @@ wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE, wxEVT_KEY_UP, wxKeyEvent); #if wxUSE_HOTKEY wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE, wxEVT_HOTKEY, wxKeyEvent); #endif +// This is a private event used by wxMSW code only and subject to change or +// disappear in the future. Don't use. +wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE, wxEVT_AFTER_CHAR, wxKeyEvent); + // Set cursor event wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE, wxEVT_SET_CURSOR, wxSetCursorEvent); @@ -1112,6 +1120,148 @@ private: wxDECLARE_NO_COPY_CLASS(wxEventProcessInHandlerOnly); }; + +class WXDLLIMPEXP_BASE wxEventBasicPayloadMixin +{ +public: + wxEventBasicPayloadMixin() + : m_commandInt(0), + m_extraLong(0) + { + } + + void SetString(const wxString& s) { m_cmdString = s; } + const wxString& GetString() const { return m_cmdString; } + + void SetInt(int i) { m_commandInt = i; } + int GetInt() const { return m_commandInt; } + + void SetExtraLong(long extraLong) { m_extraLong = extraLong; } + long GetExtraLong() const { return m_extraLong; } + +protected: + // Note: these variables have "cmd" or "command" in their name for backward compatibility: + // they used to be part of wxCommandEvent, not this mixin. + wxString m_cmdString; // String event argument + int m_commandInt; + long m_extraLong; // Additional information (e.g. select/deselect) + + wxDECLARE_NO_ASSIGN_CLASS(wxEventBasicPayloadMixin); +}; + +class WXDLLIMPEXP_BASE wxEventAnyPayloadMixin : public wxEventBasicPayloadMixin +{ +public: + wxEventAnyPayloadMixin() : wxEventBasicPayloadMixin() {} + +#if wxUSE_ANY && (!defined(__VISUALC__) || wxCHECK_VISUALC_VERSION(7)) + template + void SetPayload(const T& payload) + { + m_payload = payload; + } + + template + T GetPayload() const + { + return m_payload.As(); + } + +protected: + wxAny m_payload; +#endif // wxUSE_ANY && (!defined(__VISUALC__) || wxCHECK_VISUALC_VERSION(7)) + + wxDECLARE_NO_ASSIGN_CLASS(wxEventBasicPayloadMixin); +}; + + +// Idle event +/* + wxEVT_IDLE + */ + +// Whether to always send idle events to windows, or +// to only send update events to those with the +// wxWS_EX_PROCESS_IDLE style. + +enum wxIdleMode +{ + // Send idle events to all windows + wxIDLE_PROCESS_ALL, + + // Send idle events to windows that have + // the wxWS_EX_PROCESS_IDLE flag specified + wxIDLE_PROCESS_SPECIFIED +}; + +class WXDLLIMPEXP_BASE wxIdleEvent : public wxEvent +{ +public: + wxIdleEvent() + : wxEvent(0, wxEVT_IDLE), + m_requestMore(false) + { } + wxIdleEvent(const wxIdleEvent& event) + : wxEvent(event), + m_requestMore(event.m_requestMore) + { } + + void RequestMore(bool needMore = true) { m_requestMore = needMore; } + bool MoreRequested() const { return m_requestMore; } + + virtual wxEvent *Clone() const { return new wxIdleEvent(*this); } + + // Specify how wxWidgets will send idle events: to + // all windows, or only to those which specify that they + // will process the events. + static void SetMode(wxIdleMode mode) { sm_idleMode = mode; } + + // Returns the idle event mode + static wxIdleMode GetMode() { return sm_idleMode; } + +protected: + bool m_requestMore; + static wxIdleMode sm_idleMode; + +private: + DECLARE_DYNAMIC_CLASS_NO_ASSIGN(wxIdleEvent) +}; + + +// Thread event + +class WXDLLIMPEXP_BASE wxThreadEvent : public wxEvent, + public wxEventAnyPayloadMixin +{ +public: + wxThreadEvent(wxEventType eventType = wxEVT_THREAD, int id = wxID_ANY) + : wxEvent(id, eventType) + { } + + wxThreadEvent(const wxThreadEvent& event) + : wxEvent(event), + wxEventAnyPayloadMixin(event) + { + // make sure our string member (which uses COW, aka refcounting) is not + // shared by other wxString instances: + SetString(GetString().c_str()); + } + + virtual wxEvent *Clone() const + { + return new wxThreadEvent(*this); + } + + // this is important to avoid that calling wxEventLoopBase::YieldFor thread events + // gets processed when this is unwanted: + virtual wxEventCategory GetEventCategory() const + { return wxEVT_CATEGORY_THREAD; } + +private: + DECLARE_DYNAMIC_CLASS_NO_ASSIGN(wxThreadEvent) +}; + + #if wxUSE_GUI @@ -1134,16 +1284,15 @@ private: wxEVT_COMMAND_TOGGLEBUTTON_CLICKED */ -class WXDLLIMPEXP_CORE wxCommandEvent : public wxEvent +class WXDLLIMPEXP_CORE wxCommandEvent : public wxEvent, + public wxEventBasicPayloadMixin { public: wxCommandEvent(wxEventType commandType = wxEVT_NULL, int winid = 0); wxCommandEvent(const wxCommandEvent& event) : wxEvent(event), - m_cmdString(event.m_cmdString), - m_commandInt(event.m_commandInt), - m_extraLong(event.m_extraLong), + wxEventBasicPayloadMixin(event), m_clientData(event.m_clientData), m_clientObject(event.m_clientObject) { } @@ -1156,32 +1305,23 @@ public: void SetClientObject(wxClientData* clientObject) { m_clientObject = clientObject; } wxClientData *GetClientObject() const { return m_clientObject; } + // Note: this shadows wxEventBasicPayloadMixin::GetString(), because it does some + // GUI-specific hacks + wxString GetString() const; + // Get listbox selection if single-choice int GetSelection() const { return m_commandInt; } - // Set/Get listbox/choice selection string - void SetString(const wxString& s) { m_cmdString = s; } - wxString GetString() const; - // Get checkbox value bool IsChecked() const { return m_commandInt != 0; } // true if the listbox event was a selection. bool IsSelection() const { return (m_extraLong != 0); } - void SetExtraLong(long extraLong) { m_extraLong = extraLong; } - long GetExtraLong() const { return m_extraLong; } - - void SetInt(int i) { m_commandInt = i; } - int GetInt() const { return m_commandInt; } - virtual wxEvent *Clone() const { return new wxCommandEvent(*this); } virtual wxEventCategory GetEventCategory() const { return wxEVT_CATEGORY_USER_INPUT; } protected: - wxString m_cmdString; // String event argument - int m_commandInt; - long m_extraLong; // Additional information (e.g. select/deselect) void* m_clientData; // Arbitrary client data wxClientData* m_clientObject; // Arbitrary client object @@ -1221,60 +1361,6 @@ private: }; -// Thread event - -class WXDLLIMPEXP_CORE wxThreadEvent : public wxCommandEvent -{ -public: - wxThreadEvent(wxEventType eventType = wxEVT_COMMAND_THREAD, int id = wxID_ANY) - : wxCommandEvent(eventType, id) - { } - - wxThreadEvent(const wxThreadEvent& event) - : wxCommandEvent(event) - { - // make sure our string member (which uses COW, aka refcounting) is not - // shared by other wxString instances: - SetString(GetString().c_str()); - -#if wxUSE_ANY && (!defined(__VISUALC__) || wxCHECK_VISUALC_VERSION(7)) - m_payload = event.m_payload; -#endif - } - - virtual wxEvent *Clone() const - { - return new wxThreadEvent(*this); - } - - // this is important to avoid that calling wxEventLoopBase::YieldFor thread events - // gets processed when this is unwanted: - virtual wxEventCategory GetEventCategory() const - { return wxEVT_CATEGORY_THREAD; } - -#if wxUSE_ANY && (!defined(__VISUALC__) || wxCHECK_VISUALC_VERSION(7)) - template - void SetPayload(const T& payload) - { - m_payload = payload; - } - - template - T GetPayload() const - { - return m_payload.As(); - } - -protected: - wxAny m_payload; -#endif // wxUSE_ANY && (!defined(__VISUALC__) || wxCHECK_VISUALC_VERSION(7)) - -private: - DECLARE_DYNAMIC_CLASS_NO_ASSIGN(wxThreadEvent) -}; - - - // Scroll event class, derived form wxCommandEvent. wxScrollEvents are // sent by wxSlider and wxScrollBar. /* @@ -1360,18 +1446,6 @@ private: wxEVT_LEFT_DCLICK wxEVT_MIDDLE_DCLICK wxEVT_RIGHT_DCLICK - wxEVT_NC_LEFT_DOWN - wxEVT_NC_LEFT_UP, - wxEVT_NC_MIDDLE_DOWN, - wxEVT_NC_MIDDLE_UP, - wxEVT_NC_RIGHT_DOWN, - wxEVT_NC_RIGHT_UP, - wxEVT_NC_MOTION, - wxEVT_NC_ENTER_WINDOW, - wxEVT_NC_LEAVE_WINDOW, - wxEVT_NC_LEFT_DCLICK, - wxEVT_NC_MIDDLE_DCLICK, - wxEVT_NC_RIGHT_DCLICK, */ class WXDLLIMPEXP_CORE wxMouseEvent : public wxEvent, @@ -1420,8 +1494,8 @@ public: bool LeftDClick() const { return (m_eventType == wxEVT_LEFT_DCLICK); } bool MiddleDClick() const { return (m_eventType == wxEVT_MIDDLE_DCLICK); } bool RightDClick() const { return (m_eventType == wxEVT_RIGHT_DCLICK); } - bool Aux1DClick() const { return (m_eventType == wxEVT_AUX1_UP); } - bool Aux2DClick() const { return (m_eventType == wxEVT_AUX2_UP); } + bool Aux1DClick() const { return (m_eventType == wxEVT_AUX1_DCLICK); } + bool Aux2DClick() const { return (m_eventType == wxEVT_AUX2_DCLICK); } // True if a button is down and the mouse is moving bool Dragging() const @@ -1524,7 +1598,7 @@ public: void SetCursor(const wxCursor& cursor) { m_cursor = cursor; } const wxCursor& GetCursor() const { return m_cursor; } - bool HasCursor() const { return m_cursor.Ok(); } + bool HasCursor() const { return m_cursor.IsOk(); } virtual wxEvent *Clone() const { return new wxSetCursorEvent(*this); } @@ -1578,7 +1652,12 @@ class WXDLLIMPEXP_CORE wxKeyEvent : public wxEvent, { public: wxKeyEvent(wxEventType keyType = wxEVT_NULL); + + // Normal copy ctor and a ctor creating a new event for the same key as the + // given one but a different event type (this is used in implementation + // code only, do not use outside of the library). wxKeyEvent(const wxKeyEvent& evt); + wxKeyEvent(wxEventType eventType, const wxKeyEvent& evt); // get the key code: an ASCII7 char or an element of wxKeyCode enum int GetKeyCode() const { return (int)m_keyCode; } @@ -1619,6 +1698,15 @@ public: // Get Y position wxCoord GetY() const { return m_y; } + // Can be called from wxEVT_CHAR_HOOK handler to allow generation of normal + // key events even though the event had been handled (by default they would + // not be generated in this case). + void DoAllowNextEvent() { m_allowNext = true; } + + // Return the value of the "allow next" flag, for internal use only. + bool IsNextEventAllowed() const { return m_allowNext; } + + virtual wxEvent *Clone() const { return new wxKeyEvent(*this); } virtual wxEventCategory GetEventCategory() const { return wxEVT_CATEGORY_USER_INPUT; } @@ -1634,16 +1722,7 @@ public: // implicitly defined operator=() so need to do it this way: *static_cast(this) = evt; - m_x = evt.m_x; - m_y = evt.m_y; - - m_keyCode = evt.m_keyCode; - - m_rawCode = evt.m_rawCode; - m_rawFlags = evt.m_rawFlags; -#if wxUSE_UNICODE - m_uniChar = evt.m_uniChar; -#endif + DoAssignMembers(evt); } return *this; } @@ -1665,6 +1744,37 @@ public: wxUint32 m_rawFlags; private: + // Set the event to propagate if necessary, i.e. if it's of wxEVT_CHAR_HOOK + // type. This is used by all ctors. + void InitPropagation() + { + if ( m_eventType == wxEVT_CHAR_HOOK ) + m_propagationLevel = wxEVENT_PROPAGATE_MAX; + + m_allowNext = false; + } + + // Copy only the event data present in this class, this is used by + // AssignKeyData() and copy ctor. + void DoAssignMembers(const wxKeyEvent& evt) + { + m_x = evt.m_x; + m_y = evt.m_y; + + m_keyCode = evt.m_keyCode; + + m_rawCode = evt.m_rawCode; + m_rawFlags = evt.m_rawFlags; +#if wxUSE_UNICODE + m_uniChar = evt.m_uniChar; +#endif + } + + // If this flag is true, the normal key events should still be generated + // even if wxEVT_CHAR_HOOK had been handled. By default it is false as + // handling wxEVT_CHAR_HOOK suppresses all the subsequent events. + bool m_allowNext; + DECLARE_DYNAMIC_CLASS(wxKeyEvent) }; @@ -1749,7 +1859,6 @@ private: /* wxEVT_PAINT wxEVT_NC_PAINT - wxEVT_PAINT_ICON */ #if wxDEBUG_LEVEL && (defined(__WXMSW__) || defined(__WXPM__)) @@ -2722,59 +2831,6 @@ private: DECLARE_DYNAMIC_CLASS_NO_ASSIGN(wxContextMenuEvent) }; -#endif // wxUSE_GUI - -// Idle event -/* - wxEVT_IDLE - */ - -// Whether to always send idle events to windows, or -// to only send update events to those with the -// wxWS_EX_PROCESS_IDLE style. - -enum wxIdleMode -{ - // Send idle events to all windows - wxIDLE_PROCESS_ALL, - - // Send idle events to windows that have - // the wxWS_EX_PROCESS_IDLE flag specified - wxIDLE_PROCESS_SPECIFIED -}; - -class WXDLLIMPEXP_BASE wxIdleEvent : public wxEvent -{ -public: - wxIdleEvent() - : wxEvent(0, wxEVT_IDLE), - m_requestMore(false) - { } - wxIdleEvent(const wxIdleEvent& event) - : wxEvent(event), - m_requestMore(event.m_requestMore) - { } - - void RequestMore(bool needMore = true) { m_requestMore = needMore; } - bool MoreRequested() const { return m_requestMore; } - - virtual wxEvent *Clone() const { return new wxIdleEvent(*this); } - - // Specify how wxWidgets will send idle events: to - // all windows, or only to those which specify that they - // will process the events. - static void SetMode(wxIdleMode mode) { sm_idleMode = mode; } - - // Returns the idle event mode - static wxIdleMode GetMode() { return sm_idleMode; } - -protected: - bool m_requestMore; - static wxIdleMode sm_idleMode; - -private: - DECLARE_DYNAMIC_CLASS_NO_ASSIGN(wxIdleEvent) -}; /* TODO wxEVT_MOUSE_CAPTURE_CHANGED, @@ -2786,6 +2842,7 @@ private: wxEVT_COMPARE_ITEM */ +#endif // wxUSE_GUI // ============================================================================ @@ -2983,6 +3040,19 @@ public: bool IsUnlinked() const; + // Global event filters + // -------------------- + + // Add an event filter whose FilterEvent() method will be called for each + // and every event processed by wxWidgets. The filters are called in LIFO + // order and wxApp is registered as an event filter by default. The pointer + // must remain valid until it's removed with RemoveFilter() and is not + // deleted by wxEvtHandler. + static void AddFilter(wxEventFilter* filter); + + // Remove a filter previously installed with AddFilter(). + static void RemoveFilter(wxEventFilter* filter); + // Event queuing and processing // ---------------------------- @@ -3269,7 +3339,7 @@ protected: // base class implementation passes the event to wxTheApp virtual bool TryAfter(wxEvent& event); -#ifdef WXWIN_COMPATIBILITY_2_8 +#if WXWIN_COMPATIBILITY_2_8 // deprecated method: override TryBefore() instead of this one wxDEPRECATED_BUT_USED_INTERNALLY_INLINE( virtual bool TryValidator(wxEvent& WXUNUSED(event)), return false; ) @@ -3330,6 +3400,9 @@ private: // try to process events in all handlers chained to this one bool DoTryChain(wxEvent& event); + // Head of the event filter linked list. + static wxEventFilter* ms_filterList; + DECLARE_DYNAMIC_CLASS_NO_COPY(wxEvtHandler) }; @@ -3418,11 +3491,14 @@ inline void wxQueueEvent(wxEvtHandler *dest, wxEvent *event) typedef void (wxEvtHandler::*wxEventFunction)(wxEvent&); typedef void (wxEvtHandler::*wxIdleEventFunction)(wxIdleEvent&); +typedef void (wxEvtHandler::*wxThreadEventFunction)(wxThreadEvent&); #define wxEventHandler(func) \ wxEVENT_HANDLER_CAST(wxEventFunction, func) #define wxIdleEventHandler(func) \ wxEVENT_HANDLER_CAST(wxIdleEventFunction, func) +#define wxThreadEventHandler(func) \ + wxEVENT_HANDLER_CAST(wxThreadEventFunction, func) #if wxUSE_GUI @@ -3451,7 +3527,6 @@ protected: }; typedef void (wxEvtHandler::*wxCommandEventFunction)(wxCommandEvent&); -typedef void (wxEvtHandler::*wxThreadEventFunction)(wxThreadEvent&); typedef void (wxEvtHandler::*wxScrollEventFunction)(wxScrollEvent&); typedef void (wxEvtHandler::*wxScrollWinEventFunction)(wxScrollWinEvent&); typedef void (wxEvtHandler::*wxSizeEventFunction)(wxSizeEvent&); @@ -3491,8 +3566,6 @@ typedef void (wxEvtHandler::*wxClipboardTextEventFunction)(wxClipboardTextEvent& #define wxCommandEventHandler(func) \ wxEVENT_HANDLER_CAST(wxCommandEventFunction, func) -#define wxThreadEventHandler(func) \ - wxEVENT_HANDLER_CAST(wxThreadEventFunction, func) #define wxScrollEventHandler(func) \ wxEVENT_HANDLER_CAST(wxScrollEventFunction, func) #define wxScrollWinEventHandler(func) \ @@ -3976,7 +4049,9 @@ typedef void (wxEvtHandler::*wxClipboardTextEventFunction)(wxClipboardTextEvent& #define EVT_TEXT_PASTE(winid, func) wx__DECLARE_EVT1(wxEVT_COMMAND_TEXT_PASTE, winid, wxClipboardTextEventHandler(func)) // Thread events -#define EVT_THREAD(id, func) wx__DECLARE_EVT1(wxEVT_COMMAND_THREAD, id, wxThreadEventHandler(func)) +#define EVT_THREAD(id, func) wx__DECLARE_EVT1(wxEVT_THREAD, id, wxThreadEventHandler(func)) +// alias for backward compatibility with 2.9.0: +#define wxEVT_COMMAND_THREAD wxEVT_THREAD // ---------------------------------------------------------------------------- // Helper functions diff --git a/Externals/wxWidgets3/include/wx/eventfilter.h b/Externals/wxWidgets3/include/wx/eventfilter.h new file mode 100644 index 0000000000..5a110cb7c5 --- /dev/null +++ b/Externals/wxWidgets3/include/wx/eventfilter.h @@ -0,0 +1,72 @@ +/////////////////////////////////////////////////////////////////////////////// +// Name: wx/eventfilter.h +// Purpose: wxEventFilter class declaration. +// Author: Vadim Zeitlin +// Created: 2011-11-21 +// RCS-ID: $Id: eventfilter.h 70302 2012-01-09 14:04:25Z DS $ +// Copyright: (c) 2011 Vadim Zeitlin +// Licence: wxWindows licence +/////////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_EVENTFILTER_H_ +#define _WX_EVENTFILTER_H_ + +#include "wx/defs.h" + +class WXDLLIMPEXP_FWD_BASE wxEvent; +class WXDLLIMPEXP_FWD_BASE wxEvtHandler; + +// ---------------------------------------------------------------------------- +// wxEventFilter is used with wxEvtHandler::AddFilter() and ProcessEvent(). +// ---------------------------------------------------------------------------- + +class wxEventFilter +{ +public: + // Possible return values for FilterEvent(). + // + // Notice that the values of these enum elements are fixed due to backwards + // compatibility constraints. + enum + { + // Process event as usual. + Event_Skip = -1, + + // Don't process the event normally at all. + Event_Ignore = 0, + + // Event was already handled, don't process it normally. + Event_Processed = 1 + }; + + wxEventFilter() + { + m_next = NULL; + } + + virtual ~wxEventFilter() + { + wxASSERT_MSG( !m_next, "Forgot to call wxEvtHandler::RemoveFilter()?" ); + } + + // This method allows to filter all the events processed by the program, so + // you should try to return quickly from it to avoid slowing down the + // program to a crawl. + // + // Return value should be -1 to continue with the normal event processing, + // or true or false to stop further processing and pretend that the event + // had been already processed or won't be processed at all, respectively. + virtual int FilterEvent(wxEvent& event) = 0; + +private: + // Objects of this class are made to be stored in a linked list in + // wxEvtHandler so put the next node ponter directly in the class itself. + wxEventFilter* m_next; + + // And provide access to it for wxEvtHandler [only]. + friend class wxEvtHandler; + + wxDECLARE_NO_COPY_CLASS(wxEventFilter); +}; + +#endif // _WX_EVENTFILTER_H_ diff --git a/Externals/wxWidgets3/include/wx/evtloop.h b/Externals/wxWidgets3/include/wx/evtloop.h index ae45b8800a..97a3548d8e 100644 --- a/Externals/wxWidgets3/include/wx/evtloop.h +++ b/Externals/wxWidgets3/include/wx/evtloop.h @@ -4,7 +4,7 @@ // Author: Vadim Zeitlin // Modified by: // Created: 01.06.01 -// RCS-ID: $Id: evtloop.h 65057 2010-07-23 23:32:46Z VZ $ +// RCS-ID: $Id: evtloop.h 70345 2012-01-15 01:05:28Z VZ $ // Copyright: (c) 2001 Vadim Zeitlin // Licence: wxWindows licence /////////////////////////////////////////////////////////////////////////////// @@ -233,9 +233,7 @@ private: // integration with MFC) but currently this is not done for all ports yet (e.g. // wxX11) so fall back to the old wxGUIEventLoop definition below for them -#if defined(__WXPALMOS__) - #include "wx/palmos/evtloop.h" -#elif defined(__WXMSW__) +#if defined(__WXMSW__) // this header defines both console and GUI loops for MSW #include "wx/msw/evtloop.h" #elif defined(__WXOSX__) diff --git a/Externals/wxWidgets3/include/wx/evtloopsrc.h b/Externals/wxWidgets3/include/wx/evtloopsrc.h index 1851e30dd6..20d8770b76 100644 --- a/Externals/wxWidgets3/include/wx/evtloopsrc.h +++ b/Externals/wxWidgets3/include/wx/evtloopsrc.h @@ -3,7 +3,7 @@ // Purpose: declaration of wxEventLoopSource class // Author: Vadim Zeitlin // Created: 2009-10-21 -// RCS-ID: $Id: evtloopsrc.h 64140 2010-04-25 21:33:16Z FM $ +// RCS-ID: $Id: evtloopsrc.h 69559 2011-10-27 21:10:30Z VZ $ // Copyright: (c) 2009 Vadim Zeitlin // Licence: wxWindows licence /////////////////////////////////////////////////////////////////////////////// @@ -49,7 +49,7 @@ enum wxEVENT_SOURCE_EXCEPTION = 0x04, wxEVENT_SOURCE_ALL = wxEVENT_SOURCE_INPUT | wxEVENT_SOURCE_OUTPUT | - wxEVENT_SOURCE_EXCEPTION, + wxEVENT_SOURCE_EXCEPTION }; // wxEventLoopSource itself is an ABC and can't be created directly, currently diff --git a/Externals/wxWidgets3/include/wx/features.h b/Externals/wxWidgets3/include/wx/features.h index 66cabcba0d..0d8469917b 100644 --- a/Externals/wxWidgets3/include/wx/features.h +++ b/Externals/wxWidgets3/include/wx/features.h @@ -5,7 +5,7 @@ * Author: Vadim Zeitlin * Modified by: Ryan Norton (Converted to C) * Created: 18.03.02 -* RCS-ID: $Id: features.h 60526 2009-05-06 11:42:16Z VZ $ +* RCS-ID: $Id: features.h 69961 2011-12-08 15:58:45Z VZ $ * Copyright: (c) 2002 Vadim Zeitlin * Licence: wxWindows licence */ @@ -108,8 +108,16 @@ If this is defined, wxEvtHandler::Bind<>() is available (not all compilers have the required template support for this and in particular under Windows where only g++ and MSVC >= 7 currently support it. + + Recent Sun CC versions support this but perhaps older ones can compile this + code too, adjust the version check if this is the case (unfortunately we + can't easily test for the things used in wx/event.h in configure so we have + to maintain these checks manually). The same applies to xlC 7: perhaps + earlier versions can compile this code too but they were not tested. */ -#if wxCHECK_GCC_VERSION(3, 2) || wxCHECK_VISUALC_VERSION(7) +#if wxCHECK_GCC_VERSION(3, 2) || wxCHECK_VISUALC_VERSION(7) \ + || (defined(__SUNCC__) && __SUNCC__ >= 0x5100) \ + || (defined(__xlC__) && __xlC__ >= 0x700) #define wxHAS_EVENT_BIND #endif diff --git a/Externals/wxWidgets3/include/wx/filedlg.h b/Externals/wxWidgets3/include/wx/filedlg.h index e756cbcc6e..45178d2d43 100644 --- a/Externals/wxWidgets3/include/wx/filedlg.h +++ b/Externals/wxWidgets3/include/wx/filedlg.h @@ -5,7 +5,7 @@ // Modified by: // Created: 8/17/99 // Copyright: (c) Robert Roebling -// RCS-ID: $Id: filedlg.h 62722 2009-11-26 16:17:00Z VZ $ +// RCS-ID: $Id: filedlg.h 70345 2012-01-15 01:05:28Z VZ $ // Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// @@ -232,9 +232,6 @@ wxSaveFileSelector(const wxString& what, #include "wx/cocoa/filedlg.h" #elif defined(__WXPM__) #include "wx/os2/filedlg.h" -#elif defined(__WXPALMOS__) - #define wxHAS_GENERIC_FILEDIALOG - #include "wx/generic/filedlgg.h" #endif #endif // wxUSE_FILEDLG diff --git a/Externals/wxWidgets3/include/wx/filefn.h b/Externals/wxWidgets3/include/wx/filefn.h index 5172917416..ebd0c373c4 100644 --- a/Externals/wxWidgets3/include/wx/filefn.h +++ b/Externals/wxWidgets3/include/wx/filefn.h @@ -4,7 +4,7 @@ // Author: Julian Smart // Modified by: // Created: 29/01/98 -// RCS-ID: $Id: filefn.h 65057 2010-07-23 23:32:46Z VZ $ +// RCS-ID: $Id: filefn.h 70796 2012-03-04 00:29:31Z VZ $ // Copyright: (c) 1998 Julian Smart // Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// @@ -15,7 +15,6 @@ #include "wx/list.h" #include "wx/arrstr.h" -#ifndef __WXPALMOS5__ #ifdef __WXWINCE__ #include "wx/msw/wince/time.h" #include "wx/msw/private.h" @@ -40,7 +39,6 @@ #include #endif #endif -#endif // !__WXPALMOS5__ #ifdef __OS2__ // need to check for __OS2__ first since currently both @@ -85,11 +83,10 @@ #include #endif -#ifndef __WXPALMOS5__ #ifndef __WXWINCE__ #include // O_RDONLY &c #endif -#endif // !__WXPALMOS5__ + // ---------------------------------------------------------------------------- // constants // ---------------------------------------------------------------------------- @@ -115,8 +112,6 @@ typedef long off_t; #elif defined(__MWERKS__) && !defined(__INTEL__) && !defined(__MACH__) typedef long off_t; -#elif defined(__WXPALMOS5__) - typedef long off_t; #endif enum wxSeekMode @@ -205,7 +200,7 @@ enum wxPosixPermissions #define wxCRT_RmDir _wrmdir #define wxCRT_Stat _wstat #define wxStructStat struct _stat -#elif (defined(__WXMSW__) || defined(__OS2__)) && !defined(__WXPALMOS__) && \ +#elif (defined(__WINDOWS__) || defined(__OS2__)) && \ ( \ defined(__VISUALC__) || \ defined(__MINGW64__) || \ @@ -368,7 +363,13 @@ enum wxPosixPermissions #define wxCRT_MkDirA wxPOSIX_IDENT(mkdir) #define wxCRT_RmDirA wxPOSIX_IDENT(rmdir) #ifdef wxHAS_HUGE_FILES - #define wxCRT_StatA wxPOSIX_IDENT(stati64) + // MinGW-64 provides underscore-less versions of all file functions + // except for this one. + #ifdef __MINGW64__ + #define wxCRT_StatA _stati64 + #else + #define wxCRT_StatA wxPOSIX_IDENT(stati64) + #endif #else // Unfortunately Watcom is not consistent #if defined(__OS2__) && defined(__WATCOMC__) @@ -468,43 +469,6 @@ enum wxPosixPermissions // private defines, undefine so that nobody gets tempted to use #undef wxHAS_HUGE_FILES #undef wxHAS_HUGE_STDIO_FILES -#elif defined (__WXPALMOS__) - typedef off_t wxFileOffset; -#ifdef _LARGE_FILES - #define wxFileOffsetFmtSpec wxLongLongFmtSpec - wxCOMPILE_TIME_ASSERT( sizeof(off_t) == sizeof(wxLongLong_t), BadFileSizeType ); - // wxFile is present and supports large files - #ifdef wxUSE_FILE - #define wxHAS_LARGE_FILES - #endif - // wxFFile is present and supports large files - #if SIZEOF_LONG == 8 || defined HAVE_FSEEKO - #define wxHAS_LARGE_FFILES - #endif -#else - #define wxFileOffsetFmtSpec wxT("") -#endif - #define wxClose close - #define wxRead ::read - #define wxWrite ::write - #define wxLseek lseek - #define wxSeek lseek - #define wxFsync fsync - #define wxEof eof - - #define wxCRT_MkDir mkdir - #define wxCRT_RmDir rmdir - - #define wxTell(fd) lseek(fd, 0, SEEK_CUR) - - #define wxStructStat struct stat - - #define wxCRT_Open open - #define wxCRT_Stat svfs_stat - #define wxCRT_Lstat lstat - #define wxCRT_Access access - - #define wxHAS_NATIVE_LSTAT #else // Unix or Windows using unknown compiler, assume POSIX supported typedef off_t wxFileOffset; #ifdef HAVE_LARGEFILE_SUPPORT @@ -764,9 +728,6 @@ WXDLLIMPEXP_BASE bool wxIsExecutable(const wxString &path); // CYGWIN also uses UNIX settings #define wxFILE_SEP_PATH wxFILE_SEP_PATH_UNIX #define wxPATH_SEP wxPATH_SEP_UNIX -#elif defined(__WXPALMOS__) - #define wxFILE_SEP_PATH wxFILE_SEP_PATH_UNIX - #define wxPATH_SEP wxPATH_SEP_UNIX #elif defined(__MAC__) #define wxFILE_SEP_PATH wxFILE_SEP_PATH_MAC #define wxPATH_SEP wxPATH_SEP_MAC diff --git a/Externals/wxWidgets3/include/wx/filehistory.h b/Externals/wxWidgets3/include/wx/filehistory.h index a98668d6bd..83afeaa3ec 100644 --- a/Externals/wxWidgets3/include/wx/filehistory.h +++ b/Externals/wxWidgets3/include/wx/filehistory.h @@ -3,7 +3,7 @@ // Purpose: wxFileHistory class // Author: Julian Smart, Vaclav Slavik // Created: 2010-05-03 -// RCS-ID: $Id: filehistory.h 64240 2010-05-07 06:45:48Z VS $ +// RCS-ID: $Id: filehistory.h 70503 2012-02-03 17:27:13Z VZ $ // Copyright: (c) Julian Smart, Vaclav Slavik // Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// @@ -23,6 +23,7 @@ class WXDLLIMPEXP_FWD_CORE wxMenu; class WXDLLIMPEXP_FWD_BASE wxConfigBase; +class WXDLLIMPEXP_FWD_BASE wxFileName; // ---------------------------------------------------------------------------- // File history management @@ -79,6 +80,10 @@ private: // The ID of the first history menu item (Doesn't have to be wxID_FILE1) wxWindowID m_idBase; + // Normalize a file name to canonical form. We have a special function for + // this to ensure the same normalization is used everywhere. + static wxString NormalizeFileName(const wxFileName& filename); + wxDECLARE_NO_COPY_CLASS(wxFileHistoryBase); }; diff --git a/Externals/wxWidgets3/include/wx/filename.h b/Externals/wxWidgets3/include/wx/filename.h index ca89cf8ff7..e1454406b7 100644 --- a/Externals/wxWidgets3/include/wx/filename.h +++ b/Externals/wxWidgets3/include/wx/filename.h @@ -4,7 +4,7 @@ // Author: Robert Roebling, Vadim Zeitlin // Modified by: // Created: 28.12.00 -// RCS-ID: $Id: filename.h 63886 2010-04-06 22:51:11Z FM $ +// RCS-ID: $Id: filename.h 70796 2012-03-04 00:29:31Z VZ $ // Copyright: (c) 2000 Robert Roebling // Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// @@ -40,7 +40,7 @@ class WXDLLIMPEXP_FWD_BASE wxFFile; // this symbol is defined for the platforms where file systems use volumes in // paths -#if defined(__WXMSW__) || defined(__DOS__) || defined(__OS2__) +#if defined(__WINDOWS__) || defined(__DOS__) || defined(__OS2__) #define wxHAS_FILESYSTEM_VOLUMES #endif @@ -214,14 +214,20 @@ public: !m_ext.empty() || m_hasExt; } - // does the file with this name exists? + // does the file with this name exist? bool FileExists() const; static bool FileExists( const wxString &file ); - // does the directory with this name exists? + // does the directory with this name exist? bool DirExists() const; static bool DirExists( const wxString &dir ); + // does anything at all with this name (i.e. file, directory or some + // other file system object such as a device, socket, ...) exist? + bool Exists() const { return Exists(GetFullPath()); } + static bool Exists(const wxString& path); + + // checks on most common flags for files/directories; // more platform-specific features (like e.g. Unix permissions) are not // available in wxFileName diff --git a/Externals/wxWidgets3/include/wx/filepicker.h b/Externals/wxWidgets3/include/wx/filepicker.h index 949f6c650d..7796ac33b3 100644 --- a/Externals/wxWidgets3/include/wx/filepicker.h +++ b/Externals/wxWidgets3/include/wx/filepicker.h @@ -5,7 +5,7 @@ // Modified by: // Created: 14/4/2006 // Copyright: (c) Francesco Montorsi -// RCS-ID: $Id: filepicker.h 58849 2009-02-12 21:09:20Z RR $ +// RCS-ID: $Id: filepicker.h 70043 2011-12-18 12:34:47Z VZ $ // Licence: wxWindows Licence ///////////////////////////////////////////////////////////////////////////// @@ -87,9 +87,13 @@ public: wxFileDirPickerWidgetBase() { } virtual ~wxFileDirPickerWidgetBase() { } + // Path here is the name of the selected file or directory. wxString GetPath() const { return m_path; } virtual void SetPath(const wxString &str) { m_path=str; } + // Set the directory to open the file browse dialog at initially. + virtual void SetInitialDirectory(const wxString& dir) = 0; + // returns the picker widget cast to wxControl virtual wxControl *AsControl() = 0; @@ -109,12 +113,14 @@ protected: #define wxFLP_OVERWRITE_PROMPT 0x1000 #define wxFLP_FILE_MUST_EXIST 0x2000 #define wxFLP_CHANGE_DIR 0x4000 +#define wxFLP_SMALL wxPB_SMALL // NOTE: wxMULTIPLE is not supported ! #define wxDIRP_DIR_MUST_EXIST 0x0008 #define wxDIRP_CHANGE_DIR 0x0010 +#define wxDIRP_SMALL wxPB_SMALL // map platform-dependent controls which implement the wxFileDirPickerWidgetBase @@ -163,6 +169,12 @@ public: // public API wxString GetPath() const; void SetPath(const wxString &str); + // Set the directory to open the file browse dialog at initially. + void SetInitialDirectory(const wxString& dir) + { + m_pickerIface->SetInitialDirectory(dir); + } + public: // internal functions void UpdatePickerFromTextCtrl(); @@ -253,13 +265,7 @@ public: const wxSize& size = wxDefaultSize, long style = wxFLP_DEFAULT_STYLE, const wxValidator& validator = wxDefaultValidator, - const wxString& name = wxFilePickerCtrlNameStr) - { - return wxFileDirPickerCtrlBase::CreateBase(parent, id, path, - message, wildcard, - pos, size, style, - validator, name); - } + const wxString& name = wxFilePickerCtrlNameStr); void SetFileName(const wxFileName &filename) { SetPath(filename.GetFullPath()); } @@ -306,8 +312,13 @@ protected: // extracts the style for our picker from wxFileDirPickerCtrlBase's style long GetPickerStyle(long style) const { - return (style & (wxFLP_OPEN|wxFLP_SAVE|wxFLP_OVERWRITE_PROMPT| - wxFLP_FILE_MUST_EXIST|wxFLP_CHANGE_DIR|wxFLP_USE_TEXTCTRL)); + return style & (wxFLP_OPEN | + wxFLP_SAVE | + wxFLP_OVERWRITE_PROMPT | + wxFLP_FILE_MUST_EXIST | + wxFLP_CHANGE_DIR | + wxFLP_USE_TEXTCTRL | + wxFLP_SMALL); } private: @@ -358,14 +369,7 @@ public: const wxSize& size = wxDefaultSize, long style = wxDIRP_DEFAULT_STYLE, const wxValidator& validator = wxDefaultValidator, - const wxString& name = wxDirPickerCtrlNameStr) - { - return wxFileDirPickerCtrlBase::CreateBase - ( - parent, id, path, message, wxEmptyString, - pos, size, style, validator, name - ); - } + const wxString& name = wxDirPickerCtrlNameStr); void SetDirName(const wxFileName &dirname) { SetPath(dirname.GetPath()); } @@ -409,7 +413,12 @@ protected: // extracts the style for our picker from wxFileDirPickerCtrlBase's style long GetPickerStyle(long style) const - { return (style & (wxDIRP_DIR_MUST_EXIST|wxDIRP_CHANGE_DIR|wxDIRP_USE_TEXTCTRL)); } + { + return style & (wxDIRP_DIR_MUST_EXIST | + wxDIRP_CHANGE_DIR | + wxDIRP_USE_TEXTCTRL | + wxDIRP_SMALL); + } private: DECLARE_DYNAMIC_CLASS(wxDirPickerCtrl) diff --git a/Externals/wxWidgets3/include/wx/font.h b/Externals/wxWidgets3/include/wx/font.h index 9952472d18..6e3c5237ab 100644 --- a/Externals/wxWidgets3/include/wx/font.h +++ b/Externals/wxWidgets3/include/wx/font.h @@ -4,7 +4,7 @@ // Author: Vadim Zeitlin // Modified by: // Created: 20.09.99 -// RCS-ID: $Id: font.h 67052 2011-02-27 12:47:05Z VZ $ +// RCS-ID: $Id: font.h 70446 2012-01-23 11:28:28Z VZ $ // Copyright: (c) wxWidgets team // Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// @@ -227,6 +227,7 @@ public: virtual wxFontStyle GetStyle() const = 0; virtual wxFontWeight GetWeight() const = 0; virtual bool GetUnderlined() const = 0; + virtual bool GetStrikethrough() const { return false; } virtual wxString GetFaceName() const = 0; virtual wxFontEncoding GetEncoding() const = 0; virtual const wxNativeFontInfo *GetNativeFontInfo() const = 0; @@ -244,6 +245,7 @@ public: virtual void SetWeight( wxFontWeight weight ) = 0; virtual void SetUnderlined( bool underlined ) = 0; + virtual void SetStrikethrough( bool WXUNUSED(strikethrough) ) {} virtual void SetEncoding(wxFontEncoding encoding) = 0; virtual bool SetFaceName( const wxString& faceName ); void SetNativeFontInfo(const wxNativeFontInfo& info) @@ -277,7 +279,7 @@ public: static void SetDefaultEncoding(wxFontEncoding encoding); // this doesn't do anything and is kept for compatibility only -#ifdef WXWIN_COMPATIBILITY_2_8 +#if WXWIN_COMPATIBILITY_2_8 wxDEPRECATED_INLINE(void SetNoAntiAliasing(bool no = true), wxUnusedVar(no);); wxDEPRECATED_INLINE(bool GetNoAntiAliasing() const, return false;) #endif // WXWIN_COMPATIBILITY_2_8 @@ -290,6 +292,33 @@ protected: // wxFONTFAMILY_UNKNOWN unlike the public method (see comment there). virtual wxFontFamily DoGetFamily() const = 0; + + // Helper functions to recover wxFONTSTYLE/wxFONTWEIGHT and underlined flg + // values from flags containing a combination of wxFONTFLAG_XXX. + static wxFontStyle GetStyleFromFlags(int flags) + { + return flags & wxFONTFLAG_ITALIC + ? wxFONTSTYLE_ITALIC + : flags & wxFONTFLAG_SLANT + ? wxFONTSTYLE_SLANT + : wxFONTSTYLE_NORMAL; + } + + static wxFontWeight GetWeightFromFlags(int flags) + { + return flags & wxFONTFLAG_LIGHT + ? wxFONTWEIGHT_LIGHT + : flags & wxFONTFLAG_BOLD + ? wxFONTWEIGHT_BOLD + : wxFONTWEIGHT_NORMAL; + } + + static bool GetUnderlinedFromFlags(int flags) + { + return (flags & wxFONTFLAG_UNDERLINED) != 0; + } + + private: // the currently default encoding: by default, it's the default system // encoding, but may be changed by the application using @@ -329,6 +358,7 @@ WXDLLIMPEXP_CORE bool wxFromString(const wxString& str, wxFontBase* font); wxFont& MakeBold(); \ wxFont& MakeItalic(); \ wxFont& MakeUnderlined(); \ + wxFont& MakeStrikethrough(); \ wxFont& MakeLarger() { return Scale(1.2f); } \ wxFont& MakeSmaller() { return Scale(1/1.2f); } \ wxFont& Scale(float x); \ @@ -336,14 +366,13 @@ WXDLLIMPEXP_CORE bool wxFromString(const wxString& str, wxFontBase* font); wxFont Bold() const; \ wxFont Italic() const; \ wxFont Underlined() const; \ + wxFont Strikethrough() const; \ wxFont Larger() const { return Scaled(1.2f); } \ wxFont Smaller() const { return Scaled(1/1.2f); } \ wxFont Scaled(float x) const // include the real class declaration -#if defined(__WXPALMOS__) - #include "wx/palmos/font.h" -#elif defined(__WXMSW__) +#if defined(__WXMSW__) #include "wx/msw/font.h" #elif defined(__WXMOTIF__) #include "wx/motif/font.h" @@ -353,8 +382,6 @@ WXDLLIMPEXP_CORE bool wxFromString(const wxString& str, wxFontBase* font); #include "wx/gtk1/font.h" #elif defined(__WXX11__) #include "wx/x11/font.h" -#elif defined(__WXMGL__) - #include "wx/mgl/font.h" #elif defined(__WXDFB__) #include "wx/dfb/font.h" #elif defined(__WXMAC__) diff --git a/Externals/wxWidgets3/include/wx/fontutil.h b/Externals/wxWidgets3/include/wx/fontutil.h index a34bf5ef5e..232ef8a8e3 100644 --- a/Externals/wxWidgets3/include/wx/fontutil.h +++ b/Externals/wxWidgets3/include/wx/fontutil.h @@ -4,7 +4,7 @@ // Author: Vadim Zeitlin // Modified by: // Created: 05.11.99 -// RCS-ID: $Id: fontutil.h 63918 2010-04-08 21:39:14Z SC $ +// RCS-ID: $Id: fontutil.h 70446 2012-01-23 11:28:28Z VZ $ // Copyright: (c) wxWidgets team // Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// @@ -172,6 +172,7 @@ public: wxFontStyle m_style; wxFontWeight m_weight; bool m_underlined; + bool m_strikethrough; wxString m_faceName; wxFontEncoding m_encoding; public : @@ -187,6 +188,7 @@ public : wxFontStyle style; wxFontWeight weight; bool underlined; + bool strikethrough; wxString faceName; wxFontEncoding encoding; #endif // platforms @@ -224,6 +226,7 @@ public: SetStyle((wxFontStyle)font.GetStyle()); SetWeight((wxFontWeight)font.GetWeight()); SetUnderlined(font.GetUnderlined()); + SetStrikethrough(font.GetStrikethrough()); #if defined(__WXMSW__) if ( font.IsUsingSizeInPixels() ) SetPixelSize(font.GetPixelSize()); @@ -252,6 +255,7 @@ public: wxFontStyle GetStyle() const; wxFontWeight GetWeight() const; bool GetUnderlined() const; + bool GetStrikethrough() const; wxString GetFaceName() const; wxFontFamily GetFamily() const; wxFontEncoding GetEncoding() const; @@ -261,6 +265,7 @@ public: void SetStyle(wxFontStyle style); void SetWeight(wxFontWeight weight); void SetUnderlined(bool underlined); + void SetStrikethrough(bool strikethrough); bool SetFaceName(const wxString& facename); void SetFamily(wxFontFamily family); void SetEncoding(wxFontEncoding encoding); diff --git a/Externals/wxWidgets3/include/wx/frame.h b/Externals/wxWidgets3/include/wx/frame.h index e2f06c5c79..396dd98f5a 100644 --- a/Externals/wxWidgets3/include/wx/frame.h +++ b/Externals/wxWidgets3/include/wx/frame.h @@ -4,7 +4,7 @@ // Author: Vadim Zeitlin // Modified by: // Created: 15.11.99 -// RCS-ID: $Id: frame.h 64278 2010-05-10 21:09:50Z VZ $ +// RCS-ID: $Id: frame.h 70345 2012-01-15 01:05:28Z VZ $ // Copyright: (c) wxWidgets team // Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// @@ -39,7 +39,6 @@ class WXDLLIMPEXP_FWD_CORE wxToolBar; #define wxFRAME_NO_TASKBAR 0x0002 // No taskbar button (MSW only) #define wxFRAME_TOOL_WINDOW 0x0004 // No taskbar button, no system menu #define wxFRAME_FLOAT_ON_PARENT 0x0008 // Always above its parent -#define wxFRAME_SHAPED 0x0010 // Create a window that is able to be shaped // ---------------------------------------------------------------------------- // wxFrame is a top-level window with optional menubar, statusbar and toolbar @@ -252,9 +251,7 @@ protected: #if defined(__WXUNIVERSAL__) // && !defined(__WXMICROWIN__) #include "wx/univ/frame.h" #else // !__WXUNIVERSAL__ - #if defined(__WXPALMOS__) - #include "wx/palmos/frame.h" - #elif defined(__WXMSW__) + #if defined(__WXMSW__) #include "wx/msw/frame.h" #elif defined(__WXGTK20__) #include "wx/gtk/frame.h" diff --git a/Externals/wxWidgets3/include/wx/fswatcher.h b/Externals/wxWidgets3/include/wx/fswatcher.h index 446ac98245..239a5b4dad 100644 --- a/Externals/wxWidgets3/include/wx/fswatcher.h +++ b/Externals/wxWidgets3/include/wx/fswatcher.h @@ -3,7 +3,7 @@ // Purpose: wxFileSystemWatcherBase // Author: Bartosz Bekier // Created: 2009-05-23 -// RCS-ID: $Id: fswatcher.h 62474 2009-10-22 11:35:43Z VZ $ +// RCS-ID: $Id: fswatcher.h 70796 2012-03-04 00:29:31Z VZ $ // Copyright: (c) 2009 Bartosz Bekier // Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// @@ -55,6 +55,16 @@ enum wxFSW_EVENT_WARNING | wxFSW_EVENT_ERROR }; +// Type of the path watched, used only internally for now. +enum wxFSWPathType +{ + wxFSWPath_None, // Invalid value for an initialized watch. + wxFSWPath_File, // Plain file. + wxFSWPath_Dir, // Watch a directory and the files in it. + wxFSWPath_Tree // Watch a directory and all its children recursively. +}; + + /** * Event containing information about file system change. */ @@ -174,24 +184,24 @@ typedef void (wxEvtHandler::*wxFileSystemWatcherEventFunction) #define wxFileSystemWatcherEventHandler(func) \ wxEVENT_HANDLER_CAST(wxFileSystemWatcherEventFunction, func) +#define EVT_FSWATCHER(winid, func) \ + wx__DECLARE_EVT1(wxEVT_FSWATCHER, winid, wxFileSystemWatcherEventHandler(func)) // ---------------------------------------------------------------------------- // wxFileSystemWatcherBase: interface for wxFileSystemWatcher // ---------------------------------------------------------------------------- -/** - * Simple container to store information about one watched file - */ +// Simple container to store information about one watched path. class wxFSWatchInfo { public: wxFSWatchInfo() : - m_path(wxEmptyString), m_events(-1) + m_events(-1), m_type(wxFSWPath_None) { } - wxFSWatchInfo(const wxString& path, int events) : - m_path(path), m_events(events) + wxFSWatchInfo(const wxString& path, int events, wxFSWPathType type) : + m_path(path), m_events(events), m_type(type) { } @@ -205,9 +215,15 @@ public: return m_events; } + wxFSWPathType GetType() const + { + return m_type; + } + protected: wxString m_path; int m_events; + wxFSWPathType m_type; }; WX_DECLARE_STRING_HASH_MAP(wxFSWatchInfo, wxFSWatchInfoMap); @@ -304,6 +320,11 @@ protected: return path_copy.GetFullPath(); } + // Delegates the real work of adding the path to wxFSWatcherImpl::Add() and + // updates m_watches if the new path was successfully added. + bool DoAdd(const wxFileName& path, int events, wxFSWPathType type); + + wxFSWatchInfoMap m_watches; // path=>wxFSWatchInfo map wxFSWatcherImpl* m_service; // file system events service wxEvtHandler* m_owner; // handler for file system events @@ -320,7 +341,7 @@ protected: #elif defined(wxHAS_KQUEUE) #include "wx/unix/fswatcher_kqueue.h" #define wxFileSystemWatcher wxKqueueFileSystemWatcher -#elif defined(__WXMSW__) +#elif defined(__WINDOWS__) #include "wx/msw/fswatcher.h" #define wxFileSystemWatcher wxMSWFileSystemWatcher #else diff --git a/Externals/wxWidgets3/include/wx/gbsizer.h b/Externals/wxWidgets3/include/wx/gbsizer.h index 582f2881bb..51dc057d3d 100644 --- a/Externals/wxWidgets3/include/wx/gbsizer.h +++ b/Externals/wxWidgets3/include/wx/gbsizer.h @@ -6,7 +6,7 @@ // // Author: Robin Dunn // Created: 03-Nov-2003 -// RCS-ID: $Id: gbsizer.h 67254 2011-03-20 00:14:35Z DS $ +// RCS-ID: $Id: gbsizer.h 69970 2011-12-10 04:34:06Z RD $ // Copyright: (c) Robin Dunn // Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// @@ -115,26 +115,26 @@ public: wxGBSizerItem( int width, int height, const wxGBPosition& pos, - const wxGBSpan& span, - int flag, - int border, - wxObject* userData); + const wxGBSpan& span=wxDefaultSpan, + int flag=0, + int border=0, + wxObject* userData=NULL); // window wxGBSizerItem( wxWindow *window, const wxGBPosition& pos, - const wxGBSpan& span, - int flag, - int border, - wxObject* userData ); + const wxGBSpan& span=wxDefaultSpan, + int flag=0, + int border=0, + wxObject* userData=NULL ); // subsizer wxGBSizerItem( wxSizer *sizer, const wxGBPosition& pos, - const wxGBSpan& span, - int flag, - int border, - wxObject* userData ); + const wxGBSpan& span=wxDefaultSpan, + int flag=0, + int border=0, + wxObject* userData=NULL ); // default ctor wxGBSizerItem(); @@ -160,7 +160,7 @@ public: // is successful and after the next Layout the item will be resized. bool SetSpan( const wxGBSpan& span ); - // Returns true if this item and the other item instersect + // Returns true if this item and the other item intersect bool Intersects(const wxGBSizerItem& other); // Returns true if the given pos/span would intersect with this item. diff --git a/Externals/wxWidgets3/include/wx/gdicmn.h b/Externals/wxWidgets3/include/wx/gdicmn.h index 101c9a3907..d69b5f89be 100644 --- a/Externals/wxWidgets3/include/wx/gdicmn.h +++ b/Externals/wxWidgets3/include/wx/gdicmn.h @@ -4,7 +4,7 @@ // Author: Julian Smart // Modified by: // Created: 01/02/97 -// RCS-ID: $Id: gdicmn.h 66306 2010-12-03 12:39:43Z VZ $ +// RCS-ID: $Id: gdicmn.h 70789 2012-03-04 00:28:58Z VZ $ // Copyright: (c) Julian Smart // Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// @@ -59,8 +59,10 @@ enum wxBitmapType wxBITMAP_TYPE_XBM_DATA, wxBITMAP_TYPE_XPM, wxBITMAP_TYPE_XPM_DATA, - wxBITMAP_TYPE_TIF, - wxBITMAP_TYPE_TIF_RESOURCE, + wxBITMAP_TYPE_TIFF, + wxBITMAP_TYPE_TIF = wxBITMAP_TYPE_TIFF, + wxBITMAP_TYPE_TIFF_RESOURCE, + wxBITMAP_TYPE_TIF_RESOURCE = wxBITMAP_TYPE_TIFF_RESOURCE, wxBITMAP_TYPE_GIF, wxBITMAP_TYPE_GIF_RESOURCE, wxBITMAP_TYPE_PNG, @@ -158,14 +160,18 @@ enum wxStockCursor // macros // --------------------------------------------------------------------------- +#if defined(__WINDOWS__) || defined(__WXPM__) + #define wxHAS_IMAGES_IN_RESOURCES +#endif + /* Useful macro for creating icons portably, for example: wxIcon *icon = new wxICON(sample); expands into: - wxIcon *icon = new wxIcon("sample"); // On wxMSW - wxIcon *icon = new wxIcon(sample_xpm); // On wxGTK + wxIcon *icon = new wxIcon("sample"); // On Windows + wxIcon *icon = new wxIcon(sample_xpm); // On wxGTK/Linux */ #ifdef __WXMSW__ @@ -174,9 +180,6 @@ enum wxStockCursor #elif defined(__WXPM__) // Load from a resource #define wxICON(X) wxIcon(wxT(#X)) -#elif defined(__WXMGL__) - // Initialize from an included XPM - #define wxICON(X) wxIcon( X##_xpm ) #elif defined(__WXDFB__) // Initialize from an included XPM #define wxICON(X) wxIcon( X##_xpm ) @@ -202,12 +205,11 @@ enum wxStockCursor */ #if defined(__WXMSW__) || defined(__WXPM__) - #define wxBITMAP(name) wxBitmap(wxT(#name), wxBITMAP_TYPE_RESOURCE) + #define wxBITMAP(name) wxBitmap(wxT(#name), wxBITMAP_TYPE_BMP_RESOURCE) #elif defined(__WXGTK__) || \ defined(__WXMOTIF__) || \ defined(__WXX11__) || \ defined(__WXMAC__) || \ - defined(__WXMGL__) || \ defined(__WXDFB__) || \ defined(__WXCOCOA__) // Initialize from an included XPM @@ -900,7 +902,7 @@ class WXDLLIMPEXP_CORE wxResourceCache: public wxList { public: wxResourceCache() { } -#if !wxUSE_STL +#if !wxUSE_STD_CONTAINERS wxResourceCache(const unsigned int keyType) : wxList(keyType) { } #endif virtual ~wxResourceCache(); diff --git a/Externals/wxWidgets3/include/wx/gdiobj.h b/Externals/wxWidgets3/include/wx/gdiobj.h index fc018231ba..5e07df0d81 100644 --- a/Externals/wxWidgets3/include/wx/gdiobj.h +++ b/Externals/wxWidgets3/include/wx/gdiobj.h @@ -5,7 +5,7 @@ // Modified by: // Created: // Copyright: (c) Julian Smart -// RCS-ID: $Id: gdiobj.h 66374 2010-12-14 18:43:49Z VZ $ +// RCS-ID: $Id: gdiobj.h 70345 2012-01-15 01:05:28Z VZ $ // Licence: wxWindows Licence ///////////////////////////////////////////////////////////////////////////// @@ -57,7 +57,7 @@ public: // because it's still widely used) bool Ok() const { return IsOk(); } -#if defined(__WXMSW__) || defined(__WXPM__) || defined(__WXPALMOS__) +#if defined(__WXMSW__) || defined(__WXPM__) // Creates the resource virtual bool RealizeResource() { return false; } diff --git a/Externals/wxWidgets3/include/wx/generic/aboutdlgg.h b/Externals/wxWidgets3/include/wx/generic/aboutdlgg.h index 9311de0abc..f5b1365953 100644 --- a/Externals/wxWidgets3/include/wx/generic/aboutdlgg.h +++ b/Externals/wxWidgets3/include/wx/generic/aboutdlgg.h @@ -3,7 +3,7 @@ // Purpose: generic wxAboutBox() implementation // Author: Vadim Zeitlin // Created: 2006-10-07 -// RCS-ID: $Id: aboutdlgg.h 60389 2009-04-26 13:41:21Z VZ $ +// RCS-ID: $Id: aboutdlgg.h 70413 2012-01-20 22:11:32Z VZ $ // Copyright: (c) 2006 Vadim Zeitlin // Licence: wxWindows licence /////////////////////////////////////////////////////////////////////////////// @@ -21,6 +21,16 @@ class WXDLLIMPEXP_FWD_ADV wxAboutDialogInfo; class WXDLLIMPEXP_FWD_CORE wxSizer; class WXDLLIMPEXP_FWD_CORE wxSizerFlags; +// Under GTK and OS X "About" dialogs are not supposed to be modal, unlike MSW +// and, presumably, all the other platforms. +#ifndef wxUSE_MODAL_ABOUT_DIALOG + #if defined(__WXGTK__) || defined(__WXMAC__) + #define wxUSE_MODAL_ABOUT_DIALOG 0 + #else + #define wxUSE_MODAL_ABOUT_DIALOG 1 + #endif +#endif // wxUSE_MODAL_ABOUT_DIALOG not defined + // ---------------------------------------------------------------------------- // wxGenericAboutDialog: generic "About" dialog implementation // ---------------------------------------------------------------------------- @@ -73,6 +83,12 @@ private: // common part of all ctors void Init() { m_sizerText = NULL; } +#if !wxUSE_MODAL_ABOUT_DIALOG + // An explicit handler for deleting the dialog when it's closed is needed + // when we show it non-modally. + void OnCloseWindow(wxCloseEvent& event); + void OnOK(wxCommandEvent& event); +#endif // !wxUSE_MODAL_ABOUT_DIALOG wxSizer *m_sizerText; }; diff --git a/Externals/wxWidgets3/include/wx/generic/choicdgg.h b/Externals/wxWidgets3/include/wx/generic/choicdgg.h index 0cbf06d201..431c686b59 100644 --- a/Externals/wxWidgets3/include/wx/generic/choicdgg.h +++ b/Externals/wxWidgets3/include/wx/generic/choicdgg.h @@ -4,7 +4,7 @@ // Author: Julian Smart // Modified by: 03.11.00: VZ to add wxArrayString and multiple sel functions // Created: 01/02/97 -// RCS-ID: $Id: choicdgg.h 63731 2010-03-21 11:06:31Z VZ $ +// RCS-ID: $Id: choicdgg.h 70642 2012-02-20 21:56:18Z VZ $ // Copyright: (c) wxWidgets team // Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// @@ -106,39 +106,112 @@ public: const wxString& caption, int n, const wxString *choices, - char **clientData = (char **)NULL, + void **clientData = NULL, long style = wxCHOICEDLG_STYLE, - const wxPoint& pos = wxDefaultPosition); + const wxPoint& pos = wxDefaultPosition) + { + Create(parent, message, caption, n, choices, clientData, style, pos); + } + wxSingleChoiceDialog(wxWindow *parent, const wxString& message, const wxString& caption, const wxArrayString& choices, - char **clientData = (char **)NULL, + void **clientData = NULL, long style = wxCHOICEDLG_STYLE, - const wxPoint& pos = wxDefaultPosition); + const wxPoint& pos = wxDefaultPosition) + { + Create(parent, message, caption, choices, clientData, style, pos); + } bool Create(wxWindow *parent, const wxString& message, const wxString& caption, int n, const wxString *choices, - char **clientData = (char **)NULL, + void **clientData = NULL, long style = wxCHOICEDLG_STYLE, const wxPoint& pos = wxDefaultPosition); bool Create(wxWindow *parent, const wxString& message, const wxString& caption, const wxArrayString& choices, - char **clientData = (char **)NULL, + void **clientData = NULL, long style = wxCHOICEDLG_STYLE, const wxPoint& pos = wxDefaultPosition); void SetSelection(int sel); int GetSelection() const { return m_selection; } wxString GetStringSelection() const { return m_stringSelection; } + void* GetSelectionData() const { return m_clientData; } - // obsolete function (NB: no need to make it return wxChar, it's untyped) - char *GetSelectionClientData() const { return (char *)m_clientData; } +#if WXWIN_COMPATIBILITY_2_8 + // Deprecated overloads taking "char**" client data. + wxDEPRECATED_CONSTRUCTOR + ( + wxSingleChoiceDialog(wxWindow *parent, + const wxString& message, + const wxString& caption, + int n, + const wxString *choices, + char **clientData, + long style = wxCHOICEDLG_STYLE, + const wxPoint& pos = wxDefaultPosition) + ) + { + Create(parent, message, caption, n, choices, + (void**)clientData, style, pos); + } + + wxDEPRECATED_CONSTRUCTOR + ( + wxSingleChoiceDialog(wxWindow *parent, + const wxString& message, + const wxString& caption, + const wxArrayString& choices, + char **clientData, + long style = wxCHOICEDLG_STYLE, + const wxPoint& pos = wxDefaultPosition) + ) + { + Create(parent, message, caption, choices, + (void**)clientData, style, pos); + } + + wxDEPRECATED_INLINE + ( + bool Create(wxWindow *parent, + const wxString& message, + const wxString& caption, + int n, + const wxString *choices, + char **clientData, + long style = wxCHOICEDLG_STYLE, + const wxPoint& pos = wxDefaultPosition), + return Create(parent, message, caption, n, choices, + (void**)clientData, style, pos); + ) + + wxDEPRECATED_INLINE + ( + bool Create(wxWindow *parent, + const wxString& message, + const wxString& caption, + const wxArrayString& choices, + char **clientData, + long style = wxCHOICEDLG_STYLE, + const wxPoint& pos = wxDefaultPosition), + return Create(parent, message, caption, choices, + (void**)clientData, style, pos); + ) + + // NB: no need to make it return wxChar, it's untyped + wxDEPRECATED_ACCESSOR + ( + char* GetSelectionClientData() const, + (char*)GetSelectionData() + ) +#endif // WXWIN_COMPATIBILITY_2_8 // implementation from now on void OnOK(wxCommandEvent& event); diff --git a/Externals/wxWidgets3/include/wx/generic/collpaneg.h b/Externals/wxWidgets3/include/wx/generic/collpaneg.h index 3a69a686d3..e06b361b18 100644 --- a/Externals/wxWidgets3/include/wx/generic/collpaneg.h +++ b/Externals/wxWidgets3/include/wx/generic/collpaneg.h @@ -4,7 +4,7 @@ // Author: Francesco Montorsi // Modified by: // Created: 8/10/2006 -// RCS-ID: $Id: collpaneg.h 58606 2009-02-01 20:59:03Z FM $ +// RCS-ID: $Id: collpaneg.h 68366 2011-07-24 22:19:33Z VZ $ // Copyright: (c) Francesco Montorsi // Licence: wxWindows Licence ///////////////////////////////////////////////////////////////////////////// @@ -25,7 +25,8 @@ class WXDLLIMPEXP_FWD_CORE wxDisclosureTriangle; // wxGenericCollapsiblePane // ---------------------------------------------------------------------------- -class WXDLLIMPEXP_CORE wxGenericCollapsiblePane : public wxCollapsiblePaneBase +class WXDLLIMPEXP_CORE wxGenericCollapsiblePane : + public wxNavigationEnabled { public: wxGenericCollapsiblePane() { Init(); } @@ -103,7 +104,6 @@ private: void OnButton(wxCommandEvent &ev); void OnSize(wxSizeEvent &ev); - WX_DECLARE_CONTROL_CONTAINER(); DECLARE_DYNAMIC_CLASS(wxGenericCollapsiblePane) DECLARE_EVENT_TABLE() }; diff --git a/Externals/wxWidgets3/include/wx/generic/custombgwin.h b/Externals/wxWidgets3/include/wx/generic/custombgwin.h new file mode 100644 index 0000000000..a7ed85d995 --- /dev/null +++ b/Externals/wxWidgets3/include/wx/generic/custombgwin.h @@ -0,0 +1,96 @@ +/////////////////////////////////////////////////////////////////////////////// +// Name: wx/generic/custombgwin.h +// Purpose: Generic implementation of wxCustomBackgroundWindow. +// Author: Vadim Zeitlin +// Created: 2011-10-10 +// RCS-ID: $Id: custombgwin.h 69378 2011-10-11 17:07:43Z VZ $ +// Copyright: (c) 2011 Vadim Zeitlin +// Licence: wxWindows licence +/////////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_GENERIC_CUSTOMBGWIN_H_ +#define _WX_GENERIC_CUSTOMBGWIN_H_ + +#include "wx/bitmap.h" + +// A helper to avoid template bloat: this class contains all type-independent +// code of wxCustomBackgroundWindow<> below. +class wxCustomBackgroundWindowGenericBase : public wxCustomBackgroundWindowBase +{ +public: + wxCustomBackgroundWindowGenericBase() { } + +protected: + void DoEraseBackground(wxEraseEvent& event, wxWindow* win) + { + wxDC& dc = *event.GetDC(); + + const wxSize clientSize = win->GetClientSize(); + const wxSize bitmapSize = m_bitmapBg.GetSize(); + + for ( int x = 0; x < clientSize.x; x += bitmapSize.x ) + { + for ( int y = 0; y < clientSize.y; y += bitmapSize.y ) + { + dc.DrawBitmap(m_bitmapBg, x, y); + } + } + } + + + // The bitmap used for painting the background if valid. + wxBitmap m_bitmapBg; + + + wxDECLARE_NO_COPY_CLASS(wxCustomBackgroundWindowGenericBase); +}; + +// ---------------------------------------------------------------------------- +// wxCustomBackgroundWindow +// ---------------------------------------------------------------------------- + +template +class wxCustomBackgroundWindow : public W, + public wxCustomBackgroundWindowGenericBase +{ +public: + typedef W BaseWindowClass; + + wxCustomBackgroundWindow() { } + +protected: + virtual void DoSetBackgroundBitmap(const wxBitmap& bmp) + { + m_bitmapBg = bmp; + + if ( m_bitmapBg.IsOk() ) + { + BaseWindowClass::Connect + ( + wxEVT_ERASE_BACKGROUND, + wxEraseEventHandler(wxCustomBackgroundWindow::OnEraseBackground) + ); + } + else + { + BaseWindowClass::Disconnect + ( + wxEVT_ERASE_BACKGROUND, + wxEraseEventHandler(wxCustomBackgroundWindow::OnEraseBackground) + ); + } + } + +private: + // Event handler for erasing the background which is only used when we have + // a valid background bitmap. + void OnEraseBackground(wxEraseEvent& event) + { + DoEraseBackground(event, this); + } + + + wxDECLARE_NO_COPY_TEMPLATE_CLASS(wxCustomBackgroundWindow, W); +}; + +#endif // _WX_GENERIC_CUSTOMBGWIN_H_ diff --git a/Externals/wxWidgets3/include/wx/generic/dataview.h b/Externals/wxWidgets3/include/wx/generic/dataview.h index 30c9893749..af16d65218 100644 --- a/Externals/wxWidgets3/include/wx/generic/dataview.h +++ b/Externals/wxWidgets3/include/wx/generic/dataview.h @@ -3,7 +3,7 @@ // Purpose: wxDataViewCtrl generic implementation header // Author: Robert Roebling // Modified By: Bo Yang -// Id: $Id: dataview.h 65948 2010-10-30 15:57:41Z VS $ +// Id: $Id: dataview.h 70717 2012-02-27 18:54:02Z VZ $ // Copyright: (c) 1998 Robert Roebling // Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// @@ -68,10 +68,12 @@ public: virtual void SetFlags(int flags) { m_flags = flags; UpdateDisplay(); } virtual int GetFlags() const { return m_flags; } - virtual void SetAsSortKey(bool sort = true) { m_sort = sort; UpdateDisplay(); } virtual bool IsSortKey() const { return m_sort; } - virtual void SetSortOrder(bool ascending) { m_sortAscending = ascending; UpdateDisplay(); } + virtual void UnsetAsSortKey() { m_sort = false; UpdateDisplay(); } + + virtual void SetSortOrder(bool ascending); + virtual bool IsSortOrderAscending() const { return m_sortAscending; } virtual void SetBitmap( const wxBitmap& bitmap ) { wxDataViewColumnBase::SetBitmap(bitmap); UpdateDisplay(); } @@ -155,7 +157,7 @@ public: virtual wxDataViewColumn *GetSortingColumn() const; - virtual wxDataViewItem GetSelection() const; + virtual int GetSelectedItemsCount() const; virtual int GetSelections( wxDataViewItemArray & sel ) const; virtual void SetSelections( const wxDataViewItemArray & sel ); virtual void Select( const wxDataViewItem & item ); @@ -172,6 +174,8 @@ public: virtual wxRect GetItemRect( const wxDataViewItem & item, const wxDataViewColumn *column = NULL ) const; + virtual bool SetRowHeight( int rowHeight ); + virtual void Expand( const wxDataViewItem & item ); virtual void Collapse( const wxDataViewItem & item ); virtual bool IsExpanded( const wxDataViewItem & item ) const; @@ -185,19 +189,18 @@ public: virtual wxBorder GetDefaultBorder() const; - void StartEditor( const wxDataViewItem & item, unsigned int column ); + virtual void EditItem(const wxDataViewItem& item, const wxDataViewColumn *column); + + // These methods are specific to generic wxDataViewCtrl implementation and + // should not be used in portable code. + wxColour GetAlternateRowColour() const { return m_alternateRowColour; } + void SetAlternateRowColour(const wxColour& colour); protected: - virtual int GetSelections( wxArrayInt & sel ) const; - virtual void SetSelections( const wxArrayInt & sel ); - virtual void Select( int row ); - virtual void Unselect( int row ); - virtual bool IsSelected( int row ) const; - virtual void SelectRange( int from, int to ); - virtual void UnselectRange( int from, int to ); - virtual void EnsureVisible( int row, int column ); + // Notice that row here may be invalid (i.e. >= GetRowCount()), this is not + // an error and this function simply returns an invalid item in this case. virtual wxDataViewItem GetItemByRow( unsigned int row ) const; virtual int GetRowByItem( const wxDataViewItem & item ) const; @@ -226,21 +229,32 @@ public: // utility functions not part of the API // return the column displayed at the given position in the control wxDataViewColumn *GetColumnAt(unsigned int pos) const; + virtual wxDataViewColumn *GetCurrentColumn() const; + + virtual void OnInternalIdle(); + private: virtual wxDataViewItem DoGetCurrentItem() const; virtual void DoSetCurrentItem(const wxDataViewItem& item); void InvalidateColBestWidths(); void InvalidateColBestWidth(int idx); + void UpdateColWidths(); wxDataViewColumnList m_cols; // cached column best widths or 0 if not computed, values are for // respective columns from m_cols and the arrays have same size wxVector m_colsBestWidths; + // m_colsBestWidths partially invalid, needs recomputing + bool m_colsDirty; + wxDataViewModelNotifier *m_notifier; wxDataViewMainWindow *m_clientArea; wxDataViewHeaderWindow *m_headerArea; + // user defined color to draw row lines, may be invalid + wxColour m_alternateRowColour; + // the index of the column currently used for sorting or -1 int m_sortingColumnIdx; diff --git a/Externals/wxWidgets3/include/wx/generic/datectrl.h b/Externals/wxWidgets3/include/wx/generic/datectrl.h index b92e89990b..fe7dd57299 100644 --- a/Externals/wxWidgets3/include/wx/generic/datectrl.h +++ b/Externals/wxWidgets3/include/wx/generic/datectrl.h @@ -4,7 +4,7 @@ // Author: Andreas Pflug // Modified by: // Created: 2005-01-19 -// RCS-ID: $Id: datectrl.h 67254 2011-03-20 00:14:35Z DS $ +// RCS-ID: $Id: datectrl.h 70736 2012-02-28 14:41:30Z VZ $ // Copyright: (c) 2005 Andreas Pflug // Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// @@ -82,6 +82,10 @@ private: void OnSize(wxSizeEvent& event); void OnFocus(wxFocusEvent& event); +#ifdef __WXOSX_COCOA__ + virtual void OSXGenerateEvent(const wxDateTime& WXUNUSED(dt)) { } +#endif + wxComboCtrl* m_combo; wxCalendarComboPopup* m_popup; diff --git a/Externals/wxWidgets3/include/wx/generic/dvrenderer.h b/Externals/wxWidgets3/include/wx/generic/dvrenderer.h index cfa70c9067..8e4eb7761c 100644 --- a/Externals/wxWidgets3/include/wx/generic/dvrenderer.h +++ b/Externals/wxWidgets3/include/wx/generic/dvrenderer.h @@ -3,7 +3,7 @@ // Purpose: wxDataViewRenderer for generic wxDataViewCtrl implementation // Author: Robert Roebling, Vadim Zeitlin // Created: 2009-11-07 (extracted from wx/generic/dataview.h) -// RCS-ID: $Id: dvrenderer.h 67099 2011-03-01 12:16:49Z VS $ +// RCS-ID: $Id: dvrenderer.h 69473 2011-10-19 16:20:17Z VS $ // Copyright: (c) 2006 Robert Roebling // (c) 2009 Vadim Zeitlin // Licence: wxWindows licence @@ -41,23 +41,16 @@ public: // implementation - // These callbacks are used by generic implementation of wxDVC itself. - // They're different from the corresponding Activate/LeftClick() methods - // which should only be overridable for the custom renderers while the - // generic implementation uses these ones for all of them, including the - // standard ones. + // This callback is used by generic implementation of wxDVC itself. It's + // different from the corresponding ActivateCell() method which should only + // be overridable for the custom renderers while the generic implementation + // uses this one for all of them, including the standard ones. - virtual bool WXOnActivate(const wxRect& WXUNUSED(cell), - wxDataViewModel *WXUNUSED(model), - const wxDataViewItem & WXUNUSED(item), - unsigned int WXUNUSED(col)) - { return false; } - - virtual bool WXOnLeftClick(const wxPoint& WXUNUSED(cursor), - const wxRect& WXUNUSED(cell), - wxDataViewModel *WXUNUSED(model), - const wxDataViewItem & WXUNUSED(item), - unsigned int WXUNUSED(col) ) + virtual bool WXActivateCell(const wxRect& WXUNUSED(cell), + wxDataViewModel *WXUNUSED(model), + const wxDataViewItem & WXUNUSED(item), + unsigned int WXUNUSED(col), + const wxMouseEvent* WXUNUSED(mouseEvent)) { return false; } private: diff --git a/Externals/wxWidgets3/include/wx/generic/dvrenderers.h b/Externals/wxWidgets3/include/wx/generic/dvrenderers.h index 14040bdaa5..e5ca2c71ec 100644 --- a/Externals/wxWidgets3/include/wx/generic/dvrenderers.h +++ b/Externals/wxWidgets3/include/wx/generic/dvrenderers.h @@ -3,7 +3,7 @@ // Purpose: All generic wxDataViewCtrl renderer classes // Author: Robert Roebling, Vadim Zeitlin // Created: 2009-11-07 (extracted from wx/generic/dataview.h) -// RCS-ID: $Id: dvrenderers.h 67099 2011-03-01 12:16:49Z VS $ +// RCS-ID: $Id: dvrenderers.h 69473 2011-10-19 16:20:17Z VS $ // Copyright: (c) 2006 Robert Roebling // (c) 2009 Vadim Zeitlin // Licence: wxWindows licence @@ -26,21 +26,13 @@ public: // see the explanation of the following WXOnXXX() methods in wx/generic/dvrenderer.h - virtual bool WXOnActivate(const wxRect& cell, - wxDataViewModel *model, - const wxDataViewItem& item, - unsigned int col) + virtual bool WXActivateCell(const wxRect& cell, + wxDataViewModel *model, + const wxDataViewItem& item, + unsigned int col, + const wxMouseEvent *mouseEvent) { - return Activate(cell, model, item, col); - } - - virtual bool WXOnLeftClick(const wxPoint& cursor, - const wxRect& cell, - wxDataViewModel *model, - const wxDataViewItem &item, - unsigned int col) - { - return LeftClick(cursor, cell, model, item, col); + return ActivateCell(cell, model, item, col, mouseEvent); } private: @@ -67,9 +59,9 @@ public: // in-place editing virtual bool HasEditorCtrl() const; - virtual wxControl* CreateEditorCtrl( wxWindow *parent, wxRect labelRect, - const wxVariant &value ); - virtual bool GetValueFromEditorCtrl( wxControl* editor, wxVariant &value ); + virtual wxWindow* CreateEditorCtrl( wxWindow *parent, wxRect labelRect, + const wxVariant &value ); + virtual bool GetValueFromEditorCtrl( wxWindow* editor, wxVariant &value ); protected: wxString m_text; @@ -121,11 +113,11 @@ public: wxSize GetSize() const; // Implementation only, don't use nor override - virtual bool WXOnLeftClick(const wxPoint& cursor, - const wxRect& cell, - wxDataViewModel *model, - const wxDataViewItem& item, - unsigned int col); + virtual bool WXActivateCell(const wxRect& cell, + wxDataViewModel *model, + const wxDataViewItem& item, + unsigned int col, + const wxMouseEvent *mouseEvent); private: bool m_toggle; @@ -177,9 +169,9 @@ public: virtual wxSize GetSize() const; virtual bool HasEditorCtrl() const { return true; } - virtual wxControl* CreateEditorCtrl( wxWindow *parent, wxRect labelRect, - const wxVariant &value ); - virtual bool GetValueFromEditorCtrl( wxControl* editor, wxVariant &value ); + virtual wxWindow* CreateEditorCtrl( wxWindow *parent, wxRect labelRect, + const wxVariant &value ); + virtual bool GetValueFromEditorCtrl( wxWindow* editor, wxVariant &value ); private: wxDataViewIconText m_value; @@ -188,36 +180,5 @@ protected: DECLARE_DYNAMIC_CLASS_NO_COPY(wxDataViewIconTextRenderer) }; -// --------------------------------------------------------- -// wxDataViewDateRenderer -// --------------------------------------------------------- - -class WXDLLIMPEXP_ADV wxDataViewDateRenderer: public wxDataViewRenderer -{ -public: - wxDataViewDateRenderer( const wxString &varianttype = wxT("datetime"), - wxDataViewCellMode mode = wxDATAVIEW_CELL_ACTIVATABLE, - int align = wxDVR_DEFAULT_ALIGNMENT ); - - bool SetValue( const wxVariant &value ); - bool GetValue( wxVariant& value ) const; - - virtual bool Render( wxRect cell, wxDC *dc, int state ); - virtual wxSize GetSize() const; - - // Implementation only, don't use nor override - virtual bool WXOnActivate(const wxRect& cell, - wxDataViewModel *model, - const wxDataViewItem& item, - unsigned int col); - -private: - wxDateTime m_date; - -protected: - DECLARE_DYNAMIC_CLASS_NO_COPY(wxDataViewDateRenderer) -}; - - #endif // _WX_GENERIC_DVRENDERERS_H_ diff --git a/Externals/wxWidgets3/include/wx/generic/filepickerg.h b/Externals/wxWidgets3/include/wx/generic/filepickerg.h index 34749fb190..f1283915c1 100644 --- a/Externals/wxWidgets3/include/wx/generic/filepickerg.h +++ b/Externals/wxWidgets3/include/wx/generic/filepickerg.h @@ -5,7 +5,7 @@ // Modified by: // Created: 14/4/2006 // Copyright: (c) Francesco Montorsi -// RCS-ID: $Id: filepickerg.h 63690 2010-03-16 00:23:57Z VZ $ +// RCS-ID: $Id: filepickerg.h 70043 2011-12-18 12:34:47Z VZ $ // Licence: wxWindows Licence ///////////////////////////////////////////////////////////////////////////// @@ -49,7 +49,7 @@ public: virtual wxControl *AsControl() { return this; } -public: // overrideable +public: // overridable virtual wxDialog *CreateDialog() = 0; @@ -58,6 +58,8 @@ public: // overrideable virtual wxEventType GetEventType() const = 0; + virtual void SetInitialDirectory(const wxString& dir); + public: bool Create(wxWindow *parent, wxWindowID id, @@ -82,6 +84,9 @@ protected: // just doesn't make sense to use picker styles for wxButton anyhow long m_pickerStyle; + // Initial directory set by SetInitialDirectory() call or empty. + wxString m_initialDir; + private: // common part of all ctors void Init() { m_pickerStyle = -1; } @@ -114,7 +119,7 @@ public: pos, size, style, validator, name); } -public: // overrideable +public: // overridable virtual long GetDialogStyle() const { @@ -140,16 +145,7 @@ public: // overrideable return filedlgstyle; } - virtual wxDialog *CreateDialog() - { - wxFileDialog *p = new wxFileDialog(GetDialogParent(), m_message, - wxEmptyString, wxEmptyString, - m_wildcard, GetDialogStyle()); - - // this sets both the default folder and the default file of the dialog - p->SetPath(m_path); - return p; - } + virtual wxDialog *CreateDialog(); wxEventType GetEventType() const { return wxEVT_COMMAND_FILEPICKER_CHANGED; } @@ -160,6 +156,10 @@ protected: void UpdatePathFromDialog(wxDialog *p) { m_path = wxStaticCast(p, wxFileDialog)->GetPath(); } + // Set the initial directory for the dialog but without overriding the + // directory of the currently selected file, if any. + void DoSetInitialDirectory(wxFileDialog* dialog, const wxString& dir); + private: DECLARE_DYNAMIC_CLASS(wxGenericFileButton) }; @@ -190,7 +190,7 @@ public: pos, size, style, validator, name); } -public: // overrideable +public: // overridable virtual long GetDialogStyle() const { @@ -204,11 +204,7 @@ public: // overrideable return dirdlgstyle; } - virtual wxDialog *CreateDialog() - { - return new wxDirDialog(GetDialogParent(), m_message, m_path, - GetDialogStyle()); - } + virtual wxDialog *CreateDialog(); wxEventType GetEventType() const { return wxEVT_COMMAND_DIRPICKER_CHANGED; } diff --git a/Externals/wxWidgets3/include/wx/generic/grid.h b/Externals/wxWidgets3/include/wx/generic/grid.h index 18e5a267af..21b380023e 100644 --- a/Externals/wxWidgets3/include/wx/generic/grid.h +++ b/Externals/wxWidgets3/include/wx/generic/grid.h @@ -4,7 +4,7 @@ // Author: Michael Bedward (based on code by Julian Smart, Robin Dunn) // Modified by: Santiago Palacios // Created: 1/08/1999 -// RCS-ID: $Id: grid.h 65451 2010-08-30 22:18:52Z VZ $ +// RCS-ID: $Id: grid.h 70825 2012-03-06 10:23:44Z SC $ // Copyright: (c) Michael Bedward // Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// @@ -432,9 +432,9 @@ public: void SetKind(wxAttrKind kind) { m_attrkind = kind; } // accessors - bool HasTextColour() const { return m_colText.Ok(); } - bool HasBackgroundColour() const { return m_colBack.Ok(); } - bool HasFont() const { return m_font.Ok(); } + bool HasTextColour() const { return m_colText.IsOk(); } + bool HasBackgroundColour() const { return m_colBack.IsOk(); } + bool HasFont() const { return m_font.IsOk(); } bool HasAlignment() const { return m_hAlign != wxALIGN_INVALID || m_vAlign != wxALIGN_INVALID; @@ -1637,7 +1637,7 @@ public: // unset any existing sorting column void UnsetSortingColumn() { SetSortingColumn(wxNOT_FOUND); } -#ifdef WXWIN_COMPATIBILITY_2_8 +#if WXWIN_COMPATIBILITY_2_8 // ------ For compatibility with previous wxGrid only... // // ************************************************ @@ -2160,7 +2160,7 @@ private: // -------------------------------- // process mouse drag event in WXGRID_CURSOR_SELECT_CELL mode - void DoGridCellDrag(wxMouseEvent& event, + bool DoGridCellDrag(wxMouseEvent& event, const wxGridCellCoords& coords, bool isFirstDrag); diff --git a/Externals/wxWidgets3/include/wx/generic/gridctrl.h b/Externals/wxWidgets3/include/wx/generic/gridctrl.h index a14d98111c..2cc9859025 100644 --- a/Externals/wxWidgets3/include/wx/generic/gridctrl.h +++ b/Externals/wxWidgets3/include/wx/generic/gridctrl.h @@ -4,7 +4,7 @@ // Author: Paul Gammans, Roger Gammans // Modified by: // Created: 11/04/2001 -// RCS-ID: $Id: gridctrl.h 67254 2011-03-20 00:14:35Z DS $ +// RCS-ID: $Id: gridctrl.h 69856 2011-11-28 13:23:33Z VZ $ // Copyright: (c) The Computer Surgery (paul@compsurg.co.uk) // Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// @@ -81,13 +81,17 @@ protected: class WXDLLIMPEXP_ADV wxGridCellFloatRenderer : public wxGridCellStringRenderer { public: - wxGridCellFloatRenderer(int width = -1, int precision = -1); + wxGridCellFloatRenderer(int width = -1, + int precision = -1, + int format = wxGRID_FLOAT_FORMAT_DEFAULT); // get/change formatting parameters int GetWidth() const { return m_width; } void SetWidth(int width) { m_width = width; m_format.clear(); } int GetPrecision() const { return m_precision; } void SetPrecision(int precision) { m_precision = precision; m_format.clear(); } + int GetFormat() const { return m_style; } + void SetFormat(int format) { m_style = format; m_format.clear(); } // draw the string right aligned with given width/precision virtual void Draw(wxGrid& grid, @@ -102,7 +106,8 @@ public: wxDC& dc, int row, int col); - // parameters string format is "width[,precision]" + // parameters string format is "width[,precision[,format]]" + // with format being one of f|e|g|E|F|G virtual void SetParameters(const wxString& params); virtual wxGridCellRenderer *Clone() const; @@ -115,6 +120,7 @@ private: int m_width, m_precision; + int m_style; wxString m_format; }; diff --git a/Externals/wxWidgets3/include/wx/generic/grideditors.h b/Externals/wxWidgets3/include/wx/generic/grideditors.h index 006b66232d..c3309e0470 100644 --- a/Externals/wxWidgets3/include/wx/generic/grideditors.h +++ b/Externals/wxWidgets3/include/wx/generic/grideditors.h @@ -4,7 +4,7 @@ // Author: Michael Bedward (based on code by Julian Smart, Robin Dunn) // Modified by: Santiago Palacios // Created: 1/08/1999 -// RCS-ID: $Id: grideditors.h 61508 2009-07-23 20:30:22Z VZ $ +// RCS-ID: $Id: grideditors.h 70693 2012-02-25 23:49:55Z VZ $ // Copyright: (c) Michael Bedward // Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// @@ -154,11 +154,38 @@ private: wxDECLARE_NO_COPY_CLASS(wxGridCellNumberEditor); }; + +enum wxGridCellFloatFormat +{ + // Decimal floating point (%f) + wxGRID_FLOAT_FORMAT_FIXED = 0x0010, + + // Scientific notation (mantise/exponent) using e character (%e) + wxGRID_FLOAT_FORMAT_SCIENTIFIC = 0x0020, + + // Use the shorter of %e or %f (%g) + wxGRID_FLOAT_FORMAT_COMPACT = 0x0040, + + // To use in combination with one of the above formats (%F/%E/%G) + wxGRID_FLOAT_FORMAT_UPPER = 0x0080, + + // Format used by default. + wxGRID_FLOAT_FORMAT_DEFAULT = wxGRID_FLOAT_FORMAT_FIXED, + + // A mask to extract format from the combination of flags. + wxGRID_FLOAT_FORMAT_MASK = wxGRID_FLOAT_FORMAT_FIXED | + wxGRID_FLOAT_FORMAT_SCIENTIFIC | + wxGRID_FLOAT_FORMAT_COMPACT | + wxGRID_FLOAT_FORMAT_UPPER +}; + // the editor for floating point numbers (double) data class WXDLLIMPEXP_ADV wxGridCellFloatEditor : public wxGridCellTextEditor { public: - wxGridCellFloatEditor(int width = -1, int precision = -1); + wxGridCellFloatEditor(int width = -1, + int precision = -1, + int format = wxGRID_FLOAT_FORMAT_DEFAULT); virtual void Create(wxWindow* parent, wxWindowID id, @@ -176,18 +203,22 @@ public: virtual wxGridCellEditor *Clone() const { return new wxGridCellFloatEditor(m_width, m_precision); } - // parameters string format is "width,precision" + // parameters string format is "width[,precision[,format]]" + // format to choose beween f|e|g|E|G (f is used by default) virtual void SetParameters(const wxString& params); protected: // string representation of our value - wxString GetString() const; + wxString GetString(); private: int m_width, m_precision; double m_value; + int m_style; + wxString m_format; + wxDECLARE_NO_COPY_CLASS(wxGridCellFloatEditor); }; @@ -264,6 +295,8 @@ public: wxWindowID id, wxEvtHandler* evtHandler); + virtual void SetSize(const wxRect& rect); + virtual void PaintBackground(const wxRect& rectCell, wxGridCellAttr *attr); virtual void BeginEdit(int row, int col, wxGrid* grid); diff --git a/Externals/wxWidgets3/include/wx/generic/hyperlink.h b/Externals/wxWidgets3/include/wx/generic/hyperlink.h index 7a495ef09f..c834a7fd3b 100644 --- a/Externals/wxWidgets3/include/wx/generic/hyperlink.h +++ b/Externals/wxWidgets3/include/wx/generic/hyperlink.h @@ -4,7 +4,7 @@ // Author: David Norris , Otto Wyss // Modified by: Ryan Norton, Francesco Montorsi // Created: 04/02/2005 -// RCS-ID: $Id: hyperlink.h 65334 2010-08-17 16:55:32Z VZ $ +// RCS-ID: $Id: hyperlink.h 67948 2011-06-15 21:56:23Z VZ $ // Copyright: (c) 2005 David Norris // Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// @@ -75,6 +75,12 @@ protected: // Renders the hyperlink. void OnPaint(wxPaintEvent& event); + // Handle set/kill focus events (invalidate for painting focus rect) + void OnFocus(wxFocusEvent& event); + + // Fire a HyperlinkEvent on space + void OnChar(wxKeyEvent& event); + // Returns the wxRect of the label of this hyperlink. // This is different from the clientsize's rectangle when // clientsize != bestsize and this rectangle is influenced diff --git a/Externals/wxWidgets3/include/wx/generic/listctrl.h b/Externals/wxWidgets3/include/wx/generic/listctrl.h index 069be51688..19622cac39 100644 --- a/Externals/wxWidgets3/include/wx/generic/listctrl.h +++ b/Externals/wxWidgets3/include/wx/generic/listctrl.h @@ -3,7 +3,7 @@ // Purpose: Generic list control // Author: Robert Roebling // Created: 01/02/97 -// RCS-ID: $Id: listctrl.h 64884 2010-07-11 10:44:08Z VZ $ +// RCS-ID: $Id: listctrl.h 70282 2012-01-07 15:09:43Z VZ $ // Copyright: (c) 1998 Robert Roebling and Julian Smart // Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// @@ -14,8 +14,6 @@ #include "wx/scrolwin.h" #include "wx/textctrl.h" -class WXDLLIMPEXP_FWD_CORE wxImageList; - #if wxUSE_DRAG_AND_DROP class WXDLLIMPEXP_FWD_CORE wxDropTarget; #endif @@ -31,7 +29,7 @@ class WXDLLIMPEXP_FWD_CORE wxListMainWindow; // wxListCtrl //----------------------------------------------------------------------------- -class WXDLLIMPEXP_CORE wxGenericListCtrl: public wxControl, +class WXDLLIMPEXP_CORE wxGenericListCtrl: public wxListCtrlBase, public wxScrollHelper { public: @@ -66,7 +64,7 @@ public: const wxString &name = wxListCtrlNameStr); bool GetColumn( int col, wxListItem& item ) const; - bool SetColumn( int col, wxListItem& item ); + bool SetColumn( int col, const wxListItem& item ); int GetColumnWidth( int col ) const; bool SetColumnWidth( int col, int width); int GetCountPerPage() const; // not the same in wxGLC as in Windows, I think @@ -134,18 +132,9 @@ public: long InsertItem( long index, const wxString& label ); long InsertItem( long index, int imageIndex ); long InsertItem( long index, const wxString& label, int imageIndex ); - long InsertColumn( long col, wxListItem& info ); - long InsertColumn( long col, const wxString& heading, - int format = wxLIST_FORMAT_LEFT, int width = -1 ); bool ScrollList( int dx, int dy ); bool SortItems( wxListCtrlCompare fn, wxIntPtr data ); - // are we in report mode? - bool InReportView() const { return HasFlag(wxLC_REPORT); } - - // are we in virtual report mode? - bool IsVirtual() const { return HasFlag(wxLC_VIRTUAL); } - // do we have a header window? bool HasHeader() const { return InReportView() && !HasFlag(wxLC_NO_HEADER); } @@ -214,6 +203,10 @@ public: wxListMainWindow *m_mainWin; protected: + // Implement base class pure virtual methods. + long DoInsertColumn(long col, const wxListItem& info); + + virtual bool DoPopupMenu( wxMenu *menu, int x, int y ); // take into account the coordinates difference between the container diff --git a/Externals/wxWidgets3/include/wx/generic/logg.h b/Externals/wxWidgets3/include/wx/generic/logg.h index 2881dba02a..3ef9eacdc3 100644 --- a/Externals/wxWidgets3/include/wx/generic/logg.h +++ b/Externals/wxWidgets3/include/wx/generic/logg.h @@ -4,7 +4,7 @@ // Author: Vadim Zeitlin // Modified by: // Created: 29/01/98 -// RCS-ID: $Id: logg.h 61346 2009-07-08 13:47:33Z VZ $ +// RCS-ID: $Id: logg.h 67656 2011-04-30 10:57:04Z DS $ // Copyright: (c) 1998 Vadim Zeitlin // Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// @@ -104,7 +104,7 @@ private: // ---------------------------------------------------------------------------- // (background) log window: this class forwards all log messages to the log // target which was active when it was instantiated, but also collects them -// to the log window. This window has it's own menu which allows the user to +// to the log window. This window has its own menu which allows the user to // close it, clear the log contents or save it to the file. // ---------------------------------------------------------------------------- diff --git a/Externals/wxWidgets3/include/wx/generic/msgdlgg.h b/Externals/wxWidgets3/include/wx/generic/msgdlgg.h index aa9a95be13..73fe48b4a7 100644 --- a/Externals/wxWidgets3/include/wx/generic/msgdlgg.h +++ b/Externals/wxWidgets3/include/wx/generic/msgdlgg.h @@ -4,7 +4,7 @@ // Author: Julian Smart // Modified by: // Created: 01/02/97 -// RCS-ID: $Id: msgdlgg.h 65449 2010-08-30 21:48:21Z VZ $ +// RCS-ID: $Id: msgdlgg.h 68537 2011-08-04 22:53:42Z VZ $ // Copyright: (c) Julian Smart // Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// @@ -32,6 +32,7 @@ protected: void OnYes(wxCommandEvent& event); void OnNo(wxCommandEvent& event); + void OnHelp(wxCommandEvent& event); void OnCancel(wxCommandEvent& event); // can be overridden to provide more contents to the dialog diff --git a/Externals/wxWidgets3/include/wx/generic/notebook.h b/Externals/wxWidgets3/include/wx/generic/notebook.h index 0a2b3a4531..e2c405e7ab 100644 --- a/Externals/wxWidgets3/include/wx/generic/notebook.h +++ b/Externals/wxWidgets3/include/wx/generic/notebook.h @@ -3,7 +3,7 @@ // Purpose: wxNotebook class (a.k.a. property sheet, tabbed dialog) // Author: Julian Smart // Modified by: -// RCS-ID: $Id: notebook.h 67254 2011-03-20 00:14:35Z DS $ +// RCS-ID: $Id: notebook.h 68810 2011-08-21 14:08:49Z VZ $ // Copyright: (c) Julian Smart // Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// @@ -107,7 +107,7 @@ public: wxNotebookPage *pPage, const wxString& strText, bool bSelect = false, - int imageId = -1); + int imageId = NO_IMAGE); // callbacks // --------- diff --git a/Externals/wxWidgets3/include/wx/generic/panelg.h b/Externals/wxWidgets3/include/wx/generic/panelg.h index bd05855a1f..79dfe85c5c 100644 --- a/Externals/wxWidgets3/include/wx/generic/panelg.h +++ b/Externals/wxWidgets3/include/wx/generic/panelg.h @@ -4,7 +4,7 @@ // Author: Julian Smart // Modified by: // Created: 01/02/97 -// RCS-ID: $Id: panelg.h 67253 2011-03-20 00:00:49Z VZ $ +// RCS-ID: $Id: panelg.h 70098 2011-12-23 05:59:59Z PC $ // Copyright: (c) Julian Smart // Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// @@ -30,7 +30,7 @@ public: Create(parent, winid, pos, size, style, name); } -#ifdef WXWIN_COMPATIBILITY_2_8 +#if WXWIN_COMPATIBILITY_2_8 wxDEPRECATED_CONSTRUCTOR( wxPanel(wxWindow *parent, int x, int y, int width, int height, @@ -42,18 +42,7 @@ public: ) #endif // WXWIN_COMPATIBILITY_2_8 -protected: - virtual void DoSetBackgroundBitmap(const wxBitmap& bmp); - private: - // Event handler for erasing the background which is only used when we have - // a valid background bitmap. - void OnEraseBackground(wxEraseEvent& event); - - - // The bitmap used for painting the background if valid. - wxBitmap m_bitmapBg; - wxDECLARE_DYNAMIC_CLASS_NO_COPY(wxPanel); }; diff --git a/Externals/wxWidgets3/include/wx/generic/private/grid.h b/Externals/wxWidgets3/include/wx/generic/private/grid.h index f217481c3f..ab763a9c22 100644 --- a/Externals/wxWidgets3/include/wx/generic/private/grid.h +++ b/Externals/wxWidgets3/include/wx/generic/private/grid.h @@ -4,7 +4,7 @@ // Author: Michael Bedward (based on code by Julian Smart, Robin Dunn) // Modified by: Santiago Palacios // Created: 1/08/1999 -// RCS-ID: $Id: grid.h 66792 2011-01-27 18:35:01Z SC $ +// RCS-ID: $Id: grid.h 69861 2011-11-28 19:15:59Z VZ $ // Copyright: (c) Michael Bedward // Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// @@ -301,6 +301,8 @@ public: m_owner = owner; } + virtual wxWindow *GetMainWindowOfCompositeControl() { return m_owner; } + virtual bool AcceptsFocus() const { return false; } wxGrid *GetOwner() { return m_owner; } @@ -546,6 +548,11 @@ public: // implemented for the lines virtual int GetLineAt(const wxGrid *grid, int pos) const = 0; + // Return the display position of the line with the given index. + // + // NB: As GetLineAt(), currently this is always identity for rows. + virtual int GetLinePos(const wxGrid *grid, int line) const = 0; + // Return the index of the line just before the given one. virtual int GetLineBefore(const wxGrid* grid, int line) const = 0; @@ -613,7 +620,9 @@ public: virtual void SetDefaultLineSize(wxGrid *grid, int size, bool resizeExisting) const { grid->SetDefaultRowSize(size, resizeExisting); } - virtual int GetLineAt(const wxGrid * WXUNUSED(grid), int line) const + virtual int GetLineAt(const wxGrid * WXUNUSED(grid), int pos) const + { return pos; } // TODO: implement row reordering + virtual int GetLinePos(const wxGrid * WXUNUSED(grid), int line) const { return line; } // TODO: implement row reordering virtual int GetLineBefore(const wxGrid* WXUNUSED(grid), int line) const @@ -677,8 +686,10 @@ public: virtual void SetDefaultLineSize(wxGrid *grid, int size, bool resizeExisting) const { grid->SetDefaultColSize(size, resizeExisting); } - virtual int GetLineAt(const wxGrid *grid, int line) const - { return grid->GetColAt(line); } + virtual int GetLineAt(const wxGrid *grid, int pos) const + { return grid->GetColAt(pos); } + virtual int GetLinePos(const wxGrid *grid, int line) const + { return grid->GetColPos(line); } virtual int GetLineBefore(const wxGrid* grid, int line) const { return grid->GetColAt(wxMax(0, grid->GetColPos(line) - 1)); } @@ -691,7 +702,10 @@ public: // This class abstracts the difference between operations going forward // (down/right) and backward (up/left) and allows to use the same code for -// functions which differ only in the direction of grid traversal +// functions which differ only in the direction of grid traversal. +// +// Notice that all operations in this class work with display positions and not +// internal indices which can be different if the columns were reordered. // // Like wxGridOperations it's an ABC with two concrete subclasses below. Unlike // it, this is a normal object and not just a function dispatch table and has a @@ -720,6 +734,12 @@ public: // Find the line at the given distance, in pixels, away from this one // (this uses clipping, i.e. anything after the last line is counted as the // last one and anything before the first one as 0) + // + // TODO: Implementation of this method currently doesn't support column + // reordering as it mixes up indices and positions. But this doesn't + // really matter as it's only called for rows (Page Up/Down only work + // vertically) and row reordering is not currently supported. We'd + // need to fix it if this ever changes however. virtual int MoveByPixelDistance(int line, int distance) const = 0; // This class is never used polymorphically but give it a virtual dtor @@ -727,6 +747,28 @@ public: virtual ~wxGridDirectionOperations() { } protected: + // Get the position of the row or column from the given coordinates pair. + // + // This is just a shortcut to avoid repeating m_oper and m_grid multiple + // times in the derived classes code. + int GetLinePos(const wxGridCellCoords& coords) const + { + return m_oper.GetLinePos(m_grid, m_oper.Select(coords)); + } + + // Get the index of the row or column from the position. + int GetLineAt(int pos) const + { + return m_oper.GetLineAt(m_grid, pos); + } + + // Check if the given line is visible, i.e. has non 0 size. + bool IsLineVisible(int line) const + { + return m_oper.GetLineSize(m_grid, line) != 0; + } + + wxGrid * const m_grid; const wxGridOperations& m_oper; }; @@ -743,14 +785,38 @@ public: { wxASSERT_MSG( m_oper.Select(coords) >= 0, "invalid row/column" ); - return m_oper.Select(coords) == 0; + int pos = GetLinePos(coords); + while ( pos ) + { + // Check the previous line. + int line = GetLineAt(--pos); + if ( IsLineVisible(line) ) + { + // There is another visible line before this one, hence it's + // not at boundary. + return false; + } + } + + // We reached the boundary without finding any visible lines. + return true; } virtual void Advance(wxGridCellCoords& coords) const { - wxASSERT( !IsAtBoundary(coords) ); + int pos = GetLinePos(coords); + for ( ;; ) + { + // This is not supposed to happen if IsAtBoundary() returned false. + wxCHECK_RET( pos, "can't advance when already at boundary" ); - m_oper.Set(coords, m_oper.Select(coords) - 1); + int line = GetLineAt(--pos); + if ( IsLineVisible(line) ) + { + m_oper.Set(coords, line); + break; + } + } } virtual int MoveByPixelDistance(int line, int distance) const @@ -760,6 +826,8 @@ public: } }; +// Please refer to the comments above when reading this class code, it's +// absolutely symmetrical to wxGridBackwardOperations. class wxGridForwardOperations : public wxGridDirectionOperations { public: @@ -773,14 +841,32 @@ public: { wxASSERT_MSG( m_oper.Select(coords) < m_numLines, "invalid row/column" ); - return m_oper.Select(coords) == m_numLines - 1; + int pos = GetLinePos(coords); + while ( pos < m_numLines - 1 ) + { + int line = GetLineAt(++pos); + if ( IsLineVisible(line) ) + return false; + } + + return true; } virtual void Advance(wxGridCellCoords& coords) const { - wxASSERT( !IsAtBoundary(coords) ); + int pos = GetLinePos(coords); + for ( ;; ) + { + wxCHECK_RET( pos < m_numLines - 1, + "can't advance when already at boundary" ); - m_oper.Set(coords, m_oper.Select(coords) + 1); + int line = GetLineAt(++pos); + if ( IsLineVisible(line) ) + { + m_oper.Set(coords, line); + break; + } + } } virtual int MoveByPixelDistance(int line, int distance) const diff --git a/Externals/wxWidgets3/include/wx/generic/private/listctrl.h b/Externals/wxWidgets3/include/wx/generic/private/listctrl.h index e2a8de78cb..3d7838a883 100644 --- a/Externals/wxWidgets3/include/wx/generic/private/listctrl.h +++ b/Externals/wxWidgets3/include/wx/generic/private/listctrl.h @@ -3,7 +3,7 @@ // Purpose: private definitions of wxListCtrl helpers // Author: Robert Roebling // Vadim Zeitlin (virtual list control support) -// Id: $Id: listctrl.h 67254 2011-03-20 00:14:35Z DS $ +// Id: $Id: listctrl.h 70285 2012-01-07 15:09:54Z VZ $ // Copyright: (c) 1998 Robert Roebling // Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// @@ -402,6 +402,10 @@ public: wxTextCtrl *GetText() const { return m_text; } + // Check if the given key event should stop editing and return true if it + // does or false otherwise. + bool CheckForEndEditKey(const wxKeyEvent& event); + // Different reasons for calling EndEdit(): // // It was called because: @@ -557,6 +561,7 @@ public: // called to switch the selection from the current item to newCurrent, void OnArrowChar( size_t newCurrent, const wxKeyEvent& event ); + void OnCharHook( wxKeyEvent &event ); void OnChar( wxKeyEvent &event ); void OnKeyDown( wxKeyEvent &event ); void OnKeyUp( wxKeyEvent &event ); @@ -570,13 +575,12 @@ public: void DrawImage( int index, wxDC *dc, int x, int y ); void GetImageSize( int index, int &width, int &height ) const; - int GetTextLength( const wxString &s ) const; void SetImageList( wxImageList *imageList, int which ); void SetItemSpacing( int spacing, bool isSmall = false ); int GetItemSpacing( bool isSmall = false ); - void SetColumn( int col, wxListItem &item ); + void SetColumn( int col, const wxListItem &item ); void SetColumnWidth( int col, int width ); void GetColumn( int col, wxListItem &item ) const; int GetColumnWidth( int col ) const; @@ -640,7 +644,7 @@ public: long FindItem( const wxPoint& pt ); long HitTest( int x, int y, int &flags ) const; void InsertItem( wxListItem &item ); - void InsertColumn( long col, wxListItem &item ); + void InsertColumn( long col, const wxListItem &item ); int GetItemWidthWithImage(wxListItem * item); void SortItems( wxListCtrlCompare fn, wxIntPtr data ); @@ -788,6 +792,10 @@ private: // delete all items but don't refresh: called from dtor void DoDeleteAllItems(); + // Compute the minimal width needed to fully display the column header. + int ComputeMinHeaderWidth(const wxListHeaderData* header) const; + + // the height of one line using the current font wxCoord m_lineHeight; diff --git a/Externals/wxWidgets3/include/wx/generic/private/richtooltip.h b/Externals/wxWidgets3/include/wx/generic/private/richtooltip.h new file mode 100644 index 0000000000..0ca479dadb --- /dev/null +++ b/Externals/wxWidgets3/include/wx/generic/private/richtooltip.h @@ -0,0 +1,62 @@ +/////////////////////////////////////////////////////////////////////////////// +// Name: wx/generic/private/richtooltip.h +// Purpose: wxRichToolTipGenericImpl declaration. +// Author: Vadim Zeitlin +// Created: 2011-10-18 +// RCS-ID: $Id: richtooltip.h 69488 2011-10-20 16:20:19Z VZ $ +// Copyright: (c) 2011 Vadim Zeitlin +// Licence: wxWindows licence +/////////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_GENERIC_PRIVATE_RICHTOOLTIP_H_ +#define _GENERIC_PRIVATE_RICHTOOLTIP_H_ + +#include "wx/icon.h" +#include "wx/colour.h" + +// ---------------------------------------------------------------------------- +// wxRichToolTipGenericImpl: defines generic wxRichToolTip implementation. +// ---------------------------------------------------------------------------- + +class wxRichToolTipGenericImpl : public wxRichToolTipImpl +{ +public: + wxRichToolTipGenericImpl(const wxString& title, const wxString& message) : + m_title(title), + m_message(message) + { + m_tipKind = wxTipKind_Auto; + + // This is pretty arbitrary, we could follow MSW and use some multiple + // of double-click time here. + m_timeout = 5000; + } + + virtual void SetBackgroundColour(const wxColour& col, + const wxColour& colEnd); + virtual void SetCustomIcon(const wxIcon& icon); + virtual void SetStandardIcon(int icon); + virtual void SetTimeout(unsigned milliseconds); + virtual void SetTipKind(wxTipKind tipKind); + virtual void SetTitleFont(const wxFont& font); + + virtual void ShowFor(wxWindow* win); + +protected: + wxString m_title, + m_message; + +private: + wxIcon m_icon; + + wxColour m_colStart, + m_colEnd; + + unsigned m_timeout; + + wxTipKind m_tipKind; + + wxFont m_titleFont; +}; + +#endif // _WX_GENERIC_PRIVATE_RICHTOOLTIP_H_ diff --git a/Externals/wxWidgets3/include/wx/generic/prntdlgg.h b/Externals/wxWidgets3/include/wx/generic/prntdlgg.h index 1cd69143b1..e3317e1cc6 100644 --- a/Externals/wxWidgets3/include/wx/generic/prntdlgg.h +++ b/Externals/wxWidgets3/include/wx/generic/prntdlgg.h @@ -5,7 +5,7 @@ // Author: Julian Smart // Modified by: // Created: 01/02/97 -// RCS-ID: $Id: prntdlgg.h 67254 2011-03-20 00:14:35Z DS $ +// RCS-ID: $Id: prntdlgg.h 70636 2012-02-20 21:55:55Z VZ $ // Copyright: (c) Julian Smart // Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// @@ -34,7 +34,7 @@ class WXDLLIMPEXP_FWD_CORE wxCheckBox; class WXDLLIMPEXP_FWD_CORE wxComboBox; class WXDLLIMPEXP_FWD_CORE wxStaticText; class WXDLLIMPEXP_FWD_CORE wxRadioBox; -class WXDLLIMPEXP_FWD_CORE wxPageSetupData; +class WXDLLIMPEXP_FWD_CORE wxPageSetupDialogData; // ---------------------------------------------------------------------------- // constants diff --git a/Externals/wxWidgets3/include/wx/generic/progdlgg.h b/Externals/wxWidgets3/include/wx/generic/progdlgg.h index 518f43212b..38b69241db 100644 --- a/Externals/wxWidgets3/include/wx/generic/progdlgg.h +++ b/Externals/wxWidgets3/include/wx/generic/progdlgg.h @@ -4,7 +4,7 @@ // Author: Karsten Ballueder // Modified by: Francesco Montorsi // Created: 09.05.1999 -// RCS-ID: $Id: progdlgg.h 67254 2011-03-20 00:14:35Z DS $ +// RCS-ID: $Id: progdlgg.h 70512 2012-02-05 14:18:25Z VZ $ // Copyright: (c) Karsten Ballueder // Licence: wxWindows licence /////////////////////////////////////////////////////////////////////////////// @@ -27,6 +27,7 @@ class WXDLLIMPEXP_FWD_CORE wxWindowDisabler; class WXDLLIMPEXP_CORE wxGenericProgressDialog : public wxDialog { public: + wxGenericProgressDialog(); wxGenericProgressDialog(const wxString& title, const wxString& message, int maximum = 100, wxWindow *parent = NULL, @@ -34,6 +35,12 @@ public: virtual ~wxGenericProgressDialog(); + bool Create(const wxString& title, + const wxString& message, + int maximum = 100, + wxWindow *parent = NULL, + int style = wxPD_APP_MODAL | wxPD_AUTO_HIDE); + virtual bool Update(int value, const wxString& newmsg = wxEmptyString, bool *skip = NULL); virtual bool Pulse(const wxString& newmsg = wxEmptyString, bool *skip = NULL); @@ -67,15 +74,6 @@ public: }; protected: - // This ctor is used by the native MSW implementation only. - wxGenericProgressDialog(wxWindow *parent, int style); - - void Create(const wxString& title, - const wxString& message, - int maximum, - wxWindow *parent, - int style); - // Update just the m_maximum field, this is used by public SetRange() but, // unlike it, doesn't update the controls state. This makes it useful for // both this class and its derived classes that don't use m_gauge to @@ -95,7 +93,7 @@ protected: // Return the progress dialog style. Prefer to use HasPDFlag() if possible. int GetPDStyle() const { return m_pdStyle; } - + void SetPDStyle(int pdStyle) { m_pdStyle = pdStyle; } // Updates estimated times from a given progress bar value and stores the // results in provided arguments. @@ -123,6 +121,10 @@ protected: // the dialog was shown void ReenableOtherWindows(); + // Set the top level parent we store from the parent window provided when + // creating the dialog. + void SetTopParent(wxWindow* parent); + // return the top level parent window of this dialog (may be NULL) wxWindow *GetTopParent() const { return m_parentTop; } @@ -151,7 +153,7 @@ private: static void SetTimeLabel(unsigned long val, wxStaticText *label); // common part of all ctors - void Init(wxWindow *parent, int style); + void Init(); // create the label with given text and another one to show the time nearby // as the next windows in the sizer, returns the created control diff --git a/Externals/wxWidgets3/include/wx/generic/spinctlg.h b/Externals/wxWidgets3/include/wx/generic/spinctlg.h index 6115fce04e..36c777940e 100644 --- a/Externals/wxWidgets3/include/wx/generic/spinctlg.h +++ b/Externals/wxWidgets3/include/wx/generic/spinctlg.h @@ -4,7 +4,7 @@ // Author: Vadim Zeitlin // Modified by: // Created: 28.10.99 -// RCS-ID: $Id: spinctlg.h 67199 2011-03-15 11:10:38Z VZ $ +// RCS-ID: $Id: spinctlg.h 70432 2012-01-21 17:03:52Z VZ $ // Copyright: (c) Vadim Zeitlin // Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// @@ -81,7 +81,6 @@ public: // forward these functions to all subcontrols virtual bool Enable(bool enable = true); virtual bool Show(bool show = true); - virtual bool Reparent(wxWindowBase *newParent); #if wxUSE_TOOLTIPS virtual void DoSetToolTip(wxToolTip *tip); #endif // wxUSE_TOOLTIPS @@ -92,7 +91,7 @@ public: // forwarded events from children windows void OnSpinButton(wxSpinEvent& event); - void OnTextLostFocus(); + void OnTextLostFocus(wxFocusEvent& event); void OnTextChar(wxKeyEvent& event); // this window itself is used only as a container for its sub windows so it @@ -108,6 +107,11 @@ protected: virtual wxSize DoGetBestSize() const; virtual void DoMoveWindow(int x, int y, int width, int height); +#ifdef __WXMSW__ + // and, for MSW, enabling this window itself + virtual void DoEnable(bool enable); +#endif // __WXMSW__ + // generic double valued functions double DoGetValue() const { return m_value; } bool DoSetValue(double val); @@ -148,6 +152,8 @@ protected: private: // common part of all ctors void Init(); + + DECLARE_EVENT_TABLE() }; #else // !wxUSE_SPINBTN diff --git a/Externals/wxWidgets3/include/wx/generic/splash.h b/Externals/wxWidgets3/include/wx/generic/splash.h index a435975544..a98704a639 100644 --- a/Externals/wxWidgets3/include/wx/generic/splash.h +++ b/Externals/wxWidgets3/include/wx/generic/splash.h @@ -4,7 +4,7 @@ // Author: Julian Smart // Modified by: // Created: 28/6/2000 -// RCS-ID: $Id: splash.h 67254 2011-03-20 00:14:35Z DS $ +// RCS-ID: $Id: splash.h 69796 2011-11-22 13:18:55Z VZ $ // Copyright: (c) Julian Smart // Licence: wxWindows Licence ///////////////////////////////////////////////////////////////////////////// @@ -13,8 +13,9 @@ #define _WX_SPLASH_H_ #include "wx/bitmap.h" -#include "wx/timer.h" +#include "wx/eventfilter.h" #include "wx/frame.h" +#include "wx/timer.h" /* @@ -33,11 +34,12 @@ class WXDLLIMPEXP_FWD_ADV wxSplashScreenWindow; * wxSplashScreen */ -class WXDLLIMPEXP_ADV wxSplashScreen: public wxFrame +class WXDLLIMPEXP_ADV wxSplashScreen: public wxFrame, + public wxEventFilter { public: // for RTTI macros only - wxSplashScreen() {} + wxSplashScreen() { Init(); } wxSplashScreen(const wxBitmap& bitmap, long splashStyle, int milliseconds, wxWindow* parent, wxWindowID id, const wxPoint& pos = wxDefaultPosition, @@ -52,7 +54,13 @@ public: wxSplashScreenWindow* GetSplashWindow() const { return m_window; } int GetTimeout() const { return m_milliseconds; } + // Override wxEventFilter method to hide splash screen on any user input. + virtual int FilterEvent(wxEvent& event); + protected: + // Common part of all ctors. + void Init(); + wxSplashScreenWindow* m_window; long m_splashStyle; int m_milliseconds; @@ -74,8 +82,6 @@ public: void OnPaint(wxPaintEvent& event); void OnEraseBackground(wxEraseEvent& event); - void OnMouseEvent(wxMouseEvent& event); - void OnChar(wxKeyEvent& event); void SetBitmap(const wxBitmap& bitmap) { m_bitmap = bitmap; } wxBitmap& GetBitmap() { return m_bitmap; } diff --git a/Externals/wxWidgets3/include/wx/generic/splitter.h b/Externals/wxWidgets3/include/wx/generic/splitter.h index 00a6c88583..47bdebceed 100644 --- a/Externals/wxWidgets3/include/wx/generic/splitter.h +++ b/Externals/wxWidgets3/include/wx/generic/splitter.h @@ -4,7 +4,7 @@ // Author: Julian Smart // Modified by: // Created: 01/02/97 -// RCS-ID: $Id: splitter.h 67254 2011-03-20 00:14:35Z DS $ +// RCS-ID: $Id: splitter.h 70840 2012-03-08 13:23:39Z VZ $ // Copyright: (c) Julian Smart // Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// @@ -49,7 +49,7 @@ enum // to prevent flickering. (WS_CLIPCHILDREN doesn't work in all cases so can't be // standard). -class WXDLLIMPEXP_CORE wxSplitterWindow: public wxWindow +class WXDLLIMPEXP_CORE wxSplitterWindow: public wxNavigationEnabled { public: @@ -136,8 +136,14 @@ public: // Sets the border size void SetBorderSize(int WXUNUSED(width)) { } - // Gets the sash size + // Hide or show the sash and test whether it's currently hidden. + void SetSashInvisible(bool invisible = true); + bool IsSashInvisible() const { return HasFlag(wxSP_NOSASH); } + + // Gets the current sash size which may be 0 if it's hidden and the default + // sash size. int GetSashSize() const; + int GetDefaultSashSize() const; // Gets the border size int GetBorderSize() const; @@ -211,9 +217,6 @@ public: // Resizes subwindows virtual void SizeWindows(); - void SetNeedUpdating(bool needUpdating) { m_needUpdating = needUpdating; } - bool GetNeedUpdating() const { return m_needUpdating ; } - #ifdef __WXMAC__ virtual bool MacClipGrandChildren() const { return true ; } #endif @@ -297,11 +300,8 @@ protected: bool m_needUpdating:1; bool m_permitUnsplitAlways:1; bool m_isHot:1; - bool m_checkRequestedSashPosition:1; private: - WX_DECLARE_CONTROL_CONTAINER(); - DECLARE_DYNAMIC_CLASS(wxSplitterWindow) DECLARE_EVENT_TABLE() wxDECLARE_NO_COPY_CLASS(wxSplitterWindow); diff --git a/Externals/wxWidgets3/include/wx/generic/srchctlg.h b/Externals/wxWidgets3/include/wx/generic/srchctlg.h index 33af7b7631..864efcd142 100644 --- a/Externals/wxWidgets3/include/wx/generic/srchctlg.h +++ b/Externals/wxWidgets3/include/wx/generic/srchctlg.h @@ -3,7 +3,7 @@ // Purpose: generic wxSearchCtrl class // Author: Vince Harron // Created: 2006-02-19 -// RCS-ID: $Id: srchctlg.h 59269 2009-03-02 14:49:55Z VZ $ +// RCS-ID: $Id: srchctlg.h 68911 2011-08-27 12:13:23Z VZ $ // Copyright: Vince Harron // Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// @@ -191,6 +191,7 @@ public: // wxWindow overrides virtual bool SetFont(const wxFont& font); + virtual bool SetBackgroundColour(const wxColour& colour); // search control generic only void SetSearchBitmap( const wxBitmap& bitmap ); @@ -235,6 +236,9 @@ protected: private: friend class wxSearchButton; + // Implement pure virtual function inherited from wxCompositeWindow. + virtual wxWindowList GetCompositeWindowParts() const; + #if wxUSE_MENUS void PopupSearchMenu(); #endif // wxUSE_MENUS diff --git a/Externals/wxWidgets3/include/wx/generic/statbmpg.h b/Externals/wxWidgets3/include/wx/generic/statbmpg.h index f62acc721c..930e3943b9 100644 --- a/Externals/wxWidgets3/include/wx/generic/statbmpg.h +++ b/Externals/wxWidgets3/include/wx/generic/statbmpg.h @@ -3,7 +3,7 @@ // Purpose: wxGenericStaticBitmap header // Author: Marcin Wojdyr, Stefan Csomor // Created: 2008-06-16 -// RCS-ID: $Id: statbmpg.h 61724 2009-08-21 10:41:26Z VZ $ +// RCS-ID: $Id: statbmpg.h 67681 2011-05-03 16:29:04Z DS $ // Copyright: wxWidgets developers // Licence: wxWindows licence /////////////////////////////////////////////////////////////////////////////// @@ -61,7 +61,7 @@ public: private: wxSize GetBitmapSize() { - return m_bitmap.Ok() ? wxSize(m_bitmap.GetWidth(), m_bitmap.GetHeight()) + return m_bitmap.IsOk() ? wxSize(m_bitmap.GetWidth(), m_bitmap.GetHeight()) : wxSize(16, 16); // this is completely arbitrary } diff --git a/Externals/wxWidgets3/include/wx/generic/statusbr.h b/Externals/wxWidgets3/include/wx/generic/statusbr.h index 0f5511235b..dc2a3f88a4 100644 --- a/Externals/wxWidgets3/include/wx/generic/statusbr.h +++ b/Externals/wxWidgets3/include/wx/generic/statusbr.h @@ -4,7 +4,7 @@ // Author: Julian Smart // Modified by: VZ at 05.02.00 to derive from wxStatusBarBase // Created: 01/02/97 -// RCS-ID: $Id: statusbr.h 61624 2009-08-06 00:01:43Z VZ $ +// RCS-ID: $Id: statusbr.h 67384 2011-04-03 20:31:32Z DS $ // Copyright: (c) Julian Smart // Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// @@ -81,7 +81,7 @@ protected: virtual void InitColours(); // true if the status bar shows the size grip: for this it must have - // wxSTB_SIZEGRIP style and the window it is attached to must be resizeable + // wxSTB_SIZEGRIP style and the window it is attached to must be resizable // and not maximized bool ShowsSizeGrip() const; diff --git a/Externals/wxWidgets3/include/wx/generic/tabg.h b/Externals/wxWidgets3/include/wx/generic/tabg.h index e7f07fcbf5..ea21a32a6d 100644 --- a/Externals/wxWidgets3/include/wx/generic/tabg.h +++ b/Externals/wxWidgets3/include/wx/generic/tabg.h @@ -4,7 +4,7 @@ // Author: Julian Smart // Modified by: // Created: 01/02/97 -// RCS-ID: $Id: tabg.h 67254 2011-03-20 00:14:35Z DS $ +// RCS-ID: $Id: tabg.h 70165 2011-12-29 14:42:13Z SN $ // Copyright: (c) Julian Smart // Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// @@ -130,7 +130,7 @@ public: // Called when a tab is activated virtual void OnTabActivate(int activateId, int deactivateId); // Allows vetoing - virtual bool OnTabPreActivate(int WXUNUSED(activateId), int WXUNUSED(deactivateId) ) { return true; }; + virtual bool OnTabPreActivate(int WXUNUSED(activateId), int WXUNUSED(deactivateId) ) { return true; } // Allows use of application-supplied wxTabControl classes. virtual wxTabControl *OnCreateTabControl(void) { return new wxTabControl(this); } diff --git a/Externals/wxWidgets3/include/wx/generic/timectrl.h b/Externals/wxWidgets3/include/wx/generic/timectrl.h new file mode 100644 index 0000000000..c04ab8f254 --- /dev/null +++ b/Externals/wxWidgets3/include/wx/generic/timectrl.h @@ -0,0 +1,70 @@ +/////////////////////////////////////////////////////////////////////////////// +// Name: wx/generic/timectrl.h +// Purpose: Generic implementation of wxTimePickerCtrl. +// Author: Paul Breen, Vadim Zeitlin +// Created: 2011-09-22 +// RCS-ID: $Id: timectrl.h 69489 2011-10-20 16:45:48Z VZ $ +// Copyright: (c) 2011 Vadim Zeitlin +// Licence: wxWindows licence +/////////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_GENERIC_TIMECTRL_H_ +#define _WX_GENERIC_TIMECTRL_H_ + +#include "wx/containr.h" +#include "wx/compositewin.h" + +class WXDLLIMPEXP_ADV wxTimePickerCtrlGeneric + : public wxCompositeWindow< wxNavigationEnabled > +{ +public: + typedef wxCompositeWindow< wxNavigationEnabled > Base; + + // Creating the control. + wxTimePickerCtrlGeneric() { Init(); } + virtual ~wxTimePickerCtrlGeneric(); + wxTimePickerCtrlGeneric(wxWindow *parent, + wxWindowID id, + const wxDateTime& date = wxDefaultDateTime, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + long style = wxTP_DEFAULT, + const wxValidator& validator = wxDefaultValidator, + const wxString& name = wxTimePickerCtrlNameStr) + { + Init(); + + (void)Create(parent, id, date, pos, size, style, validator, name); + } + + bool Create(wxWindow *parent, + wxWindowID id, + const wxDateTime& date = wxDefaultDateTime, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + long style = wxTP_DEFAULT, + const wxValidator& validator = wxDefaultValidator, + const wxString& name = wxTimePickerCtrlNameStr); + + // Implement pure virtual wxTimePickerCtrlBase methods. + virtual void SetValue(const wxDateTime& date); + virtual wxDateTime GetValue() const; + +protected: + virtual wxSize DoGetBestSize() const; + + virtual void DoMoveWindow(int x, int y, int width, int height); + +private: + void Init(); + + // Return the list of the windows composing this one. + virtual wxWindowList GetCompositeWindowParts() const; + + // Implementation data. + class wxTimePickerGenericImpl* m_impl; + + wxDECLARE_NO_COPY_CLASS(wxTimePickerCtrlGeneric); +}; + +#endif // _WX_GENERIC_TIMECTRL_H_ diff --git a/Externals/wxWidgets3/include/wx/geometry.h b/Externals/wxWidgets3/include/wx/geometry.h index 5ece43eb50..d8981c5756 100644 --- a/Externals/wxWidgets3/include/wx/geometry.h +++ b/Externals/wxWidgets3/include/wx/geometry.h @@ -4,7 +4,7 @@ // Author: Stefan Csomor // Modified by: // Created: 08/05/99 -// RCS-ID: $Id: geometry.h 59019 2009-02-19 07:36:27Z PC $ +// RCS-ID: $Id: geometry.h 70493 2012-01-31 19:39:43Z VZ $ // Copyright: (c) 1999 Stefan Csomor // Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// @@ -88,12 +88,9 @@ inline wxPoint2DInt operator+(const wxPoint2DInt& pt1 , const wxPoint2DInt& pt2) inline wxPoint2DInt operator-(const wxPoint2DInt& pt1 , const wxPoint2DInt& pt2); inline wxPoint2DInt operator*(const wxPoint2DInt& pt1 , const wxPoint2DInt& pt2); inline wxPoint2DInt operator*(wxInt32 n , const wxPoint2DInt& pt); -inline wxPoint2DInt operator*(wxInt32 n , const wxPoint2DInt& pt); -inline wxPoint2DInt operator*(const wxPoint2DInt& pt , wxInt32 n); inline wxPoint2DInt operator*(const wxPoint2DInt& pt , wxInt32 n); inline wxPoint2DInt operator/(const wxPoint2DInt& pt1 , const wxPoint2DInt& pt2); inline wxPoint2DInt operator/(const wxPoint2DInt& pt , wxInt32 n); -inline wxPoint2DInt operator/(const wxPoint2DInt& pt , wxInt32 n); inline wxPoint2DInt::wxPoint2DInt() { @@ -534,8 +531,8 @@ public: inline wxSize GetSize() { return wxSize((int) m_width, (int) m_height); } - // for the edge and corner accessors there are two setters conterparts, the Set.. functions keep the other corners at their - // position whenever sensible, the Move.. functions keep the size of the rect and move the other corners apropriately + // for the edge and corner accessors there are two setters counterparts, the Set.. functions keep the other corners at their + // position whenever sensible, the Move.. functions keep the size of the rect and move the other corners appropriately inline wxDouble GetLeft() const { return m_x; } inline void SetLeft( wxDouble n ) { m_width += m_x - n; m_x = n; } @@ -661,8 +658,8 @@ public: inline wxPoint2DInt GetPosition() { return wxPoint2DInt(m_x, m_y); } inline wxSize GetSize() { return wxSize(m_width, m_height); } - // for the edge and corner accessors there are two setters conterparts, the Set.. functions keep the other corners at their - // position whenever sensible, the Move.. functions keep the size of the rect and move the other corners apropriately + // for the edge and corner accessors there are two setters counterparts, the Set.. functions keep the other corners at their + // position whenever sensible, the Move.. functions keep the size of the rect and move the other corners appropriately inline wxInt32 GetLeft() const { return m_x; } inline void SetLeft( wxInt32 n ) { m_width += m_x - n; m_x = n; } diff --git a/Externals/wxWidgets3/include/wx/glcanvas.h b/Externals/wxWidgets3/include/wx/glcanvas.h index b45a96ffd6..c0ae3dbdf9 100644 --- a/Externals/wxWidgets3/include/wx/glcanvas.h +++ b/Externals/wxWidgets3/include/wx/glcanvas.h @@ -5,7 +5,7 @@ // Modified by: // Created: // Copyright: (c) Julian Smart -// RCS-ID: $Id: glcanvas.h 66088 2010-11-10 13:52:04Z VZ $ +// RCS-ID: $Id: glcanvas.h 70165 2011-12-29 14:42:13Z SN $ // Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// @@ -49,7 +49,7 @@ enum WX_GL_MIN_ACCUM_BLUE, // use blue buffer with most bits (> MIN_ACCUM_BLUE bits) WX_GL_MIN_ACCUM_ALPHA, // use alpha buffer with most bits (> MIN_ACCUM_ALPHA bits) WX_GL_SAMPLE_BUFFERS, // 1 for multisampling support (antialiasing) - WX_GL_SAMPLES // 4 for 2x2 antialising supersampling on most graphics cards + WX_GL_SAMPLES // 4 for 2x2 antialiasing supersampling on most graphics cards }; #define wxGLCanvasName wxT("GLCanvas") @@ -143,7 +143,7 @@ public: #ifdef __WXUNIVERSAL__ // resolve the conflict with wxWindowUniv::SetCurrent() - virtual bool SetCurrent(bool doit) { return wxWindow::SetCurrent(doit); }; + virtual bool SetCurrent(bool doit) { return wxWindow::SetCurrent(doit); } #endif protected: diff --git a/Externals/wxWidgets3/include/wx/graphics.h b/Externals/wxWidgets3/include/wx/graphics.h index 64b62bd7d7..0b2420faa8 100644 --- a/Externals/wxWidgets3/include/wx/graphics.h +++ b/Externals/wxWidgets3/include/wx/graphics.h @@ -5,7 +5,7 @@ // Modified by: // Created: // Copyright: (c) Stefan Csomor -// RCS-ID: $Id: graphics.h 66514 2011-01-01 11:10:35Z SC $ +// RCS-ID: $Id: graphics.h 69485 2011-10-20 04:49:12Z RD $ // Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// @@ -19,12 +19,27 @@ #include "wx/geometry.h" #include "wx/dynarray.h" #include "wx/dc.h" +#include "wx/image.h" #include "wx/vector.h" enum wxAntialiasMode { wxANTIALIAS_NONE, // should be 0 - wxANTIALIAS_DEFAULT, + wxANTIALIAS_DEFAULT +}; + +enum wxInterpolationQuality +{ + // default interpolation + wxINTERPOLATION_DEFAULT, + // no interpolation + wxINTERPOLATION_NONE, + // fast interpolation, suited for interactivity + wxINTERPOLATION_FAST, + // better quality + wxINTERPOLATION_GOOD, + // best quality, not suited for interactivity + wxINTERPOLATION_BEST }; enum wxCompositionMode @@ -35,6 +50,7 @@ enum wxCompositionMode // classic Porter-Duff compositions // http://keithp.com/~keithp/porterduff/p253-porter.pdf + wxCOMPOSITION_INVALID = -1, /* indicates invalid/unsupported mode */ wxCOMPOSITION_CLEAR, /* R = 0 */ wxCOMPOSITION_SOURCE, /* R = S */ wxCOMPOSITION_OVER, /* R = S + D*(1 - Sa) */ @@ -50,7 +66,7 @@ enum wxCompositionMode wxCOMPOSITION_XOR, /* R = S*(1 - Da) + D*(1 - Sa) */ // mathematical compositions - wxCOMPOSITION_ADD, /* R = S + D */ + wxCOMPOSITION_ADD /* R = S + D */ }; class WXDLLIMPEXP_FWD_CORE wxWindowDC; @@ -151,6 +167,14 @@ class WXDLLIMPEXP_CORE wxGraphicsBitmap : public wxGraphicsObject public: wxGraphicsBitmap() {} virtual ~wxGraphicsBitmap() {} + + // Convert bitmap to wxImage: this is more efficient than converting to + // wxBitmap first and then to wxImage and also works without X server + // connection under Unix that wxBitmap requires. +#if wxUSE_IMAGE + wxImage ConvertToImage() const; +#endif // wxUSE_IMAGE + private: DECLARE_DYNAMIC_CLASS(wxGraphicsBitmap) }; @@ -410,6 +434,13 @@ public: static wxGraphicsContext* Create( wxWindow* window ); +#if wxUSE_IMAGE + // Create a context for drawing onto a wxImage. The image life time must be + // greater than that of the context itself as when the context is destroyed + // it will copy its contents to the specified image. + static wxGraphicsContext* Create(wxImage& image); +#endif // wxUSE_IMAGE + // create a context that can be used for measuring texts only, no drawing allowed static wxGraphicsContext * Create(); @@ -459,11 +490,18 @@ public: wxDouble xc, wxDouble yc, wxDouble radius, const wxGraphicsGradientStops& stops) const; - // sets the font + // creates a font virtual wxGraphicsFont CreateFont( const wxFont &font , const wxColour &col = *wxBLACK ) const; + virtual wxGraphicsFont CreateFont(double sizeInPixels, + const wxString& facename, + int flags = wxFONTFLAG_DEFAULT, + const wxColour& col = *wxBLACK) const; // create a native bitmap representation virtual wxGraphicsBitmap CreateBitmap( const wxBitmap &bitmap ) const; +#if wxUSE_IMAGE + wxGraphicsBitmap CreateBitmapFromImage(const wxImage& image) const; +#endif // wxUSE_IMAGE // create a native bitmap representation virtual wxGraphicsBitmap CreateSubBitmap( const wxGraphicsBitmap &bitmap, wxDouble x, wxDouble y, wxDouble w, wxDouble h ) const; @@ -496,6 +534,12 @@ public: // sets the antialiasing mode, returns true if it supported virtual bool SetAntialiasMode(wxAntialiasMode antialias) = 0; + // returns the current interpolation quality + virtual wxInterpolationQuality GetInterpolationQuality() const { return m_interpolation; } + + // sets the interpolation quality, returns true if it supported + virtual bool SetInterpolationQuality(wxInterpolationQuality interpolation) = 0; + // returns the current compositing operator virtual wxCompositionMode GetCompositionMode() const { return m_composition; } @@ -503,7 +547,13 @@ public: virtual bool SetCompositionMode(wxCompositionMode op) = 0; // returns the size of the graphics context in device coordinates - virtual void GetSize( wxDouble* width, wxDouble* height); + void GetSize(wxDouble* width, wxDouble* height) + { + if ( width ) + *width = m_width; + if ( height ) + *height = m_height; + } // returns the resolution of the graphics context in device points per inch virtual void GetDPI( wxDouble* dpiX, wxDouble* dpiY); @@ -636,14 +686,26 @@ public: // helper to determine if a 0.5 offset should be applied for the drawing operation virtual bool ShouldOffset() const { return false; } - + + // indicates whether the context should try to offset for pixel boundaries, this only makes sense on + // bitmap devices like screen, by default this is turned off + virtual void EnableOffset(bool enable = true); + + void DisableOffset() { EnableOffset(false); } + bool OffsetEnabled() { return m_enableOffset; } + protected: + // These fields must be initialized in the derived class ctors. + wxDouble m_width, + m_height; wxGraphicsPen m_pen; wxGraphicsBrush m_brush; wxGraphicsFont m_font; wxAntialiasMode m_antialias; wxCompositionMode m_composition; + wxInterpolationQuality m_interpolation; + bool m_enableOffset; protected: // implementations of overloaded public functions: we use different names @@ -733,6 +795,10 @@ public: virtual wxGraphicsContext * CreateContext( wxWindow* window ) = 0; +#if wxUSE_IMAGE + virtual wxGraphicsContext * CreateContextFromImage(wxImage& image) = 0; +#endif // wxUSE_IMAGE + // create a context that can be used for measuring texts only, no drawing allowed virtual wxGraphicsContext * CreateMeasuringContext() = 0; @@ -767,9 +833,17 @@ public: // sets the font virtual wxGraphicsFont CreateFont( const wxFont &font , const wxColour &col = *wxBLACK ) = 0; + virtual wxGraphicsFont CreateFont(double sizeInPixels, + const wxString& facename, + int flags = wxFONTFLAG_DEFAULT, + const wxColour& col = *wxBLACK) = 0; // create a native bitmap representation virtual wxGraphicsBitmap CreateBitmap( const wxBitmap &bitmap ) = 0; +#if wxUSE_IMAGE + virtual wxGraphicsBitmap CreateBitmapFromImage(const wxImage& image) = 0; + virtual wxImage CreateImageFromBitmap(const wxGraphicsBitmap& bmp) = 0; +#endif // wxUSE_IMAGE // create a graphics bitmap from a native bitmap virtual wxGraphicsBitmap CreateBitmapFromNativeBitmap( void* bitmap ) = 0; @@ -782,6 +856,16 @@ private: DECLARE_ABSTRACT_CLASS(wxGraphicsRenderer) }; -#endif + +#if wxUSE_IMAGE +inline +wxImage wxGraphicsBitmap::ConvertToImage() const +{ + wxGraphicsRenderer* renderer = GetRenderer(); + return renderer ? renderer->CreateImageFromBitmap(*this) : wxNullImage; +} +#endif // wxUSE_IMAGE + +#endif // wxUSE_GRAPHICS_CONTEXT #endif // _WX_GRAPHICS_H_ diff --git a/Externals/wxWidgets3/include/wx/gtk/animate.h b/Externals/wxWidgets3/include/wx/gtk/animate.h index 7dc5e96b6c..b48fb3a543 100644 --- a/Externals/wxWidgets3/include/wx/gtk/animate.h +++ b/Externals/wxWidgets3/include/wx/gtk/animate.h @@ -4,7 +4,7 @@ // Author: Julian Smart and Guillermo Rodriguez Garcia // Modified by: Francesco Montorsi // Created: 13/8/99 -// RCS-ID: $Id: animate.h 53629 2008-05-17 22:51:52Z VZ $ +// RCS-ID: $Id: animate.h 70520 2012-02-05 22:53:39Z SN $ // Copyright: (c) Julian Smart and Guillermo Rodriguez Garcia // Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// diff --git a/Externals/wxWidgets3/include/wx/gtk/anybutton.h b/Externals/wxWidgets3/include/wx/gtk/anybutton.h new file mode 100644 index 0000000000..7dee3e096d --- /dev/null +++ b/Externals/wxWidgets3/include/wx/gtk/anybutton.h @@ -0,0 +1,81 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/gtk/anybutton.h +// Purpose: wxGTK wxAnyButton class declaration +// Author: Robert Roebling +// Created: 1998-05-20 (extracted from button.h) +// Id: $Id: anybutton.h 67931 2011-06-14 13:00:42Z VZ $ +// Copyright: (c) 1998 Robert Roebling +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_GTK_ANYBUTTON_H_ +#define _WX_GTK_ANYBUTTON_H_ + +//----------------------------------------------------------------------------- +// wxAnyButton +//----------------------------------------------------------------------------- + +class WXDLLIMPEXP_CORE wxAnyButton : public wxAnyButtonBase +{ +public: + wxAnyButton() + { + m_isCurrent = + m_isPressed = false; + } + + virtual bool Enable( bool enable = true ); + + // implementation + // -------------- + + static wxVisualAttributes + GetClassDefaultAttributes(wxWindowVariant variant = wxWINDOW_VARIANT_NORMAL); + + // called from GTK callbacks: they update the button state and call + // GTKUpdateBitmap() + void GTKMouseEnters(); + void GTKMouseLeaves(); + void GTKPressed(); + void GTKReleased(); + +protected: + virtual GdkWindow *GTKGetWindow(wxArrayGdkWindows& windows) const; + + virtual wxBitmap DoGetBitmap(State which) const; + virtual void DoSetBitmap(const wxBitmap& bitmap, State which); + virtual void DoSetBitmapPosition(wxDirection dir); + +private: + typedef wxAnyButtonBase base_type; + + // focus event handler: calls GTKUpdateBitmap() + void GTKOnFocus(wxFocusEvent& event); + + // update the bitmap to correspond to the current button state + void GTKUpdateBitmap(); + + // return the current button state from m_isXXX flags (which means that it + // might not correspond to the real current state as e.g. m_isCurrent will + // never be true if we don't have a valid current bitmap) + State GTKGetCurrentState() const; + + // show the given bitmap (must be valid) + void GTKDoShowBitmap(const wxBitmap& bitmap); + + + // the bitmaps for the different state of the buttons, all of them may be + // invalid and the button only shows a bitmap at all if State_Normal bitmap + // is valid + wxBitmap m_bitmaps[State_Max]; + + // true iff mouse is currently over the button + bool m_isCurrent; + + // true iff the button is in pressed state + bool m_isPressed; + + wxDECLARE_NO_COPY_CLASS(wxAnyButton); +}; + +#endif // _WX_GTK_ANYBUTTON_H_ diff --git a/Externals/wxWidgets3/include/wx/gtk/app.h b/Externals/wxWidgets3/include/wx/gtk/app.h index c7ed113db6..00028aca9d 100644 --- a/Externals/wxWidgets3/include/wx/gtk/app.h +++ b/Externals/wxWidgets3/include/wx/gtk/app.h @@ -2,7 +2,7 @@ // Name: wx/gtk/app.h // Purpose: wxApp definition for wxGTK // Author: Robert Roebling -// Id: $Id: app.h 63091 2010-01-07 18:30:18Z PC $ +// Id: $Id: app.h 69020 2011-09-07 16:56:50Z PC $ // Copyright: (c) 1998 Robert Roebling, Julian Smart // Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// @@ -75,7 +75,7 @@ private: #if wxUSE_THREADS wxMutex m_idleMutex; #endif - guint m_idleSourceId; + unsigned m_idleSourceId; #if wxUSE_LIBHILDON || wxUSE_LIBHILDON2 HildonProgram *m_hildonProgram; diff --git a/Externals/wxWidgets3/include/wx/gtk/assertdlg_gtk.h b/Externals/wxWidgets3/include/wx/gtk/assertdlg_gtk.h index 35b2b82be3..91197215b6 100644 --- a/Externals/wxWidgets3/include/wx/gtk/assertdlg_gtk.h +++ b/Externals/wxWidgets3/include/wx/gtk/assertdlg_gtk.h @@ -2,19 +2,13 @@ // Name: wx/gtk/assertdlg_gtk.h // Purpose: GtkAssertDialog // Author: Francesco Montorsi -// Id: $Id: assertdlg_gtk.h 67254 2011-03-20 00:14:35Z DS $ +// Id: $Id: assertdlg_gtk.h 67338 2011-03-30 05:35:24Z PC $ // Copyright: (c) 2006 Francesco Montorsi // Licence: wxWindows licence /////////////////////////////////////////////////////////////////////////// */ -#ifndef __GTK_ASSERTDLG_H__ -#define __GTK_ASSERTDLG_H__ - -#ifdef __cplusplus -extern "C" { -#endif /* __cplusplus */ - -#include +#ifndef _WX_GTK_ASSERTDLG_H_ +#define _WX_GTK_ASSERTDLG_H_ #define GTK_TYPE_ASSERT_DIALOG (gtk_assert_dialog_get_type ()) #define GTK_ASSERT_DIALOG(object) (G_TYPE_CHECK_INSTANCE_CAST ((object), GTK_TYPE_ASSERT_DIALOG, GtkAssertDialog)) @@ -82,10 +76,4 @@ void gtk_assert_dialog_append_stack_frame(GtkAssertDialog *dlg, const gchar *sourcefile, guint line_number); -#ifdef __cplusplus -} -#endif /* __cplusplus */ - -#endif /* __GTK_ASSERTDLG_H__ */ - - +#endif /* _WX_GTK_ASSERTDLG_H_ */ diff --git a/Externals/wxWidgets3/include/wx/gtk/bitmap.h b/Externals/wxWidgets3/include/wx/gtk/bitmap.h index c82ef8a1cb..a6e6634320 100644 --- a/Externals/wxWidgets3/include/wx/gtk/bitmap.h +++ b/Externals/wxWidgets3/include/wx/gtk/bitmap.h @@ -2,7 +2,7 @@ // Name: wx/gtk/bitmap.h // Purpose: // Author: Robert Roebling -// RCS-ID: $Id: bitmap.h 63774 2010-03-28 23:20:49Z VZ $ +// RCS-ID: $Id: bitmap.h 70165 2011-12-29 14:42:13Z SN $ // Copyright: (c) 1998 Robert Roebling // Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// @@ -30,8 +30,8 @@ public: virtual ~wxMask(); // implementation - GdkBitmap *m_bitmap; - GdkBitmap *GetBitmap() const; + GdkPixmap* m_bitmap; + GdkPixmap* GetBitmap() const; protected: virtual void FreeData(); @@ -94,7 +94,7 @@ public: #if wxUSE_PALETTE wxPalette *GetPalette() const; void SetPalette(const wxPalette& palette); - wxPalette *GetColourMap() const { return GetPalette(); }; + wxPalette *GetColourMap() const { return GetPalette(); } #endif // wxUSE_PALETTE static void InitStandardHandlers(); diff --git a/Externals/wxWidgets3/include/wx/gtk/button.h b/Externals/wxWidgets3/include/wx/gtk/button.h index 9be049b5ef..6b8988ed7e 100644 --- a/Externals/wxWidgets3/include/wx/gtk/button.h +++ b/Externals/wxWidgets3/include/wx/gtk/button.h @@ -2,7 +2,7 @@ // Name: wx/gtk/button.h // Purpose: wxGTK wxButton class declaration // Author: Robert Roebling -// Id: $Id: button.h 67066 2011-02-27 12:48:30Z VZ $ +// Id: $Id: button.h 67931 2011-06-14 13:00:42Z VZ $ // Copyright: (c) 1998 Robert Roebling // Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// @@ -17,7 +17,7 @@ class WXDLLIMPEXP_CORE wxButton : public wxButtonBase { public: - wxButton() { Init(); } + wxButton() {} wxButton(wxWindow *parent, wxWindowID id, const wxString& label = wxEmptyString, const wxPoint& pos = wxDefaultPosition, @@ -25,8 +25,6 @@ public: const wxValidator& validator = wxDefaultValidator, const wxString& name = wxButtonNameStr) { - Init(); - Create(parent, id, label, pos, size, style, validator, name); } @@ -39,7 +37,6 @@ public: virtual wxWindow *SetDefault(); virtual void SetLabel( const wxString &label ); - virtual bool Enable( bool enable = true ); // implementation // -------------- @@ -61,12 +58,6 @@ protected: virtual wxSize DoGetBestSize() const; virtual void DoApplyWidgetStyle(GtkRcStyle *style); - virtual GdkWindow *GTKGetWindow(wxArrayGdkWindows& windows) const; - - virtual wxBitmap DoGetBitmap(State which) const; - virtual void DoSetBitmap(const wxBitmap& bitmap, State which); - virtual void DoSetBitmapPosition(wxDirection dir); - #if wxUSE_MARKUP virtual bool DoSetLabelMarkup(const wxString& markup); #endif // wxUSE_MARKUP @@ -74,42 +65,9 @@ protected: private: typedef wxButtonBase base_type; - // common part of all ctors - void Init() - { - m_isCurrent = - m_isPressed = false; - } - - // focus event handler: calls GTKUpdateBitmap() - void GTKOnFocus(wxFocusEvent& event); - - // update the bitmap to correspond to the current button state - void GTKUpdateBitmap(); - - // return the current button state from m_isXXX flags (which means that it - // might not correspond to the real current state as e.g. m_isCurrent will - // never be true if we don't have a valid current bitmap) - State GTKGetCurrentState() const; - - // show the given bitmap (must be valid) - void GTKDoShowBitmap(const wxBitmap& bitmap); - // Return the GtkLabel used by this button. GtkLabel *GTKGetLabel() const; - - // the bitmaps for the different state of the buttons, all of them may be - // invalid and the button only shows a bitmap at all if State_Normal bitmap - // is valid - wxBitmap m_bitmaps[State_Max]; - - // true iff mouse is currently over the button - bool m_isCurrent; - - // true iff the button is in pressed state - bool m_isPressed; - DECLARE_DYNAMIC_CLASS(wxButton) }; diff --git a/Externals/wxWidgets3/include/wx/gtk/calctrl.h b/Externals/wxWidgets3/include/wx/gtk/calctrl.h index 9b2a10d1df..a0cab6253f 100644 --- a/Externals/wxWidgets3/include/wx/gtk/calctrl.h +++ b/Externals/wxWidgets3/include/wx/gtk/calctrl.h @@ -2,7 +2,7 @@ // Name: wx/gtk/calctrl.h // Purpose: wxGtkCalendarCtrl control // Author: Marcin Wojdyr -// RCS-ID: $Id: calctrl.h 58757 2009-02-08 11:45:59Z VZ $ +// RCS-ID: $Id: calctrl.h 67987 2011-06-19 22:46:36Z VZ $ // Copyright: (C) 2008 Marcin Wojdyr // Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// @@ -38,15 +38,31 @@ public: virtual bool SetDate(const wxDateTime& date); virtual wxDateTime GetDate() const; + virtual bool SetDateRange(const wxDateTime& lowerdate = wxDefaultDateTime, + const wxDateTime& upperdate = wxDefaultDateTime); + virtual bool GetDateRange(wxDateTime *lowerdate, wxDateTime *upperdate) const; + virtual bool EnableMonthChange(bool enable = true); virtual void Mark(size_t day, bool mark); // implementation // -------------- - wxDateTime m_selectedDate; + + void GTKGenerateEvent(wxEventType type); private: + bool IsInValidRange(const wxDateTime& dt) const; + + // Range of the dates that can be selected by user, either or both may be + // invalid to indicate that no corresponding restriction is set. + wxDateTime m_validStart, + m_validEnd; + + // Last known selected date, may be different from the real selection in + // the control while a handler for day-selected is running. + wxDateTime m_selectedDate; + DECLARE_DYNAMIC_CLASS(wxGtkCalendarCtrl) wxDECLARE_NO_COPY_CLASS(wxGtkCalendarCtrl); }; diff --git a/Externals/wxWidgets3/include/wx/gtk/combobox.h b/Externals/wxWidgets3/include/wx/gtk/combobox.h index 4af492976f..87154df510 100644 --- a/Externals/wxWidgets3/include/wx/gtk/combobox.h +++ b/Externals/wxWidgets3/include/wx/gtk/combobox.h @@ -3,7 +3,7 @@ // Purpose: // Author: Robert Roebling // Created: 01/02/97 -// Id: $Id: combobox.h 65324 2010-08-16 17:48:28Z RR $ +// Id: $Id: combobox.h 70880 2012-03-11 23:55:19Z VZ $ // Copyright: (c) 1998 Robert Roebling // Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// @@ -88,6 +88,9 @@ public: { return wxItemContainer::GetStringSelection(); } + + virtual void SetString(unsigned int n, const wxString& string); + virtual void Popup(); virtual void Dismiss(); @@ -97,7 +100,9 @@ public: wxItemContainer::Clear(); } - bool IsEmpty() const { return wxItemContainer::IsEmpty(); } + // See wxComboBoxBase discussion of IsEmpty(). + bool IsListEmpty() const { return wxItemContainer::IsEmpty(); } + bool IsTextEmpty() const { return wxTextEntry::IsEmpty(); } void OnChar( wxKeyEvent &event ); diff --git a/Externals/wxWidgets3/include/wx/gtk/control.h b/Externals/wxWidgets3/include/wx/gtk/control.h index ad55168658..3d00b42278 100644 --- a/Externals/wxWidgets3/include/wx/gtk/control.h +++ b/Externals/wxWidgets3/include/wx/gtk/control.h @@ -2,7 +2,7 @@ // Name: wx/gtk/control.h // Purpose: // Author: Robert Roebling -// Id: $Id: control.h 67254 2011-03-20 00:14:35Z DS $ +// Id: $Id: control.h 70714 2012-02-27 17:49:33Z PC $ // Copyright: (c) 1998 Robert Roebling, Julian Smart // Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// @@ -20,7 +20,7 @@ typedef struct _GtkFrame GtkFrame; // C-linkage function pointer types for GetDefaultAttributesFromGTKWidget extern "C" { typedef GtkWidget* (*wxGtkWidgetNew_t)(void); - typedef GtkWidget* (*wxGtkWidgetNewFromStr_t)(const gchar*); + typedef GtkWidget* (*wxGtkWidgetNewFromStr_t)(const char*); typedef GtkWidget* (*wxGtkWidgetNewFromAdj_t)(GtkAdjustment*); } @@ -75,20 +75,20 @@ protected: static wxVisualAttributes GetDefaultAttributesFromGTKWidget(GtkWidget* widget, bool useBase = false, - int state = -1); + int state = 0); static wxVisualAttributes GetDefaultAttributesFromGTKWidget(wxGtkWidgetNew_t, bool useBase = false, - int state = -1); + int state = 0); static wxVisualAttributes GetDefaultAttributesFromGTKWidget(wxGtkWidgetNewFromStr_t, bool useBase = false, - int state = -1); + int state = 0); static wxVisualAttributes GetDefaultAttributesFromGTKWidget(wxGtkWidgetNewFromAdj_t, bool useBase = false, - int state = -1); + int state = 0); // Widgets that use the style->base colour for the BG colour should // override this and return true. diff --git a/Externals/wxWidgets3/include/wx/gtk/dataview.h b/Externals/wxWidgets3/include/wx/gtk/dataview.h index 5a82a93625..75463bd02d 100644 --- a/Externals/wxWidgets3/include/wx/gtk/dataview.h +++ b/Externals/wxWidgets3/include/wx/gtk/dataview.h @@ -2,7 +2,7 @@ // Name: wx/gtk/dataview.h // Purpose: wxDataViewCtrl GTK+2 implementation header // Author: Robert Roebling -// Id: $Id: dataview.h 65562 2010-09-17 19:07:02Z RR $ +// Id: $Id: dataview.h 70377 2012-01-17 14:05:17Z VS $ // Copyright: (c) 1998 Robert Roebling // Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// @@ -44,9 +44,8 @@ public: virtual void SetSortable( bool sortable ); virtual void SetSortOrder( bool ascending ); - virtual void SetAsSortKey(bool sort = true); - virtual void SetResizeable( bool resizeable ); + virtual void SetResizeable( bool resizable ); virtual void SetHidden( bool hidden ); virtual void SetMinWidth( int minWidth ); @@ -76,8 +75,7 @@ public: virtual int GetFlags() const { return GetFromIndividualFlags(); } // implementation - GtkWidget* GetGtkHandle() { return m_column; } - GtkWidget* GetConstGtkHandle() const { return m_column; } + GtkWidget* GetGtkHandle() const { return m_column; } private: // holds the GTK handle @@ -143,7 +141,7 @@ public: virtual wxDataViewColumn *GetSortingColumn() const; - virtual wxDataViewItem GetSelection() const; + virtual int GetSelectedItemsCount() const; virtual int GetSelections( wxDataViewItemArray & sel ) const; virtual void SetSelections( const wxDataViewItemArray & sel ); virtual void Select( const wxDataViewItem & item ); @@ -160,6 +158,10 @@ public: virtual wxRect GetItemRect( const wxDataViewItem &item, const wxDataViewColumn *column = NULL ) const; + virtual bool SetRowHeight( int rowHeight ); + + virtual void EditItem(const wxDataViewItem& item, const wxDataViewColumn *column); + virtual void Expand( const wxDataViewItem & item ); virtual void Collapse( const wxDataViewItem & item ); virtual bool IsExpanded( const wxDataViewItem & item ) const; @@ -167,6 +169,8 @@ public: virtual bool EnableDragSource( const wxDataFormat &format ); virtual bool EnableDropTarget( const wxDataFormat &format ); + virtual wxDataViewColumn *GetCurrentColumn() const; + static wxVisualAttributes GetClassDefaultAttributes(wxWindowVariant variant = wxWINDOW_VARIANT_NORMAL); @@ -181,6 +185,8 @@ public: virtual void OnInternalIdle(); + int GTKGetUniformRowHeight() const { return m_uniformRowHeight; } + protected: virtual void DoSetExpanderColumn(); virtual void DoSetIndent(); @@ -193,6 +199,12 @@ private: virtual wxDataViewItem DoGetCurrentItem() const; virtual void DoSetCurrentItem(const wxDataViewItem& item); + // Return wxDataViewColumn matching the given GtkTreeViewColumn. + // + // If the input argument is NULL, return NULL too. Otherwise we must find + // the matching column and assert if we didn't. + wxDataViewColumn* FromGTKColumn(GtkTreeViewColumn *gtk_col) const; + friend class wxDataViewCtrlDCImpl; friend class wxDataViewColumn; friend class wxDataViewCtrlInternal; @@ -202,6 +214,11 @@ private: wxDataViewColumnList m_cols; wxDataViewItem m_ensureVisibleDefered; + // By default this is set to -1 and the height of the rows is determined by + // GetRect() methods of the renderers but this can be set to a positive + // value to force the height of all rows to the given value. + int m_uniformRowHeight; + virtual void AddChildGTK(wxWindowGTK* child); void GtkEnableSelectionEvents(); void GtkDisableSelectionEvents(); diff --git a/Externals/wxWidgets3/include/wx/gtk/dc.h b/Externals/wxWidgets3/include/wx/gtk/dc.h index 0d00acbd15..3a2cc8afdc 100644 --- a/Externals/wxWidgets3/include/wx/gtk/dc.h +++ b/Externals/wxWidgets3/include/wx/gtk/dc.h @@ -2,7 +2,7 @@ // Name: wx/gtk/dc.h // Purpose: // Author: Robert Roebling -// Id: $Id: dc.h 50547 2007-12-06 16:22:00Z PC $ +// Id: $Id: dc.h 70165 2011-12-29 14:42:13Z SN $ // Copyright: (c) 1998 Robert Roebling // Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// @@ -23,7 +23,7 @@ public: virtual ~wxGTKDCImpl(); #if wxUSE_PALETTE - void SetColourMap( const wxPalette& palette ) { SetPalette(palette); }; + void SetColourMap( const wxPalette& palette ) { SetPalette(palette); } #endif // wxUSE_PALETTE // Resolution in pixels per logical inch diff --git a/Externals/wxWidgets3/include/wx/gtk/dirdlg.h b/Externals/wxWidgets3/include/wx/gtk/dirdlg.h index ad969b56e9..78e8c02a96 100644 --- a/Externals/wxWidgets3/include/wx/gtk/dirdlg.h +++ b/Externals/wxWidgets3/include/wx/gtk/dirdlg.h @@ -2,7 +2,7 @@ // Name: wx/gtk/dirdlg.h // Purpose: wxDirDialog // Author: Francesco Montorsi -// Id: $Id: dirdlg.h 67254 2011-03-20 00:14:35Z DS $ +// Id: $Id: dirdlg.h 70898 2012-03-14 12:32:27Z VZ $ // Copyright: (c) 2006 Francesco Montorsi // Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// @@ -26,7 +26,13 @@ public: const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize, const wxString& name = wxDirDialogNameStr); - + bool Create(wxWindow *parent, + const wxString& message = wxDirSelectorPromptStr, + const wxString& defaultPath = wxEmptyString, + long style = wxDD_DEFAULT_STYLE, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + const wxString& name = wxDirDialogNameStr); virtual ~wxDirDialog() { } diff --git a/Externals/wxWidgets3/include/wx/gtk/dnd.h b/Externals/wxWidgets3/include/wx/gtk/dnd.h index 74cdd71bc1..f7725017b5 100644 --- a/Externals/wxWidgets3/include/wx/gtk/dnd.h +++ b/Externals/wxWidgets3/include/wx/gtk/dnd.h @@ -2,7 +2,7 @@ // Name: wx/gtk/dnd.h // Purpose: declaration of the wxDropTarget class // Author: Robert Roebling -// RCS-ID: $Id: dnd.h 67254 2011-03-20 00:14:35Z DS $ +// RCS-ID: $Id: dnd.h 69020 2011-09-07 16:56:50Z PC $ // Copyright: (c) 1998 Vadim Zeitlin, Robert Roebling // Licence: wxWindows licence /////////////////////////////////////////////////////////////////////////////// @@ -50,13 +50,13 @@ public: GdkDragContext *m_dragContext; GtkWidget *m_dragWidget; GtkSelectionData *m_dragData; - guint m_dragTime; + unsigned m_dragTime; bool m_firstMotion; // gdk has no "gdk_drag_enter" event void GTKSetDragContext( GdkDragContext *dc ) { m_dragContext = dc; } void GTKSetDragWidget( GtkWidget *w ) { m_dragWidget = w; } void GTKSetDragData( GtkSelectionData *sd ) { m_dragData = sd; } - void GTKSetDragTime( guint time ) { m_dragTime = time; } + void GTKSetDragTime(unsigned time) { m_dragTime = time; } }; //------------------------------------------------------------------------- diff --git a/Externals/wxWidgets3/include/wx/gtk/dvrenderer.h b/Externals/wxWidgets3/include/wx/gtk/dvrenderer.h index 195360fdf7..a8a75dc4fd 100644 --- a/Externals/wxWidgets3/include/wx/gtk/dvrenderer.h +++ b/Externals/wxWidgets3/include/wx/gtk/dvrenderer.h @@ -3,7 +3,7 @@ // Purpose: wxDataViewRenderer for GTK wxDataViewCtrl implementation // Author: Robert Roebling, Vadim Zeitlin // Created: 2009-11-07 (extracted from wx/gtk/dataview.h) -// RCS-ID: $Id: dvrenderer.h 66404 2010-12-19 19:43:46Z RR $ +// RCS-ID: $Id: dvrenderer.h 69020 2011-09-07 16:56:50Z PC $ // Copyright: (c) 2006 Robert Roebling // (c) 2009 Vadim Zeitlin // Licence: wxWindows licence @@ -48,11 +48,11 @@ public: // // it validates the new value and notifies the model about the change by // calling GtkOnCellChanged() if it was accepted - virtual void GtkOnTextEdited(const gchar *itempath, const wxString& value); + virtual void GtkOnTextEdited(const char *itempath, const wxString& value); GtkCellRenderer* GetGtkHandle() { return m_renderer; } void GtkInitHandlers(); - void GtkUpdateAlignment(); + void GtkUpdateAlignment() { GtkApplyAlignment(m_renderer); } // should be overridden to return true if the renderer supports properties // corresponding to wxDataViewItemAttr field, see wxGtkTreeCellDataFunc() @@ -85,6 +85,9 @@ protected: const wxDataViewItem& item, unsigned col); + // Apply our effective alignment (i.e. m_alignment if specified or the + // associated column alignment by default) to the given renderer. + void GtkApplyAlignment(GtkCellRenderer *renderer); GtkCellRenderer *m_renderer; int m_alignment; diff --git a/Externals/wxWidgets3/include/wx/gtk/dvrenderers.h b/Externals/wxWidgets3/include/wx/gtk/dvrenderers.h index 2199a7e851..95b84d416b 100644 --- a/Externals/wxWidgets3/include/wx/gtk/dvrenderers.h +++ b/Externals/wxWidgets3/include/wx/gtk/dvrenderers.h @@ -3,7 +3,7 @@ // Purpose: All GTK wxDataViewCtrl renderer classes // Author: Robert Roebling, Vadim Zeitlin // Created: 2009-11-07 (extracted from wx/gtk/dataview.h) -// RCS-ID: $Id: dvrenderers.h 67120 2011-03-03 17:51:52Z PC $ +// RCS-ID: $Id: dvrenderers.h 70300 2012-01-09 06:31:07Z PC $ // Copyright: (c) 2006 Robert Roebling // (c) 2009 Vadim Zeitlin // Licence: wxWindows licence @@ -117,18 +117,12 @@ public: wxDC *dc, int state); + struct GTKRenderParams; + // store GTK render call parameters for possible later use - void GTKStashRenderParams(GdkWindow *window, - GtkWidget *widget, - GdkRectangle *background_area, - GdkRectangle *expose_area, - int flags) + void GTKSetRenderParams(GTKRenderParams* renderParams) { - m_renderParams.window = window; - m_renderParams.widget = widget; - m_renderParams.background_area = background_area; - m_renderParams.expose_area = expose_area; - m_renderParams.flags = flags; + m_renderParams = renderParams; } // we may or not support attributes, as we don't know it, return true to @@ -147,20 +141,17 @@ protected: bool Init(wxDataViewCellMode mode, int align); private: + // Called from GtkGetTextRenderer() to really create the renderer if + // necessary. + void GtkInitTextRenderer(); + wxDC *m_dc; GtkCellRendererText *m_text_renderer; // parameters of the original render() call stored so that we could pass // them forward to m_text_renderer if our RenderText() is called - struct GTKRenderParams - { - GdkWindow *window; - GtkWidget *widget; - GdkRectangle *background_area; - GdkRectangle *expose_area; - int flags; - } m_renderParams; + GTKRenderParams* m_renderParams; DECLARE_DYNAMIC_CLASS_NO_COPY(wxDataViewCustomRenderer) }; @@ -185,9 +176,17 @@ public: virtual wxSize GetSize() const; private: + void GTKSetLabel(); + wxString m_label; int m_value; +#if !wxUSE_UNICODE + // Flag used to indicate that we need to set the label because we were + // unable to do it in the ctor (see comments there). + bool m_needsToSetLabel; +#endif // !wxUSE_UNICODE + protected: DECLARE_DYNAMIC_CLASS_NO_COPY(wxDataViewProgressRenderer) }; @@ -223,34 +222,6 @@ private: DECLARE_DYNAMIC_CLASS_NO_COPY(wxDataViewIconTextRenderer) }; -// --------------------------------------------------------- -// wxDataViewDateRenderer -// --------------------------------------------------------- - -class WXDLLIMPEXP_ADV wxDataViewDateRenderer: public wxDataViewCustomRenderer -{ -public: - wxDataViewDateRenderer( const wxString &varianttype = "datetime", - wxDataViewCellMode mode = wxDATAVIEW_CELL_ACTIVATABLE, - int align = wxDVR_DEFAULT_ALIGNMENT ); - - bool SetValue( const wxVariant &value ); - bool GetValue( wxVariant &value ) const; - - virtual bool Render( wxRect cell, wxDC *dc, int state ); - virtual wxSize GetSize() const; - virtual bool Activate( const wxRect& cell, - wxDataViewModel *model, - const wxDataViewItem &item, - unsigned int col ); - -private: - wxDateTime m_date; - -protected: - DECLARE_DYNAMIC_CLASS_NO_COPY(wxDataViewDateRenderer) -}; - // ------------------------------------- // wxDataViewChoiceRenderer // ------------------------------------- @@ -291,7 +262,7 @@ public: virtual bool GetValue( wxVariant &value ) const; private: - virtual void GtkOnTextEdited(const gchar *itempath, const wxString& str); + virtual void GtkOnTextEdited(const char *itempath, const wxString& str); }; diff --git a/Externals/wxWidgets3/include/wx/gtk/filectrl.h b/Externals/wxWidgets3/include/wx/gtk/filectrl.h index 43c3a76b97..1551923ec3 100644 --- a/Externals/wxWidgets3/include/wx/gtk/filectrl.h +++ b/Externals/wxWidgets3/include/wx/gtk/filectrl.h @@ -4,7 +4,7 @@ // Author: Diaa M. Sami // Modified by: // Created: Aug-10-2007 -// RCS-ID: $Id: filectrl.h 64429 2010-05-29 10:35:47Z VZ $ +// RCS-ID: $Id: filectrl.h 70165 2011-12-29 14:42:13Z SN $ // Copyright: (c) Diaa M. Sami // Licence: wxWindows licence /////////////////////////////////////////////////////////////////////////////// @@ -88,7 +88,7 @@ public: Create( parent, id, defaultDirectory, defaultFilename, wildCard, style, pos, size, name ); } - virtual ~wxGtkFileCtrl() {}; + virtual ~wxGtkFileCtrl() {} void Init(); bool Create( wxWindow *parent, diff --git a/Externals/wxWidgets3/include/wx/gtk/filedlg.h b/Externals/wxWidgets3/include/wx/gtk/filedlg.h index 7afb9b1745..667e94a359 100644 --- a/Externals/wxWidgets3/include/wx/gtk/filedlg.h +++ b/Externals/wxWidgets3/include/wx/gtk/filedlg.h @@ -2,7 +2,7 @@ // Name: wx/gtk/filedlg.h // Purpose: // Author: Robert Roebling -// Id: $Id: filedlg.h 67254 2011-03-20 00:14:35Z DS $ +// Id: $Id: filedlg.h 70898 2012-03-14 12:32:27Z VZ $ // Copyright: (c) 1998 Robert Roebling // Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// @@ -30,6 +30,15 @@ public: const wxPoint& pos = wxDefaultPosition, const wxSize& sz = wxDefaultSize, const wxString& name = wxFileDialogNameStr); + bool Create(wxWindow *parent, + const wxString& message = wxFileSelectorPromptStr, + const wxString& defaultDir = wxEmptyString, + const wxString& defaultFile = wxEmptyString, + const wxString& wildCard = wxFileSelectorDefaultWildcardStr, + long style = wxFD_DEFAULT_STYLE, + const wxPoint& pos = wxDefaultPosition, + const wxSize& sz = wxDefaultSize, + const wxString& name = wxFileDialogNameStr); virtual ~wxFileDialog(); virtual wxString GetPath() const; diff --git a/Externals/wxWidgets3/include/wx/gtk/filepicker.h b/Externals/wxWidgets3/include/wx/gtk/filepicker.h index 782af3d680..ad6be66083 100644 --- a/Externals/wxWidgets3/include/wx/gtk/filepicker.h +++ b/Externals/wxWidgets3/include/wx/gtk/filepicker.h @@ -5,7 +5,7 @@ // Modified by: // Created: 14/4/2006 // Copyright: (c) Francesco Montorsi -// RCS-ID: $Id: filepicker.h 63690 2010-03-16 00:23:57Z VZ $ +// RCS-ID: $Id: filepicker.h 70043 2011-12-18 12:34:47Z VZ $ // Licence: wxWindows Licence ///////////////////////////////////////////////////////////////////////////// @@ -101,6 +101,7 @@ public: // overrides void OnDialogOK(wxCommandEvent &); virtual void SetPath(const wxString &str); + virtual void SetInitialDirectory(const wxString& dir); // see macro defined above FILEDIRBTN_OVERRIDES @@ -171,6 +172,7 @@ public: // overrides } virtual void SetPath(const wxString &str); + virtual void SetInitialDirectory(const wxString& dir); // see macro defined above FILEDIRBTN_OVERRIDES diff --git a/Externals/wxWidgets3/include/wx/gtk/font.h b/Externals/wxWidgets3/include/wx/gtk/font.h index b14fb7e921..53bc2d6441 100644 --- a/Externals/wxWidgets3/include/wx/gtk/font.h +++ b/Externals/wxWidgets3/include/wx/gtk/font.h @@ -2,7 +2,7 @@ // Name: wx/gtk/font.h // Purpose: // Author: Robert Roebling -// Id: $Id: font.h 67254 2011-03-20 00:14:35Z DS $ +// Id: $Id: font.h 70476 2012-01-29 08:14:34Z PC $ // Copyright: (c) 1998 Robert Roebling // Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// @@ -63,6 +63,12 @@ public: SetPixelSize(pixelSize); } + wxFont(int pointSize, + wxFontFamily family, + int flags = wxFONTFLAG_DEFAULT, + const wxString& face = wxEmptyString, + wxFontEncoding encoding = wxFONTENCODING_DEFAULT); + bool Create(int size, wxFontFamily family, wxFontStyle style, @@ -82,6 +88,7 @@ public: virtual wxFontWeight GetWeight() const; virtual wxString GetFaceName() const; virtual bool GetUnderlined() const; + virtual bool GetStrikethrough() const; virtual wxFontEncoding GetEncoding() const; virtual const wxNativeFontInfo *GetNativeFontInfo() const; virtual bool IsFixedWidth() const; @@ -92,10 +99,18 @@ public: virtual void SetWeight(wxFontWeight weight); virtual bool SetFaceName( const wxString& faceName ); virtual void SetUnderlined( bool underlined ); + virtual void SetStrikethrough(bool strikethrough); virtual void SetEncoding(wxFontEncoding encoding); wxDECLARE_COMMON_FONT_METHODS(); + // Set Pango attributes in the specified layout. Currently only + // underlined and strike-through attributes are handled by this function. + // + // If neither of them is specified, returns false, otherwise sets up the + // attributes and returns true. + bool GTKSetPangoAttrs(PangoLayout* layout) const; + // implementation from now on void Unshare(); diff --git a/Externals/wxWidgets3/include/wx/gtk/fontpicker.h b/Externals/wxWidgets3/include/wx/gtk/fontpicker.h index 27be02dfbd..505090e762 100644 --- a/Externals/wxWidgets3/include/wx/gtk/fontpicker.h +++ b/Externals/wxWidgets3/include/wx/gtk/fontpicker.h @@ -5,7 +5,7 @@ // Modified by: // Created: 14/4/2006 // Copyright: (c) Francesco Montorsi -// RCS-ID: $Id: fontpicker.h 49668 2007-11-06 00:32:34Z MR $ +// RCS-ID: $Id: fontpicker.h 69020 2011-09-07 16:56:50Z PC $ // Licence: wxWindows Licence ///////////////////////////////////////////////////////////////////////////// @@ -52,7 +52,7 @@ protected: public: // used by the GTK callback only - void SetNativeFontInfo(const gchar *gtkdescription) + void SetNativeFontInfo(const char *gtkdescription) { m_selectedFont.SetNativeFontInfo(wxString::FromAscii(gtkdescription)); } private: diff --git a/Externals/wxWidgets3/include/wx/gtk/gauge.h b/Externals/wxWidgets3/include/wx/gtk/gauge.h index 1c91c40512..7f065f2657 100644 --- a/Externals/wxWidgets3/include/wx/gtk/gauge.h +++ b/Externals/wxWidgets3/include/wx/gtk/gauge.h @@ -2,7 +2,7 @@ // Name: wx/gtk/gauge.h // Purpose: // Author: Robert Roebling -// Id: $Id: gauge.h 42077 2006-10-17 14:44:52Z ABX $ +// Id: $Id: gauge.h 70165 2011-12-29 14:42:13Z SN $ // Copyright: (c) 1998 Robert Roebling // Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// @@ -43,8 +43,8 @@ public: void SetShadowWidth( int WXUNUSED(w) ) { } void SetBezelFace( int WXUNUSED(w) ) { } - int GetShadowWidth() const { return 0; }; - int GetBezelFace() const { return 0; }; + int GetShadowWidth() const { return 0; } + int GetBezelFace() const { return 0; } // determinate mode API void SetRange( int r ); diff --git a/Externals/wxWidgets3/include/wx/gtk/hyperlink.h b/Externals/wxWidgets3/include/wx/gtk/hyperlink.h index a3419bf64c..7fdb40f020 100644 --- a/Externals/wxWidgets3/include/wx/gtk/hyperlink.h +++ b/Externals/wxWidgets3/include/wx/gtk/hyperlink.h @@ -4,13 +4,13 @@ // Author: Francesco Montorsi // Modified by: // Created: 14/2/2007 -// RCS-ID: $Id: hyperlink.h 44647 2007-03-07 22:12:47Z VZ $ +// RCS-ID: $Id: hyperlink.h 67378 2011-04-02 20:43:29Z PC $ // Copyright: (c) 2007 Francesco Montorsi // Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// -#ifndef __GTKHYPERLINKCTRLH__ -#define __GTKHYPERLINKCTRLH__ +#ifndef _WX_GTKHYPERLINKCTRL_H_ +#define _WX_GTKHYPERLINKCTRL_H_ #include "wx/generic/hyperlink.h" @@ -62,16 +62,12 @@ public: virtual void SetLabel(const wxString &label); protected: - // overridden base class virtuals - - // Returns the best size for the window, which is the size needed - // to display the text label. virtual wxSize DoGetBestSize() const; + virtual wxSize DoGetBestClientSize() const; virtual GdkWindow *GTKGetWindow(wxArrayGdkWindows& windows) const; -private: DECLARE_DYNAMIC_CLASS(wxHyperlinkCtrl) }; -#endif // __GTKHYPERLINKCTRLH__ +#endif // _WX_GTKHYPERLINKCTRL_H_ diff --git a/Externals/wxWidgets3/include/wx/gtk/listbox.h b/Externals/wxWidgets3/include/wx/gtk/listbox.h index 6af95eb831..b2862a935f 100644 --- a/Externals/wxWidgets3/include/wx/gtk/listbox.h +++ b/Externals/wxWidgets3/include/wx/gtk/listbox.h @@ -2,7 +2,7 @@ // Name: wx/gtk/listbox.h // Purpose: wxListBox class declaration // Author: Robert Roebling -// Id: $Id: listbox.h 65936 2010-10-27 23:22:00Z VZ $ +// Id: $Id: listbox.h 67298 2011-03-23 17:36:10Z PC $ // Copyright: (c) 1998 Robert Roebling // Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// @@ -82,11 +82,7 @@ public: // implementation from now on - GtkWidget *GetConnectWidget(); - -#if wxUSE_TOOLTIPS - void GTKApplyToolTip( GtkTooltips *tips, const gchar *tip ); -#endif // wxUSE_TOOLTIPS + virtual GtkWidget *GetConnectWidget(); struct _GtkTreeView *m_treeview; struct _GtkListStore *m_liststore; diff --git a/Externals/wxWidgets3/include/wx/gtk/mdi.h b/Externals/wxWidgets3/include/wx/gtk/mdi.h index 43a6a06b7f..6b7b50da20 100644 --- a/Externals/wxWidgets3/include/wx/gtk/mdi.h +++ b/Externals/wxWidgets3/include/wx/gtk/mdi.h @@ -3,7 +3,7 @@ // Purpose: TDI-based MDI implementation for wxGTK // Author: Robert Roebling // Modified by: 2008-10-31 Vadim Zeitlin: derive from the base classes -// Id: $Id: mdi.h 59523 2009-03-14 01:24:45Z FM $ +// Id: $Id: mdi.h 69528 2011-10-25 16:56:57Z PC $ // Copyright: (c) 1998 Robert Roebling // (c) 2008 Vadim Zeitlin // Licence: wxWindows licence @@ -118,9 +118,9 @@ public: void OnActivate( wxActivateEvent& event ); void OnMenuHighlight( wxMenuEvent& event ); + virtual void GTKHandleRealized(); wxMenuBar *m_menuBar; - GtkNotebookPage *m_page; bool m_justInserted; private: diff --git a/Externals/wxWidgets3/include/wx/gtk/menu.h b/Externals/wxWidgets3/include/wx/gtk/menu.h index 1c70606a61..25302e3ace 100644 --- a/Externals/wxWidgets3/include/wx/gtk/menu.h +++ b/Externals/wxWidgets3/include/wx/gtk/menu.h @@ -2,7 +2,7 @@ // Name: wx/gtk/menu.h // Purpose: // Author: Robert Roebling -// Id: $Id: menu.h 66180 2010-11-17 05:57:21Z PC $ +// Id: $Id: menu.h 70350 2012-01-15 13:41:17Z VZ $ // Copyright: (c) 1998 Robert Roebling, Julian Smart // Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// @@ -33,6 +33,7 @@ public: virtual wxMenuItem* FindItem( int id, wxMenu **menu = NULL ) const; virtual void EnableTop( size_t pos, bool flag ); + virtual bool IsEnabledTop(size_t pos) const; virtual void SetMenuLabel( size_t pos, const wxString& label ); virtual wxString GetMenuLabel( size_t pos ) const; @@ -51,7 +52,7 @@ public: private: // common part of Append and Insert - bool GtkAppend(wxMenu *menu, const wxString& title, int pos=-1); + void GtkAppend(wxMenu* menu, const wxString& title, int pos = -1); void Init(size_t n, wxMenu *menus[], const wxString titles[], long style); @@ -99,9 +100,8 @@ private: void Init(); // common part of Append (if pos == -1) and Insert - bool GtkAppend(wxMenuItem *item, int pos=-1); + void GtkAppend(wxMenuItem* item, int pos = -1); - GtkWidget *m_prevRadio; DECLARE_DYNAMIC_CLASS(wxMenu) }; diff --git a/Externals/wxWidgets3/include/wx/gtk/msgdlg.h b/Externals/wxWidgets3/include/wx/gtk/msgdlg.h index 86489d335b..90cc21da1f 100644 --- a/Externals/wxWidgets3/include/wx/gtk/msgdlg.h +++ b/Externals/wxWidgets3/include/wx/gtk/msgdlg.h @@ -4,7 +4,7 @@ // Author: Vaclav Slavik // Modified by: // Created: 2003/02/28 -// RCS-ID: $Id: msgdlg.h 65348 2010-08-18 22:48:28Z VZ $ +// RCS-ID: $Id: msgdlg.h 68537 2011-08-04 22:53:42Z VZ $ // Copyright: (c) Vaclav Slavik, 2003 // Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// @@ -40,6 +40,7 @@ private: virtual wxString GetDefaultNoLabel() const; virtual wxString GetDefaultOKLabel() const; virtual wxString GetDefaultCancelLabel() const; + virtual wxString GetDefaultHelpLabel() const; // create the real GTK+ dialog: this is done from ShowModal() to allow // changing the message between constructing the dialog and showing it diff --git a/Externals/wxWidgets3/include/wx/gtk/nonownedwnd.h b/Externals/wxWidgets3/include/wx/gtk/nonownedwnd.h new file mode 100644 index 0000000000..8dcb75a696 --- /dev/null +++ b/Externals/wxWidgets3/include/wx/gtk/nonownedwnd.h @@ -0,0 +1,44 @@ +/////////////////////////////////////////////////////////////////////////////// +// Name: wx/gtk/nonownedwnd.h +// Purpose: wxGTK-specific wxNonOwnedWindow declaration. +// Author: Vadim Zeitlin +// Created: 2011-10-12 +// RCS-ID: $Id: nonownedwnd.h 69462 2011-10-18 21:56:52Z VZ $ +// Copyright: (c) 2011 Vadim Zeitlin +// Licence: wxWindows licence +/////////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_GTK_NONOWNEDWND_H_ +#define _WX_GTK_NONOWNEDWND_H_ + +class wxNonOwnedWindowShapeImpl; + +// ---------------------------------------------------------------------------- +// wxNonOwnedWindow contains code common to wx{Popup,TopLevel}Window in wxGTK. +// ---------------------------------------------------------------------------- + +class WXDLLIMPEXP_CORE wxNonOwnedWindow : public wxNonOwnedWindowBase +{ +public: + wxNonOwnedWindow() { m_shapeImpl = NULL; } + virtual ~wxNonOwnedWindow(); + + // Overridden to actually set the shape when the window becomes realized. + virtual void GTKHandleRealized(); + +protected: + virtual bool DoClearShape(); + virtual bool DoSetRegionShape(const wxRegion& region); +#if wxUSE_GRAPHICS_CONTEXT + virtual bool DoSetPathShape(const wxGraphicsPath& path); +#endif // wxUSE_GRAPHICS_CONTEXT + + +private: + // If non-NULL, contains information about custom window shape. + wxNonOwnedWindowShapeImpl* m_shapeImpl; + + wxDECLARE_NO_COPY_CLASS(wxNonOwnedWindow); +}; + +#endif // _WX_GTK_NONOWNEDWND_H_ diff --git a/Externals/wxWidgets3/include/wx/gtk/notebook.h b/Externals/wxWidgets3/include/wx/gtk/notebook.h index 266b1b4e1b..50cedf0171 100644 --- a/Externals/wxWidgets3/include/wx/gtk/notebook.h +++ b/Externals/wxWidgets3/include/wx/gtk/notebook.h @@ -3,7 +3,7 @@ // Purpose: wxNotebook class // Author: Robert Roebling // Modified by: -// RCS-ID: $Id: notebook.h 67254 2011-03-20 00:14:35Z DS $ +// RCS-ID: $Id: notebook.h 70112 2011-12-24 18:19:26Z VZ $ // Copyright: (c) Julian Smart and Robert Roebling // Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// @@ -68,13 +68,13 @@ public: bool SetPageImage(size_t nPage, int nImage); // control the appearance of the notebook pages - // set the size (the same for all pages) - void SetPageSize(const wxSize& size); // set the padding between tabs (in pixels) void SetPadding(const wxSize& padding); // sets the size of the tabs (assumes all tabs are the same size) void SetTabSize(const wxSize& sz); + // geometry + virtual wxSize CalcSizeFromPage(const wxSize& sizePage) const; virtual int HitTest(const wxPoint& pt, long *flags = NULL) const; // operations @@ -89,7 +89,7 @@ public: wxNotebookPage *win, const wxString& strText, bool bSelect = false, - int imageId = -1 ); + int imageId = NO_IMAGE ); // handler for tab navigation // -------------------------- diff --git a/Externals/wxWidgets3/include/wx/gtk/pen.h b/Externals/wxWidgets3/include/wx/gtk/pen.h index 0f32910275..137066611c 100644 --- a/Externals/wxWidgets3/include/wx/gtk/pen.h +++ b/Externals/wxWidgets3/include/wx/gtk/pen.h @@ -2,7 +2,7 @@ // Name: wx/gtk/pen.h // Purpose: // Author: Robert Roebling -// Id: $Id: pen.h 54273 2008-06-17 17:28:26Z VZ $ +// Id: $Id: pen.h 69020 2011-09-07 16:56:50Z PC $ // Copyright: (c) 1998 Robert Roebling // Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// @@ -10,7 +10,7 @@ #ifndef _WX_GTK_PEN_H_ #define _WX_GTK_PEN_H_ -typedef gint8 wxGTKDash; +typedef signed char wxGTKDash; //----------------------------------------------------------------------------- // wxPen diff --git a/Externals/wxWidgets3/include/wx/gtk/popupwin.h b/Externals/wxWidgets3/include/wx/gtk/popupwin.h index d71c539128..616ae41618 100644 --- a/Externals/wxWidgets3/include/wx/gtk/popupwin.h +++ b/Externals/wxWidgets3/include/wx/gtk/popupwin.h @@ -3,7 +3,7 @@ // Purpose: // Author: Robert Roebling // Created: -// Id: $Id: popupwin.h 67254 2011-03-20 00:14:35Z DS $ +// Id: $Id: popupwin.h 70739 2012-02-28 17:25:59Z PC $ // Copyright: (c) 2001 Robert Roebling // Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// @@ -42,9 +42,6 @@ protected: virtual void DoMoveWindow(int x, int y, int width, int height); -private: - virtual void AddChildGTK(wxWindowGTK* child); - #ifdef __WXUNIVERSAL__ DECLARE_EVENT_TABLE() #endif diff --git a/Externals/wxWidgets3/include/wx/gtk/private.h b/Externals/wxWidgets3/include/wx/gtk/private.h index 86168ca47b..321ba28f3c 100644 --- a/Externals/wxWidgets3/include/wx/gtk/private.h +++ b/Externals/wxWidgets3/include/wx/gtk/private.h @@ -4,7 +4,7 @@ // Author: Vadim Zeitlin // Modified by: // Created: 12.03.02 -// RCS-ID: $Id: private.h 63805 2010-03-30 16:14:11Z PC $ +// RCS-ID: $Id: private.h 70475 2012-01-29 08:00:15Z PC $ // Copyright: (c) 2002 Vadim Zeitlin // Licence: wxWindows licence /////////////////////////////////////////////////////////////////////////////// @@ -15,6 +15,7 @@ #include #include "wx/gtk/private/string.h" +#include "wx/gtk/private/gtk2-compat.h" // pango_version_check symbol is quite recent ATM (4/2007)... so we // use our own wrapper which implements a smart trick. @@ -51,13 +52,13 @@ extern const gchar *wx_pango_version_check(int major, int minor, int micro); // helper: use the encoding of the given font if it's valid inline wxCharBuffer wxConvertToGTK(const wxString& s, const wxFont& font) { - return wxConvertToGTK(s, font.Ok() ? font.GetEncoding() + return wxConvertToGTK(s, font.IsOk() ? font.GetEncoding() : wxFONTENCODING_SYSTEM); } inline wxCharBuffer wxConvertFromGTK(const wxString& s, const wxFont& font) { - return wxConvertFromGTK(s, font.Ok() ? font.GetEncoding() + return wxConvertFromGTK(s, font.IsOk() ? font.GetEncoding() : wxFONTENCODING_SYSTEM); } @@ -113,4 +114,3 @@ GtkWidget *GetTreeWidget(); } // wxGTKPrivate #endif // _WX_GTK_PRIVATE_H_ - diff --git a/Externals/wxWidgets3/include/wx/gtk/private/event.h b/Externals/wxWidgets3/include/wx/gtk/private/event.h new file mode 100644 index 0000000000..7c1254fea8 --- /dev/null +++ b/Externals/wxWidgets3/include/wx/gtk/private/event.h @@ -0,0 +1,80 @@ +/////////////////////////////////////////////////////////////////////////////// +// Name: wx/gtk/private/event.h +// Purpose: Helper functions for working with GDK and wx events +// Author: Vaclav Slavik +// Created: 2011-10-14 +// RCS-ID: $Id$ +// Copyright: (c) 2011 Vaclav Slavik +// Licence: wxWindows licence +/////////////////////////////////////////////////////////////////////////////// + +#ifndef _GTK_PRIVATE_EVENT_H_ +#define _GTK_PRIVATE_EVENT_H_ + +#if !GTK_CHECK_VERSION(2,10,0) + // GTK+ can reliably detect Meta key state only since 2.10 when + // GDK_META_MASK was introduced -- there wasn't any way to detect it + // in older versions. wxGTK used GDK_MOD2_MASK for this purpose, but + // GDK_MOD2_MASK is documented as: + // + // the fifth modifier key (it depends on the modifier mapping of the X + // server which key is interpreted as this modifier) + // + // In other words, it isn't guaranteed to map to Meta. This is a real + // problem: it is common to map NumLock to it (in fact, it's an exception + // if the X server _doesn't_ use it for NumLock). So the old code caused + // wxKeyEvent::MetaDown() to always return true as long as NumLock was on + // on many systems, which broke all applications using + // wxKeyEvent::GetModifiers() to check modifiers state (see e.g. here: + // http://tinyurl.com/56lsk2). + // + // Because of this, it's better to not detect Meta key state at all than + // to detect it incorrectly. Hence the following #define, which causes + // m_metaDown to be always set to false. + #define GDK_META_MASK 0 +#endif + +namespace wxGTKImpl +{ + +// init wxMouseEvent with the info from GdkEventXXX struct +template void InitMouseEvent(wxWindowGTK *win, + wxMouseEvent& event, + T *gdk_event) +{ + event.m_shiftDown = (gdk_event->state & GDK_SHIFT_MASK) != 0; + event.m_controlDown = (gdk_event->state & GDK_CONTROL_MASK) != 0; + event.m_altDown = (gdk_event->state & GDK_MOD1_MASK) != 0; + event.m_metaDown = (gdk_event->state & GDK_META_MASK) != 0; + event.m_leftDown = (gdk_event->state & GDK_BUTTON1_MASK) != 0; + event.m_middleDown = (gdk_event->state & GDK_BUTTON2_MASK) != 0; + event.m_rightDown = (gdk_event->state & GDK_BUTTON3_MASK) != 0; + + // In gdk/win32 VK_XBUTTON1 is translated to GDK_BUTTON4_MASK + // and VK_XBUTTON2 to GDK_BUTTON5_MASK. In x11/gdk buttons 4/5 + // are wheel rotation and buttons 8/9 don't change the state. + event.m_aux1Down = (gdk_event->state & GDK_BUTTON4_MASK) != 0; + event.m_aux2Down = (gdk_event->state & GDK_BUTTON5_MASK) != 0; + + wxPoint pt = win->GetClientAreaOrigin(); + event.m_x = (wxCoord)gdk_event->x - pt.x; + event.m_y = (wxCoord)gdk_event->y - pt.y; + + if ((win->m_wxwindow) && (win->GetLayoutDirection() == wxLayout_RightToLeft)) + { + // origin in the upper right corner + GtkAllocation a; + gtk_widget_get_allocation(win->m_wxwindow, &a); + int window_width = a.width; + event.m_x = window_width - event.m_x; + } + + event.SetEventObject( win ); + event.SetId( win->GetId() ); + event.SetTimestamp( gdk_event->time ); +} + +} // namespace wxGTKImpl + +#endif // _GTK_PRIVATE_EVENT_H_ + diff --git a/Externals/wxWidgets3/include/wx/gtk/private/gtk2-compat.h b/Externals/wxWidgets3/include/wx/gtk/private/gtk2-compat.h new file mode 100644 index 0000000000..fddeaafca9 --- /dev/null +++ b/Externals/wxWidgets3/include/wx/gtk/private/gtk2-compat.h @@ -0,0 +1,376 @@ +/////////////////////////////////////////////////////////////////////////////// +// Name: wx/gtk/private/compat.h +// Purpose: Compatibility code for older GTK+ versions +// Author: Vaclav Slavik +// Created: 2011-03-25 +// RCS-ID: $Id$ +// Copyright: (c) 2011 Vaclav Slavik +// Licence: wxWindows licence +/////////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_GTK_PRIVATE_COMPAT_H_ +#define _WX_GTK_PRIVATE_COMPAT_H_ + +// ---------------------------------------------------------------------------- +// Implementations of new accessors for older GTK+ versions +// ---------------------------------------------------------------------------- + +// GTK+ deprecated direct access to struct members and some other stuff, +// replacing them with simple accessor functions. These aren't available in +// older versions, though, so we have to provide them for compatibility. +// +// Note: wx_ prefix is used to avoid symbol conflicts at runtime +// +// Note 2: We support building against newer GTK+ version and using an older +// one at runtime, so we must provide our implementations of these +// functions even if GTK_CHECK_VERSION would indicate the function is +// already available in GTK+. + +#if !GTK_CHECK_VERSION(3,0,0) && !(defined(GTK_DISABLE_DEPRECATED) || defined(GSEAL_ENABLE)) + +// ---------------------------------------------------------------------------- +// the following were introduced in GTK+ 2.8 + +static inline GtkWidget* wx_gtk_scrolled_window_get_hscrollbar(GtkScrolledWindow* scrolled_window) +{ + return scrolled_window->hscrollbar; +} +#define gtk_scrolled_window_get_hscrollbar wx_gtk_scrolled_window_get_hscrollbar + +static inline GtkWidget* wx_gtk_scrolled_window_get_vscrollbar(GtkScrolledWindow* scrolled_window) +{ + return scrolled_window->vscrollbar; +} +#define gtk_scrolled_window_get_vscrollbar wx_gtk_scrolled_window_get_vscrollbar + +// ---------------------------------------------------------------------------- +// the following were introduced in GLib 2.10 + +static inline gpointer wx_g_object_ref_sink(gpointer object) +{ + g_object_ref(object); + gtk_object_sink(GTK_OBJECT(object)); + return object; +} +#define g_object_ref_sink wx_g_object_ref_sink + +// ---------------------------------------------------------------------------- +// the following were introduced in GTK+ 2.12 and GtkAboutDialog itself is not +// in 2.4 so skip this if we don't have it. +#if GTK_CHECK_VERSION(2,6,0) + +static inline void wx_gtk_about_dialog_set_program_name(GtkAboutDialog* about, const gchar* name) +{ + gtk_about_dialog_set_name(about, name); +} +#define gtk_about_dialog_set_program_name wx_gtk_about_dialog_set_program_name +#endif // 2.6.0 + +// ---------------------------------------------------------------------------- +// the following were introduced in GTK+ 2.14 + +static inline gdouble wx_gtk_adjustment_get_lower(GtkAdjustment* adjustment) +{ + return adjustment->lower; +} +#define gtk_adjustment_get_lower wx_gtk_adjustment_get_lower + +static inline gdouble wx_gtk_adjustment_get_page_increment(GtkAdjustment* adjustment) +{ + return adjustment->page_increment; +} +#define gtk_adjustment_get_page_increment wx_gtk_adjustment_get_page_increment + +static inline gdouble wx_gtk_adjustment_get_page_size(GtkAdjustment* adjustment) +{ + return adjustment->page_size; +} +#define gtk_adjustment_get_page_size wx_gtk_adjustment_get_page_size + +static inline gdouble wx_gtk_adjustment_get_step_increment(GtkAdjustment* adjustment) +{ + return adjustment->step_increment; +} +#define gtk_adjustment_get_step_increment wx_gtk_adjustment_get_step_increment + +static inline gdouble wx_gtk_adjustment_get_upper(GtkAdjustment* adjustment) +{ + return adjustment->upper; +} +#define gtk_adjustment_get_upper wx_gtk_adjustment_get_upper + +static inline void wx_gtk_adjustment_set_page_size(GtkAdjustment* adjustment, gdouble page_size) +{ + adjustment->page_size = page_size; +} +#define gtk_adjustment_set_page_size wx_gtk_adjustment_set_page_size + +static inline GtkWidget* wx_gtk_color_selection_dialog_get_color_selection(GtkColorSelectionDialog* csd) +{ + return csd->colorsel; +} +#define gtk_color_selection_dialog_get_color_selection wx_gtk_color_selection_dialog_get_color_selection + +static inline GtkWidget* wx_gtk_dialog_get_content_area(GtkDialog* dialog) +{ + return dialog->vbox; +} +#define gtk_dialog_get_content_area wx_gtk_dialog_get_content_area + +static inline GtkWidget* wx_gtk_dialog_get_action_area(GtkDialog* dialog) +{ + return dialog->action_area; +} +#define gtk_dialog_get_action_area wx_gtk_dialog_get_action_area + +static inline guint16 wx_gtk_entry_get_text_length(GtkEntry* entry) +{ + return entry->text_length; +} +#define gtk_entry_get_text_length wx_gtk_entry_get_text_length + +static inline GtkWidget* wx_gtk_font_selection_dialog_get_cancel_button(GtkFontSelectionDialog* fsd) +{ + return fsd->cancel_button; +} +#define gtk_font_selection_dialog_get_cancel_button wx_gtk_font_selection_dialog_get_cancel_button + +static inline GtkWidget* wx_gtk_font_selection_dialog_get_ok_button(GtkFontSelectionDialog* fsd) +{ + return fsd->ok_button; +} +#define gtk_font_selection_dialog_get_ok_button wx_gtk_font_selection_dialog_get_ok_button + +static inline const guchar* wx_gtk_selection_data_get_data(GtkSelectionData* selection_data) +{ + return selection_data->data; +} +#define gtk_selection_data_get_data wx_gtk_selection_data_get_data + +static inline GdkAtom wx_gtk_selection_data_get_data_type(GtkSelectionData* selection_data) +{ + return selection_data->type; +} +#define gtk_selection_data_get_data_type wx_gtk_selection_data_get_data_type + +static inline gint wx_gtk_selection_data_get_format(GtkSelectionData* selection_data) +{ + return selection_data->format; +} +#define gtk_selection_data_get_format wx_gtk_selection_data_get_format + +static inline gint wx_gtk_selection_data_get_length(GtkSelectionData* selection_data) +{ + return selection_data->length; +} +#define gtk_selection_data_get_length wx_gtk_selection_data_get_length + +static inline GdkAtom wx_gtk_selection_data_get_target(GtkSelectionData* selection_data) +{ + return selection_data->target; +} +#define gtk_selection_data_get_target wx_gtk_selection_data_get_target + +static inline GdkWindow* wx_gtk_widget_get_window(GtkWidget* widget) +{ + return widget->window; +} +#define gtk_widget_get_window wx_gtk_widget_get_window + +static inline GtkWidget* wx_gtk_window_get_default_widget(GtkWindow* window) +{ + return window->default_widget; +} +#define gtk_window_get_default_widget wx_gtk_window_get_default_widget + +// ---------------------------------------------------------------------------- +// the following were introduced in GTK+ 2.16 + +static inline GdkAtom wx_gtk_selection_data_get_selection(GtkSelectionData* selection_data) +{ + return selection_data->selection; +} +#define gtk_selection_data_get_selection wx_gtk_selection_data_get_selection + +// ---------------------------------------------------------------------------- +// the following were introduced in GTK+ 2.18 + +static inline void wx_gtk_cell_renderer_get_alignment(GtkCellRenderer* cell, gfloat* xalign, gfloat* yalign) +{ + *xalign = cell->xalign; + *yalign = cell->yalign; +} +#define gtk_cell_renderer_get_alignment wx_gtk_cell_renderer_get_alignment + +static inline void wx_gtk_cell_renderer_get_padding(GtkCellRenderer* cell, gint* xpad, gint* ypad) +{ + *xpad = cell->xpad; + *ypad = cell->ypad; +} +#define gtk_cell_renderer_get_padding wx_gtk_cell_renderer_get_padding + +static inline void wx_gtk_widget_get_allocation(GtkWidget* widget, GtkAllocation* allocation) +{ + *allocation = widget->allocation; +} +#define gtk_widget_get_allocation wx_gtk_widget_get_allocation + +inline gboolean wx_gtk_widget_get_has_window(GtkWidget *widget) +{ + return !GTK_WIDGET_NO_WINDOW(widget); +} +#define gtk_widget_get_has_window wx_gtk_widget_get_has_window + + +inline gboolean wx_gtk_widget_get_has_grab(GtkWidget *widget) +{ + return GTK_WIDGET_HAS_GRAB(widget); +} +#define gtk_widget_get_has_grab wx_gtk_widget_get_has_grab + + +inline gboolean wx_gtk_widget_get_visible(GtkWidget *widget) +{ + return GTK_WIDGET_VISIBLE(widget); +} +#define gtk_widget_get_visible wx_gtk_widget_get_visible + + +inline gboolean wx_gtk_widget_get_sensitive(GtkWidget *widget) +{ + return GTK_WIDGET_SENSITIVE(widget); +} +#define gtk_widget_get_sensitive wx_gtk_widget_get_sensitive + + +inline gboolean wx_gtk_widget_is_drawable(GtkWidget *widget) +{ + return GTK_WIDGET_DRAWABLE(widget); +} +#define gtk_widget_is_drawable wx_gtk_widget_is_drawable + + +inline gboolean wx_gtk_widget_get_can_focus(GtkWidget *widget) +{ + return GTK_WIDGET_CAN_FOCUS(widget); +} +#define gtk_widget_get_can_focus wx_gtk_widget_get_can_focus + +inline void wx_gtk_widget_set_can_focus(GtkWidget *widget, gboolean can) +{ + if ( can ) + GTK_WIDGET_SET_FLAGS(widget, GTK_CAN_FOCUS); + else + GTK_WIDGET_UNSET_FLAGS(widget, GTK_CAN_FOCUS); +} +#define gtk_widget_set_can_focus wx_gtk_widget_set_can_focus + + +inline gboolean wx_gtk_widget_get_can_default(GtkWidget *widget) +{ + return GTK_WIDGET_CAN_DEFAULT(widget); +} +#define gtk_widget_get_can_default wx_gtk_widget_get_can_default + +inline void wx_gtk_widget_set_can_default(GtkWidget *widget, gboolean can) +{ + if ( can ) + GTK_WIDGET_SET_FLAGS(widget, GTK_CAN_DEFAULT); + else + GTK_WIDGET_UNSET_FLAGS(widget, GTK_CAN_DEFAULT); +} +#define gtk_widget_set_can_default wx_gtk_widget_set_can_default + + +inline gboolean wx_gtk_widget_has_default(GtkWidget *widget) +{ + return GTK_WIDGET_HAS_DEFAULT(widget); +} +#define gtk_widget_has_default wx_gtk_widget_has_default + + +inline GtkStateType wx_gtk_widget_get_state(GtkWidget *widget) +{ + return (GtkStateType)GTK_WIDGET_STATE(widget); +} +#define gtk_widget_get_state wx_gtk_widget_get_state + + +inline gboolean wx_gtk_widget_get_double_buffered(GtkWidget *widget) +{ + return GTK_WIDGET_DOUBLE_BUFFERED(widget); +} +#define gtk_widget_get_double_buffered wx_gtk_widget_get_double_buffered + +static inline gboolean wx_gtk_widget_has_grab(GtkWidget* widget) +{ + return GTK_WIDGET_HAS_GRAB(widget); +} +#define gtk_widget_has_grab wx_gtk_widget_has_grab + +static inline void wx_gtk_widget_set_allocation(GtkWidget* widget, const GtkAllocation* allocation) +{ + widget->allocation = *allocation; +} +#define gtk_widget_set_allocation wx_gtk_widget_set_allocation + +// ---------------------------------------------------------------------------- +// the following were introduced in GTK+ 2.20 + +inline gboolean wx_gtk_widget_get_realized(GtkWidget *widget) +{ + return GTK_WIDGET_REALIZED(widget); +} +#define gtk_widget_get_realized wx_gtk_widget_get_realized + + +inline gboolean wx_gtk_widget_get_mapped(GtkWidget *widget) +{ + return GTK_WIDGET_MAPPED(widget); +} +#define gtk_widget_get_mapped wx_gtk_widget_get_mapped + +static inline void wx_gtk_widget_get_requisition(GtkWidget* widget, GtkRequisition* requisition) +{ + *requisition = widget->requisition; +} +#define gtk_widget_get_requisition wx_gtk_widget_get_requisition + +static inline GdkWindow* wx_gtk_entry_get_text_window(GtkEntry* entry) +{ + return entry->text_area; +} +#define gtk_entry_get_text_window wx_gtk_entry_get_text_window + +// ---------------------------------------------------------------------------- +// the following were introduced in GTK+ 2.24 + +static inline gint wx_gdk_window_get_height(GdkWindow* window) +{ + int h; + gdk_drawable_get_size(window, NULL, &h); + return h; +} +#define gdk_window_get_height wx_gdk_window_get_height + +static inline gint wx_gdk_window_get_width(GdkWindow* window) +{ + int w; + gdk_drawable_get_size(window, &w, NULL); + return w; +} +#define gdk_window_get_width wx_gdk_window_get_width + +#if GTK_CHECK_VERSION(2,10,0) +static inline void wx_gdk_cairo_set_source_window(cairo_t* cr, GdkWindow* window, gdouble x, gdouble y) +{ + gdk_cairo_set_source_pixmap(cr, window, x, y); +} +#define gdk_cairo_set_source_window wx_gdk_cairo_set_source_window +#endif + +#endif // !GTK_CHECK_VERSION(3,0,0) && !defined(GTK_DISABLE_DEPRECATED) + + +#endif // _WX_GTK_PRIVATE_COMPAT_H_ + diff --git a/Externals/wxWidgets3/include/wx/gtk/private/list.h b/Externals/wxWidgets3/include/wx/gtk/private/list.h new file mode 100644 index 0000000000..0ec669317d --- /dev/null +++ b/Externals/wxWidgets3/include/wx/gtk/private/list.h @@ -0,0 +1,33 @@ +/////////////////////////////////////////////////////////////////////////////// +// Name: wx/gtk/private/list.h +// Purpose: wxGtkList class. +// Author: Vadim Zeitlin +// Created: 2011-08-21 +// RCS-ID: $Id: list.h 68842 2011-08-22 12:41:00Z VZ $ +// Copyright: (c) 2011 Vadim Zeitlin +// Licence: wxWindows licence +/////////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_GTK_PRIVATE_LIST_H_ +#define _WX_GTK_PRIVATE_LIST_H_ + +// ---------------------------------------------------------------------------- +// Convenience class for calling g_list_free() automatically +// ---------------------------------------------------------------------------- + +class wxGtkList +{ +public: + explicit wxGtkList(GList* list) : m_list(list) { } + ~wxGtkList() { g_list_free(m_list); } + + operator GList *() const { return m_list; } + GList * operator->() const { return m_list; } + +protected: + GList* const m_list; + + wxDECLARE_NO_COPY_CLASS(wxGtkList); +}; + +#endif // _WX_GTK_PRIVATE_LIST_H_ diff --git a/Externals/wxWidgets3/include/wx/gtk/private/timer.h b/Externals/wxWidgets3/include/wx/gtk/private/timer.h index 1d845fd873..509303cda6 100644 --- a/Externals/wxWidgets3/include/wx/gtk/private/timer.h +++ b/Externals/wxWidgets3/include/wx/gtk/private/timer.h @@ -2,7 +2,7 @@ // Name: wx/gtk/private/timer.h // Purpose: wxTimerImpl for wxGTK // Author: Robert Roebling -// Id: $Id: timer.h 67254 2011-03-20 00:14:35Z DS $ +// Id: $Id: timer.h 70165 2011-12-29 14:42:13Z SN $ // Copyright: (c) 1998 Robert Roebling // Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// @@ -21,7 +21,7 @@ class WXDLLIMPEXP_CORE wxGTKTimerImpl : public wxTimerImpl { public: - wxGTKTimerImpl(wxTimer* timer) : wxTimerImpl(timer) { m_sourceId = 0; }; + wxGTKTimerImpl(wxTimer* timer) : wxTimerImpl(timer) { m_sourceId = 0; } virtual bool Start( int millisecs = -1, bool oneShot = false ); virtual void Stop(); diff --git a/Externals/wxWidgets3/include/wx/gtk/radiobox.h b/Externals/wxWidgets3/include/wx/gtk/radiobox.h index cf875dd5ac..ced13bc390 100644 --- a/Externals/wxWidgets3/include/wx/gtk/radiobox.h +++ b/Externals/wxWidgets3/include/wx/gtk/radiobox.h @@ -2,7 +2,7 @@ // Name: wx/gtk/radiobox.h // Purpose: // Author: Robert Roebling -// Id: $Id: radiobox.h 60885 2009-06-03 22:33:32Z VZ $ +// Id: $Id: radiobox.h 67298 2011-03-23 17:36:10Z PC $ // Copyright: (c) 1998 Robert Roebling // Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// @@ -131,7 +131,7 @@ public: void GtkDisableEvents(); void GtkEnableEvents(); #if wxUSE_TOOLTIPS - void GTKApplyToolTip( GtkTooltips *tips, const gchar *tip ); + virtual void GTKApplyToolTip(const char* tip); #endif // wxUSE_TOOLTIPS wxRadioBoxButtonsInfoList m_buttonsInfo; diff --git a/Externals/wxWidgets3/include/wx/gtk/region.h b/Externals/wxWidgets3/include/wx/gtk/region.h index cba99cf1cd..18b2f26169 100644 --- a/Externals/wxWidgets3/include/wx/gtk/region.h +++ b/Externals/wxWidgets3/include/wx/gtk/region.h @@ -2,7 +2,7 @@ // Name: wx/gtk/region.h // Purpose: // Author: Robert Roebling -// Id: $Id: region.h 61724 2009-08-21 10:41:26Z VZ $ +// Id: $Id: region.h 69815 2011-11-25 00:52:24Z PC $ // Copyright: (c) 1998 Robert Roebling // Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// @@ -122,13 +122,11 @@ private: void Init(); void CreateRects( const wxRegion& r ); - size_t m_current; wxRegion m_region; - wxRect *m_rects; - size_t m_numRects; + int m_numRects; + int m_current; -private: DECLARE_DYNAMIC_CLASS(wxRegionIterator) }; diff --git a/Externals/wxWidgets3/include/wx/gtk/scrolbar.h b/Externals/wxWidgets3/include/wx/gtk/scrolbar.h index 980504935d..2ab5353ed8 100644 --- a/Externals/wxWidgets3/include/wx/gtk/scrolbar.h +++ b/Externals/wxWidgets3/include/wx/gtk/scrolbar.h @@ -2,7 +2,7 @@ // Name: wx/gtk/scrolbar.h // Purpose: // Author: Robert Roebling -// Id: $Id: scrolbar.h 67254 2011-03-20 00:14:35Z DS $ +// Id: $Id: scrolbar.h 67326 2011-03-28 06:27:49Z PC $ // Copyright: (c) 1998 Robert Roebling // Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// @@ -10,14 +10,6 @@ #ifndef _WX_GTK_SCROLLBAR_H_ #define _WX_GTK_SCROLLBAR_H_ -#include "wx/defs.h" - -//----------------------------------------------------------------------------- -// classes -//----------------------------------------------------------------------------- - -class WXDLLIMPEXP_FWD_CORE wxScrollBar; - //----------------------------------------------------------------------------- // wxScrollBar //----------------------------------------------------------------------------- @@ -57,10 +49,6 @@ public: static wxVisualAttributes GetClassDefaultAttributes(wxWindowVariant variant = wxWINDOW_VARIANT_NORMAL); -protected: - virtual GdkWindow *GTKGetWindow(wxArrayGdkWindows& windows) const; - -private: DECLARE_DYNAMIC_CLASS(wxScrollBar) }; diff --git a/Externals/wxWidgets3/include/wx/gtk/statbox.h b/Externals/wxWidgets3/include/wx/gtk/statbox.h index 7860451813..0d9ab6f624 100644 --- a/Externals/wxWidgets3/include/wx/gtk/statbox.h +++ b/Externals/wxWidgets3/include/wx/gtk/statbox.h @@ -2,7 +2,7 @@ // Name: wx/gtk/statbox.h // Purpose: // Author: Robert Roebling -// Id: $Id: statbox.h 67254 2011-03-20 00:14:35Z DS $ +// Id: $Id: statbox.h 70738 2012-02-28 17:06:56Z PC $ // Copyright: (c) 1998 Robert Roebling // Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// @@ -40,7 +40,7 @@ public: // implementation - virtual bool IsTransparentForMouse() const { return true; } + virtual bool GTKIsTransparentForMouse() const { return true; } virtual void GetBordersForSizer(int *borderTop, int *borderOther) const; diff --git a/Externals/wxWidgets3/include/wx/gtk/textctrl.h b/Externals/wxWidgets3/include/wx/gtk/textctrl.h index 0582485fa1..fb214dc5f9 100644 --- a/Externals/wxWidgets3/include/wx/gtk/textctrl.h +++ b/Externals/wxWidgets3/include/wx/gtk/textctrl.h @@ -3,7 +3,7 @@ // Purpose: // Author: Robert Roebling // Created: 01/02/97 -// Id: $Id: textctrl.h 64404 2010-05-26 17:37:55Z RR $ +// Id: $Id: textctrl.h 68450 2011-07-29 15:11:54Z VZ $ // Copyright: (c) 1998 Robert Roebling // Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// @@ -167,6 +167,8 @@ protected: virtual void DoSetValue(const wxString &value, int flags = 0); + virtual wxPoint DoPositionToCoords(long pos) const; + // wrappers hiding the differences between functions doing the same thing // for GtkTextView and GtkEntry (all of them use current window style to // set the given characteristic) @@ -214,6 +216,7 @@ private: GtkTextBuffer *m_buffer; GtkTextMark* m_showPositionOnThaw; + GSList* m_anonymousMarkList; // For wxTE_AUTO_URL void OnUrlMouseEvent(wxMouseEvent&); diff --git a/Externals/wxWidgets3/include/wx/gtk/textentry.h b/Externals/wxWidgets3/include/wx/gtk/textentry.h index e9fb99c444..c9084a53f4 100644 --- a/Externals/wxWidgets3/include/wx/gtk/textentry.h +++ b/Externals/wxWidgets3/include/wx/gtk/textentry.h @@ -3,7 +3,7 @@ // Purpose: wxGTK-specific wxTextEntry implementation // Author: Vadim Zeitlin // Created: 2007-09-24 -// RCS-ID: $Id: textentry.h 61834 2009-09-05 12:39:12Z JMS $ +// RCS-ID: $Id: textentry.h 67509 2011-04-16 17:27:04Z VZ $ // Copyright: (c) 2007 Vadim Zeitlin // Licence: wxWindows licence /////////////////////////////////////////////////////////////////////////////// @@ -43,8 +43,6 @@ public: virtual void SetSelection(long from, long to); virtual void GetSelection(long *from, long *to) const; - virtual bool AutoComplete(const wxArrayString& choices); - virtual bool IsEditable() const; virtual void SetEditable(bool editable); @@ -60,6 +58,8 @@ protected: virtual bool DoSetMargins(const wxPoint& pt); virtual wxPoint DoGetMargins() const; + virtual bool DoAutoCompleteStrings(const wxArrayString& choices); + private: // implement this to return the associated GtkEntry or another widget // implementing GtkEditable diff --git a/Externals/wxWidgets3/include/wx/gtk/tglbtn.h b/Externals/wxWidgets3/include/wx/gtk/tglbtn.h index 1bdbeb3673..514f5e4e7e 100644 --- a/Externals/wxWidgets3/include/wx/gtk/tglbtn.h +++ b/Externals/wxWidgets3/include/wx/gtk/tglbtn.h @@ -5,7 +5,7 @@ // Author: John Norris, minor changes by Axel Schlueter // Modified by: // Created: 08.02.01 -// RCS-ID: $Id: tglbtn.h 66992 2011-02-22 13:25:30Z VZ $ +// RCS-ID: $Id: tglbtn.h 67931 2011-06-14 13:00:42Z VZ $ // Copyright: (c) 2000 Johnny C. Norris II // Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// @@ -22,67 +22,6 @@ class WXDLLIMPEXP_FWD_CORE wxToggleButton; class WXDLLIMPEXP_FWD_CORE wxToggleBitmapButton; -//----------------------------------------------------------------------------- -// wxBitmapToggleButton -//----------------------------------------------------------------------------- - -class WXDLLIMPEXP_CORE wxBitmapToggleButton: public wxToggleButtonBase -{ -public: - // construction/destruction - wxBitmapToggleButton() {} - wxBitmapToggleButton(wxWindow *parent, - wxWindowID id, - const wxBitmap& label, - const wxPoint& pos = wxDefaultPosition, - const wxSize& size = wxDefaultSize, - long style = 0, - const wxValidator& validator = wxDefaultValidator, - const wxString& name = wxCheckBoxNameStr) - { - Create(parent, id, label, pos, size, style, validator, name); - } - - // Create the control - bool Create(wxWindow *parent, - wxWindowID id, - const wxBitmap& label, - const wxPoint& pos = wxDefaultPosition, - const wxSize& size = wxDefaultSize, long style = 0, - const wxValidator& validator = wxDefaultValidator, - const wxString& name = wxCheckBoxNameStr); - - // Get/set the value - void SetValue(bool state); - bool GetValue() const; - - // Set the label - virtual void SetLabel(const wxString& label) { wxControl::SetLabel(label); } - virtual void SetLabel(const wxBitmap& label); - bool Enable(bool enable = true); - - static wxVisualAttributes - GetClassDefaultAttributes(wxWindowVariant variant = wxWINDOW_VARIANT_NORMAL); - - // implementation - wxBitmap m_bitmap; - - void OnSetBitmap(); - -protected: - void GTKDisableEvents(); - void GTKEnableEvents(); - - virtual wxSize DoGetBestSize() const; - virtual void DoApplyWidgetStyle(GtkRcStyle *style); - virtual GdkWindow *GTKGetWindow(wxArrayGdkWindows& windows) const; - -private: - typedef wxToggleButtonBase base_type; - - DECLARE_DYNAMIC_CLASS(wxBitmapToggleButton) -}; - //----------------------------------------------------------------------------- // wxToggleButton //----------------------------------------------------------------------------- @@ -119,7 +58,6 @@ public: // Set the label void SetLabel(const wxString& label); - bool Enable(bool enable = true); static wxVisualAttributes GetClassDefaultAttributes(wxWindowVariant variant = wxWINDOW_VARIANT_NORMAL); @@ -130,13 +68,61 @@ protected: virtual wxSize DoGetBestSize() const; virtual void DoApplyWidgetStyle(GtkRcStyle *style); - virtual GdkWindow *GTKGetWindow(wxArrayGdkWindows& windows) const; + +#if wxUSE_MARKUP + virtual bool DoSetLabelMarkup(const wxString& markup); +#endif // wxUSE_MARKUP private: typedef wxToggleButtonBase base_type; + // Return the GtkLabel used by this toggle button. + GtkLabel *GTKGetLabel() const; + DECLARE_DYNAMIC_CLASS(wxToggleButton) }; +//----------------------------------------------------------------------------- +// wxBitmapToggleButton +//----------------------------------------------------------------------------- + +class WXDLLIMPEXP_CORE wxBitmapToggleButton: public wxToggleButton +{ +public: + // construction/destruction + wxBitmapToggleButton() {} + wxBitmapToggleButton(wxWindow *parent, + wxWindowID id, + const wxBitmap& label, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + long style = 0, + const wxValidator& validator = wxDefaultValidator, + const wxString& name = wxCheckBoxNameStr) + { + Create(parent, id, label, pos, size, style, validator, name); + } + + // Create the control + bool Create(wxWindow *parent, + wxWindowID id, + const wxBitmap& label, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, long style = 0, + const wxValidator& validator = wxDefaultValidator, + const wxString& name = wxCheckBoxNameStr); + + // deprecated synonym for SetBitmapLabel() + wxDEPRECATED_INLINE( void SetLabel(const wxBitmap& bitmap), + SetBitmapLabel(bitmap); ) + // prevent virtual function hiding + virtual void SetLabel(const wxString& label) { wxToggleButton::SetLabel(label); } + +private: + typedef wxToggleButtonBase base_type; + + DECLARE_DYNAMIC_CLASS(wxBitmapToggleButton) +}; + #endif // _WX_GTK_TOGGLEBUTTON_H_ diff --git a/Externals/wxWidgets3/include/wx/gtk/toolbar.h b/Externals/wxWidgets3/include/wx/gtk/toolbar.h index f97fe264e8..ea71a5c91b 100644 --- a/Externals/wxWidgets3/include/wx/gtk/toolbar.h +++ b/Externals/wxWidgets3/include/wx/gtk/toolbar.h @@ -2,7 +2,7 @@ // Name: wx/gtk/toolbar.h // Purpose: GTK toolbar // Author: Robert Roebling -// RCS-ID: $Id: toolbar.h 66633 2011-01-07 18:15:21Z PC $ +// RCS-ID: $Id: toolbar.h 70854 2012-03-10 00:01:09Z RD $ // Copyright: (c) Robert Roebling // Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// @@ -12,6 +12,8 @@ #if wxUSE_TOOLBAR +typedef struct _GtkTooltips GtkTooltips; + // ---------------------------------------------------------------------------- // wxToolBar // ---------------------------------------------------------------------------- @@ -56,6 +58,17 @@ public: static wxVisualAttributes GetClassDefaultAttributes(wxWindowVariant variant = wxWINDOW_VARIANT_NORMAL); + virtual wxToolBarToolBase *CreateTool(int id, + const wxString& label, + const wxBitmap& bitmap1, + const wxBitmap& bitmap2 = wxNullBitmap, + wxItemKind kind = wxITEM_NORMAL, + wxObject *clientData = NULL, + const wxString& shortHelpString = wxEmptyString, + const wxString& longHelpString = wxEmptyString); + virtual wxToolBarToolBase *CreateTool(wxControl *control, + const wxString& label); + // implementation from now on // -------------------------- @@ -71,17 +84,6 @@ protected: virtual void DoToggleTool(wxToolBarToolBase *tool, bool toggle); virtual void DoSetToggle(wxToolBarToolBase *tool, bool toggle); - virtual wxToolBarToolBase *CreateTool(int id, - const wxString& label, - const wxBitmap& bitmap1, - const wxBitmap& bitmap2, - wxItemKind kind, - wxObject *clientData, - const wxString& shortHelpString, - const wxString& longHelpString); - virtual wxToolBarToolBase *CreateTool(wxControl *control, - const wxString& label); - private: void Init(); void GtkSetStyle(); diff --git a/Externals/wxWidgets3/include/wx/gtk/tooltip.h b/Externals/wxWidgets3/include/wx/gtk/tooltip.h index 3e4589140c..e82880d638 100644 --- a/Externals/wxWidgets3/include/wx/gtk/tooltip.h +++ b/Externals/wxWidgets3/include/wx/gtk/tooltip.h @@ -2,15 +2,14 @@ // Name: wx/gtk/tooltip.h // Purpose: wxToolTip class // Author: Robert Roebling -// Id: $Id: tooltip.h 67254 2011-03-20 00:14:35Z DS $ +// Id: $Id: tooltip.h 67298 2011-03-23 17:36:10Z PC $ // Copyright: (c) 1998 Robert Roebling // Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// -#ifndef __GTKTOOLTIPH__ -#define __GTKTOOLTIPH__ +#ifndef _WX_GTKTOOLTIP_H_ +#define _WX_GTKTOOLTIP_H_ -#include "wx/defs.h" #include "wx/string.h" #include "wx/object.h" @@ -18,7 +17,6 @@ // forward declarations //----------------------------------------------------------------------------- -class WXDLLIMPEXP_FWD_CORE wxToolTip; class WXDLLIMPEXP_FWD_CORE wxWindow; //----------------------------------------------------------------------------- @@ -43,15 +41,10 @@ public: wxString GetTip() const { return m_text; } wxWindow *GetWindow() const { return m_window; } - bool IsOk() const { return m_window != NULL; } - - // this forwards back to wxWindow::GTKApplyToolTip() - void GTKApply( wxWindow *win ); - - // this just sets the given tooltip for the specified widget - // tip must be UTF-8 encoded - static void GTKApply(GtkWidget *w, const gchar *tip); + // Implementation + void GTKSetWindow(wxWindow* win); + static void GTKApply(GtkWidget* widget, const char* tip); private: wxString m_text; @@ -60,4 +53,4 @@ private: DECLARE_ABSTRACT_CLASS(wxToolTip) }; -#endif // __GTKTOOLTIPH__ +#endif // _WX_GTKTOOLTIP_H_ diff --git a/Externals/wxWidgets3/include/wx/gtk/toplevel.h b/Externals/wxWidgets3/include/wx/gtk/toplevel.h index cbfa47d34c..c17f62ed77 100644 --- a/Externals/wxWidgets3/include/wx/gtk/toplevel.h +++ b/Externals/wxWidgets3/include/wx/gtk/toplevel.h @@ -2,7 +2,7 @@ // Name: wx/gtk/toplevel.h // Purpose: // Author: Robert Roebling -// Id: $Id: toplevel.h 65373 2010-08-21 09:53:25Z RR $ +// Id: $Id: toplevel.h 70165 2011-12-29 14:42:13Z SN $ // Copyright: (c) 1998 Robert Roebling, Julian Smart // Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// @@ -55,9 +55,7 @@ public: virtual void ShowWithoutActivating(); virtual bool ShowFullScreen(bool show, long style = wxFULLSCREEN_ALL); - virtual bool IsFullScreen() const { return m_fsIsShowing; }; - - virtual bool SetShape(const wxRegion& region); + virtual bool IsFullScreen() const { return m_fsIsShowing; } virtual void RequestUserAttention(int flags = wxUSER_ATTENTION_INFO); @@ -95,6 +93,8 @@ public: // GTK callbacks virtual void OnInternalIdle(); + virtual void GTKHandleRealized(); + // do *not* call this to iconize the frame, this is a private function! void SetIconizeState(bool iconic); @@ -111,12 +111,11 @@ public: // size of WM decorations wxSize m_decorSize; - // shape of the frame - wxRegion m_shape; - // private gtk_timeout_add result for mimicing wxUSER_ATTENTION_INFO and // wxUSER_ATTENTION_ERROR difference, -2 for no hint, -1 for ERROR hint, rest for GtkTimeout handle. int m_urgency_hint; + // timer for detecting WM with broken _NET_REQUEST_FRAME_EXTENTS handling + unsigned m_netFrameExtentsTimerId; // return the size of the window without WM decorations void GTKDoGetSize(int *width, int *height) const; diff --git a/Externals/wxWidgets3/include/wx/gtk/treeentry_gtk.h b/Externals/wxWidgets3/include/wx/gtk/treeentry_gtk.h index f5c5f84363..5a2c926151 100644 --- a/Externals/wxWidgets3/include/wx/gtk/treeentry_gtk.h +++ b/Externals/wxWidgets3/include/wx/gtk/treeentry_gtk.h @@ -2,7 +2,7 @@ // Name: wx/gtk/treeentry_gtk.h // Purpose: GtkTreeEntry - a string/userdata combo for use with treeview // Author: Ryan Norton -// Id: $Id: treeentry_gtk.h 67254 2011-03-20 00:14:35Z DS $ +// Id: $Id: treeentry_gtk.h 67326 2011-03-28 06:27:49Z PC $ // Copyright: (c) 2006 Ryan Norton // Licence: wxWindows licence /////////////////////////////////////////////////////////////////////////// */ @@ -19,9 +19,9 @@ extern "C" { #include "wx/dlimpexp.h" #define GTK_TYPE_TREE_ENTRY (gtk_tree_entry_get_type()) -#define GTK_TREE_ENTRY(obj) (GTK_CHECK_CAST (obj, gtk_tree_entry_get_type (), GtkTreeEntry)) -#define GTK_TREE_ENTRY_CLASS(klass) (GTK_CHECK_CLASS_CAST (klass, gtk_tree_entry_get_type (), GtkTreeEntryClass)) -#define GTK_IS_TREE_ENTRY(obj) (GTK_CHECK_TYPE (obj, gtk_tree_entry_get_type ())) +#define GTK_TREE_ENTRY(obj) (G_TYPE_CHECK_INSTANCE_CAST (obj, gtk_tree_entry_get_type (), GtkTreeEntry)) +#define GTK_TREE_ENTRY_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST (klass, gtk_tree_entry_get_type (), GtkTreeEntryClass)) +#define GTK_IS_TREE_ENTRY(obj) (G_TYPE_CHECK_INSTANCE_TYPE (obj, gtk_tree_entry_get_type ())) typedef struct _GtkTreeEntry GtkTreeEntry; typedef struct _GtkTreeEntryClass GtkTreeEntryClass; @@ -47,7 +47,7 @@ WXDLLIMPEXP_CORE GtkTreeEntry* gtk_tree_entry_new (void); WXDLLIMPEXP_CORE -GtkType gtk_tree_entry_get_type (void); +GType gtk_tree_entry_get_type (void); WXDLLIMPEXP_CORE gchar* gtk_tree_entry_get_collate_key (GtkTreeEntry* entry); diff --git a/Externals/wxWidgets3/include/wx/gtk/webview_webkit.h b/Externals/wxWidgets3/include/wx/gtk/webview_webkit.h new file mode 100644 index 0000000000..cfb7e08aaa --- /dev/null +++ b/Externals/wxWidgets3/include/wx/gtk/webview_webkit.h @@ -0,0 +1,156 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: include/gtk/wx/webview.h +// Purpose: GTK webkit backend for web view component +// Author: Robert Roebling, Marianne Gagnon +// Id: $Id: webview_webkit.h 70768 2012-03-01 16:44:31Z PC $ +// Copyright: (c) 2010 Marianne Gagnon, 1998 Robert Roebling +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_GTK_WEBKITCTRL_H_ +#define _WX_GTK_WEBKITCTRL_H_ + +#include "wx/setup.h" + +#if wxUSE_WEBVIEW && wxUSE_WEBVIEW_WEBKIT && defined(__WXGTK__) + +#include "wx/sharedptr.h" +#include "wx/webview.h" + +typedef struct _WebKitWebView WebKitWebView; + +//----------------------------------------------------------------------------- +// wxWebViewWebKit +//----------------------------------------------------------------------------- + +class WXDLLIMPEXP_WEBVIEW wxWebViewWebKit : public wxWebView +{ +public: + wxWebViewWebKit() { Init(); } + + wxWebViewWebKit(wxWindow *parent, + wxWindowID id = wxID_ANY, + const wxString& url = wxWebViewDefaultURLStr, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, long style = 0, + const wxString& name = wxWebViewNameStr) + { + Init(); + + Create(parent, id, url, pos, size, style, name); + } + + virtual bool Create(wxWindow *parent, + wxWindowID id = wxID_ANY, + const wxString& url = wxWebViewDefaultURLStr, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, long style = 0, + const wxString& name = wxWebViewNameStr); + + virtual bool Enable( bool enable = true ); + + // implementation + // -------------- + + static wxVisualAttributes + GetClassDefaultAttributes(wxWindowVariant variant = wxWINDOW_VARIANT_NORMAL); + + virtual void Stop(); + virtual void LoadURL(const wxString& url); + virtual void GoBack(); + virtual void GoForward(); + virtual void Reload(wxWebViewReloadFlags flags = wxWEB_VIEW_RELOAD_DEFAULT); + virtual bool CanGoBack() const; + virtual bool CanGoForward() const; + virtual void ClearHistory(); + virtual void EnableHistory(bool enable = true); + virtual wxVector > GetBackwardHistory(); + virtual wxVector > GetForwardHistory(); + virtual void LoadHistoryItem(wxSharedPtr item); + virtual wxString GetCurrentURL() const; + virtual wxString GetCurrentTitle() const; + virtual wxString GetPageSource() const; + virtual wxString GetPageText() const; + //We do not want to hide the other overloads + using wxWebView::SetPage; + virtual void SetPage(const wxString& html, const wxString& baseUrl); + virtual void Print(); + virtual bool IsBusy() const; + + void SetZoomType(wxWebViewZoomType); + wxWebViewZoomType GetZoomType() const; + bool CanSetZoomType(wxWebViewZoomType) const; + virtual wxWebViewZoom GetZoom() const; + virtual void SetZoom(wxWebViewZoom); + + //Clipboard functions + virtual bool CanCut() const; + virtual bool CanCopy() const; + virtual bool CanPaste() const; + virtual void Cut(); + virtual void Copy(); + virtual void Paste(); + + //Undo / redo functionality + virtual bool CanUndo() const; + virtual bool CanRedo() const; + virtual void Undo(); + virtual void Redo(); + + //Editing functions + virtual void SetEditable(bool enable = true); + virtual bool IsEditable() const; + + //Selection + virtual void DeleteSelection(); + virtual bool HasSelection() const; + virtual void SelectAll(); + virtual wxString GetSelectedText() const; + virtual wxString GetSelectedSource() const; + virtual void ClearSelection(); + + virtual void RunScript(const wxString& javascript); + + //Virtual Filesystem Support + virtual void RegisterHandler(wxSharedPtr handler); + virtual wxVector > GetHandlers() { return m_handlerList; } + + /** TODO: check if this can be made private + * The native control has a getter to check for busy state, but except in + * very recent versions of webkit this getter doesn't say everything we need + * (namely it seems to stay indefinitely busy when loading is cancelled by + * user) + */ + bool m_busy; + + wxString m_vfsurl; + + //We use this flag to stop recursion when we load a page from the navigation + //callback, mainly when loading a VFS page + bool m_guard; + +protected: + + virtual GdkWindow *GTKGetWindow(wxArrayGdkWindows& windows) const; + +private: + + void ZoomIn(); + void ZoomOut(); + void SetWebkitZoom(float level); + float GetWebkitZoom() const; + + // focus event handler: calls GTKUpdateBitmap() + void GTKOnFocus(wxFocusEvent& event); + + WebKitWebView *m_web_view; + int m_historyLimit; + + wxVector > m_handlerList; + + wxDECLARE_DYNAMIC_CLASS(wxWebViewWebKit); +}; + +#endif // wxUSE_WEBVIEW && wxUSE_WEBVIEW_WEBKIT && defined(__WXGTK__) + +#endif diff --git a/Externals/wxWidgets3/include/wx/gtk/webviewhistoryitem_webkit.h b/Externals/wxWidgets3/include/wx/gtk/webviewhistoryitem_webkit.h new file mode 100644 index 0000000000..cbadf4ef5f --- /dev/null +++ b/Externals/wxWidgets3/include/wx/gtk/webviewhistoryitem_webkit.h @@ -0,0 +1,34 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: include/wx/gtk/webviewhistoryitem.h +// Purpose: wxWebViewHistoryItem header for GTK +// Author: Steven Lamerton +// Id: $Id: webviewhistoryitem_webkit.h 69770 2011-11-17 01:23:03Z RD $ +// Copyright: (c) 2011 Steven Lamerton +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_GTK_WEBVIEWHISTORYITEM_H_ +#define _WX_GTK_WEBVIEWHISTORYITEM_H_ + +#include "wx/setup.h" + +#if wxUSE_WEBVIEW && wxUSE_WEBVIEW_WEBKIT && defined(__WXGTK__) + +class WXDLLIMPEXP_WEBVIEW wxWebViewHistoryItem +{ +public: + wxWebViewHistoryItem(const wxString& url, const wxString& title) : + m_url(url), m_title(title) {} + wxString GetUrl() { return m_url; } + wxString GetTitle() { return m_title; } + + friend class wxWebViewWebKit; + +private: + wxString m_url, m_title; + void* m_histItem; +}; + +#endif // wxUSE_WEBVIEW && wxUSE_WEBVIEW_WEBKIT && defined(__WXGTK__) + +#endif // _WX_GTK_WEBVIEWHISTORYITEM_H_ diff --git a/Externals/wxWidgets3/include/wx/gtk/window.h b/Externals/wxWidgets3/include/wx/gtk/window.h index 7d2e6ed4fb..7238d6149b 100644 --- a/Externals/wxWidgets3/include/wx/gtk/window.h +++ b/Externals/wxWidgets3/include/wx/gtk/window.h @@ -2,7 +2,7 @@ // Name: wx/gtk/window.h // Purpose: // Author: Robert Roebling -// Id: $Id: window.h 65680 2010-09-30 11:44:45Z VZ $ +// Id: $Id: window.h 70569 2012-02-11 16:26:52Z VZ $ // Copyright: (c) 1998 Robert Roebling // Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// @@ -18,6 +18,13 @@ struct wxGtkIMData; WX_DEFINE_EXPORTED_ARRAY_PTR(GdkWindow *, wxArrayGdkWindows); +extern "C" +{ + +typedef void (*wxGTKCallback)(); + +} + //----------------------------------------------------------------------------- // wxWindowGTK //----------------------------------------------------------------------------- @@ -52,8 +59,6 @@ public: virtual bool Show( bool show = true ); - virtual void SetWindowStyleFlag( long style ); - virtual bool IsRetained() const; virtual void SetFocus(); @@ -76,6 +81,7 @@ public: virtual bool SetFont( const wxFont &font ); virtual bool SetBackgroundStyle(wxBackgroundStyle style) ; + virtual bool IsTransparentBackgroundSupported(wxString* reason = NULL) const; virtual int GetCharHeight() const; virtual int GetCharWidth() const; @@ -187,6 +193,10 @@ public: void GTKHandleFocusOutNoDeferring(); static void GTKHandleDeferredFocusOut(); + // Called when m_widget becomes realized. Derived classes must call the + // base class method if they override it. + virtual void GTKHandleRealized(); + protected: // for controls composed of multiple GTK widgets, return true to eliminate // spurious focus events if the focus changes between GTK+ children within @@ -218,7 +228,7 @@ public: #if wxUSE_TOOLTIPS // applies tooltip to the widget (tip must be UTF-8 encoded) - virtual void GTKApplyToolTip( GtkTooltips *tips, const gchar *tip ); + virtual void GTKApplyToolTip(const char* tip); #endif // wxUSE_TOOLTIPS // Called when a window should delay showing itself @@ -370,7 +380,7 @@ protected: // // This is just a wrapper for g_signal_connect() and returns the handler id // just as it does. - gulong GTKConnectWidget(const char *signal, void (*callback)()); + unsigned long GTKConnectWidget(const char *signal, wxGTKCallback callback); // Return true from here if PostCreation() should connect to size_request // signal: this is done by default but doesn't work for some native @@ -390,7 +400,6 @@ private: bool DoScrollByUnits(ScrollDir dir, ScrollUnit unit, int units); virtual void AddChildGTK(wxWindowGTK* child); - DECLARE_DYNAMIC_CLASS(wxWindowGTK) wxDECLARE_NO_COPY_CLASS(wxWindowGTK); }; diff --git a/Externals/wxWidgets3/include/wx/hash.h b/Externals/wxWidgets3/include/wx/hash.h index d20c83c668..c30644fcfb 100644 --- a/Externals/wxWidgets3/include/wx/hash.h +++ b/Externals/wxWidgets3/include/wx/hash.h @@ -4,7 +4,7 @@ // Author: Julian Smart // Modified by: VZ at 25.02.00: type safe hashes with WX_DECLARE_HASH() // Created: 01/02/97 -// RCS-ID: $Id: hash.h 58757 2009-02-08 11:45:59Z VZ $ +// RCS-ID: $Id: hash.h 67343 2011-03-30 14:16:04Z VZ $ // Copyright: (c) Julian Smart // Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// @@ -15,7 +15,7 @@ #include "wx/defs.h" #include "wx/string.h" -#if !wxUSE_STL +#if !wxUSE_STD_CONTAINERS #include "wx/object.h" #else class WXDLLIMPEXP_FWD_BASE wxObject; @@ -80,7 +80,7 @@ protected: }; class WXDLLIMPEXP_BASE wxHashTableBase -#if !wxUSE_STL +#if !wxUSE_STD_CONTAINERS : public wxObject #endif { diff --git a/Externals/wxWidgets3/include/wx/hashmap.h b/Externals/wxWidgets3/include/wx/hashmap.h index 058c5c9e38..f7288a6df0 100644 --- a/Externals/wxWidgets3/include/wx/hashmap.h +++ b/Externals/wxWidgets3/include/wx/hashmap.h @@ -4,7 +4,7 @@ // Author: Mattia Barbon // Modified by: // Created: 29/01/2002 -// RCS-ID: $Id: hashmap.h 66711 2011-01-19 10:47:49Z VZ $ +// RCS-ID: $Id: hashmap.h 69568 2011-10-27 22:26:10Z VZ $ // Copyright: (c) Mattia Barbon // Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// @@ -15,9 +15,9 @@ #include "wx/string.h" #include "wx/wxcrt.h" -// In wxUSE_STL build we prefer to use the standard hash map class but it can -// be either in non-standard hash_map header (old g++ and some other STL -// implementations) or in C++0x standard unordered_map which can in turn be +// In wxUSE_STD_CONTAINERS build we prefer to use the standard hash map class +// but it can be either in non-standard hash_map header (old g++ and some other +// STL implementations) or in C++0x standard unordered_map which can in turn be // available either in std::tr1 or std namespace itself // // To summarize: if std::unordered_map is available use it, otherwise use tr1 @@ -28,7 +28,7 @@ #define HAVE_STL_HASH_MAP #endif -#if wxUSE_STL && \ +#if wxUSE_STD_CONTAINERS && \ (defined(HAVE_STD_UNORDERED_MAP) || defined(HAVE_TR1_UNORDERED_MAP)) #if defined(HAVE_STD_UNORDERED_MAP) @@ -42,7 +42,7 @@ #define _WX_DECLARE_HASH_MAP( KEY_T, VALUE_T, HASH_T, KEY_EQ_T, CLASSNAME, CLASSEXP ) \ typedef WX_HASH_MAP_NAMESPACE::unordered_map< KEY_T, VALUE_T, HASH_T, KEY_EQ_T > CLASSNAME -#elif wxUSE_STL && defined(HAVE_STL_HASH_MAP) +#elif wxUSE_STD_CONTAINERS && defined(HAVE_STL_HASH_MAP) #if defined(HAVE_EXT_HASH_MAP) #include @@ -59,7 +59,7 @@ #define _WX_DECLARE_HASH_MAP( KEY_T, VALUE_T, HASH_T, KEY_EQ_T, CLASSNAME, CLASSEXP ) \ typedef WX_HASH_MAP_NAMESPACE::hash_map< KEY_T, VALUE_T, HASH_T, KEY_EQ_T > CLASSNAME -#else // !wxUSE_STL || no std::{hash,unordered}_map class available +#else // !wxUSE_STD_CONTAINERS || no std::{hash,unordered}_map class available #define wxNEEDS_WX_HASH_MAP @@ -127,7 +127,9 @@ protected: } }; -#define _WX_DECLARE_HASHTABLE( VALUE_T, KEY_T, HASH_T, KEY_EX_T, KEY_EQ_T, CLASSNAME, CLASSEXP, SHOULD_GROW, SHOULD_SHRINK ) \ +#define _WX_DECLARE_HASHTABLE( VALUE_T, KEY_T, HASH_T, KEY_EX_T, KEY_EQ_T,\ + PTROPERATOR, CLASSNAME, CLASSEXP, \ + SHOULD_GROW, SHOULD_SHRINK ) \ CLASSEXP CLASSNAME : protected _wxHashTableBase2 \ { \ public: \ @@ -217,7 +219,7 @@ public: \ iterator& operator++() { PlusPlus(); return *this; } \ iterator operator++(int) { iterator it=*this;PlusPlus();return it; } \ reference operator *() const { return m_node->m_value; } \ - pointer operator ->() const { return &(m_node->m_value); } \ + PTROPERATOR(pointer) \ }; \ \ CLASSEXP const_iterator : public Iterator \ @@ -230,7 +232,7 @@ public: \ const_iterator& operator++() { PlusPlus();return *this; } \ const_iterator operator++(int) { const_iterator it=*this;PlusPlus();return it; } \ const_reference operator *() const { return m_node->m_value; } \ - const_pointer operator ->() const { return &(m_node->m_value); } \ + PTROPERATOR(const_pointer) \ }; \ \ CLASSNAME( size_type sz = 10, const hasher& hfun = hasher(), \ @@ -632,10 +634,16 @@ public: #ifdef wxNEEDS_WX_HASH_MAP +#define wxPTROP_NORMAL(pointer) \ + pointer operator ->() const { return &(m_node->m_value); } +#define wxPTROP_NOP(pointer) + #define _WX_DECLARE_HASH_MAP( KEY_T, VALUE_T, HASH_T, KEY_EQ_T, CLASSNAME, CLASSEXP ) \ _WX_DECLARE_PAIR( KEY_T, VALUE_T, CLASSNAME##_wxImplementation_Pair, CLASSEXP ) \ _WX_DECLARE_HASH_MAP_KEY_EX( KEY_T, CLASSNAME##_wxImplementation_Pair, CLASSNAME##_wxImplementation_KeyEx, CLASSEXP ) \ -_WX_DECLARE_HASHTABLE( CLASSNAME##_wxImplementation_Pair, KEY_T, HASH_T, CLASSNAME##_wxImplementation_KeyEx, KEY_EQ_T, CLASSNAME##_wxImplementation_HashTable, CLASSEXP, grow_lf70, never_shrink ) \ +_WX_DECLARE_HASHTABLE( CLASSNAME##_wxImplementation_Pair, KEY_T, HASH_T, \ + CLASSNAME##_wxImplementation_KeyEx, KEY_EQ_T, wxPTROP_NORMAL, \ + CLASSNAME##_wxImplementation_HashTable, CLASSEXP, grow_lf70, never_shrink ) \ CLASSEXP CLASSNAME:public CLASSNAME##_wxImplementation_HashTable \ { \ public: \ @@ -676,7 +684,7 @@ public: \ \ size_type erase( const key_type& k ) \ { return CLASSNAME##_wxImplementation_HashTable::erase( k ); } \ - void erase( const iterator& it ) { erase( it->first ); } \ + void erase( const iterator& it ) { erase( (*it).first ); } \ \ /* count() == 0 | 1 */ \ size_type count( const const_key_type& key ) \ diff --git a/Externals/wxWidgets3/include/wx/hashset.h b/Externals/wxWidgets3/include/wx/hashset.h index 54a7779c4a..e5f4d10eca 100644 --- a/Externals/wxWidgets3/include/wx/hashset.h +++ b/Externals/wxWidgets3/include/wx/hashset.h @@ -4,7 +4,7 @@ // Author: Mattia Barbon // Modified by: // Created: 11/08/2003 -// RCS-ID: $Id: hashset.h 60410 2009-04-27 13:26:19Z VZ $ +// RCS-ID: $Id: hashset.h 69568 2011-10-27 22:26:10Z VZ $ // Copyright: (c) Mattia Barbon // Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// @@ -17,7 +17,7 @@ // see comment in wx/hashmap.h which also applies to different standard hash // set classes -#if wxUSE_STL && \ +#if wxUSE_STD_CONTAINERS && \ (defined(HAVE_STD_UNORDERED_SET) || defined(HAVE_TR1_UNORDERED_SET)) #if defined(HAVE_STD_UNORDERED_SET) @@ -30,7 +30,7 @@ #error Update this code: unordered_set is available, but I do not know where. #endif -#elif wxUSE_STL && defined(HAVE_STL_HASH_MAP) +#elif wxUSE_STD_CONTAINERS && defined(HAVE_STL_HASH_MAP) #if defined(HAVE_EXT_HASH_MAP) #include @@ -46,7 +46,7 @@ // we need to define the class declared by _WX_DECLARE_HASH_SET as a class and // not a typedef to allow forward declaring it -#define _WX_DECLARE_HASH_SET( KEY_T, HASH_T, KEY_EQ_T, CLASSNAME, CLASSEXP ) \ +#define _WX_DECLARE_HASH_SET( KEY_T, HASH_T, KEY_EQ_T, PTROP, CLASSNAME, CLASSEXP ) \ CLASSEXP CLASSNAME \ : public WX_HASH_SET_BASE_TEMPLATE< KEY_T, HASH_T, KEY_EQ_T > \ { \ @@ -89,9 +89,11 @@ public: \ CLASSNAME& operator=(const CLASSNAME&) { return *this; } \ }; -#define _WX_DECLARE_HASH_SET( KEY_T, HASH_T, KEY_EQ_T, CLASSNAME, CLASSEXP )\ +#define _WX_DECLARE_HASH_SET( KEY_T, HASH_T, KEY_EQ_T, PTROP, CLASSNAME, CLASSEXP )\ _WX_DECLARE_HASH_SET_KEY_EX( KEY_T, CLASSNAME##_wxImplementation_KeyEx, CLASSEXP ) \ -_WX_DECLARE_HASHTABLE( KEY_T, KEY_T, HASH_T, CLASSNAME##_wxImplementation_KeyEx, KEY_EQ_T, CLASSNAME##_wxImplementation_HashTable, CLASSEXP, grow_lf70, never_shrink ) \ +_WX_DECLARE_HASHTABLE( KEY_T, KEY_T, HASH_T, \ + CLASSNAME##_wxImplementation_KeyEx, KEY_EQ_T, PTROP, \ + CLASSNAME##_wxImplementation_HashTable, CLASSEXP, grow_lf70, never_shrink ) \ CLASSEXP CLASSNAME:public CLASSNAME##_wxImplementation_HashTable \ { \ public: \ @@ -134,17 +136,27 @@ public: \ // these macros are to be used in the user code #define WX_DECLARE_HASH_SET( KEY_T, HASH_T, KEY_EQ_T, CLASSNAME) \ - _WX_DECLARE_HASH_SET( KEY_T, HASH_T, KEY_EQ_T, CLASSNAME, class ) + _WX_DECLARE_HASH_SET( KEY_T, HASH_T, KEY_EQ_T, wxPTROP_NORMAL, CLASSNAME, class ) // and these do exactly the same thing but should be used inside the // library #define WX_DECLARE_HASH_SET_WITH_DECL( KEY_T, HASH_T, KEY_EQ_T, CLASSNAME, DECL) \ - _WX_DECLARE_HASH_SET( KEY_T, HASH_T, KEY_EQ_T, CLASSNAME, DECL ) + _WX_DECLARE_HASH_SET( KEY_T, HASH_T, KEY_EQ_T, wxPTROP_NORMAL, CLASSNAME, DECL ) #define WX_DECLARE_EXPORTED_HASH_SET( KEY_T, HASH_T, KEY_EQ_T, CLASSNAME) \ WX_DECLARE_HASH_SET_WITH_DECL( KEY_T, HASH_T, KEY_EQ_T, \ CLASSNAME, class WXDLLIMPEXP_CORE ) +// Finally these versions allow to define hash sets of non-objects (including +// pointers, hence the confusing but wxArray-compatible name) without +// operator->() which can't be used for them. This is mostly used inside the +// library itself to avoid warnings when using such hash sets with some less +// common compilers (notably Sun CC). +#define WX_DECLARE_HASH_SET_PTR( KEY_T, HASH_T, KEY_EQ_T, CLASSNAME) \ + _WX_DECLARE_HASH_SET( KEY_T, HASH_T, KEY_EQ_T, wxPTROP_NOP, CLASSNAME, class ) +#define WX_DECLARE_HASH_SET_WITH_DECL_PTR( KEY_T, HASH_T, KEY_EQ_T, CLASSNAME, DECL) \ + _WX_DECLARE_HASH_SET( KEY_T, HASH_T, KEY_EQ_T, wxPTROP_NOP, CLASSNAME, DECL ) + // delete all hash elements // // NB: the class declaration of the hash elements must be visible from the diff --git a/Externals/wxWidgets3/include/wx/headercol.h b/Externals/wxWidgets3/include/wx/headercol.h index d3a47d3054..34231fe83e 100644 --- a/Externals/wxWidgets3/include/wx/headercol.h +++ b/Externals/wxWidgets3/include/wx/headercol.h @@ -3,7 +3,7 @@ // Purpose: declaration of wxHeaderColumn class // Author: Vadim Zeitlin // Created: 2008-12-02 -// RCS-ID: $Id: headercol.h 65948 2010-10-30 15:57:41Z VS $ +// RCS-ID: $Id: headercol.h 69174 2011-09-21 15:07:46Z VZ $ // Copyright: (c) 2008 Vadim Zeitlin // Licence: wxWindows licence /////////////////////////////////////////////////////////////////////////////// @@ -97,7 +97,7 @@ public: // unspecified/default virtual int GetWidth() const = 0; - // minimal width can be set for resizeable columns to forbid resizing them + // minimal width can be set for resizable columns to forbid resizing them // below the specified size (set to 0 to remove) virtual int GetMinWidth() const = 0; @@ -177,8 +177,8 @@ public: void ClearFlag(int flag); void ToggleFlag(int flag); - virtual void SetResizeable(bool resizeable) - { ChangeFlag(wxCOL_RESIZABLE, resizeable); } + virtual void SetResizeable(bool resizable) + { ChangeFlag(wxCOL_RESIZABLE, resizable); } virtual void SetSortable(bool sortable) { ChangeFlag(wxCOL_SORTABLE, sortable); } virtual void SetReorderable(bool reorderable) @@ -186,8 +186,12 @@ public: virtual void SetHidden(bool hidden) { ChangeFlag(wxCOL_HIDDEN, hidden); } - virtual void SetAsSortKey(bool sort = true) = 0; - void UnsetAsSortKey() { SetAsSortKey(false); } + // This function can be called to indicate that this column is not used for + // sorting any more. Under some platforms it's not necessary to do anything + // in this case as just setting another column as a sort key takes care of + // everything but under MSW we currently need to call this explicitly to + // reset the sort indicator displayed on the column. + virtual void UnsetAsSortKey() { } virtual void SetSortOrder(bool ascending) = 0; void ToggleSortOrder() { SetSortOrder(!IsSortOrderAscending()); } @@ -249,10 +253,15 @@ public: virtual void SetFlags(int flags) { m_flags = flags; } virtual int GetFlags() const { return m_flags; } - virtual void SetAsSortKey(bool sort = true) { m_sort = sort; } virtual bool IsSortKey() const { return m_sort; } + virtual void UnsetAsSortKey() { m_sort = false; } + + virtual void SetSortOrder(bool ascending) + { + m_sort = true; + m_sortAscending = ascending; + } - virtual void SetSortOrder(bool ascending) { m_sortAscending = ascending; } virtual bool IsSortOrderAscending() const { return m_sortAscending; } private: diff --git a/Externals/wxWidgets3/include/wx/headerctrl.h b/Externals/wxWidgets3/include/wx/headerctrl.h index 600778b5fc..5477ea568d 100644 --- a/Externals/wxWidgets3/include/wx/headerctrl.h +++ b/Externals/wxWidgets3/include/wx/headerctrl.h @@ -3,7 +3,7 @@ // Purpose: wxHeaderCtrlBase class: interface of wxHeaderCtrl // Author: Vadim Zeitlin // Created: 2008-12-01 -// RCS-ID: $Id: headerctrl.h 58757 2009-02-08 11:45:59Z VZ $ +// RCS-ID: $Id: headerctrl.h 70338 2012-01-14 16:51:57Z VS $ // Copyright: (c) 2008 Vadim Zeitlin // Licence: wxWindows licence /////////////////////////////////////////////////////////////////////////////// @@ -154,6 +154,8 @@ public: // specified) and if the control has wxHD_ALLOW_REORDER style as well bool ShowCustomizeDialog(); + // compute column title width + int GetColumnTitleWidth(const wxHeaderColumn& col); // implementation only from now on // ------------------------------- diff --git a/Externals/wxWidgets3/include/wx/help.h b/Externals/wxWidgets3/include/wx/help.h index 0dae79dfae..e76d713189 100644 --- a/Externals/wxWidgets3/include/wx/help.h +++ b/Externals/wxWidgets3/include/wx/help.h @@ -5,7 +5,7 @@ // Modified by: // Created: // Copyright: (c) Julian Smart -// RCS-ID: $Id: help.h 67254 2011-03-20 00:14:35Z DS $ +// RCS-ID: $Id: help.h 70345 2012-01-15 01:05:28Z VZ $ // Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// @@ -22,10 +22,6 @@ #include "wx/msw/wince/helpwce.h" #define wxHelpController wxWinceHelpController -#elif defined(__WXPALMOS__) - #include "wx/palmos/help.h" - - #define wxHelpController wxPalmHelpController #elif defined(__WXMSW__) #include "wx/msw/helpchm.h" diff --git a/Externals/wxWidgets3/include/wx/htmllbox.h b/Externals/wxWidgets3/include/wx/htmllbox.h index 46a15de7bc..8e051b371f 100644 --- a/Externals/wxWidgets3/include/wx/htmllbox.h +++ b/Externals/wxWidgets3/include/wx/htmllbox.h @@ -4,7 +4,7 @@ // Author: Vadim Zeitlin // Modified by: // Created: 31.05.03 -// RCS-ID: $Id: htmllbox.h 66751 2011-01-25 05:03:17Z RD $ +// RCS-ID: $Id: htmllbox.h 68460 2011-07-30 11:30:08Z VZ $ // Copyright: (c) 2003 Vadim Zeitlin // Licence: wxWindows licence /////////////////////////////////////////////////////////////////////////////// @@ -196,8 +196,8 @@ private: #define wxHLB_DEFAULT_STYLE wxBORDER_SUNKEN #define wxHLB_MULTIPLE wxLB_MULTIPLE -class WXDLLIMPEXP_HTML wxSimpleHtmlListBox : public wxHtmlListBox, - public wxItemContainer +class WXDLLIMPEXP_HTML wxSimpleHtmlListBox : + public wxWindowWithItems { DECLARE_ABSTRACT_CLASS(wxSimpleHtmlListBox) public: @@ -254,9 +254,6 @@ public: int GetSelection() const { return wxVListBox::GetSelection(); } - // see ctrlsub.h for more info about this: - wxCONTROL_ITEMCONTAINER_CLIENTDATAOBJECT_RECAST - // accessing strings // ----------------- diff --git a/Externals/wxWidgets3/include/wx/icon.h b/Externals/wxWidgets3/include/wx/icon.h index 7e5265389b..421f7c5ba6 100644 --- a/Externals/wxWidgets3/include/wx/icon.h +++ b/Externals/wxWidgets3/include/wx/icon.h @@ -5,7 +5,7 @@ // Modified by: // Created: // Copyright: (c) Julian Smart -// RCS-ID: $Id: icon.h 66772 2011-01-26 15:53:31Z SC $ +// RCS-ID: $Id: icon.h 70353 2012-01-15 14:46:41Z VZ $ // Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// @@ -23,10 +23,7 @@ // constant defines the default argument value for wxIcon ctor and wxIcon::LoadFile() // functions. -#if defined(__WXPALMOS__) - #define wxICON_DEFAULT_TYPE wxBITMAP_TYPE_XPM - #include "wx/generic/icon.h" -#elif defined(__WXMSW__) +#if defined(__WXMSW__) #define wxICON_DEFAULT_TYPE wxBITMAP_TYPE_ICO_RESOURCE #include "wx/msw/icon.h" #elif defined(__WXMOTIF__) @@ -41,9 +38,6 @@ #elif defined(__WXX11__) #define wxICON_DEFAULT_TYPE wxBITMAP_TYPE_XPM #include "wx/generic/icon.h" -#elif defined(__WXMGL__) - #define wxICON_DEFAULT_TYPE wxBITMAP_TYPE_ICO_RESOURCE - #include "wx/generic/icon.h" #elif defined(__WXDFB__) #define wxICON_DEFAULT_TYPE wxBITMAP_TYPE_XPM #include "wx/generic/icon.h" diff --git a/Externals/wxWidgets3/include/wx/iconbndl.h b/Externals/wxWidgets3/include/wx/iconbndl.h index 32c62fd475..f0bbb403d9 100644 --- a/Externals/wxWidgets3/include/wx/iconbndl.h +++ b/Externals/wxWidgets3/include/wx/iconbndl.h @@ -4,7 +4,7 @@ // Author: Mattia barbon // Modified by: // Created: 23.03.02 -// RCS-ID: $Id: iconbndl.h 63942 2010-04-12 00:36:31Z VZ $ +// RCS-ID: $Id: iconbndl.h 70455 2012-01-24 22:17:47Z VZ $ // Copyright: (c) Mattia Barbon // Licence: wxWindows licence /////////////////////////////////////////////////////////////////////////////// @@ -28,6 +28,23 @@ WX_DECLARE_EXPORTED_OBJARRAY(wxIcon, wxIconArray); class WXDLLIMPEXP_CORE wxIconBundle : public wxGDIObject { public: + // Flags that determine what happens if GetIcon() doesn't find the icon of + // exactly the requested size. + enum + { + // Return invalid icon if exact size is not found. + FALLBACK_NONE = 0, + + // Return the icon of the system icon size if exact size is not found. + // May be combined with other non-NONE enum elements to determine what + // happens if the system icon size is not found neither. + FALLBACK_SYSTEM = 1, + + // Return the icon of closest larger size or, if there is no icon of + // larger size in the bundle, the closest icon of smaller size. + FALLBACK_NEAREST_LARGER = 2 + }; + // default constructor wxIconBundle(); @@ -60,13 +77,13 @@ public: void AddIcon(const wxIcon& icon); // returns the icon with the given size; if no such icon exists, - // returns the icon with size wxSYS_ICON_[XY]; if no such icon exists, - // returns the first icon in the bundle - wxIcon GetIcon(const wxSize& size) const; + // behavior is specified by the flags. + wxIcon GetIcon(const wxSize& size, int flags = FALLBACK_SYSTEM) const; // equivalent to GetIcon(wxSize(size, size)) - wxIcon GetIcon(wxCoord size = wxDefaultCoord) const - { return GetIcon(wxSize(size, size)); } + wxIcon GetIcon(wxCoord size = wxDefaultCoord, + int flags = FALLBACK_SYSTEM) const + { return GetIcon(wxSize(size, size), flags); } // returns the icon exactly of the specified size or wxNullIcon if no icon // of exactly given size are available diff --git a/Externals/wxWidgets3/include/wx/iconloc.h b/Externals/wxWidgets3/include/wx/iconloc.h index 41abc8fa7a..c2c6ef5485 100644 --- a/Externals/wxWidgets3/include/wx/iconloc.h +++ b/Externals/wxWidgets3/include/wx/iconloc.h @@ -4,7 +4,7 @@ // Author: Vadim Zeitlin // Modified by: // Created: 21.06.2003 -// RCS-ID: $Id: iconloc.h 27408 2004-05-23 20:53:33Z JS $ +// RCS-ID: $Id: iconloc.h 70808 2012-03-04 20:31:42Z VZ $ // Copyright: (c) 2003 Vadim Zeitlin // Licence: wxWindows licence /////////////////////////////////////////////////////////////////////////////// @@ -39,9 +39,9 @@ private: wxString m_filename; }; -// under MSW the same file may contain several icons so we also store the +// under Windows the same file may contain several icons so we also store the // index of the icon -#if defined(__WXMSW__) +#if defined(__WINDOWS__) class WXDLLIMPEXP_BASE wxIconLocation : public wxIconLocationBase { @@ -65,7 +65,7 @@ wxIconLocation::wxIconLocation(const wxString& file, int num) SetIndex(num); } -#else // !MSW +#else // !__WINDOWS__ // must be a class because we forward declare it as class class WXDLLIMPEXP_BASE wxIconLocation : public wxIconLocationBase diff --git a/Externals/wxWidgets3/include/wx/image.h b/Externals/wxWidgets3/include/wx/image.h index 393c0a6f69..70167b104c 100644 --- a/Externals/wxWidgets3/include/wx/image.h +++ b/Externals/wxWidgets3/include/wx/image.h @@ -2,7 +2,7 @@ // Name: wx/image.h // Purpose: wxImage class // Author: Robert Roebling -// RCS-ID: $Id: image.h 67203 2011-03-15 16:42:34Z DS $ +// RCS-ID: $Id: image.h 69760 2011-11-14 13:35:52Z VZ $ // Copyright: (c) Robert Roebling // Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// @@ -28,17 +28,20 @@ // which breaks the compilation below #undef index -#define wxIMAGE_OPTION_QUALITY wxString(wxT("quality")) -#define wxIMAGE_OPTION_FILENAME wxString(wxT("FileName")) +#define wxIMAGE_OPTION_QUALITY wxString(wxS("quality")) +#define wxIMAGE_OPTION_FILENAME wxString(wxS("FileName")) -#define wxIMAGE_OPTION_RESOLUTION wxString(wxT("Resolution")) -#define wxIMAGE_OPTION_RESOLUTIONX wxString(wxT("ResolutionX")) -#define wxIMAGE_OPTION_RESOLUTIONY wxString(wxT("ResolutionY")) +#define wxIMAGE_OPTION_RESOLUTION wxString(wxS("Resolution")) +#define wxIMAGE_OPTION_RESOLUTIONX wxString(wxS("ResolutionX")) +#define wxIMAGE_OPTION_RESOLUTIONY wxString(wxS("ResolutionY")) -#define wxIMAGE_OPTION_RESOLUTIONUNIT wxString(wxT("ResolutionUnit")) +#define wxIMAGE_OPTION_RESOLUTIONUNIT wxString(wxS("ResolutionUnit")) -#define wxIMAGE_OPTION_MAX_WIDTH wxString(wxT("MaxWidth")) -#define wxIMAGE_OPTION_MAX_HEIGHT wxString(wxT("MaxHeight")) +#define wxIMAGE_OPTION_MAX_WIDTH wxString(wxS("MaxWidth")) +#define wxIMAGE_OPTION_MAX_HEIGHT wxString(wxS("MaxHeight")) + +#define wxIMAGE_OPTION_ORIGINAL_WIDTH wxString(wxS("OriginalWidth")) +#define wxIMAGE_OPTION_ORIGINAL_HEIGHT wxString(wxS("OriginalHeight")) // constants used with wxIMAGE_OPTION_RESOLUTIONUNIT // diff --git a/Externals/wxWidgets3/include/wx/imaglist.h b/Externals/wxWidgets3/include/wx/imaglist.h index 2d501d93a4..9e5719a145 100644 --- a/Externals/wxWidgets3/include/wx/imaglist.h +++ b/Externals/wxWidgets3/include/wx/imaglist.h @@ -5,7 +5,7 @@ // Modified by: // Created: // Copyright: (c) Julian Smart -// RCS-ID: $Id: imaglist.h 63553 2010-02-25 00:03:53Z VZ $ +// RCS-ID: $Id: imaglist.h 70345 2012-01-15 01:05:28Z VZ $ // Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// @@ -42,7 +42,7 @@ enum #define wxIMAGELIST_DRAW_SELECTED 0x0004 #define wxIMAGELIST_DRAW_FOCUSED 0x0008 -#if defined(__WXMSW__) || defined(__WXMAC__) || defined(__WXPALMOS__) +#if defined(__WXMSW__) || defined(__WXMAC__) #define wxHAS_NATIVE_IMAGELIST #endif @@ -52,8 +52,6 @@ enum #include "wx/msw/imaglist.h" #elif defined(__WXMAC__) #include "wx/osx/imaglist.h" -#elif defined(__WXPALMOS__) - #include "wx/palmos/imaglist.h" #endif #endif // _WX_IMAGLIST_H_BASE_ diff --git a/Externals/wxWidgets3/include/wx/imagtiff.h b/Externals/wxWidgets3/include/wx/imagtiff.h index ad91d3d5d3..e9b00aa989 100644 --- a/Externals/wxWidgets3/include/wx/imagtiff.h +++ b/Externals/wxWidgets3/include/wx/imagtiff.h @@ -2,7 +2,7 @@ // Name: wx/imagtiff.h // Purpose: wxImage TIFF handler // Author: Robert Roebling -// RCS-ID: $Id: imagtiff.h 67254 2011-03-20 00:14:35Z DS $ +// RCS-ID: $Id: imagtiff.h 68785 2011-08-19 03:47:40Z DS $ // Copyright: (c) Robert Roebling // Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// @@ -22,10 +22,17 @@ #include "wx/versioninfo.h" // defines for wxImage::SetOption -#define wxIMAGE_OPTION_BITSPERSAMPLE wxString(wxT("BitsPerSample")) -#define wxIMAGE_OPTION_SAMPLESPERPIXEL wxString(wxT("SamplesPerPixel")) -#define wxIMAGE_OPTION_COMPRESSION wxString(wxT("Compression")) -#define wxIMAGE_OPTION_IMAGEDESCRIPTOR wxString(wxT("ImageDescriptor")) +#define wxIMAGE_OPTION_TIFF_BITSPERSAMPLE wxString(wxT("BitsPerSample")) +#define wxIMAGE_OPTION_TIFF_SAMPLESPERPIXEL wxString(wxT("SamplesPerPixel")) +#define wxIMAGE_OPTION_TIFF_COMPRESSION wxString(wxT("Compression")) +#define wxIMAGE_OPTION_TIFF_PHOTOMETRIC wxString(wxT("Photometric")) +#define wxIMAGE_OPTION_TIFF_IMAGEDESCRIPTOR wxString(wxT("ImageDescriptor")) + +// for backwards compatibility +#define wxIMAGE_OPTION_BITSPERSAMPLE wxIMAGE_OPTION_TIFF_BITSPERSAMPLE +#define wxIMAGE_OPTION_SAMPLESPERPIXEL wxIMAGE_OPTION_TIFF_SAMPLESPERPIXEL +#define wxIMAGE_OPTION_COMPRESSION wxIMAGE_OPTION_TIFF_COMPRESSION +#define wxIMAGE_OPTION_IMAGEDESCRIPTOR wxIMAGE_OPTION_TIFF_IMAGEDESCRIPTOR class WXDLLIMPEXP_CORE wxTIFFHandler: public wxImageHandler { diff --git a/Externals/wxWidgets3/include/wx/intl.h b/Externals/wxWidgets3/include/wx/intl.h index be563dd495..a2785fd97f 100644 --- a/Externals/wxWidgets3/include/wx/intl.h +++ b/Externals/wxWidgets3/include/wx/intl.h @@ -5,7 +5,7 @@ // Modified by: Michael N. Filippov // (2003/09/30 - plural forms support) // Created: 29/01/98 -// RCS-ID: $Id: intl.h 64215 2010-05-05 12:27:07Z VS $ +// RCS-ID: $Id: intl.h 70796 2012-03-04 00:29:31Z VZ $ // Copyright: (c) 1998 Vadim Zeitlin // Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// @@ -60,17 +60,17 @@ struct WXDLLIMPEXP_BASE wxLanguageInfo { int Language; // wxLanguage id wxString CanonicalName; // Canonical name, e.g. fr_FR -#ifdef __WXMSW__ +#ifdef __WINDOWS__ wxUint32 WinLang, // Win32 language identifiers WinSublang; -#endif // __WXMSW__ +#endif // __WINDOWS__ wxString Description; // human-readable name of the language wxLayoutDirection LayoutDirection; -#ifdef __WXMSW__ +#ifdef __WINDOWS__ // return the LCID corresponding to this language wxUint32 GetLCID() const; -#endif // __WXMSW__ +#endif // __WINDOWS__ // return the locale name corresponding to this language usable with // setlocale() on the current system @@ -79,9 +79,9 @@ struct WXDLLIMPEXP_BASE wxLanguageInfo // for Unix systems GetLocaleName() is trivial so implement it inline here, for // MSW it's implemented in intl.cpp -#ifndef __WXMSW__ +#ifndef __WINDOWS__ inline wxString wxLanguageInfo::GetLocaleName() const { return CanonicalName; } -#endif // !__WXMSW__ +#endif // !__WINDOWS__ // ---------------------------------------------------------------------------- diff --git a/Externals/wxWidgets3/include/wx/iosfwrap.h b/Externals/wxWidgets3/include/wx/iosfwrap.h index a4df4bfb9b..020d45882d 100644 --- a/Externals/wxWidgets3/include/wx/iosfwrap.h +++ b/Externals/wxWidgets3/include/wx/iosfwrap.h @@ -4,7 +4,7 @@ // Author: Jan van Dijk // Modified by: // Created: 18.12.2002 -// RCS-ID: $Id: iosfwrap.h 33555 2005-04-12 21:06:03Z ABX $ +// RCS-ID: $Id: iosfwrap.h 70796 2012-03-04 00:29:31Z VZ $ // Copyright: wxWidgets team // Licence: wxWindows licence /////////////////////////////////////////////////////////////////////////////// @@ -18,7 +18,7 @@ # include #endif -#ifdef __WXMSW__ +#ifdef __WINDOWS__ # include "wx/msw/winundef.h" #endif diff --git a/Externals/wxWidgets3/include/wx/ioswrap.h b/Externals/wxWidgets3/include/wx/ioswrap.h index 25932450fd..50ba04a1dc 100644 --- a/Externals/wxWidgets3/include/wx/ioswrap.h +++ b/Externals/wxWidgets3/include/wx/ioswrap.h @@ -4,7 +4,7 @@ // Author: Vadim Zeitlin // Modified by: // Created: 03.02.99 -// RCS-ID: $Id: ioswrap.h 47644 2007-07-22 09:20:42Z VS $ +// RCS-ID: $Id: ioswrap.h 70796 2012-03-04 00:29:31Z VZ $ // Copyright: (c) 1998 Vadim Zeitlin // Licence: wxWindows licence /////////////////////////////////////////////////////////////////////////////// @@ -21,7 +21,7 @@ #include "wx/afterstd.h" -#ifdef __WXMSW__ +#ifdef __WINDOWS__ # include "wx/msw/winundef.h" #endif diff --git a/Externals/wxWidgets3/include/wx/ipc.h b/Externals/wxWidgets3/include/wx/ipc.h index 34d056dde4..14650aea1d 100644 --- a/Externals/wxWidgets3/include/wx/ipc.h +++ b/Externals/wxWidgets3/include/wx/ipc.h @@ -4,7 +4,7 @@ // Author: Vadim Zeitlin // Modified by: // Created: 15.04.02 -// RCS-ID: $Id: ipc.h 35698 2005-09-25 20:49:40Z MW $ +// RCS-ID: $Id: ipc.h 70796 2012-03-04 00:29:31Z VZ $ // Copyright: (c) 2002 Vadim Zeitlin // Licence: wxWindows licence /////////////////////////////////////////////////////////////////////////////// @@ -16,7 +16,7 @@ // 0, or if the platform is not Windows, use TCP/IP for IPC implementation #if !defined(wxUSE_DDE_FOR_IPC) - #ifdef __WXMSW__ + #ifdef __WINDOWS__ #define wxUSE_DDE_FOR_IPC 1 #else #define wxUSE_DDE_FOR_IPC 0 diff --git a/Externals/wxWidgets3/include/wx/itemid.h b/Externals/wxWidgets3/include/wx/itemid.h new file mode 100644 index 0000000000..ff867ef3ec --- /dev/null +++ b/Externals/wxWidgets3/include/wx/itemid.h @@ -0,0 +1,62 @@ +/////////////////////////////////////////////////////////////////////////////// +// Name: wx/itemid.h +// Purpose: wxItemId class declaration. +// Author: Vadim Zeitlin +// Created: 2011-08-17 +// RCS-ID: $Id: itemid.h 68916 2011-08-27 14:11:03Z VZ $ +// Copyright: (c) 2011 Vadim Zeitlin +// Licence: wxWindows licence +/////////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_ITEMID_H_ +#define _WX_ITEMID_H_ + +// ---------------------------------------------------------------------------- +// wxItemId: an opaque item identifier used with wx{Tree,TreeList,DataView}Ctrl. +// ---------------------------------------------------------------------------- + +// The template argument T is typically a pointer to some opaque type. While +// wxTreeItemId and wxDataViewItem use a pointer to void, this is dangerous and +// not recommended for the new item id classes. +template +class wxItemId +{ +public: + typedef T Type; + + // This ctor is implicit which is fine for non-void* types, but if you use + // this class with void* you're strongly advised to make the derived class + // ctor explicit as implicitly converting from any pointer is simply too + // dangerous. + wxItemId(Type item = NULL) : m_pItem(item) { } + + // Default copy ctor, assignment operator and dtor are ok. + + bool IsOk() const { return m_pItem != NULL; } + Type GetID() const { return m_pItem; } + operator const Type() const { return m_pItem; } + + // This is used for implementation purposes only. + Type operator->() const { return m_pItem; } + + void Unset() { m_pItem = NULL; } + + // This field is public *only* for compatibility with the old wxTreeItemId + // implementation and must not be used in any new code. +//private: + Type m_pItem; +}; + +template +bool operator==(const wxItemId& left, const wxItemId& right) +{ + return left.GetID() == right.GetID(); +} + +template +bool operator!=(const wxItemId& left, const wxItemId& right) +{ + return !(left == right); +} + +#endif // _WX_ITEMID_H_ diff --git a/Externals/wxWidgets3/include/wx/joystick.h b/Externals/wxWidgets3/include/wx/joystick.h index 5a42af2a0f..ba36f5e956 100644 --- a/Externals/wxWidgets3/include/wx/joystick.h +++ b/Externals/wxWidgets3/include/wx/joystick.h @@ -5,7 +5,7 @@ // Modified by: // Created: // Copyright: (c) wxWidgets Team -// RCS-ID: $Id: joystick.h 67254 2011-03-20 00:14:35Z DS $ +// RCS-ID: $Id: joystick.h 70808 2012-03-04 20:31:42Z VZ $ // Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// @@ -16,7 +16,7 @@ #if wxUSE_JOYSTICK -#if defined(__WXMSW__) +#if defined(__WINDOWS__) #include "wx/msw/joystick.h" #elif defined(__WXMOTIF__) #include "wx/unix/joystick.h" diff --git a/Externals/wxWidgets3/include/wx/kbdstate.h b/Externals/wxWidgets3/include/wx/kbdstate.h index 851ec3c013..d3f927f77a 100644 --- a/Externals/wxWidgets3/include/wx/kbdstate.h +++ b/Externals/wxWidgets3/include/wx/kbdstate.h @@ -3,7 +3,7 @@ // Purpose: Declaration of wxKeyboardState class // Author: Vadim Zeitlin // Created: 2008-09-19 -// RCS-ID: $Id: kbdstate.h 55747 2008-09-19 23:59:39Z VZ $ +// RCS-ID: $Id: kbdstate.h 70579 2012-02-13 15:23:33Z SC $ // Copyright: (c) 2008 Vadim Zeitlin // Licence: wxWindows licence /////////////////////////////////////////////////////////////////////////////// @@ -28,6 +28,9 @@ public: m_shiftDown(shiftDown), m_altDown(altDown), m_metaDown(metaDown) +#ifdef __WXOSX__ + ,m_rawControlDown(false) +#endif { } @@ -45,6 +48,9 @@ public: return (m_controlDown ? wxMOD_CONTROL : 0) | (m_shiftDown ? wxMOD_SHIFT : 0) | (m_metaDown ? wxMOD_META : 0) | +#ifdef __WXOSX__ + (m_rawControlDown ? wxMOD_RAW_CONTROL : 0) | +#endif (m_altDown ? wxMOD_ALT : 0); } @@ -53,6 +59,14 @@ public: // accessors for individual modifier keys bool ControlDown() const { return m_controlDown; } + bool RawControlDown() const + { +#ifdef __WXOSX__ + return m_rawControlDown; +#else + return m_controlDown; +#endif + } bool ShiftDown() const { return m_shiftDown; } bool MetaDown() const { return m_metaDown; } bool AltDown() const { return m_altDown; } @@ -64,17 +78,21 @@ public: // purpose under Mac) bool CmdDown() const { -#if defined(__WXMAC__) || defined(__WXCOCOA__) - return MetaDown(); -#else return ControlDown(); -#endif } // these functions are mostly used by wxWidgets itself // --------------------------------------------------- void SetControlDown(bool down) { m_controlDown = down; } + void SetRawControlDown(bool down) + { +#ifdef __WXOSX__ + m_rawControlDown = down; +#else + m_controlDown = down; +#endif + } void SetShiftDown(bool down) { m_shiftDown = down; } void SetAltDown(bool down) { m_altDown = down; } void SetMetaDown(bool down) { m_metaDown = down; } @@ -84,10 +102,13 @@ public: // members of wxKeyEvent directly, these variables are public, however you // should not use them in any new code, please use the accessors instead public: - bool m_controlDown : 1; - bool m_shiftDown : 1; - bool m_altDown : 1; - bool m_metaDown : 1; + bool m_controlDown : 1; + bool m_shiftDown : 1; + bool m_altDown : 1; + bool m_metaDown : 1; +#ifdef __WXOSX__ + bool m_rawControlDown : 1; +#endif }; #endif // _WX_KBDSTATE_H_ diff --git a/Externals/wxWidgets3/include/wx/list.h b/Externals/wxWidgets3/include/wx/list.h index cceaa09d23..a74a8fc7b8 100644 --- a/Externals/wxWidgets3/include/wx/list.h +++ b/Externals/wxWidgets3/include/wx/list.h @@ -4,7 +4,7 @@ // Author: Julian Smart // Modified by: VZ at 16/11/98: WX_DECLARE_LIST() and typesafe lists added // Created: 29/01/98 -// RCS-ID: $Id: list.h 66829 2011-02-02 13:49:44Z SC $ +// RCS-ID: $Id: list.h 70165 2011-12-29 14:42:13Z SN $ // Copyright: (c) 1998 Julian Smart // Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// @@ -33,7 +33,7 @@ #include "wx/object.h" #include "wx/string.h" -#if wxUSE_STL +#if wxUSE_STD_CONTAINERS #include "wx/beforestd.h" #include #include @@ -48,7 +48,7 @@ class WXDLLIMPEXP_FWD_BASE wxObjectListNode; typedef wxObjectListNode wxNode; -#if wxUSE_STL +#if wxUSE_STD_CONTAINERS #define wxLIST_COMPATIBILITY @@ -346,7 +346,7 @@ inline const void *wxListCastElementToVoidPtr(const wxString& str) #define WX_DEFINE_EXPORTED_LIST(name) WX_DEFINE_LIST(name) #define WX_DEFINE_USER_EXPORTED_LIST(name) WX_DEFINE_LIST(name) -#else // if !wxUSE_STL +#else // if !wxUSE_STD_CONTAINERS // undef it to get rid of old, deprecated functions @@ -1148,7 +1148,7 @@ private: #define WX_DEFINE_EXPORTED_LIST(name) WX_DEFINE_LIST(name) #define WX_DEFINE_USER_EXPORTED_LIST(name) WX_DEFINE_LIST(name) -#endif // !wxUSE_STL +#endif // !wxUSE_STD_CONTAINERS // ============================================================================ // now we can define classes 100% compatible with the old ones @@ -1162,7 +1162,7 @@ private: // inline compatibility functions -#if !wxUSE_STL +#if !wxUSE_STD_CONTAINERS // ---------------------------------------------------------------------------- // wxNodeBase deprecated methods @@ -1197,26 +1197,26 @@ WX_DECLARE_LIST_2(wxObject, wxObjectList, wxObjectListNode, class WXDLLIMPEXP_BASE wxList : public wxObjectList { public: -#if defined(wxWARN_COMPAT_LIST_USE) && !wxUSE_STL - wxList() { }; +#if defined(wxWARN_COMPAT_LIST_USE) && !wxUSE_STD_CONTAINERS + wxList() { } wxDEPRECATED( wxList(int key_type) ); -#elif !wxUSE_STL +#elif !wxUSE_STD_CONTAINERS wxList(int key_type = wxKEY_NONE); #endif // this destructor is required for Darwin ~wxList() { } -#if !wxUSE_STL +#if !wxUSE_STD_CONTAINERS wxList& operator=(const wxList& list) { if (&list != this) Assign(list); return *this; } // compatibility methods void Sort(wxSortCompareFunction compfunc) { wxListBase::Sort(compfunc); } -#endif // !wxUSE_STL +#endif // !wxUSE_STD_CONTAINERS }; -#if !wxUSE_STL +#if !wxUSE_STD_CONTAINERS // ----------------------------------------------------------------------------- // wxStringList class for compatibility with the old code @@ -1268,7 +1268,7 @@ private: void DoCopy(const wxStringList&); // common part of copy ctor and operator= }; -#else // if wxUSE_STL +#else // if wxUSE_STD_CONTAINERS WX_DECLARE_LIST_XO(wxString, wxStringListBase, class WXDLLIMPEXP_BASE); @@ -1291,7 +1291,7 @@ public: { push_front(s); return GetFirst(); } }; -#endif // wxUSE_STL +#endif // wxUSE_STD_CONTAINERS #endif // wxLIST_COMPATIBILITY diff --git a/Externals/wxWidgets3/include/wx/listbase.h b/Externals/wxWidgets3/include/wx/listbase.h index 618c5dea7e..b28b9f64a3 100644 --- a/Externals/wxWidgets3/include/wx/listbase.h +++ b/Externals/wxWidgets3/include/wx/listbase.h @@ -4,7 +4,7 @@ // Author: Vadim Zeitlin // Modified by: // Created: 04.12.99 -// RCS-ID: $Id: listbase.h 60732 2009-05-24 18:04:37Z VZ $ +// RCS-ID: $Id: listbase.h 70286 2012-01-07 16:11:10Z VZ $ // Copyright: (c) wxWidgets team // Licence: wxWindows licence /////////////////////////////////////////////////////////////////////////////// @@ -16,6 +16,9 @@ #include "wx/font.h" #include "wx/gdicmn.h" #include "wx/event.h" +#include "wx/control.h" + +class WXDLLIMPEXP_FWD_CORE wxImageList; // ---------------------------------------------------------------------------- // types @@ -23,7 +26,7 @@ // type of compare function for wxListCtrl sort operation typedef -int (wxCALLBACK *wxListCtrlCompare)(long item1, long item2, wxIntPtr sortData); +int (wxCALLBACK *wxListCtrlCompare)(wxIntPtr item1, wxIntPtr item2, wxIntPtr sortData); // ---------------------------------------------------------------------------- // wxListCtrl constants @@ -183,9 +186,9 @@ public: void SetFont(const wxFont& font) { m_font = font; } // accessors - bool HasTextColour() const { return m_colText.Ok(); } - bool HasBackgroundColour() const { return m_colBack.Ok(); } - bool HasFont() const { return m_font.Ok(); } + bool HasTextColour() const { return m_colText.IsOk(); } + bool HasBackgroundColour() const { return m_colBack.IsOk(); } + bool HasFont() const { return m_font.IsOk(); } const wxColour& GetTextColour() const { return m_colText; } const wxColour& GetBackgroundColour() const { return m_colBack; } @@ -354,7 +357,7 @@ protected: void Init() { m_mask = 0; - m_itemId = 0; + m_itemId = -1; m_col = 0; m_state = 0; m_stateMask = 0; @@ -371,6 +374,94 @@ private: DECLARE_DYNAMIC_CLASS(wxListItem) }; +// ---------------------------------------------------------------------------- +// wxListCtrlBase: the base class for the main control itself. +// ---------------------------------------------------------------------------- + +// Unlike other base classes, this class doesn't currently define the API of +// the real control class but is just used for implementation convenience. We +// should define the public class functions as pure virtual here in the future +// however. +class WXDLLIMPEXP_CORE wxListCtrlBase : public wxControl +{ +public: + wxListCtrlBase() { } + + // Image list methods. + // ------------------- + + // Associate the given (possibly NULL to indicate that no images will be + // used) image list with the control. The ownership of the image list + // passes to the control, i.e. it will be deleted when the control itself + // is destroyed. + // + // The value of "which" must be one of wxIMAGE_LIST_{NORMAL,SMALL,STATE}. + virtual void AssignImageList(wxImageList* imageList, int which) = 0; + + // Same as AssignImageList() but the control does not delete the image list + // so it can be shared among several controls. + virtual void SetImageList(wxImageList* imageList, int which) = 0; + + // Return the currently used image list, may be NULL. + virtual wxImageList* GetImageList(int which) const = 0; + + + // Column-related methods. + // ----------------------- + + // All these methods can only be used in report view mode. + + // Appends a new column. + // + // Returns the index of the newly inserted column or -1 on error. + long AppendColumn(const wxString& heading, + int format = wxLIST_FORMAT_LEFT, + int width = -1); + + // Add a new column to the control at the position "col". + // + // Returns the index of the newly inserted column or -1 on error. + long InsertColumn(long col, const wxListItem& info); + long InsertColumn(long col, + const wxString& heading, + int format = wxLIST_FORMAT_LEFT, + int width = wxLIST_AUTOSIZE); + + // Delete the given or all columns. + virtual bool DeleteColumn(int col) = 0; + virtual bool DeleteAllColumns() = 0; + + // Return the current number of columns. + virtual int GetColumnCount() const = 0; + + // Get or update information about the given column. Set item mask to + // indicate the fields to retrieve or change. + // + // Returns false on error, e.g. if the column index is invalid. + virtual bool GetColumn(int col, wxListItem& item) const = 0; + virtual bool SetColumn(int col, const wxListItem& item) = 0; + + // Convenient wrappers for the above methods which get or update just the + // column width. + virtual int GetColumnWidth(int col) const = 0; + virtual bool SetColumnWidth(int col, int width) = 0; + + + // Other miscellaneous accessors. + // ------------------------------ + + // Convenient functions for testing the list control mode: + bool InReportView() const { return HasFlag(wxLC_REPORT); } + bool IsVirtual() const { return HasFlag(wxLC_VIRTUAL); } + +protected: + // Real implementations methods to which our public forwards. + virtual long DoInsertColumn(long col, const wxListItem& info) = 0; + + // Overridden methods of the base class. + virtual wxSize DoGetBestClientSize() const; +}; + // ---------------------------------------------------------------------------- // wxListEvent - the event class for the wxListCtrl notifications // ---------------------------------------------------------------------------- diff --git a/Externals/wxWidgets3/include/wx/listbook.h b/Externals/wxWidgets3/include/wx/listbook.h index 02f4cd4634..f7e4bfc389 100644 --- a/Externals/wxWidgets3/include/wx/listbook.h +++ b/Externals/wxWidgets3/include/wx/listbook.h @@ -4,7 +4,7 @@ // Author: Vadim Zeitlin // Modified by: // Created: 19.08.03 -// RCS-ID: $Id: listbook.h 65931 2010-10-27 16:54:36Z VZ $ +// RCS-ID: $Id: listbook.h 68810 2011-08-21 14:08:49Z VZ $ // Copyright: (c) 2003 Vadim Zeitlin // Licence: wxWindows licence /////////////////////////////////////////////////////////////////////////////// @@ -69,7 +69,7 @@ public: wxWindow *page, const wxString& text, bool bSelect = false, - int imageId = -1); + int imageId = NO_IMAGE); virtual int SetSelection(size_t n) { return DoSetSelection(n, SetSelection_SendEvent); } virtual int ChangeSelection(size_t n) { return DoSetSelection(n); } virtual int HitTest(const wxPoint& pt, long *flags = NULL) const; diff --git a/Externals/wxWidgets3/include/wx/listctrl.h b/Externals/wxWidgets3/include/wx/listctrl.h index 704b4ef81f..5f17cfde7d 100644 --- a/Externals/wxWidgets3/include/wx/listctrl.h +++ b/Externals/wxWidgets3/include/wx/listctrl.h @@ -4,7 +4,7 @@ // Author: Vadim Zeitlin // Modified by: // Created: 04.12.99 -// RCS-ID: $Id: listctrl.h 58182 2009-01-17 13:38:04Z SC $ +// RCS-ID: $Id: listctrl.h 70808 2012-03-04 20:31:42Z VZ $ // Copyright: (c) wxWidgets team // Licence: wxWindows licence /////////////////////////////////////////////////////////////////////////////// @@ -28,7 +28,7 @@ extern WXDLLIMPEXP_DATA_CORE(const char) wxListCtrlNameStr[]; // include the wxListCtrl class declaration // ---------------------------------------------------------------------------- -#if defined(__WIN32__) && !defined(__WXUNIVERSAL__) +#if defined(__WXMSW__) && !defined(__WXUNIVERSAL__) #include "wx/msw/listctrl.h" #elif defined(__WXMAC__) && !defined(__WXUNIVERSAL__) && wxOSX_USE_CARBON #include "wx/osx/listctrl.h" diff --git a/Externals/wxWidgets3/include/wx/listimpl.cpp b/Externals/wxWidgets3/include/wx/listimpl.cpp index e9ebeae038..771b41dcc2 100644 --- a/Externals/wxWidgets3/include/wx/listimpl.cpp +++ b/Externals/wxWidgets3/include/wx/listimpl.cpp @@ -4,12 +4,12 @@ // Author: Vadim Zeitlin // Modified by: // Created: 16/11/98 -// RCS-ID: $Id: listimpl.cpp 67254 2011-03-20 00:14:35Z DS $ +// RCS-ID: $Id: listimpl.cpp 67343 2011-03-30 14:16:04Z VZ $ // Copyright: (c) 1998 Vadim Zeitlin // Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// -#if wxUSE_STL +#if wxUSE_STD_CONTAINERS #undef WX_DEFINE_LIST #define WX_DEFINE_LIST(name) \ @@ -19,7 +19,7 @@ } \ name::BaseListType name::EmptyList; -#else // !wxUSE_STL +#else // !wxUSE_STD_CONTAINERS #undef WX_DEFINE_LIST_2 #define WX_DEFINE_LIST_2(T, name) \ void wx##name##Node::DeleteData() \ @@ -32,5 +32,5 @@ #undef WX_DEFINE_LIST #define WX_DEFINE_LIST(name) WX_DEFINE_LIST_2(_WX_LIST_ITEM_TYPE_##name, name) -#endif // wxUSE_STL/!wxUSE_STL +#endif // wxUSE_STD_CONTAINERS/!wxUSE_STD_CONTAINERS diff --git a/Externals/wxWidgets3/include/wx/log.h b/Externals/wxWidgets3/include/wx/log.h index 1b1ac53c5e..8f0679b243 100644 --- a/Externals/wxWidgets3/include/wx/log.h +++ b/Externals/wxWidgets3/include/wx/log.h @@ -4,7 +4,7 @@ // Author: Vadim Zeitlin // Modified by: // Created: 29/01/98 -// RCS-ID: $Id: log.h 66966 2011-02-19 12:32:59Z VZ $ +// RCS-ID: $Id: log.h 70796 2012-03-04 00:29:31Z VZ $ // Copyright: (c) 1998 Vadim Zeitlin // Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// @@ -29,7 +29,7 @@ typedef unsigned long wxLogLevel; #define wxTraceResAlloc 0x0004 // trace GDI resource allocation #define wxTraceRefCount 0x0008 // trace various ref counting operations - #ifdef __WXMSW__ + #ifdef __WINDOWS__ #define wxTraceOleCalls 0x0100 // OLE interface calls #endif @@ -57,11 +57,9 @@ class WXDLLIMPEXP_FWD_BASE wxObject; #include "wx/arrstr.h" -#ifndef __WXPALMOS5__ #ifndef __WXWINCE__ #include // for time_t #endif -#endif // ! __WXPALMOS5__ #include "wx/dynarray.h" #include "wx/hashmap.h" @@ -130,7 +128,7 @@ enum wxLogLevelValues #define wxTRACE_ResAlloc wxT("resalloc") // trace GDI resource allocation #define wxTRACE_RefCount wxT("refcount") // trace various ref counting operations -#ifdef __WXMSW__ +#ifdef __WINDOWS__ #define wxTRACE_OleCalls wxT("ole") // OLE interface calls #endif @@ -309,6 +307,34 @@ struct wxLogRecord wxLogRecordInfo info; }; +// ---------------------------------------------------------------------------- +// Derive from this class to customize format of log messages. +// ---------------------------------------------------------------------------- + +class WXDLLIMPEXP_BASE wxLogFormatter +{ +public: + // Default constructor. + wxLogFormatter() { } + + // Trivial but virtual destructor for the base class. + virtual ~wxLogFormatter() { } + + + // Override this method to implement custom formatting of the given log + // record. The default implementation simply prepends a level-dependent + // prefix to the message and optionally adds a time stamp. + virtual wxString Format(wxLogLevel level, + const wxString& msg, + const wxLogRecordInfo& info) const; + +protected: + // Override this method to change just the time stamp formatting. It is + // called by default Format() implementation. + virtual wxString FormatTime(time_t t) const; +}; + + // ---------------------------------------------------------------------------- // derive from this class to redirect (or suppress, or ...) log messages // normally, only a single instance of this class exists but it's not enforced @@ -318,7 +344,7 @@ class WXDLLIMPEXP_BASE wxLog { public: // ctor - wxLog() { } + wxLog() : m_formatter(new wxLogFormatter) { } // make dtor virtual for all derived classes virtual ~wxLog(); @@ -455,6 +481,26 @@ public: // call AddTraceMask() concurrently static const wxArrayString& GetTraceMasks(); + // is this trace mask in the list? + static bool IsAllowedTraceMask(const wxString& mask); + + + // log formatting + // ----------------- + + // Change wxLogFormatter object used by wxLog to format the log messages. + // + // wxLog takes ownership of the pointer passed in but the caller is + // responsible for deleting the returned pointer. + wxLogFormatter* SetFormatter(wxLogFormatter* formatter); + + + // All the time stamp related functions below only work when the default + // wxLogFormatter is being used. Defining a custom formatter overrides them + // as it could use its own time stamp format or format messages without + // using time stamp at all. + + // sets the time stamp string format: this is used as strftime() format // string for the log targets which add time stamps to the messages; set // it to empty string to disable time stamping completely. @@ -464,9 +510,6 @@ public: static void DisableTimestamp() { SetTimestamp(wxEmptyString); } - // is this trace mask in the list? - static bool IsAllowedTraceMask(const wxString& mask); - // get the current timestamp format string (maybe empty) static const wxString& GetTimestamp() { return ms_timestamp; } @@ -475,9 +518,10 @@ public: // helpers: all functions in this section are mostly for internal use only, // don't call them from your code even if they are not formally deprecated - // put the time stamp into the string if ms_timestamp != NULL (don't - // change it otherwise) + // put the time stamp into the string if ms_timestamp is not empty (don't + // change it otherwise); the first overload uses the current time. static void TimeStamp(wxString *str); + static void TimeStamp(wxString *str, time_t t); // these methods should only be called from derived classes DoLogRecord(), // DoLogTextAtLevel() and DoLogText() implementations respectively and @@ -621,6 +665,12 @@ private: const wxLogRecordInfo& info); + // variables + // ---------------- + + wxLogFormatter *m_formatter; // We own this pointer. + + // static variables // ---------------- diff --git a/Externals/wxWidgets3/include/wx/longlong.h b/Externals/wxWidgets3/include/wx/longlong.h index bcc4575f4e..e190ec804b 100644 --- a/Externals/wxWidgets3/include/wx/longlong.h +++ b/Externals/wxWidgets3/include/wx/longlong.h @@ -5,7 +5,7 @@ // Author: Jeffrey C. Ollie , Vadim Zeitlin // Modified by: // Created: 10.02.99 -// RCS-ID: $Id: longlong.h 61508 2009-07-23 20:30:22Z VZ $ +// RCS-ID: $Id: longlong.h 68472 2011-07-31 13:25:33Z VS $ // Copyright: (c) 1998 Vadim Zeitlin // Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// @@ -404,15 +404,20 @@ public: // convert to ulong with range checking in debug mode (only!) unsigned long ToULong() const { - wxASSERT_MSG( m_ll <= LONG_MAX, + wxASSERT_MSG( m_ll <= ULONG_MAX, wxT("wxULongLong to long conversion loss of precision") ); return wx_truncate_cast(unsigned long, m_ll); } // convert to double -#ifdef _MSC_VER - double ToDouble() const { return wx_truncate_cast(double, (__int64) m_ll); } + // + // For some completely obscure reasons compiling the cast below with + // VC6 in DLL builds only (!) results in "error C2520: conversion from + // unsigned __int64 to double not implemented, use signed __int64" so + // we must use a different version for that compiler. +#ifdef __VISUALC6__ + double ToDouble() const; #else double ToDouble() const { return wx_truncate_cast(double, m_ll); } #endif @@ -1075,6 +1080,66 @@ WXDLLIMPEXP_BASE class wxTextInputStream &operator>>(class wxTextInputStream &st #endif +// ---------------------------------------------------------------------------- +// Specialize numeric_limits<> for our long long wrapper classes. +// ---------------------------------------------------------------------------- + +#if wxUSE_LONGLONG_NATIVE + +// VC6 is known to not have __int64 specializations of numeric_limits<> in its +// anyhow so don't bother including it, especially as it results in +// tons of warnings because the standard header itself uses obsolete template +// specialization syntax. +#ifndef __VISUALC6__ + +#include + +namespace std +{ + +#ifdef __clang__ + // libstdc++ (used by Clang) uses struct for numeric_limits; unlike gcc, clang + // warns about this + template<> struct numeric_limits : public numeric_limits {}; + template<> struct numeric_limits : public numeric_limits {}; +#else + template<> class numeric_limits : public numeric_limits {}; + template<> class numeric_limits : public numeric_limits {}; +#endif + +} // namespace std + +#endif // !VC6 + +#endif // wxUSE_LONGLONG_NATIVE + +// ---------------------------------------------------------------------------- +// Specialize wxArgNormalizer to allow using wxLongLong directly with wx pseudo +// vararg functions. +// ---------------------------------------------------------------------------- + +// Notice that this must be done here and not in wx/strvararg.h itself because +// we can't include wx/longlong.h from there as this header itself includes +// wx/string.h which includes wx/strvararg.h too, so to avoid the circular +// dependencies we can only do it here (or add another header just for this but +// it doesn't seem necessary). +#include "wx/strvararg.h" + +template<> +struct WXDLLIMPEXP_BASE wxArgNormalizer +{ + wxArgNormalizer(wxLongLong value, + const wxFormatString *fmt, unsigned index) + : m_value(value) + { + wxASSERT_ARG_TYPE( fmt, index, wxFormatString::Arg_LongLongInt ); + } + + wxLongLong_t get() const { return m_value.GetValue(); } + + wxLongLong m_value; +}; + #endif // wxUSE_LONGLONG #endif // _WX_LONGLONG_H diff --git a/Externals/wxWidgets3/include/wx/math.h b/Externals/wxWidgets3/include/wx/math.h index a71078a54f..0978a84dcc 100644 --- a/Externals/wxWidgets3/include/wx/math.h +++ b/Externals/wxWidgets3/include/wx/math.h @@ -4,7 +4,7 @@ * Author: John Labenski and others * Modified by: * Created: 02/02/03 -* RCS-ID: $Id: math.h 63194 2010-01-19 22:02:59Z VS $ +* RCS-ID: $Id: math.h 70796 2012-03-04 00:29:31Z VZ $ * Copyright: (c) John Labenski * Licence: wxWindows licence */ @@ -58,8 +58,10 @@ #include #define wxFinite(x) _finite(x) #elif defined(__MINGW64__) - // add more compilers with C99 support here: using C99 isfinite() is - // preferable to using BSD-ish finite() + /* + add more compilers with C99 support here: using C99 isfinite() is + preferable to using BSD-ish finite() + */ #define wxFinite(x) isfinite(x) #elif ( defined(__GNUG__)||defined(__GNUWIN32__)||defined(__DJGPP__)|| \ defined(__SGI_CC__)||defined(__SUNCC__)||defined(__XLC__)|| \ @@ -126,7 +128,7 @@ #endif /* __cplusplus */ -#if defined(__WXMSW__) && !defined(__WXWINCE__) +#if defined(__WINDOWS__) && !defined(__WXWINCE__) #define wxMulDivInt32( a , b , c ) ::MulDiv( a , b , c ) #else #define wxMulDivInt32( a , b , c ) (wxRound((a)*(((wxDouble)b)/((wxDouble)c)))) @@ -144,7 +146,7 @@ #if WXWIN_COMPATIBILITY_2_8 wxDEPRECATED( WXDLLIMPEXP_BASE wxFloat64 ConvertFromIeeeExtended(const wxInt8 *bytes) ); wxDEPRECATED( WXDLLIMPEXP_BASE void ConvertToIeeeExtended(wxFloat64 num, wxInt8 *bytes) ); -#endif // WXWIN_COMPATIBILITY_2_8 +#endif #ifdef __cplusplus } diff --git a/Externals/wxWidgets3/include/wx/mdi.h b/Externals/wxWidgets3/include/wx/mdi.h index 35820a90f9..df6283eb2a 100644 --- a/Externals/wxWidgets3/include/wx/mdi.h +++ b/Externals/wxWidgets3/include/wx/mdi.h @@ -5,7 +5,7 @@ // Vadim Zeitlin (base MDI classes refactoring) // Copyright: (c) 1998 Julian Smart // (c) 2008 Vadim Zeitlin -// RCS-ID: $Id: mdi.h 58457 2009-01-27 14:48:20Z VZ $ +// RCS-ID: $Id: mdi.h 70790 2012-03-04 00:29:03Z VZ $ // Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// @@ -81,7 +81,7 @@ public: #if wxUSE_MENUS // return the pointer to the current window menu or NULL if we don't have // because of wxFRAME_NO_WINDOW_MENU style - wxMenu* GetWindowMenu() const { return m_windowMenu; }; + wxMenu* GetWindowMenu() const { return m_windowMenu; } // use the given menu instead of the default window menu // @@ -176,6 +176,16 @@ public: // level windows too virtual bool IsTopLevel() const { return false; } + // In all ports keyboard navigation must stop at MDI child frame level and + // can't cross its boundary. Indicate this by overriding this function to + // return true. + virtual bool IsTopNavigationDomain() const { return true; } + + // Raising any frame is supposed to show it but wxFrame Raise() + // implementation doesn't work for MDI child frames in most forms so + // forward this to Activate() which serves the same purpose by default. + virtual void Raise() { Activate(); } + protected: wxMDIParentFrame *m_mdiParent; }; diff --git a/Externals/wxWidgets3/include/wx/memory.h b/Externals/wxWidgets3/include/wx/memory.h index 480411d38a..17f1149b7b 100644 --- a/Externals/wxWidgets3/include/wx/memory.h +++ b/Externals/wxWidgets3/include/wx/memory.h @@ -4,7 +4,7 @@ // Author: Arthur Seaton, Julian Smart // Modified by: // Created: 29/01/98 -// RCS-ID: $Id: memory.h 59711 2009-03-21 23:36:37Z VZ $ +// RCS-ID: $Id: memory.h 70796 2012-03-04 00:29:31Z VZ $ // Copyright: (c) 1998 Julian Smart // Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// @@ -60,7 +60,7 @@ WXDLLIMPEXP_BASE void wxDebugFree(void * buf, bool isVect = false); // devik 2000-8-29: All new/delete ops are now inline because they can't // be marked as dllexport/dllimport. It then leads to weird bugs when // used on MSW as DLL -#if defined(__WXMSW__) && (defined(WXUSINGDLL) || defined(WXMAKINGDLL_BASE)) +#if defined(__WINDOWS__) && (defined(WXUSINGDLL) || defined(WXMAKINGDLL_BASE)) inline void * operator new (size_t size, wxChar * fileName, int lineNum) { return wxDebugAlloc(size, fileName, lineNum, false, false); @@ -108,7 +108,7 @@ void * operator new[] (size_t size, wxChar * fileName, int lineNum); void operator delete[] (void * buf); #endif // wxUSE_ARRAY_MEMORY_OPERATORS -#endif // defined(__WXMSW__) && (defined(WXUSINGDLL) || defined(WXMAKINGDLL_BASE)) +#endif // defined(__WINDOWS__) && (defined(WXUSINGDLL) || defined(WXMAKINGDLL_BASE)) // VC++ 6.0 and MWERKS #if ( defined(__VISUALC__) && (__VISUALC__ >= 1200) ) || defined(__MWERKS__) diff --git a/Externals/wxWidgets3/include/wx/menu.h b/Externals/wxWidgets3/include/wx/menu.h index f3ee7c9060..552ca8b286 100644 --- a/Externals/wxWidgets3/include/wx/menu.h +++ b/Externals/wxWidgets3/include/wx/menu.h @@ -4,7 +4,7 @@ // Author: Vadim Zeitlin // Modified by: // Created: 26.10.99 -// RCS-ID: $Id: menu.h 66640 2011-01-07 21:51:19Z SC $ +// RCS-ID: $Id: menu.h 70345 2012-01-15 01:05:28Z VZ $ // Copyright: (c) wxWidgets team // Licence: wxWindows licence /////////////////////////////////////////////////////////////////////////////// @@ -580,8 +580,6 @@ protected: #else // !wxUSE_BASE_CLASSES_ONLY #if defined(__WXUNIVERSAL__) #include "wx/univ/menu.h" -#elif defined(__WXPALMOS__) - #include "wx/palmos/menu.h" #elif defined(__WXMSW__) #include "wx/msw/menu.h" #elif defined(__WXMOTIF__) diff --git a/Externals/wxWidgets3/include/wx/menuitem.h b/Externals/wxWidgets3/include/wx/menuitem.h index 0e4a99efd9..3c0fdfc41b 100644 --- a/Externals/wxWidgets3/include/wx/menuitem.h +++ b/Externals/wxWidgets3/include/wx/menuitem.h @@ -4,7 +4,7 @@ // Author: Vadim Zeitlin // Modified by: // Created: 25.10.99 -// RCS-ID: $Id: menuitem.h 66966 2011-02-19 12:32:59Z VZ $ +// RCS-ID: $Id: menuitem.h 70345 2012-01-15 01:05:28Z VZ $ // Copyright: (c) 1999 Vadim Zeitlin // Licence: wxWindows licence /////////////////////////////////////////////////////////////////////////////// @@ -189,8 +189,6 @@ inline void wxMenuItemBase::SetText(const wxString& text) { SetItemLabel(text); #else // !wxUSE_BASE_CLASSES_ONLY #if defined(__WXUNIVERSAL__) #include "wx/univ/menuitem.h" -#elif defined(__WXPALMOS__) - #include "wx/palmos/menuitem.h" #elif defined(__WXMSW__) #include "wx/msw/menuitem.h" #elif defined(__WXMOTIF__) diff --git a/Externals/wxWidgets3/include/wx/meta/movable.h b/Externals/wxWidgets3/include/wx/meta/movable.h index 55877b129d..0217a121c7 100644 --- a/Externals/wxWidgets3/include/wx/meta/movable.h +++ b/Externals/wxWidgets3/include/wx/meta/movable.h @@ -3,7 +3,7 @@ // Purpose: Test if a type is movable using memmove() etc. // Author: Vaclav Slavik // Created: 2008-01-21 -// RCS-ID: $Id: movable.h 64589 2010-06-14 15:12:37Z JMS $ +// RCS-ID: $Id: movable.h 67343 2011-03-30 14:16:04Z VZ $ // Copyright: (c) 2008 Vaclav Slavik // Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// @@ -38,7 +38,7 @@ struct wxIsMovable // (NB: we don't put this into string.h and choose to include wx/string.h from // here instead so that rarely-used wxIsMovable code isn't included by // everything) -#if !wxUSE_STL && !wxUSE_STRING_POS_CACHE +#if !wxUSE_STD_STRING && !wxUSE_STRING_POS_CACHE WX_DECLARE_TYPE_MOVABLE(wxString) #endif diff --git a/Externals/wxWidgets3/include/wx/metafile.h b/Externals/wxWidgets3/include/wx/metafile.h index 4a501965d2..feaac82e7f 100644 --- a/Externals/wxWidgets3/include/wx/metafile.h +++ b/Externals/wxWidgets3/include/wx/metafile.h @@ -4,7 +4,7 @@ // Author: wxWidgets team // Modified by: // Created: 13.01.00 -// RCS-ID: $Id: metafile.h 54125 2008-06-11 19:17:41Z SC $ +// RCS-ID: $Id: metafile.h 70345 2012-01-15 01:05:28Z VZ $ // Copyright: (c) wxWidgets team // Licence: wxWindows licence /////////////////////////////////////////////////////////////////////////////// @@ -25,11 +25,7 @@ #if defined(__WXMSW__) #if wxUSE_ENH_METAFILE - #if defined(__WXPALMOS__) - #include "wx/palmos/enhmeta.h" - #else - #include "wx/msw/enhmeta.h" - #endif + #include "wx/msw/enhmeta.h" #if wxUSE_WIN_METAFILES_ALWAYS // use normal metafiles as well @@ -45,11 +41,7 @@ #define wxMETAFILE_IS_ENH #endif // wxUSE_WIN_METAFILES_ALWAYS #else // !wxUSE_ENH_METAFILE - #if defined(__WXPALMOS__) - #include "wx/palmos/metafile.h" - #else - #include "wx/msw/metafile.h" - #endif + #include "wx/msw/metafile.h" #endif #elif defined(__WXPM__) #include "wx/os2/metafile.h" diff --git a/Externals/wxWidgets3/include/wx/mimetype.h b/Externals/wxWidgets3/include/wx/mimetype.h index 45eb578d61..a7933cd989 100644 --- a/Externals/wxWidgets3/include/wx/mimetype.h +++ b/Externals/wxWidgets3/include/wx/mimetype.h @@ -5,7 +5,7 @@ // Modified by: // Chris Elliott (biol75@york.ac.uk) 5 Dec 00: write support for Win32 // Created: 23.09.98 -// RCS-ID: $Id: mimetype.h 65707 2010-10-01 13:05:42Z VZ $ +// RCS-ID: $Id: mimetype.h 67384 2011-04-03 20:31:32Z DS $ // Copyright: (c) 1998 Vadim Zeitlin // Licence: wxWindows licence (part of wxExtra library) ///////////////////////////////////////////////////////////////////////////// @@ -389,7 +389,7 @@ public: // operations // expand a string in the format of GetOpenCommand (which may contain - // '%s' and '%t' format specificators for the file name and mime type + // '%s' and '%t' format specifiers for the file name and mime type // and %{param} constructions). static wxString ExpandCommand(const wxString& command, const MessageParameters& params); diff --git a/Externals/wxWidgets3/include/wx/minifram.h b/Externals/wxWidgets3/include/wx/minifram.h index d7d66ce25f..8907b69ba4 100644 --- a/Externals/wxWidgets3/include/wx/minifram.h +++ b/Externals/wxWidgets3/include/wx/minifram.h @@ -5,7 +5,7 @@ // Modified by: // Created: // Copyright: (c) Julian Smart -// RCS-ID: $Id: minifram.h 54125 2008-06-11 19:17:41Z SC $ +// RCS-ID: $Id: minifram.h 70345 2012-01-15 01:05:28Z VZ $ // Licence: wxWindows Licence ///////////////////////////////////////////////////////////////////////////// @@ -16,9 +16,7 @@ #if wxUSE_MINIFRAME -#if defined(__WXPALMOS__) -#include "wx/palmos/minifram.h" -#elif defined(__WXMSW__) +#if defined(__WXMSW__) #include "wx/msw/minifram.h" #elif defined(__WXMOTIF__) #include "wx/motif/minifram.h" diff --git a/Externals/wxWidgets3/include/wx/mousestate.h b/Externals/wxWidgets3/include/wx/mousestate.h index 719052951c..334b13fb15 100644 --- a/Externals/wxWidgets3/include/wx/mousestate.h +++ b/Externals/wxWidgets3/include/wx/mousestate.h @@ -3,7 +3,7 @@ // Purpose: Declaration of wxMouseState class // Author: Vadim Zeitlin // Created: 2008-09-19 (extracted from wx/utils.h) -// RCS-ID: $Id: mousestate.h 65379 2010-08-22 22:15:07Z VZ $ +// RCS-ID: $Id: mousestate.h 70098 2011-12-23 05:59:59Z PC $ // Copyright: (c) 2008 Vadim Zeitlin // Licence: wxWindows licence /////////////////////////////////////////////////////////////////////////////// @@ -79,10 +79,6 @@ public: { switch ( but ) { - default: - wxFAIL_MSG(wxT("invalid parameter in wxMouseState::ButtonIsDown")); - // fall through - case wxMOUSE_BTN_ANY: return LeftIsDown() || MiddleIsDown() || RightIsDown() || Aux1IsDown() || Aux2IsDown(); @@ -101,6 +97,15 @@ public: case wxMOUSE_BTN_AUX2: return Aux2IsDown(); + + case wxMOUSE_BTN_NONE: + case wxMOUSE_BTN_MAX: + wxFAIL_MSG(wxS("invalid parameter")); + return false; + + default: + wxFAIL_MSG(wxS("unknown parameter")); + return false; } } @@ -123,7 +128,7 @@ public: // version of wxMouseState but their names are confusing as wxMouseEvent // has methods with the same names which do something quite different so // don't use them any more -#ifdef WXWIN_COMPATIBILITY_2_8 +#if WXWIN_COMPATIBILITY_2_8 wxDEPRECATED_INLINE(bool LeftDown() const, return LeftIsDown(); ) wxDEPRECATED_INLINE(bool MiddleDown() const, return MiddleIsDown(); ) wxDEPRECATED_INLINE(bool RightDown() const, return RightIsDown(); ) diff --git a/Externals/wxWidgets3/include/wx/msgdlg.h b/Externals/wxWidgets3/include/wx/msgdlg.h index be95fbc5e9..6da9e0cd7f 100644 --- a/Externals/wxWidgets3/include/wx/msgdlg.h +++ b/Externals/wxWidgets3/include/wx/msgdlg.h @@ -4,7 +4,7 @@ // Author: Julian Smart // Modified by: // Created: -// RCS-ID: $Id: msgdlg.h 67254 2011-03-20 00:14:35Z DS $ +// RCS-ID: $Id: msgdlg.h 70345 2012-01-15 01:05:28Z VZ $ // Copyright: (c) Julian Smart // Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// @@ -177,10 +177,16 @@ public: return true; } + virtual bool SetHelpLabel(const ButtonLabel& help) + { + DoSetCustomLabel(m_help, help); + return true; + } + // test if any custom labels were set bool HasCustomLabels() const { - return !(m_ok.empty() && m_cancel.empty() && + return !(m_ok.empty() && m_cancel.empty() && m_help.empty() && m_yes.empty() && m_no.empty()); } @@ -195,6 +201,8 @@ public: { return m_ok.empty() ? GetDefaultOKLabel() : m_ok; } wxString GetCancelLabel() const { return m_cancel.empty() ? GetDefaultCancelLabel() : m_cancel; } + wxString GetHelpLabel() const + { return m_help.empty() ? GetDefaultHelpLabel() : m_help; } // based on message dialog style, returns exactly one of: wxICON_NONE, // wxICON_ERROR, wxICON_WARNING, wxICON_QUESTION, wxICON_INFORMATION @@ -250,6 +258,7 @@ protected: const wxString& GetCustomYesLabel() const { return m_yes; } const wxString& GetCustomNoLabel() const { return m_no; } const wxString& GetCustomOKLabel() const { return m_ok; } + const wxString& GetCustomHelpLabel() const { return m_help; } const wxString& GetCustomCancelLabel() const { return m_cancel; } private: @@ -259,13 +268,15 @@ private: virtual wxString GetDefaultNoLabel() const { return wxGetTranslation("No"); } virtual wxString GetDefaultOKLabel() const { return wxGetTranslation("OK"); } virtual wxString GetDefaultCancelLabel() const { return wxGetTranslation("Cancel"); } + virtual wxString GetDefaultHelpLabel() const { return wxGetTranslation("Help"); } // labels for the buttons, initially empty meaning that the defaults should // be used, use GetYes/No/OK/CancelLabel() to access them wxString m_yes, m_no, m_ok, - m_cancel; + m_cancel, + m_help; wxDECLARE_NO_COPY_CLASS(wxMessageDialogBase); }; @@ -279,8 +290,6 @@ private: #define wxMessageDialog wxGenericMessageDialog #elif defined(__WXCOCOA__) #include "wx/cocoa/msgdlg.h" -#elif defined(__WXPALMOS__) - #include "wx/palmos/msgdlg.h" #elif defined(__WXMSW__) #include "wx/msw/msgdlg.h" #elif defined(__WXMOTIF__) diff --git a/Externals/wxWidgets3/include/wx/msw/anybutton.h b/Externals/wxWidgets3/include/wx/msw/anybutton.h new file mode 100644 index 0000000000..cda386e798 --- /dev/null +++ b/Externals/wxWidgets3/include/wx/msw/anybutton.h @@ -0,0 +1,81 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/msw/anybutton.h +// Purpose: wxAnyButton class +// Author: Julian Smart +// Created: 1997-02-01 (extracted from button.h) +// RCS-ID: $Id: anybutton.h 67931 2011-06-14 13:00:42Z VZ $ +// Copyright: (c) Julian Smart +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_MSW_ANYBUTTON_H_ +#define _WX_MSW_ANYBUTTON_H_ + +// ---------------------------------------------------------------------------- +// Common button functionality +// ---------------------------------------------------------------------------- + +class WXDLLIMPEXP_CORE wxAnyButton : public wxAnyButtonBase +{ +public: + wxAnyButton() + { + m_imageData = NULL; +#if wxUSE_MARKUP + m_markupText = NULL; +#endif // wxUSE_MARKUP + } + + virtual ~wxAnyButton(); + + // overridden base class methods + virtual void SetLabel(const wxString& label); + virtual bool SetBackgroundColour(const wxColour &colour); + virtual bool SetForegroundColour(const wxColour &colour); + + // implementation from now on + virtual WXLRESULT MSWWindowProc(WXUINT nMsg, WXWPARAM wParam, WXLPARAM lParam); + + virtual bool MSWOnDraw(WXDRAWITEMSTRUCT *item); + virtual State GetNormalState() const { return State_Normal; } + + // returns true if the platform should explicitly apply a theme border + virtual bool CanApplyThemeBorder() const { return false; } + +protected: + // usually overridden base class virtuals + virtual wxSize DoGetBestSize() const; + + virtual wxBitmap DoGetBitmap(State which) const; + virtual void DoSetBitmap(const wxBitmap& bitmap, State which); + virtual wxSize DoGetBitmapMargins() const; + virtual void DoSetBitmapMargins(wxCoord x, wxCoord y); + virtual void DoSetBitmapPosition(wxDirection dir); + +#if wxUSE_MARKUP + virtual bool DoSetLabelMarkup(const wxString& markup); +#endif // wxUSE_MARKUP + + // Increases the passed in size to account for the button image. + // + // Should only be called if we do have a button, i.e. if m_imageData is + // non-NULL. + void AdjustForBitmapSize(wxSize& size) const; + + class wxButtonImageData *m_imageData; + +#if wxUSE_MARKUP + class wxMarkupText *m_markupText; +#endif // wxUSE_MARKUP + + // Switches button into owner-drawn mode: this is used if we need to draw + // something not supported by the native control, such as using non default + // colours or a bitmap on pre-XP systems. + void MakeOwnerDrawn(); + bool IsOwnerDrawn() const; + +private: + wxDECLARE_NO_COPY_CLASS(wxAnyButton); +}; + +#endif // _WX_MSW_ANYBUTTON_H_ diff --git a/Externals/wxWidgets3/include/wx/msw/bmpbuttn.h b/Externals/wxWidgets3/include/wx/msw/bmpbuttn.h index d753a82701..894260f4a0 100644 --- a/Externals/wxWidgets3/include/wx/msw/bmpbuttn.h +++ b/Externals/wxWidgets3/include/wx/msw/bmpbuttn.h @@ -4,7 +4,7 @@ // Author: Julian Smart // Modified by: // Created: 01/02/97 -// RCS-ID: $Id: bmpbuttn.h 61071 2009-06-15 23:10:16Z VZ $ +// RCS-ID: $Id: bmpbuttn.h 67931 2011-06-14 13:00:42Z VZ $ // Copyright: (c) Julian Smart // Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// @@ -19,7 +19,7 @@ class WXDLLIMPEXP_CORE wxBitmapButton : public wxBitmapButtonBase { public: - wxBitmapButton() { Init(); } + wxBitmapButton() {} wxBitmapButton(wxWindow *parent, wxWindowID id, @@ -30,8 +30,6 @@ public: const wxValidator& validator = wxDefaultValidator, const wxString& name = wxButtonNameStr) { - Init(); - Create(parent, id, bitmap, pos, size, style, validator, name); } @@ -45,25 +43,6 @@ public: const wxString& name = wxButtonNameStr); protected: - // common part of all ctors - void Init() - { - m_disabledSetByUser = - m_hoverSetByUser = false; - } - - // reimplement some base class virtuals - virtual void DoSetBitmap(const wxBitmap& bitmap, State which); - - // true if disabled bitmap was set by user, false if we created it - // ourselves from the normal one - bool m_disabledSetByUser; - - // true if hover bitmap was set by user, false if it was set from focused - // one - bool m_hoverSetByUser; - - DECLARE_EVENT_TABLE() DECLARE_DYNAMIC_CLASS_NO_COPY(wxBitmapButton) }; diff --git a/Externals/wxWidgets3/include/wx/msw/button.h b/Externals/wxWidgets3/include/wx/msw/button.h index 898aeaac99..ac3545b6eb 100644 --- a/Externals/wxWidgets3/include/wx/msw/button.h +++ b/Externals/wxWidgets3/include/wx/msw/button.h @@ -4,13 +4,13 @@ // Author: Julian Smart // Modified by: // Created: 01/02/97 -// RCS-ID: $Id: button.h 67065 2011-02-27 12:48:26Z VZ $ +// RCS-ID: $Id: button.h 69984 2011-12-11 17:03:56Z VZ $ // Copyright: (c) Julian Smart // Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// -#ifndef _WX_BUTTON_H_ -#define _WX_BUTTON_H_ +#ifndef _WX_MSW_BUTTON_H_ +#define _WX_MSW_BUTTON_H_ // ---------------------------------------------------------------------------- // Pushbutton @@ -47,22 +47,13 @@ public: virtual wxWindow *SetDefault(); - // overridden base class methods - virtual void SetLabel(const wxString& label); - virtual bool SetBackgroundColour(const wxColour &colour); - virtual bool SetForegroundColour(const wxColour &colour); - // implementation from now on virtual void Command(wxCommandEvent& event); virtual WXLRESULT MSWWindowProc(WXUINT nMsg, WXWPARAM wParam, WXLPARAM lParam); virtual bool MSWCommand(WXUINT param, WXWORD id); - virtual bool MSWOnDraw(WXDRAWITEMSTRUCT *item); virtual WXDWORD MSWGetStyle(long style, WXDWORD *exstyle) const; - // returns true if the platform should explicitly apply a theme border - virtual bool CanApplyThemeBorder() const { return false; } - protected: // send a notification event, return true if processed bool SendClickEvent(); @@ -74,32 +65,8 @@ protected: // set or unset BS_DEFPUSHBUTTON style static void SetDefaultStyle(wxButton *btn, bool on); - // usually overridden base class virtuals - virtual wxSize DoGetBestSize() const; - virtual bool DoGetAuthNeeded() const; virtual void DoSetAuthNeeded(bool show); - virtual wxBitmap DoGetBitmap(State which) const; - virtual void DoSetBitmap(const wxBitmap& bitmap, State which); - virtual wxSize DoGetBitmapMargins() const; - virtual void DoSetBitmapMargins(wxCoord x, wxCoord y); - virtual void DoSetBitmapPosition(wxDirection dir); - -#if wxUSE_MARKUP - virtual bool DoSetLabelMarkup(const wxString& markup); -#endif // wxUSE_MARKUP - - // Increases the passed in size to account for the button image. - // - // Should only be called if we do have a button, i.e. if m_imageData is - // non-NULL. - void AdjustForBitmapSize(wxSize& size) const; - - class wxButtonImageData *m_imageData; - -#if wxUSE_MARKUP - class wxMarkupText *m_markupText; -#endif // wxUSE_MARKUP // true if the UAC symbol is shown bool m_authNeeded; @@ -107,19 +74,13 @@ protected: private: void Init() { - m_imageData = NULL; -#if wxUSE_MARKUP - m_markupText = NULL; -#endif // wxUSE_MARKUP m_authNeeded = false; } - // Switches button into owner-drawn mode: this is used if we need to draw - // something not supported by the native control, such as using non default - // colours or a bitmap on pre-XP systems. - void MakeOwnerDrawn(); + void OnCharHook(wxKeyEvent& event); + wxDECLARE_EVENT_TABLE(); wxDECLARE_DYNAMIC_CLASS_NO_COPY(wxButton); }; -#endif // _WX_BUTTON_H_ +#endif // _WX_MSW_BUTTON_H_ diff --git a/Externals/wxWidgets3/include/wx/msw/chkconf.h b/Externals/wxWidgets3/include/wx/msw/chkconf.h index 7e547f91b0..637155d5f8 100644 --- a/Externals/wxWidgets3/include/wx/msw/chkconf.h +++ b/Externals/wxWidgets3/include/wx/msw/chkconf.h @@ -4,7 +4,7 @@ * Author: Julian Smart * Modified by: * Created: 01/02/97 - * RCS-ID: $Id: chkconf.h 63832 2010-04-02 19:30:41Z VZ $ + * RCS-ID: $Id: chkconf.h 69845 2011-11-27 19:52:13Z VZ $ * Copyright: (c) Julian Smart * Licence: wxWindows licence */ @@ -224,11 +224,6 @@ */ #ifdef __WIN64__ # if wxUSE_STACKWALKER - /* this is not currently supported under Win64, volunteers needed to - make it work */ -# undef wxUSE_STACKWALKER -# define wxUSE_STACKWALKER 0 - # undef wxUSE_CRASHREPORT # define wxUSE_CRASHREPORT 0 # endif @@ -239,7 +234,7 @@ Compiler-specific checks. */ -// Borland +/* Borland */ #ifdef __BORLANDC__ #if __BORLANDC__ < 0x500 @@ -336,6 +331,14 @@ #endif /* !wxUSE_DYNAMIC_LOADER */ #if !wxUSE_DYNLIB_CLASS +# if wxUSE_DC_TRANSFORM_MATRIX +# ifdef wxABORT_ON_CONFIG_ERROR +# error "wxUSE_DC_TRANSFORM_MATRIX requires wxUSE_DYNLIB_CLASS" +# else +# undef wxUSE_DC_TRANSFORM_MATRIX +# define wxUSE_DC_TRANSFORM_MATRIX 0 +# endif +# endif # if wxUSE_UXTHEME # ifdef wxABORT_ON_CONFIG_ERROR # error "wxUSE_UXTHEME requires wxUSE_DYNLIB_CLASS" @@ -400,6 +403,14 @@ # define wxUSE_MEDIACTRL 0 # endif # endif +# if wxUSE_WEB +# ifdef wxABORT_ON_CONFIG_ERROR +# error "wxWebView requires wxActiveXContainer under MSW" +# else +# undef wxUSE_WEB +# define wxUSE_WEB 0 +# endif +# endif #endif /* !wxUSE_ACTIVEX */ #if !wxUSE_THREADS @@ -413,6 +424,18 @@ # endif #endif /* !wxUSE_THREADS */ + +#if !wxUSE_OLE_AUTOMATION +# if wxUSE_WEB +# ifdef wxABORT_ON_CONFIG_ERROR +# error "wxWebView requires wxUSE_OLE_AUTOMATION under MSW" +# else +# undef wxUSE_WEB +# define wxUSE_WEB 0 +# endif +# endif +#endif /* !wxUSE_OLE_AUTOMATION */ + #if defined(__WXUNIVERSAL__) && wxUSE_POSTSCRIPT_ARCHITECTURE_IN_MSW && !wxUSE_POSTSCRIPT # undef wxUSE_POSTSCRIPT # define wxUSE_POSTSCRIPT 1 diff --git a/Externals/wxWidgets3/include/wx/msw/combobox.h b/Externals/wxWidgets3/include/wx/msw/combobox.h index d0b6ee8234..5b7c63d67a 100644 --- a/Externals/wxWidgets3/include/wx/msw/combobox.h +++ b/Externals/wxWidgets3/include/wx/msw/combobox.h @@ -4,7 +4,7 @@ // Author: Julian Smart // Modified by: // Created: 01/02/97 -// RCS-ID: $Id: combobox.h 63242 2010-01-24 01:00:45Z VZ $ +// RCS-ID: $Id: combobox.h 68808 2011-08-21 12:06:16Z VZ $ // Copyright: (c) Julian Smart // Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// @@ -75,6 +75,10 @@ public: const wxValidator& validator = wxDefaultValidator, const wxString& name = wxComboBoxNameStr); + // See wxComboBoxBase discussion of IsEmpty(). + bool IsListEmpty() const { return wxItemContainer::IsEmpty(); } + bool IsTextEmpty() const { return wxTextEntry::IsEmpty(); } + // resolve ambiguities among virtual functions inherited from both base // classes virtual void Clear(); diff --git a/Externals/wxWidgets3/include/wx/msw/custombgwin.h b/Externals/wxWidgets3/include/wx/msw/custombgwin.h new file mode 100644 index 0000000000..fe5481f710 --- /dev/null +++ b/Externals/wxWidgets3/include/wx/msw/custombgwin.h @@ -0,0 +1,58 @@ +/////////////////////////////////////////////////////////////////////////////// +// Name: wx/msw/custombgwin.h +// Purpose: wxMSW implementation of wxCustomBackgroundWindow +// Author: Vadim Zeitlin +// Created: 2011-10-10 +// RCS-ID: $Id: custombgwin.h 69378 2011-10-11 17:07:43Z VZ $ +// Copyright: (c) 2011 Vadim Zeitlin +// Licence: wxWindows licence +/////////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_MSW_CUSTOMBGWIN_H_ +#define _WX_MSW_CUSTOMBGWIN_H_ + +#include "wx/bitmap.h" +#include "wx/brush.h" + +// ---------------------------------------------------------------------------- +// wxCustomBackgroundWindow +// ---------------------------------------------------------------------------- + +template +class wxCustomBackgroundWindow : public W, + public wxCustomBackgroundWindowBase +{ +public: + typedef W BaseWindowClass; + + wxCustomBackgroundWindow() { m_backgroundBrush = NULL; } + + virtual ~wxCustomBackgroundWindow() { delete m_backgroundBrush; } + +protected: + virtual void DoSetBackgroundBitmap(const wxBitmap& bmp) + { + delete m_backgroundBrush; + m_backgroundBrush = bmp.IsOk() ? new wxBrush(bmp) : NULL; + + // Our transparent children should use our background if we have it, + // otherwise try to restore m_inheritBgCol to some reasonable value: true + // if we also have non-default background colour or false otherwise. + BaseWindowClass::m_inheritBgCol = bmp.IsOk() + || BaseWindowClass::UseBgCol(); + } + + virtual WXHBRUSH MSWGetCustomBgBrush() + { + if ( m_backgroundBrush ) + return (WXHBRUSH)m_backgroundBrush->GetResourceHandle(); + + return BaseWindowClass::MSWGetCustomBgBrush(); + } + + wxBrush *m_backgroundBrush; + + wxDECLARE_NO_COPY_TEMPLATE_CLASS(wxCustomBackgroundWindow, W); +}; + +#endif // _WX_MSW_CUSTOMBGWIN_H_ diff --git a/Externals/wxWidgets3/include/wx/msw/datectrl.h b/Externals/wxWidgets3/include/wx/msw/datectrl.h index 8a0cabdf9a..7015019f53 100644 --- a/Externals/wxWidgets3/include/wx/msw/datectrl.h +++ b/Externals/wxWidgets3/include/wx/msw/datectrl.h @@ -4,7 +4,7 @@ // Author: Vadim Zeitlin // Modified by: // Created: 2005-01-09 -// RCS-ID: $Id: datectrl.h 49893 2007-11-13 12:10:34Z JS $ +// RCS-ID: $Id: datectrl.h 69222 2011-09-29 13:43:02Z VZ $ // Copyright: (c) 2005 Vadim Zeitlin // Licence: wxWindows licence /////////////////////////////////////////////////////////////////////////////// @@ -43,30 +43,21 @@ public: const wxValidator& validator = wxDefaultValidator, const wxString& name = wxDatePickerCtrlNameStr); - // set/get the date + // Override this one to add date-specific (and time-ignoring) checks. virtual void SetValue(const wxDateTime& dt); virtual wxDateTime GetValue() const; - // set/get the allowed valid range for the dates, if either/both of them - // are invalid, there is no corresponding limit and if neither is set - // GetRange() returns false + // Implement the base class pure virtuals. virtual void SetRange(const wxDateTime& dt1, const wxDateTime& dt2); virtual bool GetRange(wxDateTime *dt1, wxDateTime *dt2) const; + // Override MSW-specific functions used during control creation. virtual WXDWORD MSWGetStyle(long style, WXDWORD *exstyle) const; - virtual bool MSWOnNotify(int idCtrl, WXLPARAM lParam, WXLPARAM *result); - - // returns true if the platform should explicitly apply a theme border - virtual bool CanApplyThemeBorder() const { return false; } - protected: - virtual wxBorder GetDefaultBorder() const { return wxBORDER_NONE; } - virtual wxSize DoGetBestSize() const; - - // the date currently shown by the control, may be invalid - wxDateTime m_date; - + virtual wxLocaleInfo MSWGetFormat() const; + virtual bool MSWAllowsNone() const { return HasFlag(wxDP_ALLOWNONE); } + virtual bool MSWOnDateTimeChange(const tagNMDATETIMECHANGE& dtch); DECLARE_DYNAMIC_CLASS_NO_COPY(wxDatePickerCtrl) }; diff --git a/Externals/wxWidgets3/include/wx/msw/datetimectrl.h b/Externals/wxWidgets3/include/wx/msw/datetimectrl.h new file mode 100644 index 0000000000..0c783511c2 --- /dev/null +++ b/Externals/wxWidgets3/include/wx/msw/datetimectrl.h @@ -0,0 +1,87 @@ +/////////////////////////////////////////////////////////////////////////////// +// Name: wx/msw/datetimectrl.h +// Purpose: wxDateTimePickerCtrl for Windows. +// Author: Vadim Zeitlin +// Created: 2011-09-22 (extracted from wx/msw/datectrl.h). +// RCS-ID: $Id: datetimectrl.h 69489 2011-10-20 16:45:48Z VZ $ +// Copyright: (c) 2005-2011 Vadim Zeitlin +// Licence: wxWindows licence +/////////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_MSW_DATETIMECTRL_H_ +#define _WX_MSW_DATETIMECTRL_H_ + +#include "wx/intl.h" + +// Forward declare a struct from Platform SDK. +struct tagNMDATETIMECHANGE; + +// ---------------------------------------------------------------------------- +// wxDateTimePickerCtrl +// ---------------------------------------------------------------------------- + +class WXDLLIMPEXP_ADV wxDateTimePickerCtrl : public wxDateTimePickerCtrlBase +{ +public: + // set/get the date + virtual void SetValue(const wxDateTime& dt); + virtual wxDateTime GetValue() const; + + // returns true if the platform should explicitly apply a theme border + virtual bool CanApplyThemeBorder() const { return false; } + + virtual bool MSWOnNotify(int idCtrl, WXLPARAM lParam, WXLPARAM *result); + +protected: + virtual wxBorder GetDefaultBorder() const { return wxBORDER_NONE; } + virtual wxSize DoGetBestSize() const; + + // Helper for the derived classes Create(): creates a native control with + // the specified attributes. + bool MSWCreateDateTimePicker(wxWindow *parent, + wxWindowID id, + const wxDateTime& dt, + const wxPoint& pos, + const wxSize& size, + long style, + const wxValidator& validator, + const wxString& name); + + // Notice that the methods below must be overridden in all native MSW + // classes inheriting from this one but they can't be pure virtual because + // the generic implementations, not needing nor able to implement them, is + // also derived from this class currently. The real problem is, of course, + // this wrong class structure because the generic classes also inherit the + // wrong implementations of Set/GetValue() and DoGetBestSize() but as they + // override these methods anyhow, it does work -- but is definitely ugly + // and need to be changed (but how?) in the future. + + // Override to return the date/time format used by this control. + virtual wxLocaleInfo MSWGetFormat() const /* = 0 */ + { + wxFAIL_MSG( "Unreachable" ); + return wxLOCALE_TIME_FMT; + } + + // Override to indicate whether we can have no date at all. + virtual bool MSWAllowsNone() const /* = 0 */ + { + wxFAIL_MSG( "Unreachable" ); + return false; + } + + // Override to update m_date and send the event when the control contents + // changes, return true if the event was handled. + virtual bool MSWOnDateTimeChange(const tagNMDATETIMECHANGE& dtch) /* = 0 */ + { + wxUnusedVar(dtch); + wxFAIL_MSG( "Unreachable" ); + return false; + } + + + // the date currently shown by the control, may be invalid + wxDateTime m_date; +}; + +#endif // _WX_MSW_DATETIMECTRL_H_ diff --git a/Externals/wxWidgets3/include/wx/msw/dc.h b/Externals/wxWidgets3/include/wx/msw/dc.h index e55eb54715..48fa925c24 100644 --- a/Externals/wxWidgets3/include/wx/msw/dc.h +++ b/Externals/wxWidgets3/include/wx/msw/dc.h @@ -4,7 +4,7 @@ // Author: Julian Smart // Modified by: // Created: 01/02/97 -// RCS-ID: $Id: dc.h 67063 2011-02-27 12:48:13Z VZ $ +// RCS-ID: $Id: dc.h 67588 2011-04-23 16:03:10Z VZ $ // Copyright: (c) Julian Smart // Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// @@ -87,6 +87,13 @@ public: virtual void SetDeviceOrigin(wxCoord x, wxCoord y); virtual void SetAxisOrientation(bool xLeftRight, bool yBottomUp); +#if wxUSE_DC_TRANSFORM_MATRIX + virtual bool CanUseTransformMatrix() const; + virtual bool SetTransformMatrix(const wxAffineMatrix2D& matrix); + virtual wxAffineMatrix2D GetTransformMatrix() const; + virtual void ResetTransformMatrix(); +#endif // wxUSE_DC_TRANSFORM_MATRIX + virtual void SetLogicalFunction(wxRasterOperationMode function); // implementation from now on diff --git a/Externals/wxWidgets3/include/wx/msw/debughlp.h b/Externals/wxWidgets3/include/wx/msw/debughlp.h index e4337ce751..f5c34ec2b3 100644 --- a/Externals/wxWidgets3/include/wx/msw/debughlp.h +++ b/Externals/wxWidgets3/include/wx/msw/debughlp.h @@ -4,7 +4,7 @@ // Author: Vadim Zeitlin // Modified by: // Created: 2005-01-08 (extracted from msw/crashrpt.cpp) -// RCS-ID: $Id: debughlp.h 67254 2011-03-20 00:14:35Z DS $ +// RCS-ID: $Id: debughlp.h 69845 2011-11-27 19:52:13Z VZ $ // Copyright: (c) 2003-2005 Vadim Zeitlin // Licence: wxWindows licence /////////////////////////////////////////////////////////////////////////////// @@ -146,9 +146,9 @@ public: PGET_MODULE_BASE_ROUTINE, PTRANSLATE_ADDRESS_ROUTINE); typedef BOOL (WINAPI *SymFromAddr_t)(HANDLE, DWORD64, PDWORD64, PSYMBOL_INFO); - typedef LPVOID (WINAPI *SymFunctionTableAccess_t)(HANDLE, DWORD); - typedef DWORD (WINAPI *SymGetModuleBase_t)(HANDLE, DWORD); - typedef BOOL (WINAPI *SymGetLineFromAddr_t)(HANDLE, DWORD, + typedef LPVOID (WINAPI *SymFunctionTableAccess_t)(HANDLE, DWORD_PTR); + typedef DWORD_PTR (WINAPI *SymGetModuleBase_t)(HANDLE, DWORD_PTR); + typedef BOOL (WINAPI *SymGetLineFromAddr_t)(HANDLE, DWORD_PTR, PDWORD, PIMAGEHLP_LINE); typedef BOOL (WINAPI *SymSetContext_t)(HANDLE, PIMAGEHLP_STACK_FRAME, PIMAGEHLP_CONTEXT); @@ -164,23 +164,44 @@ public: CONST PMINIDUMP_USER_STREAM_INFORMATION, CONST PMINIDUMP_CALLBACK_INFORMATION); - #define wxDO_FOR_ALL_SYM_FUNCS(what) \ - what(SymGetOptions); \ - what(SymSetOptions); \ - what(SymInitialize); \ - what(StackWalk); \ - what(SymFromAddr); \ - what(SymFunctionTableAccess); \ - what(SymGetModuleBase); \ - what(SymGetLineFromAddr); \ - what(SymSetContext); \ - what(SymEnumSymbols); \ - what(SymGetTypeInfo); \ - what(SymCleanup); \ - what(EnumerateLoadedModules); \ - what(MiniDumpWriteDump) + // The macro called by wxDO_FOR_ALL_SYM_FUNCS() below takes 2 arguments: + // the name of the function in the program code, which never has "64" + // suffix, and the name of the function in the DLL which can have "64" + // suffix in some cases. These 2 helper macros call the macro with the + // correct arguments in both cases. + #define wxSYM_CALL(what, name) what(name, name) +#if defined(_M_AMD64) + #define wxSYM_CALL_64(what, name) what(name, name ## 64) - #define wxDECLARE_SYM_FUNCTION(func) static func ## _t func + // Also undo all the "helpful" definitions done by imagehlp.h that map 32 + // bit functions to 64 bit ones, we don't need this as we do it ourselves. + #undef StackWalk + #undef SymFunctionTableAccess + #undef SymGetModuleBase + #undef SymGetLineFromAddr + #undef EnumerateLoadedModules +#else + #define wxSYM_CALL_64(what, name) what(name, name) +#endif + + #define wxDO_FOR_ALL_SYM_FUNCS(what) \ + wxSYM_CALL_64(what, StackWalk); \ + wxSYM_CALL_64(what, SymFunctionTableAccess); \ + wxSYM_CALL_64(what, SymGetModuleBase); \ + wxSYM_CALL_64(what, SymGetLineFromAddr); \ + wxSYM_CALL_64(what, EnumerateLoadedModules); \ + \ + wxSYM_CALL(what, SymGetOptions); \ + wxSYM_CALL(what, SymSetOptions); \ + wxSYM_CALL(what, SymInitialize); \ + wxSYM_CALL(what, SymFromAddr); \ + wxSYM_CALL(what, SymSetContext); \ + wxSYM_CALL(what, SymEnumSymbols); \ + wxSYM_CALL(what, SymGetTypeInfo); \ + wxSYM_CALL(what, SymCleanup); \ + wxSYM_CALL(what, MiniDumpWriteDump) + + #define wxDECLARE_SYM_FUNCTION(func, name) static func ## _t func wxDO_FOR_ALL_SYM_FUNCS(wxDECLARE_SYM_FUNCTION); diff --git a/Externals/wxWidgets3/include/wx/msw/dialog.h b/Externals/wxWidgets3/include/wx/msw/dialog.h index 9ea9a3766b..ad192925e1 100644 --- a/Externals/wxWidgets3/include/wx/msw/dialog.h +++ b/Externals/wxWidgets3/include/wx/msw/dialog.h @@ -4,7 +4,7 @@ // Author: Julian Smart // Modified by: // Created: 01/02/97 -// RCS-ID: $Id: dialog.h 60559 2009-05-09 12:26:15Z VZ $ +// RCS-ID: $Id: dialog.h 70511 2012-02-05 14:18:22Z VZ $ // Copyright: (c) Julian Smart // Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// @@ -16,7 +16,7 @@ // this option is always enabled (there doesn't seem to be any good reason to // disable it) for desktop Windows versions but Windows CE dialogs are usually -// not resizeable and never show resize gripper anyhow so don't use it there +// not resizable and never show resize gripper anyhow so don't use it there #ifdef __WXWINCE__ #define wxUSE_DIALOG_SIZEGRIP 0 #else @@ -92,9 +92,9 @@ public: // override some base class virtuals virtual bool Show(bool show = true); - virtual void Raise(); - +#if wxUSE_DIALOG_SIZEGRIP virtual void SetWindowStyleFlag(long style); +#endif // wxUSE_DIALOG_SIZEGRIP #ifdef __POCKETPC__ // Responds to the OK button in a PocketPC titlebar. This @@ -114,7 +114,7 @@ protected: private: #if wxUSE_DIALOG_SIZEGRIP // these functions deal with the gripper window shown in the corner of - // resizeable dialogs + // resizable dialogs void CreateGripper(); void DestroyGripper(); void ShowGripper(bool show); diff --git a/Externals/wxWidgets3/include/wx/msw/dragimag.h b/Externals/wxWidgets3/include/wx/msw/dragimag.h index 44dafc0025..5118833235 100644 --- a/Externals/wxWidgets3/include/wx/msw/dragimag.h +++ b/Externals/wxWidgets3/include/wx/msw/dragimag.h @@ -5,7 +5,7 @@ // Author: Julian Smart // Modified by: // Created: 08/04/99 -// RCS-ID: $Id: dragimag.h 58757 2009-02-08 11:45:59Z VZ $ +// RCS-ID: $Id: dragimag.h 70584 2012-02-15 00:35:25Z VZ $ // Copyright: (c) Julian Smart // Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// @@ -114,14 +114,6 @@ public: Create(image, cursor); } - // Deprecated form of the above - wxDragImage(const wxBitmap& image, const wxCursor& cursor, const wxPoint& cursorHotspot) - { - Init(); - - Create(image, cursor, cursorHotspot); - } - wxDragImage(const wxIcon& image, const wxCursor& cursor = wxNullCursor) { Init(); @@ -129,14 +121,6 @@ public: Create(image, cursor); } - // Deprecated form of the above - wxDragImage(const wxIcon& image, const wxCursor& cursor, const wxPoint& cursorHotspot) - { - Init(); - - Create(image, cursor, cursorHotspot); - } - wxDragImage(const wxString& str, const wxCursor& cursor = wxNullCursor) { Init(); @@ -144,14 +128,6 @@ public: Create(str, cursor); } - // Deprecated form of the above - wxDragImage(const wxString& str, const wxCursor& cursor, const wxPoint& cursorHotspot) - { - Init(); - - Create(str, cursor, cursorHotspot); - } - #if wxUSE_TREECTRL wxDragImage(const wxTreeCtrl& treeCtrl, wxTreeItemId& id) { @@ -180,27 +156,12 @@ public: // Create a drag image from a bitmap and optional cursor bool Create(const wxBitmap& image, const wxCursor& cursor = wxNullCursor); - bool Create(const wxBitmap& image, const wxCursor& cursor, const wxPoint& WXUNUSED(cursorHotspot)) - { - wxLogDebug(wxT("wxDragImage::Create: use of a cursor hotspot is now deprecated. Please omit this argument.")); - return Create(image, cursor); - } // Create a drag image from an icon and optional cursor bool Create(const wxIcon& image, const wxCursor& cursor = wxNullCursor); - bool Create(const wxIcon& image, const wxCursor& cursor, const wxPoint& WXUNUSED(cursorHotspot)) - { - wxLogDebug(wxT("wxDragImage::Create: use of a cursor hotspot is now deprecated. Please omit this argument.")); - return Create(image, cursor); - } // Create a drag image from a string and optional cursor bool Create(const wxString& str, const wxCursor& cursor = wxNullCursor); - bool Create(const wxString& str, const wxCursor& cursor, const wxPoint& WXUNUSED(cursorHotspot)) - { - wxLogDebug(wxT("wxDragImage::Create: use of a cursor hotspot is now deprecated. Please omit this argument.")); - return Create(str, cursor); - } #if wxUSE_TREECTRL // Create a drag image for the given tree control item @@ -248,6 +209,16 @@ public: WXHIMAGELIST GetCursorHIMAGELIST() const { return m_hCursorImageList; } #endif + // don't use in new code, use versions without hot spot parameter +#if WXWIN_COMPATIBILITY_2_8 + wxDEPRECATED_CONSTRUCTOR( wxDragImage(const wxBitmap& image, const wxCursor& cursor, const wxPoint& cursorHotspot) ); + wxDEPRECATED_CONSTRUCTOR( wxDragImage(const wxString& str, const wxCursor& cursor, const wxPoint& cursorHotspot) ); + wxDEPRECATED_CONSTRUCTOR( wxDragImage(const wxIcon& image, const wxCursor& cursor, const wxPoint& cursorHotspot) ); + wxDEPRECATED( bool Create(const wxBitmap& image, const wxCursor& cursor, const wxPoint& cursorHotspot) ); + wxDEPRECATED( bool Create(const wxIcon& image, const wxCursor& cursor, const wxPoint& cursorHotspot) ); + wxDEPRECATED( bool Create(const wxString& str, const wxCursor& cursor, const wxPoint& cursorHotspot) ); +#endif // WXWIN_COMPATIBILITY_2_8 + protected: WXHIMAGELIST m_hImageList; diff --git a/Externals/wxWidgets3/include/wx/msw/enhmeta.h b/Externals/wxWidgets3/include/wx/msw/enhmeta.h index 89fa8cfa18..e1168ec707 100644 --- a/Externals/wxWidgets3/include/wx/msw/enhmeta.h +++ b/Externals/wxWidgets3/include/wx/msw/enhmeta.h @@ -4,7 +4,7 @@ // Author: Vadim Zeitlin // Modified by: // Created: 13.01.00 -// RCS-ID: $Id: enhmeta.h 60843 2009-05-31 19:11:15Z VS $ +// RCS-ID: $Id: enhmeta.h 68317 2011-07-21 13:49:59Z VZ $ // Copyright: (c) 2000 Vadim Zeitlin // Licence: wxWindows licence /////////////////////////////////////////////////////////////////////////////// @@ -89,6 +89,7 @@ public: // as above, but takes reference DC as first argument to take resolution, // size, font metrics etc. from + wxEXPLICIT wxEnhMetaFileDC(const wxDC& referenceDC, const wxString& filename = wxEmptyString, int width = 0, int height = 0, diff --git a/Externals/wxWidgets3/include/wx/msw/font.h b/Externals/wxWidgets3/include/wx/msw/font.h index ef4d59f7c1..8c29e0e6dd 100644 --- a/Externals/wxWidgets3/include/wx/msw/font.h +++ b/Externals/wxWidgets3/include/wx/msw/font.h @@ -4,7 +4,7 @@ // Author: Julian Smart // Modified by: // Created: 01/02/97 -// RCS-ID: $Id: font.h 65670 2010-09-29 13:46:09Z VZ $ +// RCS-ID: $Id: font.h 70446 2012-01-23 11:28:28Z VZ $ // Copyright: (c) Julian Smart // Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// @@ -91,6 +91,12 @@ public: Create(info, hFont); } + wxFont(int pointSize, + wxFontFamily family, + int flags = wxFONTFLAG_DEFAULT, + const wxString& face = wxEmptyString, + wxFontEncoding encoding = wxFONTENCODING_DEFAULT); + wxFont(const wxString& fontDesc); @@ -117,6 +123,7 @@ public: virtual wxFontStyle GetStyle() const; virtual wxFontWeight GetWeight() const; virtual bool GetUnderlined() const; + virtual bool GetStrikethrough() const; virtual wxString GetFaceName() const; virtual wxFontEncoding GetEncoding() const; virtual const wxNativeFontInfo *GetNativeFontInfo() const; @@ -128,6 +135,7 @@ public: virtual void SetWeight(wxFontWeight weight); virtual bool SetFaceName(const wxString& faceName); virtual void SetUnderlined(bool underlined); + virtual void SetStrikethrough(bool strikethrough); virtual void SetEncoding(wxFontEncoding encoding); wxDECLARE_COMMON_FONT_METHODS(); diff --git a/Externals/wxWidgets3/include/wx/msw/frame.h b/Externals/wxWidgets3/include/wx/msw/frame.h index fa66386469..7483e1c992 100644 --- a/Externals/wxWidgets3/include/wx/msw/frame.h +++ b/Externals/wxWidgets3/include/wx/msw/frame.h @@ -4,7 +4,7 @@ // Author: Julian Smart // Modified by: // Created: 01/02/97 -// RCS-ID: $Id: frame.h 60337 2009-04-25 12:59:09Z FM $ +// RCS-ID: $Id: frame.h 70511 2012-02-05 14:18:22Z VZ $ // Copyright: (c) Julian Smart // Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// @@ -42,7 +42,6 @@ public: // implement base class pure virtuals virtual bool ShowFullScreen(bool show, long style = wxFULLSCREEN_ALL); - virtual void Raise(); // implementation only from now on // ------------------------------- @@ -79,7 +78,6 @@ public: bool HandleSize(int x, int y, WXUINT flag); bool HandleCommand(WXWORD id, WXWORD cmd, WXHWND control); bool HandleMenuSelect(WXWORD nItem, WXWORD nFlags, WXHMENU hMenu); - bool HandleMenuLoop(const wxEventType& evtType, WXWORD isPopup); // tooltip management #if wxUSE_TOOLTIPS @@ -133,8 +131,17 @@ protected: // wxMDIChildFrame bool MSWDoTranslateMessage(wxFrame *frame, WXMSG *msg); - // handle WM_INITMENUPOPUP message to generate wxEVT_MENU_OPEN - bool HandleInitMenuPopup(WXHMENU hMenu); +#if wxUSE_MENUS + // handle WM_EXITMENULOOP message for Win95 only + bool HandleExitMenuLoop(WXWORD isPopup); + + // handle WM_(UN)INITMENUPOPUP message to generate wxEVT_MENU_OPEN/CLOSE + bool HandleMenuPopup(wxEventType evtType, WXHMENU hMenu); + + // Command part of HandleMenuPopup() and HandleExitMenuLoop(). + bool DoSendMenuOpenCloseEvent(wxEventType evtType, wxMenu* menu, bool popup); +#endif // wxUSE_MENUS + virtual bool IsMDIChild() const { return false; } diff --git a/Externals/wxWidgets3/include/wx/msw/fswatcher.h b/Externals/wxWidgets3/include/wx/msw/fswatcher.h index a88d81a869..ea7ca41379 100644 --- a/Externals/wxWidgets3/include/wx/msw/fswatcher.h +++ b/Externals/wxWidgets3/include/wx/msw/fswatcher.h @@ -3,7 +3,7 @@ // Purpose: wxMSWFileSystemWatcher // Author: Bartosz Bekier // Created: 2009-05-26 -// RCS-ID: $Id: fswatcher.h 62474 2009-10-22 11:35:43Z VZ $ +// RCS-ID: $Id: fswatcher.h 67693 2011-05-03 23:31:39Z VZ $ // Copyright: (c) 2009 Bartosz Bekier // Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// @@ -23,6 +23,12 @@ public: wxMSWFileSystemWatcher(const wxFileName& path, int events = wxFSW_EVENT_ALL); + // Override the base class function to provide a much more efficient + // implementation for it using the platform native support for watching the + // entire directory trees. + virtual bool AddTree(const wxFileName& path, int events = wxFSW_EVENT_ALL, + const wxString& filter = wxEmptyString); + protected: bool Init(); }; diff --git a/Externals/wxWidgets3/include/wx/msw/helpchm.h b/Externals/wxWidgets3/include/wx/msw/helpchm.h index 711d74dfb1..d3fdc9272b 100644 --- a/Externals/wxWidgets3/include/wx/msw/helpchm.h +++ b/Externals/wxWidgets3/include/wx/msw/helpchm.h @@ -4,7 +4,7 @@ // Author: Julian Smart // Modified by: // Created: 16/04/2000 -// RCS-ID: $Id: helpchm.h 67254 2011-03-20 00:14:35Z DS $ +// RCS-ID: $Id: helpchm.h 67880 2011-06-07 14:28:55Z VZ $ // Copyright: (c) Julian Smart // Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// @@ -82,7 +82,7 @@ protected: wxString m_helpFile; - DECLARE_CLASS(wxCHMHelpController) + DECLARE_DYNAMIC_CLASS(wxCHMHelpController) }; #endif // wxUSE_MS_HTML_HELP diff --git a/Externals/wxWidgets3/include/wx/msw/helpwin.h b/Externals/wxWidgets3/include/wx/msw/helpwin.h index d209f93f83..828d2b6b4f 100644 --- a/Externals/wxWidgets3/include/wx/msw/helpwin.h +++ b/Externals/wxWidgets3/include/wx/msw/helpwin.h @@ -4,7 +4,7 @@ // Author: Julian Smart // Modified by: // Created: 04/01/98 -// RCS-ID: $Id: helpwin.h 67254 2011-03-20 00:14:35Z DS $ +// RCS-ID: $Id: helpwin.h 67882 2011-06-07 16:48:36Z VZ $ // Copyright: (c) Julian Smart // Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// @@ -20,7 +20,7 @@ class WXDLLIMPEXP_CORE wxWinHelpController: public wxHelpControllerBase { - DECLARE_CLASS(wxWinHelpController) + DECLARE_DYNAMIC_CLASS(wxWinHelpController) public: wxWinHelpController(wxWindow* parentWindow = NULL): wxHelpControllerBase(parentWindow) {} diff --git a/Externals/wxWidgets3/include/wx/msw/listctrl.h b/Externals/wxWidgets3/include/wx/msw/listctrl.h index 5b4eacae95..ff49f754bb 100644 --- a/Externals/wxWidgets3/include/wx/msw/listctrl.h +++ b/Externals/wxWidgets3/include/wx/msw/listctrl.h @@ -4,7 +4,7 @@ // Author: Julian Smart // Modified by: Agron Selimaj // Created: 01/02/97 -// RCS-ID: $Id: listctrl.h 64532 2010-06-09 13:55:48Z FM $ +// RCS-ID: $Id: listctrl.h 70282 2012-01-07 15:09:43Z VZ $ // Copyright: (c) Julian Smart // Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// @@ -16,7 +16,6 @@ #include "wx/dynarray.h" #include "wx/vector.h" -class WXDLLIMPEXP_FWD_CORE wxImageList; class wxMSWListItemData; // define this symbol to indicate the availability of SetColumnsOrder() and @@ -77,7 +76,7 @@ class wxMSWListItemData; */ -class WXDLLIMPEXP_CORE wxListCtrl: public wxControl +class WXDLLIMPEXP_CORE wxListCtrl: public wxListCtrlBase { public: /* @@ -256,12 +255,6 @@ public: void SetImageList(wxImageList *imageList, int which); void AssignImageList(wxImageList *imageList, int which); - // are we in report mode? - bool InReportView() const { return HasFlag(wxLC_REPORT); } - - // are we in virtual report mode? - bool IsVirtual() const { return HasFlag(wxLC_VIRTUAL); } - // refresh items selectively (only useful for virtual list controls) void RefreshItem(long item); void RefreshItems(long itemFrom, long itemTo); @@ -326,14 +319,6 @@ public: // Insert an image/string item long InsertItem(long index, const wxString& label, int imageIndex); - // For list view mode (only), inserts a column. - long InsertColumn(long col, const wxListItem& info); - - long InsertColumn(long col, - const wxString& heading, - int format = wxLIST_FORMAT_LEFT, - int width = -1); - // set the number of items in a virtual list control void SetItemCount(long count); @@ -399,6 +384,9 @@ protected: // common part of all ctors void Init(); + // Implement base class pure virtual methods. + long DoInsertColumn(long col, const wxListItem& info); + // free memory taken by all internal data void FreeAllInternalData(); @@ -466,6 +454,10 @@ private: // destroy m_textCtrl if it's currently valid and reset it to NULL void DeleteEditControl(); + // Intercept Escape and Enter keys to avoid them being stolen from our + // in-place editor control. + void OnCharHook(wxKeyEvent& event); + DECLARE_DYNAMIC_CLASS(wxListCtrl) DECLARE_EVENT_TABLE() diff --git a/Externals/wxWidgets3/include/wx/msw/menu.h b/Externals/wxWidgets3/include/wx/msw/menu.h index e5cc5d0142..53bea80f91 100644 --- a/Externals/wxWidgets3/include/wx/msw/menu.h +++ b/Externals/wxWidgets3/include/wx/msw/menu.h @@ -4,7 +4,7 @@ // Author: Julian Smart // Modified by: Vadim Zeitlin (wxMenuItem is now in separate file) // Created: 01/02/97 -// RCS-ID: $Id: menu.h 66178 2010-11-17 01:20:50Z VZ $ +// RCS-ID: $Id: menu.h 70350 2012-01-15 13:41:17Z VZ $ // Copyright: (c) Julian Smart // Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// @@ -25,6 +25,7 @@ class WXDLLIMPEXP_FWD_CORE wxFrame; class WXDLLIMPEXP_FWD_CORE wxToolBar; #endif +class wxMenuRadioItemsData; // Not using a combined wxToolBar/wxMenuBar? then use // a commandbar in WinCE .NET to implement the @@ -60,16 +61,27 @@ public: virtual void SetTitle(const wxString& title); + // MSW-only methods + // ---------------- + + // Create a new menu from the given native HMENU. Takes ownership of the + // menu handle and will delete it when this object is destroyed. + static wxMenu *MSWNewFromHMENU(WXHMENU hMenu) { return new wxMenu(hMenu); } + + // implementation only from now on // ------------------------------- - virtual void Attach(wxMenuBarBase *menubar); - bool MSWCommand(WXUINT param, WXWORD id); // get the native menu handle WXHMENU GetHMenu() const { return m_hMenu; } + // Return the start and end position of the radio group to which the item + // at the given position belongs. Returns false if there is no radio group + // containing this position. + bool MSWGetRadioGroupRange(int pos, int *start, int *end) const; + #if wxUSE_ACCEL // called by wxMenuBar to build its accel table from the accels of all menus bool HasAccels() const { return !m_accels.empty(); } @@ -102,6 +114,9 @@ public: m_maxAccelWidth = -1; } + // get the menu with given handle (recursively) + wxMenu* MSWGetMenu(WXHMENU hMenu); + private: void CalculateMaxAccelWidth(); @@ -113,21 +128,30 @@ protected: virtual wxMenuItem* DoRemove(wxMenuItem *item); private: - // common part of all ctors + // This constructor is private, use MSWNewFromHMENU() to use it. + wxMenu(WXHMENU hMenu); + + // Common part of all ctors, it doesn't create a new HMENU. + void InitNoCreate(); + + // Common part of all ctors except of the one above taking a native menu + // handler: calls InitNoCreate() and also creates a new menu. void Init(); // common part of Append/Insert (behaves as Append is pos == (size_t)-1) bool DoInsertOrAppend(wxMenuItem *item, size_t pos = (size_t)-1); - // terminate the current radio group, if any - void EndRadioGroup(); + + // This variable contains the description of the radio item groups and + // allows to find whether an item at the given position is part of the + // group and also where its group starts and ends. + // + // It is initially NULL and only allocated if we have any radio items. + wxMenuRadioItemsData *m_radioData; // if true, insert a breal before appending the next item bool m_doBreak; - // the position of the first item in the current radio group or -1 - int m_startRadioGroup; - // the menu handle of this menu WXHMENU m_hMenu; @@ -173,6 +197,7 @@ public: virtual wxMenu *Remove(size_t pos); virtual void EnableTop( size_t pos, bool flag ); + virtual bool IsEnabledTop(size_t pos) const; virtual void SetMenuLabel( size_t pos, const wxString& label ); virtual wxString GetMenuLabel( size_t pos ) const; @@ -208,6 +233,9 @@ public: void Refresh( bool eraseBackground, const wxRect *rect = (const wxRect *) NULL ) { wxWindow::Refresh(eraseBackground, rect); } + // get the menu with given handle (recursively) + wxMenu* MSWGetMenu(WXHMENU hMenu); + protected: // common part of all ctors void Init(); diff --git a/Externals/wxWidgets3/include/wx/msw/menuitem.h b/Externals/wxWidgets3/include/wx/msw/menuitem.h index 8cf0698c63..1ccc75bdea 100644 --- a/Externals/wxWidgets3/include/wx/msw/menuitem.h +++ b/Externals/wxWidgets3/include/wx/msw/menuitem.h @@ -4,7 +4,7 @@ // Author: Vadim Zeitlin // Modified by: // Created: 11.11.97 -// RCS-ID: $Id: menuitem.h 67254 2011-03-20 00:14:35Z DS $ +// RCS-ID: $Id: menuitem.h 70801 2012-03-04 00:29:55Z VZ $ // Copyright: (c) 1998 Vadim Zeitlin // Licence: wxWindows licence /////////////////////////////////////////////////////////////////////////////// @@ -61,11 +61,6 @@ public: // Win32 API WXWPARAM GetMSWId() const; - // mark item as belonging to the given radio group - void SetAsRadioGroupStart(); - void SetRadioGroupStart(int start); - void SetRadioGroupEnd(int end); - #if WXWIN_COMPATIBILITY_2_8 // compatibility only, don't use in new code wxDEPRECATED( @@ -124,24 +119,21 @@ private: // helper function for draw std menu check mark void DrawStdCheckMark(WXHDC hdc, const tagRECT* rc, wxODStatus stat); -#endif // wxUSE_OWNER_DRAWN +#else // !wxUSE_OWNER_DRAWN + // Provide stubs for the public functions above to ensure that the code + // still compiles without wxUSE_OWNER_DRAWN -- it makes sense to just drop + // the bitmaps then instead of failing compilation. + void SetBitmaps(const wxBitmap& WXUNUSED(bmpChecked), + const wxBitmap& WXUNUSED(bmpUnchecked) = wxNullBitmap) { } + void SetBitmap(const wxBitmap& WXUNUSED(bmp), + bool WXUNUSED(bChecked) = true) { } + const wxBitmap& GetBitmap() const { return wxNullBitmap; } +#endif // wxUSE_OWNER_DRAWN/!wxUSE_OWNER_DRAWN private: // common part of all ctors void Init(); - // the positions of the first and last items of the radio group this item - // belongs to or -1: start is the radio group start and is valid for all - // but first radio group items (m_isRadioGroupStart == false), end is valid - // only for the first one - union - { - int start; - int end; - } m_radioGroup; - - // does this item start a radio group? - bool m_isRadioGroupStart; #if wxUSE_OWNER_DRAWN // item bitmaps diff --git a/Externals/wxWidgets3/include/wx/msw/missing.h b/Externals/wxWidgets3/include/wx/msw/missing.h index 0888d1322e..34184c596d 100644 --- a/Externals/wxWidgets3/include/wx/msw/missing.h +++ b/Externals/wxWidgets3/include/wx/msw/missing.h @@ -3,7 +3,7 @@ // Purpose: Declarations for parts of the Win32 SDK that are missing in // the versions that come with some compilers // Created: 2002/04/23 -// RCS-ID: $Id: missing.h 66996 2011-02-22 13:26:06Z VZ $ +// RCS-ID: $Id: missing.h 69844 2011-11-27 19:50:53Z VZ $ // Copyright: (c) 2002 Mattia Barbon // Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// @@ -94,6 +94,7 @@ #define VK_OEM_5 0xDC #define VK_OEM_6 0xDD #define VK_OEM_7 0xDE + #define VK_OEM_102 0xE2 #endif #ifndef VK_OEM_COMMA @@ -514,6 +515,152 @@ typedef struct #endif +#endif + +//Various defines that will be needed by mingw and possibly VC++6 +//Used by the webview library + +#ifndef DISPID_COMMANDSTATECHANGE +#define DISPID_COMMANDSTATECHANGE 105 +#endif + +#ifndef DISPID_NAVIGATECOMPLETE2 +#define DISPID_NAVIGATECOMPLETE2 252 +#endif + +#ifndef DISPID_NAVIGATEERROR +#define DISPID_NAVIGATEERROR 271 +#endif + +#ifndef DISPID_NEWWINDOW3 +#define DISPID_NEWWINDOW3 273 +#endif + +#ifndef INET_E_ERROR_FIRST +#define INET_E_ERROR_FIRST 0x800C0002L +#endif + +#ifndef INET_E_INVALID_URL +#define INET_E_INVALID_URL 0x800C0002L +#endif + +#ifndef INET_E_NO_SESSION +#define INET_E_NO_SESSION 0x800C0003L +#endif + +#ifndef INET_E_CANNOT_CONNECT +#define INET_E_CANNOT_CONNECT 0x800C0004L +#endif + +#ifndef INET_E_RESOURCE_NOT_FOUND +#define INET_E_RESOURCE_NOT_FOUND 0x800C0005L +#endif + +#ifndef INET_E_OBJECT_NOT_FOUND +#define INET_E_OBJECT_NOT_FOUND 0x800C0006L +#endif + +#ifndef INET_E_DATA_NOT_AVAILABLE +#define INET_E_DATA_NOT_AVAILABLE 0x800C0007L +#endif + +#ifndef INET_E_DOWNLOAD_FAILURE +#define INET_E_DOWNLOAD_FAILURE 0x800C0008L +#endif + +#ifndef INET_E_AUTHENTICATION_REQUIRED +#define INET_E_AUTHENTICATION_REQUIRED 0x800C0009L +#endif + +#ifndef INET_E_NO_VALID_MEDIA +#define INET_E_NO_VALID_MEDIA 0x800C000AL +#endif + +#ifndef INET_E_CONNECTION_TIMEOUT +#define INET_E_CONNECTION_TIMEOUT 0x800C000BL +#endif + +#ifndef INET_E_INVALID_REQUEST +#define INET_E_INVALID_REQUEST 0x800C000CL +#endif + +#ifndef INET_E_UNKNOWN_PROTOCOL +#define INET_E_UNKNOWN_PROTOCOL 0x800C000DL +#endif + +#ifndef INET_E_SECURITY_PROBLEM +#define INET_E_SECURITY_PROBLEM 0x800C000EL +#endif + +#ifndef INET_E_CANNOT_LOAD_DATA +#define INET_E_CANNOT_LOAD_DATA 0x800C000FL +#endif + +#ifndef INET_E_CANNOT_INSTANTIATE_OBJECT +#define INET_E_CANNOT_INSTANTIATE_OBJECT 0x800C0010L +#endif + +#ifndef INET_E_QUERYOPTION_UNKNOWN +#define INET_E_QUERYOPTION_UNKNOWN 0x800C0013L +#endif + +#ifndef INET_E_REDIRECT_FAILED +#define INET_E_REDIRECT_FAILED 0x800C0014L +#endif + +#ifndef INET_E_REDIRECT_TO_DIR +#define INET_E_REDIRECT_TO_DIR 0x800C0015L +#endif + +#ifndef INET_E_CANNOT_LOCK_REQUEST +#define INET_E_CANNOT_LOCK_REQUEST 0x800C0016L +#endif + +#ifndef INET_E_USE_EXTEND_BINDING +#define INET_E_USE_EXTEND_BINDING 0x800C0017L +#endif + +#ifndef INET_E_TERMINATED_BIND +#define INET_E_TERMINATED_BIND 0x800C0018L +#endif + +#ifndef INET_E_INVALID_CERTIFICATE +#define INET_E_INVALID_CERTIFICATE 0x800C0019L +#endif + +#ifndef INET_E_CODE_DOWNLOAD_DECLINED +#define INET_E_CODE_DOWNLOAD_DECLINED 0x800C0100L +#endif + +#ifndef INET_E_RESULT_DISPATCHED +#define INET_E_RESULT_DISPATCHED 0x800C0200L +#endif + +#ifndef INET_E_CANNOT_REPLACE_SFP_FILE +#define INET_E_CANNOT_REPLACE_SFP_FILE 0x800C0300L +#endif + +#ifndef INET_E_CODE_INSTALL_BLOCKED_BY_HASH_POLICY +#define INET_E_CODE_INSTALL_BLOCKED_BY_HASH_POLICY 0x800C0500L +#endif + +#ifndef INET_E_CODE_INSTALL_SUPPRESSED +#define INET_E_CODE_INSTALL_SUPPRESSED 0x800C0400L +#endif + +//We need to check if we are using MinGW or mingw-w64 as their +//definitions are different + +#ifdef __MINGW32__ +#include <_mingw.h> +#endif + +#if defined(__MINGW32__) && !defined(__MINGW64_VERSION_MAJOR) +typedef enum CommandStateChangeConstants { + CSC_UPDATECOMMANDS = (int) 0xFFFFFFFF, + CSC_NAVIGATEFORWARD = 0x1, + CSC_NAVIGATEBACK = 0x2 +} CommandStateChangeConstants; #endif /* diff --git a/Externals/wxWidgets3/include/wx/msw/nonownedwnd.h b/Externals/wxWidgets3/include/wx/msw/nonownedwnd.h new file mode 100644 index 0000000000..789a836aea --- /dev/null +++ b/Externals/wxWidgets3/include/wx/msw/nonownedwnd.h @@ -0,0 +1,39 @@ +/////////////////////////////////////////////////////////////////////////////// +// Name: wx/msw/nonownedwnd.h +// Purpose: wxNonOwnedWindow declaration for wxMSW. +// Author: Vadim Zeitlin +// Created: 2011-10-09 +// RCS-ID: $Id: nonownedwnd.h 69462 2011-10-18 21:56:52Z VZ $ +// Copyright: (c) 2011 Vadim Zeitlin +// Licence: wxWindows licence +/////////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_MSW_NONOWNEDWND_H_ +#define _WX_MSW_NONOWNEDWND_H_ + +class wxNonOwnedWindowShapeImpl; + +// ---------------------------------------------------------------------------- +// wxNonOwnedWindow +// ---------------------------------------------------------------------------- + +class WXDLLIMPEXP_CORE wxNonOwnedWindow : public wxNonOwnedWindowBase +{ +public: + wxNonOwnedWindow(); + virtual ~wxNonOwnedWindow(); + +protected: + virtual bool DoClearShape(); + virtual bool DoSetRegionShape(const wxRegion& region); +#if wxUSE_GRAPHICS_CONTEXT + virtual bool DoSetPathShape(const wxGraphicsPath& path); + +private: + wxNonOwnedWindowShapeImpl* m_shapeImpl; +#endif // wxUSE_GRAPHICS_CONTEXT + + wxDECLARE_NO_COPY_CLASS(wxNonOwnedWindow); +}; + +#endif // _WX_MSW_NONOWNEDWND_H_ diff --git a/Externals/wxWidgets3/include/wx/msw/notebook.h b/Externals/wxWidgets3/include/wx/msw/notebook.h index 644231a4d6..bfed8f9794 100644 --- a/Externals/wxWidgets3/include/wx/msw/notebook.h +++ b/Externals/wxWidgets3/include/wx/msw/notebook.h @@ -3,7 +3,7 @@ // Purpose: MSW/GTK compatible notebook (a.k.a. property sheet) // Author: Robert Roebling // Modified by: Vadim Zeitlin for Windows version -// RCS-ID: $Id: notebook.h 67250 2011-03-20 00:00:29Z VZ $ +// RCS-ID: $Id: notebook.h 69793 2011-11-22 13:18:45Z VZ $ // Copyright: (c) Julian Smart // Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// @@ -96,7 +96,7 @@ public: wxNotebookPage *pPage, const wxString& strText, bool bSelect = false, - int imageId = -1); + int imageId = NO_IMAGE); // Windows-only at present. Also, you must use the wxNB_FIXEDWIDTH // style. @@ -194,6 +194,9 @@ protected: // true if we have already subclassed our updown control bool m_hasSubclassedUpdown; + + // true if we already refreshed the current page after showing the window + bool m_doneUpdateHack; #endif // __WXWINCE__ #if wxUSE_UXTHEME diff --git a/Externals/wxWidgets3/include/wx/msw/ole/activex.h b/Externals/wxWidgets3/include/wx/msw/ole/activex.h index a0047ae0cc..2acd893ace 100644 --- a/Externals/wxWidgets3/include/wx/msw/ole/activex.h +++ b/Externals/wxWidgets3/include/wx/msw/ole/activex.h @@ -4,7 +4,7 @@ // Author: Ryan Norton // Modified by: // Created: 8/18/05 -// RCS-ID: $Id: activex.h 64533 2010-06-09 14:28:08Z FM $ +// RCS-ID: $Id: activex.h 70361 2012-01-15 19:05:34Z SJL $ // Copyright: (c) Ryan Norton // Licence: wxWindows licence /////////////////////////////////////////////////////////////////////////////// @@ -168,6 +168,8 @@ public: void OnPaint(wxPaintEvent&); void OnSetFocus(wxFocusEvent&); void OnKillFocus(wxFocusEvent&); + virtual bool MSWTranslateMessage(WXMSG* pMsg); + virtual bool QueryClientSiteInterface(REFIID iid, void **_interface, const char *&desc); protected: friend class FrameSite; diff --git a/Externals/wxWidgets3/include/wx/msw/ole/oleutils.h b/Externals/wxWidgets3/include/wx/msw/ole/oleutils.h index f52e1a294d..dffb3b266e 100644 --- a/Externals/wxWidgets3/include/wx/msw/ole/oleutils.h +++ b/Externals/wxWidgets3/include/wx/msw/ole/oleutils.h @@ -4,7 +4,7 @@ // Author: Vadim Zeitlin // Modified by: // Created: 19.02.1998 -// RCS-ID: $Id: oleutils.h 67254 2011-03-20 00:14:35Z DS $ +// RCS-ID: $Id: oleutils.h 70162 2011-12-29 11:26:05Z SN $ // Copyright: (c) 1998 Vadim Zeitlin // Licence: wxWindows licence /////////////////////////////////////////////////////////////////////////////// @@ -82,7 +82,7 @@ inline void ReleaseInterface(IUnknown *pIUnk) #define RELEASE_AND_NULL(p) if ( (p) != NULL ) { p->Release(); p = NULL; }; // return true if the iid is in the array -extern bool IsIidFromList(REFIID riid, const IID *aIids[], size_t nCount); +extern WXDLLIMPEXP_CORE bool IsIidFromList(REFIID riid, const IID *aIids[], size_t nCount); // ============================================================================ // IUnknown implementation helpers @@ -140,9 +140,10 @@ private: wxAutoULong m_cRef // macros for declaring supported interfaces -// NB: you should write ADD_INTERFACE(Foo) and not ADD_INTERFACE(IID_IFoo)! +// NB: ADD_IID prepends IID_I whereas ADD_RAW_IID does not #define BEGIN_IID_TABLE(cname) const IID *cname::ms_aIids[] = { #define ADD_IID(iid) &IID_I##iid, +#define ADD_RAW_IID(iid) &iid, #define END_IID_TABLE } // implementation is as straightforward as possible @@ -197,11 +198,11 @@ private: // ---------------------------------------------------------------------------- // tries to translate riid into a symbolic name, if possible -void wxLogQueryInterface(const wxChar *szInterface, REFIID riid); +WXDLLIMPEXP_CORE void wxLogQueryInterface(const wxChar *szInterface, REFIID riid); // these functions print out the new value of reference counter -void wxLogAddRef (const wxChar *szInterface, ULONG cRef); -void wxLogRelease(const wxChar *szInterface, ULONG cRef); +WXDLLIMPEXP_CORE void wxLogAddRef (const wxChar *szInterface, ULONG cRef); +WXDLLIMPEXP_CORE void wxLogRelease(const wxChar *szInterface, ULONG cRef); #else //!__WXDEBUG__ #define wxLogQueryInterface(szInterface, riid) diff --git a/Externals/wxWidgets3/include/wx/msw/palette.h b/Externals/wxWidgets3/include/wx/msw/palette.h index b6e737a8a8..35560e6012 100644 --- a/Externals/wxWidgets3/include/wx/msw/palette.h +++ b/Externals/wxWidgets3/include/wx/msw/palette.h @@ -4,7 +4,7 @@ // Author: Julian Smart // Modified by: // Created: 01/02/97 -// RCS-ID: $Id: palette.h 52834 2008-03-26 15:06:00Z FM $ +// RCS-ID: $Id: palette.h 70040 2011-12-17 23:52:47Z VZ $ // Copyright: (c) Julian Smart // Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// @@ -19,13 +19,13 @@ class WXDLLIMPEXP_CORE wxPalette : public wxPaletteBase public: wxPalette() { } wxPalette(int n, - unsigned char *red, unsigned char *green, unsigned char *blue) + const unsigned char *red, const unsigned char *green, const unsigned char *blue) { Create(n, red, green, blue); } bool Create(int n, - unsigned char *red, unsigned char *green, unsigned char *blue); + const unsigned char *red, const unsigned char *green, const unsigned char *blue); virtual int GetColoursCount() const; diff --git a/Externals/wxWidgets3/include/wx/msw/panel.h b/Externals/wxWidgets3/include/wx/msw/panel.h index 6007a6010b..9a2ab283c1 100644 --- a/Externals/wxWidgets3/include/wx/msw/panel.h +++ b/Externals/wxWidgets3/include/wx/msw/panel.h @@ -3,7 +3,7 @@ // Purpose: wxMSW-specific wxPanel class. // Author: Vadim Zeitlin // Created: 2011-03-18 -// RCS-ID: $Id: panel.h 67253 2011-03-20 00:00:49Z VZ $ +// RCS-ID: $Id: panel.h 70098 2011-12-23 05:59:59Z PC $ // Copyright: (c) 2011 Vadim Zeitlin // Licence: wxWindows licence /////////////////////////////////////////////////////////////////////////////// @@ -20,7 +20,7 @@ class WXDLLIMPEXP_FWD_CORE wxBrush; class WXDLLIMPEXP_CORE wxPanel : public wxPanelBase { public: - wxPanel() { Init(); } + wxPanel() { } wxPanel(wxWindow *parent, wxWindowID winid = wxID_ANY, @@ -29,8 +29,6 @@ public: long style = wxTAB_TRAVERSAL | wxNO_BORDER, const wxString& name = wxPanelNameStr) { - Init(); - Create(parent, winid, pos, size, style, name); } @@ -40,7 +38,7 @@ public: virtual bool HasTransparentBackground(); -#ifdef WXWIN_COMPATIBILITY_2_8 +#if WXWIN_COMPATIBILITY_2_8 wxDEPRECATED_CONSTRUCTOR( wxPanel(wxWindow *parent, int x, int y, int width, int height, @@ -52,18 +50,7 @@ public: ) #endif // WXWIN_COMPATIBILITY_2_8 -protected: - void Init() - { - m_backgroundBrush = NULL; - } - - virtual void DoSetBackgroundBitmap(const wxBitmap& bmp); - virtual WXHBRUSH MSWGetCustomBgBrush(); - private: - wxBrush *m_backgroundBrush; - wxDECLARE_DYNAMIC_CLASS_NO_COPY(wxPanel); }; diff --git a/Externals/wxWidgets3/include/wx/msw/printdlg.h b/Externals/wxWidgets3/include/wx/msw/printdlg.h index f656e75720..a8362bdd06 100644 --- a/Externals/wxWidgets3/include/wx/msw/printdlg.h +++ b/Externals/wxWidgets3/include/wx/msw/printdlg.h @@ -4,7 +4,7 @@ // Author: Julian Smart // Modified by: // Created: 01/02/97 -// RCS-ID: $Id: printdlg.h 67254 2011-03-20 00:14:35Z DS $ +// RCS-ID: $Id: printdlg.h 70636 2012-02-20 21:55:55Z VZ $ // Copyright: (c) Julian Smart // Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// @@ -20,6 +20,7 @@ #include "wx/printdlg.h" class WXDLLIMPEXP_FWD_CORE wxDC; +class WinPrinter; //---------------------------------------------------------------------------- // wxWindowsPrintNativeData @@ -37,6 +38,7 @@ public: virtual bool Ok() const { return IsOk(); } virtual bool IsOk() const; + void InitializeDevMode(const wxString &printerName = wxEmptyString, WinPrinter* printer = NULL); void* GetDevMode() const { return m_devMode; } void SetDevMode(void* data) { m_devMode = data; } void* GetDevNames() const { return m_devNames; } @@ -105,7 +107,7 @@ public: bool ConvertToNative( wxPageSetupDialogData &data ); bool ConvertFromNative( wxPageSetupDialogData &data ); - virtual wxPageSetupData& GetPageSetupDialogData() { return m_pageSetupData; } + virtual wxPageSetupDialogData& GetPageSetupDialogData() { return m_pageSetupData; } private: wxPageSetupDialogData m_pageSetupData; diff --git a/Externals/wxWidgets3/include/wx/msw/private.h b/Externals/wxWidgets3/include/wx/msw/private.h index 45217c0aae..75f5c65382 100644 --- a/Externals/wxWidgets3/include/wx/msw/private.h +++ b/Externals/wxWidgets3/include/wx/msw/private.h @@ -6,7 +6,7 @@ // Author: Julian Smart // Modified by: // Created: 01/02/97 -// RCS-ID: $Id: private.h 65958 2010-10-30 23:50:45Z VZ $ +// RCS-ID: $Id: private.h 69758 2011-11-14 12:51:53Z VZ $ // Copyright: (c) Julian Smart // Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// @@ -454,7 +454,7 @@ private: void DoInit(HGDIOBJ hgdiobj) { m_hgdiobj = ::SelectObject(m_hdc, hgdiobj); } public: - SelectInHDC() : m_hdc(NULL) { } + SelectInHDC() : m_hdc(NULL), m_hgdiobj(NULL) { } SelectInHDC(HDC hdc, HGDIOBJ hgdiobj) : m_hdc(hdc) { DoInit(hgdiobj); } void Init(HDC hdc, HGDIOBJ hgdiobj) @@ -923,6 +923,9 @@ WXDLLIMPEXP_BASE wxWinVersion wxGetWinVersion(); extern HCURSOR wxGetCurrentBusyCursor(); // from msw/utils.cpp extern const wxCursor *wxGetGlobalCursor(); // from msw/cursor.cpp +// GetCursorPos can fail without populating the POINT. This falls back to GetMessagePos. +WXDLLIMPEXP_CORE void wxGetCursorPosMSW(POINT* pt); + WXDLLIMPEXP_CORE void wxGetCharSize(WXHWND wnd, int *x, int *y, const wxFont& the_font); WXDLLIMPEXP_CORE void wxFillLogFont(LOGFONT *logFont, const wxFont *font); WXDLLIMPEXP_CORE wxFont wxCreateFontFromLogFont(const LOGFONT *logFont); diff --git a/Externals/wxWidgets3/include/wx/msw/private/button.h b/Externals/wxWidgets3/include/wx/msw/private/button.h index 8f16b885c3..c45bcf167a 100644 --- a/Externals/wxWidgets3/include/wx/msw/private/button.h +++ b/Externals/wxWidgets3/include/wx/msw/private/button.h @@ -3,7 +3,7 @@ // Purpose: helper functions used with native BUTTON control // Author: Vadim Zeitlin // Created: 2008-06-07 -// RCS-ID: $Id: button.h 67254 2011-03-20 00:14:35Z DS $ +// RCS-ID: $Id: button.h 68922 2011-08-27 14:11:28Z VZ $ // Copyright: (c) 2008 Vadim Zeitlin // Licence: wxWindows licence /////////////////////////////////////////////////////////////////////////////// @@ -44,7 +44,8 @@ void UpdateMultilineStyle(HWND hwnd, const wxString& label); // flags for ComputeBestSize() and GetFittingSize() enum { - Size_AuthNeeded = 1 + Size_AuthNeeded = 1, + Size_ExactFit = 2 }; // NB: All the functions below are implemented in src/msw/button.cpp diff --git a/Externals/wxWidgets3/include/wx/msw/private/fswatcher.h b/Externals/wxWidgets3/include/wx/msw/private/fswatcher.h index d03d4db8ca..f5ef3bbd38 100644 --- a/Externals/wxWidgets3/include/wx/msw/private/fswatcher.h +++ b/Externals/wxWidgets3/include/wx/msw/private/fswatcher.h @@ -3,7 +3,7 @@ // Purpose: File system watcher impl classes // Author: Bartosz Bekier // Created: 2009-05-26 -// RCS-ID: $Id: fswatcher.h 62678 2009-11-18 09:56:52Z VZ $ +// RCS-ID: $Id: fswatcher.h 67806 2011-05-28 19:35:13Z VZ $ // Copyright: (c) 2009 Bartosz Bekier // Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// @@ -50,7 +50,7 @@ public: m_path); } } - delete m_overlapped; + free(m_overlapped); } bool IsOk() const @@ -104,7 +104,6 @@ private: wxDECLARE_NO_COPY_CLASS(wxFSWatchEntryMSW); }; - // ============================================================================ // wxFSWatcherImplMSW helper classes implementations // ============================================================================ @@ -156,6 +155,48 @@ public: return m_watches.insert(val).second; } + // Removes a watch we're currently using. Notice that this doesn't happen + // immediately, CompleteRemoval() must be called later when it's really + // safe to delete the watch, i.e. after completion of the IO operation + // using it. + bool ScheduleForRemoval(const wxSharedPtr& watch) + { + wxCHECK_MSG( m_iocp != INVALID_HANDLE_VALUE, false, "IOCP not init" ); + wxCHECK_MSG( watch->IsOk(), false, "Invalid watch" ); + + const wxString path = watch->GetPath(); + wxFSWatchEntries::iterator it = m_watches.find(path); + wxCHECK_MSG( it != m_watches.end(), false, + "Can't remove a watch we don't use" ); + + // We can't just delete the watch here as we can have pending events + // for it and if we destroyed it now, we could get a dangling (or, + // worse, reused to point to another object) pointer in ReadEvents() so + // just remember that this one should be removed when CompleteRemoval() + // is called later. + m_removedWatches.insert(wxFSWatchEntries::value_type(path, watch)); + m_watches.erase(it); + + return true; + } + + // Really remove the watch previously passed to ScheduleForRemoval(). + // + // It's ok to call this for a watch that hadn't been removed before, in + // this case we'll just return false and do nothing. + bool CompleteRemoval(wxFSWatchEntryMSW* watch) + { + wxFSWatchEntries::iterator it = m_removedWatches.find(watch->GetPath()); + if ( it == m_removedWatches.end() ) + return false; + + // Removing the object from the map will result in deleting the watch + // itself as it's not referenced from anywhere else now. + m_removedWatches.erase(it); + + return true; + } + // post completion packet bool PostEmptyStatus() { @@ -203,7 +244,13 @@ protected: } HANDLE m_iocp; + + // The hash containing all the wxFSWatchEntryMSW objects currently being + // watched keyed by their paths. wxFSWatchEntries m_watches; + + // Contains the watches which had been removed but are still pending. + wxFSWatchEntries m_removedWatches; }; diff --git a/Externals/wxWidgets3/include/wx/msw/private/hiddenwin.h b/Externals/wxWidgets3/include/wx/msw/private/hiddenwin.h new file mode 100644 index 0000000000..7f592e2e2e --- /dev/null +++ b/Externals/wxWidgets3/include/wx/msw/private/hiddenwin.h @@ -0,0 +1,31 @@ +/////////////////////////////////////////////////////////////////////////////// +// Name: wx/msw/private/hiddenwin.h +// Purpose: Helper for creating a hidden window used by wxMSW internally. +// Author: Vadim Zeitlin +// Created: 2011-09-16 +// RCS-ID: $Id: hiddenwin.h 69170 2011-09-21 15:07:32Z VZ $ +// Copyright: (c) 2011 Vadim Zeitlin +// Licence: wxWindows licence +/////////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_MSW_PRIVATE_HIDDENWIN_H_ +#define _WX_MSW_PRIVATE_HIDDENWIN_H_ + +#include "wx/msw/private.h" + +/* + Creates a hidden window with supplied window proc registering the class for + it if necessary (i.e. the first time only). Caller is responsible for + destroying the window and unregistering the class (note that this must be + done because wxWidgets may be used as a DLL and so may be loaded/unloaded + multiple times into/from the same process so we can't rely on automatic + Windows class unregistration). + + pclassname is a pointer to a caller stored classname, which must initially be + NULL. classname is the desired wndclass classname. If function successfully + registers the class, pclassname will be set to classname. + */ +extern "C" WXDLLIMPEXP_BASE HWND +wxCreateHiddenWindow(LPCTSTR *pclassname, LPCTSTR classname, WNDPROC wndproc); + +#endif // _WX_MSW_PRIVATE_HIDDENWIN_H_ diff --git a/Externals/wxWidgets3/include/wx/msw/private/msgdlg.h b/Externals/wxWidgets3/include/wx/msw/private/msgdlg.h index 339b2f5528..9598f7fc11 100644 --- a/Externals/wxWidgets3/include/wx/msw/private/msgdlg.h +++ b/Externals/wxWidgets3/include/wx/msw/private/msgdlg.h @@ -3,7 +3,7 @@ // Purpose: helper functions used with native message dialog // Author: Rickard Westerlund // Created: 2010-07-12 -// RCS-ID: $Id: msgdlg.h 65348 2010-08-18 22:48:28Z VZ $ +// RCS-ID: $Id: msgdlg.h 68537 2011-08-04 22:53:42Z VZ $ // Copyright: (c) 2010 wxWidgets team // Licence: wxWindows licence /////////////////////////////////////////////////////////////////////////////// @@ -19,7 +19,10 @@ // by the task dialogs only. Also notice that task dialogs are available for // Unicode applications only. #if defined(TD_WARNING_ICON) && wxUSE_UNICODE - #define wxHAS_MSW_TASKDIALOG +// (shuffle2) This is turned off because as of wxW svn r70933, +// there is a bug with the wxPD_AUTO_HIDE style which can cause a non-dolphin +// window to come to the foreground after auto-closing of the TaskDialog. +// #define wxHAS_MSW_TASKDIALOG #endif // Provides methods for creating a task dialog. @@ -30,8 +33,10 @@ namespace wxMSWMessageDialog class wxMSWTaskDialogConfig { public: + enum { MAX_BUTTONS = 4 }; + wxMSWTaskDialogConfig() - : buttons(new TASKDIALOG_BUTTON[3]), + : buttons(new TASKDIALOG_BUTTON[MAX_BUTTONS]), parent(NULL), iconId(0), style(0), @@ -53,6 +58,7 @@ namespace wxMSWMessageDialog wxString btnNoLabel; wxString btnOKLabel; wxString btnCancelLabel; + wxString btnHelpLabel; // Will create a task dialog with it's paremeters for it's creation // stored in the provided TASKDIALOGCONFIG parameter. diff --git a/Externals/wxWidgets3/include/wx/msw/private/timer.h b/Externals/wxWidgets3/include/wx/msw/private/timer.h index 145995f9dc..c45ba1df7e 100644 --- a/Externals/wxWidgets3/include/wx/msw/private/timer.h +++ b/Externals/wxWidgets3/include/wx/msw/private/timer.h @@ -3,7 +3,7 @@ // Purpose: wxTimer class // Author: Julian Smart // Created: 01/02/97 -// RCS-ID: $Id: timer.h 63486 2010-02-15 17:34:21Z RD $ +// RCS-ID: $Id: timer.h 70165 2011-12-29 14:42:13Z SN $ // Copyright: (c) Julian Smart // Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// @@ -19,7 +19,7 @@ class WXDLLIMPEXP_BASE wxMSWTimerImpl : public wxTimerImpl { public: - wxMSWTimerImpl(wxTimer *timer) : wxTimerImpl(timer) { m_id = 0; }; + wxMSWTimerImpl(wxTimer *timer) : wxTimerImpl(timer) { m_id = 0; } virtual bool Start(int milliseconds = -1, bool oneShot = false); virtual void Stop(); diff --git a/Externals/wxWidgets3/include/wx/msw/progdlg.h b/Externals/wxWidgets3/include/wx/msw/progdlg.h index 3c1f69407b..096c89a94d 100644 --- a/Externals/wxWidgets3/include/wx/msw/progdlg.h +++ b/Externals/wxWidgets3/include/wx/msw/progdlg.h @@ -3,7 +3,7 @@ // Purpose: wxProgressDialog // Author: Rickard Westerlund // Created: 2010-07-22 -// RCS-ID: $Id: progdlg.h 65574 2010-09-20 13:11:03Z VZ $ +// RCS-ID: $Id: progdlg.h 69041 2011-09-10 03:26:37Z RD $ // Copyright: (c) 2010 wxWidgets team // Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// @@ -47,6 +47,8 @@ public: // Must provide overload to avoid hiding it (and warnings about it) virtual void Update() { wxGenericProgressDialog::Update(); } + virtual WXWidget GetHandle() const; + private: // Performs common routines to Update() and Pulse(). Requires the // shared object to have been entered. diff --git a/Externals/wxWidgets3/include/wx/msw/radiobox.h b/Externals/wxWidgets3/include/wx/msw/radiobox.h index 589bcdc462..4caefafb8f 100644 --- a/Externals/wxWidgets3/include/wx/msw/radiobox.h +++ b/Externals/wxWidgets3/include/wx/msw/radiobox.h @@ -4,7 +4,7 @@ // Author: Julian Smart // Modified by: // Created: 01/02/97 -// RCS-ID: $Id: radiobox.h 65957 2010-10-30 23:50:39Z VZ $ +// RCS-ID: $Id: radiobox.h 70498 2012-02-02 14:26:06Z VZ $ // Copyright: (c) Julian Smart // Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// @@ -149,6 +149,9 @@ protected: // get the total size occupied by the radio box buttons wxSize GetTotalButtonSize(const wxSize& sizeBtn) const; + // Adjust all the buttons to the new window size. + void PositionAllButtons(int x, int y, int width, int height); + virtual void DoSetSize(int x, int y, int width, int height, int sizeFlags = wxSIZE_AUTO); @@ -163,6 +166,8 @@ protected: virtual WXHRGN MSWGetRegionWithoutChildren(); #endif // __WXWINCE__ + // resolve ambiguity in base classes + virtual wxBorder GetDefaultBorder() const { return wxRadioBoxBase::GetDefaultBorder(); } // the buttons we contain wxSubwindows *m_radioButtons; diff --git a/Externals/wxWidgets3/include/wx/msw/setup0.h b/Externals/wxWidgets3/include/wx/msw/setup0.h index f3c5cf733c..7b0bf0b25f 100644 --- a/Externals/wxWidgets3/include/wx/msw/setup0.h +++ b/Externals/wxWidgets3/include/wx/msw/setup0.h @@ -4,7 +4,7 @@ // Author: Julian Smart // Modified by: // Created: 01/02/97 -// RCS-ID: $Id: setup0.h 67062 2011-02-27 12:48:07Z VZ $ +// RCS-ID: $Id: setup0.h 69463 2011-10-18 21:57:02Z VZ $ // Copyright: (c) Julian Smart // Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// @@ -201,15 +201,6 @@ // Recommended setting: 0 (this is still work in progress...) #define wxUSE_EXTENDED_RTTI 0 -// Set wxUSE_STL to 1 to derive wxList(Foo) and wxArray(Foo) from -// std::list and std::vector, with a compatibility interface, -// and for wxHashMap to be implemented with templates. -// -// Default is 0 -// -// Recommended setting: YMMV -#define wxUSE_STL 0 - // Support for message/error logging. This includes wxLogXXX() functions and // wxLog and derived classes. Don't set this to 0 unless you really know what // you are doing. @@ -261,44 +252,6 @@ // Recommended setting: 1 as setting it to 0 disables many other things #define wxUSE_STREAMS 1 -// This is not a real option but is used as the default value for -// wxUSE_STD_IOSTREAM and wxUSE_STD_STRING. -// -// Currently the Digital Mars and Watcom compilers come without standard C++ -// library headers by default, wxUSE_STD_STRING can be set to 1 if you do have -// them (e.g. from STLPort). -// -// VC++ 5.0 does include standard C++ library headers, however they produce -// many warnings that can't be turned off when compiled at warning level 4. -#if defined(__DMC__) || defined(__WATCOMC__) \ - || (defined(_MSC_VER) && _MSC_VER < 1200) - #define wxUSE_STD_DEFAULT 0 -#else - #define wxUSE_STD_DEFAULT 1 -#endif - -// Use standard C++ streams if 1 instead of wx streams in some places. If -// disabled (default), wx streams are used everywhere and wxWidgets doesn't -// depend on the standard streams library. -// -// Notice that enabling this does not replace wx streams with std streams -// everywhere, in a lot of places wx streams are used no matter what. -// -// Default is 0 -// -// Recommended setting: 1 if you use the standard streams anyhow and so -// dependency on the standard streams library is not a -// problem -#define wxUSE_STD_IOSTREAM wxUSE_STD_DEFAULT - -// Enable conversion to standard C++ string if 1. -// -// Default is 1 for most compilers. -// -// Recommended setting: 1 unless you want to ensure your program doesn't use -// the standard C++ library at all. -#define wxUSE_STD_STRING wxUSE_STD_DEFAULT - // Support for positional parameters (e.g. %1$d, %2$s ...) in wxVsnprintf. // Note that if the system's implementation does not support positional // parameters, setting this to 1 forces the use of the wxWidgets implementation @@ -314,6 +267,107 @@ // Recommended setting: 1 if you want to support multiple languages #define wxUSE_PRINTF_POS_PARAMS 1 + +// ---------------------------------------------------------------------------- +// Interoperability with the standard library. +// ---------------------------------------------------------------------------- + +// Set wxUSE_STL to 1 to enable maximal interoperability with the standard +// library, even at the cost of backwards compatibility. +// +// Default is 0 +// +// Recommended setting: 0 as the options below already provide a relatively +// good level of interoperability and changing this option arguably isn't worth +// diverging from the official builds of the library. +#define wxUSE_STL 0 + +// This is not a real option but is used as the default value for +// wxUSE_STD_IOSTREAM, wxUSE_STD_STRING and wxUSE_STD_CONTAINERS. +// +// Currently the Digital Mars and Watcom compilers come without standard C++ +// library headers by default, wxUSE_STD_STRING can be set to 1 if you do have +// them (e.g. from STLPort). +// +// VC++ 5.0 does include standard C++ library headers, however they produce +// many warnings that can't be turned off when compiled at warning level 4. +#if defined(__DMC__) || defined(__WATCOMC__) \ + || (defined(_MSC_VER) && _MSC_VER < 1200) + #define wxUSE_STD_DEFAULT 0 +#else + #define wxUSE_STD_DEFAULT 1 +#endif + +// Use standard C++ containers to implement wxVector<>, wxStack<>, wxDList<> +// and wxHashXXX<> classes. If disabled, wxWidgets own (mostly compatible but +// usually more limited) implementations are used which allows to avoid the +// dependency on the C++ run-time library. +// +// Notice that the compilers mentioned in wxUSE_STD_DEFAULT comment above don't +// support using standard containers and that VC6 needs non-default options for +// such build to avoid getting "fatal error C1076: compiler limit : internal +// heap limit reached; use /Zm to specify a higher limit" in its own standard +// headers, so you need to ensure you do increase the heap size before enabling +// this option for this compiler. +// +// Default is 0 for compatibility reasons. +// +// Recommended setting: 1 unless compatibility with the official wxWidgets +// build and/or the existing code is a concern. +#define wxUSE_STD_CONTAINERS 0 + +// Use standard C++ streams if 1 instead of wx streams in some places. If +// disabled, wx streams are used everywhere and wxWidgets doesn't depend on the +// standard streams library. +// +// Notice that enabling this does not replace wx streams with std streams +// everywhere, in a lot of places wx streams are used no matter what. +// +// Default is 1 if compiler supports it. +// +// Recommended setting: 1 if you use the standard streams anyhow and so +// dependency on the standard streams library is not a +// problem +#define wxUSE_STD_IOSTREAM wxUSE_STD_DEFAULT + +// Enable minimal interoperability with the standard C++ string class if 1. +// "Minimal" means that wxString can be constructed from std::string or +// std::wstring but can't be implicitly converted to them. You need to enable +// the option below for the latter. +// +// Default is 1 for most compilers. +// +// Recommended setting: 1 unless you want to ensure your program doesn't use +// the standard C++ library at all. +#define wxUSE_STD_STRING wxUSE_STD_DEFAULT + +// Make wxString as much interchangeable with std::[w]string as possible, in +// particular allow implicit conversion of wxString to either of these classes. +// This comes at a price (or a benefit, depending on your point of view) of not +// allowing implicit conversion to "const char *" and "const wchar_t *". +// +// Because a lot of existing code relies on these conversions, this option is +// disabled by default but can be enabled for your build if you don't care +// about compatibility. +// +// Default is 0 if wxUSE_STL has its default value or 1 if it is enabled. +// +// Recommended setting: 0 to remain compatible with the official builds of +// wxWidgets. +#define wxUSE_STD_STRING_CONV_IN_WXSTRING wxUSE_STL + +// VC++ 4.2 and above allows and but you can't mix +// them. Set this option to 1 to use , 0 to use . +// +// Note that newer compilers (including VC++ 7.1 and later) don't support +// wxUSE_IOSTREAMH == 1 and so will be used anyhow. +// +// Default is 0. +// +// Recommended setting: 0, only set to 1 if you use a really old compiler +#define wxUSE_IOSTREAMH 0 + + // ---------------------------------------------------------------------------- // non GUI features selection // ---------------------------------------------------------------------------- @@ -651,6 +705,34 @@ // Recommended setting: 1 #define wxUSE_STC 1 +// Use wxWidget's web viewing classes +// +// Default is 1 +// +// Recommended setting: 1 +#define wxUSE_WEBVIEW 1 + +// Use the IE wxWebView backend +// +// Default is 1 on MSW +// +// Recommended setting: 1 +#ifdef __WXMSW__ +#define wxUSE_WEBVIEW_IE 1 +#else +#define wxUSE_WEBVIEW_IE 0 +#endif + +// Use the WebKit wxWebView backend +// +// Default is 1 on GTK and OSX +// +// Recommended setting: 1 +#if defined(__WXGTK__) || defined(__WXOSX__) +#define wxUSE_WEBVIEW_WEBKIT 1 +#else +#define wxUSE_WEBVIEW_WEBKIT 0 +#endif // Enable the new wxGraphicsPath and wxGraphicsContext classes for an advanced // 2D drawing API. (Still somewhat experimental) @@ -749,6 +831,7 @@ // // Recommended setting: 1 #define wxUSE_ANIMATIONCTRL 1 // wxAnimationCtrl +#define wxUSE_BANNERWINDOW 1 // wxBannerWindow #define wxUSE_BUTTON 1 // wxButton #define wxUSE_BMPBUTTON 1 // wxBitmapButton #define wxUSE_CALENDARCTRL 1 // wxCalendarCtrl @@ -784,8 +867,10 @@ #define wxUSE_STATTEXT 1 // wxStaticText #define wxUSE_STATBMP 1 // wxStaticBitmap #define wxUSE_TEXTCTRL 1 // wxTextCtrl +#define wxUSE_TIMEPICKCTRL 1 // wxTimePickerCtrl #define wxUSE_TOGGLEBTN 1 // requires wxButton #define wxUSE_TREECTRL 1 // wxTreeCtrl +#define wxUSE_TREELISTCTRL 1 // wxTreeListCtrl // Use a status bar class? Depending on the value of wxUSE_NATIVE_STATUSBAR // below either wxStatusBar95 or a generic wxStatusBar will be used. @@ -1002,6 +1087,14 @@ // Recommended setting: 1 #define wxUSE_NOTIFICATION_MESSAGE 1 +// wxRichToolTip is a customizable tooltip class which has more functionality +// than the stock (but native, unlike this class) wxToolTip. +// +// Default is 1. +// +// Recommended setting: 1 (but can be safely set to 0 if you don't need it) +#define wxUSE_RICHTOOLTIP 1 + // Use wxSashWindow class. // // Default is 1. @@ -1307,28 +1400,15 @@ // to create files in SVG (Scalable Vector Graphics) format. #define wxUSE_SVG 1 -// ---------------------------------------------------------------------------- -// other compiler (mis)features -// ---------------------------------------------------------------------------- - -// Set this to 0 if your compiler can't cope with omission of prototype -// parameters. +// Should wxDC provide SetTransformMatrix() and related methods? // -// Default is 1. +// Default is 1 but can be set to 0 if this functionality is not used. Notice +// that currently only wxMSW supports this so setting this to 0 doesn't change +// much for non-MSW platforms (although it will still save a few bytes +// probably). // -// Recommended setting: 1 (should never need to set this to 0) -#define REMOVE_UNUSED_ARG 1 - -// VC++ 4.2 and above allows and but you can't mix -// them. Set this option to 1 to use , 0 to use . -// -// Note that newer compilers (including VC++ 7.1 and later) don't support -// wxUSE_IOSTREAMH == 1 and so will be used anyhow. -// -// Default is 0. -// -// Recommended setting: 0, only set to 1 if you use a really old compiler -#define wxUSE_IOSTREAMH 0 +// Recommended setting: 1. +#define wxUSE_DC_TRANSFORM_MATRIX 1 // ---------------------------------------------------------------------------- // image format support @@ -1452,7 +1532,7 @@ // Recommended setting: 1, required by wxMediaCtrl #define wxUSE_ACTIVEX 1 -// wxDC cacheing implementation +// wxDC caching implementation #define wxUSE_DC_CACHEING 1 // Set this to 1 to enable wxDIB class used internally for manipulating @@ -1533,6 +1613,14 @@ // Recommended setting: 0, this is mainly used for testing #define wxUSE_DATEPICKCTRL_GENERIC 0 +// Set this to 1 to be able to use wxTimePickerCtrlGeneric in addition to the +// native wxTimePickerCtrl for the platforms that have the latter (MSW). +// +// Default is 0. +// +// Recommended setting: 0, this is mainly used for testing +#define wxUSE_TIMEPICKCTRL_GENERIC 0 + // ---------------------------------------------------------------------------- // Crash debugging helpers // ---------------------------------------------------------------------------- diff --git a/Externals/wxWidgets3/include/wx/msw/setup_inc.h b/Externals/wxWidgets3/include/wx/msw/setup_inc.h index 5a24539c8b..176796629d 100644 --- a/Externals/wxWidgets3/include/wx/msw/setup_inc.h +++ b/Externals/wxWidgets3/include/wx/msw/setup_inc.h @@ -3,7 +3,7 @@ // Purpose: MSW-specific setup.h options // Author: Vadim Zeitlin // Created: 2007-07-21 (extracted from wx/msw/setup0.h) -// RCS-ID: $Id: setup_inc.h 50586 2007-12-08 20:51:21Z VZ $ +// RCS-ID: $Id: setup_inc.h 69224 2011-09-29 13:43:15Z VZ $ // Copyright: (c) 2007 Vadim Zeitlin // Licence: wxWindows licence /////////////////////////////////////////////////////////////////////////////// @@ -63,7 +63,7 @@ // Recommended setting: 1, required by wxMediaCtrl #define wxUSE_ACTIVEX 1 -// wxDC cacheing implementation +// wxDC caching implementation #define wxUSE_DC_CACHEING 1 // Set this to 1 to enable wxDIB class used internally for manipulating @@ -144,6 +144,14 @@ // Recommended setting: 0, this is mainly used for testing #define wxUSE_DATEPICKCTRL_GENERIC 0 +// Set this to 1 to be able to use wxTimePickerCtrlGeneric in addition to the +// native wxTimePickerCtrl for the platforms that have the latter (MSW). +// +// Default is 0. +// +// Recommended setting: 0, this is mainly used for testing +#define wxUSE_TIMEPICKCTRL_GENERIC 0 + // ---------------------------------------------------------------------------- // Crash debugging helpers // ---------------------------------------------------------------------------- diff --git a/Externals/wxWidgets3/include/wx/msw/slider.h b/Externals/wxWidgets3/include/wx/msw/slider.h index 7ac25508c5..99267d7ca3 100644 --- a/Externals/wxWidgets3/include/wx/msw/slider.h +++ b/Externals/wxWidgets3/include/wx/msw/slider.h @@ -4,7 +4,7 @@ // Author: Julian Smart // Modified by: // Created: 01/02/97 -// RCS-ID: $Id: slider.h 66844 2011-02-05 16:36:30Z VZ $ +// RCS-ID: $Id: slider.h 68230 2011-07-11 22:49:33Z VZ $ // Copyright: (c) Julian Smart // Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// @@ -106,6 +106,10 @@ protected: wxRect GetBoundingBox() const; // Get the height and, if the pointers are non NULL, widths of both labels. + // + // Notice that the return value will be 0 if we don't have wxSL_LABELS + // style but we do fill widthMin and widthMax even if we don't have + // wxSL_MIN_MAX_LABELS style set so the caller should account for it. int GetLabelsSize(int *widthMin = NULL, int *widthMax = NULL) const; @@ -123,8 +127,6 @@ protected: int m_pageSize; int m_lineSize; int m_tickFreq; - int m_minLabelWidth; - int m_maxLabelWidth; // flag needed to detect whether we're getting THUMBRELEASE event because // of dragging the thumb or scrolling the mouse wheel diff --git a/Externals/wxWidgets3/include/wx/msw/sound.h b/Externals/wxWidgets3/include/wx/msw/sound.h index d6d3061f7b..f8b1134229 100644 --- a/Externals/wxWidgets3/include/wx/msw/sound.h +++ b/Externals/wxWidgets3/include/wx/msw/sound.h @@ -4,7 +4,7 @@ // Author: Julian Smart // Modified by: // Created: 01/02/97 -// RCS-ID: $Id: sound.h 58757 2009-02-08 11:45:59Z VZ $ +// RCS-ID: $Id: sound.h 69178 2011-09-21 15:08:02Z VZ $ // Copyright: (c) Julian Smart // Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// @@ -19,14 +19,14 @@ class WXDLLIMPEXP_ADV wxSound : public wxSoundBase public: wxSound(); wxSound(const wxString& fileName, bool isResource = false); - wxSound(int size, const wxByte* data); + wxSound(size_t size, const void* data); virtual ~wxSound(); // Create from resource or file bool Create(const wxString& fileName, bool isResource = false); // Create from data - bool Create(int size, const wxByte* data); + bool Create(size_t size, const void* data); bool IsOk() const { return m_data != NULL; } diff --git a/Externals/wxWidgets3/include/wx/msw/spinctrl.h b/Externals/wxWidgets3/include/wx/msw/spinctrl.h index 6e986bf94e..c1c0f7975d 100644 --- a/Externals/wxWidgets3/include/wx/msw/spinctrl.h +++ b/Externals/wxWidgets3/include/wx/msw/spinctrl.h @@ -4,7 +4,7 @@ // Author: Vadim Zeitlin // Modified by: // Created: 22.07.99 -// RCS-ID: $Id: spinctrl.h 67254 2011-03-20 00:14:35Z DS $ +// RCS-ID: $Id: spinctrl.h 70799 2012-03-04 00:29:48Z VZ $ // Copyright: (c) Vadim Zeitlin // Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// @@ -30,7 +30,7 @@ WX_DEFINE_EXPORTED_ARRAY_PTR(wxSpinCtrl *, wxArraySpins); class WXDLLIMPEXP_CORE wxSpinCtrl : public wxSpinButton { public: - wxSpinCtrl() { } + wxSpinCtrl() { Init(); } wxSpinCtrl(wxWindow *parent, wxWindowID id = wxID_ANY, @@ -41,6 +41,8 @@ public: int min = 0, int max = 100, int initial = 0, const wxString& name = wxT("wxSpinCtrl")) { + Init(); + Create(parent, id, value, pos, size, style, min, max, initial, name); } @@ -143,6 +145,9 @@ protected: bool m_blockEvent; private: + // Common part of all ctors. + void Init(); + DECLARE_DYNAMIC_CLASS(wxSpinCtrl) DECLARE_EVENT_TABLE() wxDECLARE_NO_COPY_CLASS(wxSpinCtrl); diff --git a/Externals/wxWidgets3/include/wx/msw/statusbar.h b/Externals/wxWidgets3/include/wx/msw/statusbar.h index 290fda2c08..c69be90c93 100644 --- a/Externals/wxWidgets3/include/wx/msw/statusbar.h +++ b/Externals/wxWidgets3/include/wx/msw/statusbar.h @@ -4,7 +4,7 @@ // Author: Vadim Zeitlin // Modified by: // Created: 04.04.98 -// RCS-ID: $Id: statusbar.h 67254 2011-03-20 00:14:35Z DS $ +// RCS-ID: $Id: statusbar.h 70310 2012-01-10 17:01:09Z VZ $ // Copyright: (c) 1998 Vadim Zeitlin // Licence: wxWindows licence /////////////////////////////////////////////////////////////////////////////// @@ -76,8 +76,10 @@ protected: // used by DoUpdateStatusText() wxClientDC *m_pDC; +#if wxUSE_TOOLTIPS // the tooltips used when wxSTB_SHOW_TIPS is given wxVector m_tooltips; +#endif private: struct MSWBorders diff --git a/Externals/wxWidgets3/include/wx/msw/textctrl.h b/Externals/wxWidgets3/include/wx/msw/textctrl.h index 0c5dda1db6..cbcf8b772e 100644 --- a/Externals/wxWidgets3/include/wx/msw/textctrl.h +++ b/Externals/wxWidgets3/include/wx/msw/textctrl.h @@ -4,7 +4,7 @@ // Author: Julian Smart // Modified by: // Created: 01/02/97 -// RCS-ID: $Id: textctrl.h 65564 2010-09-18 16:26:30Z VZ $ +// RCS-ID: $Id: textctrl.h 68450 2011-07-29 15:11:54Z VZ $ // Copyright: (c) Julian Smart // Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// @@ -198,6 +198,8 @@ protected: virtual void DoSetValue(const wxString &value, int flags = 0); + virtual wxPoint DoPositionToCoords(long pos) const; + // return true if this control has a user-set limit on amount of text (i.e. // the limit is due to a previous call to SetMaxLength() and not built in) bool HasSpaceLimit(unsigned int *len) const; diff --git a/Externals/wxWidgets3/include/wx/msw/textentry.h b/Externals/wxWidgets3/include/wx/msw/textentry.h index 0f5b195092..3ba6dcb2ea 100644 --- a/Externals/wxWidgets3/include/wx/msw/textentry.h +++ b/Externals/wxWidgets3/include/wx/msw/textentry.h @@ -3,7 +3,7 @@ // Purpose: wxMSW-specific wxTextEntry implementation // Author: Vadim Zeitlin // Created: 2007-09-26 -// RCS-ID: $Id: textentry.h 61834 2009-09-05 12:39:12Z JMS $ +// RCS-ID: $Id: textentry.h 68918 2011-08-27 14:11:13Z VZ $ // Copyright: (c) 2007 Vadim Zeitlin // Licence: wxWindows licence /////////////////////////////////////////////////////////////////////////////// @@ -11,6 +11,8 @@ #ifndef _WX_MSW_TEXTENTRY_H_ #define _WX_MSW_TEXTENTRY_H_ +class wxTextAutoCompleteData; // private class used only by wxTextEntry itself + // ---------------------------------------------------------------------------- // wxTextEntry: common part of wxComboBox and (single line) wxTextCtrl // ---------------------------------------------------------------------------- @@ -18,12 +20,8 @@ class WXDLLIMPEXP_CORE wxTextEntry : public wxTextEntryBase { public: - wxTextEntry() - { -#if wxUSE_OLE - m_enumStrings = NULL; -#endif // wxUSE_OLE - } + wxTextEntry(); + virtual ~wxTextEntry(); // implement wxTextEntryBase pure virtual methods virtual void WriteText(const wxString& text); @@ -46,13 +44,6 @@ public: { DoSetSelection(from, to); } virtual void GetSelection(long *from, long *to) const; - // auto-completion uses COM under Windows so they won't work without - // wxUSE_OLE as OleInitialize() is not called then -#if wxUSE_OLE - virtual bool AutoComplete(const wxArrayString& choices); - virtual bool AutoCompleteFileNames(); -#endif // wxUSE_OLE - virtual bool IsEditable() const; virtual void SetEditable(bool editable); @@ -80,13 +71,29 @@ protected: virtual bool DoSetMargins(const wxPoint& pt); virtual wxPoint DoGetMargins() const; + // auto-completion uses COM under Windows so they won't work without + // wxUSE_OLE as OleInitialize() is not called then +#if wxUSE_OLE + virtual bool DoAutoCompleteStrings(const wxArrayString& choices); + virtual bool DoAutoCompleteFileNames(int flags); + virtual bool DoAutoCompleteCustom(wxTextCompleter *completer); +#endif // wxUSE_OLE + private: // implement this to return the HWND of the EDIT control virtual WXHWND GetEditHWND() const = 0; #if wxUSE_OLE - // enumerator for strings currently used for auto-completion or NULL - class wxIEnumString *m_enumStrings; + // Get the auto-complete object creating it if necessary. Returns NULL if + // creating it failed. + wxTextAutoCompleteData *GetOrCreateCompleter(); + + // Various auto-completion-related stuff, only used if any of AutoComplete() + // methods are called. Use the function above to access it. + wxTextAutoCompleteData *m_autoCompleteData; + + // It needs to call our GetEditableWindow() and GetEditHWND() methods. + friend class wxTextAutoCompleteData; #endif // wxUSE_OLE }; diff --git a/Externals/wxWidgets3/include/wx/msw/tglbtn.h b/Externals/wxWidgets3/include/wx/msw/tglbtn.h index ec15dea83a..7711f70bb6 100644 --- a/Externals/wxWidgets3/include/wx/msw/tglbtn.h +++ b/Externals/wxWidgets3/include/wx/msw/tglbtn.h @@ -5,7 +5,7 @@ // Author: John Norris, minor changes by Axel Schlueter // Modified by: // Created: 08.02.01 -// RCS-ID: $Id: tglbtn.h 66992 2011-02-22 13:25:30Z VZ $ +// RCS-ID: $Id: tglbtn.h 67931 2011-06-14 13:00:42Z VZ $ // Copyright: (c) 2000 Johnny C. Norris II // Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// @@ -15,71 +15,11 @@ #include "wx/bitmap.h" -//----------------------------------------------------------------------------- -// wxBitmapToggleButton -//----------------------------------------------------------------------------- - - -class WXDLLIMPEXP_CORE wxBitmapToggleButton: public wxToggleButtonBase -{ -public: - // construction/destruction - wxBitmapToggleButton() { Init(); } - wxBitmapToggleButton(wxWindow *parent, - wxWindowID id, - const wxBitmap& label, - const wxPoint& pos = wxDefaultPosition, - const wxSize& size = wxDefaultSize, - long style = 0, - const wxValidator& validator = wxDefaultValidator, - const wxString& name = wxCheckBoxNameStr) - { - Create(parent, id, label, pos, size, style, validator, name); - } - - // Create the control - bool Create(wxWindow *parent, - wxWindowID id, - const wxBitmap& label, - const wxPoint& pos = wxDefaultPosition, - const wxSize& size = wxDefaultSize, long style = 0, - const wxValidator& validator = wxDefaultValidator, - const wxString& name = wxCheckBoxNameStr); - - // Get/set the value - void SetValue(bool state); - bool GetValue() const; - - // Set the label - virtual void SetLabel(const wxString& label) { wxControl::SetLabel(label); } - virtual void SetLabel(const wxBitmap& label); - bool Enable(bool enable = true); - -protected: - void Init(); - - wxBitmap m_bitmap; - wxBitmap m_disabledBitmap; - bool m_capturing; - bool m_depressed,m_oldValue; - - void OnPaint(wxPaintEvent &event); - void OnMouse(wxMouseEvent &event); - void OnChar(wxKeyEvent &event); - void OnSize(wxSizeEvent &event); - - virtual wxSize DoGetBestSize() const; - -private: - DECLARE_EVENT_TABLE() - DECLARE_DYNAMIC_CLASS(wxBitmapToggleButton) -}; - // Checkbox item (single checkbox) class WXDLLIMPEXP_CORE wxToggleButton : public wxToggleButtonBase { public: - wxToggleButton() {} + wxToggleButton() { Init(); } wxToggleButton(wxWindow *parent, wxWindowID id, const wxString& label, @@ -104,23 +44,68 @@ public: virtual void SetValue(bool value); virtual bool GetValue() const ; - virtual void SetLabel(const wxString& label); - virtual bool MSWCommand(WXUINT param, WXWORD id); virtual void Command(wxCommandEvent& event); + virtual State GetNormalState() const; + // returns true if the platform should explicitly apply a theme border virtual bool CanApplyThemeBorder() const { return false; } protected: virtual wxBorder GetDefaultBorder() const { return wxBORDER_NONE; } - virtual wxSize DoGetBestSize() const; virtual WXDWORD MSWGetStyle(long flags, WXDWORD *exstyle = NULL) const; + void Init(); + + // current state of the button (when owner-drawn) + bool m_state; + private: DECLARE_DYNAMIC_CLASS_NO_COPY(wxToggleButton) }; +//----------------------------------------------------------------------------- +// wxBitmapToggleButton +//----------------------------------------------------------------------------- + + +class WXDLLIMPEXP_CORE wxBitmapToggleButton: public wxToggleButton +{ +public: + // construction/destruction + wxBitmapToggleButton() {} + wxBitmapToggleButton(wxWindow *parent, + wxWindowID id, + const wxBitmap& label, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + long style = 0, + const wxValidator& validator = wxDefaultValidator, + const wxString& name = wxCheckBoxNameStr) + { + Create(parent, id, label, pos, size, style, validator, name); + } + + // Create the control + bool Create(wxWindow *parent, + wxWindowID id, + const wxBitmap& label, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, long style = 0, + const wxValidator& validator = wxDefaultValidator, + const wxString& name = wxCheckBoxNameStr); + + // deprecated synonym for SetBitmapLabel() + wxDEPRECATED_INLINE( void SetLabel(const wxBitmap& bitmap), + SetBitmapLabel(bitmap); ) + // prevent virtual function hiding + virtual void SetLabel(const wxString& label) { wxToggleButton::SetLabel(label); } + +private: + DECLARE_DYNAMIC_CLASS(wxBitmapToggleButton) +}; + #endif // _WX_TOGGLEBUTTON_H_ diff --git a/Externals/wxWidgets3/include/wx/msw/timectrl.h b/Externals/wxWidgets3/include/wx/msw/timectrl.h new file mode 100644 index 0000000000..8fbb70196e --- /dev/null +++ b/Externals/wxWidgets3/include/wx/msw/timectrl.h @@ -0,0 +1,61 @@ +/////////////////////////////////////////////////////////////////////////////// +// Name: wx/msw/timectrl.h +// Purpose: wxTimePickerCtrl for Windows. +// Author: Vadim Zeitlin +// Created: 2011-09-22 +// RCS-ID: $Id: timectrl.h 69224 2011-09-29 13:43:15Z VZ $ +// Copyright: (c) 2011 Vadim Zeitlin +// Licence: wxWindows licence +/////////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_MSW_TIMECTRL_H_ +#define _WX_MSW_TIMECTRL_H_ + +// ---------------------------------------------------------------------------- +// wxTimePickerCtrl +// ---------------------------------------------------------------------------- + +class WXDLLIMPEXP_ADV wxTimePickerCtrl : public wxTimePickerCtrlBase +{ +public: + // ctors + wxTimePickerCtrl() { } + + wxTimePickerCtrl(wxWindow *parent, + wxWindowID id, + const wxDateTime& dt = wxDefaultDateTime, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + long style = wxTP_DEFAULT, + const wxValidator& validator = wxDefaultValidator, + const wxString& name = wxTimePickerCtrlNameStr) + { + Create(parent, id, dt, pos, size, style, validator, name); + } + + bool Create(wxWindow *parent, + wxWindowID id, + const wxDateTime& dt = wxDefaultDateTime, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + long style = wxTP_DEFAULT, + const wxValidator& validator = wxDefaultValidator, + const wxString& name = wxTimePickerCtrlNameStr) + { + return MSWCreateDateTimePicker(parent, id, dt, + pos, size, style, + validator, name); + } + + // Override MSW-specific functions used during control creation. + virtual WXDWORD MSWGetStyle(long style, WXDWORD *exstyle) const; + +protected: + virtual wxLocaleInfo MSWGetFormat() const; + virtual bool MSWAllowsNone() const { return false; } + virtual bool MSWOnDateTimeChange(const tagNMDATETIMECHANGE& dtch); + + wxDECLARE_DYNAMIC_CLASS_NO_COPY(wxTimePickerCtrl); +}; + +#endif // _WX_MSW_TIMECTRL_H_ diff --git a/Externals/wxWidgets3/include/wx/msw/toolbar.h b/Externals/wxWidgets3/include/wx/msw/toolbar.h index 9f1c702ee4..1fe458f2aa 100644 --- a/Externals/wxWidgets3/include/wx/msw/toolbar.h +++ b/Externals/wxWidgets3/include/wx/msw/toolbar.h @@ -4,7 +4,7 @@ // Author: Julian Smart // Modified by: // Created: 01/02/97 -// RCS-ID: $Id: toolbar.h 67254 2011-03-20 00:14:35Z DS $ +// RCS-ID: $Id: toolbar.h 70854 2012-03-10 00:01:09Z RD $ // Copyright: (c) Julian Smart // Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// @@ -85,6 +85,17 @@ public: virtual WXHBRUSH MSWGetBgBrushForChild(WXHDC hDC, wxWindowMSW *child); #endif // wxHAS_MSW_BACKGROUND_ERASE_HOOK + virtual wxToolBarToolBase *CreateTool(int id, + const wxString& label, + const wxBitmap& bmpNormal, + const wxBitmap& bmpDisabled = wxNullBitmap, + wxItemKind kind = wxITEM_NORMAL, + wxObject *clientData = NULL, + const wxString& shortHelp = wxEmptyString, + const wxString& longHelp = wxEmptyString); + + virtual wxToolBarToolBase *CreateTool(wxControl *control, + const wxString& label); protected: // common part of all ctors void Init(); @@ -103,18 +114,6 @@ protected: virtual void DoToggleTool(wxToolBarToolBase *tool, bool toggle); virtual void DoSetToggle(wxToolBarToolBase *tool, bool toggle); - virtual wxToolBarToolBase *CreateTool(int id, - const wxString& label, - const wxBitmap& bmpNormal, - const wxBitmap& bmpDisabled, - wxItemKind kind, - wxObject *clientData, - const wxString& shortHelp, - const wxString& longHelp); - - virtual wxToolBarToolBase *CreateTool(wxControl *control, - const wxString& label); - // return the appropriate size and flags for the toolbar control virtual wxSize DoGetBestSize() const; diff --git a/Externals/wxWidgets3/include/wx/msw/toplevel.h b/Externals/wxWidgets3/include/wx/msw/toplevel.h index 48ef335a42..55afcbdb17 100644 --- a/Externals/wxWidgets3/include/wx/msw/toplevel.h +++ b/Externals/wxWidgets3/include/wx/msw/toplevel.h @@ -4,7 +4,7 @@ // Author: Vadim Zeitlin // Modified by: // Created: 20.09.01 -// RCS-ID: $Id: toplevel.h 65556 2010-09-16 09:05:48Z VS $ +// RCS-ID: $Id: toplevel.h 70881 2012-03-12 11:42:49Z JS $ // Copyright: (c) 2001 SciTech Software, Inc. (www.scitechsoft.com) // Licence: wxWindows licence /////////////////////////////////////////////////////////////////////////////// @@ -57,12 +57,10 @@ public: virtual void SetLayoutDirection(wxLayoutDirection dir); -#ifndef __WXWINCE__ - virtual bool SetShape(const wxRegion& region); -#endif // __WXWINCE__ virtual void RequestUserAttention(int flags = wxUSER_ATTENTION_INFO); virtual bool Show(bool show = true); + virtual void Raise(); virtual void ShowWithoutActivating(); virtual bool ShowFullScreen(bool show, long style = wxFULLSCREEN_ALL); @@ -77,6 +75,19 @@ public: virtual bool CanSetTransparent(); + // MSW-specific methods + // -------------------- + + // Return the menu representing the "system" menu of the window. You can + // call wxMenu::AppendWhatever() methods on it but removing items from it + // is in general not a good idea. + // + // The pointer returned by this method belongs to the window and will be + // deleted when the window itself is, do not delete it yourself. May return + // NULL if getting the system menu failed. + wxMenu *MSWGetSystemMenu() const; + + // implementation from now on // -------------------------- @@ -141,8 +152,6 @@ protected: virtual void DoFreeze(); virtual void DoThaw(); - virtual void DoEnable(bool enable); - // helper of SetIcons(): calls gets the icon with the size specified by the // given system metrics (SM_C{X|Y}[SM]ICON) from the bundle and sets it // using WM_SETICON with the specified wParam (ICOM_SMALL or ICON_BIG); @@ -170,7 +179,16 @@ protected: bool m_fsIsMaximized; bool m_fsIsShowing; - // the last focused child: we restore focus to it on activation + // Save the current focus to m_winLastFocused if we're not iconized (the + // focus is always NULL when we're iconized). + void DoSaveLastFocus(); + + // Restore focus to m_winLastFocused if possible and needed. + void DoRestoreLastFocus(); + + // The last focused child: we remember it when we're deactivated and + // restore focus to it when we're activated (this is done here) or restored + // from iconic state (done by wxFrame). wxWindow *m_winLastFocused; #if defined(__SMARTPHONE__) && defined(__WXWINCE__) @@ -214,6 +232,10 @@ private: void* m_activateInfo; #endif + // The system menu: initially NULL but can be set (once) by + // MSWGetSystemMenu(). Owned by this window. + wxMenu *m_menuSystem; + DECLARE_EVENT_TABLE() wxDECLARE_NO_COPY_CLASS(wxTopLevelWindowMSW); }; diff --git a/Externals/wxWidgets3/include/wx/msw/webview_ie.h b/Externals/wxWidgets3/include/wx/msw/webview_ie.h new file mode 100644 index 0000000000..62b9a49a01 --- /dev/null +++ b/Externals/wxWidgets3/include/wx/msw/webview_ie.h @@ -0,0 +1,518 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: include/wx/msw/webviewie.h +// Purpose: wxMSW IE wxWebView backend +// Author: Marianne Gagnon +// Id: $Id: webview_ie.h 70499 2012-02-02 20:32:08Z SJL $ +// Copyright: (c) 2010 Marianne Gagnon, 2011 Steven Lamerton +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef wxWebViewIE_H +#define wxWebViewIE_H + +#include "wx/setup.h" + +#if wxUSE_WEBVIEW && wxUSE_WEBVIEW_IE && defined(__WXMSW__) + +#include "wx/control.h" +#include "wx/webview.h" +#include "wx/msw/ole/automtn.h" +#include "wx/msw/ole/activex.h" +#include "wx/msw/ole/oleutils.h" +#include "wx/msw/wrapwin.h" +#include "wx/msw/missing.h" +#include "wx/sharedptr.h" +#include "wx/vector.h" + +/* Classes and definitions from urlmon.h vary in their + * completeness between compilers and versions of compilers. + * We implement our own versions here which should work + * for all compilers. The definitions are taken from the + * mingw-w64 headers which are public domain. + */ + +#ifndef REFRESH_NORMAL +#define REFRESH_NORMAL 0 +#endif + +#ifndef REFRESH_COMPLETELY +#define REFRESH_COMPLETELY 3 +#endif + +typedef enum __wxMIDL_IBindStatusCallback_0006 +{ + wxBSCF_FIRSTDATANOTIFICATION = 0x1, + wxBSCF_INTERMEDIATEDATANOTIFICATION = 0x2, + wxBSCF_LASTDATANOTIFICATION = 0x4, + wxBSCF_DATAFULLYAVAILABLE = 0x8, + wxBSCF_AVAILABLEDATASIZEUNKNOWN = 0x10 +} wxBSCF; + +EXTERN_C const IID CLSID_FileProtocol; + +typedef struct _tagwxBINDINFO +{ + ULONG cbSize; + LPWSTR szExtraInfo; + STGMEDIUM stgmedData; + DWORD grfBindInfoF; + DWORD dwBindVerb; + LPWSTR szCustomVerb; + DWORD cbstgmedData; + DWORD dwOptions; + DWORD dwOptionsFlags; + DWORD dwCodePage; + SECURITY_ATTRIBUTES securityAttributes; + IID iid; + IUnknown *pUnk; + DWORD dwReserved; +} wxBINDINFO; + +typedef struct _tagwxPROTOCOLDATA +{ + DWORD grfFlags; + DWORD dwState; + LPVOID pData; + ULONG cbData; +} wxPROTOCOLDATA; + +class wxIInternetBindInfo : public IUnknown +{ +public: + virtual HRESULT wxSTDCALL GetBindInfo(DWORD *grfBINDF,wxBINDINFO *pbindinfo) = 0; + virtual HRESULT wxSTDCALL GetBindString(ULONG ulStringType,LPOLESTR *ppwzStr, + ULONG cEl,ULONG *pcElFetched) = 0; +}; + +class wxIInternetProtocolSink : public IUnknown +{ +public: + virtual HRESULT wxSTDCALL Switch(wxPROTOCOLDATA *pProtocolData) = 0; + virtual HRESULT wxSTDCALL ReportProgress(ULONG ulStatusCode, + LPCWSTR szStatusText) = 0; + virtual HRESULT wxSTDCALL ReportData(DWORD grfBSCF,ULONG ulProgress, + ULONG ulProgressMax) = 0; + virtual HRESULT wxSTDCALL ReportResult(HRESULT hrResult,DWORD dwError, + LPCWSTR szResult) = 0; +}; + +class wxIInternetProtocolRoot : public IUnknown +{ +public: + virtual HRESULT wxSTDCALL Start(LPCWSTR szUrl,wxIInternetProtocolSink *pOIProtSink, + wxIInternetBindInfo *pOIBindInfo,DWORD grfPI, + HANDLE_PTR dwReserved) = 0; + virtual HRESULT wxSTDCALL Continue(wxPROTOCOLDATA *pProtocolData) = 0; + virtual HRESULT wxSTDCALL Abort(HRESULT hrReason,DWORD dwOptions) = 0; + virtual HRESULT wxSTDCALL Terminate(DWORD dwOptions) = 0; + virtual HRESULT wxSTDCALL Suspend(void) = 0; + virtual HRESULT wxSTDCALL Resume(void) = 0; +}; + + +class wxIInternetProtocol : public wxIInternetProtocolRoot +{ +public: + virtual HRESULT wxSTDCALL Read(void *pv,ULONG cb,ULONG *pcbRead) = 0; + virtual HRESULT wxSTDCALL Seek(LARGE_INTEGER dlibMove,DWORD dwOrigin, + ULARGE_INTEGER *plibNewPosition) = 0; + virtual HRESULT wxSTDCALL LockRequest(DWORD dwOptions) = 0; + virtual HRESULT wxSTDCALL UnlockRequest(void) = 0; +}; + + +class wxIInternetSession : public IUnknown +{ + public: + virtual HRESULT wxSTDCALL RegisterNameSpace(IClassFactory *pCF,REFCLSID rclsid, + LPCWSTR pwzProtocol, + ULONG cPatterns, + const LPCWSTR *ppwzPatterns, + DWORD dwReserved) = 0; + virtual HRESULT wxSTDCALL UnregisterNameSpace(IClassFactory *pCF, + LPCWSTR pszProtocol) = 0; + virtual HRESULT wxSTDCALL RegisterMimeFilter(IClassFactory *pCF, + REFCLSID rclsid, + LPCWSTR pwzType) = 0; + virtual HRESULT wxSTDCALL UnregisterMimeFilter(IClassFactory *pCF, + LPCWSTR pwzType) = 0; + virtual HRESULT wxSTDCALL CreateBinding(LPBC pBC,LPCWSTR szUrl, + IUnknown *pUnkOuter,IUnknown **ppUnk, + wxIInternetProtocol **ppOInetProt, + DWORD dwOption) = 0; + virtual HRESULT wxSTDCALL SetSessionOption(DWORD dwOption,LPVOID pBuffer, + DWORD dwBufferLength, + DWORD dwReserved) = 0; + virtual HRESULT wxSTDCALL GetSessionOption(DWORD dwOption,LPVOID pBuffer, + DWORD *pdwBufferLength, + DWORD dwReserved) = 0; +}; + +/* END OF URLMON.H implementation */ + +/* Same goes for the mshtmhst.h, these are also taken + * from mingw-w64 headers. + */ + +typedef enum _tagwxDOCHOSTUIFLAG +{ + DOCHOSTUIFLAG_DIALOG = 0x1, + DOCHOSTUIFLAG_DISABLE_HELP_MENU = 0x2, + DOCHOSTUIFLAG_NO3DBORDER = 0x4, + DOCHOSTUIFLAG_SCROLL_NO = 0x8, + DOCHOSTUIFLAG_DISABLE_SCRIPT_INACTIVE = 0x10, + DOCHOSTUIFLAG_OPENNEWWIN = 0x20, + DOCHOSTUIFLAG_DISABLE_OFFSCREEN = 0x40, + DOCHOSTUIFLAG_FLAT_SCROLLBAR = 0x80, + DOCHOSTUIFLAG_DIV_BLOCKDEFAULT = 0x100, + DOCHOSTUIFLAG_ACTIVATE_CLIENTHIT_ONLY = 0x200, + DOCHOSTUIFLAG_OVERRIDEBEHAVIORFACTORY = 0x400, + DOCHOSTUIFLAG_CODEPAGELINKEDFONTS = 0x800, + DOCHOSTUIFLAG_URL_ENCODING_DISABLE_UTF8 = 0x1000, + DOCHOSTUIFLAG_URL_ENCODING_ENABLE_UTF8 = 0x2000, + DOCHOSTUIFLAG_ENABLE_FORMS_AUTOCOMPLETE = 0x4000, + DOCHOSTUIFLAG_ENABLE_INPLACE_NAVIGATION = 0x10000, + DOCHOSTUIFLAG_IME_ENABLE_RECONVERSION = 0x20000, + DOCHOSTUIFLAG_THEME = 0x40000, + DOCHOSTUIFLAG_NOTHEME = 0x80000, + DOCHOSTUIFLAG_NOPICS = 0x100000, + DOCHOSTUIFLAG_NO3DOUTERBORDER = 0x200000, + DOCHOSTUIFLAG_DISABLE_EDIT_NS_FIXUP = 0x400000, + DOCHOSTUIFLAG_LOCAL_MACHINE_ACCESS_CHECK = 0x800000, + DOCHOSTUIFLAG_DISABLE_UNTRUSTEDPROTOCOL = 0x1000000 +} DOCHOSTUIFLAG; + +typedef struct _tagwxDOCHOSTUIINFO +{ + ULONG cbSize; + DWORD dwFlags; + DWORD dwDoubleClick; + OLECHAR *pchHostCss; + OLECHAR *pchHostNS; +} DOCHOSTUIINFO; + +class wxIDocHostUIHandler : public IUnknown +{ +public: + virtual HRESULT wxSTDCALL ShowContextMenu(DWORD dwID, POINT *ppt, + IUnknown *pcmdtReserved, + IDispatch *pdispReserved) = 0; + + virtual HRESULT wxSTDCALL GetHostInfo(DOCHOSTUIINFO *pInfo) = 0; + + virtual HRESULT wxSTDCALL ShowUI(DWORD dwID, + IOleInPlaceActiveObject *pActiveObject, + IOleCommandTarget *pCommandTarget, + IOleInPlaceFrame *pFrame, + IOleInPlaceUIWindow *pDoc) = 0; + + virtual HRESULT wxSTDCALL HideUI(void) = 0; + + virtual HRESULT wxSTDCALL UpdateUI(void) = 0; + + virtual HRESULT wxSTDCALL EnableModeless(BOOL fEnable) = 0; + + virtual HRESULT wxSTDCALL OnDocWindowActivate(BOOL fActivate) = 0; + + virtual HRESULT wxSTDCALL OnFrameWindowActivate(BOOL fActivate) = 0; + + virtual HRESULT wxSTDCALL ResizeBorder(LPCRECT prcBorder, + IOleInPlaceUIWindow *pUIWindow, + BOOL fRameWindow) = 0; + + virtual HRESULT wxSTDCALL TranslateAccelerator(LPMSG lpMsg, + const GUID *pguidCmdGroup, + DWORD nCmdID) = 0; + + virtual HRESULT wxSTDCALL GetOptionKeyPath(LPOLESTR *pchKey, + DWORD dw) = 0; + + virtual HRESULT wxSTDCALL GetDropTarget(IDropTarget *pDropTarget, + IDropTarget **ppDropTarget) = 0; + + virtual HRESULT wxSTDCALL GetExternal(IDispatch **ppDispatch) = 0; + + virtual HRESULT wxSTDCALL TranslateUrl(DWORD dwTranslate, + OLECHAR *pchURLIn, + OLECHAR **ppchURLOut) = 0; + + virtual HRESULT wxSTDCALL FilterDataObject(IDataObject *pDO, + IDataObject **ppDORet) = 0; +}; + +/* END OF MSHTMHST.H implementation */ + +struct IHTMLDocument2; +class wxFSFile; +class ClassFactory; +class wxIEContainer; +class DocHostUIHandler; + +class WXDLLIMPEXP_WEBVIEW wxWebViewIE : public wxWebView +{ +public: + + wxWebViewIE() {} + + wxWebViewIE(wxWindow* parent, + wxWindowID id, + const wxString& url = wxWebViewDefaultURLStr, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + long style = 0, + const wxString& name = wxWebViewNameStr) + { + Create(parent, id, url, pos, size, style, name); + } + + ~wxWebViewIE(); + + bool Create(wxWindow* parent, + wxWindowID id, + const wxString& url = wxWebViewDefaultURLStr, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + long style = 0, + const wxString& name = wxWebViewNameStr); + + virtual void LoadURL(const wxString& url); + virtual void LoadHistoryItem(wxSharedPtr item); + virtual wxVector > GetBackwardHistory(); + virtual wxVector > GetForwardHistory(); + + virtual bool CanGoForward() const; + virtual bool CanGoBack() const; + virtual void GoBack(); + virtual void GoForward(); + virtual void ClearHistory(); + virtual void EnableHistory(bool enable = true); + virtual void Stop(); + virtual void Reload(wxWebViewReloadFlags flags = wxWEB_VIEW_RELOAD_DEFAULT); + + virtual wxString GetPageSource() const; + virtual wxString GetPageText() const; + + virtual bool IsBusy() const; + virtual wxString GetCurrentURL() const; + virtual wxString GetCurrentTitle() const; + + virtual void SetZoomType(wxWebViewZoomType); + virtual wxWebViewZoomType GetZoomType() const; + virtual bool CanSetZoomType(wxWebViewZoomType) const; + + virtual void Print(); + + virtual void SetPage(const wxString& html, const wxString& baseUrl); + + virtual wxWebViewZoom GetZoom() const; + virtual void SetZoom(wxWebViewZoom zoom); + + //Clipboard functions + virtual bool CanCut() const; + virtual bool CanCopy() const; + virtual bool CanPaste() const; + virtual void Cut(); + virtual void Copy(); + virtual void Paste(); + + //Undo / redo functionality + virtual bool CanUndo() const; + virtual bool CanRedo() const; + virtual void Undo(); + virtual void Redo(); + + //Editing functions + virtual void SetEditable(bool enable = true); + virtual bool IsEditable() const; + + //Selection + virtual void SelectAll(); + virtual bool HasSelection() const; + virtual void DeleteSelection(); + virtual wxString GetSelectedText() const; + virtual wxString GetSelectedSource() const; + virtual void ClearSelection(); + + virtual void RunScript(const wxString& javascript); + + //Virtual Filesystem Support + virtual void RegisterHandler(wxSharedPtr handler); + + // ---- IE-specific methods + + // FIXME: I seem to be able to access remote webpages even in offline mode... + bool IsOfflineMode(); + void SetOfflineMode(bool offline); + + wxWebViewZoom GetIETextZoom() const; + void SetIETextZoom(wxWebViewZoom level); + + wxWebViewZoom GetIEOpticalZoom() const; + void SetIEOpticalZoom(wxWebViewZoom level); + + void onActiveXEvent(wxActiveXEvent& evt); + void onEraseBg(wxEraseEvent&) {} + + DECLARE_EVENT_TABLE(); + +private: + wxIEContainer* m_container; + wxAutomationObject m_ie; + IWebBrowser2* m_webBrowser; + DWORD m_dwCookie; + DocHostUIHandler* m_uiHandler; + + //We store the current zoom type; + wxWebViewZoomType m_zoomType; + + /** The "Busy" property of IWebBrowser2 does not always return busy when + * we'd want it to; this variable may be set to true in cases where the + * Busy property is false but should be true. + */ + bool m_isBusy; + //We manage our own history, the history list contains the history items + //which are added as documentcomplete events arrive, unless we are loading + //an item from the history. The position is stored as an int, and reflects + //where we are in the history list. + wxVector > m_historyList; + wxVector m_factories; + int m_historyPosition; + bool m_historyLoadingFromList; + bool m_historyEnabled; + + //Generic helper functions for IHtmlDocument commands + bool CanExecCommand(wxString command) const; + void ExecCommand(wxString command); + IHTMLDocument2* GetDocument() const; + //Toggles control features see INTERNETFEATURELIST for values. + bool EnableControlFeature(long flag, bool enable = true); + + wxDECLARE_DYNAMIC_CLASS(wxWebViewIE); +}; + +class VirtualProtocol : public wxIInternetProtocol +{ +protected: + wxIInternetProtocolSink* m_protocolSink; + wxString m_html; + VOID * fileP; + + wxFSFile* m_file; + wxSharedPtr m_handler; + +public: + VirtualProtocol(wxSharedPtr handler); + ~VirtualProtocol() {} + + //IUnknown + DECLARE_IUNKNOWN_METHODS; + + //IInternetProtocolRoot + HRESULT STDMETHODCALLTYPE Abort(HRESULT WXUNUSED(hrReason), + DWORD WXUNUSED(dwOptions)) + { return E_NOTIMPL; } + HRESULT STDMETHODCALLTYPE Continue(wxPROTOCOLDATA *WXUNUSED(pProtocolData)) + { return S_OK; } + HRESULT STDMETHODCALLTYPE Resume() { return S_OK; } + HRESULT STDMETHODCALLTYPE Start(LPCWSTR szUrl, + wxIInternetProtocolSink *pOIProtSink, + wxIInternetBindInfo *pOIBindInfo, + DWORD grfPI, + HANDLE_PTR dwReserved); + HRESULT STDMETHODCALLTYPE Suspend() { return S_OK; } + HRESULT STDMETHODCALLTYPE Terminate(DWORD WXUNUSED(dwOptions)) { return S_OK; } + + //IInternetProtocol + HRESULT STDMETHODCALLTYPE LockRequest(DWORD WXUNUSED(dwOptions)) + { return S_OK; } + HRESULT STDMETHODCALLTYPE Read(void *pv, ULONG cb, ULONG *pcbRead); + HRESULT STDMETHODCALLTYPE Seek(LARGE_INTEGER WXUNUSED(dlibMove), + DWORD WXUNUSED(dwOrigin), + ULARGE_INTEGER* WXUNUSED(plibNewPosition)) + { return E_FAIL; } + HRESULT STDMETHODCALLTYPE UnlockRequest() { return S_OK; } +}; + +class ClassFactory : public IClassFactory +{ +public: + ClassFactory(wxSharedPtr handler) : m_handler(handler) {} + + //IClassFactory + HRESULT STDMETHODCALLTYPE CreateInstance(IUnknown* pUnkOuter, + REFIID riid, void** ppvObject); + HRESULT STDMETHODCALLTYPE LockServer(BOOL fLock); + + //IUnknown + DECLARE_IUNKNOWN_METHODS; + +private: + wxSharedPtr m_handler; +}; + +class wxIEContainer : public wxActiveXContainer +{ +public: + wxIEContainer(wxWindow *parent, REFIID iid, IUnknown *pUnk, DocHostUIHandler* uiHandler = NULL); + virtual ~wxIEContainer(); + virtual bool QueryClientSiteInterface(REFIID iid, void **_interface, const char *&desc); +private: + DocHostUIHandler* m_uiHandler; +}; + +class DocHostUIHandler : public wxIDocHostUIHandler +{ +public: + DocHostUIHandler() {}; + ~DocHostUIHandler() {}; + virtual HRESULT wxSTDCALL ShowContextMenu(DWORD dwID, POINT *ppt, + IUnknown *pcmdtReserved, + IDispatch *pdispReserved); + + virtual HRESULT wxSTDCALL GetHostInfo(DOCHOSTUIINFO *pInfo); + + virtual HRESULT wxSTDCALL ShowUI(DWORD dwID, + IOleInPlaceActiveObject *pActiveObject, + IOleCommandTarget *pCommandTarget, + IOleInPlaceFrame *pFrame, + IOleInPlaceUIWindow *pDoc); + + virtual HRESULT wxSTDCALL HideUI(void); + + virtual HRESULT wxSTDCALL UpdateUI(void); + + virtual HRESULT wxSTDCALL EnableModeless(BOOL fEnable); + + virtual HRESULT wxSTDCALL OnDocWindowActivate(BOOL fActivate); + + virtual HRESULT wxSTDCALL OnFrameWindowActivate(BOOL fActivate); + + virtual HRESULT wxSTDCALL ResizeBorder(LPCRECT prcBorder, + IOleInPlaceUIWindow *pUIWindow, + BOOL fRameWindow); + + virtual HRESULT wxSTDCALL TranslateAccelerator(LPMSG lpMsg, + const GUID *pguidCmdGroup, + DWORD nCmdID); + + virtual HRESULT wxSTDCALL GetOptionKeyPath(LPOLESTR *pchKey, + DWORD dw); + + virtual HRESULT wxSTDCALL GetDropTarget(IDropTarget *pDropTarget, + IDropTarget **ppDropTarget); + + virtual HRESULT wxSTDCALL GetExternal(IDispatch **ppDispatch); + + virtual HRESULT wxSTDCALL TranslateUrl(DWORD dwTranslate, + OLECHAR *pchURLIn, + OLECHAR **ppchURLOut); + + virtual HRESULT wxSTDCALL FilterDataObject(IDataObject *pDO, + IDataObject **ppDORet); + //IUnknown + DECLARE_IUNKNOWN_METHODS; +}; + +#endif // wxUSE_WEBVIEW && wxUSE_WEBVIEW_IE && defined(__WXMSW__) + +#endif // wxWebViewIE_H diff --git a/Externals/wxWidgets3/include/wx/msw/webviewhistoryitem_ie.h b/Externals/wxWidgets3/include/wx/msw/webviewhistoryitem_ie.h new file mode 100644 index 0000000000..acfec70014 --- /dev/null +++ b/Externals/wxWidgets3/include/wx/msw/webviewhistoryitem_ie.h @@ -0,0 +1,31 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: include/wx/msw/webviewhistoryitem.h +// Purpose: wxWebViewHistoryItem header for MSW +// Author: Steven Lamerton +// Id: $Id: webviewhistoryitem_ie.h 69074 2011-09-12 18:35:39Z SJL $ +// Copyright: (c) 2011 Steven Lamerton +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_MSW_WEBVIEWHISTORYITEM_H_ +#define _WX_MSW_WEBVIEWHISTORYITEM_H_ + +#include "wx/setup.h" + +#if wxUSE_WEBVIEW && wxUSE_WEBVIEW_IE && defined(__WXMSW__) + +class WXDLLIMPEXP_WEBVIEW wxWebViewHistoryItem +{ +public: + wxWebViewHistoryItem(const wxString& url, const wxString& title) : + m_url(url), m_title(title) {} + wxString GetUrl() { return m_url; } + wxString GetTitle() { return m_title; } + +private: + wxString m_url, m_title; +}; + +#endif // wxUSE_WEBVIEW && wxUSE_WEBVIEW_IE && defined(__WXMSW__) + +#endif // _WX_MSW_WEBVIEWHISTORYITEM_H_ diff --git a/Externals/wxWidgets3/include/wx/msw/wince/setup.h b/Externals/wxWidgets3/include/wx/msw/wince/setup.h index 0f84386008..a22f9ec48f 100644 --- a/Externals/wxWidgets3/include/wx/msw/wince/setup.h +++ b/Externals/wxWidgets3/include/wx/msw/wince/setup.h @@ -4,7 +4,7 @@ // Author: Julian Smart // Modified by: // Created: 01/02/97 -// RCS-ID: $Id: setup.h 67062 2011-02-27 12:48:07Z VZ $ +// RCS-ID: $Id: setup.h 69463 2011-10-18 21:57:02Z VZ $ // Copyright: (c) Julian Smart // Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// @@ -201,15 +201,6 @@ // Recommended setting: 0 (this is still work in progress...) #define wxUSE_EXTENDED_RTTI 0 -// Set wxUSE_STL to 1 to derive wxList(Foo) and wxArray(Foo) from -// std::list and std::vector, with a compatibility interface, -// and for wxHashMap to be implemented with templates. -// -// Default is 0 -// -// Recommended setting: YMMV -#define wxUSE_STL 0 - // Support for message/error logging. This includes wxLogXXX() functions and // wxLog and derived classes. Don't set this to 0 unless you really know what // you are doing. @@ -261,44 +252,6 @@ // Recommended setting: 1 as setting it to 0 disables many other things #define wxUSE_STREAMS 1 -// This is not a real option but is used as the default value for -// wxUSE_STD_IOSTREAM and wxUSE_STD_STRING. -// -// Currently the Digital Mars and Watcom compilers come without standard C++ -// library headers by default, wxUSE_STD_STRING can be set to 1 if you do have -// them (e.g. from STLPort). -// -// VC++ 5.0 does include standard C++ library headers, however they produce -// many warnings that can't be turned off when compiled at warning level 4. -#if defined(__DMC__) || defined(__WATCOMC__) \ - || (defined(_MSC_VER) && _MSC_VER < 1200) - #define wxUSE_STD_DEFAULT 0 -#else - #define wxUSE_STD_DEFAULT 1 -#endif - -// Use standard C++ streams if 1 instead of wx streams in some places. If -// disabled (default), wx streams are used everywhere and wxWidgets doesn't -// depend on the standard streams library. -// -// Notice that enabling this does not replace wx streams with std streams -// everywhere, in a lot of places wx streams are used no matter what. -// -// Default is 0 -// -// Recommended setting: 1 if you use the standard streams anyhow and so -// dependency on the standard streams library is not a -// problem -#define wxUSE_STD_IOSTREAM wxUSE_STD_DEFAULT - -// Enable conversion to standard C++ string if 1. -// -// Default is 1 for most compilers. -// -// Recommended setting: 1 unless you want to ensure your program doesn't use -// the standard C++ library at all. -#define wxUSE_STD_STRING wxUSE_STD_DEFAULT - // Support for positional parameters (e.g. %1$d, %2$s ...) in wxVsnprintf. // Note that if the system's implementation does not support positional // parameters, setting this to 1 forces the use of the wxWidgets implementation @@ -314,6 +267,107 @@ // Recommended setting: 1 if you want to support multiple languages #define wxUSE_PRINTF_POS_PARAMS 1 + +// ---------------------------------------------------------------------------- +// Interoperability with the standard library. +// ---------------------------------------------------------------------------- + +// Set wxUSE_STL to 1 to enable maximal interoperability with the standard +// library, even at the cost of backwards compatibility. +// +// Default is 0 +// +// Recommended setting: 0 as the options below already provide a relatively +// good level of interoperability and changing this option arguably isn't worth +// diverging from the official builds of the library. +#define wxUSE_STL 0 + +// This is not a real option but is used as the default value for +// wxUSE_STD_IOSTREAM, wxUSE_STD_STRING and wxUSE_STD_CONTAINERS. +// +// Currently the Digital Mars and Watcom compilers come without standard C++ +// library headers by default, wxUSE_STD_STRING can be set to 1 if you do have +// them (e.g. from STLPort). +// +// VC++ 5.0 does include standard C++ library headers, however they produce +// many warnings that can't be turned off when compiled at warning level 4. +#if defined(__DMC__) || defined(__WATCOMC__) \ + || (defined(_MSC_VER) && _MSC_VER < 1200) + #define wxUSE_STD_DEFAULT 0 +#else + #define wxUSE_STD_DEFAULT 1 +#endif + +// Use standard C++ containers to implement wxVector<>, wxStack<>, wxDList<> +// and wxHashXXX<> classes. If disabled, wxWidgets own (mostly compatible but +// usually more limited) implementations are used which allows to avoid the +// dependency on the C++ run-time library. +// +// Notice that the compilers mentioned in wxUSE_STD_DEFAULT comment above don't +// support using standard containers and that VC6 needs non-default options for +// such build to avoid getting "fatal error C1076: compiler limit : internal +// heap limit reached; use /Zm to specify a higher limit" in its own standard +// headers, so you need to ensure you do increase the heap size before enabling +// this option for this compiler. +// +// Default is 0 for compatibility reasons. +// +// Recommended setting: 1 unless compatibility with the official wxWidgets +// build and/or the existing code is a concern. +#define wxUSE_STD_CONTAINERS 0 + +// Use standard C++ streams if 1 instead of wx streams in some places. If +// disabled, wx streams are used everywhere and wxWidgets doesn't depend on the +// standard streams library. +// +// Notice that enabling this does not replace wx streams with std streams +// everywhere, in a lot of places wx streams are used no matter what. +// +// Default is 1 if compiler supports it. +// +// Recommended setting: 1 if you use the standard streams anyhow and so +// dependency on the standard streams library is not a +// problem +#define wxUSE_STD_IOSTREAM wxUSE_STD_DEFAULT + +// Enable minimal interoperability with the standard C++ string class if 1. +// "Minimal" means that wxString can be constructed from std::string or +// std::wstring but can't be implicitly converted to them. You need to enable +// the option below for the latter. +// +// Default is 1 for most compilers. +// +// Recommended setting: 1 unless you want to ensure your program doesn't use +// the standard C++ library at all. +#define wxUSE_STD_STRING wxUSE_STD_DEFAULT + +// Make wxString as much interchangeable with std::[w]string as possible, in +// particular allow implicit conversion of wxString to either of these classes. +// This comes at a price (or a benefit, depending on your point of view) of not +// allowing implicit conversion to "const char *" and "const wchar_t *". +// +// Because a lot of existing code relies on these conversions, this option is +// disabled by default but can be enabled for your build if you don't care +// about compatibility. +// +// Default is 0 if wxUSE_STL has its default value or 1 if it is enabled. +// +// Recommended setting: 0 to remain compatible with the official builds of +// wxWidgets. +#define wxUSE_STD_STRING_CONV_IN_WXSTRING wxUSE_STL + +// VC++ 4.2 and above allows and but you can't mix +// them. Set this option to 1 to use , 0 to use . +// +// Note that newer compilers (including VC++ 7.1 and later) don't support +// wxUSE_IOSTREAMH == 1 and so will be used anyhow. +// +// Default is 0. +// +// Recommended setting: 0, only set to 1 if you use a really old compiler +#define wxUSE_IOSTREAMH 0 + + // ---------------------------------------------------------------------------- // non GUI features selection // ---------------------------------------------------------------------------- @@ -651,6 +705,34 @@ // Recommended setting: 1 #define wxUSE_STC 1 +// Use wxWidget's web viewing classes +// +// Default is 1 +// +// Recommended setting: 1 +#define wxUSE_WEBVIEW 1 + +// Use the IE wxWebView backend +// +// Default is 1 on MSW +// +// Recommended setting: 1 +#ifdef __WXMSW__ +#define wxUSE_WEBVIEW_IE 1 +#else +#define wxUSE_WEBVIEW_IE 0 +#endif + +// Use the WebKit wxWebView backend +// +// Default is 1 on GTK and OSX +// +// Recommended setting: 1 +#if defined(__WXGTK__) || defined(__WXOSX__) +#define wxUSE_WEBVIEW_WEBKIT 1 +#else +#define wxUSE_WEBVIEW_WEBKIT 0 +#endif // Enable the new wxGraphicsPath and wxGraphicsContext classes for an advanced // 2D drawing API. (Still somewhat experimental) @@ -749,6 +831,7 @@ // // Recommended setting: 1 #define wxUSE_ANIMATIONCTRL 1 // wxAnimationCtrl +#define wxUSE_BANNERWINDOW 1 // wxBannerWindow #define wxUSE_BUTTON 1 // wxButton #define wxUSE_BMPBUTTON 1 // wxBitmapButton #define wxUSE_CALENDARCTRL 1 // wxCalendarCtrl @@ -784,8 +867,10 @@ #define wxUSE_STATTEXT 1 // wxStaticText #define wxUSE_STATBMP 1 // wxStaticBitmap #define wxUSE_TEXTCTRL 1 // wxTextCtrl +#define wxUSE_TIMEPICKCTRL 1 // wxTimePickerCtrl #define wxUSE_TOGGLEBTN 1 // requires wxButton #define wxUSE_TREECTRL 1 // wxTreeCtrl +#define wxUSE_TREELISTCTRL 1 // wxTreeListCtrl // Use a status bar class? Depending on the value of wxUSE_NATIVE_STATUSBAR // below either wxStatusBar95 or a generic wxStatusBar will be used. @@ -1002,6 +1087,14 @@ // Recommended setting: 1 #define wxUSE_NOTIFICATION_MESSAGE 1 +// wxRichToolTip is a customizable tooltip class which has more functionality +// than the stock (but native, unlike this class) wxToolTip. +// +// Default is 1. +// +// Recommended setting: 1 (but can be safely set to 0 if you don't need it) +#define wxUSE_RICHTOOLTIP 1 + // Use wxSashWindow class. // // Default is 1. @@ -1307,28 +1400,15 @@ // to create files in SVG (Scalable Vector Graphics) format. #define wxUSE_SVG 1 -// ---------------------------------------------------------------------------- -// other compiler (mis)features -// ---------------------------------------------------------------------------- - -// Set this to 0 if your compiler can't cope with omission of prototype -// parameters. +// Should wxDC provide SetTransformMatrix() and related methods? // -// Default is 1. +// Default is 1 but can be set to 0 if this functionality is not used. Notice +// that currently only wxMSW supports this so setting this to 0 doesn't change +// much for non-MSW platforms (although it will still save a few bytes +// probably). // -// Recommended setting: 1 (should never need to set this to 0) -#define REMOVE_UNUSED_ARG 1 - -// VC++ 4.2 and above allows and but you can't mix -// them. Set this option to 1 to use , 0 to use . -// -// Note that newer compilers (including VC++ 7.1 and later) don't support -// wxUSE_IOSTREAMH == 1 and so will be used anyhow. -// -// Default is 0. -// -// Recommended setting: 0, only set to 1 if you use a really old compiler -#define wxUSE_IOSTREAMH 0 +// Recommended setting: 1. +#define wxUSE_DC_TRANSFORM_MATRIX 1 // ---------------------------------------------------------------------------- // image format support diff --git a/Externals/wxWidgets3/include/wx/msw/window.h b/Externals/wxWidgets3/include/wx/msw/window.h index 303aeee24b..afb6df7a60 100644 --- a/Externals/wxWidgets3/include/wx/msw/window.h +++ b/Externals/wxWidgets3/include/wx/msw/window.h @@ -5,7 +5,7 @@ // Modified by: Vadim Zeitlin on 13.05.99: complete refont of message handling, // elimination of Default(), ... // Created: 01/02/97 -// RCS-ID: $Id: window.h 67250 2011-03-20 00:00:29Z VZ $ +// RCS-ID: $Id: window.h 69348 2011-10-09 22:01:57Z VZ $ // Copyright: (c) Julian Smart // Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// @@ -366,7 +366,21 @@ public: bool HandlePower(WXWPARAM wParam, WXLPARAM lParam, bool *vetoed); - // Window procedure + // The main body of common window proc for all wxWindow objects. It tries + // to handle the given message and returns true if it was handled (the + // appropriate return value is then put in result, which must be non-NULL) + // or false if it wasn't. + // + // This function should be overridden in any new code instead of + // MSWWindowProc() even if currently most of the code overrides + // MSWWindowProc() as it had been written before this function was added. + virtual bool MSWHandleMessage(WXLRESULT *result, + WXUINT message, + WXWPARAM wParam, + WXLPARAM lParam); + + // Common Window procedure for all wxWindow objects: forwards to + // MSWHandleMessage() and MSWDefWindowProc() if the message wasn't handled. virtual WXLRESULT MSWWindowProc(WXUINT nMsg, WXWPARAM wParam, WXLPARAM lParam); // Calls an appropriate default window procedure @@ -453,7 +467,13 @@ public: // This should be overridden to return true for the controls which have // themed background that should through their children. Currently only // wxNotebook uses this. - virtual bool MSWHasInheritableBackground() const { return false; } + // + // The base class version already returns true if we have a solid + // background colour that should be propagated to our children. + virtual bool MSWHasInheritableBackground() const + { + return InheritsBackgroundColour(); + } #if !defined(__WXWINCE__) && !defined(__WXUNIVERSAL__) #define wxHAS_MSW_BACKGROUND_ERASE_HOOK @@ -599,6 +619,14 @@ protected: WXWPARAM wParam, WXLPARAM lParam = 0) const; + // Another helper for creating wxKeyEvent for wxEVT_CHAR and related types. + // + // The wParam and lParam here must come from WM_CHAR event parameters, i.e. + // wParam must be a character and not a virtual code. + wxKeyEvent CreateCharEvent(wxEventType evType, + WXWPARAM wParam, + WXLPARAM lParam) const; + // default OnEraseBackground() implementation, return true if we did erase // the background, false otherwise (i.e. the system should erase it) diff --git a/Externals/wxWidgets3/include/wx/msw/wrapwin.h b/Externals/wxWidgets3/include/wx/msw/wrapwin.h index 85ee355f8a..8ddd5fe79e 100644 --- a/Externals/wxWidgets3/include/wx/msw/wrapwin.h +++ b/Externals/wxWidgets3/include/wx/msw/wrapwin.h @@ -3,7 +3,7 @@ // Purpose: Wrapper around , to be included instead of it // Author: Vaclav Slavik // Created: 2003/07/22 -// RCS-ID: $Id: wrapwin.h 67254 2011-03-20 00:14:35Z DS $ +// RCS-ID: $Id: wrapwin.h 69784 2011-11-17 16:43:34Z VZ $ // Copyright: (c) 2003 Vaclav Slavik // Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// @@ -80,6 +80,7 @@ #if (!defined(_MSC_VER) || (_MSC_VER < 1300)) && !defined(__WIN64__) #define UINT_PTR unsigned int #define INT_PTR int + #define HANDLE_PTR unsigned long #define LONG_PTR long #define ULONG_PTR unsigned long #define DWORD_PTR unsigned long diff --git a/Externals/wxWidgets3/include/wx/nonownedwnd.h b/Externals/wxWidgets3/include/wx/nonownedwnd.h index 25e21b670e..03888e4140 100644 --- a/Externals/wxWidgets3/include/wx/nonownedwnd.h +++ b/Externals/wxWidgets3/include/wx/nonownedwnd.h @@ -4,7 +4,7 @@ // Author: Vaclav Slavik // Modified by: // Created: 2006-12-24 -// RCS-ID: $Id: nonownedwnd.h 54125 2008-06-11 19:17:41Z SC $ +// RCS-ID: $Id: nonownedwnd.h 70813 2012-03-05 13:00:57Z VZ $ // Copyright: (c) 2006 TT-Solutions // Licence: wxWindows licence /////////////////////////////////////////////////////////////////////////////// @@ -12,15 +12,103 @@ #ifndef _WX_NONOWNEDWND_H_ #define _WX_NONOWNEDWND_H_ +#include "wx/window.h" + +// Styles that can be used with any wxNonOwnedWindow: +#define wxFRAME_SHAPED 0x0010 // Create a window that is able to be shaped + +class WXDLLIMPEXP_FWD_CORE wxGraphicsPath; + +// ---------------------------------------------------------------------------- +// wxNonOwnedWindow: a window that is not a child window of another one. +// ---------------------------------------------------------------------------- + +class WXDLLIMPEXP_CORE wxNonOwnedWindowBase : public wxWindow +{ +public: + // Set the shape of the window to the given region. + // Returns true if the platform supports this feature (and the + // operation is successful.) + bool SetShape(const wxRegion& region) + { + // This style is in fact only needed by wxOSX/Carbon so once we don't + // use this port any more, we could get rid of this requirement, but + // for now you must specify wxFRAME_SHAPED for SetShape() to work on + // all platforms. + wxCHECK_MSG + ( + HasFlag(wxFRAME_SHAPED), false, + wxS("Shaped windows must be created with the wxFRAME_SHAPED style.") + ); + + return region.IsEmpty() ? DoClearShape() : DoSetRegionShape(region); + } + +#if wxUSE_GRAPHICS_CONTEXT + // Set the shape using the specified path. + bool SetShape(const wxGraphicsPath& path) + { + wxCHECK_MSG + ( + HasFlag(wxFRAME_SHAPED), false, + wxS("Shaped windows must be created with the wxFRAME_SHAPED style.") + ); + + return DoSetPathShape(path); + } +#endif // wxUSE_GRAPHICS_CONTEXT + + + // Overridden base class methods. + // ------------------------------ + + virtual void AdjustForParentClientOrigin(int& WXUNUSED(x), int& WXUNUSED(y), + int WXUNUSED(sizeFlags) = 0) const + { + // Non owned windows positions don't need to be adjusted for parent + // client area origin so simply do nothing here. + } + + virtual void InheritAttributes() + { + // Non owned windows don't inherit attributes from their parent window + // (if the parent frame is red, it doesn't mean that all dialogs shown + // by it should be red as well), so don't do anything here neither. + } + +protected: + virtual bool DoClearShape() + { + return false; + } + + virtual bool DoSetRegionShape(const wxRegion& WXUNUSED(region)) + { + return false; + } + +#if wxUSE_GRAPHICS_CONTEXT + virtual bool DoSetPathShape(const wxGraphicsPath& WXUNUSED(path)) + { + return false; + } +#endif // wxUSE_GRAPHICS_CONTEXT +}; + #if defined(__WXDFB__) #include "wx/dfb/nonownedwnd.h" +#elif defined(__WXGTK20__) + #include "wx/gtk/nonownedwnd.h" #elif defined(__WXMAC__) #include "wx/osx/nonownedwnd.h" +#elif defined(__WXMSW__) && !defined(__WXWINCE__) + #include "wx/msw/nonownedwnd.h" #else - // other ports can derive both wxTLW and wxPopupWindow directly - // from wxWindow: - #include "wx/window.h" - typedef wxWindow wxNonOwnedWindow; + // No special class needed in other ports, they can derive both wxTLW and + // wxPopupWindow directly from wxWindow and don't implement SetShape(). + class wxNonOwnedWindow : public wxNonOwnedWindowBase + { + }; #endif #endif // _WX_NONOWNEDWND_H_ diff --git a/Externals/wxWidgets3/include/wx/odcombo.h b/Externals/wxWidgets3/include/wx/odcombo.h index 04dccc0731..6e2d9efb86 100644 --- a/Externals/wxWidgets3/include/wx/odcombo.h +++ b/Externals/wxWidgets3/include/wx/odcombo.h @@ -4,7 +4,7 @@ // Author: Jaakko Salli // Modified by: // Created: Apr-30-2006 -// RCS-ID: $Id: odcombo.h 66412 2010-12-20 14:54:04Z JMS $ +// RCS-ID: $Id: odcombo.h 68460 2011-07-30 11:30:08Z VZ $ // Copyright: (c) Jaakko Salli // Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// @@ -233,15 +233,15 @@ private: // the wxComboCtrl. // ---------------------------------------------------------------------------- -class WXDLLIMPEXP_ADV wxOwnerDrawnComboBox : public wxComboCtrl, - public wxItemContainer +class WXDLLIMPEXP_ADV wxOwnerDrawnComboBox : + public wxWindowWithItems { //friend class wxComboPopupWindow; friend class wxVListBoxComboPopup; public: // ctors and such - wxOwnerDrawnComboBox() : wxComboCtrl() { Init(); } + wxOwnerDrawnComboBox() { Init(); } wxOwnerDrawnComboBox(wxWindow *parent, wxWindowID id, @@ -253,7 +253,6 @@ public: long style = 0, const wxValidator& validator = wxDefaultValidator, const wxString& name = wxComboBoxNameStr) - : wxComboCtrl() { Init(); @@ -339,8 +338,6 @@ public: virtual bool IsSorted() const { return HasFlag(wxCB_SORT); } - wxCONTROL_ITEMCONTAINER_CLIENTDATAOBJECT_RECAST - protected: virtual void DoClear(); virtual void DoDeleteOneItem(unsigned int n); diff --git a/Externals/wxWidgets3/include/wx/osx/anybutton.h b/Externals/wxWidgets3/include/wx/osx/anybutton.h new file mode 100644 index 0000000000..9e11031ae8 --- /dev/null +++ b/Externals/wxWidgets3/include/wx/osx/anybutton.h @@ -0,0 +1,59 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: anybutton.h +// Purpose: wxAnyButton class +// Author: Stefan Csomor +// Created: 1998-01-01 (extracted from button.h) +// RCS-ID: $Id: anybutton.h 67931 2011-06-14 13:00:42Z VZ $ +// Copyright: (c) Stefan Csomor +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_OSX_ANYBUTTON_H_ +#define _WX_OSX_ANYBUTTON_H_ + +// Any button +class WXDLLIMPEXP_CORE wxAnyButton : public wxAnyButtonBase +{ +public: + wxAnyButton() {} + + static wxSize GetDefaultSize(); + + virtual void SetLabel(const wxString& label); + +protected: + virtual wxSize DoGetBestSize() const ; + + void OnEnterWindow( wxMouseEvent& event); + void OnLeaveWindow( wxMouseEvent& event); + + virtual wxBitmap DoGetBitmap(State which) const; + virtual void DoSetBitmap(const wxBitmap& bitmap, State which); + virtual void DoSetBitmapPosition(wxDirection dir); + + virtual void DoSetBitmapMargins(int x, int y) + { + m_marginX = x; + m_marginY = y; + InvalidateBestSize(); + } + +#if wxUSE_MARKUP && wxOSX_USE_COCOA + virtual bool DoSetLabelMarkup(const wxString& markup); +#endif // wxUSE_MARKUP && wxOSX_USE_COCOA + + + // the margins around the bitmap + int m_marginX; + int m_marginY; + + // the bitmaps for the different state of the buttons, all of them may be + // invalid and the button only shows a bitmap at all if State_Normal bitmap + // is valid + wxBitmap m_bitmaps[State_Max]; + + wxDECLARE_NO_COPY_CLASS(wxAnyButton); + DECLARE_EVENT_TABLE() +}; + +#endif // _WX_OSX_ANYBUTTON_H_ diff --git a/Externals/wxWidgets3/include/wx/osx/app.h b/Externals/wxWidgets3/include/wx/osx/app.h index 74ff369b34..3814c79462 100644 --- a/Externals/wxWidgets3/include/wx/osx/app.h +++ b/Externals/wxWidgets3/include/wx/osx/app.h @@ -4,7 +4,7 @@ // Author: Stefan Csomor // Modified by: // Created: 1998-01-01 -// RCS-ID: $Id: app.h 67254 2011-03-20 00:14:35Z DS $ +// RCS-ID: $Id: app.h 68617 2011-08-09 22:17:12Z DS $ // Copyright: (c) Stefan Csomor // Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// @@ -122,7 +122,10 @@ public: virtual short MacHandleAEQuit(const WXAPPLEEVENTREF event , WXAPPLEEVENTREF reply) ; virtual short MacHandleAERApp(const WXAPPLEEVENTREF event , WXAPPLEEVENTREF reply) ; #endif - // in response of an open-document apple event + // in response of an openFiles message with Cocoa and an + // open-document apple event with Carbon + virtual void MacOpenFiles(const wxArrayString &fileNames) ; + // called by MacOpenFiles for each file. virtual void MacOpenFile(const wxString &fileName) ; // in response of a get-url apple event virtual void MacOpenURL(const wxString &url) ; diff --git a/Externals/wxWidgets3/include/wx/osx/button.h b/Externals/wxWidgets3/include/wx/osx/button.h index dad3e4cc05..a9a7abbd99 100644 --- a/Externals/wxWidgets3/include/wx/osx/button.h +++ b/Externals/wxWidgets3/include/wx/osx/button.h @@ -4,7 +4,7 @@ // Author: Stefan Csomor // Modified by: // Created: 1998-01-01 -// RCS-ID: $Id: button.h 67254 2011-03-20 00:14:35Z DS $ +// RCS-ID: $Id: button.h 67931 2011-06-14 13:00:42Z VZ $ // Copyright: (c) Stefan Csomor // Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// @@ -41,8 +41,6 @@ public: const wxValidator& validator = wxDefaultValidator, const wxString& name = wxButtonNameStr); - static wxSize GetDefaultSize(); - virtual void SetLabel(const wxString& label); virtual wxWindow *SetDefault(); virtual void Command(wxCommandEvent& event); @@ -52,38 +50,7 @@ public: virtual bool OSXHandleClicked( double timestampsec ); protected: - virtual wxSize DoGetBestSize() const ; - - void OnEnterWindow( wxMouseEvent& event); - void OnLeaveWindow( wxMouseEvent& event); - - virtual wxBitmap DoGetBitmap(State which) const; - virtual void DoSetBitmap(const wxBitmap& bitmap, State which); - virtual void DoSetBitmapPosition(wxDirection dir); - - virtual void DoSetBitmapMargins(int x, int y) - { - m_marginX = x; - m_marginY = y; - InvalidateBestSize(); - } - -#if wxUSE_MARKUP && wxOSX_USE_COCOA - virtual bool DoSetLabelMarkup(const wxString& markup); -#endif // wxUSE_MARKUP && wxOSX_USE_COCOA - - - // the margins around the bitmap - int m_marginX; - int m_marginY; - - // the bitmaps for the different state of the buttons, all of them may be - // invalid and the button only shows a bitmap at all if State_Normal bitmap - // is valid - wxBitmap m_bitmaps[State_Max]; - DECLARE_DYNAMIC_CLASS(wxButton) - DECLARE_EVENT_TABLE() }; // OS X specific class, not part of public wx API diff --git a/Externals/wxWidgets3/include/wx/osx/carbon/dataview.h b/Externals/wxWidgets3/include/wx/osx/carbon/dataview.h index 056a2a895c..e4dfeb2940 100644 --- a/Externals/wxWidgets3/include/wx/osx/carbon/dataview.h +++ b/Externals/wxWidgets3/include/wx/osx/carbon/dataview.h @@ -406,6 +406,8 @@ public: // virtual wxDataViewItem GetCurrentItem() const; virtual void SetCurrentItem(const wxDataViewItem& item); + virtual wxDataViewColumn *GetCurrentColumn() const; + virtual int GetSelectedItemsCount() const; virtual int GetSelections(wxDataViewItemArray& sel) const; virtual bool IsSelected (wxDataViewItem const& item) const; virtual void Select (wxDataViewItem const& item); @@ -427,6 +429,8 @@ public: virtual void SetRowHeight(wxDataViewItem const& item, unsigned int height); virtual void OnSize (); + virtual void StartEditor( const wxDataViewItem & item, unsigned int column ); + // // other methods // diff --git a/Externals/wxWidgets3/include/wx/osx/carbon/evtloop.h b/Externals/wxWidgets3/include/wx/osx/carbon/evtloop.h index 2811e5c8c8..c327fff427 100644 --- a/Externals/wxWidgets3/include/wx/osx/carbon/evtloop.h +++ b/Externals/wxWidgets3/include/wx/osx/carbon/evtloop.h @@ -4,7 +4,7 @@ // Author: Vadim Zeitlin // Modified by: // Created: 2006-01-12 -// RCS-ID: $Id: evtloop.h 65680 2010-09-30 11:44:45Z VZ $ +// RCS-ID: $Id: evtloop.h 68302 2011-07-19 17:56:57Z SC $ // Copyright: (c) 2006 Vadim Zeitlin // Licence: wxWindows licence /////////////////////////////////////////////////////////////////////////////// @@ -20,6 +20,8 @@ class WXDLLIMPEXP_CORE wxGUIEventLoop : public wxCFEventLoop public: wxGUIEventLoop(); + virtual void WakeUp(); + protected: virtual int DoDispatchTimeout(unsigned long timeout); diff --git a/Externals/wxWidgets3/include/wx/osx/carbon/region.h b/Externals/wxWidgets3/include/wx/osx/carbon/region.h index 22ae118508..e15ca339d8 100644 --- a/Externals/wxWidgets3/include/wx/osx/carbon/region.h +++ b/Externals/wxWidgets3/include/wx/osx/carbon/region.h @@ -4,7 +4,7 @@ // Author: Stefan Csomor // Modified by: // Created: 1998-01-01 -// RCS-ID: $Id: region.h 67254 2011-03-20 00:14:35Z DS $ +// RCS-ID: $Id: region.h 69459 2011-10-18 21:56:40Z VZ $ // Copyright: (c) Stefan Csomor // Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// @@ -17,12 +17,13 @@ class WXDLLIMPEXP_CORE wxRegion : public wxRegionWithCombine { public: + wxRegion() { } wxRegion(long x, long y, long w, long h); wxRegion(const wxPoint& topLeft, const wxPoint& bottomRight); wxRegion(const wxRect& rect); wxRegion( WXHRGN hRegion ); wxRegion(size_t n, const wxPoint *points, wxPolygonFillMode fillStyle = wxODDEVEN_RULE ); - wxRegion(); +#if wxUSE_IMAGE wxRegion(const wxBitmap& bmp) { Union(bmp); @@ -32,6 +33,7 @@ public: { Union(bmp, transColour, tolerance); } +#endif virtual ~wxRegion(); diff --git a/Externals/wxWidgets3/include/wx/osx/carbon/statbmp.h b/Externals/wxWidgets3/include/wx/osx/carbon/statbmp.h index 6d378e2d49..4ec79b1054 100644 --- a/Externals/wxWidgets3/include/wx/osx/carbon/statbmp.h +++ b/Externals/wxWidgets3/include/wx/osx/carbon/statbmp.h @@ -4,7 +4,7 @@ // Author: Stefan Csomor // Modified by: // Created: 1998-01-01 -// RCS-ID: $Id: statbmp.h 67280 2011-03-22 14:17:38Z DS $ +// RCS-ID: $Id: statbmp.h 70165 2011-12-29 14:42:13Z SN $ // Copyright: (c) Stefan Csomor // Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// @@ -39,8 +39,8 @@ class WXDLLIMPEXP_CORE wxStaticBitmap: public wxStaticBitmapBase virtual void SetBitmap(const wxBitmap& bitmap); - virtual void Command(wxCommandEvent& WXUNUSED(event)) {}; - virtual void ProcessCommand(wxCommandEvent& WXUNUSED(event)) {}; + virtual void Command(wxCommandEvent& WXUNUSED(event)) {} + virtual void ProcessCommand(wxCommandEvent& WXUNUSED(event)) {} void OnPaint( wxPaintEvent &event ) ; wxBitmap GetBitmap() const { return m_bitmap; } diff --git a/Externals/wxWidgets3/include/wx/osx/chkconf.h b/Externals/wxWidgets3/include/wx/osx/chkconf.h index 98446dc66f..211411c961 100644 --- a/Externals/wxWidgets3/include/wx/osx/chkconf.h +++ b/Externals/wxWidgets3/include/wx/osx/chkconf.h @@ -4,7 +4,7 @@ * Author: Vadim Zeitlin * Modified by: * Created: 2005-04-05 (extracted from wx/chkconf.h) - * RCS-ID: $Id: chkconf.h 66955 2011-02-18 18:44:43Z SC $ + * RCS-ID: $Id: chkconf.h 67497 2011-04-15 19:18:34Z DS $ * Copyright: (c) 2005 Vadim Zeitlin * Licence: wxWindows licence */ @@ -107,4 +107,4 @@ #include "wx/osx/cocoa/chkconf.h" #endif -#endif // _WX_OSX_CHKCONF_H_ +#endif /* _WX_OSX_CHKCONF_H_ */ diff --git a/Externals/wxWidgets3/include/wx/osx/cocoa/dataview.h b/Externals/wxWidgets3/include/wx/osx/cocoa/dataview.h index 335bce5ad7..0859b2dbae 100644 --- a/Externals/wxWidgets3/include/wx/osx/cocoa/dataview.h +++ b/Externals/wxWidgets3/include/wx/osx/cocoa/dataview.h @@ -474,6 +474,8 @@ public: // virtual wxDataViewItem GetCurrentItem() const; virtual void SetCurrentItem(const wxDataViewItem& item); + virtual wxDataViewColumn *GetCurrentColumn() const; + virtual int GetSelectedItemsCount() const; virtual int GetSelections(wxDataViewItemArray& sel) const; virtual bool IsSelected(const wxDataViewItem& item) const; virtual void Select(const wxDataViewItem& item); @@ -496,6 +498,8 @@ public: wxDataViewColumn*& columnPtr) const; virtual void SetRowHeight(const wxDataViewItem& item, unsigned int height); virtual void OnSize(); + + virtual void StartEditor( const wxDataViewItem & item, unsigned int column ); // drag & drop helper methods wxDataFormat GetDnDDataFormat(wxDataObjectComposite* dataObjects); diff --git a/Externals/wxWidgets3/include/wx/osx/cocoa/evtloop.h b/Externals/wxWidgets3/include/wx/osx/cocoa/evtloop.h index d3ae6c76d1..4dae4c2184 100644 --- a/Externals/wxWidgets3/include/wx/osx/cocoa/evtloop.h +++ b/Externals/wxWidgets3/include/wx/osx/cocoa/evtloop.h @@ -3,7 +3,7 @@ // Purpose: declaration of wxGUIEventLoop for wxOSX/Cocoa // Author: Vadim Zeitlin // Created: 2008-12-28 -// RCS-ID: $Id: evtloop.h 67129 2011-03-05 12:21:20Z SC $ +// RCS-ID: $Id: evtloop.h 68301 2011-07-19 16:17:44Z SC $ // Copyright: (c) 2006 Vadim Zeitlin // Licence: wxWindows licence /////////////////////////////////////////////////////////////////////////////// @@ -21,6 +21,8 @@ public: void EndModalSession(); + virtual void WakeUp(); + protected: virtual int DoDispatchTimeout(unsigned long timeout); @@ -31,7 +33,12 @@ protected: virtual CFRunLoopRef CFGetCurrentRunLoop() const; void* m_modalSession; + + wxWindow* m_modalWindow; + WXWindow m_dummyWindow; + + int m_modalNestedLevel; }; #endif // _WX_OSX_COCOA_EVTLOOP_H_ diff --git a/Externals/wxWidgets3/include/wx/osx/cocoa/private.h b/Externals/wxWidgets3/include/wx/osx/cocoa/private.h index 9449772324..0e4a19ac8c 100644 --- a/Externals/wxWidgets3/include/wx/osx/cocoa/private.h +++ b/Externals/wxWidgets3/include/wx/osx/cocoa/private.h @@ -6,7 +6,7 @@ // Author: Stefan Csomor // Modified by: // Created: 1998-01-01 -// RCS-ID: $Id: private.h 67233 2011-03-18 15:45:51Z SC $ +// RCS-ID: $Id: private.h 70863 2012-03-10 13:13:51Z SC $ // Copyright: (c) Stefan Csomor // Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// @@ -145,13 +145,13 @@ public : virtual unsigned int draggingUpdated(void* sender, WXWidget slf, void* _cmd); virtual bool performDragOperation(void* sender, WXWidget slf, void* _cmd); virtual void mouseEvent(WX_NSEvent event, WXWidget slf, void* _cmd); + virtual void cursorUpdate(WX_NSEvent event, WXWidget slf, void* _cmd); virtual void keyEvent(WX_NSEvent event, WXWidget slf, void* _cmd); virtual void insertText(NSString* text, WXWidget slf, void* _cmd); virtual bool performKeyEquivalent(WX_NSEvent event, WXWidget slf, void* _cmd); virtual bool acceptsFirstResponder(WXWidget slf, void* _cmd); virtual bool becomeFirstResponder(WXWidget slf, void* _cmd); virtual bool resignFirstResponder(WXWidget slf, void* _cmd); - virtual void resetCursorRects(WXWidget slf, void* _cmd); virtual bool isFlipped(WXWidget slf, void* _cmd); virtual void drawRect(void* rect, WXWidget slf, void* _cmd); @@ -239,6 +239,8 @@ public : virtual void SetModified(bool modified); virtual bool IsModified() const; + virtual void SetRepresentedFilename(const wxString& filename); + wxNonOwnedWindow* GetWXPeer() { return m_wxPeer; } CGWindowLevel GetWindowLevel() const { return m_macWindowLevel; } @@ -352,6 +354,21 @@ protected : - (void)sheetDidEnd:(NSWindow *)sheet returnCode:(int)returnCode contextInfo:(void *)contextInfo; @end + // This interface must be exported in shared 64 bit multilib build but + // using WXEXPORT with Objective C interfaces doesn't work with old (4.0.1) + // gcc when using 10.4 SDK. It does work with newer gcc even in 32 bit + // builds but seems to be unnecessary there so to avoid the expense of a + // configure check verifying if this does work or not with the current + // compiler we just only use it for 64 bit builds where this is always + // supported. + // + // NB: Currently this is the only place where we need to export an + // interface but if we need to do it elsewhere we should define a + // WXEXPORT_OBJC macro once and reuse it in all places it's needed + // instead of duplicating this preprocessor check. +#ifdef __LP64__ + WXEXPORT +#endif // 64 bit builds @interface wxNSAppController : NSObject wxOSX_10_6_AND_LATER() { } diff --git a/Externals/wxWidgets3/include/wx/osx/cocoa/private/date.h b/Externals/wxWidgets3/include/wx/osx/cocoa/private/date.h new file mode 100644 index 0000000000..09624ab3f9 --- /dev/null +++ b/Externals/wxWidgets3/include/wx/osx/cocoa/private/date.h @@ -0,0 +1,51 @@ +/////////////////////////////////////////////////////////////////////////////// +// Name: wx/osx/cocoa/private/date.h +// Purpose: NSDate-related helpers +// Author: Vadim Zeitlin +// Created: 2011-12-19 +// RCS-ID: $Id: date.h 70070 2011-12-20 21:27:09Z VZ $ +// Copyright: (c) 2011 Vadim Zeitlin +// Licence: wxWindows licence +/////////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_OSX_COCOA_PRIVATE_DATE_H_ +#define _WX_OSX_COCOA_PRIVATE_DATE_H_ + +#include "wx/datetime.h" + +namespace wxOSXImpl +{ + +// Functions to convert between NSDate and wxDateTime. + +// Returns an NSDate corresponding to the given wxDateTime which can be invalid +// (in which case nil is returned). +inline NSDate* NSDateFromWX(const wxDateTime& dt) +{ + if ( !dt.IsValid() ) + return nil; + + // Get the internal representation as a double used by NSDate. + double ticks = dt.GetValue().ToDouble(); + + // wxDateTime uses milliseconds while NSDate uses (fractional) seconds. + return [NSDate dateWithTimeIntervalSince1970:ticks/1000.]; +} + + +// Returns wxDateTime corresponding to the given NSDate (which may be nil). +inline wxDateTime NSDateToWX(const NSDate* d) +{ + if ( !d ) + return wxDefaultDateTime; + + // Reverse everything done above. + wxLongLong ll; + ll.Assign([d timeIntervalSince1970]*1000); + wxDateTime dt(ll); + return dt; +} + +} // namespace wxOSXImpl + +#endif // _WX_OSX_COCOA_PRIVATE_DATE_H_ diff --git a/Externals/wxWidgets3/include/wx/osx/cocoa/private/textimpl.h b/Externals/wxWidgets3/include/wx/osx/cocoa/private/textimpl.h index a977555e35..841bf5bd08 100644 --- a/Externals/wxWidgets3/include/wx/osx/cocoa/private/textimpl.h +++ b/Externals/wxWidgets3/include/wx/osx/cocoa/private/textimpl.h @@ -4,7 +4,7 @@ // Author: Stefan Csomor // Modified by: // Created: 03/02/99 -// RCS-ID: $Id: textimpl.h 67254 2011-03-20 00:14:35Z DS $ +// RCS-ID: $Id: textimpl.h 70354 2012-01-15 15:53:56Z SC $ // Copyright: (c) Stefan Csomor // Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// @@ -28,6 +28,9 @@ public : wxNSTextFieldControl( wxWindow *wxPeer, wxTextEntry *entry, WXWidget w ); virtual ~wxNSTextFieldControl(); + virtual bool CanClipMaxLength() const { return true; } + virtual void SetMaxLength(unsigned long len); + virtual wxString GetStringValue() const ; virtual void SetStringValue( const wxString &str) ; virtual void Copy() ; @@ -105,6 +108,9 @@ public : virtual wxString GetStringAtIndex(int pos) const; virtual int FindString(const wxString& text) const; + virtual void Popup(); + virtual void Dismiss(); + private: NSComboBox* m_comboBox; }; diff --git a/Externals/wxWidgets3/include/wx/osx/combobox.h b/Externals/wxWidgets3/include/wx/osx/combobox.h index 0aad2f019d..ba55d4f160 100644 --- a/Externals/wxWidgets3/include/wx/osx/combobox.h +++ b/Externals/wxWidgets3/include/wx/osx/combobox.h @@ -4,7 +4,7 @@ // Author: Stefan Csomor // Modified by: // Created: 1998-01-01 -// RCS-ID: $Id: combobox.h 66993 2011-02-22 13:25:38Z VZ $ +// RCS-ID: $Id: combobox.h 69956 2011-12-08 14:47:37Z VZ $ // Copyright: (c) Stefan Csomor // Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// @@ -25,7 +25,14 @@ class wxComboBoxChoice; class wxComboWidgetImpl; // Combobox item -class WXDLLIMPEXP_CORE wxComboBox : public wxControl, public wxComboBoxBase +class WXDLLIMPEXP_CORE wxComboBox : + public wxWindowWithItems< +#if wxOSX_USE_CARBON + wxNavigationEnabled, +#else + wxControl, +#endif + wxComboBoxBase> { DECLARE_DYNAMIC_CLASS(wxComboBox) @@ -42,7 +49,7 @@ class WXDLLIMPEXP_CORE wxComboBox : public wxControl, public wxComboBoxBase virtual void DelegateTextChanged( const wxString& value ); virtual void DelegateChoice( const wxString& value ); - wxComboBox() { Init(); } + wxComboBox() { } wxComboBox(wxWindow *parent, wxWindowID id, const wxString& value = wxEmptyString, @@ -53,7 +60,6 @@ class WXDLLIMPEXP_CORE wxComboBox : public wxControl, public wxComboBoxBase const wxValidator& validator = wxDefaultValidator, const wxString& name = wxComboBoxNameStr) { - Init(); Create(parent, id, value, pos, size, n, choices, style, validator, name); } @@ -66,7 +72,6 @@ class WXDLLIMPEXP_CORE wxComboBox : public wxControl, public wxComboBoxBase const wxValidator& validator = wxDefaultValidator, const wxString& name = wxComboBoxNameStr) { - Init(); Create(parent, id, value, pos, size, choices, style, validator, name); } @@ -134,25 +139,20 @@ class WXDLLIMPEXP_CORE wxComboBox : public wxControl, public wxComboBoxBase virtual wxTextWidgetImpl* GetTextPeer() const; #endif // wxOSX_USE_CARBON +#if wxOSX_USE_COCOA + virtual void Popup(); + virtual void Dismiss(); +#endif // wxOSX_USE_COCOA // osx specific event handling common for all osx-ports virtual bool OSXHandleClicked( double timestampsec ); -#if wxOSX_USE_CARBON - wxCONTROL_ITEMCONTAINER_CLIENTDATAOBJECT_RECAST - - WX_DECLARE_CONTROL_CONTAINER(); -#endif - #if wxOSX_USE_COCOA wxComboWidgetImpl* GetComboPeer() const; #endif protected: - // common part of all ctors - void Init(); - // List functions virtual void DoDeleteOneItem(unsigned int n); virtual void DoClear(); @@ -187,10 +187,6 @@ protected: wxComboBoxChoice* m_choice; wxComboBoxDataArray m_datas; - -#if wxOSX_USE_CARBON - DECLARE_EVENT_TABLE() -#endif }; #endif // _WX_COMBOBOX_H_ diff --git a/Externals/wxWidgets3/include/wx/osx/config_xcode.h b/Externals/wxWidgets3/include/wx/osx/config_xcode.h index 5321a98ee3..5c92ac2032 100644 --- a/Externals/wxWidgets3/include/wx/osx/config_xcode.h +++ b/Externals/wxWidgets3/include/wx/osx/config_xcode.h @@ -4,7 +4,7 @@ // Author: Stefan Csomor // Modified by: // Created: 29.04.04 -// RCS-ID: $Id: config_xcode.h 67254 2011-03-20 00:14:35Z DS $ +// RCS-ID: $Id: config_xcode.h 70021 2011-12-16 22:12:49Z VZ $ // Copyright: (c) wxWidgets team // Licence: wxWindows licence /////////////////////////////////////////////////////////////////////////////// @@ -133,9 +133,9 @@ #define WXWIN_OS_DESCRIPTION "Darwin 7.9.0 Power Macintosh" #define PACKAGE_BUGREPORT "wx-dev@lists.wxwidgets.org" #define PACKAGE_NAME "wxWidgets" -#define PACKAGE_STRING "wxWidgets 2.9.2" +#define PACKAGE_STRING "wxWidgets 2.9.4" #define PACKAGE_TARNAME "wxwidgets" -#define PACKAGE_VERSION "2.9.2" +#define PACKAGE_VERSION "2.9.4" // for regex #define WX_NO_REGEX_ADVANCED 1 diff --git a/Externals/wxWidgets3/include/wx/osx/core/colour.h b/Externals/wxWidgets3/include/wx/osx/core/colour.h index 827c26db69..2765a4c20b 100644 --- a/Externals/wxWidgets3/include/wx/osx/core/colour.h +++ b/Externals/wxWidgets3/include/wx/osx/core/colour.h @@ -4,7 +4,7 @@ // Author: Stefan Csomor // Modified by: // Created: 1998-01-01 -// RCS-ID: $Id: colour.h 67068 2011-02-27 12:48:42Z VZ $ +// RCS-ID: $Id: colour.h 70165 2011-12-29 14:42:13Z SN $ // Copyright: (c) Stefan Csomor // Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// @@ -42,10 +42,10 @@ public: bool operator != (const wxColour& colour) const { return !(*this == colour); } - CGColorRef GetPixel() const { return m_cgColour; }; + CGColorRef GetPixel() const { return m_cgColour; } - CGColorRef GetCGColor() const { return m_cgColour; }; - CGColorRef CreateCGColor() const { return wxCFRetain( (CGColorRef)m_cgColour ); }; + CGColorRef GetCGColor() const { return m_cgColour; } + CGColorRef CreateCGColor() const { return wxCFRetain( (CGColorRef)m_cgColour ); } #if wxOSX_USE_COCOA_OR_CARBON void GetRGBColor( RGBColor *col ) const; diff --git a/Externals/wxWidgets3/include/wx/osx/core/dataview.h b/Externals/wxWidgets3/include/wx/osx/core/dataview.h index 8a24aaefd3..f02d328eea 100644 --- a/Externals/wxWidgets3/include/wx/osx/core/dataview.h +++ b/Externals/wxWidgets3/include/wx/osx/core/dataview.h @@ -89,6 +89,9 @@ public: virtual wxDataViewItem GetCurrentItem() const = 0; virtual void SetCurrentItem(const wxDataViewItem& item) = 0; + virtual wxDataViewColumn *GetCurrentColumn() const = 0; + + virtual int GetSelectedItemsCount() const = 0; virtual int GetSelections(wxDataViewItemArray& sel) const = 0; // returns all selected items in the native control virtual bool IsSelected (wxDataViewItem const& item) const = 0; // checks if the passed item is selected in the native control virtual void Select (wxDataViewItem const& item) = 0; // selects the passed item in the native control @@ -109,6 +112,7 @@ public: virtual void HitTest (wxPoint const& point, wxDataViewItem& item, wxDataViewColumn*& columnPtr) const = 0; // return the item and column pointer that contains with the passed point virtual void SetRowHeight(wxDataViewItem const& item, unsigned int height) = 0; // sets the height of the row containg the passed item in the native control virtual void OnSize (void) = 0; // updates the layout of the native control after a size event + virtual void StartEditor( const wxDataViewItem & item, unsigned int column ) = 0; // starts editing the passed in item and column }; #endif // _WX_DATAVIEWCTRL_CORE_H_ diff --git a/Externals/wxWidgets3/include/wx/osx/core/mimetype.h b/Externals/wxWidgets3/include/wx/osx/core/mimetype.h index b018d7a560..a6e5b1ead9 100644 --- a/Externals/wxWidgets3/include/wx/osx/core/mimetype.h +++ b/Externals/wxWidgets3/include/wx/osx/core/mimetype.h @@ -4,7 +4,7 @@ // Author: Neil Perkins // Modified by: // Created: 2010-05-15 -// RCS-ID: $Id: mimetype.h 67232 2011-03-18 15:10:15Z DS $ +// RCS-ID: $Id: mimetype.h 68563 2011-08-05 19:02:26Z VZ $ // Copyright: (C) 2010 Neil Perkins // Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// @@ -56,6 +56,7 @@ private: bool GetMimeTypes(const wxString& uti, wxArrayString& mimeTypes); bool GetIcon(const wxString& uti, wxIconLocation *iconLoc); bool GetDescription(const wxString& uti, wxString *desc); + bool GetApplication(const wxString& uti, wxString *command); // Structure to represent file types typedef struct FileTypeData @@ -63,6 +64,7 @@ private: wxArrayString extensions; wxArrayString mimeTypes; wxIconLocation iconLoc; + wxString application; wxString description; } FileTypeInfo; @@ -95,9 +97,9 @@ public: bool GetMimeTypes(wxArrayString& mimeTypes) const ; bool GetIcon(wxIconLocation *iconLoc) const ; bool GetDescription(wxString *desc) const ; + bool GetOpenCommand(wxString *openCmd, const wxFileType::MessageParameters& params) const; // These functions are only stubs on Mac OS X - bool GetOpenCommand(wxString *openCmd, const wxFileType::MessageParameters& params) const; bool GetPrintCommand(wxString *printCmd, const wxFileType::MessageParameters& params) const; size_t GetAllCommands(wxArrayString *verbs, wxArrayString *commands, const wxFileType::MessageParameters& params) const; bool SetCommand(const wxString& cmd, const wxString& verb, bool overwriteprompt = TRUE); diff --git a/Externals/wxWidgets3/include/wx/osx/core/private.h b/Externals/wxWidgets3/include/wx/osx/core/private.h index 06f660ccc5..4b69c9bb90 100644 --- a/Externals/wxWidgets3/include/wx/osx/core/private.h +++ b/Externals/wxWidgets3/include/wx/osx/core/private.h @@ -6,7 +6,7 @@ // Author: Stefan Csomor // Modified by: // Created: 1998-01-01 -// RCS-ID: $Id: private.h 67233 2011-03-18 15:45:51Z SC $ +// RCS-ID: $Id: private.h 70354 2012-01-15 15:53:56Z SC $ // Copyright: (c) Stefan Csomor // Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// @@ -32,7 +32,7 @@ #define wxOSX_10_6_AND_LATER(x) #endif -#if !wxUSE_GUI || wxOSX_USE_COCOA_OR_CARBON +#if ( !wxUSE_GUI && !wxOSX_USE_IPHONE ) || wxOSX_USE_COCOA_OR_CARBON // Carbon functions are currently still used in wxOSX/Cocoa too (including // wxBase part of it). @@ -47,6 +47,11 @@ WXDLLIMPEXP_BASE wxString wxMacFSRefToPath( const FSRef *fsRef , CFStringRef add WXDLLIMPEXP_BASE OSStatus wxMacPathToFSRef( const wxString&path , FSRef *fsRef ); WXDLLIMPEXP_BASE wxString wxMacHFSUniStrToString( ConstHFSUniStr255Param uniname ); +// keycode utils from app.cpp + +WXDLLIMPEXP_BASE CGKeyCode wxCharCodeWXToOSX(wxKeyCode code); +WXDLLIMPEXP_BASE long wxMacTranslateKey(unsigned char key, unsigned char code); + #endif #if wxUSE_GUI @@ -626,6 +631,9 @@ public : virtual void GetSelection( long* from, long* to ) const = 0 ; virtual void WriteText( const wxString& str ) = 0 ; + virtual bool CanClipMaxLength() const { return false; } + virtual void SetMaxLength(unsigned long WXUNUSED(len)) {} + virtual bool GetStyle( long position, wxTextAttr& style); virtual void SetStyle( long start, long end, const wxTextAttr& style ) ; virtual void Copy() ; @@ -675,16 +683,18 @@ public : virtual ~wxComboWidgetImpl() {} - virtual int GetSelectedItem() const { return -1; }; - virtual void SetSelectedItem(int WXUNUSED(item)) {}; + virtual int GetSelectedItem() const { return -1; } + virtual void SetSelectedItem(int WXUNUSED(item)) {} - virtual int GetNumberOfItems() const { return -1; }; + virtual int GetNumberOfItems() const { return -1; } virtual void InsertItem(int WXUNUSED(pos), const wxString& WXUNUSED(item)) {} virtual void RemoveItem(int WXUNUSED(pos)) {} virtual void Clear() {} + virtual void Popup() {} + virtual void Dismiss() {} virtual wxString GetStringAtIndex(int WXUNUSED(pos)) const { return wxEmptyString; } @@ -856,6 +866,8 @@ public : virtual void SetModified(bool WXUNUSED(modified)) { } virtual bool IsModified() const { return false; } + virtual void SetRepresentedFilename(const wxString& WXUNUSED(filename)) { } + #if wxOSX_USE_IPHONE virtual CGFloat GetWindowLevel() const { return 0.0; } #else diff --git a/Externals/wxWidgets3/include/wx/osx/core/private/datetimectrl.h b/Externals/wxWidgets3/include/wx/osx/core/private/datetimectrl.h new file mode 100644 index 0000000000..499ff1b94a --- /dev/null +++ b/Externals/wxWidgets3/include/wx/osx/core/private/datetimectrl.h @@ -0,0 +1,71 @@ +/////////////////////////////////////////////////////////////////////////////// +// Name: wx/osx/core/private/datetime.h +// Purpose: +// Author: Vadim Zeitlin +// Created: 2011-12-19 +// RCS-ID: $Id: datetimectrl.h 70071 2011-12-20 21:27:14Z VZ $ +// Copyright: (c) 2011 Vadim Zeitlin +// Licence: wxWindows licence +/////////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_OSX_CORE_PRIVATE_DATETIMECTRL_H_ +#define _WX_OSX_CORE_PRIVATE_DATETIMECTRL_H_ + +#if wxUSE_DATEPICKCTRL + +#include "wx/osx/private.h" + +#include "wx/datetime.h" + +enum wxDateTimeWidgetKind +{ + wxDateTimeWidget_YearMonthDay, + wxDateTimeWidget_HourMinuteSecond +}; + +// ---------------------------------------------------------------------------- +// wxDateTimeWidgetImpl: peer class for wxDateTimePickerCtrl. +// ---------------------------------------------------------------------------- + +class wxDateTimeWidgetImpl +#if wxOSX_USE_COCOA + : public wxWidgetCocoaImpl +#elif wxOSX_USE_CARBON + : public wxMacControl +#else + #error "Unsupported platform" +#endif +{ +public: + static wxDateTimeWidgetImpl* + CreateDateTimePicker(wxDateTimePickerCtrl* wxpeer, + const wxDateTime& dt, + const wxPoint& pos, + const wxSize& size, + long style, + wxDateTimeWidgetKind kind); + + virtual void SetDateTime(const wxDateTime& dt) = 0; + virtual wxDateTime GetDateTime() const = 0; + + virtual void SetDateRange(const wxDateTime& dt1, const wxDateTime& dt2) = 0; + virtual bool GetDateRange(wxDateTime* dt1, wxDateTime* dt2) = 0; + + virtual ~wxDateTimeWidgetImpl() { } + +protected: +#if wxOSX_USE_COCOA + wxDateTimeWidgetImpl(wxDateTimePickerCtrl* wxpeer, WXWidget view) + : wxWidgetCocoaImpl(wxpeer, view) + { + } +#elif wxOSX_USE_CARBON + // There is no Carbon implementation of this control yet so we don't need + // any ctor for it yet but it should be added here if Carbon version is + // written later. +#endif +}; + +#endif // wxUSE_DATEPICKCTRL + +#endif // _WX_OSX_CORE_PRIVATE_DATETIMECTRL_H_ diff --git a/Externals/wxWidgets3/include/wx/osx/dataview.h b/Externals/wxWidgets3/include/wx/osx/dataview.h index 5380d55a38..f54188e3df 100644 --- a/Externals/wxWidgets3/include/wx/osx/dataview.h +++ b/Externals/wxWidgets3/include/wx/osx/dataview.h @@ -2,7 +2,7 @@ // Name: wx/osx/dataview.h // Purpose: wxDataViewCtrl native implementation header for OSX // Author: -// Id: $Id: dataview.h 66634 2011-01-07 18:26:58Z VS $ +// Id: $Id: dataview.h 70496 2012-02-02 14:19:30Z VZ $ // Copyright: (c) 2009 // Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// @@ -60,12 +60,11 @@ public: virtual void SetMaxWidth (int maxWidth); virtual void SetMinWidth (int minWidth); virtual void SetReorderable(bool reorderable); - virtual void SetResizeable (bool resizeable); + virtual void SetResizeable (bool resizable); virtual void SetSortable (bool sortable); virtual void SetSortOrder (bool ascending); virtual void SetTitle (wxString const& title); virtual void SetWidth (int width); - virtual void SetAsSortKey (bool sort = true); // implementation only wxDataViewColumnNativeData* GetNativeData() const @@ -151,7 +150,7 @@ public: const wxValidator& validator = wxDefaultValidator, const wxString& name = wxDataViewCtrlNameStr); - virtual wxControl* GetMainWindow() // not used for the native implementation + virtual wxWindow* GetMainWindow() // not used for the native implementation { return this; } @@ -175,8 +174,9 @@ public: virtual bool IsExpanded(const wxDataViewItem & item) const; virtual unsigned int GetCount() const; - virtual wxRect GetItemRect(const wxDataViewItem& item, const wxDataViewColumn* columnPtr) const; - virtual wxDataViewItem GetSelection() const; + virtual wxRect GetItemRect(const wxDataViewItem& item, + const wxDataViewColumn* columnPtr = NULL) const; + virtual int GetSelectedItemsCount() const; virtual int GetSelections(wxDataViewItemArray& sel) const; virtual void HitTest(const wxPoint& point, wxDataViewItem& item, wxDataViewColumn*& columnPtr) const; @@ -201,6 +201,8 @@ public: // finishes editing of custom items; if no custom item is currently edited the method does nothing void FinishCustomItemEditing(); + + virtual void EditItem(const wxDataViewItem& item, const wxDataViewColumn *column); // returns the n-th pointer to a column; // this method is different from GetColumn(unsigned int pos) because here 'n' is not a position in the control but the n-th @@ -255,6 +257,8 @@ public: m_Deleting = deleting; } + virtual wxDataViewColumn *GetCurrentColumn() const; + virtual wxVisualAttributes GetDefaultAttributes() const { return GetClassDefaultAttributes(GetWindowVariant()); diff --git a/Externals/wxWidgets3/include/wx/osx/datectrl.h b/Externals/wxWidgets3/include/wx/osx/datectrl.h new file mode 100644 index 0000000000..026361aa2f --- /dev/null +++ b/Externals/wxWidgets3/include/wx/osx/datectrl.h @@ -0,0 +1,55 @@ +/////////////////////////////////////////////////////////////////////////////// +// Name: wx/osx/datectrl.h +// Purpose: Declaration of wxOSX-specific wxDatePickerCtrl class. +// Author: Vadim Zeitlin +// Created: 2011-12-18 +// RCS-ID: $Id: datectrl.h 70071 2011-12-20 21:27:14Z VZ $ +// Copyright: (c) 2011 Vadim Zeitlin +// Licence: wxWindows licence +/////////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_OSX_DATECTRL_H_ +#define _WX_OSX_DATECTRL_H_ + +// ---------------------------------------------------------------------------- +// wxDatePickerCtrl +// ---------------------------------------------------------------------------- + +class WXDLLIMPEXP_ADV wxDatePickerCtrl : public wxDatePickerCtrlBase +{ +public: + // Constructors. + wxDatePickerCtrl() { } + + wxDatePickerCtrl(wxWindow *parent, + wxWindowID id, + const wxDateTime& dt = wxDefaultDateTime, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + long style = wxDP_DEFAULT | wxDP_SHOWCENTURY, + const wxValidator& validator = wxDefaultValidator, + const wxString& name = wxDatePickerCtrlNameStr) + { + Create(parent, id, dt, pos, size, style, validator, name); + } + + bool Create(wxWindow *parent, + wxWindowID id, + const wxDateTime& dt = wxDefaultDateTime, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + long style = wxDP_DEFAULT | wxDP_SHOWCENTURY, + const wxValidator& validator = wxDefaultValidator, + const wxString& name = wxDatePickerCtrlNameStr); + + // Implement the base class pure virtuals. + virtual void SetRange(const wxDateTime& dt1, const wxDateTime& dt2); + virtual bool GetRange(wxDateTime *dt1, wxDateTime *dt2) const; + + virtual void OSXGenerateEvent(const wxDateTime& dt); + +private: + wxDECLARE_DYNAMIC_CLASS_NO_COPY(wxDatePickerCtrl); +}; + +#endif // _WX_OSX_DATECTRL_H_ diff --git a/Externals/wxWidgets3/include/wx/osx/datetimectrl.h b/Externals/wxWidgets3/include/wx/osx/datetimectrl.h new file mode 100644 index 0000000000..2184229b12 --- /dev/null +++ b/Externals/wxWidgets3/include/wx/osx/datetimectrl.h @@ -0,0 +1,34 @@ +/////////////////////////////////////////////////////////////////////////////// +// Name: wx/osx/datetimectrl.h +// Purpose: Declaration of wxOSX-specific wxDateTimePickerCtrl class. +// Author: Vadim Zeitlin +// Created: 2011-12-18 +// RCS-ID: $Id: datetimectrl.h 70071 2011-12-20 21:27:14Z VZ $ +// Copyright: (c) 2011 Vadim Zeitlin +// Licence: wxWindows licence +/////////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_OSX_DATETIMECTRL_H_ +#define _WX_OSX_DATETIMECTRL_H_ + +class wxDateTimeWidgetImpl; + +// ---------------------------------------------------------------------------- +// wxDateTimePickerCtrl +// ---------------------------------------------------------------------------- + +class WXDLLIMPEXP_ADV wxDateTimePickerCtrl : public wxDateTimePickerCtrlBase +{ +public: + // Implement the base class pure virtuals. + virtual void SetValue(const wxDateTime& dt); + virtual wxDateTime GetValue() const; + + // Implementation only. + virtual void OSXGenerateEvent(const wxDateTime& dt) = 0; + +protected: + wxDateTimeWidgetImpl* GetDateTimePeer() const; +}; + +#endif // _WX_OSX_DATETIMECTRL_H_ diff --git a/Externals/wxWidgets3/include/wx/osx/dirdlg.h b/Externals/wxWidgets3/include/wx/osx/dirdlg.h index 9ff101b44e..1ea6fd2739 100644 --- a/Externals/wxWidgets3/include/wx/osx/dirdlg.h +++ b/Externals/wxWidgets3/include/wx/osx/dirdlg.h @@ -4,7 +4,7 @@ // Author: Stefan Csomor // Modified by: // Created: 1998-01-01 -// RCS-ID: $Id: dirdlg.h 67254 2011-03-20 00:14:35Z DS $ +// RCS-ID: $Id: dirdlg.h 67896 2011-06-09 00:28:28Z SC $ // Copyright: (c) Stefan Csomor // Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// @@ -23,6 +23,10 @@ public: const wxSize& size = wxDefaultSize, const wxString& name = wxDirDialogNameStr); +#if wxOSX_USE_COCOA + ~wxDirDialog(); +#endif + virtual int ShowModal(); #if wxOSX_USE_COCOA @@ -33,6 +37,10 @@ public: protected: DECLARE_DYNAMIC_CLASS(wxDirDialog) + +#if wxOSX_USE_COCOA + WX_NSObject m_sheetDelegate; +#endif }; #endif diff --git a/Externals/wxWidgets3/include/wx/osx/evtloop.h b/Externals/wxWidgets3/include/wx/osx/evtloop.h index f427594d59..26c75a7ac5 100644 --- a/Externals/wxWidgets3/include/wx/osx/evtloop.h +++ b/Externals/wxWidgets3/include/wx/osx/evtloop.h @@ -6,7 +6,7 @@ // Author: Vadim Zeitlin // Modified by: // Created: 2006-01-12 -// RCS-ID: $Id: evtloop.h 65680 2010-09-30 11:44:45Z VZ $ +// RCS-ID: $Id: evtloop.h 67724 2011-05-11 06:46:07Z SC $ // Copyright: (c) 2006 Vadim Zeitlin // Licence: wxWindows licence /////////////////////////////////////////////////////////////////////////////// @@ -53,9 +53,14 @@ public: AddSourceForFD(int fd, wxEventLoopSourceHandler *handler, int flags); #endif // wxUSE_EVENTLOOP_SOURCE - void ObserverCallBack(CFRunLoopObserverRef observer, int activity); protected: + void CommonModeObserverCallBack(CFRunLoopObserverRef observer, int activity); + void DefaultModeObserverCallBack(CFRunLoopObserverRef observer, int activity); + + static void OSXCommonModeObserverCallBack(CFRunLoopObserverRef observer, int activity, void *info); + static void OSXDefaultModeObserverCallBack(CFRunLoopObserverRef observer, int activity, void *info); + // get the currently executing CFRunLoop virtual CFRunLoopRef CFGetCurrentRunLoop() const; @@ -74,8 +79,11 @@ protected: // cfrunloop CFRunLoopRef m_runLoop; - // runloop observer - CFRunLoopObserverRef m_runLoopObserver; + // common modes runloop observer + CFRunLoopObserverRef m_commonModeRunLoopObserver; + + // default mode runloop observer + CFRunLoopObserverRef m_defaultModeRunLoopObserver; private: // process all already pending events and dispatch a new one (blocking diff --git a/Externals/wxWidgets3/include/wx/osx/filedlg.h b/Externals/wxWidgets3/include/wx/osx/filedlg.h index 4ac1d59404..6dbc0cb50c 100644 --- a/Externals/wxWidgets3/include/wx/osx/filedlg.h +++ b/Externals/wxWidgets3/include/wx/osx/filedlg.h @@ -4,7 +4,7 @@ // Author: Stefan Csomor // Modified by: // Created: 1998-01-01 -// RCS-ID: $Id: filedlg.h 67254 2011-03-20 00:14:35Z DS $ +// RCS-ID: $Id: filedlg.h 67896 2011-06-09 00:28:28Z SC $ // Copyright: (c) Stefan Csomor // Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// @@ -41,6 +41,10 @@ public: const wxSize& sz = wxDefaultSize, const wxString& name = wxFileDialogNameStr); +#if wxOSX_USE_COCOA + ~wxFileDialog(); +#endif + virtual void GetPaths(wxArrayString& paths) const { paths = m_paths; } virtual void GetFilenames(wxArrayString& files) const { files = m_fileNames ; } @@ -70,6 +74,7 @@ protected: #if wxOSX_USE_COCOA virtual wxWindow* CreateFilterPanel(wxWindow *extracontrol); + void DoOnFilterSelected(int index); virtual void OnFilterSelected(wxCommandEvent &event); wxArrayString m_filterExtensions; @@ -80,6 +85,7 @@ protected: int m_firstFileTypeFilter; wxArrayString m_currentExtensions; WX_NSObject m_delegate; + WX_NSObject m_sheetDelegate; #endif }; diff --git a/Externals/wxWidgets3/include/wx/osx/font.h b/Externals/wxWidgets3/include/wx/osx/font.h index fc53a77bc8..e1fe572e58 100644 --- a/Externals/wxWidgets3/include/wx/osx/font.h +++ b/Externals/wxWidgets3/include/wx/osx/font.h @@ -4,7 +4,7 @@ // Author: Julian Smart // Modified by: // Created: 01/02/97 -// RCS-ID: $Id: font.h 67254 2011-03-20 00:14:35Z DS $ +// RCS-ID: $Id: font.h 70445 2012-01-23 11:28:21Z VZ $ // Copyright: (c) Julian Smart // Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// @@ -79,6 +79,19 @@ public: SetPixelSize(pixelSize); } + wxFont(int pointSize, + wxFontFamily family, + int flags = wxFONTFLAG_DEFAULT, + const wxString& face = wxEmptyString, + wxFontEncoding encoding = wxFONTENCODING_DEFAULT) + { + Create(pointSize, family, + GetStyleFromFlags(flags), + GetWeightFromFlags(flags), + GetUnderlinedFromFlags(flags), + face, encoding); + } + bool Create(int size, wxFontFamily family, wxFontStyle style, diff --git a/Externals/wxWidgets3/include/wx/osx/fontdlg.h b/Externals/wxWidgets3/include/wx/osx/fontdlg.h index 81ecf877a7..966a8fa937 100644 --- a/Externals/wxWidgets3/include/wx/osx/fontdlg.h +++ b/Externals/wxWidgets3/include/wx/osx/fontdlg.h @@ -4,7 +4,7 @@ // Author: Ryan Norton // Modified by: // Created: 2004-09-25 -// RCS-ID: $Id: fontdlg.h 66615 2011-01-07 05:26:57Z PC $ +// RCS-ID: $Id: fontdlg.h 70497 2012-02-02 14:19:34Z VZ $ // Copyright: (c) Ryan Norton // Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// @@ -35,9 +35,11 @@ class WXDLLIMPEXP_CORE wxFontDialog : public wxDialog { public: wxFontDialog(); + wxFontDialog(wxWindow *parent); wxFontDialog(wxWindow *parent, const wxFontData& data); virtual ~wxFontDialog(); + bool Create(wxWindow *parent); bool Create(wxWindow *parent, const wxFontData& data); int ShowModal(); diff --git a/Externals/wxWidgets3/include/wx/osx/frame.h b/Externals/wxWidgets3/include/wx/osx/frame.h index 08d91de60e..ca6ffb51da 100644 --- a/Externals/wxWidgets3/include/wx/osx/frame.h +++ b/Externals/wxWidgets3/include/wx/osx/frame.h @@ -4,7 +4,7 @@ // Author: Stefan Csomor // Modified by: // Created: 1998-01-01 -// RCS-ID: $Id: frame.h 67254 2011-03-20 00:14:35Z DS $ +// RCS-ID: $Id: frame.h 70765 2012-03-01 15:04:42Z JS $ // Copyright: (c) Stefan Csomor // Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// @@ -59,7 +59,6 @@ public: // event handlers void OnActivate(wxActivateEvent& event); void OnSysColourChanged(wxSysColourChangedEvent& event); - void OnSize(wxSizeEvent& event); // Toolbar #if wxUSE_TOOLBAR @@ -84,6 +83,8 @@ public: void PositionBars(); + // internal response to size events + virtual void MacOnInternalSize() { PositionBars(); } protected: // common part of all ctors diff --git a/Externals/wxWidgets3/include/wx/osx/iphone/chkconf.h b/Externals/wxWidgets3/include/wx/osx/iphone/chkconf.h index ccbe8206f6..c402458f67 100644 --- a/Externals/wxWidgets3/include/wx/osx/iphone/chkconf.h +++ b/Externals/wxWidgets3/include/wx/osx/iphone/chkconf.h @@ -4,7 +4,7 @@ * Author: Stefan Csomor * Modified by: * Created: 2008-07-30 - * RCS-ID: $Id: chkconf.h 67232 2011-03-18 15:10:15Z DS $ + * RCS-ID: $Id: chkconf.h 69818 2011-11-25 14:37:03Z SC $ * Copyright: (c) Stefan Csomor * Licence: wxWindows licence */ @@ -66,6 +66,11 @@ #define wxUSE_DATAVIEWCTRL 0 #endif +#if wxUSE_TREELISTCTRL +#undef wxUSE_TREELISTCTRL +#define wxUSE_TREELISTCTRL 0 +#endif + #if wxUSE_DRAG_AND_DROP #undef wxUSE_DRAG_AND_DROP #define wxUSE_DRAG_AND_DROP 0 @@ -348,6 +353,16 @@ #define wxUSE_RICHTEXT 0 #endif +#if wxUSE_TIMEPICKCTRL +#undef wxUSE_TIMEPICKCTRL +#define wxUSE_TIMEPICKCTRL 0 +#endif + +#if wxUSE_RICHTOOLTIP +#undef wxUSE_RICHTOOLTIP +#define wxUSE_RICHTOOLTIP 0 +#endif + #endif /* _WX_OSX_IPHONE_CHKCONF_H_ */ diff --git a/Externals/wxWidgets3/include/wx/osx/joystick.h b/Externals/wxWidgets3/include/wx/osx/joystick.h index 3608bc1cea..d9d2f06481 100644 --- a/Externals/wxWidgets3/include/wx/osx/joystick.h +++ b/Externals/wxWidgets3/include/wx/osx/joystick.h @@ -4,7 +4,7 @@ // Author: Stefan Csomor // Modified by: // Created: 1998-01-01 -// RCS-ID: $Id: joystick.h 67254 2011-03-20 00:14:35Z DS $ +// RCS-ID: $Id: joystick.h 70165 2011-12-29 14:42:13Z SN $ // Copyright: (c) Stefan Csomor // Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// @@ -22,7 +22,7 @@ class WXDLLIMPEXP_ADV wxJoystick: public wxObject * Public interface */ - wxJoystick(int joystick = wxJOYSTICK1) { m_joystick = joystick; }; + wxJoystick(int joystick = wxJOYSTICK1) { m_joystick = joystick; } // Attributes //////////////////////////////////////////////////////////////////////////// diff --git a/Externals/wxWidgets3/include/wx/osx/listctrl.h b/Externals/wxWidgets3/include/wx/osx/listctrl.h index 7b55e8ff6c..b0412f25f7 100644 --- a/Externals/wxWidgets3/include/wx/osx/listctrl.h +++ b/Externals/wxWidgets3/include/wx/osx/listctrl.h @@ -4,7 +4,7 @@ // Author: Stefan Csomor // Modified by: // Created: 1998-01-01 -// RCS-ID: $Id: listctrl.h 67254 2011-03-20 00:14:35Z DS $ +// RCS-ID: $Id: listctrl.h 70290 2012-01-08 00:55:22Z VZ $ // Copyright: (c) Stefan Csomor // Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// @@ -23,7 +23,7 @@ class wxListCtrlRenameTimer; WX_DECLARE_EXPORTED_LIST(wxListItem, wxColumnList); -class WXDLLIMPEXP_CORE wxListCtrl: public wxControl +class WXDLLIMPEXP_CORE wxListCtrl: public wxListCtrlBase { DECLARE_DYNAMIC_CLASS(wxListCtrl) public: @@ -63,8 +63,7 @@ class WXDLLIMPEXP_CORE wxListCtrl: public wxControl bool GetColumn(int col, wxListItem& item) const; // Sets information about this column - // TODO: NOT const to be compatible with wxGenericListCtrl API - bool SetColumn(int col, wxListItem& item) ; + bool SetColumn(int col, const wxListItem& item) ; // Gets the column width int GetColumnWidth(int col) const; @@ -160,11 +159,6 @@ class WXDLLIMPEXP_CORE wxListCtrl: public wxControl // list or report view long GetTopItem() const ; - // are we in report mode? - bool InReportView() const { return HasFlag(wxLC_REPORT); } - - bool IsVirtual() const { return HasFlag(wxLC_VIRTUAL); } - // Add or remove a single window style void SetSingleStyle(long style, bool add = true) ; @@ -257,12 +251,6 @@ class WXDLLIMPEXP_CORE wxListCtrl: public wxControl // Insert an image/string item long InsertItem(long index, const wxString& label, int imageIndex); - // For list view mode (only), inserts a column. - long InsertColumn(long col, wxListItem& info); - - long InsertColumn(long col, const wxString& heading, int format = wxLIST_FORMAT_LEFT, - int width = -1); - // Scrolls the list control. If in icon, small icon or report view mode, // x specifies the number of pixels to scroll. If in list view mode, x // specifies the number of columns to scroll. @@ -314,10 +302,10 @@ class WXDLLIMPEXP_CORE wxListCtrl: public wxControl bool Update(long item); */ - void Command(wxCommandEvent& event) { ProcessCommand(event); }; + void Command(wxCommandEvent& event) { ProcessCommand(event); } - wxListCtrlCompare GetCompareFunc() { return m_compareFunc; }; - wxIntPtr GetCompareFuncData() { return m_compareFuncData; }; + wxListCtrlCompare GetCompareFunc() { return m_compareFunc; } + wxIntPtr GetCompareFuncData() { return m_compareFuncData; } // public overrides needed for pimpl approach @@ -376,14 +364,14 @@ class WXDLLIMPEXP_CORE wxListCtrl: public wxControl GetClassDefaultAttributes(wxWindowVariant variant = wxWINDOW_VARIANT_NORMAL); protected: + // Implement base class pure virtual methods. + long DoInsertColumn(long col, const wxListItem& info); // protected overrides needed for pimpl approach virtual void DoSetSize(int x, int y, int width, int height, int sizeFlags = wxSIZE_AUTO); - virtual wxSize DoGetBestSize() const; - long m_current; wxListCtrlTextCtrlWrapper *m_textctrlWrapper; wxListCtrlRenameTimer *m_renameTimer; diff --git a/Externals/wxWidgets3/include/wx/osx/menu.h b/Externals/wxWidgets3/include/wx/osx/menu.h index fa62ad500a..6429ca657d 100644 --- a/Externals/wxWidgets3/include/wx/osx/menu.h +++ b/Externals/wxWidgets3/include/wx/osx/menu.h @@ -4,7 +4,7 @@ // Author: Stefan Csomor // Modified by: // Created: 1998-01-01 -// RCS-ID: $Id: menu.h 67254 2011-03-20 00:14:35Z DS $ +// RCS-ID: $Id: menu.h 70350 2012-01-15 13:41:17Z VZ $ // Copyright: (c) Stefan Csomor // Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// @@ -83,6 +83,10 @@ private: // terminate the current radio group, if any void EndRadioGroup(); + // Common part of HandleMenu{Opened,Closed}(). + void DoHandleMenuOpenedOrClosed(wxEventType evtType); + + // if TRUE, insert a breal before appending the next item bool m_doBreak; @@ -127,6 +131,7 @@ public: virtual wxMenu *Remove(size_t pos); virtual void EnableTop( size_t pos, bool flag ); + virtual bool IsEnabledTop(size_t pos) const; virtual void SetMenuLabel( size_t pos, const wxString& label ); virtual wxString GetMenuLabel( size_t pos ) const; virtual bool Enable( bool enable = true ); diff --git a/Externals/wxWidgets3/include/wx/osx/metafile.h b/Externals/wxWidgets3/include/wx/osx/metafile.h index 646f60462f..2a7e13e252 100644 --- a/Externals/wxWidgets3/include/wx/osx/metafile.h +++ b/Externals/wxWidgets3/include/wx/osx/metafile.h @@ -6,7 +6,7 @@ // Author: Stefan Csomor // Modified by: // Created: 1998-01-01 -// RCS-ID: $Id: metafile.h 67254 2011-03-20 00:14:35Z DS $ +// RCS-ID: $Id: metafile.h 70710 2012-02-27 15:37:24Z SC $ // Copyright: (c) Stefan Csomor // Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// @@ -56,13 +56,6 @@ public: // Implementation WXHMETAFILE GetHMETAFILE() const ; void SetHMETAFILE(WXHMETAFILE mf) ; -#if wxOSX_USE_COCOA_OR_CARBON && !defined( __LP64__ ) - // Since the native metafile format is PDF for Quartz - // we need a call that allows setting PICT content for - // backwards compatibility - void SetPICT(void* pictHandle) ; -#endif - protected: virtual wxGDIRefData *CreateGDIRefData() const; virtual wxGDIRefData *CloneGDIRefData(const wxGDIRefData *data) const; @@ -145,7 +138,7 @@ class WXDLLIMPEXP_CORE wxMetafileDataObject : public wxDataObjectSimple public: // ctors wxMetafileDataObject() - : wxDataObjectSimple(wxDF_METAFILE) { }; + : wxDataObjectSimple(wxDF_METAFILE) { } wxMetafileDataObject(const wxMetafile& metafile) : wxDataObjectSimple(wxDF_METAFILE), m_metafile(metafile) { } diff --git a/Externals/wxWidgets3/include/wx/osx/msgdlg.h b/Externals/wxWidgets3/include/wx/osx/msgdlg.h index 00b096e920..173cab4994 100644 --- a/Externals/wxWidgets3/include/wx/osx/msgdlg.h +++ b/Externals/wxWidgets3/include/wx/osx/msgdlg.h @@ -5,7 +5,7 @@ // Author: Stefan Csomor // Modified by: // Created: 1998-01-01 -// RCS-ID: $Id: msgdlg.h 65680 2010-09-30 11:44:45Z VZ $ +// RCS-ID: $Id: msgdlg.h 68537 2011-08-04 22:53:42Z VZ $ // Copyright: (c) Stefan Csomor // Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// @@ -22,6 +22,10 @@ public: long style = wxOK|wxCENTRE, const wxPoint& pos = wxDefaultPosition); +#if wxOSX_USE_COCOA + ~wxMessageDialog(); +#endif + virtual int ShowModal(); #if wxOSX_USE_COCOA @@ -39,9 +43,12 @@ protected: void* ConstructNSAlert(); #endif - int m_buttonId[3]; + int m_buttonId[4]; int m_buttonCount; +#if wxOSX_USE_COCOA + WX_NSObject m_sheetDelegate; +#endif DECLARE_DYNAMIC_CLASS(wxMessageDialog) }; diff --git a/Externals/wxWidgets3/include/wx/osx/nonownedwnd.h b/Externals/wxWidgets3/include/wx/osx/nonownedwnd.h index 8c674bfce2..b6b014f30b 100644 --- a/Externals/wxWidgets3/include/wx/osx/nonownedwnd.h +++ b/Externals/wxWidgets3/include/wx/osx/nonownedwnd.h @@ -4,7 +4,7 @@ // Author: Stefan Csomor // Modified by: // Created: 2008-03-24 -// RCS-ID: $Id: nonownedwnd.h 67232 2011-03-18 15:10:15Z DS $ +// RCS-ID: $Id: nonownedwnd.h 70488 2012-01-31 17:39:39Z SC $ // Copyright: (c) 2008 Stefan Csomor // Licence: wxWindows licence /////////////////////////////////////////////////////////////////////////////// @@ -14,6 +14,8 @@ #include "wx/window.h" +#include "wx/graphics.h" + #if wxUSE_SYSTEM_OPTIONS #define wxMAC_WINDOW_PLAIN_TRANSITION wxT("mac.window-plain-transition") #endif @@ -30,7 +32,7 @@ class wxNonOwnedWindowImpl; -class WXDLLIMPEXP_CORE wxNonOwnedWindow : public wxWindow +class WXDLLIMPEXP_CORE wxNonOwnedWindow : public wxNonOwnedWindowBase { public: // constructors and such @@ -79,8 +81,11 @@ public: // implementation from now on // -------------------------- - virtual bool DoSetShape(const wxRegion& region); + // These accessors are Mac-specific and don't exist in other ports. const wxRegion& GetShape() const { return m_shape; } +#if wxUSE_GRAPHICS_CONTEXT + const wxGraphicsPath& GetShapePath() { return m_shapePath; } +#endif // wxUSE_GRAPHICS_CONTEXT // activation hooks only necessary for MDI Implementation static void MacDelayedDeactivation(long timestamp); @@ -109,6 +114,8 @@ public: virtual void HandleResized( double timestampsec ); virtual void HandleMoved( double timestampsec ); virtual void HandleResizing( double timestampsec, wxRect* rect ); + + void WindowWasPainted(); virtual bool Destroy(); @@ -125,6 +132,12 @@ protected: wxShowEffect effect, unsigned timeout); + virtual bool DoClearShape(); + virtual bool DoSetRegionShape(const wxRegion& region); +#if wxUSE_GRAPHICS_CONTEXT + virtual bool DoSetPathShape(const wxGraphicsPath& path); +#endif // wxUSE_GRAPHICS_CONTEXT + virtual void WillBeDestroyed(); wxNonOwnedWindowImpl* m_nowpeer ; @@ -134,7 +147,12 @@ protected: static wxNonOwnedWindow *s_macDeactivateWindow; private : + static clock_t s_lastFlush; + wxRegion m_shape; +#if wxUSE_GRAPHICS_CONTEXT + wxGraphicsPath m_shapePath; +#endif // wxUSE_GRAPHICS_CONTEXT }; // list of all frames and modeless dialogs diff --git a/Externals/wxWidgets3/include/wx/osx/notebook.h b/Externals/wxWidgets3/include/wx/osx/notebook.h index 8dd48fd9ca..62a1accc33 100644 --- a/Externals/wxWidgets3/include/wx/osx/notebook.h +++ b/Externals/wxWidgets3/include/wx/osx/notebook.h @@ -3,7 +3,7 @@ // Purpose: MSW/GTK compatible notebook (a.k.a. property sheet) // Author: Stefan Csomor // Modified by: -// RCS-ID: $Id: notebook.h 67254 2011-03-20 00:14:35Z DS $ +// RCS-ID: $Id: notebook.h 68810 2011-08-21 14:08:49Z VZ $ // Copyright: (c) Stefan Csomor // Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// @@ -95,7 +95,7 @@ public: wxNotebookPage *pPage, const wxString& strText, bool bSelect = false, - int imageId = -1); + int imageId = NO_IMAGE); // callbacks // --------- diff --git a/Externals/wxWidgets3/include/wx/osx/pnghand.h b/Externals/wxWidgets3/include/wx/osx/pnghand.h index ce2a8d6daf..135725528b 100644 --- a/Externals/wxWidgets3/include/wx/osx/pnghand.h +++ b/Externals/wxWidgets3/include/wx/osx/pnghand.h @@ -4,7 +4,7 @@ // Author: Julian Smart // Modified by: // Created: 04/01/98 -// RCS-ID: $Id: pnghand.h 67254 2011-03-20 00:14:35Z DS $ +// RCS-ID: $Id: pnghand.h 70165 2011-12-29 14:42:13Z SN $ // Copyright: (c) Julian Smart // Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// @@ -25,7 +25,7 @@ public: SetName(wxT("PNG bitmap file")); SetExtension(wxT("bmp")); SetType(wxBITMAP_TYPE_PNG); - }; + } virtual bool LoadFile(wxBitmap *bitmap, const wxString& name, long flags, int desiredWidth, int desiredHeight); diff --git a/Externals/wxWidgets3/include/wx/osx/pngread.h b/Externals/wxWidgets3/include/wx/osx/pngread.h index 222a2c5589..bdf466b8a3 100644 --- a/Externals/wxWidgets3/include/wx/osx/pngread.h +++ b/Externals/wxWidgets3/include/wx/osx/pngread.h @@ -61,10 +61,10 @@ public: bool ReadFile( char* ImageFileName=0 ); bool SaveFile( char* ImageFileName=0 ); bool SaveXPM(char *filename, char *name = 0); - int GetWidth( void ) const { return Width; }; - int GetHeight( void ) const { return Height; }; - int GetDepth( void ) const { return Depth; }; - int GetColorType( void ) const { return ColorType; }; + int GetWidth( void ) const { return Width; } + int GetHeight( void ) const { return Height; } + int GetDepth( void ) const { return Depth; } + int GetColorType( void ) const { return ColorType; } int GetIndex(int x, int y); bool GetRGB(int x, int y, byte* r, byte* g, byte* b); diff --git a/Externals/wxWidgets3/include/wx/osx/popupwin.h b/Externals/wxWidgets3/include/wx/osx/popupwin.h index caeaa004f5..3027d5f26c 100644 --- a/Externals/wxWidgets3/include/wx/osx/popupwin.h +++ b/Externals/wxWidgets3/include/wx/osx/popupwin.h @@ -4,7 +4,7 @@ // Author: Stefan Csomor // Modified by: // Created: -// RCS-ID: $Id: popupwin.h 65680 2010-09-30 11:44:45Z VZ $ +// RCS-ID: $Id: popupwin.h 70848 2012-03-09 05:50:58Z PC $ // Copyright: (c) 2006 Stefan Csomor // Licence: wxWindows licence /////////////////////////////////////////////////////////////////////////////// @@ -27,9 +27,8 @@ public: bool Create(wxWindow *parent, int flags = wxBORDER_NONE); - virtual bool Show(bool show); + virtual bool Show(bool show = true); -protected: DECLARE_DYNAMIC_CLASS_NO_COPY(wxPopupWindow) }; diff --git a/Externals/wxWidgets3/include/wx/osx/printdlg.h b/Externals/wxWidgets3/include/wx/osx/printdlg.h index 459a1d4e23..ab87b870e0 100644 --- a/Externals/wxWidgets3/include/wx/osx/printdlg.h +++ b/Externals/wxWidgets3/include/wx/osx/printdlg.h @@ -6,7 +6,7 @@ // Author: Stefan Csomor // Modified by: // Created: 1998-01-01 -// RCS-ID: $Id: printdlg.h 64943 2010-07-13 13:29:58Z VZ $ +// RCS-ID: $Id: printdlg.h 70636 2012-02-20 21:55:55Z VZ $ // Copyright: (c) Stefan Csomor // Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// @@ -58,16 +58,16 @@ private: class WXDLLIMPEXP_CORE wxMacPageSetupDialog: public wxPageSetupDialogBase { public: - wxMacPageSetupDialog(wxWindow *parent, wxPageSetupData *data = NULL); + wxMacPageSetupDialog(wxWindow *parent, wxPageSetupDialogData *data = NULL); virtual ~wxMacPageSetupDialog(); - virtual wxPageSetupData& GetPageSetupDialogData(); + virtual wxPageSetupDialogData& GetPageSetupDialogData(); - bool Create(wxWindow *parent, wxPageSetupData *data = NULL); + bool Create(wxWindow *parent, wxPageSetupDialogData *data = NULL); virtual int ShowModal(); private: - wxPageSetupData m_pageSetupData; + wxPageSetupDialogData m_pageSetupData; wxWindow* m_dialogParent; private: @@ -85,14 +85,14 @@ class WXDLLIMPEXP_FWD_CORE wxTextCtrl; class WXDLLIMPEXP_CORE wxMacPageMarginsDialog : public wxDialog { public: - wxMacPageMarginsDialog(wxFrame* parent, wxPageSetupData* data); + wxMacPageMarginsDialog(wxFrame* parent, wxPageSetupDialogData* data); bool TransferToWindow(); bool TransferDataFromWindow(); - virtual wxPageSetupData& GetPageSetupDialogData() { return *m_pageSetupDialogData; } + virtual wxPageSetupDialogData& GetPageSetupDialogData() { return *m_pageSetupDialogData; } private: - wxPageSetupData* m_pageSetupDialogData; + wxPageSetupDialogData* m_pageSetupDialogData; wxPoint m_MinMarginTopLeft; wxPoint m_MinMarginBottomRight; diff --git a/Externals/wxWidgets3/include/wx/osx/radiobox.h b/Externals/wxWidgets3/include/wx/osx/radiobox.h index 8738e2514e..5ca8856e20 100644 --- a/Externals/wxWidgets3/include/wx/osx/radiobox.h +++ b/Externals/wxWidgets3/include/wx/osx/radiobox.h @@ -4,7 +4,7 @@ // Author: Stefan Csomor // Modified by: // Created: 1998-01-01 -// RCS-ID: $Id: radiobox.h 64943 2010-07-13 13:29:58Z VZ $ +// RCS-ID: $Id: radiobox.h 69544 2011-10-26 05:39:18Z RD $ // Copyright: (c) Stefan Csomor // Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// @@ -89,6 +89,9 @@ public: void OnRadioButton( wxCommandEvent& event ) ; protected: + // resolve ambiguity in base classes + virtual wxBorder GetDefaultBorder() const { return wxRadioBoxBase::GetDefaultBorder(); } + wxRadioButton *m_radioButtonCycle; unsigned int m_noItems; diff --git a/Externals/wxWidgets3/include/wx/osx/setup0.h b/Externals/wxWidgets3/include/wx/osx/setup0.h index 15da2d8110..46bad79d19 100644 --- a/Externals/wxWidgets3/include/wx/osx/setup0.h +++ b/Externals/wxWidgets3/include/wx/osx/setup0.h @@ -4,7 +4,7 @@ // Author: Stefan Csomor // Modified by: Stefan Csomor // Created: 1998-01-01 -// RCS-ID: $Id: setup0.h 67254 2011-03-20 00:14:35Z DS $ +// RCS-ID: $Id: setup0.h 70395 2012-01-19 08:55:41Z SC $ // Copyright: (c) Stefan Csomor // Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// @@ -202,15 +202,6 @@ // Recommended setting: 0 (this is still work in progress...) #define wxUSE_EXTENDED_RTTI 0 -// Set wxUSE_STL to 1 to derive wxList(Foo) and wxArray(Foo) from -// std::list and std::vector, with a compatibility interface, -// and for wxHashMap to be implemented with templates. -// -// Default is 0 -// -// Recommended setting: YMMV -#define wxUSE_STL 0 - // Support for message/error logging. This includes wxLogXXX() functions and // wxLog and derived classes. Don't set this to 0 unless you really know what // you are doing. @@ -262,44 +253,6 @@ // Recommended setting: 1 as setting it to 0 disables many other things #define wxUSE_STREAMS 1 -// This is not a real option but is used as the default value for -// wxUSE_STD_IOSTREAM and wxUSE_STD_STRING. -// -// Currently the Digital Mars and Watcom compilers come without standard C++ -// library headers by default, wxUSE_STD_STRING can be set to 1 if you do have -// them (e.g. from STLPort). -// -// VC++ 5.0 does include standard C++ library headers, however they produce -// many warnings that can't be turned off when compiled at warning level 4. -#if defined(__DMC__) || defined(__WATCOMC__) \ - || (defined(_MSC_VER) && _MSC_VER < 1200) - #define wxUSE_STD_DEFAULT 0 -#else - #define wxUSE_STD_DEFAULT 1 -#endif - -// Use standard C++ streams if 1 instead of wx streams in some places. If -// disabled (default), wx streams are used everywhere and wxWidgets doesn't -// depend on the standard streams library. -// -// Notice that enabling this does not replace wx streams with std streams -// everywhere, in a lot of places wx streams are used no matter what. -// -// Default is 0 -// -// Recommended setting: 1 if you use the standard streams anyhow and so -// dependency on the standard streams library is not a -// problem -#define wxUSE_STD_IOSTREAM wxUSE_STD_DEFAULT - -// Enable conversion to standard C++ string if 1. -// -// Default is 1 for most compilers. -// -// Recommended setting: 1 unless you want to ensure your program doesn't use -// the standard C++ library at all. -#define wxUSE_STD_STRING wxUSE_STD_DEFAULT - // Support for positional parameters (e.g. %1$d, %2$s ...) in wxVsnprintf. // Note that if the system's implementation does not support positional // parameters, setting this to 1 forces the use of the wxWidgets implementation @@ -315,6 +268,107 @@ // Recommended setting: 1 if you want to support multiple languages #define wxUSE_PRINTF_POS_PARAMS 1 + +// ---------------------------------------------------------------------------- +// Interoperability with the standard library. +// ---------------------------------------------------------------------------- + +// Set wxUSE_STL to 1 to enable maximal interoperability with the standard +// library, even at the cost of backwards compatibility. +// +// Default is 0 +// +// Recommended setting: 0 as the options below already provide a relatively +// good level of interoperability and changing this option arguably isn't worth +// diverging from the official builds of the library. +#define wxUSE_STL 0 + +// This is not a real option but is used as the default value for +// wxUSE_STD_IOSTREAM, wxUSE_STD_STRING and wxUSE_STD_CONTAINERS. +// +// Currently the Digital Mars and Watcom compilers come without standard C++ +// library headers by default, wxUSE_STD_STRING can be set to 1 if you do have +// them (e.g. from STLPort). +// +// VC++ 5.0 does include standard C++ library headers, however they produce +// many warnings that can't be turned off when compiled at warning level 4. +#if defined(__DMC__) || defined(__WATCOMC__) \ + || (defined(_MSC_VER) && _MSC_VER < 1200) + #define wxUSE_STD_DEFAULT 0 +#else + #define wxUSE_STD_DEFAULT 1 +#endif + +// Use standard C++ containers to implement wxVector<>, wxStack<>, wxDList<> +// and wxHashXXX<> classes. If disabled, wxWidgets own (mostly compatible but +// usually more limited) implementations are used which allows to avoid the +// dependency on the C++ run-time library. +// +// Notice that the compilers mentioned in wxUSE_STD_DEFAULT comment above don't +// support using standard containers and that VC6 needs non-default options for +// such build to avoid getting "fatal error C1076: compiler limit : internal +// heap limit reached; use /Zm to specify a higher limit" in its own standard +// headers, so you need to ensure you do increase the heap size before enabling +// this option for this compiler. +// +// Default is 0 for compatibility reasons. +// +// Recommended setting: 1 unless compatibility with the official wxWidgets +// build and/or the existing code is a concern. +#define wxUSE_STD_CONTAINERS 0 + +// Use standard C++ streams if 1 instead of wx streams in some places. If +// disabled, wx streams are used everywhere and wxWidgets doesn't depend on the +// standard streams library. +// +// Notice that enabling this does not replace wx streams with std streams +// everywhere, in a lot of places wx streams are used no matter what. +// +// Default is 1 if compiler supports it. +// +// Recommended setting: 1 if you use the standard streams anyhow and so +// dependency on the standard streams library is not a +// problem +#define wxUSE_STD_IOSTREAM wxUSE_STD_DEFAULT + +// Enable minimal interoperability with the standard C++ string class if 1. +// "Minimal" means that wxString can be constructed from std::string or +// std::wstring but can't be implicitly converted to them. You need to enable +// the option below for the latter. +// +// Default is 1 for most compilers. +// +// Recommended setting: 1 unless you want to ensure your program doesn't use +// the standard C++ library at all. +#define wxUSE_STD_STRING wxUSE_STD_DEFAULT + +// Make wxString as much interchangeable with std::[w]string as possible, in +// particular allow implicit conversion of wxString to either of these classes. +// This comes at a price (or a benefit, depending on your point of view) of not +// allowing implicit conversion to "const char *" and "const wchar_t *". +// +// Because a lot of existing code relies on these conversions, this option is +// disabled by default but can be enabled for your build if you don't care +// about compatibility. +// +// Default is 0 if wxUSE_STL has its default value or 1 if it is enabled. +// +// Recommended setting: 0 to remain compatible with the official builds of +// wxWidgets. +#define wxUSE_STD_STRING_CONV_IN_WXSTRING wxUSE_STL + +// VC++ 4.2 and above allows and but you can't mix +// them. Set this option to 1 to use , 0 to use . +// +// Note that newer compilers (including VC++ 7.1 and later) don't support +// wxUSE_IOSTREAMH == 1 and so will be used anyhow. +// +// Default is 0. +// +// Recommended setting: 0, only set to 1 if you use a really old compiler +#define wxUSE_IOSTREAMH 0 + + // ---------------------------------------------------------------------------- // non GUI features selection // ---------------------------------------------------------------------------- @@ -652,6 +706,34 @@ // Recommended setting: 1 #define wxUSE_STC 1 +// Use wxWidget's web viewing classes +// +// Default is 1 +// +// Recommended setting: 1 +#define wxUSE_WEBVIEW 1 + +// Use the IE wxWebView backend +// +// Default is 1 on MSW +// +// Recommended setting: 1 +#ifdef __WXMSW__ +#define wxUSE_WEBVIEW_IE 1 +#else +#define wxUSE_WEBVIEW_IE 0 +#endif + +// Use the WebKit wxWebView backend +// +// Default is 1 on GTK and OSX +// +// Recommended setting: 1 +#if defined(__WXGTK__) || defined(__WXOSX__) +#define wxUSE_WEBVIEW_WEBKIT 1 +#else +#define wxUSE_WEBVIEW_WEBKIT 0 +#endif // Enable the new wxGraphicsPath and wxGraphicsContext classes for an advanced // 2D drawing API. (Still somewhat experimental) @@ -750,6 +832,7 @@ // // Recommended setting: 1 #define wxUSE_ANIMATIONCTRL 1 // wxAnimationCtrl +#define wxUSE_BANNERWINDOW 1 // wxBannerWindow #define wxUSE_BUTTON 1 // wxButton #define wxUSE_BMPBUTTON 1 // wxBitmapButton #define wxUSE_CALENDARCTRL 1 // wxCalendarCtrl @@ -785,8 +868,10 @@ #define wxUSE_STATTEXT 1 // wxStaticText #define wxUSE_STATBMP 1 // wxStaticBitmap #define wxUSE_TEXTCTRL 1 // wxTextCtrl +#define wxUSE_TIMEPICKCTRL 1 // wxTimePickerCtrl #define wxUSE_TOGGLEBTN 1 // requires wxButton #define wxUSE_TREECTRL 1 // wxTreeCtrl +#define wxUSE_TREELISTCTRL 1 // wxTreeListCtrl // Use a status bar class? Depending on the value of wxUSE_NATIVE_STATUSBAR // below either wxStatusBar95 or a generic wxStatusBar will be used. @@ -1003,6 +1088,14 @@ // Recommended setting: 1 #define wxUSE_NOTIFICATION_MESSAGE 1 +// wxRichToolTip is a customizable tooltip class which has more functionality +// than the stock (but native, unlike this class) wxToolTip. +// +// Default is 1. +// +// Recommended setting: 1 (but can be safely set to 0 if you don't need it) +#define wxUSE_RICHTOOLTIP 1 + // Use wxSashWindow class. // // Default is 1. @@ -1308,28 +1401,15 @@ // to create files in SVG (Scalable Vector Graphics) format. #define wxUSE_SVG 1 -// ---------------------------------------------------------------------------- -// other compiler (mis)features -// ---------------------------------------------------------------------------- - -// Set this to 0 if your compiler can't cope with omission of prototype -// parameters. +// Should wxDC provide SetTransformMatrix() and related methods? // -// Default is 1. +// Default is 1 but can be set to 0 if this functionality is not used. Notice +// that currently only wxMSW supports this so setting this to 0 doesn't change +// much for non-MSW platforms (although it will still save a few bytes +// probably). // -// Recommended setting: 1 (should never need to set this to 0) -#define REMOVE_UNUSED_ARG 1 - -// VC++ 4.2 and above allows and but you can't mix -// them. Set this option to 1 to use , 0 to use . -// -// Note that newer compilers (including VC++ 7.1 and later) don't support -// wxUSE_IOSTREAMH == 1 and so will be used anyhow. -// -// Default is 0. -// -// Recommended setting: 0, only set to 1 if you use a really old compiler -#define wxUSE_IOSTREAMH 0 +// Recommended setting: 1. +#define wxUSE_DC_TRANSFORM_MATRIX 1 // ---------------------------------------------------------------------------- // image format support @@ -1397,6 +1477,26 @@ /* --- end common options --- */ +// ---------------------------------------------------------------------------- +// Unix-specific options settings +// ---------------------------------------------------------------------------- + +// use wxSelectDispatcher class +#define wxUSE_SELECT_DISPATCHER 1 + +// use wxEpollDispatcher class (Linux only) +#define wxUSE_EPOLL_DISPATCHER 0 + +/* + Use GStreamer for Unix. + + Default is 0 as this requires a lot of dependencies which might not be + available. + + Recommended setting: 1 (wxMediaCtrl won't work by default without it). + */ +#define wxUSE_GSTREAMER 0 + // ---------------------------------------------------------------------------- // Mac-specific settings // ---------------------------------------------------------------------------- diff --git a/Externals/wxWidgets3/include/wx/osx/sound.h b/Externals/wxWidgets3/include/wx/osx/sound.h index 1318e76315..45538773d0 100644 --- a/Externals/wxWidgets3/include/wx/osx/sound.h +++ b/Externals/wxWidgets3/include/wx/osx/sound.h @@ -5,7 +5,7 @@ // Author: Ryan Norton, Stefan Csomor // Modified by: // Created: 1998-01-01 -// RCS-ID: $Id: sound.h 67254 2011-03-20 00:14:35Z DS $ +// RCS-ID: $Id: sound.h 69178 2011-09-21 15:08:02Z VZ $ // Copyright: (c) Ryan Norton, Stefan Csomor // Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// @@ -49,13 +49,13 @@ class WXDLLIMPEXP_ADV wxSound : public wxSoundBase public: wxSound(); wxSound(const wxString& fileName, bool isResource = false); - wxSound(int size, const wxByte* data); + wxSound(size_t size, const void* data); virtual ~wxSound(); // Create from resource or file bool Create(const wxString& fileName, bool isResource = false); // Create from data - bool Create(int size, const wxByte* data); + bool Create(size_t size, const void* data); bool IsOk() const { return m_data != NULL; } diff --git a/Externals/wxWidgets3/include/wx/osx/spinctrl.h b/Externals/wxWidgets3/include/wx/osx/spinctrl.h index c274fb33f2..3803f9d526 100644 --- a/Externals/wxWidgets3/include/wx/osx/spinctrl.h +++ b/Externals/wxWidgets3/include/wx/osx/spinctrl.h @@ -4,7 +4,7 @@ // Author: Vadim Zeitlin // Modified by: // Created: 28.10.99 -// RCS-ID: $Id: spinctrl.h 67254 2011-03-20 00:14:35Z DS $ +// RCS-ID: $Id: spinctrl.h 68366 2011-07-24 22:19:33Z VZ $ // Copyright: (c) Vadim Zeitlin // Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// @@ -33,7 +33,7 @@ class WXDLLIMPEXP_FWD_CORE wxSpinCtrlButton; // wxSpinCtrl is a combination of wxTextCtrl and wxSpinButton // ---------------------------------------------------------------------------- -class WXDLLIMPEXP_CORE wxSpinCtrl : public wxControl +class WXDLLIMPEXP_CORE wxSpinCtrl : public wxNavigationEnabled { public: wxSpinCtrl() { Init(); } @@ -93,8 +93,6 @@ public: // number is out of range bool GetTextValue(int *val) const; - WX_DECLARE_CONTROL_CONTAINER(); - protected: // override the base class virtuals involved into geometry calculations virtual wxSize DoGetBestSize() const; @@ -113,7 +111,6 @@ private: int m_oldValue; private: - DECLARE_EVENT_TABLE() DECLARE_DYNAMIC_CLASS(wxSpinCtrl) }; diff --git a/Externals/wxWidgets3/include/wx/osx/statbox.h b/Externals/wxWidgets3/include/wx/osx/statbox.h index df046443fe..cdbdead32e 100644 --- a/Externals/wxWidgets3/include/wx/osx/statbox.h +++ b/Externals/wxWidgets3/include/wx/osx/statbox.h @@ -4,7 +4,7 @@ // Author: Stefan Csomor // Modified by: // Created: 1998-01-01 -// RCS-ID: $Id: statbox.h 67254 2011-03-20 00:14:35Z DS $ +// RCS-ID: $Id: statbox.h 70165 2011-12-29 14:42:13Z SN $ // Copyright: (c) Stefan Csomor // Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// @@ -38,8 +38,8 @@ class WXDLLIMPEXP_CORE wxStaticBox: public wxControl long style = 0, const wxString& name = wxStaticBoxNameStr); - virtual void Command(wxCommandEvent& WXUNUSED(event)) {}; - virtual void ProcessCommand(wxCommandEvent& WXUNUSED(event)) {}; + virtual void Command(wxCommandEvent& WXUNUSED(event)) {} + virtual void ProcessCommand(wxCommandEvent& WXUNUSED(event)) {} virtual void GetBordersForSizer(int *borderTop, int *borderOther) const; diff --git a/Externals/wxWidgets3/include/wx/osx/textctrl.h b/Externals/wxWidgets3/include/wx/osx/textctrl.h index 411bfbf30e..70e0863c35 100644 --- a/Externals/wxWidgets3/include/wx/osx/textctrl.h +++ b/Externals/wxWidgets3/include/wx/osx/textctrl.h @@ -4,7 +4,7 @@ // Author: Stefan Csomor // Modified by: // Created: 1998-01-01 -// RCS-ID: $Id: textctrl.h 66770 2011-01-26 15:51:39Z SC $ +// RCS-ID: $Id: textctrl.h 70355 2012-01-15 15:54:53Z SC $ // Copyright: (c) Stefan Csomor // Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// @@ -75,10 +75,6 @@ public: virtual void MarkDirty(); virtual void DiscardEdits(); - // set the max number of characters which may be entered - // in a single line text control - virtual void SetMaxLength(unsigned long len); - // set the grayed out hint text virtual bool SetHint(const wxString& hint); virtual wxString GetHint() const; diff --git a/Externals/wxWidgets3/include/wx/osx/textentry.h b/Externals/wxWidgets3/include/wx/osx/textentry.h index 07ae94e81c..7a6a66f58b 100644 --- a/Externals/wxWidgets3/include/wx/osx/textentry.h +++ b/Externals/wxWidgets3/include/wx/osx/textentry.h @@ -4,7 +4,7 @@ // Author: Stefan Csomor // Modified by: Kevin Ollivier // Created: 1998-01-01 -// RCS-ID: $Id: textentry.h 67232 2011-03-18 15:10:15Z DS $ +// RCS-ID: $Id: textentry.h 67526 2011-04-17 23:14:15Z VZ $ // Copyright: (c) Stefan Csomor // Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// @@ -32,12 +32,8 @@ class WXDLLIMPEXP_CORE wxTextEntry: public wxTextEntryBase { public: - wxTextEntry() - : m_editable(true), - m_maxLength(0) - { } - - virtual ~wxTextEntry() {}; + wxTextEntry(); + virtual ~wxTextEntry(); virtual bool IsEditable() const; @@ -88,10 +84,18 @@ public: // -------------- virtual wxTextWidgetImpl * GetTextPeer() const; + wxTextCompleter *OSXGetCompleter() const { return m_completer; } + protected: virtual wxString DoGetValue() const; + virtual bool DoAutoCompleteStrings(const wxArrayString& choices); + virtual bool DoAutoCompleteCustom(wxTextCompleter *completer); + + // The object providing auto-completions or NULL if none. + wxTextCompleter *m_completer; + bool m_editable; // need to make this public because of the current implementation via callbacks diff --git a/Externals/wxWidgets3/include/wx/osx/tglbtn.h b/Externals/wxWidgets3/include/wx/osx/tglbtn.h index 9ea7406baa..e68a2ba60c 100644 --- a/Externals/wxWidgets3/include/wx/osx/tglbtn.h +++ b/Externals/wxWidgets3/include/wx/osx/tglbtn.h @@ -5,7 +5,7 @@ // Author: Stefan Csomor // Modified by: // Created: 08.02.01 -// RCS-ID: $Id: tglbtn.h 66992 2011-02-22 13:25:30Z VZ $ +// RCS-ID: $Id: tglbtn.h 67949 2011-06-16 00:43:22Z RD $ // Copyright: (c) 2004 Stefan Csomor // Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// @@ -13,53 +13,6 @@ #ifndef _WX_TOGGLEBUTTON_H_ #define _WX_TOGGLEBUTTON_H_ -class WXDLLIMPEXP_CORE wxBitmapToggleButton : public wxToggleButtonBase -{ -public: - wxBitmapToggleButton() {} - wxBitmapToggleButton(wxWindow *parent, - wxWindowID id, - const wxBitmap& label, - const wxPoint& pos = wxDefaultPosition, - const wxSize& size = wxDefaultSize, - long style = 0, - const wxValidator& validator = wxDefaultValidator, - const wxString& name = wxCheckBoxNameStr) - { - Create(parent, id, label, pos, size, style, validator, name); - } - - bool Create(wxWindow *parent, - wxWindowID id, - const wxBitmap& label, - const wxPoint& pos = wxDefaultPosition, - const wxSize& size = wxDefaultSize, - long style = 0, - const wxValidator& validator = wxDefaultValidator, - const wxString& name = wxCheckBoxNameStr); - - virtual void SetValue(bool value); - virtual bool GetValue() const ; - - virtual bool OSXHandleClicked( double timestampsec ); - - virtual void Command(wxCommandEvent& event); - -private: - wxBitmap m_bitmap; - - int m_marginX, - m_marginY; - -protected: - virtual wxBorder GetDefaultBorder() const { return wxBORDER_NONE; } - virtual wxSize DoGetBestSize() const; - -private: - DECLARE_DYNAMIC_CLASS_NO_COPY(wxBitmapToggleButton) -}; - - class WXDLLIMPEXP_CORE wxToggleButton : public wxToggleButtonBase { public: @@ -94,11 +47,40 @@ public: protected: virtual wxBorder GetDefaultBorder() const { return wxBORDER_NONE; } - virtual wxSize DoGetBestSize() const; private: DECLARE_DYNAMIC_CLASS_NO_COPY(wxToggleButton) }; + +class WXDLLIMPEXP_CORE wxBitmapToggleButton : public wxToggleButton +{ +public: + wxBitmapToggleButton() {} + wxBitmapToggleButton(wxWindow *parent, + wxWindowID id, + const wxBitmap& label, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + long style = 0, + const wxValidator& validator = wxDefaultValidator, + const wxString& name = wxCheckBoxNameStr) + { + Create(parent, id, label, pos, size, style, validator, name); + } + + bool Create(wxWindow *parent, + wxWindowID id, + const wxBitmap& label, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + long style = 0, + const wxValidator& validator = wxDefaultValidator, + const wxString& name = wxCheckBoxNameStr); + +private: + DECLARE_DYNAMIC_CLASS_NO_COPY(wxBitmapToggleButton) +}; + #endif // _WX_TOGGLEBUTTON_H_ diff --git a/Externals/wxWidgets3/include/wx/osx/timectrl.h b/Externals/wxWidgets3/include/wx/osx/timectrl.h new file mode 100644 index 0000000000..2d093acd54 --- /dev/null +++ b/Externals/wxWidgets3/include/wx/osx/timectrl.h @@ -0,0 +1,51 @@ +/////////////////////////////////////////////////////////////////////////////// +// Name: wx/osx/timectrl.h +// Purpose: Declaration of wxOSX-specific wxTimePickerCtrl class. +// Author: Vadim Zeitlin +// Created: 2011-12-18 +// RCS-ID: $Id: timectrl.h 70071 2011-12-20 21:27:14Z VZ $ +// Copyright: (c) 2011 Vadim Zeitlin +// Licence: wxWindows licence +/////////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_OSX_TIMECTRL_H_ +#define _WX_OSX_TIMECTRL_H_ + +// ---------------------------------------------------------------------------- +// wxTimePickerCtrl +// ---------------------------------------------------------------------------- + +class WXDLLIMPEXP_ADV wxTimePickerCtrl : public wxTimePickerCtrlBase +{ +public: + // Constructors. + wxTimePickerCtrl() { } + + wxTimePickerCtrl(wxWindow *parent, + wxWindowID id, + const wxDateTime& dt = wxDefaultDateTime, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + long style = wxTP_DEFAULT, + const wxValidator& validator = wxDefaultValidator, + const wxString& name = wxTimePickerCtrlNameStr) + { + Create(parent, id, dt, pos, size, style, validator, name); + } + + bool Create(wxWindow *parent, + wxWindowID id, + const wxDateTime& dt = wxDefaultDateTime, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + long style = wxTP_DEFAULT, + const wxValidator& validator = wxDefaultValidator, + const wxString& name = wxTimePickerCtrlNameStr); + + virtual void OSXGenerateEvent(const wxDateTime& dt); + +private: + wxDECLARE_DYNAMIC_CLASS_NO_COPY(wxTimePickerCtrl); +}; + +#endif // _WX_OSX_TIMECTRL_H_ diff --git a/Externals/wxWidgets3/include/wx/osx/toolbar.h b/Externals/wxWidgets3/include/wx/osx/toolbar.h index 7ebb40e028..f4a21982a6 100644 --- a/Externals/wxWidgets3/include/wx/osx/toolbar.h +++ b/Externals/wxWidgets3/include/wx/osx/toolbar.h @@ -4,7 +4,7 @@ // Author: Stefan Csomor // Modified by: // Created: 1998-01-01 -// RCS-ID: $Id: toolbar.h 66993 2011-02-22 13:25:38Z VZ $ +// RCS-ID: $Id: toolbar.h 70854 2012-03-10 00:01:09Z RD $ // Copyright: (c) Stefan Csomor // Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// @@ -77,6 +77,18 @@ class WXDLLIMPEXP_CORE wxToolBar: public wxToolBarBase bool MacWantsNativeToolbar(); bool MacTopLevelHasNativeToolbar(bool *ownToolbarInstalled) const; #endif + + virtual wxToolBarToolBase *CreateTool(int id, + const wxString& label, + const wxBitmap& bmpNormal, + const wxBitmap& bmpDisabled = wxNullBitmap, + wxItemKind kind = wxITEM_NORMAL, + wxObject *clientData = NULL, + const wxString& shortHelp = wxEmptyString, + const wxString& longHelp = wxEmptyString); + virtual wxToolBarToolBase *CreateTool(wxControl *control, + const wxString& label); + protected: // common part of all ctors void Init(); @@ -86,8 +98,11 @@ protected: void DoSetSize(int x, int y, int width, int height, int sizeFlags); #ifndef __WXOSX_IPHONE__ - virtual void DoGetSize(int *width, int *height) const; + virtual void DoGetSize(int *width, int *height) const; virtual wxSize DoGetBestSize() const; +#endif +#ifdef __WXOSX_COCOA__ + virtual void DoGetPosition(int*x, int *y) const; #endif virtual bool DoInsertTool(size_t pos, wxToolBarToolBase *tool); virtual bool DoDeleteTool(size_t pos, wxToolBarToolBase *tool); @@ -96,17 +111,6 @@ protected: virtual void DoToggleTool(wxToolBarToolBase *tool, bool toggle); virtual void DoSetToggle(wxToolBarToolBase *tool, bool toggle); - virtual wxToolBarToolBase *CreateTool(int id, - const wxString& label, - const wxBitmap& bmpNormal, - const wxBitmap& bmpDisabled, - wxItemKind kind, - wxObject *clientData, - const wxString& shortHelp, - const wxString& longHelp); - virtual wxToolBarToolBase *CreateTool(wxControl *control, - const wxString& label); - DECLARE_EVENT_TABLE() #if wxOSX_USE_NATIVE_TOOLBAR bool m_macUsesNativeToolbar ; diff --git a/Externals/wxWidgets3/include/wx/osx/toplevel.h b/Externals/wxWidgets3/include/wx/osx/toplevel.h index c0c6373e08..afe1f1d80f 100644 --- a/Externals/wxWidgets3/include/wx/osx/toplevel.h +++ b/Externals/wxWidgets3/include/wx/osx/toplevel.h @@ -4,7 +4,7 @@ // Author: Stefan Csomor // Modified by: // Created: 20.09.01 -// RCS-ID: $Id: toplevel.h 65680 2010-09-30 11:44:45Z VZ $ +// RCS-ID: $Id: toplevel.h 70295 2012-01-08 14:52:47Z VZ $ // Copyright: (c) 2001 Stefan Csomor // Licence: wxWindows licence /////////////////////////////////////////////////////////////////////////////// @@ -51,9 +51,6 @@ public: virtual wxPoint GetClientAreaOrigin() const; - virtual bool SetShape(const wxRegion& region) - { return DoSetShape(region); } - // Attracts the users attention to this window if the application is // inactive (should be called when a background event occurs) virtual void RequestUserAttention(int flags = wxUSER_ATTENTION_INFO); @@ -80,6 +77,8 @@ public: virtual void OSXSetModified(bool modified); virtual bool OSXIsModified() const; + virtual void SetRepresentedFilename(const wxString& filename); + protected: // common part of all ctors void Init(); diff --git a/Externals/wxWidgets3/include/wx/osx/treectrl.h b/Externals/wxWidgets3/include/wx/osx/treectrl.h index 1f5e9bcc00..090111624f 100644 --- a/Externals/wxWidgets3/include/wx/osx/treectrl.h +++ b/Externals/wxWidgets3/include/wx/osx/treectrl.h @@ -4,7 +4,7 @@ // Author: Stefan Csomor // Modified by: // Created: 1998-01-01 -// RCS-ID: $Id: treectrl.h 64943 2010-07-13 13:29:58Z VZ $ +// RCS-ID: $Id: treectrl.h 70165 2011-12-29 14:42:13Z SN $ // Copyright: (c) Stefan Csomor // Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// @@ -225,7 +225,7 @@ public: bool SortChildren(long item); bool EnsureVisible(long item); - void Command(wxCommandEvent& event) { ProcessCommand(event); }; + void Command(wxCommandEvent& event) { ProcessCommand(event); } protected: wxTextCtrl* m_textCtrl; diff --git a/Externals/wxWidgets3/include/wx/osx/webview_webkit.h b/Externals/wxWidgets3/include/wx/osx/webview_webkit.h new file mode 100644 index 0000000000..d0a93e653e --- /dev/null +++ b/Externals/wxWidgets3/include/wx/osx/webview_webkit.h @@ -0,0 +1,163 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: include/wx/osx/webkit.h +// Purpose: wxWebViewWebKit - embeddable web kit control, +// OS X implementation of web view component +// Author: Jethro Grassie / Kevin Ollivier / Marianne Gagnon +// Modified by: +// Created: 2004-4-16 +// RCS-ID: $Id: webview_webkit.h 69074 2011-09-12 18:35:39Z SJL $ +// Copyright: (c) Jethro Grassie / Kevin Ollivier / Marianne Gagnon +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_WEBKIT_H +#define _WX_WEBKIT_H + +#include "wx/setup.h" + +#if wxUSE_WEBVIEW && wxUSE_WEBVIEW_WEBKIT && (defined(__WXOSX_COCOA__) \ + || defined(__WXOSX_CARBON__)) + +#include "wx/control.h" +#include "wx/webview.h" + +// ---------------------------------------------------------------------------- +// Web Kit Control +// ---------------------------------------------------------------------------- + +class WXDLLIMPEXP_WEBVIEW wxWebViewWebKit : public wxWebView +{ +public: + wxDECLARE_DYNAMIC_CLASS(wxWebViewWebKit); + + wxWebViewWebKit() {} + wxWebViewWebKit(wxWindow *parent, + wxWindowID winID = wxID_ANY, + const wxString& strURL = wxWebViewDefaultURLStr, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, long style = 0, + const wxString& name = wxWebViewNameStr) + { + Create(parent, winID, strURL, pos, size, style, name); + } + bool Create(wxWindow *parent, + wxWindowID winID = wxID_ANY, + const wxString& strURL = wxWebViewDefaultURLStr, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, long style = 0, + const wxString& name = wxWebViewNameStr); + virtual ~wxWebViewWebKit(); + + virtual bool CanGoBack() const; + virtual bool CanGoForward() const; + virtual void GoBack(); + virtual void GoForward(); + virtual void Reload(wxWebViewReloadFlags flags = wxWEB_VIEW_RELOAD_DEFAULT); + virtual void Stop(); + virtual wxString GetPageSource() const; + virtual wxString GetPageText() const; + + //We do not want to hide the other overloads + using wxWebView::SetPage; + virtual void SetPage(const wxString& html, const wxString& baseUrl); + + virtual void Print(); + + virtual void LoadURL(const wxString& url); + virtual wxString GetCurrentURL() const; + virtual wxString GetCurrentTitle() const; + virtual wxWebViewZoom GetZoom() const; + virtual void SetZoom(wxWebViewZoom zoom); + + virtual void SetZoomType(wxWebViewZoomType zoomType); + virtual wxWebViewZoomType GetZoomType() const; + virtual bool CanSetZoomType(wxWebViewZoomType type) const; + + virtual bool IsBusy() const { return m_busy; } + + //History functions + virtual void ClearHistory(); + virtual void EnableHistory(bool enable = true); + virtual wxVector > GetBackwardHistory(); + virtual wxVector > GetForwardHistory(); + virtual void LoadHistoryItem(wxSharedPtr item); + + //Undo / redo functionality + virtual bool CanUndo() const; + virtual bool CanRedo() const; + virtual void Undo(); + virtual void Redo(); + + //Clipboard functions + virtual bool CanCut() const { return true; } + virtual bool CanCopy() const { return true; } + virtual bool CanPaste() const { return true; } + virtual void Cut(); + virtual void Copy(); + virtual void Paste(); + + //Editing functions + virtual void SetEditable(bool enable = true); + virtual bool IsEditable() const; + + //Selection + virtual void DeleteSelection(); + virtual bool HasSelection() const; + virtual void SelectAll(); + virtual wxString GetSelectedText() const; + virtual wxString GetSelectedSource() const; + virtual void ClearSelection(); + + void RunScript(const wxString& javascript); + + //Virtual Filesystem Support + virtual void RegisterHandler(wxSharedPtr handler); + + // ---- methods not from the parent (common) interface + bool CanGetPageSource() const; + + void SetScrollPos(int pos); + int GetScrollPos(); + + bool CanIncreaseTextSize() const; + void IncreaseTextSize(); + bool CanDecreaseTextSize() const; + void DecreaseTextSize(); + + float GetWebkitZoom() const; + void SetWebkitZoom(float zoom); + + // don't hide base class virtuals + virtual void SetScrollPos( int orient, int pos, bool refresh = true ) + { return wxControl::SetScrollPos(orient, pos, refresh); } + virtual int GetScrollPos( int orient ) const + { return wxControl::GetScrollPos(orient); } + + //we need to resize the webview when the control size changes + void OnSize(wxSizeEvent &event); + void OnMove(wxMoveEvent &event); + void OnMouseEvents(wxMouseEvent &event); + + bool m_busy; + +protected: + DECLARE_EVENT_TABLE() + void MacVisibilityChanged(); + +private: + wxWindow *m_parent; + wxWindowID m_windowID; + wxString m_pageTitle; + + struct objc_object *m_webView; + + // we may use this later to setup our own mouse events, + // so leave it in for now. + void* m_webKitCtrlEventHandler; + //It should be WebView*, but WebView is an Objective-C class + //TODO: look into using DECLARE_WXCOCOA_OBJC_CLASS rather than this. +}; + +#endif // wxUSE_WEBVIEW && wxUSE_WEBVIEW_WEBKIT + +#endif // _WX_WEBKIT_H_ diff --git a/Externals/wxWidgets3/include/wx/osx/webviewhistoryitem_webkit.h b/Externals/wxWidgets3/include/wx/osx/webviewhistoryitem_webkit.h new file mode 100644 index 0000000000..05976803f5 --- /dev/null +++ b/Externals/wxWidgets3/include/wx/osx/webviewhistoryitem_webkit.h @@ -0,0 +1,35 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: include/wx/osx/webviewhistoryitem.h +// Purpose: wxWebViewHistoryItem header for OSX +// Author: Steven Lamerton +// Id: $Id: webviewhistoryitem_webkit.h 69074 2011-09-12 18:35:39Z SJL $ +// Copyright: (c) 2011 Steven Lamerton +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_OSX_WEBVIEWHISTORYITEM_H_ +#define _WX_OSX_WEBVIEWHISTORYITEM_H_ + +#include "wx/setup.h" + +#if wxUSE_WEBVIEW && wxUSE_WEBVIEW_WEBKIT && (defined(__WXOSX_COCOA__) \ + || defined(__WXOSX_CARBON__)) + +class WXDLLIMPEXP_WEBVIEW wxWebViewHistoryItem +{ +public: + wxWebViewHistoryItem(const wxString& url, const wxString& title) : + m_url(url), m_title(title) {} + wxString GetUrl() { return m_url; } + wxString GetTitle() { return m_title; } + + friend class wxWebViewWebKit; + +private: + wxString m_url, m_title; + struct objc_object *m_histItem; +}; + +#endif // wxUSE_WEBVIEW && wxUSE_WEBVIEW_WEBKIT + +#endif // _WX_OSX_WEBVIEWHISTORYITEM_H_ diff --git a/Externals/wxWidgets3/include/wx/osx/window.h b/Externals/wxWidgets3/include/wx/osx/window.h index 49aa250906..1ac3916a8c 100644 --- a/Externals/wxWidgets3/include/wx/osx/window.h +++ b/Externals/wxWidgets3/include/wx/osx/window.h @@ -4,7 +4,7 @@ // Author: Stefan Csomor // Modified by: // Created: 1998-01-01 -// RCS-ID: $Id: window.h 67280 2011-03-22 14:17:38Z DS $ +// RCS-ID: $Id: window.h 70765 2012-03-01 15:04:42Z JS $ // Copyright: (c) Stefan Csomor // Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// @@ -114,6 +114,14 @@ public: virtual bool Reparent( wxWindowBase *newParent ); +#if wxUSE_HOTKEY && wxOSX_USE_COCOA_OR_CARBON + // hot keys (system wide accelerators) + // ----------------------------------- + + virtual bool RegisterHotKey(int hotkeyId, int modifiers, int keycode); + virtual bool UnregisterHotKey(int hotkeyId); +#endif // wxUSE_HOTKEY + #if wxUSE_DRAG_AND_DROP virtual void SetDropTarget( wxDropTarget *dropTarget ); #endif @@ -280,6 +288,9 @@ public: float GetContentScaleFactor() const ; + // internal response to size events + virtual void MacOnInternalSize() {} + protected: // For controls like radio buttons which are genuinely composite wxList m_subControls; diff --git a/Externals/wxWidgets3/include/wx/palette.h b/Externals/wxWidgets3/include/wx/palette.h index dab7040c58..4c29f23b98 100644 --- a/Externals/wxWidgets3/include/wx/palette.h +++ b/Externals/wxWidgets3/include/wx/palette.h @@ -4,7 +4,7 @@ // Author: Julian Smart // Modified by: // Created: -// RCS-ID: $Id: palette.h 61508 2009-07-23 20:30:22Z VZ $ +// RCS-ID: $Id: palette.h 70353 2012-01-15 14:46:41Z VZ $ // Copyright: (c) Julian Smart // Licence: wxWindows Licence ///////////////////////////////////////////////////////////////////////////// @@ -28,16 +28,12 @@ public: virtual int GetColoursCount() const { wxFAIL_MSG( wxT("not implemented") ); return 0; } }; -#if defined(__WXPALMOS__) - #include "wx/palmos/palette.h" -#elif defined(__WXMSW__) +#if defined(__WXMSW__) #include "wx/msw/palette.h" #elif defined(__WXX11__) || defined(__WXMOTIF__) #include "wx/x11/palette.h" #elif defined(__WXGTK__) || defined(__WXCOCOA__) #include "wx/generic/paletteg.h" -#elif defined(__WXMGL__) - #include "wx/mgl/palette.h" #elif defined(__WXMAC__) #include "wx/osx/palette.h" #elif defined(__WXPM__) diff --git a/Externals/wxWidgets3/include/wx/panel.h b/Externals/wxWidgets3/include/wx/panel.h index 8241cc51d0..18c7aacd47 100644 --- a/Externals/wxWidgets3/include/wx/panel.h +++ b/Externals/wxWidgets3/include/wx/panel.h @@ -4,7 +4,7 @@ // Author: Julian Smart // Modified by: // Created: -// RCS-ID: $Id: panel.h 67253 2011-03-20 00:00:49Z VZ $ +// RCS-ID: $Id: panel.h 69378 2011-10-11 17:07:43Z VZ $ // Copyright: (c) Julian Smart // (c) 2011 Vadim Zeitlin // Licence: wxWindows Licence @@ -28,10 +28,10 @@ extern WXDLLIMPEXP_DATA_CORE(const char) wxPanelNameStr[]; // wxPanel contains other controls and implements TAB traversal between them // ---------------------------------------------------------------------------- -class WXDLLIMPEXP_CORE wxPanelBase : public wxWindow +class WXDLLIMPEXP_CORE wxPanelBase : public wxNavigationEnabled { public: - wxPanelBase(); + wxPanelBase() { } // Derived classes should also provide this constructor: /* @@ -52,31 +52,12 @@ public: const wxString& name = wxPanelNameStr); - // Use the given bitmap to tile the background of this panel. This bitmap - // will show through any transparent children. - // - // Notice that you must not prevent the base class EVT_ERASE_BACKGROUND - // handler from running (i.e. not to handle this event yourself) for this - // to work. - void SetBackgroundBitmap(const wxBitmap& bmp) - { - DoSetBackgroundBitmap(bmp); - } - - // implementation from now on // -------------------------- virtual void InitDialog(); - WX_DECLARE_CONTROL_CONTAINER(); - -protected: - virtual void DoSetBackgroundBitmap(const wxBitmap& bmp) = 0; - private: - wxDECLARE_EVENT_TABLE(); - wxDECLARE_NO_COPY_CLASS(wxPanelBase); }; diff --git a/Externals/wxWidgets3/include/wx/pen.h b/Externals/wxWidgets3/include/wx/pen.h index 01895e35f4..75147dcf37 100644 --- a/Externals/wxWidgets3/include/wx/pen.h +++ b/Externals/wxWidgets3/include/wx/pen.h @@ -4,7 +4,7 @@ // Author: Julian Smart // Modified by: // Created: -// RCS-ID: $Id: pen.h 66054 2010-11-07 13:16:20Z VZ $ +// RCS-ID: $Id: pen.h 70353 2012-01-15 14:46:41Z VZ $ // Copyright: (c) Julian Smart // Licence: wxWindows Licence ///////////////////////////////////////////////////////////////////////////// @@ -99,9 +99,7 @@ public: } }; -#if defined(__WXPALMOS__) - #include "wx/palmos/pen.h" -#elif defined(__WXMSW__) +#if defined(__WXMSW__) #include "wx/msw/pen.h" #elif defined(__WXMOTIF__) || defined(__WXX11__) #include "wx/x11/pen.h" @@ -109,8 +107,6 @@ public: #include "wx/gtk/pen.h" #elif defined(__WXGTK__) #include "wx/gtk1/pen.h" -#elif defined(__WXMGL__) - #include "wx/mgl/pen.h" #elif defined(__WXDFB__) #include "wx/dfb/pen.h" #elif defined(__WXMAC__) diff --git a/Externals/wxWidgets3/include/wx/persist.h b/Externals/wxWidgets3/include/wx/persist.h index e238da9a26..2ac6a4423e 100644 --- a/Externals/wxWidgets3/include/wx/persist.h +++ b/Externals/wxWidgets3/include/wx/persist.h @@ -3,7 +3,7 @@ // Purpose: common classes for persistence support // Author: Vadim Zeitlin // Created: 2009-01-18 -// RCS-ID: $Id: persist.h 64887 2010-07-11 10:44:23Z VZ $ +// RCS-ID: $Id: persist.h 69583 2011-10-30 10:08:18Z VZ $ // Copyright: (c) 2009 Vadim Zeitlin // Licence: wxWindows licence /////////////////////////////////////////////////////////////////////////////// @@ -44,6 +44,14 @@ wxPersistentObject *wxCreatePersistentObject(T *obj); class WXDLLIMPEXP_CORE wxPersistenceManager { public: + // Call this method to specify a non-default persistence manager to use. + // This function should usually be called very early to affect creation of + // all persistent controls and the object passed to it must have a lifetime + // long enough to be still alive when the persistent controls are destroyed + // and need it to save their state so typically this would be a global or a + // wxApp member. + static void Set(wxPersistenceManager& manager); + // accessor to the unique persistence manager object static wxPersistenceManager& Get(); @@ -133,7 +141,7 @@ public: #undef wxPERSIST_DECLARE_SAVE_RESTORE_FOR -private: +protected: // ctor is private, use Get() wxPersistenceManager() { @@ -142,15 +150,18 @@ private: } - // helpers of Save/Restore() - // - // TODO: make this customizable by allowing - // (a) specifying custom wxConfig object to use - // (b) allowing to use something else entirely - wxConfigBase *GetConfig() const { return wxConfigBase::Get(); } - wxString GetKey(const wxPersistentObject& who, const wxString& name) const; + // Return the config object to use, by default just the global one but a + // different one could be used by the derived class if needed. + virtual wxConfigBase *GetConfig() const { return wxConfigBase::Get(); } + + // Return the path to use for saving the setting with the given name for + // the specified object (notice that the name is the name of the setting, + // not the name of the object itself which can be retrieved with GetName()). + virtual wxString GetKey(const wxPersistentObject& who, + const wxString& name) const; +private: // map with the registered objects as keys and associated // wxPersistentObjects as values wxPersistentObjectsMap m_persistentObjects; diff --git a/Externals/wxWidgets3/include/wx/persist/splitter.h b/Externals/wxWidgets3/include/wx/persist/splitter.h new file mode 100644 index 0000000000..5f8fe34158 --- /dev/null +++ b/Externals/wxWidgets3/include/wx/persist/splitter.h @@ -0,0 +1,69 @@ +/////////////////////////////////////////////////////////////////////////////// +// Name: wx/persist/splitter.h +// Purpose: Persistence support for wxSplitterWindow. +// Author: Vadim Zeitlin +// Created: 2011-08-31 +// RCS-ID: $Id: splitter.h 69582 2011-10-30 10:08:14Z VZ $ +// Copyright: (c) 2011 Vadim Zeitlin +// Licence: wxWindows licence +/////////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_PERSIST_SPLITTER_H_ +#define _WX_PERSIST_SPLITTER_H_ + +#include "wx/persist/window.h" + +#include "wx/splitter.h" + +// ---------------------------------------------------------------------------- +// string constants used by wxPersistentSplitter +// ---------------------------------------------------------------------------- + +#define wxPERSIST_SPLITTER_KIND "Splitter" + +// Special position value of -1 means the splitter is not split at all. +#define wxPERSIST_SPLITTER_POSITION "Position" + +// ---------------------------------------------------------------------------- +// wxPersistentSplitter: supports saving/restoring splitter position +// ---------------------------------------------------------------------------- + +class wxPersistentSplitter : public wxPersistentWindow +{ +public: + wxPersistentSplitter(wxSplitterWindow* splitter) + : wxPersistentWindow(splitter) + { + } + + virtual void Save() const + { + wxSplitterWindow* const splitter = Get(); + + int pos = splitter->IsSplit() ? splitter->GetSashPosition() : -1; + SaveValue(wxPERSIST_SPLITTER_POSITION, pos); + } + + virtual bool Restore() + { + int pos; + if ( !RestoreValue(wxPERSIST_SPLITTER_POSITION, &pos) ) + return false; + + if ( pos == -1 ) + Get()->Unsplit(); + else + Get()->SetSashPosition(pos); + + return true; + } + + virtual wxString GetKind() const { return wxPERSIST_SPLITTER_KIND; } +}; + +inline wxPersistentObject *wxCreatePersistentObject(wxSplitterWindow* splitter) +{ + return new wxPersistentSplitter(splitter); +} + +#endif // _WX_PERSIST_SPLITTER_H_ diff --git a/Externals/wxWidgets3/include/wx/pickerbase.h b/Externals/wxWidgets3/include/wx/pickerbase.h index c578a157a0..ff5c86f0de 100644 --- a/Externals/wxWidgets3/include/wx/pickerbase.h +++ b/Externals/wxWidgets3/include/wx/pickerbase.h @@ -5,7 +5,7 @@ // Modified by: // Created: 14/4/2006 // Copyright: (c) Vadim Zeitlin, Francesco Montorsi -// RCS-ID: $Id: pickerbase.h 52834 2008-03-26 15:06:00Z FM $ +// RCS-ID: $Id: pickerbase.h 68921 2011-08-27 14:11:25Z VZ $ // Licence: wxWindows Licence ///////////////////////////////////////////////////////////////////////////// @@ -31,13 +31,14 @@ extern WXDLLIMPEXP_DATA_CORE(const char) wxButtonNameStr[]; // ---------------------------------------------------------------------------- #define wxPB_USE_TEXTCTRL 0x0002 +#define wxPB_SMALL 0x8000 -class WXDLLIMPEXP_CORE wxPickerBase : public wxControl +class WXDLLIMPEXP_CORE wxPickerBase : public wxNavigationEnabled { public: // ctor: text is the associated text control wxPickerBase() : m_text(NULL), m_picker(NULL), m_sizer(NULL) - { WX_INIT_CONTROL_CONTAINER(); } + { } virtual ~wxPickerBase() {} @@ -121,8 +122,6 @@ protected: void OnTextCtrlUpdate(wxCommandEvent &); void OnTextCtrlKillFocus(wxFocusEvent &); - void OnSize(wxSizeEvent &); - // returns the set of styles for the attached wxTextCtrl // from given wxPickerBase's styles virtual long GetTextCtrlStyle(long style) const @@ -178,10 +177,6 @@ protected: private: DECLARE_ABSTRACT_CLASS(wxPickerBase) - DECLARE_EVENT_TABLE() - - // This class must be something just like a panel... - WX_DECLARE_CONTROL_CONTAINER(); }; diff --git a/Externals/wxWidgets3/include/wx/platform.h b/Externals/wxWidgets3/include/wx/platform.h index c6861ca5c2..74ad218a3a 100644 --- a/Externals/wxWidgets3/include/wx/platform.h +++ b/Externals/wxWidgets3/include/wx/platform.h @@ -4,7 +4,7 @@ * Author: Vadim Zeitlin * Modified by: * Created: 29.10.01 (extracted from wx/defs.h) -* RCS-ID: $Id: platform.h 66077 2010-11-09 23:53:42Z VZ $ +* RCS-ID: $Id: platform.h 70757 2012-02-29 22:40:24Z VZ $ * Copyright: (c) 1997-2001 Vadim Zeitlin * Licence: wxWindows licence */ @@ -15,23 +15,35 @@ #define _WX_PLATFORM_H_ + /* Codewarrior doesn't define any Windows symbols until some headers are included */ #ifdef __MWERKS__ # include - -# if !defined(__WXMAC__) && !defined(__WINDOWS__) && !defined(WIN32) && !defined(_WIN32_WCE) -# define __PALMOS__ 0x05000000 -# endif #endif #ifdef __WXMAC_XCODE__ # include # include # include +# ifndef MAC_OS_X_VERSION_10_4 +# define MAC_OS_X_VERSION_10_4 1040 +# endif +# ifndef MAC_OS_X_VERSION_10_5 +# define MAC_OS_X_VERSION_10_5 1050 +# endif +# ifndef MAC_OS_X_VERSION_10_6 +# define MAC_OS_X_VERSION_10_6 1060 +# endif # include "wx/osx/config_xcode.h" +# ifndef __WXOSX__ +# define __WXOSX__ 1 +# endif +# ifndef __WXMAC__ +# define __WXMAC__ 1 +# endif #endif /* @@ -44,33 +56,6 @@ # endif #endif -#if defined(__PALMOS__) -# if __PALMOS__ == 0x06000000 -# define __WXPALMOS6__ 1 -# endif -# if __PALMOS__ == 0x05000000 -# define __WXPALMOS5__ 1 -# endif -# ifndef __WXPALMOS__ -# define __WXPALMOS__ 1 -# endif -# ifdef __WXMSW__ -# undef __WXMSW__ -# endif -# ifdef __WINDOWS__ -# undef __WINDOWS__ -# endif -# ifdef __WIN32__ -# undef __WIN32__ -# endif -# ifdef WIN32 -# undef WIN32 -# endif -# ifdef _WIN32 -# undef _WIN32 -# endif -#endif - #if defined(_WIN64) # ifndef _WIN32 /* @@ -164,6 +149,11 @@ # define __WXHANDHELD__ #endif +#ifdef __ANDROID__ +# define __WXANDROID__ +# include "wx/android/config_android.h" +#endif + /* Include wx/setup.h for the Unix platform defines generated by configure and the library compilation options @@ -182,6 +172,13 @@ #include "wx/setup_gccxml.h" #endif +/* + Convenience for any optional classes that use the wxAnyButton base class. + */ +#if wxUSE_TOGGLEBTN || wxUSE_BUTTON + #define wxHAS_ANY_BUTTON +#endif + /* Hardware platform detection. @@ -273,7 +270,7 @@ /* Preprocessor in older Borland compilers have major problems concatenating with ##. Specifically, if the string operands being - concatenated have special meaning (e.g L"str", 123i64 etc) + concatenated have special meaning (e.g. L"str", 123i64 etc) then ## will not concatenate the operands correctly. As a workaround, define wxPREPEND* and wxAPPEND* without using @@ -434,20 +431,6 @@ # endif # define wxSIZE_T_IS_UINT -/* - OS: Palm OS - */ -#elif defined(__PALMOS__) -# ifdef __WIN32__ -# error "__WIN32__ should not be defined for PalmOS" -# endif -# ifdef __WINDOWS__ -# error "__WINDOWS__ should not be defined for PalmOS" -# endif -# ifdef __WXMSW__ -# error "__WXMSW__ should not be defined for PalmOS" -# endif - /* OS: Otherwise it must be Windows */ @@ -486,6 +469,8 @@ # define __VISUALC9__ # elif __VISUALC__ < 1700 # define __VISUALC10__ +# elif __VISUALC__ < 1800 +# define __VISUALC11__ # else # pragma message("Please update wx/platform.h to recognize this VC++ version") # endif @@ -586,8 +571,7 @@ !defined(__WXPM__) && \ !defined(__WXMOTIF__) && \ !defined(__WXGTK__) && \ - !defined(__WXX11__) && \ - !defined(__WXPALMOS__) + !defined(__WXX11__) # include "wx/msw/gccpriv.h" #else # undef wxCHECK_W32API_VERSION @@ -789,7 +773,7 @@ * Presently, only Windows and GTK+ support wxEVT_MENU_OPEN. */ #ifndef wxUSE_IDLEMENUUPDATES -# if (defined(__WXMSW__) || defined(__WXGTK__)) && !defined(__WXUNIVERSAL__) +# if (defined(__WXMSW__) || defined(__WXGTK__) || defined(__WXOSX__)) && !defined(__WXUNIVERSAL__) # define wxUSE_IDLEMENUUPDATES 0 # else # define wxUSE_IDLEMENUUPDATES 1 @@ -818,31 +802,6 @@ # define wxUSE_WXDIB 1 #endif -#if defined (__WXPALMOS__) -#include "wx/palmos/missing.h" -#endif // __WXPALMOS__ - -#if !defined (__WXPALMOS5__) -#define POSSEC_APPBASE -#define POSSEC_ARCHIVE -#define POSSEC_CLNTDATA -#define POSSEC_CMDLINE -#define POSSEC_CONFIG -#define POSSEC_DATETIME -#define POSSEC_DATETIME2 -#define POSSEC_DATSTRM -#define POSSEC_DIRCMN -#define POSSEC_DYNARRAY -#define POSSEC_DYNLIB -#define POSSEC_DYNLOAD -#define POSSEC_ENCCONV -#define POSSEC_EXTENDED -#define POSSEC_FFILE -#define POSSEC_FILE -#define POSSEC_FILECONF -#define POSSEC_FILEFN -#endif // __WXPALMOS5__ - /* Optionally supported C++ features. */ @@ -866,6 +825,6 @@ # define wxNO_RTTI # endif # endif -#endif // wxNO_RTTI +#endif /* wxNO_RTTI */ #endif /* _WX_PLATFORM_H_ */ diff --git a/Externals/wxWidgets3/include/wx/platinfo.h b/Externals/wxWidgets3/include/wx/platinfo.h index 59a99db827..8adabba16b 100644 --- a/Externals/wxWidgets3/include/wx/platinfo.h +++ b/Externals/wxWidgets3/include/wx/platinfo.h @@ -4,7 +4,7 @@ // Author: Francesco Montorsi // Modified by: // Created: 07.07.2006 (based on wxToolkitInfo) -// RCS-ID: $Id: platinfo.h 64940 2010-07-13 13:29:13Z VZ $ +// RCS-ID: $Id: platinfo.h 70353 2012-01-15 14:46:41Z VZ $ // Copyright: (c) 2006 Francesco Montorsi // Licence: wxWindows licence /////////////////////////////////////////////////////////////////////////////// @@ -58,11 +58,7 @@ enum wxOperatingSystemId // 1<<13 and 1<<14 available for other Unix flavours wxOS_DOS = 1 << 15, // Microsoft DOS - wxOS_OS2 = 1 << 16, // OS/2 - - wxOS_PALM_OS = 1 << 17, // Pure Palm OS - wxOS_PALM_LINUX = 1 << 18, // Palm over linux - wxOS_PALM = wxOS_PALM_OS | wxOS_PALM_LINUX + wxOS_OS2 = 1 << 16 // OS/2 }; // list of wxWidgets ports - some of them can be used with more than @@ -76,16 +72,14 @@ enum wxPortId wxPORT_MSW = 1 << 1, // wxMSW, native toolkit is Windows API wxPORT_MOTIF = 1 << 2, // wxMotif, using [Open]Motif or Lesstif wxPORT_GTK = 1 << 3, // wxGTK, using GTK+ 1.x, 2.x, GPE or Maemo - wxPORT_MGL = 1 << 4, // wxMGL, using wxUniversal + wxPORT_DFB = 1 << 4, // wxDFB, using wxUniversal wxPORT_X11 = 1 << 5, // wxX11, using wxUniversal wxPORT_PM = 1 << 6, // wxOS2, using OS/2 Presentation Manager wxPORT_OS2 = wxPORT_PM, // wxOS2, using OS/2 Presentation Manager wxPORT_MAC = 1 << 7, // wxOSX (former wxMac), using Cocoa, Carbon or iPhone API wxPORT_OSX = wxPORT_MAC, // wxOSX, using Cocoa, Carbon or iPhone API wxPORT_COCOA = 1 << 8, // wxCocoa, using Cocoa NextStep/Mac API - wxPORT_WINCE = 1 << 9, // wxWinCE, toolkit is WinCE SDK API - wxPORT_PALMOS = 1 << 10, // wxPalmOS, toolkit is PalmOS API - wxPORT_DFB = 1 << 11 // wxDFB, using wxUniversal + wxPORT_WINCE = 1 << 9 // wxWinCE, toolkit is WinCE SDK API }; // architecture of the operating system @@ -366,9 +360,7 @@ protected: #define wxWinCE wxOS_WINDOWS_CE #define wxWIN32S wxOS_WINDOWS_9X - #define wxPalmOS wxPORT_PALMOS #define wxOS2 wxPORT_OS2 - #define wxMGL wxPORT_MGL #define wxCocoa wxPORT_MAC #define wxMac wxPORT_MAC #define wxMotif wxPORT_MOTIF diff --git a/Externals/wxWidgets3/include/wx/popupwin.h b/Externals/wxWidgets3/include/wx/popupwin.h index 901fee0613..e6ed10c4e3 100644 --- a/Externals/wxWidgets3/include/wx/popupwin.h +++ b/Externals/wxWidgets3/include/wx/popupwin.h @@ -4,7 +4,7 @@ // Author: Vadim Zeitlin // Modified by: // Created: 06.01.01 -// RCS-ID: $Id: popupwin.h 67244 2011-03-19 11:57:06Z VZ $ +// RCS-ID: $Id: popupwin.h 70353 2012-01-15 14:46:41Z VZ $ // Copyright: (c) 2001 Vadim Zeitlin // Licence: wxWindows licence /////////////////////////////////////////////////////////////////////////////// @@ -66,8 +66,6 @@ public: #include "wx/motif/popupwin.h" #elif defined(__WXDFB__) #include "wx/dfb/popupwin.h" -#elif defined(__WXMGL__) - #include "wx/mgl/popupwin.h" #elif defined(__WXMAC__) #include "wx/osx/popupwin.h" #else @@ -112,6 +110,9 @@ public: // Overridden to grab the input on some plaforms virtual bool Show( bool show = true ); + // Override to implement delayed destruction of this window. + virtual bool Destroy(); + protected: // common part of all ctors void Init(); @@ -129,8 +130,9 @@ protected: // get alerted when child gets deleted from under us void OnDestroy(wxWindowDestroyEvent& event); -#if defined( __WXMSW__ ) || defined( __WXMAC__) - // check if the mouse needs captured or released +#if defined(__WXMSW__) ||(defined(__WXMAC__) && wxOSX_USE_CARBON) + // Check if the mouse needs to be captured or released: we must release + // when it's inside our window if we want the embedded controls to work. void OnIdle(wxIdleEvent& event); #endif diff --git a/Externals/wxWidgets3/include/wx/power.h b/Externals/wxWidgets3/include/wx/power.h index 71a2a8bffe..ea3a11c9fc 100644 --- a/Externals/wxWidgets3/include/wx/power.h +++ b/Externals/wxWidgets3/include/wx/power.h @@ -4,7 +4,7 @@ // Author: Vadim Zeitlin // Modified by: // Created: 2006-05-27 -// RCS-ID: $Id: power.h 58718 2009-02-07 18:59:25Z VZ $ +// RCS-ID: $Id: power.h 70796 2012-03-04 00:29:31Z VZ $ // Copyright: (c) 2006 Vadim Zeitlin // Licence: wxWindows licence /////////////////////////////////////////////////////////////////////////////// @@ -42,7 +42,7 @@ enum wxBatteryState // compiling in the code for handling them which is never going to be invoked // under the other platforms, we define wxHAS_POWER_EVENTS symbol if this event // is available, it should be used to guard all code using wxPowerEvent -#ifdef __WXMSW__ +#ifdef __WINDOWS__ #define wxHAS_POWER_EVENTS diff --git a/Externals/wxWidgets3/include/wx/private/fontmgr.h b/Externals/wxWidgets3/include/wx/private/fontmgr.h index 68d7fc7ab3..e29ac1eece 100644 --- a/Externals/wxWidgets3/include/wx/private/fontmgr.h +++ b/Externals/wxWidgets3/include/wx/private/fontmgr.h @@ -3,7 +3,7 @@ // Purpose: font management for ports that don't have their own // Author: Vaclav Slavik // Created: 2006-11-18 -// RCS-ID: $Id: fontmgr.h 62349 2009-10-09 13:04:59Z VZ $ +// RCS-ID: $Id: fontmgr.h 70353 2012-01-15 14:46:41Z VZ $ // Copyright: (c) 2001-2002 SciTech Software, Inc. (www.scitechsoft.com) // (c) 2006 REA Elektronik GmbH // Licence: wxWindows licence @@ -192,9 +192,7 @@ protected: -#if defined(__WXMGL__) - #include "wx/mgl/private/fontmgr.h" -#elif defined(__WXDFB__) +#if defined(__WXDFB__) #include "wx/dfb/private/fontmgr.h" #endif diff --git a/Externals/wxWidgets3/include/wx/private/fswatcher.h b/Externals/wxWidgets3/include/wx/private/fswatcher.h index c0438243a9..8f6f72ed47 100644 --- a/Externals/wxWidgets3/include/wx/private/fswatcher.h +++ b/Externals/wxWidgets3/include/wx/private/fswatcher.h @@ -3,7 +3,7 @@ // Purpose: File system watcher impl classes // Author: Bartosz Bekier // Created: 2009-05-26 -// RCS-ID: $Id: fswatcher.h 62475 2009-10-22 11:36:35Z VZ $ +// RCS-ID: $Id: fswatcher.h 70796 2012-03-04 00:29:31Z VZ $ // Copyright: (c) 2009 Bartosz Bekier // Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// @@ -23,7 +23,7 @@ #define wxFSWatchEntry wxFSWatchEntryKq WX_DECLARE_STRING_HASH_MAP(wxSharedPtr,wxFSWatchEntries); #include "wx/unix/private/fswatcher_kqueue.h" -#elif defined(__WXMSW__) +#elif defined(__WINDOWS__) class wxFSWatchEntryMSW; #define wxFSWatchEntry wxFSWatchEntryMSW WX_DECLARE_STRING_HASH_MAP(wxSharedPtr,wxFSWatchEntries); diff --git a/Externals/wxWidgets3/include/wx/private/markupparserattr.h b/Externals/wxWidgets3/include/wx/private/markupparserattr.h index 3bf3ddcba6..1cce2f8cce 100644 --- a/Externals/wxWidgets3/include/wx/private/markupparserattr.h +++ b/Externals/wxWidgets3/include/wx/private/markupparserattr.h @@ -3,7 +3,7 @@ // Purpose: Classes mapping markup attributes to wxFont/wxColour. // Author: Vadim Zeitlin // Created: 2011-02-18 -// RCS-ID: $Id: markupparserattr.h 67073 2011-02-27 14:01:36Z VZ $ +// RCS-ID: $Id: markupparserattr.h 70447 2012-01-23 11:28:32Z VZ $ // Copyright: (c) 2011 Vadim Zeitlin // Licence: wxWindows licence /////////////////////////////////////////////////////////////////////////////// @@ -78,8 +78,8 @@ public: virtual void OnUnderlinedStart() { DoChangeFont(&wxFont::Underlined); } virtual void OnUnderlinedEnd() { DoEndAttr(); } - virtual void OnStrikethroughStart() { } // TODO: No support in wxFont yet. - virtual void OnStrikethroughEnd() { } + virtual void OnStrikethroughStart() { DoChangeFont(&wxFont::Strikethrough); } + virtual void OnStrikethroughEnd() { DoEndAttr(); } virtual void OnBigStart() { DoChangeFont(&wxFont::Larger); } virtual void OnBigEnd() { DoEndAttr(); } diff --git a/Externals/wxWidgets3/include/wx/private/richtooltip.h b/Externals/wxWidgets3/include/wx/private/richtooltip.h new file mode 100644 index 0000000000..1334778e56 --- /dev/null +++ b/Externals/wxWidgets3/include/wx/private/richtooltip.h @@ -0,0 +1,44 @@ +/////////////////////////////////////////////////////////////////////////////// +// Name: wx/private/richtooltip.h +// Purpose: wxRichToolTipImpl declaration. +// Author: Vadim Zeitlin +// Created: 2011-10-18 +// RCS-ID: $Id: richtooltip.h 69463 2011-10-18 21:57:02Z VZ $ +// Copyright: (c) 2011 Vadim Zeitlin +// Licence: wxWindows licence +/////////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_PRIVATE_RICHTOOLTIP_H_ +#define _WX_PRIVATE_RICHTOOLTIP_H_ + +#include "wx/richtooltip.h" + +// ---------------------------------------------------------------------------- +// wxRichToolTipImpl: defines wxRichToolTip implementation. +// ---------------------------------------------------------------------------- + +class wxRichToolTipImpl +{ +public: + // This is implemented in a platform-specific way. + static wxRichToolTipImpl* Create(const wxString& title, + const wxString& message); + + // These methods simply mirror the public wxRichToolTip ones. + virtual void SetBackgroundColour(const wxColour& col, + const wxColour& colEnd) = 0; + virtual void SetCustomIcon(const wxIcon& icon) = 0; + virtual void SetStandardIcon(int icon) = 0; + virtual void SetTimeout(unsigned milliseconds) = 0; + virtual void SetTipKind(wxTipKind tipKind) = 0; + virtual void SetTitleFont(const wxFont& font) = 0; + + virtual void ShowFor(wxWindow* win) = 0; + + virtual ~wxRichToolTipImpl() { } + +protected: + wxRichToolTipImpl() { } +}; + +#endif // _WX_PRIVATE_RICHTOOLTIP_H_ diff --git a/Externals/wxWidgets3/include/wx/private/sckaddr.h b/Externals/wxWidgets3/include/wx/private/sckaddr.h index 07b061bd3d..cebd608d0e 100644 --- a/Externals/wxWidgets3/include/wx/private/sckaddr.h +++ b/Externals/wxWidgets3/include/wx/private/sckaddr.h @@ -3,7 +3,7 @@ // Purpose: wxSockAddressImpl // Author: Vadim Zeitlin // Created: 2008-12-28 -// RCS-ID: $Id: sckaddr.h 67254 2011-03-20 00:14:35Z DS $ +// RCS-ID: $Id: sckaddr.h 70796 2012-03-04 00:29:31Z VZ $ // Copyright: (c) 2008 Vadim Zeitlin // Licence: wxWindows licence /////////////////////////////////////////////////////////////////////////////// @@ -11,7 +11,7 @@ #ifndef _WX_PRIVATE_SOCKADDR_H_ #define _WX_PRIVATE_SOCKADDR_H_ -#ifdef __WXMSW__ +#ifdef __WINDOWS__ #include "wx/msw/wrapwin.h" #if wxUSE_IPV6 diff --git a/Externals/wxWidgets3/include/wx/private/socket.h b/Externals/wxWidgets3/include/wx/private/socket.h index dcdeca02df..1664066d65 100644 --- a/Externals/wxWidgets3/include/wx/private/socket.h +++ b/Externals/wxWidgets3/include/wx/private/socket.h @@ -3,7 +3,7 @@ // Purpose: wxSocketImpl and related declarations // Authors: Guilhem Lavaux, Vadim Zeitlin // Created: April 1997 -// RCS-ID: $Id: socket.h 61675 2009-08-16 23:13:45Z VZ $ +// RCS-ID: $Id: socket.h 70796 2012-03-04 00:29:31Z VZ $ // Copyright: (c) 1997 Guilhem Lavaux // (c) 2008 Vadim Zeitlin // Licence: wxWindows licence @@ -61,7 +61,7 @@ // include the header defining timeval: under Windows this struct is used only // with sockets so we need to include winsock.h which we do via windows.h -#ifdef __WXMSW__ +#ifdef __WINDOWS__ #include "wx/msw/wrapwin.h" #else #include // for timeval @@ -79,7 +79,7 @@ // define some symbols which winsock.h defines but traditional BSD headers // don't -#ifndef __WXMSW__ +#ifndef __WINDOWS__ #define SOCKET int #endif @@ -367,7 +367,7 @@ private: wxDECLARE_NO_COPY_CLASS(wxSocketImpl); }; -#if defined(__WXMSW__) +#if defined(__WINDOWS__) #include "wx/msw/private/sockmsw.h" #else #include "wx/unix/private/sockunix.h" diff --git a/Externals/wxWidgets3/include/wx/private/wxprintf.h b/Externals/wxWidgets3/include/wx/private/wxprintf.h index af20eab169..0bb0098cb5 100644 --- a/Externals/wxWidgets3/include/wx/private/wxprintf.h +++ b/Externals/wxWidgets3/include/wx/private/wxprintf.h @@ -4,7 +4,7 @@ // Author: Ove Kaven // Modified by: Ron Lee, Francesco Montorsi // Created: 09/04/99 -// RCS-ID: $Id: wxprintf.h 65690 2010-09-30 14:30:35Z VZ $ +// RCS-ID: $Id: wxprintf.h 70796 2012-03-04 00:29:31Z VZ $ // Copyright: (c) wxWidgets copyright // Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// @@ -289,7 +289,7 @@ bool wxPrintfConvSpec::Parse(const CharType *format) CHECK_PREC m_szFlags[flagofs++] = char(ch); break; -#ifdef __WXMSW__ +#ifdef __WINDOWS__ // under Windows we support the special '%I64' notation as longlong // integer conversion specifier for MSVC compatibility // (it behaves exactly as '%lli' or '%Li' or '%qi') @@ -308,7 +308,7 @@ bool wxPrintfConvSpec::Parse(const CharType *format) break; } // else: fall-through, 'I' is MSVC equivalent of C99 'z' -#endif // __WXMSW__ +#endif // __WINDOWS__ case wxT('z'): case wxT('Z'): diff --git a/Externals/wxWidgets3/include/wx/prntbase.h b/Externals/wxWidgets3/include/wx/prntbase.h index 24d941683c..8b71a0658f 100644 --- a/Externals/wxWidgets3/include/wx/prntbase.h +++ b/Externals/wxWidgets3/include/wx/prntbase.h @@ -4,7 +4,7 @@ // Author: Julian Smart // Modified by: // Created: 01/02/97 -// RCS-ID: $Id: prntbase.h 66539 2011-01-03 15:57:21Z VZ $ +// RCS-ID: $Id: prntbase.h 68026 2011-06-22 22:58:07Z VZ $ // Copyright: (c) Julian Smart // Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// @@ -40,6 +40,7 @@ class WXDLLIMPEXP_FWD_CORE wxPreviewFrame; class WXDLLIMPEXP_FWD_CORE wxPrintFactory; class WXDLLIMPEXP_FWD_CORE wxPrintNativeDataBase; class WXDLLIMPEXP_FWD_CORE wxPrintPreview; +class wxPrintPageMaxCtrl; class wxPrintPageTextCtrl; //---------------------------------------------------------------------------- @@ -53,6 +54,19 @@ enum wxPrinterError wxPRINTER_ERROR }; +// Preview frame modality kind used with wxPreviewFrame::Initialize() +enum wxPreviewFrameModalityKind +{ + // Disable all the other top level windows while the preview is shown. + wxPreviewFrame_AppModal, + + // Disable only the parent window while the preview is shown. + wxPreviewFrame_WindowModal, + + // Don't disable any windows. + wxPreviewFrame_NonModal +}; + //---------------------------------------------------------------------------- // wxPrintFactory //---------------------------------------------------------------------------- @@ -384,8 +398,26 @@ public: const wxString& name = wxFrameNameStr); virtual ~wxPreviewFrame(); + // Either Initialize() or InitializeWithModality() must be called before + // showing the preview frame, the former being just a particular case of + // the latter initializing the frame for being showing app-modally. + + // Notice that we must keep Initialize() with its existing signature to + // avoid breaking the old code that overrides it and we can't reuse the + // same name for the other functions to avoid virtual function hiding + // problem and the associated warnings given by some compilers (e.g. from + // g++ with -Woverloaded-virtual). + virtual void Initialize() + { + InitializeWithModality(wxPreviewFrame_AppModal); + } + + // Also note that this method is not virtual as it doesn't need to be + // overridden: it's never called by wxWidgets (of course, the same is true + // for Initialize() but, again, it must remain virtual for compatibility). + void InitializeWithModality(wxPreviewFrameModalityKind kind); + void OnCloseWindow(wxCloseEvent& event); - virtual void Initialize(); virtual void CreateCanvas(); virtual void CreateControlBar(); @@ -397,6 +429,9 @@ protected: wxPrintPreviewBase* m_printPreview; wxWindowDisabler* m_windowDisabler; + wxPreviewFrameModalityKind m_modalityKind; + + private: void OnChar(wxKeyEvent& event); @@ -453,6 +488,7 @@ public: virtual ~wxPreviewControlBar(); virtual void CreateButtons(); + virtual void SetPageInfo(int minPage, int maxPage); virtual void SetZoomControl(int zoom); virtual int GetZoomControl(); virtual wxPrintPreviewBase *GetPrintPreview() const @@ -496,7 +532,8 @@ protected: wxPrintPreviewBase* m_printPreview; wxButton* m_closeButton; wxChoice* m_zoomControl; - wxPrintPageTextCtrl* m_currentPageText; + wxPrintPageTextCtrl* m_currentPageText; + wxPrintPageMaxCtrl* m_maxPageText; long m_buttonFlags; diff --git a/Externals/wxWidgets3/include/wx/progdlg.h b/Externals/wxWidgets3/include/wx/progdlg.h index 7507e07ba2..e6d4132765 100644 --- a/Externals/wxWidgets3/include/wx/progdlg.h +++ b/Externals/wxWidgets3/include/wx/progdlg.h @@ -4,7 +4,7 @@ // Author: Julian Smart // Modified by: // Created: -// RCS-ID: $Id: progdlg.h 66930 2011-02-16 23:45:00Z VZ $ +// RCS-ID: $Id: progdlg.h 70345 2012-01-15 01:05:28Z VZ $ // Copyright: (c) Julian Smart // Licence: wxWindows Licence ///////////////////////////////////////////////////////////////////////////// @@ -29,31 +29,27 @@ #define wxPD_CAN_SKIP 0x0080 -#ifdef __WXPALMOS__ - #include "wx/palmos/progdlg.h" +#include "wx/generic/progdlgg.h" + +#if defined(__WXMSW__) && wxUSE_THREADS && !defined(__WXUNIVERSAL__) + #include "wx/msw/progdlg.h" #else - #include "wx/generic/progdlgg.h" + class WXDLLIMPEXP_CORE wxProgressDialog + : public wxGenericProgressDialog + { + public: + wxProgressDialog( const wxString& title, const wxString& message, + int maximum = 100, + wxWindow *parent = NULL, + int style = wxPD_APP_MODAL | wxPD_AUTO_HIDE ) + : wxGenericProgressDialog( title, message, maximum, + parent, style ) + { } - #if defined(__WXMSW__) && wxUSE_THREADS && !defined(__WXUNIVERSAL__) - #include "wx/msw/progdlg.h" - #else - class WXDLLIMPEXP_CORE wxProgressDialog - : public wxGenericProgressDialog - { - public: - wxProgressDialog( const wxString& title, const wxString& message, - int maximum = 100, - wxWindow *parent = NULL, - int style = wxPD_APP_MODAL | wxPD_AUTO_HIDE ) - : wxGenericProgressDialog( title, message, maximum, - parent, style ) - { } - - private: - wxDECLARE_DYNAMIC_CLASS_NO_COPY( wxProgressDialog ); - }; - #endif // defined(__WXMSW__) && wxUSE_THREADS -#endif // __WXPALMOS__ + private: + wxDECLARE_DYNAMIC_CLASS_NO_COPY( wxProgressDialog ); + }; +#endif // defined(__WXMSW__) && wxUSE_THREADS #endif // wxUSE_PROGRESSDLG diff --git a/Externals/wxWidgets3/include/wx/protocol/ftp.h b/Externals/wxWidgets3/include/wx/protocol/ftp.h index cb03a70639..bae8c78fdc 100644 --- a/Externals/wxWidgets3/include/wx/protocol/ftp.h +++ b/Externals/wxWidgets3/include/wx/protocol/ftp.h @@ -5,7 +5,7 @@ // Modified by: Mark Johnson, wxWindows@mj10777.de // 20000917 : RmDir, GetLastResult, GetList // Created: 07/07/1997 -// RCS-ID: $Id: ftp.h 67280 2011-03-22 14:17:38Z DS $ +// RCS-ID: $Id: ftp.h 67384 2011-04-03 20:31:32Z DS $ // Copyright: (c) 1997, 1998 Guilhem Lavaux // Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// @@ -139,7 +139,7 @@ protected: wxString GetPortCmdArgument(const wxIPV4address& Local, const wxIPV4address& New); // accept connection from server in active mode, returns the same socket as - // passed in in passive mode + // passed in passive mode wxSocketBase *AcceptIfActive(wxSocketBase *sock); diff --git a/Externals/wxWidgets3/include/wx/protocol/http.h b/Externals/wxWidgets3/include/wx/protocol/http.h index 8618b311a5..d3fff96500 100644 --- a/Externals/wxWidgets3/include/wx/protocol/http.h +++ b/Externals/wxWidgets3/include/wx/protocol/http.h @@ -4,7 +4,7 @@ // Author: Guilhem Lavaux // Modified by: Simo Virokannas (authentication, Dec 2005) // Created: August 1997 -// RCS-ID: $Id: http.h 67254 2011-03-20 00:14:35Z DS $ +// RCS-ID: $Id: http.h 70408 2012-01-20 12:22:25Z VZ $ // Copyright: (c) 1997, 1998 Guilhem Lavaux // Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// @@ -17,6 +17,7 @@ #include "wx/hashmap.h" #include "wx/protocol/protocol.h" +#include "wx/buffer.h" class WXDLLIMPEXP_NET wxHTTP : public wxProtocol { @@ -36,13 +37,19 @@ public: int GetResponse() const { return m_http_response; } void SetHeader(const wxString& header, const wxString& h_data); - void SetPostBuffer(const wxString& post_buf); + bool SetPostText(const wxString& contentType, + const wxString& data, + const wxMBConv& conv = wxConvUTF8); + bool SetPostBuffer(const wxString& contentType, const wxMemoryBuffer& data); void SetProxyMode(bool on); /* Cookies */ wxString GetCookie(const wxString& cookie) const; bool HasCookies() const { return m_cookies.size() > 0; } + // Use the other SetPostBuffer() overload or SetPostText() instead. + wxDEPRECATED(void SetPostBuffer(const wxString& post_buf)); + protected: enum wxHTTP_Req { @@ -80,7 +87,8 @@ protected: bool m_read, m_proxy_mode; wxSockAddress *m_addr; - wxString m_post_buf; + wxMemoryBuffer m_postBuffer; + wxString m_contentType; int m_http_response; DECLARE_DYNAMIC_CLASS(wxHTTP) diff --git a/Externals/wxWidgets3/include/wx/radiobox.h b/Externals/wxWidgets3/include/wx/radiobox.h index 768c63e787..7b7960c215 100644 --- a/Externals/wxWidgets3/include/wx/radiobox.h +++ b/Externals/wxWidgets3/include/wx/radiobox.h @@ -4,7 +4,7 @@ // Author: Vadim Zeitlin // Modified by: // Created: 10.09.00 -// RCS-ID: $Id: radiobox.h 65668 2010-09-29 13:45:51Z VZ $ +// RCS-ID: $Id: radiobox.h 70345 2012-01-15 01:05:28Z VZ $ // Copyright: (c) Vadim Zeitlin // Licence: wxWindows licence /////////////////////////////////////////////////////////////////////////////// @@ -168,8 +168,6 @@ private: #include "wx/cocoa/radiobox.h" #elif defined(__WXPM__) #include "wx/os2/radiobox.h" -#elif defined(__WXPALMOS__) - #include "wx/palmos/radiobox.h" #endif #endif // wxUSE_RADIOBOX diff --git a/Externals/wxWidgets3/include/wx/radiobut.h b/Externals/wxWidgets3/include/wx/radiobut.h index a0bf142b77..d69ec49579 100644 --- a/Externals/wxWidgets3/include/wx/radiobut.h +++ b/Externals/wxWidgets3/include/wx/radiobut.h @@ -4,7 +4,7 @@ // Author: Vadim Zeitlin // Modified by: // Created: 07.09.00 -// RCS-ID: $Id: radiobut.h 54125 2008-06-11 19:17:41Z SC $ +// RCS-ID: $Id: radiobut.h 70345 2012-01-15 01:05:28Z VZ $ // Copyright: (c) Vadim Zeitlin // Licence: wxWindows licence /////////////////////////////////////////////////////////////////////////////// @@ -51,8 +51,6 @@ extern WXDLLIMPEXP_DATA_CORE(const char) wxRadioButtonNameStr[]; #include "wx/cocoa/radiobut.h" #elif defined(__WXPM__) #include "wx/os2/radiobut.h" -#elif defined(__WXPALMOS__) - #include "wx/palmos/radiobut.h" #endif #endif // wxUSE_RADIOBTN diff --git a/Externals/wxWidgets3/include/wx/rawbmp.h b/Externals/wxWidgets3/include/wx/rawbmp.h index 69c6df19f9..2fca1857d4 100644 --- a/Externals/wxWidgets3/include/wx/rawbmp.h +++ b/Externals/wxWidgets3/include/wx/rawbmp.h @@ -4,7 +4,7 @@ // Author: Eric Kidd, Vadim Zeitlin // Modified by: // Created: 10.03.03 -// RCS-ID: $Id: rawbmp.h 66054 2010-11-07 13:16:20Z VZ $ +// RCS-ID: $Id: rawbmp.h 70165 2011-12-29 14:42:13Z SN $ // Copyright: (c) 2002 Vadim Zeitlin // Licence: wxWindows licence /////////////////////////////////////////////////////////////////////////////// @@ -172,6 +172,11 @@ typedef wxPixelFormat wxImagePixelFormat; // Under GTK+ 2.X we use GdkPixbuf, which is standard RGB or RGBA typedef wxPixelFormat wxNativePixelFormat; + #define wxPIXEL_FORMAT_ALPHA 3 +#elif defined(__WXPM__) + // Under PM, we can use standard RGB or RGBA + typedef wxPixelFormat wxNativePixelFormat; + #define wxPIXEL_FORMAT_ALPHA 3 #elif defined(__WXDFB__) // Under DirectFB, RGB components are reversed, they're in BGR order @@ -596,7 +601,7 @@ struct wxPixelDataOut // data access // ----------- - // access to invidividual colour components + // access to individual colour components ChannelType& Red() { return m_ptr[PixelFormat::RED]; } ChannelType& Green() { return m_ptr[PixelFormat::GREEN]; } ChannelType& Blue() { return m_ptr[PixelFormat::BLUE]; } diff --git a/Externals/wxWidgets3/include/wx/region.h b/Externals/wxWidgets3/include/wx/region.h index 8ad565e04f..c032903f3d 100644 --- a/Externals/wxWidgets3/include/wx/region.h +++ b/Externals/wxWidgets3/include/wx/region.h @@ -4,7 +4,7 @@ // Author: Julian Smart // Modified by: // Created: -// RCS-ID: $Id: region.h 58804 2009-02-09 09:01:19Z SC $ +// RCS-ID: $Id: region.h 70353 2012-01-15 14:46:41Z VZ $ // Copyright: (c) Julian Smart // Licence: wxWindows Licence ///////////////////////////////////////////////////////////////////////////// @@ -181,8 +181,7 @@ protected: // some ports implement a generic Combine() function while others only // implement individual wxRegion operations, factor out the common code for the // ports with Combine() in this class -#if defined(__WXPALMOS__) || \ - defined(__WXMSW__) || \ +#if defined(__WXMSW__) || \ ( defined(__WXMAC__) && wxOSX_USE_COCOA_OR_CARBON ) || \ defined(__WXPM__) @@ -213,9 +212,7 @@ protected: #endif // ports with wxRegion::Combine() -#if defined(__WXPALMOS__) - #include "wx/palmos/region.h" -#elif defined(__WXMSW__) +#if defined(__WXMSW__) #include "wx/msw/region.h" #elif defined(__WXGTK20__) #include "wx/gtk/region.h" @@ -223,8 +220,6 @@ protected: #include "wx/gtk1/region.h" #elif defined(__WXMOTIF__) || defined(__WXX11__) #include "wx/x11/region.h" -#elif defined(__WXMGL__) - #include "wx/mgl/region.h" #elif defined(__WXDFB__) #include "wx/dfb/region.h" #elif defined(__WXMAC__) diff --git a/Externals/wxWidgets3/include/wx/richmsgdlg.h b/Externals/wxWidgets3/include/wx/richmsgdlg.h index 4204cffeba..6d1ac376fd 100644 --- a/Externals/wxWidgets3/include/wx/richmsgdlg.h +++ b/Externals/wxWidgets3/include/wx/richmsgdlg.h @@ -3,7 +3,7 @@ // Purpose: wxRichMessageDialogBase // Author: Rickard Westerlund // Created: 2010-07-03 -// RCS-ID: $Id: richmsgdlg.h 65349 2010-08-18 22:48:41Z VZ $ +// RCS-ID: $Id: richmsgdlg.h 70165 2011-12-29 14:42:13Z SN $ // Copyright: (c) 2010 wxWidgets team // Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// @@ -45,7 +45,7 @@ public: wxString GetDetailedText() const { return m_detailedText; } - virtual bool IsCheckBoxChecked() const { return m_checkBoxValue; }; + virtual bool IsCheckBoxChecked() const { return m_checkBoxValue; } protected: const wxString m_detailsExpanderCollapsedLabel; diff --git a/Externals/wxWidgets3/include/wx/richtooltip.h b/Externals/wxWidgets3/include/wx/richtooltip.h new file mode 100644 index 0000000000..0005edb8b1 --- /dev/null +++ b/Externals/wxWidgets3/include/wx/richtooltip.h @@ -0,0 +1,103 @@ +/////////////////////////////////////////////////////////////////////////////// +// Name: wx/richtooltip.h +// Purpose: Declaration of wxRichToolTip class. +// Author: Vadim Zeitlin +// Created: 2011-10-07 +// RCS-ID: $Id: richtooltip.h 69480 2011-10-19 21:53:10Z VZ $ +// Copyright: (c) 2011 Vadim Zeitlin +// Licence: wxWindows licence +/////////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_RICHTOOLTIP_H_ +#define _WX_RICHTOOLTIP_H_ + +#include "wx/defs.h" + +#if wxUSE_RICHTOOLTIP + +#include "wx/colour.h" + +class WXDLLIMPEXP_FWD_CORE wxFont; +class WXDLLIMPEXP_FWD_CORE wxIcon; +class WXDLLIMPEXP_FWD_CORE wxWindow; + +class wxRichToolTipImpl; + +// This enum describes the kind of the tip shown which combines both the tip +// position and appearance because the two are related (when the tip is +// positioned asymmetrically, a right handed triangle is used but an +// equilateral one when it's in the middle of a side). +// +// Automatic selects the tip appearance best suited for the current platform +// and the position best suited for the window the tooltip is shown for, i.e. +// chosen in such a way that the tooltip is always fully on screen. +// +// Other values describe the position of the tooltip itself, not the window it +// relates to. E.g. wxTipKind_Top places the tip on the top of the tooltip and +// so the tooltip itself is located beneath its associated window. +enum wxTipKind +{ + wxTipKind_None, + wxTipKind_TopLeft, + wxTipKind_Top, + wxTipKind_TopRight, + wxTipKind_BottomLeft, + wxTipKind_Bottom, + wxTipKind_BottomRight, + wxTipKind_Auto +}; + +// ---------------------------------------------------------------------------- +// wxRichToolTip: a customizable but not necessarily native tooltip. +// ---------------------------------------------------------------------------- + +// Notice that this class does not inherit from wxWindow. +class WXDLLIMPEXP_ADV wxRichToolTip +{ +public: + // Ctor must specify the tooltip title and main message, additional + // attributes can be set later. + wxRichToolTip(const wxString& title, const wxString& message); + + // Set the background colour: if two colours are specified, the background + // is drawn using a gradient from top to bottom, otherwise a single solid + // colour is used. + void SetBackgroundColour(const wxColour& col, + const wxColour& colEnd = wxColour()); + + // Set the small icon to show: either one of the standard information/ + // warning/error ones (the question icon doesn't make sense for a tooltip) + // or a custom icon. + void SetIcon(int icon = wxICON_INFORMATION); + void SetIcon(const wxIcon& icon); + + // Set timeout after which the tooltip should disappear, in milliseconds. + // By default the tooltip is hidden after system-dependent interval of time + // elapses but this method can be used to change this or also disable + // hiding the tooltip automatically entirely by passing 0 in this parameter + // (but doing this can result in native version not being used). + void SetTimeout(unsigned milliseconds); + + // Choose the tip kind, possibly none. By default the tip is positioned + // automatically, as if wxTipKind_Auto was used. + void SetTipKind(wxTipKind tipKind); + + // Set the title text font. By default it's emphasized using the font style + // or colour appropriate for the current platform. + void SetTitleFont(const wxFont& font); + + // Show the tooltip for the given window. + void ShowFor(wxWindow* win); + + // Non-virtual dtor as this class is not supposed to be derived from. + ~wxRichToolTip(); + +private: + wxRichToolTipImpl* const m_impl; + + wxDECLARE_NO_COPY_CLASS(wxRichToolTip); +}; + +#endif // wxUSE_RICHTOOLTIP + +#endif // _WX_RICHTOOLTIP_H_ diff --git a/Externals/wxWidgets3/include/wx/rtti.h b/Externals/wxWidgets3/include/wx/rtti.h index ddc3a35b7e..43e3939c41 100644 --- a/Externals/wxWidgets3/include/wx/rtti.h +++ b/Externals/wxWidgets3/include/wx/rtti.h @@ -4,7 +4,7 @@ // Author: Julian Smart // Modified by: Ron Lee // Created: 01/02/97 -// RCS-ID: $Id: rtti.h 66636 2011-01-07 20:55:00Z SC $ +// RCS-ID: $Id: rtti.h 67879 2011-06-07 13:06:17Z VZ $ // Copyright: (c) 1997 Julian Smart // (c) 2001 Ron Lee // Licence: wxWindows licence @@ -144,7 +144,7 @@ WXDLLIMPEXP_BASE wxObject *wxCreateDynamicObject(const wxString& name); static wxObject* wxCreateObject() #define wxDECLARE_CLASS(name) \ - wxDECLARE_DYNAMIC_CLASS(name) + wxDECLARE_ABSTRACT_CLASS(name) // common part of the macros below diff --git a/Externals/wxWidgets3/include/wx/scopedarray.h b/Externals/wxWidgets3/include/wx/scopedarray.h index 35257a224b..11cc04130a 100644 --- a/Externals/wxWidgets3/include/wx/scopedarray.h +++ b/Externals/wxWidgets3/include/wx/scopedarray.h @@ -3,7 +3,7 @@ // Purpose: scoped smart pointer class // Author: Vadim Zeitlin // Created: 2009-02-03 -// RCS-ID: $Id: scopedarray.h 58634 2009-02-03 12:01:46Z VZ $ +// RCS-ID: $Id: scopedarray.h 70109 2011-12-24 15:43:14Z VZ $ // Copyright: (c) Jesse Lovelace and original Boost authors (see below) // (c) 2009 Vadim Zeitlin // Licence: wxWindows licence @@ -41,7 +41,7 @@ public: { if ( array != m_array ) { - delete m_array; + delete [] m_array; m_array = array; } } diff --git a/Externals/wxWidgets3/include/wx/scopeguard.h b/Externals/wxWidgets3/include/wx/scopeguard.h index 85ca52385b..c0c354536a 100644 --- a/Externals/wxWidgets3/include/wx/scopeguard.h +++ b/Externals/wxWidgets3/include/wx/scopeguard.h @@ -4,7 +4,7 @@ // Author: Vadim Zeitlin // Modified by: // Created: 03.07.2003 -// RCS-ID: $Id: scopeguard.h 63473 2010-02-12 22:47:21Z VZ $ +// RCS-ID: $Id: scopeguard.h 67592 2011-04-24 13:14:47Z VS $ // Copyright: (c) 2003 Vadim Zeitlin // Licence: wxWindows licence /////////////////////////////////////////////////////////////////////////////// @@ -390,7 +390,7 @@ namespace wxPrivate { // empty class just to be able to define a reference to it -class VariableSetterBase { }; +class VariableSetterBase : public wxScopeGuardImplBase { }; typedef const VariableSetterBase& VariableSetter; @@ -404,10 +404,9 @@ public: { } - ~VariableSetterImpl() - { - m_var = m_value; - } + ~VariableSetterImpl() { wxPrivateOnScopeExit(*this); } + + void Execute() { m_var = m_value; } private: T& m_var; @@ -426,10 +425,9 @@ public: { } - ~VariableNullerImpl() - { - m_var = NULL; - } + ~VariableNullerImpl() { wxPrivateOnScopeExit(*this); } + + void Execute() { m_var = NULL; } private: T& m_var; diff --git a/Externals/wxWidgets3/include/wx/setup_inc.h b/Externals/wxWidgets3/include/wx/setup_inc.h index ec25baa50d..32b19dfbb8 100644 --- a/Externals/wxWidgets3/include/wx/setup_inc.h +++ b/Externals/wxWidgets3/include/wx/setup_inc.h @@ -4,7 +4,7 @@ // Author: Vadim Zeitlin // Modified by: // Created: -// RCS-ID: $Id: setup_inc.h 67062 2011-02-27 12:48:07Z VZ $ +// RCS-ID: $Id: setup_inc.h 69463 2011-10-18 21:57:02Z VZ $ // Copyright: (c) Vadim Zeitlin // Licence: wxWindows licence /////////////////////////////////////////////////////////////////////////////// @@ -197,15 +197,6 @@ // Recommended setting: 0 (this is still work in progress...) #define wxUSE_EXTENDED_RTTI 0 -// Set wxUSE_STL to 1 to derive wxList(Foo) and wxArray(Foo) from -// std::list and std::vector, with a compatibility interface, -// and for wxHashMap to be implemented with templates. -// -// Default is 0 -// -// Recommended setting: YMMV -#define wxUSE_STL 0 - // Support for message/error logging. This includes wxLogXXX() functions and // wxLog and derived classes. Don't set this to 0 unless you really know what // you are doing. @@ -257,44 +248,6 @@ // Recommended setting: 1 as setting it to 0 disables many other things #define wxUSE_STREAMS 1 -// This is not a real option but is used as the default value for -// wxUSE_STD_IOSTREAM and wxUSE_STD_STRING. -// -// Currently the Digital Mars and Watcom compilers come without standard C++ -// library headers by default, wxUSE_STD_STRING can be set to 1 if you do have -// them (e.g. from STLPort). -// -// VC++ 5.0 does include standard C++ library headers, however they produce -// many warnings that can't be turned off when compiled at warning level 4. -#if defined(__DMC__) || defined(__WATCOMC__) \ - || (defined(_MSC_VER) && _MSC_VER < 1200) - #define wxUSE_STD_DEFAULT 0 -#else - #define wxUSE_STD_DEFAULT 1 -#endif - -// Use standard C++ streams if 1 instead of wx streams in some places. If -// disabled (default), wx streams are used everywhere and wxWidgets doesn't -// depend on the standard streams library. -// -// Notice that enabling this does not replace wx streams with std streams -// everywhere, in a lot of places wx streams are used no matter what. -// -// Default is 0 -// -// Recommended setting: 1 if you use the standard streams anyhow and so -// dependency on the standard streams library is not a -// problem -#define wxUSE_STD_IOSTREAM wxUSE_STD_DEFAULT - -// Enable conversion to standard C++ string if 1. -// -// Default is 1 for most compilers. -// -// Recommended setting: 1 unless you want to ensure your program doesn't use -// the standard C++ library at all. -#define wxUSE_STD_STRING wxUSE_STD_DEFAULT - // Support for positional parameters (e.g. %1$d, %2$s ...) in wxVsnprintf. // Note that if the system's implementation does not support positional // parameters, setting this to 1 forces the use of the wxWidgets implementation @@ -310,6 +263,107 @@ // Recommended setting: 1 if you want to support multiple languages #define wxUSE_PRINTF_POS_PARAMS 1 + +// ---------------------------------------------------------------------------- +// Interoperability with the standard library. +// ---------------------------------------------------------------------------- + +// Set wxUSE_STL to 1 to enable maximal interoperability with the standard +// library, even at the cost of backwards compatibility. +// +// Default is 0 +// +// Recommended setting: 0 as the options below already provide a relatively +// good level of interoperability and changing this option arguably isn't worth +// diverging from the official builds of the library. +#define wxUSE_STL 0 + +// This is not a real option but is used as the default value for +// wxUSE_STD_IOSTREAM, wxUSE_STD_STRING and wxUSE_STD_CONTAINERS. +// +// Currently the Digital Mars and Watcom compilers come without standard C++ +// library headers by default, wxUSE_STD_STRING can be set to 1 if you do have +// them (e.g. from STLPort). +// +// VC++ 5.0 does include standard C++ library headers, however they produce +// many warnings that can't be turned off when compiled at warning level 4. +#if defined(__DMC__) || defined(__WATCOMC__) \ + || (defined(_MSC_VER) && _MSC_VER < 1200) + #define wxUSE_STD_DEFAULT 0 +#else + #define wxUSE_STD_DEFAULT 1 +#endif + +// Use standard C++ containers to implement wxVector<>, wxStack<>, wxDList<> +// and wxHashXXX<> classes. If disabled, wxWidgets own (mostly compatible but +// usually more limited) implementations are used which allows to avoid the +// dependency on the C++ run-time library. +// +// Notice that the compilers mentioned in wxUSE_STD_DEFAULT comment above don't +// support using standard containers and that VC6 needs non-default options for +// such build to avoid getting "fatal error C1076: compiler limit : internal +// heap limit reached; use /Zm to specify a higher limit" in its own standard +// headers, so you need to ensure you do increase the heap size before enabling +// this option for this compiler. +// +// Default is 0 for compatibility reasons. +// +// Recommended setting: 1 unless compatibility with the official wxWidgets +// build and/or the existing code is a concern. +#define wxUSE_STD_CONTAINERS 0 + +// Use standard C++ streams if 1 instead of wx streams in some places. If +// disabled, wx streams are used everywhere and wxWidgets doesn't depend on the +// standard streams library. +// +// Notice that enabling this does not replace wx streams with std streams +// everywhere, in a lot of places wx streams are used no matter what. +// +// Default is 1 if compiler supports it. +// +// Recommended setting: 1 if you use the standard streams anyhow and so +// dependency on the standard streams library is not a +// problem +#define wxUSE_STD_IOSTREAM wxUSE_STD_DEFAULT + +// Enable minimal interoperability with the standard C++ string class if 1. +// "Minimal" means that wxString can be constructed from std::string or +// std::wstring but can't be implicitly converted to them. You need to enable +// the option below for the latter. +// +// Default is 1 for most compilers. +// +// Recommended setting: 1 unless you want to ensure your program doesn't use +// the standard C++ library at all. +#define wxUSE_STD_STRING wxUSE_STD_DEFAULT + +// Make wxString as much interchangeable with std::[w]string as possible, in +// particular allow implicit conversion of wxString to either of these classes. +// This comes at a price (or a benefit, depending on your point of view) of not +// allowing implicit conversion to "const char *" and "const wchar_t *". +// +// Because a lot of existing code relies on these conversions, this option is +// disabled by default but can be enabled for your build if you don't care +// about compatibility. +// +// Default is 0 if wxUSE_STL has its default value or 1 if it is enabled. +// +// Recommended setting: 0 to remain compatible with the official builds of +// wxWidgets. +#define wxUSE_STD_STRING_CONV_IN_WXSTRING wxUSE_STL + +// VC++ 4.2 and above allows and but you can't mix +// them. Set this option to 1 to use , 0 to use . +// +// Note that newer compilers (including VC++ 7.1 and later) don't support +// wxUSE_IOSTREAMH == 1 and so will be used anyhow. +// +// Default is 0. +// +// Recommended setting: 0, only set to 1 if you use a really old compiler +#define wxUSE_IOSTREAMH 0 + + // ---------------------------------------------------------------------------- // non GUI features selection // ---------------------------------------------------------------------------- @@ -647,6 +701,34 @@ // Recommended setting: 1 #define wxUSE_STC 1 +// Use wxWidget's web viewing classes +// +// Default is 1 +// +// Recommended setting: 1 +#define wxUSE_WEBVIEW 1 + +// Use the IE wxWebView backend +// +// Default is 1 on MSW +// +// Recommended setting: 1 +#ifdef __WXMSW__ +#define wxUSE_WEBVIEW_IE 1 +#else +#define wxUSE_WEBVIEW_IE 0 +#endif + +// Use the WebKit wxWebView backend +// +// Default is 1 on GTK and OSX +// +// Recommended setting: 1 +#if defined(__WXGTK__) || defined(__WXOSX__) +#define wxUSE_WEBVIEW_WEBKIT 1 +#else +#define wxUSE_WEBVIEW_WEBKIT 0 +#endif // Enable the new wxGraphicsPath and wxGraphicsContext classes for an advanced // 2D drawing API. (Still somewhat experimental) @@ -745,6 +827,7 @@ // // Recommended setting: 1 #define wxUSE_ANIMATIONCTRL 1 // wxAnimationCtrl +#define wxUSE_BANNERWINDOW 1 // wxBannerWindow #define wxUSE_BUTTON 1 // wxButton #define wxUSE_BMPBUTTON 1 // wxBitmapButton #define wxUSE_CALENDARCTRL 1 // wxCalendarCtrl @@ -780,8 +863,10 @@ #define wxUSE_STATTEXT 1 // wxStaticText #define wxUSE_STATBMP 1 // wxStaticBitmap #define wxUSE_TEXTCTRL 1 // wxTextCtrl +#define wxUSE_TIMEPICKCTRL 1 // wxTimePickerCtrl #define wxUSE_TOGGLEBTN 1 // requires wxButton #define wxUSE_TREECTRL 1 // wxTreeCtrl +#define wxUSE_TREELISTCTRL 1 // wxTreeListCtrl // Use a status bar class? Depending on the value of wxUSE_NATIVE_STATUSBAR // below either wxStatusBar95 or a generic wxStatusBar will be used. @@ -998,6 +1083,14 @@ // Recommended setting: 1 #define wxUSE_NOTIFICATION_MESSAGE 1 +// wxRichToolTip is a customizable tooltip class which has more functionality +// than the stock (but native, unlike this class) wxToolTip. +// +// Default is 1. +// +// Recommended setting: 1 (but can be safely set to 0 if you don't need it) +#define wxUSE_RICHTOOLTIP 1 + // Use wxSashWindow class. // // Default is 1. @@ -1303,28 +1396,15 @@ // to create files in SVG (Scalable Vector Graphics) format. #define wxUSE_SVG 1 -// ---------------------------------------------------------------------------- -// other compiler (mis)features -// ---------------------------------------------------------------------------- - -// Set this to 0 if your compiler can't cope with omission of prototype -// parameters. +// Should wxDC provide SetTransformMatrix() and related methods? // -// Default is 1. +// Default is 1 but can be set to 0 if this functionality is not used. Notice +// that currently only wxMSW supports this so setting this to 0 doesn't change +// much for non-MSW platforms (although it will still save a few bytes +// probably). // -// Recommended setting: 1 (should never need to set this to 0) -#define REMOVE_UNUSED_ARG 1 - -// VC++ 4.2 and above allows and but you can't mix -// them. Set this option to 1 to use , 0 to use . -// -// Note that newer compilers (including VC++ 7.1 and later) don't support -// wxUSE_IOSTREAMH == 1 and so will be used anyhow. -// -// Default is 0. -// -// Recommended setting: 0, only set to 1 if you use a really old compiler -#define wxUSE_IOSTREAMH 0 +// Recommended setting: 1. +#define wxUSE_DC_TRANSFORM_MATRIX 1 // ---------------------------------------------------------------------------- // image format support diff --git a/Externals/wxWidgets3/include/wx/sizer.h b/Externals/wxWidgets3/include/wx/sizer.h index ddd8ef06a0..249f2d8389 100644 --- a/Externals/wxWidgets3/include/wx/sizer.h +++ b/Externals/wxWidgets3/include/wx/sizer.h @@ -4,7 +4,7 @@ // Author: Robert Roebling and Robin Dunn // Modified by: Ron Lee, Vadim Zeitlin (wxSizerFlags) // Created: -// RCS-ID: $Id: sizer.h 66862 2011-02-08 13:36:13Z VZ $ +// RCS-ID: $Id: sizer.h 69970 2011-12-10 04:34:06Z RD $ // Copyright: (c) Robin Dunn, Robert Roebling // Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// @@ -251,10 +251,10 @@ class WXDLLIMPEXP_CORE wxSizerItem : public wxObject public: // window wxSizerItem( wxWindow *window, - int proportion, - int flag, - int border, - wxObject* userData ); + int proportion=0, + int flag=0, + int border=0, + wxObject* userData=NULL ); // window with flags wxSizerItem(wxWindow *window, const wxSizerFlags& flags) @@ -266,10 +266,10 @@ public: // subsizer wxSizerItem( wxSizer *sizer, - int proportion, - int flag, - int border, - wxObject* userData ); + int proportion=0, + int flag=0, + int border=0, + wxObject* userData=NULL ); // sizer with flags wxSizerItem(wxSizer *sizer, const wxSizerFlags& flags) @@ -282,10 +282,10 @@ public: // spacer wxSizerItem( int width, int height, - int proportion, - int flag, - int border, - wxObject* userData); + int proportion=0, + int flag=0, + int border=0, + wxObject* userData=NULL); // spacer with flags wxSizerItem(int width, int height, const wxSizerFlags& flags) diff --git a/Externals/wxWidgets3/include/wx/slider.h b/Externals/wxWidgets3/include/wx/slider.h index 344d442b2a..e6d9f5e6ea 100644 --- a/Externals/wxWidgets3/include/wx/slider.h +++ b/Externals/wxWidgets3/include/wx/slider.h @@ -4,7 +4,7 @@ // Author: Vadim Zeitlin // Modified by: // Created: 09.02.01 -// RCS-ID: $Id: slider.h 66844 2011-02-05 16:36:30Z VZ $ +// RCS-ID: $Id: slider.h 70345 2012-01-15 01:05:28Z VZ $ // Copyright: (c) 1996-2001 Vadim Zeitlin // Licence: wxWindows licence /////////////////////////////////////////////////////////////////////////////// @@ -105,7 +105,7 @@ public: virtual int GetSelStart() const { return GetMax(); } virtual void SetSelection(int WXUNUSED(min), int WXUNUSED(max)) { } -#ifdef WXWIN_COMPATIBILITY_2_8 +#if WXWIN_COMPATIBILITY_2_8 wxDEPRECATED_INLINE( void SetTickFreq(int freq, int), DoSetTickFreq(freq); ) #endif @@ -149,8 +149,6 @@ private: #include "wx/cocoa/slider.h" #elif defined(__WXPM__) #include "wx/os2/slider.h" -#elif defined(__WXPALMOS__) - #include "wx/palmos/slider.h" #endif #endif // wxUSE_SLIDER diff --git a/Externals/wxWidgets3/include/wx/sound.h b/Externals/wxWidgets3/include/wx/sound.h index d19a2d10b5..863b1d3298 100644 --- a/Externals/wxWidgets3/include/wx/sound.h +++ b/Externals/wxWidgets3/include/wx/sound.h @@ -4,7 +4,7 @@ // Author: Vaclav Slavik // Modified by: // Created: 2004/02/01 -// RCS-ID: $Id: sound.h 61508 2009-07-23 20:30:22Z VZ $ +// RCS-ID: $Id: sound.h 70796 2012-03-04 00:29:31Z VZ $ // Copyright: (c) 2004, Vaclav Slavik // Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// @@ -55,7 +55,7 @@ protected: // wxSound class implementation // ---------------------------------------------------------------------------- -#if defined(__WXMSW__) +#if defined(__WINDOWS__) #include "wx/msw/sound.h" #elif defined(__WXCOCOA__) #include "wx/cocoa/sound.h" diff --git a/Externals/wxWidgets3/include/wx/srchctrl.h b/Externals/wxWidgets3/include/wx/srchctrl.h index 6dc5ee4435..bae24ec5d1 100644 --- a/Externals/wxWidgets3/include/wx/srchctrl.h +++ b/Externals/wxWidgets3/include/wx/srchctrl.h @@ -3,7 +3,7 @@ // Purpose: wxSearchCtrlBase class // Author: Vince Harron // Created: 2006-02-18 -// RCS-ID: $Id: srchctrl.h 67254 2011-03-20 00:14:35Z DS $ +// RCS-ID: $Id: srchctrl.h 68911 2011-08-27 12:13:23Z VZ $ // Copyright: (c) Vince Harron // Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// @@ -26,8 +26,12 @@ // no native version, use the generic one #define wxUSE_NATIVE_SEARCH_CONTROL 0 - class WXDLLIMPEXP_CORE wxSearchCtrlBaseBaseClass : public wxControl, - public wxTextCtrlIface + #include "wx/compositewin.h" + #include "wx/containr.h" + + class WXDLLIMPEXP_CORE wxSearchCtrlBaseBaseClass + : public wxCompositeWindow< wxNavigationEnabled >, + public wxTextCtrlIface { }; #endif diff --git a/Externals/wxWidgets3/include/wx/sstream.h b/Externals/wxWidgets3/include/wx/sstream.h index a891306dfa..405af50f4e 100644 --- a/Externals/wxWidgets3/include/wx/sstream.h +++ b/Externals/wxWidgets3/include/wx/sstream.h @@ -4,7 +4,7 @@ // Author: Vadim Zeitlin // Modified by: // Created: 2004-09-19 -// RCS-ID: $Id: sstream.h 63248 2010-01-24 11:33:17Z VZ $ +// RCS-ID: $Id: sstream.h 67968 2011-06-16 16:22:15Z VZ $ // Copyright: (c) 2004 Vadim Zeitlin // Licence: wxWindows licence /////////////////////////////////////////////////////////////////////////////// @@ -66,9 +66,9 @@ public: wxStringOutputStream(wxString *pString = NULL, wxMBConv& conv = wxConvUTF8) : m_conv(conv) -#if wxUSE_UNICODE_WCHAR +#if wxUSE_UNICODE , m_unconv(0) -#endif // wxUSE_UNICODE_WCHAR +#endif // wxUSE_UNICODE { m_str = pString ? pString : &m_strInternal; m_pos = m_str->length() / sizeof(wxChar); @@ -98,10 +98,10 @@ private: // arbitrary 8 bit data wxMBConv& m_conv; -#if wxUSE_UNICODE_WCHAR +#if wxUSE_UNICODE // unconverted data from the last call to OnSysWrite() wxMemoryBuffer m_unconv; -#endif // wxUSE_UNICODE_WCHAR +#endif // wxUSE_UNICODE wxDECLARE_NO_COPY_CLASS(wxStringOutputStream); }; diff --git a/Externals/wxWidgets3/include/wx/stack.h b/Externals/wxWidgets3/include/wx/stack.h index 1ca3cd657a..b4e8ed2f8a 100644 --- a/Externals/wxWidgets3/include/wx/stack.h +++ b/Externals/wxWidgets3/include/wx/stack.h @@ -13,12 +13,12 @@ #include "wx/vector.h" -#if wxUSE_STL +#if wxUSE_STD_CONTAINERS #include #define wxStack std::stack -#else // !wxUSE_STL +#else // !wxUSE_STD_CONTAINERS // Notice that unlike std::stack, wxStack currently always uses wxVector and // can't be used with any other underlying container type. @@ -53,7 +53,7 @@ private: container_type m_cont; }; -#endif // wxUSE_STL/!wxUSE_STL +#endif // wxUSE_STD_CONTAINERS/!wxUSE_STD_CONTAINERS // Deprecated macro-based class for compatibility only, don't use any more. diff --git a/Externals/wxWidgets3/include/wx/stackwalk.h b/Externals/wxWidgets3/include/wx/stackwalk.h index 2032d830fe..22cf370868 100644 --- a/Externals/wxWidgets3/include/wx/stackwalk.h +++ b/Externals/wxWidgets3/include/wx/stackwalk.h @@ -4,7 +4,7 @@ // Author: Vadim Zeitlin // Modified by: // Created: 2005-01-07 -// RCS-ID: $Id: stackwalk.h 64754 2010-06-26 11:43:13Z FM $ +// RCS-ID: $Id: stackwalk.h 70796 2012-03-04 00:29:31Z VZ $ // Copyright: (c) 2004 Vadim Zeitlin // Licence: wxWindows licence /////////////////////////////////////////////////////////////////////////////// @@ -146,7 +146,7 @@ protected: virtual void OnStackFrame(const wxStackFrame& frame) = 0; }; -#ifdef __WXMSW__ +#ifdef __WINDOWS__ #include "wx/msw/stackwalk.h" #elif defined(__UNIX__) #include "wx/unix/stackwalk.h" diff --git a/Externals/wxWidgets3/include/wx/stattext.h b/Externals/wxWidgets3/include/wx/stattext.h index f9ca7a0e82..a3165cc877 100644 --- a/Externals/wxWidgets3/include/wx/stattext.h +++ b/Externals/wxWidgets3/include/wx/stattext.h @@ -5,7 +5,7 @@ // Modified by: // Created: // Copyright: (c) Julian Smart -// RCS-ID: $Id: stattext.h 67280 2011-03-22 14:17:38Z DS $ +// RCS-ID: $Id: stattext.h 70345 2012-01-15 01:05:28Z VZ $ // Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// @@ -102,8 +102,6 @@ private: #include "wx/cocoa/stattext.h" #elif defined(__WXPM__) #include "wx/os2/stattext.h" -#elif defined(__WXPALMOS__) - #include "wx/palmos/stattext.h" #endif #endif // !wxNO_PORT_STATTEXT_INCLUDE diff --git a/Externals/wxWidgets3/include/wx/statusbr.h b/Externals/wxWidgets3/include/wx/statusbr.h index 255ec251ed..f76eb72864 100644 --- a/Externals/wxWidgets3/include/wx/statusbr.h +++ b/Externals/wxWidgets3/include/wx/statusbr.h @@ -4,7 +4,7 @@ // Author: Vadim Zeitlin // Modified by: // Created: 05.02.00 -// RCS-ID: $Id: statusbr.h 66226 2010-11-22 01:22:36Z VZ $ +// RCS-ID: $Id: statusbr.h 70808 2012-03-04 20:31:42Z VZ $ // Copyright: (c) Vadim Zeitlin // Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// @@ -234,10 +234,7 @@ protected: #if defined(__WXUNIVERSAL__) #define wxStatusBarUniv wxStatusBar #include "wx/univ/statusbr.h" -#elif defined(__WXPALMOS__) - #define wxStatusBarPalm wxStatusBar - #include "wx/palmos/statusbr.h" -#elif defined(__WIN32__) && wxUSE_NATIVE_STATUSBAR +#elif defined(__WXMSW__) && wxUSE_NATIVE_STATUSBAR #include "wx/msw/statusbar.h" #elif defined(__WXMAC__) #define wxStatusBarMac wxStatusBar diff --git a/Externals/wxWidgets3/include/wx/stdpaths.h b/Externals/wxWidgets3/include/wx/stdpaths.h index 92b49f740c..5288ae626a 100644 --- a/Externals/wxWidgets3/include/wx/stdpaths.h +++ b/Externals/wxWidgets3/include/wx/stdpaths.h @@ -4,7 +4,7 @@ // Author: Vadim Zeitlin // Modified by: // Created: 2004-10-17 -// RCS-ID: $Id: stdpaths.h 65652 2010-09-27 11:51:50Z VZ $ +// RCS-ID: $Id: stdpaths.h 70796 2012-03-04 00:29:31Z VZ $ // Copyright: (c) 2004 Vadim Zeitlin // Licence: wxWindows licence /////////////////////////////////////////////////////////////////////////////// @@ -171,7 +171,7 @@ protected: }; #if wxUSE_STDPATHS - #if defined(__WXMSW__) + #if defined(__WINDOWS__) #include "wx/msw/stdpaths.h" #define wxHAS_NATIVE_STDPATHS // We want CoreFoundation paths on both CarbonLib and Darwin (for all ports) @@ -184,9 +184,6 @@ protected: #elif defined(__UNIX__) #include "wx/unix/stdpaths.h" #define wxHAS_NATIVE_STDPATHS - #elif defined(__PALMOS__) - #include "wx/palmos/stdpaths.h" - #define wxHAS_NATIVE_STDPATHS #endif #endif diff --git a/Externals/wxWidgets3/include/wx/stdstream.h b/Externals/wxWidgets3/include/wx/stdstream.h index 33cfa34747..4e3ab6dc65 100644 --- a/Externals/wxWidgets3/include/wx/stdstream.h +++ b/Externals/wxWidgets3/include/wx/stdstream.h @@ -4,7 +4,7 @@ // wxInputStream and wxOutputStream // Author: Jonathan Liu // Created: 2009-05-02 -// RCS-ID: $Id: stdstream.h 64924 2010-07-12 22:50:51Z VZ $ +// RCS-ID: $Id: stdstream.h 70515 2012-02-05 14:18:37Z VZ $ // Copyright: (c) 2009 Jonathan Liu // Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// @@ -47,6 +47,18 @@ protected: virtual int uflow(); virtual int pbackfail(int c = EOF); + // Special work around for VC8/9 (this bug was fixed in VC10 and later): + // these versions have non-standard _Xsgetn_s() that it being called from + // the stream code instead of xsgetn() and so our overridden implementation + // never actually gets used. To work around this, forward to it explicitly. +#if defined(__VISUALC8__) || defined(__VISUALC9__) + virtual std::streamsize + _Xsgetn_s(char *s, size_t WXUNUSED(size), std::streamsize n) + { + return xsgetn(s, n); + } +#endif // VC8 or VC9 + wxInputStream& m_stream; int m_lastChar; }; diff --git a/Externals/wxWidgets3/include/wx/stopwatch.h b/Externals/wxWidgets3/include/wx/stopwatch.h index 6e124f1547..da5069e975 100644 --- a/Externals/wxWidgets3/include/wx/stopwatch.h +++ b/Externals/wxWidgets3/include/wx/stopwatch.h @@ -1,10 +1,12 @@ ///////////////////////////////////////////////////////////////////////////// // Name: wx/stopwatch.h // Purpose: wxStopWatch and global time-related functions -// Author: Julian Smart (wxTimer), Sylvain Bougnoux (wxStopWatch) +// Author: Julian Smart (wxTimer), Sylvain Bougnoux (wxStopWatch), +// Vadim Zeitlin (time functions, current wxStopWatch) // Created: 26.06.03 (extracted from wx/timer.h) -// RCS-ID: $Id: stopwatch.h 61508 2009-07-23 20:30:22Z VZ $ +// RCS-ID: $Id: stopwatch.h 69838 2011-11-27 19:50:27Z VZ $ // Copyright: (c) 1998-2003 Julian Smart, Sylvain Bougnoux +// (c) 2011 Vadim Zeitlin // Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// @@ -14,6 +16,11 @@ #include "wx/defs.h" #include "wx/longlong.h" +// Time-related functions are also available via this header for compatibility +// but you should include wx/time.h directly if you need only them and not +// wxStopWatch itself. +#include "wx/time.h" + // ---------------------------------------------------------------------------- // wxStopWatch: measure time intervals with up to 1ms resolution // ---------------------------------------------------------------------------- @@ -26,14 +33,16 @@ public: // ctor starts the stop watch wxStopWatch() { m_pauseCount = 0; Start(); } - // start the stop watch at the moment t0 + // Start the stop watch at the moment t0 expressed in milliseconds (i.e. + // calling Time() immediately afterwards returns t0). This can be used to + // restart an existing stopwatch. void Start(long t0 = 0); // pause the stop watch void Pause() { if ( m_pauseCount++ == 0 ) - m_pause = GetElapsedTime(); + m_elapsedBeforePause = GetCurrentClockValue() - m_t0; } // resume it @@ -43,22 +52,37 @@ public: wxT("Resuming stop watch which is not paused") ); if ( --m_pauseCount == 0 ) - Start(m_pause); + { + DoStart(); + m_t0 -= m_elapsedBeforePause; + } } - // get elapsed time since the last Start() in milliseconds - long Time() const; + // Get elapsed time since the last Start() in microseconds. + wxLongLong TimeInMicro() const; -protected: - // returns the elapsed time since t0 - long GetElapsedTime() const; + // get elapsed time since the last Start() in milliseconds + long Time() const { return (TimeInMicro()/1000).ToLong(); } private: - // the time of the last Start() + // Really starts the stop watch. The initial time is set to current clock + // value. + void DoStart(); + + // Returns the current clock value in its native units. + wxLongLong GetCurrentClockValue() const; + + // Return the frequency of the clock used in its ticks per second. + wxLongLong GetClockFreq() const; + + + // The clock value when the stop watch was last started. Its units vary + // depending on the platform. wxLongLong m_t0; - // the time of the last Pause() (only valid if m_pauseCount > 0) - long m_pause; + // The elapsed time as of last Pause() call (only valid if m_pauseCount > + // 0) in the same units as m_t0. + wxLongLong m_elapsedBeforePause; // if > 0, the stop watch is paused, otherwise it is running int m_pauseCount; @@ -78,37 +102,4 @@ private: #endif // wxUSE_LONGLONG && WXWIN_COMPATIBILITY_2_6 -// ---------------------------------------------------------------------------- -// global time functions -// ---------------------------------------------------------------------------- - -// Get number of seconds since local time 00:00:00 Jan 1st 1970. -extern long WXDLLIMPEXP_BASE wxGetLocalTime(); - -// Get number of seconds since GMT 00:00:00, Jan 1st 1970. -extern long WXDLLIMPEXP_BASE wxGetUTCTime(); - -#if wxUSE_LONGLONG - typedef wxLongLong wxMilliClock_t; - inline long wxMilliClockToLong(wxLongLong ll) { return ll.ToLong(); } -#else - typedef double wxMilliClock_t; - inline long wxMilliClockToLong(double d) { return wx_truncate_cast(long, d); } -#endif // wxUSE_LONGLONG - -// Get number of milliseconds since local time 00:00:00 Jan 1st 1970 -extern wxMilliClock_t WXDLLIMPEXP_BASE wxGetLocalTimeMillis(); - -#define wxGetCurrentTime() wxGetLocalTime() - -// on some really old systems gettimeofday() doesn't have the second argument, -// define wxGetTimeOfDay() to hide this difference -#ifdef HAVE_GETTIMEOFDAY - #ifdef WX_GETTIMEOFDAY_NO_TZ - #define wxGetTimeOfDay(tv) gettimeofday(tv) - #else - #define wxGetTimeOfDay(tv) gettimeofday((tv), NULL) - #endif -#endif // HAVE_GETTIMEOFDAY - #endif // _WX_STOPWATCH_H_ diff --git a/Externals/wxWidgets3/include/wx/strconv.h b/Externals/wxWidgets3/include/wx/strconv.h index 49fd028da3..26b5314ca5 100644 --- a/Externals/wxWidgets3/include/wx/strconv.h +++ b/Externals/wxWidgets3/include/wx/strconv.h @@ -4,7 +4,7 @@ // Author: Ove Kaaven, Robert Roebling, Vadim Zeitlin // Modified by: // Created: 29/01/98 -// RCS-ID: $Id: strconv.h 67254 2011-03-20 00:14:35Z DS $ +// RCS-ID: $Id: strconv.h 70345 2012-01-15 01:05:28Z VZ $ // Copyright: (c) 1998 Ove Kaaven, Robert Roebling // (c) 1998-2006 Vadim Zeitlin // Licence: wxWindows licence @@ -25,9 +25,7 @@ # undef __BSEXCPT__ #endif -#ifndef __WXPALMOS5__ #include -#endif // ! __WXPALMOS5__ class WXDLLIMPEXP_FWD_BASE wxString; diff --git a/Externals/wxWidgets3/include/wx/stream.h b/Externals/wxWidgets3/include/wx/stream.h index b29089b073..7103c8d970 100644 --- a/Externals/wxWidgets3/include/wx/stream.h +++ b/Externals/wxWidgets3/include/wx/stream.h @@ -4,7 +4,7 @@ // Author: Guilhem Lavaux, Guillermo Rodriguez Garcia, Vadim Zeitlin // Modified by: // Created: 11/07/98 -// RCS-ID: $Id: stream.h 59761 2009-03-23 10:59:40Z VZ $ +// RCS-ID: $Id: stream.h 68331 2011-07-22 16:16:00Z VZ $ // Copyright: (c) Guilhem Lavaux // Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// @@ -64,7 +64,7 @@ public: bool operator!() const { return !IsOk(); } // reset the stream state - void Reset() { m_lasterror = wxSTREAM_NO_ERROR; } + void Reset(wxStreamError error = wxSTREAM_NO_ERROR) { m_lasterror = error; } // this doesn't make sense for all streams, always test its return value virtual size_t GetSize() const; diff --git a/Externals/wxWidgets3/include/wx/string.h b/Externals/wxWidgets3/include/wx/string.h index ae0c706ed5..930e822d25 100644 --- a/Externals/wxWidgets3/include/wx/string.h +++ b/Externals/wxWidgets3/include/wx/string.h @@ -4,7 +4,7 @@ // Author: Vadim Zeitlin // Modified by: // Created: 29/01/98 -// RCS-ID: $Id: string.h 67181 2011-03-13 13:53:54Z VZ $ +// RCS-ID: $Id: string.h 70796 2012-03-04 00:29:31Z VZ $ // Copyright: (c) 1998 Vadim Zeitlin // Licence: wxWindows licence /////////////////////////////////////////////////////////////////////////////// @@ -24,7 +24,6 @@ #include "wx/defs.h" // everybody should include this -#ifndef __WXPALMOS5__ #if defined(__WXMAC__) || defined(__VISAGECPP__) #include #endif @@ -47,7 +46,6 @@ #ifdef HAVE_STRCASECMP_IN_STRINGS_H #include // for strcasecmp() #endif // HAVE_STRCASECMP_IN_STRINGS_H -#endif // ! __WXPALMOS5__ #include "wx/wxcrtbase.h" // for wxChar, wxStrlen() etc. #include "wx/strvararg.h" @@ -71,7 +69,7 @@ // it would have to be re-tested and probably corrected // CS: under OSX release builds the string destructor/cache cleanup sometimes // crashes, disable until we find the true reason or a better workaround -#if wxUSE_UNICODE_UTF8 && !defined(__WXMSW__) && !defined(__WXOSX__) +#if wxUSE_UNICODE_UTF8 && !defined(__WINDOWS__) && !defined(__WXOSX__) #define wxUSE_STRING_POS_CACHE 1 #else #define wxUSE_STRING_POS_CACHE 0 @@ -170,8 +168,7 @@ inline int Stricmp(const char *psz1, const char *psz2) return stricmp(psz1, psz2); #elif defined(__WXPM__) return stricmp(psz1, psz2); -#elif defined(__WXPALMOS__) || \ - defined(HAVE_STRCASECMP_IN_STRING_H) || \ +#elif defined(HAVE_STRCASECMP_IN_STRING_H) || \ defined(HAVE_STRCASECMP_IN_STRINGS_H) || \ defined(__GNUWIN32__) return strcasecmp(psz1, psz2); @@ -1345,12 +1342,13 @@ public: } #endif // wxUSE_STRING_POS_CACHE - // even if we're not built with wxUSE_STL == 1 it is very convenient to allow - // implicit conversions from std::string to wxString and vice verse as this - // allows to use the same strings in non-GUI and GUI code, however we don't - // want to unconditionally add this ctor as it would make wx lib dependent on - // libstdc++ on some Linux versions which is bad, so instead we ask the - // client code to define this wxUSE_STD_STRING symbol if they need it + // even if we're not built with wxUSE_STD_STRING_CONV_IN_WXSTRING == 1 it is + // very convenient to allow implicit conversions from std::string to wxString + // and vice verse as this allows to use the same strings in non-GUI and GUI + // code, however we don't want to unconditionally add this ctor as it would + // make wx lib dependent on libstdc++ on some Linux versions which is bad, so + // instead we ask the client code to define this wxUSE_STD_STRING symbol if + // they need it #if wxUSE_STD_STRING #if wxUSE_UNICODE_WCHAR wxString(const wxStdWideString& str) : m_impl(str) {} @@ -1368,10 +1366,8 @@ public: #endif #endif // wxUSE_STD_STRING - // Unlike ctor from std::string, we provide conversion to std::string only - // if wxUSE_STL and not merely wxUSE_STD_STRING (which is on by default), - // because it conflicts with operator const char/wchar_t* but we still - // provide explicit conversions to std::[w]string for convenience in any case + // Also always provide explicit conversions to std::[w]string in any case, + // see below for the implicit ones. #if wxUSE_STD_STRING // We can avoid a copy if we already use this string type internally, // otherwise we create a copy on the fly: @@ -1408,13 +1404,14 @@ public: } #endif -#if wxUSE_STL - // In wxUSE_STL case we also provide implicit conversions as there is no - // ambiguity with the const char/wchar_t* ones as they are disabled in this - // build (for consistency with std::basic_string<>) +#if wxUSE_STD_STRING_CONV_IN_WXSTRING + // Implicit conversions to std::[w]string are not provided by default as + // they conflict with the implicit conversions to "const char/wchar_t *" + // which we use for backwards compatibility but do provide them if + // explicitly requested. operator wxStringToStdStringRetType() const { return ToStdString(); } operator wxStringToStdWstringRetType() const { return ToStdWstring(); } -#endif // wxUSE_STL +#endif // wxUSE_STD_STRING_CONV_IN_WXSTRING #undef wxStringToStdStringRetType #undef wxStringToStdWstringRetType @@ -1654,11 +1651,12 @@ public: operator wxCStrData() const { return c_str(); } // the first two operators conflict with operators for conversion to - // std::string and they must be disabled in STL build; the next one only - // makes sense if conversions to char* are also defined and not defining it - // in STL build also helps us to get more clear error messages for the code - // which relies on implicit conversion to char* in STL build -#if !wxUSE_STL + // std::string and they must be disabled if those conversions are enabled; + // the next one only makes sense if conversions to char* are also defined + // and not defining it in STL build also helps us to get more clear error + // messages for the code which relies on implicit conversion to char* in + // STL build +#if !wxUSE_STD_STRING_CONV_IN_WXSTRING operator const char*() const { return c_str(); } operator const wchar_t*() const { return c_str(); } @@ -1666,7 +1664,7 @@ public: // wxWidgets versions: this is the same as conversion to const char * so it // may fail! operator const void*() const { return c_str(); } -#endif // wxUSE_STL +#endif // !wxUSE_STD_STRING_CONV_IN_WXSTRING // identical to c_str(), for MFC compatibility const wxCStrData GetData() const { return c_str(); } diff --git a/Externals/wxWidgets3/include/wx/stringimpl.h b/Externals/wxWidgets3/include/wx/stringimpl.h index f2229c4ece..fd611454ca 100644 --- a/Externals/wxWidgets3/include/wx/stringimpl.h +++ b/Externals/wxWidgets3/include/wx/stringimpl.h @@ -4,14 +4,14 @@ // Author: Vadim Zeitlin // Modified by: // Created: 29/01/98 -// RCS-ID: $Id: stringimpl.h 61508 2009-07-23 20:30:22Z VZ $ +// RCS-ID: $Id: stringimpl.h 67343 2011-03-30 14:16:04Z VZ $ // Copyright: (c) 1998 Vadim Zeitlin // Licence: wxWindows licence /////////////////////////////////////////////////////////////////////////////// /* This header implements std::string-like string class, wxStringImpl, that is - used by wxString to store the data. Alternatively, if wxUSE_STL=1, + used by wxString to store the data. Alternatively, if wxUSE_STD_STRING=1, wxStringImpl is just a typedef to std:: string class. */ @@ -50,15 +50,9 @@ extern WXDLLIMPEXP_DATA_BASE(const wxStringCharType*) wxEmptyStringImpl; // ---------------------------------------------------------------------------- -// deal with STL/non-STL/non-STL-but-wxUSE_STD_STRING +// deal with various build options // ---------------------------------------------------------------------------- -// using STL implies using std::string -#if wxUSE_STL - #undef wxUSE_STD_STRING - #define wxUSE_STD_STRING 1 -#endif - // we use STL-based string internally if we use std::string at all now, there // should be no reason to prefer our internal implement but if you really need // it you can predefine wxUSE_STL_BASED_WXSTRING as 0 when building the library diff --git a/Externals/wxWidgets3/include/wx/strvararg.h b/Externals/wxWidgets3/include/wx/strvararg.h index 13409da707..78f44579db 100644 --- a/Externals/wxWidgets3/include/wx/strvararg.h +++ b/Externals/wxWidgets3/include/wx/strvararg.h @@ -3,7 +3,7 @@ // Purpose: macros for implementing type-safe vararg passing of strings // Author: Vaclav Slavik // Created: 2007-02-19 -// RCS-ID: $Id: strvararg.h 67280 2011-03-22 14:17:38Z DS $ +// RCS-ID: $Id: strvararg.h 67760 2011-05-17 22:12:39Z VZ $ // Copyright: (c) 2007 REA Elektronik GmbH // Licence: wxWindows licence /////////////////////////////////////////////////////////////////////////////// @@ -825,7 +825,7 @@ WX_ARG_NORMALIZER_FORWARD(const signed char&, signed char); #undef WX_ARG_NORMALIZER_FORWARD #undef _WX_ARG_NORMALIZER_FORWARD_IMPL -#undef wxASSERT_ARG_TYPE +// NB: Don't #undef wxASSERT_ARG_TYPE here as it's also used in wx/longlong.h. // ---------------------------------------------------------------------------- // WX_VA_ARG_STRING diff --git a/Externals/wxWidgets3/include/wx/taskbar.h b/Externals/wxWidgets3/include/wx/taskbar.h index 7df9b4f190..0e7de72668 100644 --- a/Externals/wxWidgets3/include/wx/taskbar.h +++ b/Externals/wxWidgets3/include/wx/taskbar.h @@ -5,7 +5,7 @@ // Modified by: // Created: // Copyright: (c) Julian Smart -// RCS-ID: $Id: taskbar.h 58822 2009-02-10 03:43:30Z PC $ +// RCS-ID: $Id: taskbar.h 70345 2012-01-15 01:05:28Z VZ $ // Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// @@ -32,7 +32,7 @@ public: #if defined(__WXGTK__) || defined(__WXX11__) || defined(__WXMOTIF__) static bool IsAvailable(); #else - static bool IsAvailable() { return true; }; + static bool IsAvailable() { return true; } #endif // Operations: @@ -61,9 +61,7 @@ private: // now include the actual class declaration // ---------------------------------------------------------------------------- -#if defined(__WXPALMOS__) - #include "wx/palmos/taskbar.h" -#elif defined(__WXMSW__) +#if defined(__WXMSW__) #include "wx/msw/taskbar.h" #elif defined(__WXGTK20__) #include "wx/gtk/taskbar.h" diff --git a/Externals/wxWidgets3/include/wx/tbarbase.h b/Externals/wxWidgets3/include/wx/tbarbase.h index 3e2b4c4f9e..fb4e7fde74 100644 --- a/Externals/wxWidgets3/include/wx/tbarbase.h +++ b/Externals/wxWidgets3/include/wx/tbarbase.h @@ -4,7 +4,7 @@ // Author: Julian Smart // Modified by: // Created: 01/02/97 -// RCS-ID: $Id: tbarbase.h 64854 2010-07-08 17:35:04Z JS $ +// RCS-ID: $Id: tbarbase.h 70854 2012-03-10 00:01:09Z RD $ // Copyright: (c) Julian Smart // Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// @@ -473,7 +473,7 @@ public: { return GetToolBitmapSize(); } // returns a (non separator) tool containing the point (x, y) or NULL if - // there is no tool at this point (corrdinates are client) + // there is no tool at this point (coordinates are client) virtual wxToolBarToolBase *FindToolForPosition(wxCoord x, wxCoord y) const = 0; @@ -567,6 +567,33 @@ public: // use GetToolMargins() instead wxSize GetMargins() const { return GetToolMargins(); } + // Tool factories, + // helper functions to create toolbar tools + // ------------------------- + virtual wxToolBarToolBase *CreateTool(int toolid, + const wxString& label, + const wxBitmap& bmpNormal, + const wxBitmap& bmpDisabled = wxNullBitmap, + wxItemKind kind = wxITEM_NORMAL, + wxObject *clientData = NULL, + const wxString& shortHelp = wxEmptyString, + const wxString& longHelp = wxEmptyString) = 0; + + virtual wxToolBarToolBase *CreateTool(wxControl *control, + const wxString& label) = 0; + + // this one is not virtual but just a simple helper/wrapper around + // CreateTool() for separators + wxToolBarToolBase *CreateSeparator() + { + return CreateTool(wxID_SEPARATOR, + wxEmptyString, + wxNullBitmap, wxNullBitmap, + wxITEM_SEPARATOR, NULL, + wxEmptyString, wxEmptyString); + } + + // implementation only from now on // ------------------------------- @@ -618,29 +645,6 @@ protected: // called when the tools "can be toggled" flag changes virtual void DoSetToggle(wxToolBarToolBase *tool, bool toggle) = 0; - // the functions to create toolbar tools - virtual wxToolBarToolBase *CreateTool(int toolid, - const wxString& label, - const wxBitmap& bmpNormal, - const wxBitmap& bmpDisabled, - wxItemKind kind, - wxObject *clientData, - const wxString& shortHelp, - const wxString& longHelp) = 0; - - virtual wxToolBarToolBase *CreateTool(wxControl *control, - const wxString& label) = 0; - - // this one is not virtual but just a simple helper/wrapper around - // CreateTool() for separators - wxToolBarToolBase *CreateSeparator() - { - return CreateTool(wxID_SEPARATOR, - wxEmptyString, - wxNullBitmap, wxNullBitmap, - wxITEM_SEPARATOR, NULL, - wxEmptyString, wxEmptyString); - } // helper functions // ---------------- diff --git a/Externals/wxWidgets3/include/wx/textcompleter.h b/Externals/wxWidgets3/include/wx/textcompleter.h new file mode 100644 index 0000000000..fa422d309d --- /dev/null +++ b/Externals/wxWidgets3/include/wx/textcompleter.h @@ -0,0 +1,87 @@ +/////////////////////////////////////////////////////////////////////////////// +// Name: wx/textcompleter.h +// Purpose: Declaration of wxTextCompleter class. +// Author: Vadim Zeitlin +// Created: 2011-04-13 +// RCS-ID: $Id: textcompleter.h 67525 2011-04-17 23:14:11Z VZ $ +// Copyright: (c) 2011 Vadim Zeitlin +// Licence: wxWindows licence +/////////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_TEXTCOMPLETER_H_ +#define _WX_TEXTCOMPLETER_H_ + +// ---------------------------------------------------------------------------- +// wxTextCompleter: used by wxTextEnter::AutoComplete() +// ---------------------------------------------------------------------------- + +class WXDLLIMPEXP_CORE wxTextCompleter +{ +public: + wxTextCompleter() { } + + // The virtual functions to be implemented by the derived classes: the + // first one is called to start preparing for completions for the given + // prefix and, if it returns true, GetNext() is called until it returns an + // empty string indicating that there are no more completions. + virtual bool Start(const wxString& prefix) = 0; + virtual wxString GetNext() = 0; + + virtual ~wxTextCompleter(); + +private: + wxDECLARE_NO_COPY_CLASS(wxTextCompleter); +}; + +// ---------------------------------------------------------------------------- +// wxTextCompleterSimple: returns the entire set of completions at once +// ---------------------------------------------------------------------------- + +class WXDLLIMPEXP_CORE wxTextCompleterSimple : public wxTextCompleter +{ +public: + wxTextCompleterSimple() { } + + // Must be implemented to return all the completions for the given prefix. + virtual void GetCompletions(const wxString& prefix, wxArrayString& res) = 0; + + virtual bool Start(const wxString& prefix); + virtual wxString GetNext(); + +private: + wxArrayString m_completions; + unsigned m_index; + + wxDECLARE_NO_COPY_CLASS(wxTextCompleterSimple); +}; + +// ---------------------------------------------------------------------------- +// wxTextCompleterFixed: Trivial wxTextCompleter implementation which always +// returns the same fixed array of completions. +// ---------------------------------------------------------------------------- + +// NB: This class is private and intentionally not documented as it is +// currently used only for implementation of completion with the fixed list +// of strings only by wxWidgets itself, do not use it outside of wxWidgets. + +class wxTextCompleterFixed : public wxTextCompleterSimple +{ +public: + void SetCompletions(const wxArrayString& strings) + { + m_strings = strings; + } + + virtual void GetCompletions(const wxString& WXUNUSED(prefix), + wxArrayString& res) + { + res = m_strings; + } + +private: + wxArrayString m_strings; +}; + + +#endif // _WX_TEXTCOMPLETER_H_ + diff --git a/Externals/wxWidgets3/include/wx/textctrl.h b/Externals/wxWidgets3/include/wx/textctrl.h index 57fa252843..eb7a03c96e 100644 --- a/Externals/wxWidgets3/include/wx/textctrl.h +++ b/Externals/wxWidgets3/include/wx/textctrl.h @@ -4,7 +4,7 @@ // Author: Vadim Zeitlin // Modified by: // Created: 13.07.99 -// RCS-ID: $Id: textctrl.h 65756 2010-10-04 08:37:31Z JS $ +// RCS-ID: $Id: textctrl.h 70446 2012-01-23 11:28:28Z VZ $ // Copyright: (c) Vadim Zeitlin // Licence: wxWindows licence /////////////////////////////////////////////////////////////////////////////// @@ -171,11 +171,12 @@ enum wxTextAttrFlags wxTEXT_ATTR_FONT_WEIGHT = 0x00000010, wxTEXT_ATTR_FONT_ITALIC = 0x00000020, wxTEXT_ATTR_FONT_UNDERLINE = 0x00000040, + wxTEXT_ATTR_FONT_STRIKETHROUGH = 0x08000000, wxTEXT_ATTR_FONT_ENCODING = 0x02000000, wxTEXT_ATTR_FONT_FAMILY = 0x04000000, wxTEXT_ATTR_FONT = \ ( wxTEXT_ATTR_FONT_FACE | wxTEXT_ATTR_FONT_SIZE | wxTEXT_ATTR_FONT_WEIGHT | \ - wxTEXT_ATTR_FONT_ITALIC | wxTEXT_ATTR_FONT_UNDERLINE | wxTEXT_ATTR_FONT_ENCODING | wxTEXT_ATTR_FONT_FAMILY ), + wxTEXT_ATTR_FONT_ITALIC | wxTEXT_ATTR_FONT_UNDERLINE | wxTEXT_ATTR_FONT_STRIKETHROUGH | wxTEXT_ATTR_FONT_ENCODING | wxTEXT_ATTR_FONT_FAMILY ), wxTEXT_ATTR_ALIGNMENT = 0x00000080, wxTEXT_ATTR_LEFT_INDENT = 0x00000100, @@ -317,6 +318,7 @@ public: void SetFontWeight(wxFontWeight fontWeight) { m_fontWeight = fontWeight; m_flags |= wxTEXT_ATTR_FONT_WEIGHT; } void SetFontFaceName(const wxString& faceName) { m_fontFaceName = faceName; m_flags |= wxTEXT_ATTR_FONT_FACE; } void SetFontUnderlined(bool underlined) { m_fontUnderlined = underlined; m_flags |= wxTEXT_ATTR_FONT_UNDERLINE; } + void SetFontStrikethrough(bool strikethrough) { m_fontStrikethrough = strikethrough; m_flags |= wxTEXT_ATTR_FONT_STRIKETHROUGH; } void SetFontEncoding(wxFontEncoding encoding) { m_fontEncoding = encoding; m_flags |= wxTEXT_ATTR_FONT_ENCODING; } void SetFontFamily(wxFontFamily family) { m_fontFamily = family; m_flags |= wxTEXT_ATTR_FONT_FAMILY; } @@ -355,6 +357,7 @@ public: wxFontStyle GetFontStyle() const { return m_fontStyle; } wxFontWeight GetFontWeight() const { return m_fontWeight; } bool GetFontUnderlined() const { return m_fontUnderlined; } + bool GetFontStrikethrough() const { return m_fontStrikethrough; } const wxString& GetFontFaceName() const { return m_fontFaceName; } wxFontEncoding GetFontEncoding() const { return m_fontEncoding; } wxFontFamily GetFontFamily() const { return m_fontFamily; } @@ -379,8 +382,8 @@ public: int GetOutlineLevel() const { return m_outlineLevel; } // accessors - bool HasTextColour() const { return m_colText.Ok() && HasFlag(wxTEXT_ATTR_TEXT_COLOUR) ; } - bool HasBackgroundColour() const { return m_colBack.Ok() && HasFlag(wxTEXT_ATTR_BACKGROUND_COLOUR) ; } + bool HasTextColour() const { return m_colText.IsOk() && HasFlag(wxTEXT_ATTR_TEXT_COLOUR) ; } + bool HasBackgroundColour() const { return m_colBack.IsOk() && HasFlag(wxTEXT_ATTR_BACKGROUND_COLOUR) ; } bool HasAlignment() const { return (m_textAlignment != wxTEXT_ALIGNMENT_DEFAULT) && HasFlag(wxTEXT_ATTR_ALIGNMENT) ; } bool HasTabs() const { return HasFlag(wxTEXT_ATTR_TABS) ; } bool HasLeftIndent() const { return HasFlag(wxTEXT_ATTR_LEFT_INDENT); } @@ -389,6 +392,7 @@ public: bool HasFontSize() const { return HasFlag(wxTEXT_ATTR_FONT_SIZE); } bool HasFontItalic() const { return HasFlag(wxTEXT_ATTR_FONT_ITALIC); } bool HasFontUnderlined() const { return HasFlag(wxTEXT_ATTR_FONT_UNDERLINE); } + bool HasFontStrikethrough() const { return HasFlag(wxTEXT_ATTR_FONT_STRIKETHROUGH); } bool HasFontFaceName() const { return HasFlag(wxTEXT_ATTR_FONT_FACE); } bool HasFontEncoding() const { return HasFlag(wxTEXT_ATTR_FONT_ENCODING); } bool HasFontFamily() const { return HasFlag(wxTEXT_ATTR_FONT_FAMILY); } @@ -500,6 +504,7 @@ private: wxFontWeight m_fontWeight; wxFontFamily m_fontFamily; bool m_fontUnderlined; + bool m_fontStrikethrough; wxString m_fontFaceName; // Character style @@ -574,6 +579,11 @@ public: virtual long XYToPosition(long x, long y) const = 0; virtual bool PositionToXY(long pos, long *x, long *y) const = 0; + // translate the given position (which is just an index in the text control) + // to client coordinates + wxPoint PositionToCoords(long pos) const; + + virtual void ShowPosition(long pos) = 0; // find the character at position given in pixels @@ -592,6 +602,13 @@ protected: virtual bool DoLoadFile(const wxString& file, int fileType); virtual bool DoSaveFile(const wxString& file, int fileType); + // Return true if the given position is valid, i.e. positive and less than + // the last position. + virtual bool IsValidPosition(long pos) const = 0; + + // Default stub implementation of PositionToCoords() always returns + // wxDefaultPosition. + virtual wxPoint DoPositionToCoords(long pos) const; // the name of the last file loaded with LoadFile() which will be used by // SaveFile() by default @@ -625,6 +642,12 @@ public: wxTextEntryBase::SetValue(value); } +protected: + virtual bool IsValidPosition(long pos) const + { + return pos >= 0 && pos <= GetLastPosition(); + } + private: wxDECLARE_NO_COPY_CLASS(wxTextCtrlIface); }; @@ -723,6 +746,12 @@ protected: virtual bool DoLoadFile(const wxString& file, int fileType); virtual bool DoSaveFile(const wxString& file, int fileType); + // Another wxTextAreaBase override. + virtual bool IsValidPosition(long pos) const + { + return pos >= 0 && pos <= GetLastPosition(); + } + // implement the wxTextEntry pure virtual method virtual wxWindow *GetEditableWindow() { return this; } @@ -754,8 +783,6 @@ protected: #include "wx/cocoa/textctrl.h" #elif defined(__WXPM__) #include "wx/os2/textctrl.h" -#elif defined(__WXPALMOS__) - #include "wx/palmos/textctrl.h" #endif // ---------------------------------------------------------------------------- diff --git a/Externals/wxWidgets3/include/wx/textentry.h b/Externals/wxWidgets3/include/wx/textentry.h index a2bfc97e67..aeeffa652b 100644 --- a/Externals/wxWidgets3/include/wx/textentry.h +++ b/Externals/wxWidgets3/include/wx/textentry.h @@ -3,7 +3,7 @@ // Purpose: declares wxTextEntry interface defining a simple text entry // Author: Vadim Zeitlin // Created: 2007-09-24 -// RCS-ID: $Id: textentry.h 65552 2010-09-15 22:10:20Z VZ $ +// RCS-ID: $Id: textentry.h 68918 2011-08-27 14:11:13Z VZ $ // Copyright: (c) 2007 Vadim Zeitlin // Licence: wxWindows licence /////////////////////////////////////////////////////////////////////////////// @@ -16,9 +16,11 @@ typedef long wxTextPos; class WXDLLIMPEXP_FWD_BASE wxArrayString; +class WXDLLIMPEXP_FWD_CORE wxTextCompleter; class WXDLLIMPEXP_FWD_CORE wxTextEntryHintData; class WXDLLIMPEXP_FWD_CORE wxWindow; +#include "wx/filefn.h" // for wxFILE and wxDIR only #include "wx/gdicmn.h" // for wxPoint // ---------------------------------------------------------------------------- @@ -106,18 +108,26 @@ public: // these functions allow to auto-complete the text already entered into the // control using either the given fixed list of strings, the paths from the - // file system or, in the future, an arbitrary user-defined completer + // file system or an arbitrary user-defined completer // // they all return true if completion was enabled or false on error (most // commonly meaning that this functionality is not available under the // current platform) - virtual bool AutoComplete(const wxArrayString& WXUNUSED(choices)) - { - return false; - } + bool AutoComplete(const wxArrayString& choices) + { return DoAutoCompleteStrings(choices); } - virtual bool AutoCompleteFileNames() { return false; } + bool AutoCompleteFileNames() + { return DoAutoCompleteFileNames(wxFILE); } + + bool AutoCompleteDirectories() + { return DoAutoCompleteFileNames(wxDIR); } + + // notice that we take ownership of the pointer and will delete it + // + // if the pointer is NULL auto-completion is disabled + bool AutoComplete(wxTextCompleter *completer) + { return DoAutoCompleteCustom(completer); } // status @@ -218,6 +228,16 @@ protected: virtual bool DoSetMargins(const wxPoint& pt); virtual wxPoint DoGetMargins() const; + // the derived classes should override these virtual methods to implement + // auto-completion, they do the same thing as their public counterparts but + // have different names to allow overriding just one of them without hiding + // the other one(s) + virtual bool DoAutoCompleteStrings(const wxArrayString& WXUNUSED(choices)) + { return false; } + virtual bool DoAutoCompleteFileNames(int WXUNUSED(flags)) // wxFILE | wxDIR + { return false; } + virtual bool DoAutoCompleteCustom(wxTextCompleter *completer); + // class which should be used to temporarily disable text change events // diff --git a/Externals/wxWidgets3/include/wx/textwrapper.h b/Externals/wxWidgets3/include/wx/textwrapper.h index 69b13fe2ab..f776b9939e 100644 --- a/Externals/wxWidgets3/include/wx/textwrapper.h +++ b/Externals/wxWidgets3/include/wx/textwrapper.h @@ -3,7 +3,7 @@ // Purpose: declaration of wxTextWrapper class // Author: Vadim Zeitlin // Created: 2009-05-31 (extracted from dlgcmn.cpp via wx/private/stattext.h) -// RCS-ID: $Id: textwrapper.h 65363 2010-08-19 15:41:18Z VZ $ +// RCS-ID: $Id: textwrapper.h 70433 2012-01-22 00:58:05Z VZ $ // Copyright: (c) 1999, 2009 Vadim Zeitlin // Licence: wxWindows licence /////////////////////////////////////////////////////////////////////////////// @@ -98,7 +98,8 @@ public: protected: virtual wxWindow *OnCreateLine(const wxString& line) { - return new wxStaticText(m_win, wxID_ANY, line); + return new wxStaticText(m_win, wxID_ANY, + wxControl::EscapeMnemonics(line)); } virtual void OnOutputLine(const wxString& line) diff --git a/Externals/wxWidgets3/include/wx/tglbtn.h b/Externals/wxWidgets3/include/wx/tglbtn.h index 010dfb1622..72966cc759 100644 --- a/Externals/wxWidgets3/include/wx/tglbtn.h +++ b/Externals/wxWidgets3/include/wx/tglbtn.h @@ -5,7 +5,7 @@ // Author: John Norris, minor changes by Axel Schlueter // Modified by: // Created: 08.02.01 -// RCS-ID: $Id: tglbtn.h 66992 2011-02-22 13:25:30Z VZ $ +// RCS-ID: $Id: tglbtn.h 70345 2012-01-15 01:05:28Z VZ $ // Copyright: (c) 2000 Johnny C. Norris II // Licence: wxWindows Licence ///////////////////////////////////////////////////////////////////////////// @@ -18,7 +18,7 @@ #if wxUSE_TOGGLEBTN #include "wx/event.h" -#include "wx/control.h" // base class +#include "wx/anybutton.h" // base class extern WXDLLIMPEXP_DATA_CORE(const char) wxCheckBoxNameStr[]; @@ -28,7 +28,7 @@ wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_CORE, wxEVT_COMMAND_TOGGLEBUTTON_CLICKED, // wxToggleButtonBase // ---------------------------------------------------------------------------- -class WXDLLIMPEXP_CORE wxToggleButtonBase : public wxControl +class WXDLLIMPEXP_CORE wxToggleButtonBase : public wxAnyButton { public: wxToggleButtonBase() { } @@ -89,8 +89,6 @@ protected: #elif defined(__WXMAC__) #include "wx/osx/tglbtn.h" #define wxHAS_BITMAPTOGGLEBUTTON -#elif defined(__WXPALMOS__) - #include "wx/palmos/tglbtn.h" #elif defined(__WXPM__) #include "wx/os2/tglbtn.h" #endif diff --git a/Externals/wxWidgets3/include/wx/thread.h b/Externals/wxWidgets3/include/wx/thread.h index 49c131a216..59ccfc952a 100644 --- a/Externals/wxWidgets3/include/wx/thread.h +++ b/Externals/wxWidgets3/include/wx/thread.h @@ -5,7 +5,7 @@ // Modified by: Vadim Zeitlin (modifications partly inspired by omnithreads // package from Olivetti & Oracle Research Laboratory) // Created: 04/13/98 -// RCS-ID: $Id: thread.h 67185 2011-03-14 11:54:32Z VZ $ +// RCS-ID: $Id: thread.h 70796 2012-03-04 00:29:31Z VZ $ // Copyright: (c) Guilhem Lavaux // Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// @@ -219,7 +219,7 @@ private: // in order to avoid any overhead under platforms where critical sections are // just mutexes make all wxCriticalSection class functions inline -#if !defined(__WXMSW__) +#if !defined(__WINDOWS__) #define wxCRITSECT_IS_MUTEX 1 #define wxCRITSECT_INLINE WXEXPORT inline @@ -249,13 +249,16 @@ public: // enter the section (the same as locking a mutex) wxCRITSECT_INLINE void Enter(); + // try to enter the section (the same as trying to lock a mutex) + wxCRITSECT_INLINE bool TryEnter(); + // leave the critical section (same as unlocking a mutex) wxCRITSECT_INLINE void Leave(); private: #if wxCRITSECT_IS_MUTEX wxMutex m_mutex; -#elif defined(__WXMSW__) +#elif defined(__WINDOWS__) // we can't allocate any memory in the ctor, so use placement new - // unfortunately, we have to hardcode the sizeof() here because we can't // include windows.h from this public header and we also have to use the @@ -291,6 +294,7 @@ private: inline wxCriticalSection::~wxCriticalSection() { } inline void wxCriticalSection::Enter() { (void)m_mutex.Lock(); } + inline bool wxCriticalSection::TryEnter() { return m_mutex.TryLock() == wxMUTEX_NO_ERROR; } inline void wxCriticalSection::Leave() { (void)m_mutex.Unlock(); } #endif // wxCRITSECT_IS_MUTEX @@ -840,7 +844,7 @@ public: #if wxUSE_THREADS -#if defined(__WXMSW__) || defined(__OS2__) || defined(__EMX__) || defined(__WXOSX__) +#if defined(__WINDOWS__) || defined(__OS2__) || defined(__EMX__) || defined(__WXOSX__) // unlock GUI if there are threads waiting for and lock it back when // there are no more of them - should be called periodically by the main // thread diff --git a/Externals/wxWidgets3/include/wx/thrimpl.cpp b/Externals/wxWidgets3/include/wx/thrimpl.cpp index ca3234b4a9..39a75a770b 100644 --- a/Externals/wxWidgets3/include/wx/thrimpl.cpp +++ b/Externals/wxWidgets3/include/wx/thrimpl.cpp @@ -4,7 +4,7 @@ // Author: Vadim Zeitlin // Modified by: // Created: 04.06.02 (extracted from src/*/thread.cpp files) -// RCS-ID: $Id: thrimpl.cpp 67254 2011-03-20 00:14:35Z DS $ +// RCS-ID: $Id: thrimpl.cpp 70796 2012-03-04 00:29:31Z VZ $ // Copyright: (c) Vadim Zeitlin (2002) // Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// @@ -76,7 +76,7 @@ wxMutexError wxMutex::Unlock() // variables and their events/event semaphores have quite different semantics, // so we reimplement the conditions from scratch using the mutexes and // semaphores -#if defined(__WXMSW__) || defined(__OS2__) || defined(__EMX__) +#if defined(__WINDOWS__) || defined(__OS2__) || defined(__EMX__) class wxConditionInternal { @@ -223,7 +223,7 @@ wxCondError wxConditionInternal::Broadcast() return wxCOND_NO_ERROR; } -#endif // MSW or OS2 +#endif // __WINDOWS__ || __OS2__ || __EMX__ // ---------------------------------------------------------------------------- // wxCondition diff --git a/Externals/wxWidgets3/include/wx/time.h b/Externals/wxWidgets3/include/wx/time.h new file mode 100644 index 0000000000..4dc6bf8d19 --- /dev/null +++ b/Externals/wxWidgets3/include/wx/time.h @@ -0,0 +1,77 @@ +/////////////////////////////////////////////////////////////////////////////// +// Name: wx/time.h +// Purpose: Miscellaneous time-related functions. +// Author: Vadim Zeitlin +// Created: 2011-11-26 +// RCS-ID: $Id: time.h 69846 2011-11-27 20:28:43Z VZ $ +// Copyright: (c) 2011 Vadim Zeitlin +// Licence: wxWindows licence +/////////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_TIME_H_ +#define _WX_TIME_H_ + +#include "wx/longlong.h" + +// Returns the difference between UTC and local time in seconds. +WXDLLIMPEXP_BASE int wxGetTimeZone(); + +// Get number of seconds since local time 00:00:00 Jan 1st 1970. +extern long WXDLLIMPEXP_BASE wxGetLocalTime(); + +// Get number of seconds since GMT 00:00:00, Jan 1st 1970. +extern long WXDLLIMPEXP_BASE wxGetUTCTime(); + +#if wxUSE_LONGLONG + typedef wxLongLong wxMilliClock_t; + inline long wxMilliClockToLong(wxLongLong ll) { return ll.ToLong(); } +#else + typedef double wxMilliClock_t; + inline long wxMilliClockToLong(double d) { return wx_truncate_cast(long, d); } +#endif // wxUSE_LONGLONG + +// Get number of milliseconds since local time 00:00:00 Jan 1st 1970 +extern wxMilliClock_t WXDLLIMPEXP_BASE wxGetLocalTimeMillis(); + +#if wxUSE_LONGLONG + +// Get the number of milliseconds or microseconds since the Epoch. +wxLongLong WXDLLIMPEXP_BASE wxGetUTCTimeMillis(); +wxLongLong WXDLLIMPEXP_BASE wxGetUTCTimeUSec(); + +#endif // wxUSE_LONGLONG + +#define wxGetCurrentTime() wxGetLocalTime() + +// on some really old systems gettimeofday() doesn't have the second argument, +// define wxGetTimeOfDay() to hide this difference +#ifdef HAVE_GETTIMEOFDAY + #ifdef WX_GETTIMEOFDAY_NO_TZ + #define wxGetTimeOfDay(tv) gettimeofday(tv) + #else + #define wxGetTimeOfDay(tv) gettimeofday((tv), NULL) + #endif +#endif // HAVE_GETTIMEOFDAY + +/* Two wrapper functions for thread safety */ +#ifdef HAVE_LOCALTIME_R +#define wxLocaltime_r localtime_r +#else +WXDLLIMPEXP_BASE struct tm *wxLocaltime_r(const time_t*, struct tm*); +#if wxUSE_THREADS && !defined(__WINDOWS__) && !defined(__WATCOMC__) + // On Windows, localtime _is_ threadsafe! +#warning using pseudo thread-safe wrapper for localtime to emulate localtime_r +#endif +#endif + +#ifdef HAVE_GMTIME_R +#define wxGmtime_r gmtime_r +#else +WXDLLIMPEXP_BASE struct tm *wxGmtime_r(const time_t*, struct tm*); +#if wxUSE_THREADS && !defined(__WINDOWS__) && !defined(__WATCOMC__) + // On Windows, gmtime _is_ threadsafe! +#warning using pseudo thread-safe wrapper for gmtime to emulate gmtime_r +#endif +#endif + +#endif // _WX_TIME_H_ diff --git a/Externals/wxWidgets3/include/wx/timectrl.h b/Externals/wxWidgets3/include/wx/timectrl.h new file mode 100644 index 0000000000..832cc67708 --- /dev/null +++ b/Externals/wxWidgets3/include/wx/timectrl.h @@ -0,0 +1,92 @@ +/////////////////////////////////////////////////////////////////////////////// +// Name: wx/timectrl.h +// Purpose: Declaration of wxTimePickerCtrl class. +// Author: Vadim Zeitlin +// Created: 2011-09-22 +// RCS-ID: $Id: timectrl.h 70071 2011-12-20 21:27:14Z VZ $ +// Copyright: (c) 2011 Vadim Zeitlin +// Licence: wxWindows licence +/////////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_TIMECTRL_H_ +#define _WX_TIMECTRL_H_ + +#include "wx/defs.h" + +#if wxUSE_TIMEPICKCTRL + +#include "wx/datetimectrl.h" + +#define wxTimePickerCtrlNameStr wxS("timectrl") + +// No special styles are currently defined for this control but still define a +// symbolic constant for the default style for consistency. +enum +{ + wxTP_DEFAULT = 0 +}; + +// ---------------------------------------------------------------------------- +// wxTimePickerCtrl: Allow the user to enter the time. +// ---------------------------------------------------------------------------- + +class WXDLLIMPEXP_ADV wxTimePickerCtrlBase : public wxDateTimePickerCtrl +{ +public: + /* + The derived classes should implement ctor and Create() method with the + following signature: + + bool Create(wxWindow *parent, + wxWindowID id, + const wxDateTime& dt = wxDefaultDateTime, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + long style = wxTP_DEFAULT, + const wxValidator& validator = wxDefaultValidator, + const wxString& name = wxTimePickerCtrlNameStr); + */ + + /* + We also inherit Set/GetValue() methods from the base class which define + our public API. Notice that the date portion of the date passed as + input is ignored and for the result date it's always today, but only + the time part of wxDateTime objects is really significant here. + */ +}; + +#if defined(__WXMSW__) && !defined(__WXUNIVERSAL__) + #include "wx/msw/timectrl.h" + + #define wxHAS_NATIVE_TIMEPICKERCTRL +#elif defined(__WXOSX_COCOA__) && !defined(__WXUNIVERSAL__) + #include "wx/osx/timectrl.h" + + #define wxHAS_NATIVE_TIMEPICKERCTRL +#else + #include "wx/generic/timectrl.h" + + class WXDLLIMPEXP_ADV wxTimePickerCtrl : public wxTimePickerCtrlGeneric + { + public: + wxTimePickerCtrl() { } + wxTimePickerCtrl(wxWindow *parent, + wxWindowID id, + const wxDateTime& date = wxDefaultDateTime, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + long style = wxTP_DEFAULT, + const wxValidator& validator = wxDefaultValidator, + const wxString& name = wxTimePickerCtrlNameStr) + : wxTimePickerCtrlGeneric(parent, id, date, pos, size, style, validator, name) + { + } + + private: + wxDECLARE_DYNAMIC_CLASS_NO_COPY(wxTimePickerCtrl); + }; +#endif + +#endif // wxUSE_TIMEPICKCTRL + +#endif // _WX_TIMECTRL_H_ diff --git a/Externals/wxWidgets3/include/wx/tls.h b/Externals/wxWidgets3/include/wx/tls.h index 40f91fce9e..0dfa87d2c5 100644 --- a/Externals/wxWidgets3/include/wx/tls.h +++ b/Externals/wxWidgets3/include/wx/tls.h @@ -3,7 +3,7 @@ // Purpose: Implementation of thread local storage // Author: Vadim Zeitlin // Created: 2008-08-08 -// RCS-ID: $Id: tls.h 65747 2010-10-03 17:16:15Z VZ $ +// RCS-ID: $Id: tls.h 70796 2012-03-04 00:29:31Z VZ $ // Copyright: (c) 2008 Vadim Zeitlin // Licence: wxWindows licence /////////////////////////////////////////////////////////////////////////////// @@ -50,7 +50,7 @@ typedef void (*wxTlsDestructorFunction)(void*); } - #if defined(__WXMSW__) + #if defined(__WINDOWS__) #include "wx/msw/tls.h" #elif defined(__OS2__) #include "wx/os2/tls.h" @@ -132,7 +132,7 @@ }; #define wxTLS_TYPE(T) wxTlsValue - #define wxTLS_PTR(var) (var) + #define wxTLS_PTR(var) ((var).Get()) #define wxTLS_VALUE(var) (*(var)) #endif // wxHAS_COMPILER_TLS/!wxHAS_COMPILER_TLS diff --git a/Externals/wxWidgets3/include/wx/toolbar.h b/Externals/wxWidgets3/include/wx/toolbar.h index d90e4ed516..5e6298320e 100644 --- a/Externals/wxWidgets3/include/wx/toolbar.h +++ b/Externals/wxWidgets3/include/wx/toolbar.h @@ -4,7 +4,7 @@ // Author: Vadim Zeitlin // Modified by: // Created: 20.11.99 -// RCS-ID: $Id: toolbar.h 62849 2009-12-10 03:04:07Z VZ $ +// RCS-ID: $Id: toolbar.h 70345 2012-01-15 01:05:28Z VZ $ // Copyright: (c) Vadim Zeitlin // Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// @@ -68,8 +68,6 @@ enum #if defined(__WXUNIVERSAL__) #include "wx/univ/toolbar.h" - #elif defined(__WXPALMOS__) - #include "wx/palmos/toolbar.h" #elif defined(__WXMSW__) && (!defined(_WIN32_WCE) || (_WIN32_WCE >= 400 && !defined(__POCKETPC__) && !defined(__SMARTPHONE__))) #include "wx/msw/toolbar.h" #elif defined(__WXWINCE__) diff --git a/Externals/wxWidgets3/include/wx/toolbook.h b/Externals/wxWidgets3/include/wx/toolbook.h index 5ddffc7a5c..2efd27434e 100644 --- a/Externals/wxWidgets3/include/wx/toolbook.h +++ b/Externals/wxWidgets3/include/wx/toolbook.h @@ -4,7 +4,7 @@ // Author: Julian Smart // Modified by: // Created: 2006-01-29 -// RCS-ID: $Id: toolbook.h 65931 2010-10-27 16:54:36Z VZ $ +// RCS-ID: $Id: toolbook.h 68810 2011-08-21 14:08:49Z VZ $ // Copyright: (c) 2006 Julian Smart // Licence: wxWindows licence /////////////////////////////////////////////////////////////////////////////// @@ -78,7 +78,7 @@ public: wxWindow *page, const wxString& text, bool bSelect = false, - int imageId = -1); + int imageId = NO_IMAGE); virtual int SetSelection(size_t n) { return DoSetSelection(n, SetSelection_SendEvent); } virtual int ChangeSelection(size_t n) { return DoSetSelection(n); } virtual void SetImageList(wxImageList *imageList); diff --git a/Externals/wxWidgets3/include/wx/toplevel.h b/Externals/wxWidgets3/include/wx/toplevel.h index be0c70b824..bf1049350c 100644 --- a/Externals/wxWidgets3/include/wx/toplevel.h +++ b/Externals/wxWidgets3/include/wx/toplevel.h @@ -5,7 +5,7 @@ // Author: Vadim Zeitlin, Vaclav Slavik // Modified by: // Created: 06.08.01 -// RCS-ID: $Id: toplevel.h 65680 2010-09-30 11:44:45Z VZ $ +// RCS-ID: $Id: toplevel.h 70353 2012-01-15 14:46:41Z VZ $ // Copyright: (c) 2001 Vadim Zeitlin // Vaclav Slavik // Licence: wxWindows licence @@ -33,7 +33,7 @@ class WXDLLIMPEXP_FWD_CORE wxTopLevelWindowBase; // ---------------------------------------------------------------------------- /* - Summary of the bits used (some of them are defined in wx/frame.g and + Summary of the bits used (some of them are defined in wx/frame.h and wx/dialog.h and not here): +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+ @@ -45,10 +45,10 @@ class WXDLLIMPEXP_FWD_CORE wxTopLevelWindowBase; | | | | | | | | | | | | | \_______ wxFRAME_TOOL_WINDOW | | | | | | | | | | | | \__________ wxFRAME_FLOAT_ON_PARENT | | | | | | | | | | | \_____________ wxFRAME_SHAPED - | | | | | | | | | | \________________ + | | | | | | | | | | \________________ wxDIALOG_NO_PARENT | | | | | | | | | \___________________ wxRESIZE_BORDER | | | | | | | | \______________________ wxTINY_CAPTION_VERT - | | | | | | | \_________________________ wxDIALOG_NO_PARENT + | | | | | | | \_________________________ | | | | | | \____________________________ wxMAXIMIZE_BOX | | | | | \_______________________________ wxMINIMIZE_BOX | | | | \__________________________________ wxSYSTEM_MENU @@ -70,14 +70,14 @@ class WXDLLIMPEXP_FWD_CORE wxTopLevelWindowBase; #define wxICONIZE 0x4000 #define wxMINIMIZE wxICONIZE #define wxMAXIMIZE 0x2000 -#define wxCLOSE_BOX 0x1000 +#define wxCLOSE_BOX 0x1000 // == wxHELP so can't be used with it #define wxSYSTEM_MENU 0x0800 #define wxMINIMIZE_BOX 0x0400 #define wxMAXIMIZE_BOX 0x0200 #define wxTINY_CAPTION 0x0080 // clashes with wxNO_DEFAULT -#define wxRESIZE_BORDER 0x0040 +#define wxRESIZE_BORDER 0x0040 // == wxCLOSE #if WXWIN_COMPATIBILITY_2_8 // HORIZ and VERT styles are equivalent anyhow so don't use different names @@ -157,7 +157,8 @@ enum // wxTopLevelWindow: a top level (as opposed to child) window // ---------------------------------------------------------------------------- -class WXDLLIMPEXP_CORE wxTopLevelWindowBase : public wxNonOwnedWindow +class WXDLLIMPEXP_CORE wxTopLevelWindowBase : + public wxNavigationEnabled { public: // construction @@ -218,11 +219,6 @@ public: // enable/disable close button [x] virtual bool EnableCloseButton(bool WXUNUSED(enable) ) { return false; } - // Set the shape of the window to the given region. - // Returns true if the platform supports this feature (and the - // operation is successful.) - virtual bool SetShape(const wxRegion& WXUNUSED(region)) { return false; } - // Attracts the users attention to this window if the application is // inactive (should be called when a background event occurs) virtual void RequestUserAttention(int flags = wxUSER_ATTENTION_INFO); @@ -281,6 +277,7 @@ public: // override some base class virtuals virtual bool Destroy(); virtual bool IsTopLevel() const { return true; } + virtual bool IsTopNavigationDomain() const { return true; } virtual bool IsVisible() const { return IsShown(); } // event handlers @@ -304,6 +301,8 @@ public: virtual void OSXSetModified(bool modified) { m_modified = modified; } virtual bool OSXIsModified() const { return m_modified; } + virtual void SetRepresentedFilename(const wxString& WXUNUSED(filename)) { } + protected: // the frame client to screen translation should take account of the // toolbar which may shift the origin of the client area @@ -352,15 +351,11 @@ protected: wxDECLARE_NO_COPY_CLASS(wxTopLevelWindowBase); DECLARE_EVENT_TABLE() - WX_DECLARE_CONTROL_CONTAINER(); }; // include the real class declaration -#if defined(__WXPALMOS__) - #include "wx/palmos/toplevel.h" - #define wxTopLevelWindowNative wxTopLevelWindowPalm -#elif defined(__WXMSW__) +#if defined(__WXMSW__) #include "wx/msw/toplevel.h" #define wxTopLevelWindowNative wxTopLevelWindowMSW #elif defined(__WXGTK20__) @@ -372,9 +367,6 @@ protected: #elif defined(__WXX11__) #include "wx/x11/toplevel.h" #define wxTopLevelWindowNative wxTopLevelWindowX11 -#elif defined(__WXMGL__) - #include "wx/mgl/toplevel.h" - #define wxTopLevelWindowNative wxTopLevelWindowMGL #elif defined(__WXDFB__) #include "wx/dfb/toplevel.h" #define wxTopLevelWindowNative wxTopLevelWindowDFB diff --git a/Externals/wxWidgets3/include/wx/treebase.h b/Externals/wxWidgets3/include/wx/treebase.h index 99d74f8aab..dc03d28f88 100644 --- a/Externals/wxWidgets3/include/wx/treebase.h +++ b/Externals/wxWidgets3/include/wx/treebase.h @@ -4,7 +4,7 @@ // Author: Julian Smart et al // Modified by: // Created: 01/02/97 -// RCS-ID: $Id: treebase.h 58718 2009-02-07 18:59:25Z VZ $ +// RCS-ID: $Id: treebase.h 68812 2011-08-21 14:08:56Z VZ $ // Copyright: (c) 1997,1998 Robert Roebling // Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// @@ -23,6 +23,7 @@ #include "wx/window.h" // for wxClientData #include "wx/event.h" #include "wx/dynarray.h" +#include "wx/itemid.h" #if WXWIN_COMPATIBILITY_2_6 @@ -38,53 +39,19 @@ enum #endif // WXWIN_COMPATIBILITY_2_6 // ---------------------------------------------------------------------------- -// wxTreeItemId identifies an element of the tree. In this implementation, it's -// just a trivial wrapper around Win32 HTREEITEM or a pointer to some private -// data structure in the generic version. It's opaque for the application and -// the only method which can be used by user code is IsOk(). +// wxTreeItemId identifies an element of the tree. It's opaque for the +// application and the only method which can be used by user code is IsOk(). // ---------------------------------------------------------------------------- -// Using this typedef removes an ambiguity when calling Remove() -typedef void *wxTreeItemIdValue; - -class WXDLLIMPEXP_CORE wxTreeItemId +// This is a class and not a typedef because existing code may forward declare +// wxTreeItemId as a class and we don't want to break it without good reason. +class wxTreeItemId : public wxItemId { - friend bool operator==(const wxTreeItemId&, const wxTreeItemId&); public: - // ctors - // 0 is invalid value for HTREEITEM - wxTreeItemId() { m_pItem = 0; } - - // construct wxTreeItemId from the native item id - wxTreeItemId(void *pItem) { m_pItem = pItem; } - - // default copy ctor/assignment operator are ok for us - - // accessors - // is this a valid tree item? - bool IsOk() const { return m_pItem != 0; } - // return true if this item is not valid - bool operator!() const { return !IsOk(); } - - // operations - // invalidate the item - void Unset() { m_pItem = 0; } - - operator bool() const { return IsOk(); } - - wxTreeItemIdValue m_pItem; + wxTreeItemId() : wxItemId() { } + wxTreeItemId(void* pItem) : wxItemId(pItem) { } }; -inline bool operator==(const wxTreeItemId& i1, const wxTreeItemId& i2) -{ - return i1.m_pItem == i2.m_pItem; -} - -inline bool operator!=(const wxTreeItemId& i1, const wxTreeItemId& i2) -{ - return i1.m_pItem != i2.m_pItem; -} - // ---------------------------------------------------------------------------- // wxTreeItemData is some (arbitrary) user class associated with some item. The // main advantage of having this class (compared to old untyped interface) is @@ -119,10 +86,12 @@ protected: wxTreeItemId m_pItem; }; +typedef void *wxTreeItemIdValue; + WX_DEFINE_EXPORTED_ARRAY_PTR(wxTreeItemIdValue, wxArrayTreeItemIdsBase); // this is a wrapper around the array class defined above which allow to wok -// with vaue of natural wxTreeItemId type instead of using wxTreeItemIdValue +// with values of natural wxTreeItemId type instead of using wxTreeItemIdValue // and does it without any loss of efficiency class WXDLLIMPEXP_CORE wxArrayTreeItemIds : public wxArrayTreeItemIdsBase { @@ -252,9 +221,9 @@ public: void SetFont(const wxFont& font) { m_font = font; } // accessors - bool HasTextColour() const { return m_colText.Ok(); } - bool HasBackgroundColour() const { return m_colBack.Ok(); } - bool HasFont() const { return m_font.Ok(); } + bool HasTextColour() const { return m_colText.IsOk(); } + bool HasBackgroundColour() const { return m_colBack.IsOk(); } + bool HasFont() const { return m_font.IsOk(); } const wxColour& GetTextColour() const { return m_colText; } const wxColour& GetBackgroundColour() const { return m_colBack; } diff --git a/Externals/wxWidgets3/include/wx/treebook.h b/Externals/wxWidgets3/include/wx/treebook.h index bc39e8f698..86bdf0b0da 100644 --- a/Externals/wxWidgets3/include/wx/treebook.h +++ b/Externals/wxWidgets3/include/wx/treebook.h @@ -4,7 +4,7 @@ // Author: Evgeniy Tarassov, Vadim Zeitlin // Modified by: // Created: 2005-09-15 -// RCS-ID: $Id: treebook.h 65931 2010-10-27 16:54:36Z VZ $ +// RCS-ID: $Id: treebook.h 68810 2011-08-21 14:08:49Z VZ $ // Copyright: (c) 2005 Vadim Zeitlin // Licence: wxWindows licence /////////////////////////////////////////////////////////////////////////////// @@ -74,27 +74,27 @@ public: wxWindow *page, const wxString& text, bool bSelect = false, - int imageId = wxNOT_FOUND); + int imageId = NO_IMAGE); // Inserts a new sub-page to the end of children of the page at given pos. virtual bool InsertSubPage(size_t pos, wxWindow *page, const wxString& text, bool bSelect = false, - int imageId = wxNOT_FOUND); + int imageId = NO_IMAGE); // Adds a new page at top level after all other pages. virtual bool AddPage(wxWindow *page, const wxString& text, bool bSelect = false, - int imageId = wxNOT_FOUND); + int imageId = NO_IMAGE); // Adds a new child-page to the last top-level page inserted. // Useful when constructing 1 level tree structure. virtual bool AddSubPage(wxWindow *page, const wxString& text, bool bSelect = false, - int imageId = wxNOT_FOUND); + int imageId = NO_IMAGE); // Deletes the page and ALL its children. Could trigger page selection // change in a case when selected page is removed. In that case its parent @@ -169,16 +169,16 @@ private: wxWindow *page, const wxString& text, bool bSelect = false, - int imageId = wxNOT_FOUND); + int imageId = NO_IMAGE); bool DoInsertSubPage(size_t pos, wxWindow *page, const wxString& text, bool bSelect = false, - int imageId = wxNOT_FOUND); + int imageId = NO_IMAGE); bool DoAddSubPage(wxWindow *page, const wxString& text, bool bSelect = false, - int imageId = wxNOT_FOUND); + int imageId = NO_IMAGE); // Sets selection in the tree control and updates the page being shown. int DoSetSelection(size_t pos, int flags = 0); diff --git a/Externals/wxWidgets3/include/wx/treectrl.h b/Externals/wxWidgets3/include/wx/treectrl.h index 1b46241a20..feefbd7638 100644 --- a/Externals/wxWidgets3/include/wx/treectrl.h +++ b/Externals/wxWidgets3/include/wx/treectrl.h @@ -5,7 +5,7 @@ // Modified by: // Created: // Copyright: (c) Karsten Ballueder -// RCS-ID: $Id: treectrl.h 64532 2010-06-09 13:55:48Z FM $ +// RCS-ID: $Id: treectrl.h 70345 2012-01-15 01:05:28Z VZ $ // Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// @@ -33,20 +33,7 @@ class WXDLLIMPEXP_FWD_CORE wxImageList; class WXDLLIMPEXP_CORE wxTreeCtrlBase : public wxControl { public: - wxTreeCtrlBase() - { - m_imageListNormal = - m_imageListState = NULL; - m_ownsImageListNormal = - m_ownsImageListState = false; - - // arbitrary default - m_spacing = 18; - - // quick DoGetBestSize calculation - m_quickBestSize = true; - } - + wxTreeCtrlBase(); virtual ~wxTreeCtrlBase(); // accessors @@ -452,6 +439,13 @@ protected: bool m_quickBestSize; +private: + // Intercept Escape and Return keys to ensure that our in-place edit + // control always gets them before they're used for dialog navigation or + // anything else. + void OnCharHook(wxKeyEvent& event); + + wxDECLARE_NO_COPY_CLASS(wxTreeCtrlBase); }; @@ -461,8 +455,6 @@ protected: #if defined(__WXUNIVERSAL__) #include "wx/generic/treectlg.h" -#elif defined(__WXPALMOS__) - #include "wx/generic/treectlg.h" #elif defined(__WXMSW__) #include "wx/msw/treectrl.h" #elif defined(__WXMOTIF__) diff --git a/Externals/wxWidgets3/include/wx/treelist.h b/Externals/wxWidgets3/include/wx/treelist.h new file mode 100644 index 0000000000..bb4f3b0f11 --- /dev/null +++ b/Externals/wxWidgets3/include/wx/treelist.h @@ -0,0 +1,567 @@ +/////////////////////////////////////////////////////////////////////////////// +// Name: wx/treelist.h +// Purpose: wxTreeListCtrl class declaration. +// Author: Vadim Zeitlin +// Created: 2011-08-17 +// RCS-ID: $Id: treelist.h 69619 2011-10-31 19:41:06Z VZ $ +// Copyright: (c) 2011 Vadim Zeitlin +// Licence: wxWindows licence +/////////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_TREELIST_H_ +#define _WX_TREELIST_H_ + +#include "wx/defs.h" + +#if wxUSE_TREELISTCTRL + +#include "wx/compositewin.h" +#include "wx/containr.h" +#include "wx/headercol.h" +#include "wx/itemid.h" +#include "wx/vector.h" +#include "wx/window.h" +#include "wx/withimages.h" + +class WXDLLIMPEXP_FWD_ADV wxDataViewCtrl; +class WXDLLIMPEXP_FWD_ADV wxDataViewEvent; + +extern WXDLLIMPEXP_DATA_ADV(const char) wxTreeListCtrlNameStr[]; + +class wxTreeListCtrl; +class wxTreeListModel; +class wxTreeListModelNode; + +// ---------------------------------------------------------------------------- +// Constants. +// ---------------------------------------------------------------------------- + +// wxTreeListCtrl styles. +// +// Notice that using wxTL_USER_3STATE implies wxTL_3STATE and wxTL_3STATE in +// turn implies wxTL_CHECKBOX. +enum +{ + wxTL_SINGLE = 0x0000, // This is the default anyhow. + wxTL_MULTIPLE = 0x0001, // Allow multiple selection. + wxTL_CHECKBOX = 0x0002, // Show checkboxes in the first column. + wxTL_3STATE = 0x0004, // Allow 3rd state in checkboxes. + wxTL_USER_3STATE = 0x0008, // Allow user to set 3rd state. + + wxTL_DEFAULT_STYLE = wxTL_SINGLE, + wxTL_STYLE_MASK = wxTL_SINGLE | + wxTL_MULTIPLE | + wxTL_CHECKBOX | + wxTL_3STATE | + wxTL_USER_3STATE +}; + +// ---------------------------------------------------------------------------- +// wxTreeListItem: unique identifier of an item in wxTreeListCtrl. +// ---------------------------------------------------------------------------- + +// Make wxTreeListItem a forward-declarable class even though it's simple +// enough to possibly be declared as a simple typedef. +class wxTreeListItem : public wxItemId +{ +public: + wxTreeListItem(wxTreeListModelNode* item = NULL) + : wxItemId(item) + { + } +}; + +// Container of multiple items. +typedef wxVector wxTreeListItems; + +// Some special "items" that can be used with InsertItem(): +extern WXDLLIMPEXP_DATA_ADV(const wxTreeListItem) wxTLI_FIRST; +extern WXDLLIMPEXP_DATA_ADV(const wxTreeListItem) wxTLI_LAST; + +// ---------------------------------------------------------------------------- +// wxTreeListItemComparator: defines order of wxTreeListCtrl items. +// ---------------------------------------------------------------------------- + +class wxTreeListItemComparator +{ +public: + wxTreeListItemComparator() { } + + // The comparison function should return negative, null or positive value + // depending on whether the first item is less than, equal to or greater + // than the second one. The items should be compared using their values for + // the given column. + virtual int + Compare(wxTreeListCtrl* treelist, + unsigned column, + wxTreeListItem first, + wxTreeListItem second) = 0; + + // Although this class is not used polymorphically by wxWidgets itself, + // provide virtual dtor in case it's used like this in the user code. + virtual ~wxTreeListItemComparator() { } + +private: + wxDECLARE_NO_COPY_CLASS(wxTreeListItemComparator); +}; + +// ---------------------------------------------------------------------------- +// wxTreeListCtrl: a control combining wxTree- and wxListCtrl features. +// ---------------------------------------------------------------------------- + +// This control also provides easy to use high level interface. Although the +// implementation uses wxDataViewCtrl internally, this class is intentionally +// simpler than wxDataViewCtrl and doesn't provide all of its functionality. +// +// If you need extra features you can always use GetDataView() accessor to work +// with wxDataViewCtrl directly but doing this makes your unportable to possible +// future non-wxDataViewCtrl-based implementations of this class. + +class WXDLLIMPEXP_ADV wxTreeListCtrl + : public wxCompositeWindow< wxNavigationEnabled >, + public wxWithImages +{ +public: + // Constructors and such + // --------------------- + + wxTreeListCtrl() { Init(); } + wxTreeListCtrl(wxWindow* parent, + wxWindowID id, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + long style = wxTL_DEFAULT_STYLE, + const wxString& name = wxTreeListCtrlNameStr) + { + Init(); + + Create(parent, id, pos, size, style, name); + } + + bool Create(wxWindow* parent, + wxWindowID id, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + long style = wxTL_DEFAULT_STYLE, + const wxString& name = wxTreeListCtrlNameStr); + + + virtual ~wxTreeListCtrl(); + + // Columns methods + // --------------- + + // Add a column with the given title and attributes, returns the index of + // the new column or -1 on failure. + int AppendColumn(const wxString& title, + int width = wxCOL_WIDTH_AUTOSIZE, + wxAlignment align = wxALIGN_LEFT, + int flags = wxCOL_RESIZABLE) + { + return DoInsertColumn(title, -1, width, align, flags); + } + + // Return the total number of columns. + unsigned GetColumnCount() const; + + // Delete the column with the given index, returns false if index is + // invalid or deleting the column failed for some other reason. + bool DeleteColumn(unsigned col); + + // Delete all columns. + void ClearColumns(); + + // Set column width to either the given value in pixels or to the value + // large enough to fit all of the items if width == wxCOL_WIDTH_AUTOSIZE. + void SetColumnWidth(unsigned col, int width); + + // Get the current width of the given column in pixels. + int GetColumnWidth(unsigned col) const; + + // Get the width appropriate for showing the given text. This is typically + // used as second argument for AppendColumn() or with SetColumnWidth(). + int WidthFor(const wxString& text) const; + + + // Item methods + // ------------ + + // Adding items. The parent and text of the first column of the new item + // must always be specified, the rest is optional. + // + // Each item can have two images: one used for closed state and another for + // opened one. Only the first one is ever used for the items that don't + // have children. And both are not set by default. + // + // It is also possible to associate arbitrary client data pointer with the + // new item. It will be deleted by the control when the item is deleted + // (either by an explicit DeleteItem() call or because the entire control + // is destroyed). + + wxTreeListItem AppendItem(wxTreeListItem parent, + const wxString& text, + int imageClosed = NO_IMAGE, + int imageOpened = NO_IMAGE, + wxClientData* data = NULL) + { + return DoInsertItem(parent, wxTLI_LAST, text, + imageClosed, imageOpened, data); + } + + wxTreeListItem InsertItem(wxTreeListItem parent, + wxTreeListItem previous, + const wxString& text, + int imageClosed = NO_IMAGE, + int imageOpened = NO_IMAGE, + wxClientData* data = NULL) + { + return DoInsertItem(parent, previous, text, + imageClosed, imageOpened, data); + } + + wxTreeListItem PrependItem(wxTreeListItem parent, + const wxString& text, + int imageClosed = NO_IMAGE, + int imageOpened = NO_IMAGE, + wxClientData* data = NULL) + { + return DoInsertItem(parent, wxTLI_FIRST, text, + imageClosed, imageOpened, data); + } + + // Deleting items. + void DeleteItem(wxTreeListItem item); + void DeleteAllItems(); + + + // Tree navigation + // --------------- + + // Return the (never shown) root item. + wxTreeListItem GetRootItem() const; + + // The parent item may be invalid for the root-level items. + wxTreeListItem GetItemParent(wxTreeListItem item) const; + + // Iterate over the given item children: start by calling GetFirstChild() + // and then call GetNextSibling() for as long as it returns valid item. + wxTreeListItem GetFirstChild(wxTreeListItem item) const; + wxTreeListItem GetNextSibling(wxTreeListItem item) const; + + // Return the first child of the root item, which is also the first item of + // the tree in depth-first traversal order. + wxTreeListItem GetFirstItem() const { return GetFirstChild(GetRootItem()); } + + // Get item after the given one in the depth-first tree-traversal order. + // Calling this function starting with the result of GetFirstItem() allows + // iterating over all items in the tree. + wxTreeListItem GetNextItem(wxTreeListItem item) const; + + + // Items attributes + // ---------------- + + const wxString& GetItemText(wxTreeListItem item, unsigned col = 0) const; + + // The convenience overload below sets the text for the first column. + void SetItemText(wxTreeListItem item, unsigned col, const wxString& text); + void SetItemText(wxTreeListItem item, const wxString& text) + { + SetItemText(item, 0, text); + } + + // By default the opened image is the same as the normal, closed one (if + // it's used at all). + void SetItemImage(wxTreeListItem item, int closed, int opened = NO_IMAGE); + + // Retrieve or set the data associated with the item. + wxClientData* GetItemData(wxTreeListItem item) const; + void SetItemData(wxTreeListItem item, wxClientData* data); + + + // Expanding and collapsing + // ------------------------ + + void Expand(wxTreeListItem item); + void Collapse(wxTreeListItem item); + bool IsExpanded(wxTreeListItem item) const; + + + // Selection handling + // ------------------ + + // This function can be used with single selection controls, use + // GetSelections() with the multi-selection ones. + wxTreeListItem GetSelection() const; + + // This one can be used with either single or multi-selection controls. + unsigned GetSelections(wxTreeListItems& selections) const; + + // In single selection mode Select() deselects any other selected items, in + // multi-selection case it adds to the selection. + void Select(wxTreeListItem item); + + // Can be used in multiple selection mode only, single selected item in the + // single selection mode can't be unselected. + void Unselect(wxTreeListItem item); + + // Return true if the item is selected, can be used in both single and + // multiple selection modes. + bool IsSelected(wxTreeListItem item) const; + + // Select or unselect all items, only valid in multiple selection mode. + void SelectAll(); + void UnselectAll(); + + + // Checkbox handling + // ----------------- + + // Methods in this section can only be used with the controls created with + // wxTL_CHECKBOX style. + + // Simple set, unset or query the checked state. + void CheckItem(wxTreeListItem item, wxCheckBoxState state = wxCHK_CHECKED); + void UncheckItem(wxTreeListItem item) { CheckItem(item, wxCHK_UNCHECKED); } + + // The same but do it recursively for this item itself and its children. + void CheckItemRecursively(wxTreeListItem item, + wxCheckBoxState state = wxCHK_CHECKED); + + // Update the parent of this item recursively: if this item and all its + // siblings are checked, the parent will become checked as well. If this + // item and all its siblings are unchecked, the parent will be unchecked. + // And if the siblings of this item are not all in the same state, the + // parent will be switched to indeterminate state. And then the same logic + // will be applied to the parents parent and so on recursively. + // + // This is typically called when the state of the given item has changed + // from EVT_TREELIST_ITEM_CHECKED() handler in the controls which have + // wxTL_3STATE flag. Notice that without this flag this function can't work + // as it would be unable to set the state of a parent with both checked and + // unchecked items so it's only allowed to call it when this flag is set. + void UpdateItemParentStateRecursively(wxTreeListItem item); + + // Return the current state. + wxCheckBoxState GetCheckedState(wxTreeListItem item) const; + + // Return true if all item children (if any) are in the given state. + bool AreAllChildrenInState(wxTreeListItem item, + wxCheckBoxState state) const; + + + + // Sorting. + // -------- + + // Sort by the given column, either in ascending (default) or descending + // sort order. + // + // By default, simple alphabetical sorting is done by this column contents + // but SetItemComparator() may be called to perform comparison in some + // other way. + void SetSortColumn(unsigned col, bool ascendingOrder = true); + + // If the control contents is sorted, return true and fill the output + // parameters with the column which is currently used for sorting and + // whether we sort using ascending or descending order. Otherwise, i.e. if + // the control contents is unsorted, simply return false. + bool GetSortColumn(unsigned* col, bool* ascendingOrder = NULL); + + // Set the object to use for comparing the items. It will be called when + // the control is being sorted because the user clicked on a sortable + // column. + // + // The provided pointer is stored by the control so the object it points to + // must have a life-time equal or greater to that of the control itself. In + // addition, the pointer can be NULL to stop using custom comparator and + // revert to the default alphabetical comparison. + void SetItemComparator(wxTreeListItemComparator* comparator); + + + // View window functions. + // ---------------------- + + // This control itself is entirely covered by the "view window" which is + // currently a wxDataViewCtrl but if you want to avoid relying on this to + // allow your code to work with later versions which might not be + // wxDataViewCtrl-based, use the first function only and only use the + // second one if you really need to call wxDataViewCtrl methods on it. + wxWindow* GetView() const; + wxDataViewCtrl* GetDataView() const { return m_view; } + +private: + // Common part of all ctors. + void Init(); + + // Pure virtual method inherited from wxCompositeWindow. + virtual wxWindowList GetCompositeWindowParts() const; + + // Implementation of AppendColumn(). + int DoInsertColumn(const wxString& title, + int pos, // May be -1 meaning "append". + int width, + wxAlignment align, + int flags); + + // Common part of {Append,Insert,Prepend}Item(). + wxTreeListItem DoInsertItem(wxTreeListItem parent, + wxTreeListItem previous, + const wxString& text, + int imageClosed, + int imageOpened, + wxClientData* data); + + // Send wxTreeListEvent corresponding to the given wxDataViewEvent for an + // item (as opposed for column-oriented events). + // + // Also updates the original event "skipped" and "vetoed" flags. + void SendItemEvent(wxEventType evt, wxDataViewEvent& event); + + // Send wxTreeListEvent corresponding to the given column wxDataViewEvent. + void SendColumnEvent(wxEventType evt, wxDataViewEvent& event); + + + // Called by wxTreeListModel when an item is toggled by the user. + void OnItemToggled(wxTreeListItem item, wxCheckBoxState stateOld); + + // Event handlers. + void OnSelectionChanged(wxDataViewEvent& event); + void OnItemExpanding(wxDataViewEvent& event); + void OnItemExpanded(wxDataViewEvent& event); + void OnItemActivated(wxDataViewEvent& event); + void OnItemContextMenu(wxDataViewEvent& event); + void OnColumnSorted(wxDataViewEvent& event); + void OnSize(wxSizeEvent& event); + + wxDECLARE_EVENT_TABLE(); + + + wxDataViewCtrl* m_view; + wxTreeListModel* m_model; + + wxTreeListItemComparator* m_comparator; + + + // It calls our inherited protected wxWithImages::GetImage() method. + friend class wxTreeListModel; + + wxDECLARE_NO_COPY_CLASS(wxTreeListCtrl); +}; + +// ---------------------------------------------------------------------------- +// wxTreeListEvent: event generated by wxTreeListCtrl. +// ---------------------------------------------------------------------------- + +class wxTreeListEvent : public wxNotifyEvent +{ +public: + // Default ctor is provided for wxRTTI needs only but should never be used. + wxTreeListEvent() { Init(); } + + // The item affected by the event. Valid for all events except + // column-specific ones such as COLUMN_SORTED. + wxTreeListItem GetItem() const { return m_item; } + + // The previous state of the item checkbox for ITEM_CHECKED events only. + wxCheckBoxState GetOldCheckedState() const { return m_oldCheckedState; } + + // The index of the column affected by the event. Currently only used by + // COLUMN_SORTED event. + unsigned GetColumn() const { return m_column; } + + virtual wxEvent* Clone() const { return new wxTreeListEvent(*this); } + +private: + // Common part of all ctors. + void Init() + { + m_column = static_cast(-1); + + m_oldCheckedState = wxCHK_UNDETERMINED; + } + + // Ctor is private, only wxTreeListCtrl can create events of this type. + wxTreeListEvent(wxEventType evtType, + wxTreeListCtrl* treelist, + wxTreeListItem item) + : wxNotifyEvent(evtType, treelist->GetId()), + m_item(item) + { + SetEventObject(treelist); + + Init(); + } + + // Set the checkbox state before this event for ITEM_CHECKED events. + void SetOldCheckedState(wxCheckBoxState state) + { + m_oldCheckedState = state; + } + + // Set the column affected by this event for COLUMN_SORTED events. + void SetColumn(unsigned column) + { + m_column = column; + } + + + const wxTreeListItem m_item; + + wxCheckBoxState m_oldCheckedState; + + unsigned m_column; + + friend class wxTreeListCtrl; + + wxDECLARE_DYNAMIC_CLASS(wxTreeListEvent); +}; + +// Event types and event table macros. + +typedef void (wxEvtHandler::*wxTreeListEventFunction)(wxTreeListEvent&); + +#define wxTreeListEventHandler(func) \ + wxEVENT_HANDLER_CAST(wxTreeListEventFunction, func) + +#define wxEVT_TREELIST_GENERIC(name, id, fn) \ + wx__DECLARE_EVT1(wxEVT_COMMAND_TREELIST_##name, id, wxTreeListEventHandler(fn)) + +#define wxDECLARE_TREELIST_EVENT(name) \ + wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_ADV, \ + wxEVT_COMMAND_TREELIST_##name, \ + wxTreeListEvent) + +wxDECLARE_TREELIST_EVENT(SELECTION_CHANGED); +#define EVT_TREELIST_SELECTION_CHANGED(id, fn) \ + wxEVT_TREELIST_GENERIC(SELECTION_CHANGED, id, fn) + +wxDECLARE_TREELIST_EVENT(ITEM_EXPANDING); +#define EVT_TREELIST_ITEM_EXPANDING(id, fn) \ + wxEVT_TREELIST_GENERIC(ITEM_EXPANDING, id, fn) + +wxDECLARE_TREELIST_EVENT(ITEM_EXPANDED); +#define EVT_TREELIST_ITEM_EXPANDED(id, fn) \ + wxEVT_TREELIST_GENERIC(ITEM_EXPANDED, id, fn) + +wxDECLARE_TREELIST_EVENT(ITEM_CHECKED); +#define EVT_TREELIST_ITEM_CHECKED(id, fn) \ + wxEVT_TREELIST_GENERIC(ITEM_CHECKED, id, fn) + +wxDECLARE_TREELIST_EVENT(ITEM_ACTIVATED); +#define EVT_TREELIST_ITEM_ACTIVATED(id, fn) \ + wxEVT_TREELIST_GENERIC(ITEM_ACTIVATED, id, fn) + +wxDECLARE_TREELIST_EVENT(ITEM_CONTEXT_MENU); +#define EVT_TREELIST_ITEM_CONTEXT_MENU(id, fn) \ + wxEVT_TREELIST_GENERIC(ITEM_CONTEXT_MENU, id, fn) + +wxDECLARE_TREELIST_EVENT(COLUMN_SORTED); +#define EVT_TREELIST_COLUMN_SORTED(id, fn) \ + wxEVT_TREELIST_GENERIC(COLUMN_SORTED, id, fn) + +#undef wxDECLARE_TREELIST_EVENT + +#endif // wxUSE_TREELISTCTRL + +#endif // _WX_TREELIST_H_ diff --git a/Externals/wxWidgets3/include/wx/uiaction.h b/Externals/wxWidgets3/include/wx/uiaction.h index 738deca738..af2b162c49 100644 --- a/Externals/wxWidgets3/include/wx/uiaction.h +++ b/Externals/wxWidgets3/include/wx/uiaction.h @@ -4,7 +4,7 @@ // Author: Kevin Ollivier, Steven Lamerton, Vadim Zeitlin // Modified by: // Created: 2010-03-06 -// RCS-ID: $Id: uiaction.h 67232 2011-03-18 15:10:15Z DS $ +// RCS-ID: $Id: uiaction.h 69762 2011-11-15 15:56:55Z VZ $ // Copyright: (c) Kevin Ollivier // (c) 2010 Steven Lamerton // (c) 2010 Vadim Zeitlin @@ -58,8 +58,8 @@ public: { return Key(keycode, modifiers, false); } // Higher level methods for generating both the key press and release for a - // single key or for all characters in the ASCII string "text" which can - // currently contain letters only (no digits, no punctuation). + // single key or for all characters in the ASCII string "text" which can currently + // contain letters, digits and characters for the definition of numbers [+-., ]. bool Char(int keycode, int modifiers = wxMOD_NONE); bool Text(const char *text); diff --git a/Externals/wxWidgets3/include/wx/unix/private/timer.h b/Externals/wxWidgets3/include/wx/unix/private/timer.h index eeff719c9b..764f3a9954 100644 --- a/Externals/wxWidgets3/include/wx/unix/private/timer.h +++ b/Externals/wxWidgets3/include/wx/unix/private/timer.h @@ -3,7 +3,7 @@ // Purpose: wxTimer for wxBase (unix) // Author: Lukasz Michalski // Created: 15/01/2005 -// RCS-ID: $Id: timer.h 61508 2009-07-23 20:30:22Z VZ $ +// RCS-ID: $Id: timer.h 69839 2011-11-27 19:50:33Z VZ $ // Copyright: (c) Lukasz Michalski // Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// @@ -134,12 +134,6 @@ private: static wxTimerScheduler *ms_instance; }; -// this helper function currently only exists for Unix platforms but could be -// moved to wx/stopwatch.h if it turns out to be useful elsewhere -// -// returns the number of microseconds since the Epoch -extern wxUsecClock_t wxGetLocalTimeUsec(); - #endif // wxUSE_TIMER #endif // _WX_UNIX_PRIVATE_TIMER_H_ diff --git a/Externals/wxWidgets3/include/wx/unix/sound.h b/Externals/wxWidgets3/include/wx/unix/sound.h index 98916f699a..d2f2220b5b 100644 --- a/Externals/wxWidgets3/include/wx/unix/sound.h +++ b/Externals/wxWidgets3/include/wx/unix/sound.h @@ -4,7 +4,7 @@ // Author: Julian Smart, Vaclav Slavik // Modified by: // Created: 25/10/98 -// RCS-ID: $Id: sound.h 47254 2007-07-09 10:09:52Z VS $ +// RCS-ID: $Id: sound.h 69178 2011-09-21 15:08:02Z VZ $ // Copyright: (c) Julian Smart, Vaclav Slavik // Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// @@ -60,13 +60,13 @@ class WXDLLIMPEXP_ADV wxSound : public wxSoundBase public: wxSound(); wxSound(const wxString& fileName, bool isResource = false); - wxSound(int size, const wxByte* data); + wxSound(size_t size, const void* data); virtual ~wxSound(); // Create from resource or file bool Create(const wxString& fileName, bool isResource = false); // Create from data - bool Create(int size, const wxByte* data); + bool Create(size_t size, const void* data); bool IsOk() const { return m_data != NULL; } @@ -84,7 +84,7 @@ protected: static void EnsureBackend(); void Free(); - bool LoadWAV(const wxUint8 *data, size_t length, bool copyData); + bool LoadWAV(const void* data, size_t length, bool copyData); static wxSoundBackend *ms_backend; #if wxUSE_LIBSDL && wxUSE_PLUGINS diff --git a/Externals/wxWidgets3/include/wx/utils.h b/Externals/wxWidgets3/include/wx/utils.h index f085a7a59b..bccc7411a8 100644 --- a/Externals/wxWidgets3/include/wx/utils.h +++ b/Externals/wxWidgets3/include/wx/utils.h @@ -4,7 +4,7 @@ // Author: Julian Smart // Modified by: // Created: 29/01/98 -// RCS-ID: $Id: utils.h 67129 2011-03-05 12:21:20Z SC $ +// RCS-ID: $Id: utils.h 70796 2012-03-04 00:29:31Z VZ $ // Copyright: (c) 1998 Julian Smart // Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// @@ -113,7 +113,7 @@ wxClip(T1 a, T2 b, T3 c) // String functions (deprecated, use wxString) // ---------------------------------------------------------------------------- -#ifdef WXWIN_COMPATIBILITY_2_8 +#if WXWIN_COMPATIBILITY_2_8 // A shorter way of using strcmp wxDEPRECATED_INLINE(inline bool wxStringEq(const char *s1, const char *s2), return wxCRT_StrcmpA(s1, s2) == 0; ) @@ -334,10 +334,17 @@ enum // under Windows, don't hide the child even if it's IO is redirected (this // is done by default) - wxEXEC_NOHIDE = 2, + wxEXEC_SHOW_CONSOLE = 2, + + // deprecated synonym for wxEXEC_SHOW_CONSOLE, use the new name as it's + // more clear + wxEXEC_NOHIDE = wxEXEC_SHOW_CONSOLE, // under Unix, if the process is the group leader then passing wxKILL_CHILDREN to wxKill // kills all children as well as pid + // under Windows (NT family only), sets the CREATE_NEW_PROCESS_GROUP flag, + // which allows to target Ctrl-Break signal to the spawned process. + // applies to console processes only. wxEXEC_MAKE_GROUP_LEADER = 4, // by default synchronous execution disables all program windows to avoid @@ -350,6 +357,10 @@ enum // until the child process finishes wxEXEC_NOEVENTS = 16, + // under Windows, hide the console of the child process if it has one, even + // if its IO is not redirected + wxEXEC_HIDE_CONSOLE = 32, + // convenient synonym for flags given system()-like behaviour wxEXEC_BLOCK = wxEXEC_SYNC | wxEXEC_NOEVENTS }; @@ -399,12 +410,12 @@ WXDLLIMPEXP_BASE long wxExecute(const wxString& command, int flags = 0, const wxExecuteEnv *env = NULL); -#if defined(__WXMSW__) && wxUSE_IPC +#if defined(__WINDOWS__) && wxUSE_IPC // ask a DDE server to execute the DDE request with given parameters WXDLLIMPEXP_BASE bool wxExecuteDDE(const wxString& ddeServer, const wxString& ddeTopic, const wxString& ddeCommand); -#endif // __WXMSW__ && wxUSE_IPC +#endif // __WINDOWS__ && wxUSE_IPC enum wxSignal { @@ -588,14 +599,14 @@ WXDLLIMPEXP_BASE bool wxGetDiskSpace(const wxString& path, -extern "C" -{ -typedef int (wxCMPFUNC_CONV *CMPFUNCDATA)(const void* pItem1, const void* pItem2, const void* user_data); -} +typedef int (*wxSortCallback)(const void* pItem1, + const void* pItem2, + const void* user_data); -WXDLLIMPEXP_BASE void wxQsort(void *const pbase, size_t total_elems, - size_t size, CMPFUNCDATA cmp, const void* user_data); +WXDLLIMPEXP_BASE void wxQsort(void* pbase, size_t total_elems, + size_t size, wxSortCallback cmp, + const void* user_data); #if wxUSE_GUI // GUI only things from now on @@ -804,8 +815,8 @@ WXDLLIMPEXP_CORE bool wxYieldIfNeeded(); // Windows resources access // ---------------------------------------------------------------------------- -// MSW only: get user-defined resource from the .res file. -#ifdef __WXMSW__ +// Windows only: get user-defined resource from the .res file. +#ifdef __WINDOWS__ // default resource type for wxLoadUserResource() extern WXDLLIMPEXP_DATA_BASE(const wxChar*) wxUserResourceStr; @@ -832,7 +843,7 @@ WXDLLIMPEXP_CORE bool wxYieldIfNeeded(); const wxString& resourceType = wxUserResourceStr, int* pLen = NULL, WXHINSTANCE module = 0); -#endif // MSW +#endif // __WINDOWS__ #endif // _WX_UTILSH__ diff --git a/Externals/wxWidgets3/include/wx/valgen.h b/Externals/wxWidgets3/include/wx/valgen.h index a0c81bf88f..9e6f0c3479 100644 --- a/Externals/wxWidgets3/include/wx/valgen.h +++ b/Externals/wxWidgets3/include/wx/valgen.h @@ -3,7 +3,7 @@ // Purpose: wxGenericValidator class // Author: Kevin Smith // Created: Jan 22 1999 -// RCS-ID: $Id: valgen.h 67254 2011-03-20 00:14:35Z DS $ +// RCS-ID: $Id: valgen.h 68217 2011-07-09 23:37:28Z VZ $ // Copyright: (c) 1999 Julian Smart (assigned from Kevin) // Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// @@ -16,6 +16,7 @@ #if wxUSE_VALIDATORS class WXDLLIMPEXP_FWD_BASE wxDateTime; +class WXDLLIMPEXP_FWD_BASE wxFileName; // ---------------------------------------------------------------------------- // wxGenericValidator performs data transfer between many standard controls and @@ -42,6 +43,13 @@ public: // wxDatePickerCtrl wxGenericValidator(wxDateTime* val); #endif // wxUSE_DATETIME + // wxTextCtrl + wxGenericValidator(wxFileName* val); + // wxTextCtrl + wxGenericValidator(float* val); + // wxTextCtrl + wxGenericValidator(double* val); + wxGenericValidator(const wxGenericValidator& copyFrom); virtual ~wxGenericValidator(){} @@ -73,6 +81,9 @@ protected: #if wxUSE_DATETIME wxDateTime* m_pDateTime; #endif // wxUSE_DATETIME + wxFileName* m_pFileName; + float* m_pFloat; + double* m_pDouble; private: DECLARE_CLASS(wxGenericValidator) diff --git a/Externals/wxWidgets3/include/wx/vector.h b/Externals/wxWidgets3/include/wx/vector.h index 1d785e949d..e95d4103ef 100644 --- a/Externals/wxWidgets3/include/wx/vector.h +++ b/Externals/wxWidgets3/include/wx/vector.h @@ -14,7 +14,7 @@ #include "wx/defs.h" -#if wxUSE_STL +#if wxUSE_STD_CONTAINERS #include #include @@ -26,7 +26,7 @@ inline void wxVectorSort(wxVector& v) std::sort(v.begin(), v.end()); } -#else // !wxUSE_STL +#else // !wxUSE_STD_CONTAINERS #include "wx/utils.h" #include "wx/scopeguard.h" @@ -457,7 +457,7 @@ namespace wxPrivate template struct wxVectorComparator { - static int wxCMPFUNC_CONV + static int Compare(const void* pitem1, const void* pitem2, const void* ) { const T& item1 = *reinterpret_cast(pitem1); @@ -485,7 +485,7 @@ void wxVectorSort(wxVector& v) -#endif // wxUSE_STL/!wxUSE_STL +#endif // wxUSE_STD_CONTAINERS/!wxUSE_STD_CONTAINERS #if WXWIN_COMPATIBILITY_2_8 #define WX_DECLARE_VECTORBASE(obj, cls) typedef wxVector cls diff --git a/Externals/wxWidgets3/include/wx/version.h b/Externals/wxWidgets3/include/wx/version.h index 67888da9d6..fb634a97fb 100644 --- a/Externals/wxWidgets3/include/wx/version.h +++ b/Externals/wxWidgets3/include/wx/version.h @@ -4,7 +4,7 @@ * Author: Julian Smart * Modified by: Ryan Norton (Converted to C) * Created: 29/01/98 - * RCS-ID: $Id: version.h 65038 2010-07-22 12:09:04Z VZ $ + * RCS-ID: $Id: version.h 70021 2011-12-16 22:12:49Z VZ $ * Copyright: (c) 1998 Julian Smart * Licence: wxWindows licence */ @@ -28,9 +28,9 @@ /* NB: this file is parsed by automatic tools so don't change its format! */ #define wxMAJOR_VERSION 2 #define wxMINOR_VERSION 9 -#define wxRELEASE_NUMBER 2 +#define wxRELEASE_NUMBER 4 #define wxSUBRELEASE_NUMBER 0 -#define wxVERSION_STRING wxT("wxWidgets 2.9.2") +#define wxVERSION_STRING wxT("wxWidgets 2.9.4") /* nothing to update below this line when updating the version */ /* ---------------------------------------------------------------------------- */ diff --git a/Externals/wxWidgets3/include/wx/vscroll.h b/Externals/wxWidgets3/include/wx/vscroll.h index d13ecf26f7..6bf9623c36 100644 --- a/Externals/wxWidgets3/include/wx/vscroll.h +++ b/Externals/wxWidgets3/include/wx/vscroll.h @@ -4,7 +4,7 @@ // Author: Vadim Zeitlin // Modified by: Brad Anderson, Bryan Petty // Created: 30.05.03 -// RCS-ID: $Id: vscroll.h 64943 2010-07-13 13:29:58Z VZ $ +// RCS-ID: $Id: vscroll.h 70085 2011-12-22 01:26:11Z RD $ // Copyright: (c) 2003 Vadim Zeitlin // Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// @@ -236,7 +236,7 @@ protected: #ifdef __WXMAC__ // queue mac window update after handling scroll event - virtual void UpdateMacScrollWindow() = 0; + virtual void UpdateMacScrollWindow() { } #endif // __WXMAC__ // change the target window diff --git a/Externals/wxWidgets3/include/wx/webview.h b/Externals/wxWidgets3/include/wx/webview.h new file mode 100644 index 0000000000..993d99cfa5 --- /dev/null +++ b/Externals/wxWidgets3/include/wx/webview.h @@ -0,0 +1,242 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: webview.h +// Purpose: Common interface and events for web view component +// Author: Marianne Gagnon +// Id: $Id: webview.h 70038 2011-12-17 23:52:40Z VZ $ +// Copyright: (c) 2010 Marianne Gagnon, 2011 Steven Lamerton +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_WEB_VIEW_H_ +#define _WX_WEB_VIEW_H_ + +#include "wx/defs.h" + +#if wxUSE_WEBVIEW + +#include "wx/control.h" +#include "wx/event.h" +#include "wx/sstream.h" +#include "wx/sharedptr.h" +#include "wx/vector.h" + +#if defined(__WXOSX__) + #include "wx/osx/webviewhistoryitem_webkit.h" +#elif defined(__WXGTK__) + #include "wx/gtk/webviewhistoryitem_webkit.h" +#elif defined(__WXMSW__) + #include "wx/msw/webviewhistoryitem_ie.h" +#else + #error "wxWebView not implemented on this platform." +#endif + +class wxFSFile; +class wxFileSystem; + +enum wxWebViewZoom +{ + wxWEB_VIEW_ZOOM_TINY, + wxWEB_VIEW_ZOOM_SMALL, + wxWEB_VIEW_ZOOM_MEDIUM, + wxWEB_VIEW_ZOOM_LARGE, + wxWEB_VIEW_ZOOM_LARGEST +}; + +enum wxWebViewZoomType +{ + //Scales entire page, including images + wxWEB_VIEW_ZOOM_TYPE_LAYOUT, + wxWEB_VIEW_ZOOM_TYPE_TEXT +}; + +enum wxWebViewNavigationError +{ + wxWEB_NAV_ERR_CONNECTION, + wxWEB_NAV_ERR_CERTIFICATE, + wxWEB_NAV_ERR_AUTH, + wxWEB_NAV_ERR_SECURITY, + wxWEB_NAV_ERR_NOT_FOUND, + wxWEB_NAV_ERR_REQUEST, + wxWEB_NAV_ERR_USER_CANCELLED, + wxWEB_NAV_ERR_OTHER +}; + +enum wxWebViewReloadFlags +{ + //Default, may access cache + wxWEB_VIEW_RELOAD_DEFAULT, + wxWEB_VIEW_RELOAD_NO_CACHE +}; + +enum wxWebViewBackend +{ + wxWEB_VIEW_BACKEND_DEFAULT, + wxWEB_VIEW_BACKEND_WEBKIT, + wxWEB_VIEW_BACKEND_IE +}; + +//Base class for custom scheme handlers +class WXDLLIMPEXP_WEBVIEW wxWebViewHandler +{ +public: + wxWebViewHandler(const wxString& scheme) : m_scheme(scheme) {} + virtual ~wxWebViewHandler() {} + virtual wxString GetName() const { return m_scheme; } + virtual wxFSFile* GetFile(const wxString &uri) = 0; +private: + wxString m_scheme; +}; + +extern WXDLLIMPEXP_DATA_WEBVIEW(const char) wxWebViewNameStr[]; +extern WXDLLIMPEXP_DATA_WEBVIEW(const char) wxWebViewDefaultURLStr[]; + +class WXDLLIMPEXP_WEBVIEW wxWebView : public wxControl +{ +public: + virtual ~wxWebView() {} + + virtual bool Create(wxWindow* parent, + wxWindowID id, + const wxString& url = wxWebViewDefaultURLStr, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + long style = 0, + const wxString& name = wxWebViewNameStr) = 0; + + static wxWebView* New(wxWebViewBackend backend = wxWEB_VIEW_BACKEND_DEFAULT); + static wxWebView* New(wxWindow* parent, + wxWindowID id, + const wxString& url = wxWebViewDefaultURLStr, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + wxWebViewBackend backend = wxWEB_VIEW_BACKEND_DEFAULT, + long style = 0, + const wxString& name = wxWebViewNameStr); + + //General methods + virtual wxString GetCurrentTitle() const = 0; + virtual wxString GetCurrentURL() const = 0; + // TODO: handle choosing a frame when calling GetPageSource()? + virtual wxString GetPageSource() const = 0; + virtual wxString GetPageText() const = 0; + virtual bool IsBusy() const = 0; + virtual bool IsEditable() const = 0; + virtual void LoadURL(const wxString& url) = 0; + virtual void Print() = 0; + virtual void RegisterHandler(wxSharedPtr handler) = 0; + virtual void Reload(wxWebViewReloadFlags flags = wxWEB_VIEW_RELOAD_DEFAULT) = 0; + virtual void RunScript(const wxString& javascript) = 0; + virtual void SetEditable(bool enable = true) = 0; + virtual void SetPage(const wxString& html, const wxString& baseUrl) = 0; + virtual void SetPage(wxInputStream& html, wxString baseUrl) + { + wxStringOutputStream stream; + stream.Write(html); + SetPage(stream.GetString(), baseUrl); + } + virtual void Stop() = 0; + + //History + virtual bool CanGoBack() const = 0; + virtual bool CanGoForward() const = 0; + virtual void GoBack() = 0; + virtual void GoForward() = 0; + virtual void ClearHistory() = 0; + virtual void EnableHistory(bool enable = true) = 0; + virtual wxVector > GetBackwardHistory() = 0; + virtual wxVector > GetForwardHistory() = 0; + virtual void LoadHistoryItem(wxSharedPtr item) = 0; + + //Zoom + virtual bool CanSetZoomType(wxWebViewZoomType type) const = 0; + virtual wxWebViewZoom GetZoom() const = 0; + virtual wxWebViewZoomType GetZoomType() const = 0; + virtual void SetZoom(wxWebViewZoom zoom) = 0; + virtual void SetZoomType(wxWebViewZoomType zoomType) = 0; + + //Selection + virtual void SelectAll() = 0; + virtual bool HasSelection() const = 0; + virtual void DeleteSelection() = 0; + virtual wxString GetSelectedText() const = 0; + virtual wxString GetSelectedSource() const = 0; + virtual void ClearSelection() = 0; + + //Clipboard functions + virtual bool CanCut() const = 0; + virtual bool CanCopy() const = 0; + virtual bool CanPaste() const = 0; + virtual void Cut() = 0; + virtual void Copy() = 0; + virtual void Paste() = 0; + + //Undo / redo functionality + virtual bool CanUndo() const = 0; + virtual bool CanRedo() const = 0; + virtual void Undo() = 0; + virtual void Redo() = 0; + + wxDECLARE_ABSTRACT_CLASS(wxWebView); +}; + +class WXDLLIMPEXP_WEBVIEW wxWebViewEvent : public wxNotifyEvent +{ +public: + wxWebViewEvent() {} + wxWebViewEvent(wxEventType type, int id, const wxString url, + const wxString target) + : wxNotifyEvent(type, id), m_url(url), m_target(target) + {} + + + const wxString& GetURL() const { return m_url; } + const wxString& GetTarget() const { return m_target; } + + virtual wxEvent* Clone() const { return new wxWebViewEvent(*this); } +private: + wxString m_url; + wxString m_target; + + wxDECLARE_DYNAMIC_CLASS_NO_ASSIGN(wxWebViewEvent); +}; + +wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_WEBVIEW, wxEVT_COMMAND_WEB_VIEW_NAVIGATING, wxWebViewEvent ); +wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_WEBVIEW, wxEVT_COMMAND_WEB_VIEW_NAVIGATED, wxWebViewEvent ); +wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_WEBVIEW, wxEVT_COMMAND_WEB_VIEW_LOADED, wxWebViewEvent ); +wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_WEBVIEW, wxEVT_COMMAND_WEB_VIEW_ERROR, wxWebViewEvent ); +wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_WEBVIEW, wxEVT_COMMAND_WEB_VIEW_NEWWINDOW, wxWebViewEvent ); +wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_WEBVIEW, wxEVT_COMMAND_WEB_VIEW_TITLE_CHANGED, wxWebViewEvent ); + +typedef void (wxEvtHandler::*wxWebViewEventFunction) + (wxWebViewEvent&); + +#define wxWebViewEventHandler(func) \ + wxEVENT_HANDLER_CAST(wxWebViewEventFunction, func) + +#define EVT_WEB_VIEW_NAVIGATING(id, fn) \ + wx__DECLARE_EVT1(wxEVT_COMMAND_WEB_VIEW_NAVIGATING, id, \ + wxWebViewEventHandler(fn)) + +#define EVT_WEB_VIEW_NAVIGATED(id, fn) \ + wx__DECLARE_EVT1(wxEVT_COMMAND_WEB_VIEW_NAVIGATED, id, \ + wxWebViewEventHandler(fn)) + +#define EVT_WEB_VIEW_LOADED(id, fn) \ + wx__DECLARE_EVT1(wxEVT_COMMAND_WEB_VIEW_LOADED, id, \ + wxWebViewEventHandler(fn)) + +#define EVT_WEB_VIEW_ERROR(id, fn) \ + wx__DECLARE_EVT1(wxEVT_COMMAND_WEB_VIEW_ERROR, id, \ + wxWebViewEventHandler(fn)) + +#define EVT_WEB_VIEW_NEWWINDOW(id, fn) \ + wx__DECLARE_EVT1(wxEVT_COMMAND_WEB_VIEW_NEWWINDOW, id, \ + wxWebViewEventHandler(fn)) + +#define EVT_WEB_VIEW_TITLE_CHANGED(id, fn) \ + wx__DECLARE_EVT1(wxEVT_COMMAND_WEB_VIEW_TITLE_CHANGED, id, \ + wxWebViewEventHandler(fn)) + +#endif // wxUSE_WEBVIEW + +#endif // _WX_WEB_VIEW_H_ diff --git a/Externals/wxWidgets3/include/wx/webviewarchivehandler.h b/Externals/wxWidgets3/include/wx/webviewarchivehandler.h new file mode 100644 index 0000000000..4cd91dc4af --- /dev/null +++ b/Externals/wxWidgets3/include/wx/webviewarchivehandler.h @@ -0,0 +1,37 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: webviewarchivehandler.h +// Purpose: Custom webview handler to allow archive browsing +// Author: Steven Lamerton +// Id: $Id: webviewarchivehandler.h 69316 2011-10-05 21:21:51Z SJL $ +// Copyright: (c) 2011 Steven Lamerton +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_WEB_VIEW_FILE_HANDLER_H_ +#define _WX_WEB_VIEW_FILE_HANDLER_H_ + +#include "wx/setup.h" + +#if wxUSE_WEBVIEW + +class wxFSFile; +class wxFileSystem; + +#include "wx/webview.h" + +//Loads from uris such as scheme:///C:/example/example.html or archives such as +//scheme:///C:/example/example.zip;protocol=zip/example.html + +class WXDLLIMPEXP_WEBVIEW wxWebViewArchiveHandler : public wxWebViewHandler +{ +public: + wxWebViewArchiveHandler(const wxString& scheme); + virtual ~wxWebViewArchiveHandler(); + virtual wxFSFile* GetFile(const wxString &uri); +private: + wxFileSystem* m_fileSystem; +}; + +#endif // wxUSE_WEBVIEW + +#endif // _WX_WEB_VIEW_FILE_HANDLER_H_ diff --git a/Externals/wxWidgets3/include/wx/window.h b/Externals/wxWidgets3/include/wx/window.h index e108fac563..3ec3b57692 100644 --- a/Externals/wxWidgets3/include/wx/window.h +++ b/Externals/wxWidgets3/include/wx/window.h @@ -4,7 +4,7 @@ // Author: Vadim Zeitlin // Modified by: Ron Lee // Created: 01/02/97 -// RCS-ID: $Id: window.h 67280 2011-03-22 14:17:38Z DS $ +// RCS-ID: $Id: window.h 70838 2012-03-07 23:50:21Z VZ $ // Copyright: (c) Vadim Zeitlin // Licence: wxWindows licence /////////////////////////////////////////////////////////////////////////////// @@ -480,7 +480,7 @@ public: // windows this is just the client area of the window, but for // some like scrolled windows it is more or less independent of // the screen window size. You may override the DoXXXVirtual - // methods below for classes where that is is the case. + // methods below for classes where that is the case. void SetVirtualSize( const wxSize &size ) { DoSetVirtualSize( size.x, size.y ); } void SetVirtualSize( int x, int y ) { DoSetVirtualSize( x, y ); } @@ -623,9 +623,10 @@ public: bool HasExtraStyle(int exFlag) const { return (m_exStyle & exFlag) != 0; } +#if WXWIN_COMPATIBILITY_2_8 // make the window modal (all other windows unresponsive) - virtual void MakeModal(bool modal = true); - + wxDEPRECATED( virtual void MakeModal(bool modal = true) ); +#endif // (primitive) theming support // --------------------------- @@ -1029,8 +1030,7 @@ public: wxColour GetForegroundColour() const; // Set/get the background style. - virtual bool SetBackgroundStyle(wxBackgroundStyle style) - { m_backgroundStyle = style; return true; } + virtual bool SetBackgroundStyle(wxBackgroundStyle style); wxBackgroundStyle GetBackgroundStyle() const { return m_backgroundStyle; } @@ -1039,6 +1039,13 @@ public: // from a parent window virtual bool HasTransparentBackground() { return false; } + // Returns true if background transparency is supported for this + // window, i.e. if calling SetBackgroundStyle(wxBG_STYLE_TRANSPARENT) + // has a chance of succeeding. If reason argument is non-NULL, returns a + // user-readable explanation of why it isn't supported if the return + // value is false. + virtual bool IsTransparentBackgroundSupported(wxString* reason = NULL) const; + // set/retrieve the font for the window (SetFont() returns true if the // font really changed) virtual bool SetFont(const wxFont& font) = 0; @@ -1254,6 +1261,15 @@ public: // get the associated tooltip or NULL if none wxToolTip* GetToolTip() const { return m_tooltip; } wxString GetToolTipText() const; + + // Use the same tool tip as the given one (which can be NULL to indicate + // that no tooltip should be used) for this window. This is currently only + // used by wxCompositeWindow::DoSetToolTip() implementation and is not part + // of the public wx API. + // + // Returns true if tip was valid and we copied it or false if it was NULL + // and we reset our own tooltip too. + bool CopyToolTip(wxToolTip *tip); #else // !wxUSE_TOOLTIPS // make it much easier to compile apps in an environment // that doesn't support tooltips, such as PocketPC @@ -1422,6 +1438,15 @@ public: virtual wxWindow *GetMainWindowOfCompositeControl() { return (wxWindow*)this; } + // If this function returns true, keyboard navigation events shouldn't + // escape from it. A typical example of such "navigation domain" is a top + // level window because pressing TAB in one of them must not transfer focus + // to a different top level window. But it's not limited to them, e.g. MDI + // children frames are not top level windows (and their IsTopLevel() + // returns false) but still are self-contained navigation domains as well. + virtual bool IsTopNavigationDomain() const { return false; } + + protected: // helper for the derived class Create() methods: the first overload, with // validator parameter, should be used for child windows while the second @@ -1794,14 +1819,7 @@ inline void wxWindowBase::SetInitialBestSize(const wxSize& size) // ---------------------------------------------------------------------------- // include the declaration of the platform-specific class -#if defined(__WXPALMOS__) - #ifdef __WXUNIVERSAL__ - #define wxWindowNative wxWindowPalm - #else // !wxUniv - #define wxWindowPalm wxWindow - #endif // wxUniv/!wxUniv - #include "wx/palmos/window.h" -#elif defined(__WXMSW__) +#if defined(__WXMSW__) #ifdef __WXUNIVERSAL__ #define wxWindowNative wxWindowMSW #else // !wxUniv @@ -1831,9 +1849,6 @@ inline void wxWindowBase::SetInitialBestSize(const wxSize& size) #define wxWindowX11 wxWindow #endif // wxUniv #include "wx/x11/window.h" -#elif defined(__WXMGL__) - #define wxWindowNative wxWindowMGL - #include "wx/mgl/window.h" #elif defined(__WXDFB__) #define wxWindowNative wxWindowDFB #include "wx/dfb/window.h" diff --git a/Externals/wxWidgets3/include/wx/withimages.h b/Externals/wxWidgets3/include/wx/withimages.h new file mode 100644 index 0000000000..f8ce1c85e4 --- /dev/null +++ b/Externals/wxWidgets3/include/wx/withimages.h @@ -0,0 +1,97 @@ +/////////////////////////////////////////////////////////////////////////////// +// Name: wx/withimages.h +// Purpose: Declaration of a simple wxWithImages class. +// Author: Vadim Zeitlin +// Created: 2011-08-17 +// RCS-ID: $Id: withimages.h 68813 2011-08-21 14:52:16Z VZ $ +// Copyright: (c) 2011 Vadim Zeitlin +// Licence: wxWindows licence +/////////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_WITHIMAGES_H_ +#define _WX_WITHIMAGES_H_ + +#include "wx/defs.h" +#include "wx/icon.h" +#include "wx/imaglist.h" + +// ---------------------------------------------------------------------------- +// wxWithImages: mix-in class providing access to wxImageList. +// ---------------------------------------------------------------------------- + +class WXDLLIMPEXP_CORE wxWithImages +{ +public: + enum + { + NO_IMAGE = -1 + }; + + wxWithImages() + { + m_imageList = NULL; + m_ownsImageList = false; + } + + virtual ~wxWithImages() + { + FreeIfNeeded(); + } + + // Sets the image list to use, it is *not* deleted by the control. + virtual void SetImageList(wxImageList* imageList) + { + FreeIfNeeded(); + m_imageList = imageList; + } + + // As SetImageList() but we will delete the image list ourselves. + void AssignImageList(wxImageList* imageList) + { + SetImageList(imageList); + m_ownsImageList = true; + } + + // Get pointer (may be NULL) to the associated image list. + wxImageList* GetImageList() const { return m_imageList; } + +protected: + // Return true if we have a valid image list. + bool HasImageList() const { return m_imageList != NULL; } + + // Return the image with the given index from the image list. + // + // If there is no image list or if index == NO_IMAGE, silently returns + // wxNullIcon. + wxIcon GetImage(int iconIndex) const + { + return m_imageList && iconIndex != NO_IMAGE + ? m_imageList->GetIcon(iconIndex) + : wxNullIcon; + } + +private: + // Free the image list if necessary, i.e. if we own it. + void FreeIfNeeded() + { + if ( m_ownsImageList ) + { + delete m_imageList; + m_imageList = NULL; + + // We don't own it any more. + m_ownsImageList = false; + } + } + + + // The associated image list or NULL. + wxImageList* m_imageList; + + // False by default, if true then we delete m_imageList. + bool m_ownsImageList; + + wxDECLARE_NO_COPY_CLASS(wxWithImages); +}; + +#endif // _WX_WITHIMAGES_H_ diff --git a/Externals/wxWidgets3/include/wx/wizard.h b/Externals/wxWidgets3/include/wx/wizard.h index 997631bfb4..bd23ce582a 100644 --- a/Externals/wxWidgets3/include/wx/wizard.h +++ b/Externals/wxWidgets3/include/wx/wizard.h @@ -9,7 +9,7 @@ // Added wxWIZARD_HELP event // Robert Vazan (sizers) // Created: 15.08.99 -// RCS-ID: $Id: wizard.h 67254 2011-03-20 00:14:35Z DS $ +// RCS-ID: $Id: wizard.h 70630 2012-02-20 11:38:52Z JS $ // Copyright: (c) 1999 Vadim Zeitlin // Licence: wxWindows licence /////////////////////////////////////////////////////////////////////////////// @@ -291,6 +291,7 @@ wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_ADV, wxEVT_WIZARD_CANCEL, wxWizardEvent ); wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_ADV, wxEVT_WIZARD_HELP, wxWizardEvent ); wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_ADV, wxEVT_WIZARD_FINISHED, wxWizardEvent ); wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_ADV, wxEVT_WIZARD_PAGE_SHOWN, wxWizardEvent ); +wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_ADV, wxEVT_WIZARD_BEFORE_PAGE_CHANGED, wxWizardEvent ); typedef void (wxEvtHandler::*wxWizardEventFunction)(wxWizardEvent&); @@ -307,6 +308,10 @@ typedef void (wxEvtHandler::*wxWizardEventFunction)(wxWizardEvent&); // changed - unless the event handler vetoes the event #define EVT_WIZARD_PAGE_CHANGING(id, fn) wx__DECLARE_WIZARDEVT(PAGE_CHANGING, id, fn) +// Called before GetNext/GetPrev is called, so that the handler can change state that will be +// used when GetNext/GetPrev is called. PAGE_CHANGING is called too late to influence GetNext/GetPrev. +#define EVT_WIZARD_BEFORE_PAGE_CHANGED(id, fn) wx__DECLARE_WIZARDEVT(BEFORE_PAGE_CHANGED, id, fn) + // the user pressed "Cancel" button and the wizard is going to be dismissed - // unless the event handler vetoes the event #define EVT_WIZARD_CANCEL(id, fn) wx__DECLARE_WIZARDEVT(CANCEL, id, fn) diff --git a/Externals/wxWidgets3/include/wx/wxcrt.h b/Externals/wxWidgets3/include/wx/wxcrt.h index 19cb0d6258..e464e36c80 100644 --- a/Externals/wxWidgets3/include/wx/wxcrt.h +++ b/Externals/wxWidgets3/include/wx/wxcrt.h @@ -5,7 +5,7 @@ // Author: Joel Farley, Ove Kaaven // Modified by: Vadim Zeitlin, Robert Roebling, Ron Lee, Vaclav Slavik // Created: 1998/06/12 -// RCS-ID: $Id: wxcrt.h 66798 2011-01-28 06:18:33Z PC $ +// RCS-ID: $Id: wxcrt.h 68594 2011-08-08 08:33:19Z VZ $ // Copyright: (c) 1998-2006 wxWidgets dev team // Licence: wxWindows licence /////////////////////////////////////////////////////////////////////////////// @@ -467,7 +467,7 @@ WX_STRCMP_FUNC(wxStricmp, wxCRT_StricmpA, wxCRT_StricmpW, wxStricmp_String) // forward-declare the template and implement it below WX_STRCMP_FUNC. OTOH, // this fails to compile with VC6, so don't do it for VC. It also causes // problems with GCC visibility in newer GCC versions. -#if !(defined(__VISUALC__) || wxCHECK_GCC_VERSION(3,5)) || defined(__clang__) +#if !(defined(__VISUALC__) || (wxCHECK_GCC_VERSION(3,5) && !wxCHECK_GCC_VERSION(4,7))) || defined(__clang__) #define wxNEEDS_DECL_BEFORE_TEMPLATE #endif diff --git a/Externals/wxWidgets3/include/wx/wxcrtbase.h b/Externals/wxWidgets3/include/wx/wxcrtbase.h index 845a443c45..4d3d9ebb22 100644 --- a/Externals/wxWidgets3/include/wx/wxcrtbase.h +++ b/Externals/wxWidgets3/include/wx/wxcrtbase.h @@ -5,7 +5,7 @@ * Author: Joel Farley, Ove Kaaven * Modified by: Vadim Zeitlin, Robert Roebling, Ron Lee * Created: 1998/06/12 - * RCS-ID: $Id: wxcrtbase.h 66446 2010-12-25 14:18:58Z VZ $ + * RCS-ID: $Id: wxcrtbase.h 70345 2012-01-15 01:05:28Z VZ $ * Copyright: (c) 1998-2006 wxWidgets dev team * Licence: wxWindows licence */ @@ -32,17 +32,11 @@ */ -#if !defined(__WXPALMOS5__) #include #include #include -#if defined(__WXPALMOS__) - #include -#else - #include -#endif +#include #include -#endif #if defined(__WINDOWS__) && !defined(__WXWINCE__) #include @@ -179,7 +173,7 @@ WXDLLIMPEXP_BASE void *calloc( size_t num, size_t size ); #define wxCRT_StrstrW wcsstr /* these functions are not defined under CE, at least in VC8 CRT */ -#if !defined(__WXWINCE__) && !defined(__WXPALMOS__) +#if !defined(__WXWINCE__) #define wxCRT_StrcollA strcoll #define wxCRT_StrxfrmA strxfrm @@ -188,9 +182,12 @@ WXDLLIMPEXP_BASE void *calloc( size_t num, size_t size ); #endif /* __WXWINCE__ */ /* Almost all compiler have strdup(), but not quite all: CodeWarrior under - Mac and VC++ for Windows CE don't provide it; additionally, gcc under - Mac and OpenVMS do not have wcsdup: */ -#if defined(__VISUALC__) && __VISUALC__ >= 1400 + Mac and VC++ for Windows CE don't provide it. Another special case is gcc in + strict ANSI mode: normally it doesn't provide strdup() but MinGW does + provide it under MSVC-compatible name so test for it before checking + __WX_STRICT_ANSI_GCC__. */ +#if (defined(__VISUALC__) && __VISUALC__ >= 1400) || \ + defined(__MINGW32__) #define wxCRT_StrdupA _strdup #elif !((defined(__MWERKS__) && defined(__WXMAC__)) || \ defined(__WXWINCE__) || \ @@ -198,7 +195,7 @@ WXDLLIMPEXP_BASE void *calloc( size_t num, size_t size ); #define wxCRT_StrdupA strdup #endif -// most Windows compilers provide _wcsdup() +/* most Windows compilers provide _wcsdup() */ #if defined(__WINDOWS__) && \ !(defined(__CYGWIN__) || defined(__WX_STRICT_ANSI_GCC__)) #define wxCRT_StrdupW _wcsdup @@ -271,12 +268,6 @@ WXDLLIMPEXP_BASE void *calloc( size_t num, size_t size ); defined(__EMX__) || defined(__DJGPP__) #define wxCRT_StricmpA stricmp #define wxCRT_StrnicmpA strnicmp -#elif defined(__WXPALMOS__) - /* FIXME: There is no equivalent to strnicmp in the Palm OS API. This - * quick hack should do until one can be written. - */ - #define wxCRT_StricmpA StrCaselessCompare - #define wxCRT_StrnicmpA StrNCaselessCompare #elif defined(__SYMANTEC__) || defined(__VISUALC__) || \ (defined(__MWERKS__) && defined(__INTEL__)) #define wxCRT_StricmpA _stricmp @@ -449,14 +440,14 @@ WXDLLIMPEXP_BASE wchar_t *wxCRT_StrtokW(wchar_t *psz, const wchar_t *delim, wcha wchar_t** endptr, int base); #endif -#endif // wxLongLong_t +#endif /* wxLongLong_t */ /* ------------------------------------------------------------------------- stdio.h ------------------------------------------------------------------------- */ -#if defined(__UNIX__) || defined(__WXMAC__) || defined(__WXPALMOS__) +#if defined(__UNIX__) || defined(__WXMAC__) #define wxMBFILES 1 #else #define wxMBFILES 0 @@ -616,12 +607,9 @@ WXDLLIMPEXP_BASE wchar_t * wxCRT_GetenvW(const wchar_t *name); #if defined(__MWERKS__) && defined(__MSL__) #define wxNEED_WX_MBSTOWCS #endif -#if defined(__WXPALMOS__) - #define wxNEED_WX_MBSTOWCS -#endif #ifdef __DARWIN__ - #if MAC_OS_X_VERSION_MAX_ALLOWED <= MAC_OS_X_VERSION_10_2 + #if !defined(__WXOSX_IPHONE__) && MAC_OS_X_VERSION_MAX_ALLOWED <= MAC_OS_X_VERSION_10_2 #define wxNEED_WX_MBSTOWCS #endif #endif @@ -664,13 +652,14 @@ WXDLLIMPEXP_BASE wchar_t * wxCRT_GetenvW(const wchar_t *name); _xpg5_wcsftime(wchar_t *, size_t, const wchar_t *, const struct tm * ); #define wxCRT_StrftimeW _xpg5_wcsftime #else - // Assume it's always available under non-Unix systems with the exception - // of Palm OS, this does seem to be the case for now. And under Unix we - // trust configure to detect it (except for SGI special case above). - #if defined(HAVE_WCSFTIME) || \ - !(defined(__UNIX__) || defined(__WXPALMOS__)) + /* + Assume it's always available under non-Unix systems as this does seem + to be the case for now. And under Unix we trust configure to detect it + (except for SGI special case above). + */ + #if defined(HAVE_WCSFTIME) || !defined(__UNIX__) #define wxCRT_StrftimeW wcsftime - #endif /* ! __WXPALMOS__ */ + #endif #endif #ifndef wxCRT_StrftimeW diff --git a/Externals/wxWidgets3/include/wx/wxprec.h b/Externals/wxWidgets3/include/wx/wxprec.h index 48f0034877..d1e3fe8a30 100644 --- a/Externals/wxWidgets3/include/wx/wxprec.h +++ b/Externals/wxWidgets3/include/wx/wxprec.h @@ -4,7 +4,7 @@ // Author: Julian Smart // Modified by: // Created: 01/02/97 -// RCS-ID: $Id: wxprec.h 61724 2009-08-21 10:41:26Z VZ $ +// RCS-ID: $Id: wxprec.h 70353 2012-01-15 14:46:41Z VZ $ // Copyright: (c) Julian Smart // Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// @@ -49,21 +49,11 @@ #include "wx/msw/missing.h" #endif -// include all PalmOS headers at once -#ifdef __WXPALMOS__ -# include -#endif - // include #ifdef __OS2__ # include "wx/os2/private.h" #endif -// include mgl headers -#ifdef __WXMGL__ -# include "wx/mgl/private.h" -#endif - // include the most common wx headers #include "wx/wx.h" diff --git a/Externals/wxWidgets3/include/wx/xti.h b/Externals/wxWidgets3/include/wx/xti.h index 34bcdeece5..abd8ae0934 100644 --- a/Externals/wxWidgets3/include/wx/xti.h +++ b/Externals/wxWidgets3/include/wx/xti.h @@ -4,7 +4,7 @@ // Author: Stefan Csomor // Modified by: Francesco Montorsi // Created: 27/07/03 -// RCS-ID: $Id: xti.h 66646 2011-01-07 22:52:46Z SC $ +// RCS-ID: $Id: xti.h 70396 2012-01-19 09:00:29Z SC $ // Copyright: (c) 1997 Julian Smart // (c) 2003 Stefan Csomor // Licence: wxWindows licence @@ -96,7 +96,7 @@ typedef bool (*wxObjectStreamingCallback) ( const wxObject *, wxObjectWriter *, class WXDLLIMPEXP_BASE wxClassInfo { friend class WXDLLIMPEXP_BASE wxPropertyInfo; - friend class WXDLLIMPEXP_BASE wxHandlerInfo; + friend class /* WXDLLIMPEXP_BASE */ wxHandlerInfo; friend wxObject *wxCreateDynamicObject(const wxString& name); public: @@ -333,7 +333,6 @@ private: wxPropertyInfoFn m_firstPropertyFn; wxHandlerInfoFn m_firstHandlerFn; - mutable bool m_firstInited; protected: void EnsureInfosInited() const @@ -351,6 +350,8 @@ protected: mutable wxHandlerInfo* m_firstHandler; private: + mutable bool m_firstInited; + const wxClassInfo** m_parents; const wxChar* m_unitName; diff --git a/Externals/wxWidgets3/include/wx/xtiprop.h b/Externals/wxWidgets3/include/wx/xtiprop.h index 464047004e..75539f51e4 100644 --- a/Externals/wxWidgets3/include/wx/xtiprop.h +++ b/Externals/wxWidgets3/include/wx/xtiprop.h @@ -4,7 +4,7 @@ // Author: Stefan Csomor // Modified by: Francesco Montorsi // Created: 27/07/03 -// RCS-ID: $Id: xtiprop.h 66651 2011-01-08 10:22:30Z SC $ +// RCS-ID: $Id: xtiprop.h 70398 2012-01-19 09:50:46Z SC $ // Copyright: (c) 1997 Julian Smart // (c) 2003 Stefan Csomor // Licence: wxWindows licence @@ -20,9 +20,11 @@ #include "wx/xti.h" #include "wx/any.h" +/* class WXDLLIMPEXP_BASE wxObject; class WXDLLIMPEXP_BASE wxClassInfo; class WXDLLIMPEXP_BASE wxDynamicClassInfo; +*/ class WXDLLIMPEXP_BASE wxHashTable; class WXDLLIMPEXP_BASE wxHashTable_Node; class WXDLLIMPEXP_BASE wxEvent; @@ -302,7 +304,7 @@ enum class WXDLLIMPEXP_BASE wxPropertyInfo { - friend class WXDLLIMPEXP_BASE wxDynamicClassInfo; + friend class /* WXDLLIMPEXP_BASE */ wxDynamicClassInfo; public: wxPropertyInfo(wxPropertyInfo* &iter, @@ -443,9 +445,20 @@ private: // when the component is dropped on the container. }; -WX_DECLARE_STRING_HASH_MAP_WITH_DECL( wxPropertyInfo*, wxPropertyInfoMap, +// stl is giving problems when forwarding declarations, therefore we define it as a subclass + +WX_DECLARE_STRING_HASH_MAP_WITH_DECL( wxPropertyInfo*, wxPropertyInfoMapBase, class WXDLLIMPEXP_BASE ); +class WXDLLIMPEXP_BASE wxPropertyInfoMap : public wxPropertyInfoMapBase { +}; + +WX_DECLARE_STRING_HASH_MAP_WITH_DECL( wxAny, wxStringToAnyHashMapBase, + class WXDLLIMPEXP_BASE ); + +class WXDLLIMPEXP_FWD_BASE wxStringToAnyHashMap : public wxStringToAnyHashMapBase { +}; + #define wxBEGIN_PROPERTIES_TABLE(theClass) \ wxPropertyInfo *theClass::GetPropertiesStatic() \ { \ @@ -544,8 +557,5 @@ public: \ void Set##name( type const & p) { m_##name = p; } \ type const & Get##name() const { return m_##name; } -WX_DECLARE_STRING_HASH_MAP_WITH_DECL( wxAny, wxStringToAnyHashMap, - class WXDLLIMPEXP_BASE ); - #endif // wxUSE_EXTENDED_RTTI #endif // _XTIPROP_H_ diff --git a/Externals/wxWidgets3/include/wx/xtistrm.h b/Externals/wxWidgets3/include/wx/xtistrm.h index 2a5369240a..e304803494 100644 --- a/Externals/wxWidgets3/include/wx/xtistrm.h +++ b/Externals/wxWidgets3/include/wx/xtistrm.h @@ -4,7 +4,7 @@ // Author: Stefan Csomor // Modified by: // Created: 27/07/03 -// RCS-ID: $Id: xtistrm.h 66621 2011-01-07 17:22:59Z SC $ +// RCS-ID: $Id: xtistrm.h 70396 2012-01-19 09:00:29Z SC $ // Copyright: (c) 2003 Stefan Csomor // Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// @@ -38,14 +38,16 @@ const int wxNullObjectID = -3; // or modify the value before it is streamed-out. // ---------------------------------------------------------------------------- +/* + class WXDLLIMPEXP_BASE wxClassInfo; + class WXDLLIMPEXP_BASE wxAnyList; + class WXDLLIMPEXP_BASE wxPropertyInfo; + class WXDLLIMPEXP_BASE wxAny; + class WXDLLIMPEXP_BASE wxHandlerInfo; + */ + class WXDLLIMPEXP_BASE wxObjectWriter; class WXDLLIMPEXP_BASE wxObjectReader; -class WXDLLIMPEXP_BASE wxClassInfo; -class WXDLLIMPEXP_BASE wxAnyList; -class WXDLLIMPEXP_BASE wxPropertyInfo; -class WXDLLIMPEXP_BASE wxAny; -class WXDLLIMPEXP_BASE wxObjectWriter; -class WXDLLIMPEXP_BASE wxHandlerInfo; class WXDLLIMPEXP_BASE wxObjectWriterCallback { diff --git a/Externals/wxWidgets3/include/wx/xtitypes.h b/Externals/wxWidgets3/include/wx/xtitypes.h index 2f689d3126..6724bf4c35 100644 --- a/Externals/wxWidgets3/include/wx/xtitypes.h +++ b/Externals/wxWidgets3/include/wx/xtitypes.h @@ -4,7 +4,7 @@ // Author: Stefan Csomor // Modified by: Francesco Montorsi // Created: 27/07/03 -// RCS-ID: $Id: xtitypes.h 66651 2011-01-08 10:22:30Z SC $ +// RCS-ID: $Id: xtitypes.h 70384 2012-01-18 14:05:39Z SC $ // Copyright: (c) 1997 Julian Smart // (c) 2003 Stefan Csomor // Licence: wxWindows licence @@ -88,7 +88,7 @@ private: wxEnumData s_enumData##e( s_enumDataMembers##e ); \ wxEnumData *wxGetEnumData(e) { return &s_enumData##e; } \ template<> void wxStringReadValue(const wxString& s, e &data ) \ - { data = (e) s_enumData##e.GetEnumMemberValue(s); } \ + { data = (e) s_enumData##e.GetEnumMemberValue(s.c_str()); } \ template<> void wxStringWriteValue(wxString &s, const e &data ) \ { s = s_enumData##e.GetEnumMemberName((int)data); } \ void FromLong##e( long data, wxAny& result ) \ @@ -147,7 +147,7 @@ void wxSetFromString(const wxString &s, wxBitset &data ) { flag = array[i]; int ivalue; - if ( edata->HasEnumMemberValue( flag, &ivalue ) ) + if ( edata->HasEnumMemberValue( flag.c_str(), &ivalue ) ) { data.set( (e) ivalue ); } @@ -202,7 +202,7 @@ void wxFlagsFromString(const wxString &s, e &data ) { flag = array[i]; int ivalue; - if ( edata->HasEnumMemberValue( flag, &ivalue ) ) + if ( edata->HasEnumMemberValue( flag.c_str(), &ivalue ) ) { data.m_data |= ivalue; } @@ -355,7 +355,7 @@ public: if ( m_toString ) (*m_toString)( data, result ); else - wxLogError( wxGetTranslation(_T("String conversions not supported")) ); + wxLogError( wxGetTranslation(wxT("String conversions not supported")) ); } // convert a string into a wxAny holding the corresponding data in this type @@ -364,7 +364,7 @@ public: if( m_fromString ) (*m_fromString)( data, result ); else - wxLogError( wxGetTranslation(_T("String conversions not supported")) ); + wxLogError( wxGetTranslation(wxT("String conversions not supported")) ); } // statics: @@ -428,7 +428,7 @@ public: if( m_toLong ) (*m_toLong)( data, result ); else - wxLogError( wxGetTranslation(_T("Long Conversions not supported")) ); + wxLogError( wxGetTranslation(wxT("Long Conversions not supported")) ); } // convert a long into a wxAny holding the corresponding data in this type @@ -437,7 +437,7 @@ public: if( m_fromLong ) (*m_fromLong)( data, result ); else - wxLogError( wxGetTranslation(_T("Long Conversions not supported")) ); + wxLogError( wxGetTranslation(wxT("Long Conversions not supported")) ); } private: diff --git a/Externals/wxWidgets3/include/wx/xtixml.h b/Externals/wxWidgets3/include/wx/xtixml.h index b68f02438a..5eaf03fa51 100644 --- a/Externals/wxWidgets3/include/wx/xtixml.h +++ b/Externals/wxWidgets3/include/wx/xtixml.h @@ -4,7 +4,7 @@ // Author: Stefan Csomor // Modified by: // Created: 27/07/03 -// RCS-ID: $Id: xtixml.h 66621 2011-01-07 17:22:59Z SC $ +// RCS-ID: $Id: xtixml.h 70397 2012-01-19 09:45:49Z SC $ // Copyright: (c) 2003 Stefan Csomor // Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// @@ -19,6 +19,7 @@ #include "wx/string.h" #include "wx/xtistrm.h" +/* class WXDLLIMPEXP_XML wxXmlNode; class WXDLLIMPEXP_BASE wxPropertyInfo; class WXDLLIMPEXP_BASE wxObject; @@ -26,6 +27,7 @@ class WXDLLIMPEXP_BASE wxClassInfo; class WXDLLIMPEXP_BASE wxAnyList; class WXDLLIMPEXP_BASE wxHandlerInfo; class WXDLLIMPEXP_BASE wxObjectWriterCallback; +*/ class WXDLLIMPEXP_XML wxObjectXmlWriter: public wxObjectWriter { diff --git a/Externals/wxWidgets3/src/aui/auibar.cpp b/Externals/wxWidgets3/src/aui/auibar.cpp index 6e9eb92037..b6654e2fb4 100644 --- a/Externals/wxWidgets3/src/aui/auibar.cpp +++ b/Externals/wxWidgets3/src/aui/auibar.cpp @@ -5,7 +5,7 @@ // Author: Benjamin I. Williams // Modified by: // Created: 2005-05-17 -// RCS-ID: $Id: auibar.cpp 67254 2011-03-20 00:14:35Z DS $ +// RCS-ID: $Id: auibar.cpp 70748 2012-02-29 13:58:52Z VZ $ // Copyright: (C) Copyright 2005-2006, Kirix Corporation, All Rights Reserved // Licence: wxWindows Library Licence, Version 3.1 /////////////////////////////////////////////////////////////////////////////// @@ -69,60 +69,25 @@ const int BUTTON_DROPDOWN_WIDTH = 10; wxBitmap wxAuiBitmapFromBits(const unsigned char bits[], int w, int h, const wxColour& color); -static wxBitmap MakeDisabledBitmap(wxBitmap& bmp) -{ - wxImage image = bmp.ConvertToImage(); - - int mr, mg, mb; - mr = image.GetMaskRed(); - mg = image.GetMaskGreen(); - mb = image.GetMaskBlue(); - - unsigned char* data = image.GetData(); - int width = image.GetWidth(); - int height = image.GetHeight(); - bool has_mask = image.HasMask(); - - for (int y = height-1; y >= 0; --y) - { - for (int x = width-1; x >= 0; --x) - { - data = image.GetData() + (y*(width*3))+(x*3); - unsigned char* r = data; - unsigned char* g = data+1; - unsigned char* b = data+2; - - if (has_mask && *r == mr && *g == mg && *b == mb) - continue; - - *r = wxColour::AlphaBlend(*r, 255, 0.4); - *g = wxColour::AlphaBlend(*g, 255, 0.4); - *b = wxColour::AlphaBlend(*b, 255, 0.4); - } - } - - return wxBitmap(image); -} - static wxColor GetBaseColor() { #if defined( __WXMAC__ ) && wxOSX_USE_COCOA_OR_CARBON - wxColor base_colour = wxColour( wxMacCreateCGColorFromHITheme(kThemeBrushToolbarBackground)); + wxColor baseColour = wxColour( wxMacCreateCGColorFromHITheme(kThemeBrushToolbarBackground)); #else - wxColor base_colour = wxSystemSettings::GetColour(wxSYS_COLOUR_3DFACE); + wxColor baseColour = wxSystemSettings::GetColour(wxSYS_COLOUR_3DFACE); #endif - // the base_colour is too pale to use as our base colour, + // the baseColour is too pale to use as our base colour, // so darken it a bit -- - if ((255-base_colour.Red()) + - (255-base_colour.Green()) + - (255-base_colour.Blue()) < 60) + if ((255-baseColour.Red()) + + (255-baseColour.Green()) + + (255-baseColour.Blue()) < 60) { - base_colour = base_colour.ChangeLightness(92); + baseColour = baseColour.ChangeLightness(92); } - return base_colour; + return baseColour; } @@ -131,14 +96,14 @@ class ToolbarCommandCapture : public wxEvtHandler { public: - ToolbarCommandCapture() { m_last_id = 0; } - int GetCommandId() const { return m_last_id; } + ToolbarCommandCapture() { m_lastId = 0; } + int GetCommandId() const { return m_lastId; } bool ProcessEvent(wxEvent& evt) { if (evt.GetEventType() == wxEVT_COMMAND_MENU_SELECTED) { - m_last_id = evt.GetId(); + m_lastId = evt.GetId(); return true; } @@ -149,7 +114,7 @@ public: } private: - int m_last_id; + int m_lastId; }; @@ -162,36 +127,36 @@ const wxColour DISABLED_TEXT_COLOR(DISABLED_TEXT_GREY_HUE, wxAuiDefaultToolBarArt::wxAuiDefaultToolBarArt() { - m_base_colour = GetBaseColor(); + m_baseColour = GetBaseColor(); m_flags = 0; - m_text_orientation = wxAUI_TBTOOL_TEXT_BOTTOM; - m_highlight_colour = wxSystemSettings::GetColour(wxSYS_COLOUR_HIGHLIGHT); + m_textOrientation = wxAUI_TBTOOL_TEXT_BOTTOM; + m_highlightColour = wxSystemSettings::GetColour(wxSYS_COLOUR_HIGHLIGHT); - m_separator_size = 7; - m_gripper_size = 7; - m_overflow_size = 16; + m_separatorSize = 7; + m_gripperSize = 7; + m_overflowSize = 16; - wxColor darker1_colour = m_base_colour.ChangeLightness(85); - wxColor darker2_colour = m_base_colour.ChangeLightness(75); - wxColor darker3_colour = m_base_colour.ChangeLightness(60); - wxColor darker4_colour = m_base_colour.ChangeLightness(50); - wxColor darker5_colour = m_base_colour.ChangeLightness(40); + wxColor darker1Colour = m_baseColour.ChangeLightness(85); + wxColor darker2Colour = m_baseColour.ChangeLightness(75); + wxColor darker3Colour = m_baseColour.ChangeLightness(60); + wxColor darker4Colour = m_baseColour.ChangeLightness(50); + wxColor darker5Colour = m_baseColour.ChangeLightness(40); - m_gripper_pen1 = wxPen(darker5_colour); - m_gripper_pen2 = wxPen(darker3_colour); - m_gripper_pen3 = *wxWHITE_PEN; + m_gripperPen1 = wxPen(darker5Colour); + m_gripperPen2 = wxPen(darker3Colour); + m_gripperPen3 = *wxWHITE_PEN; - static const unsigned char button_dropdown_bits[] = { 0xe0, 0xf1, 0xfb }; - static const unsigned char overflow_bits[] = { 0x80, 0xff, 0x80, 0xc1, 0xe3, 0xf7 }; + static const unsigned char buttonDropdownBits[] = { 0xe0, 0xf1, 0xfb }; + static const unsigned char overflowBits[] = { 0x80, 0xff, 0x80, 0xc1, 0xe3, 0xf7 }; - m_button_dropdown_bmp = wxAuiBitmapFromBits(button_dropdown_bits, 5, 3, + m_buttonDropDownBmp = wxAuiBitmapFromBits(buttonDropdownBits, 5, 3, *wxBLACK); - m_disabled_button_dropdown_bmp = wxAuiBitmapFromBits( - button_dropdown_bits, 5, 3, + m_disabledButtonDropDownBmp = wxAuiBitmapFromBits( + buttonDropdownBits, 5, 3, wxColor(128,128,128)); - m_overflow_bmp = wxAuiBitmapFromBits(overflow_bits, 7, 6, *wxBLACK); - m_disabled_overflow_bmp = wxAuiBitmapFromBits(overflow_bits, 7, 6, wxColor(128,128,128)); + m_overflowBmp = wxAuiBitmapFromBits(overflowBits, 7, 6, *wxBLACK); + m_disabledOverflowBmp = wxAuiBitmapFromBits(overflowBits, 7, 6, wxColor(128,128,128)); m_font = *wxNORMAL_FONT; } @@ -219,7 +184,7 @@ void wxAuiDefaultToolBarArt::SetFont(const wxFont& font) void wxAuiDefaultToolBarArt::SetTextOrientation(int orientation) { - m_text_orientation = orientation; + m_textOrientation = orientation; } unsigned int wxAuiDefaultToolBarArt::GetFlags() @@ -234,7 +199,7 @@ wxFont wxAuiDefaultToolBarArt::GetFont() int wxAuiDefaultToolBarArt::GetTextOrientation() { - return m_text_orientation; + return m_textOrientation; } void wxAuiDefaultToolBarArt::DrawBackground( @@ -244,9 +209,9 @@ void wxAuiDefaultToolBarArt::DrawBackground( { wxRect rect = _rect; rect.height++; - wxColour start_colour = m_base_colour.ChangeLightness(150); - wxColour end_colour = m_base_colour.ChangeLightness(90); - dc.GradientFillLinear(rect, start_colour, end_colour, wxSOUTH); + wxColour startColour = m_baseColour.ChangeLightness(150); + wxColour endColour = m_baseColour.ChangeLightness(90); + dc.GradientFillLinear(rect, startColour, endColour, wxSOUTH); } void wxAuiDefaultToolBarArt::DrawLabel( @@ -260,18 +225,18 @@ void wxAuiDefaultToolBarArt::DrawLabel( // we only care about the text height here since the text // will get cropped based on the width of the item - int text_width = 0, text_height = 0; - dc.GetTextExtent(wxT("ABCDHgj"), &text_width, &text_height); + int textWidth = 0, textHeight = 0; + dc.GetTextExtent(wxT("ABCDHgj"), &textWidth, &textHeight); // set the clipping region - wxRect clip_rect = rect; - clip_rect.width -= 1; - dc.SetClippingRegion(clip_rect); + wxRect clipRect = rect; + clipRect.width -= 1; + dc.SetClippingRegion(clipRect); - int text_x, text_y; - text_x = rect.x + 1; - text_y = rect.y + (rect.height-text_height)/2; - dc.DrawText(item.GetLabel(), text_x, text_y); + int textX, textY; + textX = rect.x + 1; + textY = rect.y + (rect.height-textHeight)/2; + dc.DrawText(item.GetLabel(), textX, textY); dc.DestroyClippingRegion(); } @@ -282,7 +247,7 @@ void wxAuiDefaultToolBarArt::DrawButton( const wxAuiToolBarItem& item, const wxRect& rect) { - int text_width = 0, text_height = 0; + int textWidth = 0, textHeight = 0; if (m_flags & wxAUI_TB_TEXT) { @@ -290,39 +255,39 @@ void wxAuiDefaultToolBarArt::DrawButton( int tx, ty; - dc.GetTextExtent(wxT("ABCDHgj"), &tx, &text_height); - text_width = 0; - dc.GetTextExtent(item.GetLabel(), &text_width, &ty); + dc.GetTextExtent(wxT("ABCDHgj"), &tx, &textHeight); + textWidth = 0; + dc.GetTextExtent(item.GetLabel(), &textWidth, &ty); } - int bmp_x = 0, bmp_y = 0; - int text_x = 0, text_y = 0; + int bmpX = 0, bmpY = 0; + int textX = 0, textY = 0; - if (m_text_orientation == wxAUI_TBTOOL_TEXT_BOTTOM) + if (m_textOrientation == wxAUI_TBTOOL_TEXT_BOTTOM) { - bmp_x = rect.x + + bmpX = rect.x + (rect.width/2) - (item.GetBitmap().GetWidth()/2); - bmp_y = rect.y + - ((rect.height-text_height)/2) - + bmpY = rect.y + + ((rect.height-textHeight)/2) - (item.GetBitmap().GetHeight()/2); - text_x = rect.x + (rect.width/2) - (text_width/2) + 1; - text_y = rect.y + rect.height - text_height - 1; + textX = rect.x + (rect.width/2) - (textWidth/2) + 1; + textY = rect.y + rect.height - textHeight - 1; } - else if (m_text_orientation == wxAUI_TBTOOL_TEXT_RIGHT) + else if (m_textOrientation == wxAUI_TBTOOL_TEXT_RIGHT) { - bmp_x = rect.x + 3; + bmpX = rect.x + 3; - bmp_y = rect.y + + bmpY = rect.y + (rect.height/2) - (item.GetBitmap().GetHeight()/2); - text_x = bmp_x + 3 + item.GetBitmap().GetWidth(); - text_y = rect.y + + textX = bmpX + 3 + item.GetBitmap().GetWidth(); + textY = rect.y + (rect.height/2) - - (text_height/2); + (textHeight/2); } @@ -330,19 +295,19 @@ void wxAuiDefaultToolBarArt::DrawButton( { if (item.GetState() & wxAUI_BUTTON_STATE_PRESSED) { - dc.SetPen(wxPen(m_highlight_colour)); - dc.SetBrush(wxBrush(m_highlight_colour.ChangeLightness(150))); + dc.SetPen(wxPen(m_highlightColour)); + dc.SetBrush(wxBrush(m_highlightColour.ChangeLightness(150))); dc.DrawRectangle(rect); } else if ((item.GetState() & wxAUI_BUTTON_STATE_HOVER) || item.IsSticky()) { - dc.SetPen(wxPen(m_highlight_colour)); - dc.SetBrush(wxBrush(m_highlight_colour.ChangeLightness(170))); + dc.SetPen(wxPen(m_highlightColour)); + dc.SetBrush(wxBrush(m_highlightColour.ChangeLightness(170))); // draw an even lighter background for checked item hovers (since // the hover background is the same color as the check background) if (item.GetState() & wxAUI_BUTTON_STATE_CHECKED) - dc.SetBrush(wxBrush(m_highlight_colour.ChangeLightness(180))); + dc.SetBrush(wxBrush(m_highlightColour.ChangeLightness(180))); dc.DrawRectangle(rect); } @@ -350,8 +315,8 @@ void wxAuiDefaultToolBarArt::DrawButton( { // it's important to put this code in an else statment after the // hover, otherwise hovers won't draw properly for checked items - dc.SetPen(wxPen(m_highlight_colour)); - dc.SetBrush(wxBrush(m_highlight_colour.ChangeLightness(170))); + dc.SetPen(wxPen(m_highlightColour)); + dc.SetBrush(wxBrush(m_highlightColour.ChangeLightness(170))); dc.DrawRectangle(rect); } } @@ -362,10 +327,8 @@ void wxAuiDefaultToolBarArt::DrawButton( else bmp = item.GetBitmap(); - if (!bmp.IsOk()) - return; - - dc.DrawBitmap(bmp, bmp_x, bmp_y, true); + if ( bmp.IsOk() ) + dc.DrawBitmap(bmp, bmpX, bmpY, true); // set the item's text color based on if it is disabled dc.SetTextForeground(*wxBLACK); @@ -374,7 +337,7 @@ void wxAuiDefaultToolBarArt::DrawButton( if ( (m_flags & wxAUI_TB_TEXT) && !item.GetLabel().empty() ) { - dc.DrawText(item.GetLabel(), text_x, text_y); + dc.DrawText(item.GetLabel(), textX, textY); } } @@ -385,14 +348,14 @@ void wxAuiDefaultToolBarArt::DrawDropDownButton( const wxAuiToolBarItem& item, const wxRect& rect) { - int text_width = 0, text_height = 0, text_x = 0, text_y = 0; - int bmp_x = 0, bmp_y = 0, dropbmp_x = 0, dropbmp_y = 0; + int textWidth = 0, textHeight = 0, textX = 0, textY = 0; + int bmpX = 0, bmpY = 0, dropBmpX = 0, dropBmpY = 0; - wxRect button_rect = wxRect(rect.x, + wxRect buttonRect = wxRect(rect.x, rect.y, rect.width-BUTTON_DROPDOWN_WIDTH, rect.height); - wxRect dropdown_rect = wxRect(rect.x+rect.width-BUTTON_DROPDOWN_WIDTH-1, + wxRect dropDownRect = wxRect(rect.x+rect.width-BUTTON_DROPDOWN_WIDTH-1, rect.y, BUTTON_DROPDOWN_WIDTH+1, rect.height); @@ -404,66 +367,75 @@ void wxAuiDefaultToolBarArt::DrawDropDownButton( int tx, ty; if (m_flags & wxAUI_TB_TEXT) { - dc.GetTextExtent(wxT("ABCDHgj"), &tx, &text_height); - text_width = 0; + dc.GetTextExtent(wxT("ABCDHgj"), &tx, &textHeight); + textWidth = 0; } - dc.GetTextExtent(item.GetLabel(), &text_width, &ty); + dc.GetTextExtent(item.GetLabel(), &textWidth, &ty); } - dropbmp_x = dropdown_rect.x + - (dropdown_rect.width/2) - - (m_button_dropdown_bmp.GetWidth()/2); - dropbmp_y = dropdown_rect.y + - (dropdown_rect.height/2) - - (m_button_dropdown_bmp.GetHeight()/2); + dropBmpX = dropDownRect.x + + (dropDownRect.width/2) - + (m_buttonDropDownBmp.GetWidth()/2); + dropBmpY = dropDownRect.y + + (dropDownRect.height/2) - + (m_buttonDropDownBmp.GetHeight()/2); - if (m_text_orientation == wxAUI_TBTOOL_TEXT_BOTTOM) + if (m_textOrientation == wxAUI_TBTOOL_TEXT_BOTTOM) { - bmp_x = button_rect.x + - (button_rect.width/2) - + bmpX = buttonRect.x + + (buttonRect.width/2) - (item.GetBitmap().GetWidth()/2); - bmp_y = button_rect.y + - ((button_rect.height-text_height)/2) - + bmpY = buttonRect.y + + ((buttonRect.height-textHeight)/2) - (item.GetBitmap().GetHeight()/2); - text_x = rect.x + (rect.width/2) - (text_width/2) + 1; - text_y = rect.y + rect.height - text_height - 1; + textX = rect.x + (rect.width/2) - (textWidth/2) + 1; + textY = rect.y + rect.height - textHeight - 1; } - else if (m_text_orientation == wxAUI_TBTOOL_TEXT_RIGHT) + else if (m_textOrientation == wxAUI_TBTOOL_TEXT_RIGHT) { - bmp_x = rect.x + 3; + bmpX = rect.x + 3; - bmp_y = rect.y + + bmpY = rect.y + (rect.height/2) - (item.GetBitmap().GetHeight()/2); - text_x = bmp_x + 3 + item.GetBitmap().GetWidth(); - text_y = rect.y + + textX = bmpX + 3 + item.GetBitmap().GetWidth(); + textY = rect.y + (rect.height/2) - - (text_height/2); + (textHeight/2); } if (item.GetState() & wxAUI_BUTTON_STATE_PRESSED) { - dc.SetPen(wxPen(m_highlight_colour)); - dc.SetBrush(wxBrush(m_highlight_colour.ChangeLightness(140))); - dc.DrawRectangle(button_rect); + dc.SetPen(wxPen(m_highlightColour)); + dc.SetBrush(wxBrush(m_highlightColour.ChangeLightness(140))); + dc.DrawRectangle(buttonRect); - dc.SetBrush(wxBrush(m_highlight_colour.ChangeLightness(170))); - dc.DrawRectangle(dropdown_rect); + dc.SetBrush(wxBrush(m_highlightColour.ChangeLightness(170))); + dc.DrawRectangle(dropDownRect); } else if (item.GetState() & wxAUI_BUTTON_STATE_HOVER || item.IsSticky()) { - dc.SetPen(wxPen(m_highlight_colour)); - dc.SetBrush(wxBrush(m_highlight_colour.ChangeLightness(170))); - dc.DrawRectangle(button_rect); - dc.DrawRectangle(dropdown_rect); + dc.SetPen(wxPen(m_highlightColour)); + dc.SetBrush(wxBrush(m_highlightColour.ChangeLightness(170))); + dc.DrawRectangle(buttonRect); + dc.DrawRectangle(dropDownRect); + } + else if (item.GetState() & wxAUI_BUTTON_STATE_CHECKED) + { + // Notice that this branch must come after the hover one to ensure the + // correct appearance when the mouse hovers over a checked item.m_ + dc.SetPen(wxPen(m_highlightColour)); + dc.SetBrush(wxBrush(m_highlightColour.ChangeLightness(170))); + dc.DrawRectangle(buttonRect); + dc.DrawRectangle(dropDownRect); } wxBitmap bmp; @@ -471,19 +443,19 @@ void wxAuiDefaultToolBarArt::DrawDropDownButton( if (item.GetState() & wxAUI_BUTTON_STATE_DISABLED) { bmp = item.GetDisabledBitmap(); - dropbmp = m_disabled_button_dropdown_bmp; + dropbmp = m_disabledButtonDropDownBmp; } else { bmp = item.GetBitmap(); - dropbmp = m_button_dropdown_bmp; + dropbmp = m_buttonDropDownBmp; } if (!bmp.IsOk()) return; - dc.DrawBitmap(bmp, bmp_x, bmp_y, true); - dc.DrawBitmap(dropbmp, dropbmp_x, dropbmp_y, true); + dc.DrawBitmap(bmp, bmpX, bmpY, true); + dc.DrawBitmap(dropbmp, dropBmpX, dropBmpY, true); // set the item's text color based on if it is disabled dc.SetTextForeground(*wxBLACK); @@ -492,7 +464,7 @@ void wxAuiDefaultToolBarArt::DrawDropDownButton( if ( (m_flags & wxAUI_TB_TEXT) && !item.GetLabel().empty() ) { - dc.DrawText(item.GetLabel(), text_x, text_y); + dc.DrawText(item.GetLabel(), textX, textY); } } @@ -505,36 +477,36 @@ void wxAuiDefaultToolBarArt::DrawControlLabel( if (!(m_flags & wxAUI_TB_TEXT)) return; - if (m_text_orientation != wxAUI_TBTOOL_TEXT_BOTTOM) + if (m_textOrientation != wxAUI_TBTOOL_TEXT_BOTTOM) return; - int text_x = 0, text_y = 0; - int text_width = 0, text_height = 0; + int textX = 0, textY = 0; + int textWidth = 0, textHeight = 0; dc.SetFont(m_font); int tx, ty; if (m_flags & wxAUI_TB_TEXT) { - dc.GetTextExtent(wxT("ABCDHgj"), &tx, &text_height); - text_width = 0; + dc.GetTextExtent(wxT("ABCDHgj"), &tx, &textHeight); + textWidth = 0; } - dc.GetTextExtent(item.GetLabel(), &text_width, &ty); + dc.GetTextExtent(item.GetLabel(), &textWidth, &ty); // don't draw the label if it is wider than the item width - if (text_width > rect.width) + if (textWidth > rect.width) return; // set the label's text color dc.SetTextForeground(*wxBLACK); - text_x = rect.x + (rect.width/2) - (text_width/2) + 1; - text_y = rect.y + rect.height - text_height - 1; + textX = rect.x + (rect.width/2) - (textWidth/2) + 1; + textY = rect.y + rect.height - textHeight - 1; if ( (m_flags & wxAUI_TB_TEXT) && !item.GetLabel().empty() ) { - dc.DrawText(item.GetLabel(), text_x, text_y); + dc.DrawText(item.GetLabel(), textX, textY); } } @@ -577,7 +549,7 @@ wxSize wxAuiDefaultToolBarArt::GetToolSize( dc.SetFont(m_font); int tx, ty; - if (m_text_orientation == wxAUI_TBTOOL_TEXT_BOTTOM) + if (m_textOrientation == wxAUI_TBTOOL_TEXT_BOTTOM) { dc.GetTextExtent(wxT("ABCDHgj"), &tx, &ty); height += ty; @@ -588,7 +560,7 @@ wxSize wxAuiDefaultToolBarArt::GetToolSize( width = wxMax(width, tx+6); } } - else if ( m_text_orientation == wxAUI_TBTOOL_TEXT_RIGHT && + else if ( m_textOrientation == wxAUI_TBTOOL_TEXT_RIGHT && !item.GetLabel().empty() ) { width += 3; // space between left border and bitmap @@ -638,9 +610,9 @@ void wxAuiDefaultToolBarArt::DrawSeparator( rect.width = new_width; } - wxColour start_colour = m_base_colour.ChangeLightness(80); - wxColour end_colour = m_base_colour.ChangeLightness(80); - dc.GradientFillLinear(rect, start_colour, end_colour, horizontal ? wxSOUTH : wxEAST); + wxColour startColour = m_baseColour.ChangeLightness(80); + wxColour endColour = m_baseColour.ChangeLightness(80); + dc.GradientFillLinear(rect, startColour, endColour, horizontal ? wxSOUTH : wxEAST); } void wxAuiDefaultToolBarArt::DrawGripper(wxDC& dc, @@ -667,12 +639,12 @@ void wxAuiDefaultToolBarArt::DrawGripper(wxDC& dc, break; } - dc.SetPen(m_gripper_pen1); + dc.SetPen(m_gripperPen1); dc.DrawPoint(x, y); - dc.SetPen(m_gripper_pen2); + dc.SetPen(m_gripperPen2); dc.DrawPoint(x, y+1); dc.DrawPoint(x+1, y); - dc.SetPen(m_gripper_pen3); + dc.SetPen(m_gripperPen3); dc.DrawPoint(x+2, y+1); dc.DrawPoint(x+2, y+2); dc.DrawPoint(x+1, y+2); @@ -683,19 +655,18 @@ void wxAuiDefaultToolBarArt::DrawGripper(wxDC& dc, } void wxAuiDefaultToolBarArt::DrawOverflowButton(wxDC& dc, - wxWindow* wnd, + wxWindow* /*wnd*/, const wxRect& rect, int state) { if (state & wxAUI_BUTTON_STATE_HOVER || state & wxAUI_BUTTON_STATE_PRESSED) { - wxRect cli_rect = wnd->GetClientRect(); - wxColor light_gray_bg = m_highlight_colour.ChangeLightness(170); + wxColor light_gray_bg = m_highlightColour.ChangeLightness(170); if (m_flags & wxAUI_TB_VERTICAL) { - dc.SetPen(wxPen(m_highlight_colour)); + dc.SetPen(wxPen(m_highlightColour)); dc.DrawLine(rect.x, rect.y, rect.x+rect.width, rect.y); dc.SetPen(wxPen(light_gray_bg)); dc.SetBrush(wxBrush(light_gray_bg)); @@ -703,7 +674,7 @@ void wxAuiDefaultToolBarArt::DrawOverflowButton(wxDC& dc, } else { - dc.SetPen(wxPen(m_highlight_colour)); + dc.SetPen(wxPen(m_highlightColour)); dc.DrawLine(rect.x, rect.y, rect.x, rect.y+rect.height); dc.SetPen(wxPen(light_gray_bg)); dc.SetBrush(wxBrush(light_gray_bg)); @@ -711,18 +682,18 @@ void wxAuiDefaultToolBarArt::DrawOverflowButton(wxDC& dc, } } - int x = rect.x+1+(rect.width-m_overflow_bmp.GetWidth())/2; - int y = rect.y+1+(rect.height-m_overflow_bmp.GetHeight())/2; - dc.DrawBitmap(m_overflow_bmp, x, y, true); + int x = rect.x+1+(rect.width-m_overflowBmp.GetWidth())/2; + int y = rect.y+1+(rect.height-m_overflowBmp.GetHeight())/2; + dc.DrawBitmap(m_overflowBmp, x, y, true); } int wxAuiDefaultToolBarArt::GetElementSize(int element_id) { switch (element_id) { - case wxAUI_TBART_SEPARATOR_SIZE: return m_separator_size; - case wxAUI_TBART_GRIPPER_SIZE: return m_gripper_size; - case wxAUI_TBART_OVERFLOW_SIZE: return m_overflow_size; + case wxAUI_TBART_SEPARATOR_SIZE: return m_separatorSize; + case wxAUI_TBART_GRIPPER_SIZE: return m_gripperSize; + case wxAUI_TBART_OVERFLOW_SIZE: return m_overflowSize; default: return 0; } } @@ -731,9 +702,9 @@ void wxAuiDefaultToolBarArt::SetElementSize(int element_id, int size) { switch (element_id) { - case wxAUI_TBART_SEPARATOR_SIZE: m_separator_size = size; break; - case wxAUI_TBART_GRIPPER_SIZE: m_gripper_size = size; break; - case wxAUI_TBART_OVERFLOW_SIZE: m_overflow_size = size; break; + case wxAUI_TBART_SEPARATOR_SIZE: m_separatorSize = size; break; + case wxAUI_TBART_GRIPPER_SIZE: m_gripperSize = size; break; + case wxAUI_TBART_OVERFLOW_SIZE: m_overflowSize = size; break; } } @@ -840,18 +811,18 @@ wxAuiToolBar::wxAuiToolBar(wxWindow* parent, style | wxBORDER_NONE) { m_sizer = new wxBoxSizer(wxHORIZONTAL); - m_button_width = -1; - m_button_height = -1; - m_sizer_element_count = 0; - m_action_pos = wxPoint(-1,-1); - m_action_item = NULL; - m_tip_item = NULL; + m_buttonWidth = -1; + m_buttonHeight = -1; + m_sizerElementCount = 0; + m_actionPos = wxPoint(-1,-1); + m_actionItem = NULL; + m_tipItem = NULL; m_art = new wxAuiDefaultToolBarArt; - m_tool_packing = 2; - m_tool_border_padding = 3; - m_tool_text_orientation = wxAUI_TBTOOL_TEXT_BOTTOM; - m_gripper_sizer_item = NULL; - m_overflow_sizer_item = NULL; + m_toolPacking = 2; + m_toolBorderPadding = 3; + m_toolTextOrientation = wxAUI_TBTOOL_TEXT_BOTTOM; + m_gripperSizerItem = NULL; + m_overflowSizerItem = NULL; m_dragging = false; m_orientation = GetOrientation(style); if (m_orientation == wxBOTH) @@ -859,9 +830,9 @@ wxAuiToolBar::wxAuiToolBar(wxWindow* parent, m_orientation = wxHORIZONTAL; } m_style = style | wxBORDER_NONE; - m_gripper_visible = (m_style & wxAUI_TB_GRIPPER) ? true : false; - m_overflow_visible = (m_style & wxAUI_TB_OVERFLOW) ? true : false; - m_overflow_state = 0; + m_gripperVisible = (m_style & wxAUI_TB_GRIPPER) ? true : false; + m_overflowVisible = (m_style & wxAUI_TB_OVERFLOW) ? true : false; + m_overflowState = 0; SetMargins(5, 5, 2, 2); SetFont(*wxNORMAL_FONT); SetArtFlags(); @@ -894,15 +865,15 @@ void wxAuiToolBar::SetWindowStyleFlag(long style) } if (m_style & wxAUI_TB_GRIPPER) - m_gripper_visible = true; + m_gripperVisible = true; else - m_gripper_visible = false; + m_gripperVisible = false; if (m_style & wxAUI_TB_OVERFLOW) - m_overflow_visible = true; + m_overflowVisible = true; else - m_overflow_visible = false; + m_overflowVisible = false; if (style & wxAUI_TB_HORZ_LAYOUT) SetToolTextOrientation(wxAUI_TBTOOL_TEXT_RIGHT); @@ -924,7 +895,7 @@ void wxAuiToolBar::SetArtProvider(wxAuiToolBarArt* art) if (m_art) { SetArtFlags(); - m_art->SetTextOrientation(m_tool_text_orientation); + m_art->SetTextOrientation(m_toolTextOrientation); } } @@ -939,7 +910,7 @@ wxAuiToolBarArt* wxAuiToolBar::GetArtProvider() const wxAuiToolBarItem* wxAuiToolBar::AddTool(int tool_id, const wxString& label, const wxBitmap& bitmap, - const wxString& short_help_string, + const wxString& shortHelp_string, wxItemKind kind) { return AddTool(tool_id, @@ -947,7 +918,7 @@ wxAuiToolBarItem* wxAuiToolBar::AddTool(int tool_id, bitmap, wxNullBitmap, kind, - short_help_string, + shortHelp_string, wxEmptyString, NULL); } @@ -956,43 +927,40 @@ wxAuiToolBarItem* wxAuiToolBar::AddTool(int tool_id, wxAuiToolBarItem* wxAuiToolBar::AddTool(int tool_id, const wxString& label, const wxBitmap& bitmap, - const wxBitmap& disabled_bitmap, + const wxBitmap& disabledBitmap, wxItemKind kind, - const wxString& short_help_string, - const wxString& long_help_string, + const wxString& shortHelpString, + const wxString& longHelpString, wxObject* WXUNUSED(client_data)) { wxAuiToolBarItem item; - item.window = NULL; - item.label = label; - item.bitmap = bitmap; - item.disabled_bitmap = disabled_bitmap; - item.short_help = short_help_string; - item.long_help = long_help_string; - item.active = true; - item.dropdown = false; - item.spacer_pixels = 0; - item.toolid = tool_id; - item.state = 0; - item.proportion = 0; - item.kind = kind; - item.sizer_item = NULL; - item.min_size = wxDefaultSize; - item.user_data = 0; - item.sticky = false; + item.m_window = NULL; + item.m_label = label; + item.m_bitmap = bitmap; + item.m_disabledBitmap = disabledBitmap; + item.m_shortHelp = shortHelpString; + item.m_longHelp = longHelpString; + item.m_active = true; + item.m_dropDown = false; + item.m_spacerPixels = 0; + item.m_toolId = tool_id; + item.m_state = 0; + item.m_proportion = 0; + item.m_kind = kind; + item.m_sizerItem = NULL; + item.m_minSize = wxDefaultSize; + item.m_userData = 0; + item.m_sticky = false; - if (item.toolid == wxID_ANY) - item.toolid = wxNewId(); + if (item.m_toolId == wxID_ANY) + item.m_toolId = wxNewId(); - if (!item.disabled_bitmap.IsOk()) + if (!item.m_disabledBitmap.IsOk()) { // no disabled bitmap specified, we need to make one - if (item.bitmap.IsOk()) + if (item.m_bitmap.IsOk()) { - //wxImage img = item.bitmap.ConvertToImage(); - //wxImage grey_version = img.ConvertToGreyscale(); - //item.disabled_bitmap = wxBitmap(grey_version); - item.disabled_bitmap = MakeDisabledBitmap(item.bitmap); + item.m_disabledBitmap = item.m_bitmap.ConvertToDisabled(); } } m_items.Add(item); @@ -1003,21 +971,21 @@ wxAuiToolBarItem* wxAuiToolBar::AddControl(wxControl* control, const wxString& label) { wxAuiToolBarItem item; - item.window = (wxWindow*)control; - item.label = label; - item.bitmap = wxNullBitmap; - item.disabled_bitmap = wxNullBitmap; - item.active = true; - item.dropdown = false; - item.spacer_pixels = 0; - item.toolid = control->GetId(); - item.state = 0; - item.proportion = 0; - item.kind = wxITEM_CONTROL; - item.sizer_item = NULL; - item.min_size = control->GetEffectiveMinSize(); - item.user_data = 0; - item.sticky = false; + item.m_window = (wxWindow*)control; + item.m_label = label; + item.m_bitmap = wxNullBitmap; + item.m_disabledBitmap = wxNullBitmap; + item.m_active = true; + item.m_dropDown = false; + item.m_spacerPixels = 0; + item.m_toolId = control->GetId(); + item.m_state = 0; + item.m_proportion = 0; + item.m_kind = wxITEM_CONTROL; + item.m_sizerItem = NULL; + item.m_minSize = control->GetEffectiveMinSize(); + item.m_userData = 0; + item.m_sticky = false; m_items.Add(item); return &m_items.Last(); @@ -1032,24 +1000,24 @@ wxAuiToolBarItem* wxAuiToolBar::AddLabel(int tool_id, min_size.x = width; wxAuiToolBarItem item; - item.window = NULL; - item.label = label; - item.bitmap = wxNullBitmap; - item.disabled_bitmap = wxNullBitmap; - item.active = true; - item.dropdown = false; - item.spacer_pixels = 0; - item.toolid = tool_id; - item.state = 0; - item.proportion = 0; - item.kind = wxITEM_LABEL; - item.sizer_item = NULL; - item.min_size = min_size; - item.user_data = 0; - item.sticky = false; + item.m_window = NULL; + item.m_label = label; + item.m_bitmap = wxNullBitmap; + item.m_disabledBitmap = wxNullBitmap; + item.m_active = true; + item.m_dropDown = false; + item.m_spacerPixels = 0; + item.m_toolId = tool_id; + item.m_state = 0; + item.m_proportion = 0; + item.m_kind = wxITEM_LABEL; + item.m_sizerItem = NULL; + item.m_minSize = min_size; + item.m_userData = 0; + item.m_sticky = false; - if (item.toolid == wxID_ANY) - item.toolid = wxNewId(); + if (item.m_toolId == wxID_ANY) + item.m_toolId = wxNewId(); m_items.Add(item); return &m_items.Last(); @@ -1058,20 +1026,20 @@ wxAuiToolBarItem* wxAuiToolBar::AddLabel(int tool_id, wxAuiToolBarItem* wxAuiToolBar::AddSeparator() { wxAuiToolBarItem item; - item.window = NULL; - item.label = wxEmptyString; - item.bitmap = wxNullBitmap; - item.disabled_bitmap = wxNullBitmap; - item.active = true; - item.dropdown = false; - item.toolid = -1; - item.state = 0; - item.proportion = 0; - item.kind = wxITEM_SEPARATOR; - item.sizer_item = NULL; - item.min_size = wxDefaultSize; - item.user_data = 0; - item.sticky = false; + item.m_window = NULL; + item.m_label = wxEmptyString; + item.m_bitmap = wxNullBitmap; + item.m_disabledBitmap = wxNullBitmap; + item.m_active = true; + item.m_dropDown = false; + item.m_toolId = -1; + item.m_state = 0; + item.m_proportion = 0; + item.m_kind = wxITEM_SEPARATOR; + item.m_sizerItem = NULL; + item.m_minSize = wxDefaultSize; + item.m_userData = 0; + item.m_sticky = false; m_items.Add(item); return &m_items.Last(); @@ -1080,21 +1048,21 @@ wxAuiToolBarItem* wxAuiToolBar::AddSeparator() wxAuiToolBarItem* wxAuiToolBar::AddSpacer(int pixels) { wxAuiToolBarItem item; - item.window = NULL; - item.label = wxEmptyString; - item.bitmap = wxNullBitmap; - item.disabled_bitmap = wxNullBitmap; - item.active = true; - item.dropdown = false; - item.spacer_pixels = pixels; - item.toolid = -1; - item.state = 0; - item.proportion = 0; - item.kind = wxITEM_SPACER; - item.sizer_item = NULL; - item.min_size = wxDefaultSize; - item.user_data = 0; - item.sticky = false; + item.m_window = NULL; + item.m_label = wxEmptyString; + item.m_bitmap = wxNullBitmap; + item.m_disabledBitmap = wxNullBitmap; + item.m_active = true; + item.m_dropDown = false; + item.m_spacerPixels = pixels; + item.m_toolId = -1; + item.m_state = 0; + item.m_proportion = 0; + item.m_kind = wxITEM_SPACER; + item.m_sizerItem = NULL; + item.m_minSize = wxDefaultSize; + item.m_userData = 0; + item.m_sticky = false; m_items.Add(item); return &m_items.Last(); @@ -1103,21 +1071,21 @@ wxAuiToolBarItem* wxAuiToolBar::AddSpacer(int pixels) wxAuiToolBarItem* wxAuiToolBar::AddStretchSpacer(int proportion) { wxAuiToolBarItem item; - item.window = NULL; - item.label = wxEmptyString; - item.bitmap = wxNullBitmap; - item.disabled_bitmap = wxNullBitmap; - item.active = true; - item.dropdown = false; - item.spacer_pixels = 0; - item.toolid = -1; - item.state = 0; - item.proportion = proportion; - item.kind = wxITEM_SPACER; - item.sizer_item = NULL; - item.min_size = wxDefaultSize; - item.user_data = 0; - item.sticky = false; + item.m_window = NULL; + item.m_label = wxEmptyString; + item.m_bitmap = wxNullBitmap; + item.m_disabledBitmap = wxNullBitmap; + item.m_active = true; + item.m_dropDown = false; + item.m_spacerPixels = 0; + item.m_toolId = -1; + item.m_state = 0; + item.m_proportion = proportion; + item.m_kind = wxITEM_SPACER; + item.m_sizerItem = NULL; + item.m_minSize = wxDefaultSize; + item.m_userData = 0; + item.m_sticky = false; m_items.Add(item); return &m_items.Last(); @@ -1126,7 +1094,7 @@ wxAuiToolBarItem* wxAuiToolBar::AddStretchSpacer(int proportion) void wxAuiToolBar::Clear() { m_items.Clear(); - m_sizer_element_count = 0; + m_sizerElementCount = 0; } bool wxAuiToolBar::DeleteTool(int tool_id) @@ -1167,7 +1135,7 @@ wxAuiToolBarItem* wxAuiToolBar::FindTool(int tool_id) const for (i = 0, count = m_items.GetCount(); i < count; ++i) { wxAuiToolBarItem& item = m_items.Item(i); - if (item.toolid == tool_id) + if (item.m_toolId == tool_id) return &item; } @@ -1181,10 +1149,10 @@ wxAuiToolBarItem* wxAuiToolBar::FindToolByPosition(wxCoord x, wxCoord y) const { wxAuiToolBarItem& item = m_items.Item(i); - if (!item.sizer_item) + if (!item.m_sizerItem) continue; - wxRect rect = item.sizer_item->GetRect(); + wxRect rect = item.m_sizerItem->GetRect(); if (rect.Contains(x,y)) { // if the item doesn't fit on the toolbar, return NULL @@ -1205,14 +1173,14 @@ wxAuiToolBarItem* wxAuiToolBar::FindToolByPositionWithPacking(wxCoord x, wxCoord { wxAuiToolBarItem& item = m_items.Item(i); - if (!item.sizer_item) + if (!item.m_sizerItem) continue; - wxRect rect = item.sizer_item->GetRect(); + wxRect rect = item.m_sizerItem->GetRect(); // apply tool packing if (i+1 < count) - rect.width += m_tool_packing; + rect.width += m_toolPacking; if (rect.Contains(x,y)) { @@ -1255,7 +1223,7 @@ void wxAuiToolBar::SetToolProportion(int tool_id, int proportion) if (!item) return; - item->proportion = proportion; + item->m_proportion = proportion; } int wxAuiToolBar::GetToolProportion(int tool_id) const @@ -1264,7 +1232,7 @@ int wxAuiToolBar::GetToolProportion(int tool_id) const if (!item) return 0; - return item->proportion; + return item->m_proportion; } void wxAuiToolBar::SetToolSeparation(int separation) @@ -1288,7 +1256,7 @@ void wxAuiToolBar::SetToolDropDown(int tool_id, bool dropdown) if (!item) return; - item->dropdown = dropdown; + item->m_dropDown = dropdown; } bool wxAuiToolBar::GetToolDropDown(int tool_id) const @@ -1297,7 +1265,7 @@ bool wxAuiToolBar::GetToolDropDown(int tool_id) const if (!item) return 0; - return item->dropdown; + return item->m_dropDown; } void wxAuiToolBar::SetToolSticky(int tool_id, bool sticky) @@ -1310,10 +1278,10 @@ void wxAuiToolBar::SetToolSticky(int tool_id, bool sticky) if (!item) return; - if (item->sticky == sticky) + if (item->m_sticky == sticky) return; - item->sticky = sticky; + item->m_sticky = sticky; Refresh(false); Update(); @@ -1325,7 +1293,7 @@ bool wxAuiToolBar::GetToolSticky(int tool_id) const if (!item) return 0; - return item->sticky; + return item->m_sticky; } @@ -1333,17 +1301,17 @@ bool wxAuiToolBar::GetToolSticky(int tool_id) const void wxAuiToolBar::SetToolBorderPadding(int padding) { - m_tool_border_padding = padding; + m_toolBorderPadding = padding; } int wxAuiToolBar::GetToolBorderPadding() const { - return m_tool_border_padding; + return m_toolBorderPadding; } void wxAuiToolBar::SetToolTextOrientation(int orientation) { - m_tool_text_orientation = orientation; + m_toolTextOrientation = orientation; if (m_art) { @@ -1353,17 +1321,17 @@ void wxAuiToolBar::SetToolTextOrientation(int orientation) int wxAuiToolBar::GetToolTextOrientation() const { - return m_tool_text_orientation; + return m_toolTextOrientation; } void wxAuiToolBar::SetToolPacking(int packing) { - m_tool_packing = packing; + m_toolPacking = packing; } int wxAuiToolBar::GetToolPacking() const { - return m_tool_packing; + return m_toolPacking; } @@ -1382,23 +1350,23 @@ void wxAuiToolBar::SetOrientation(int orientation) void wxAuiToolBar::SetMargins(int left, int right, int top, int bottom) { if (left != -1) - m_left_padding = left; + m_leftPadding = left; if (right != -1) - m_right_padding = right; + m_rightPadding = right; if (top != -1) - m_top_padding = top; + m_topPadding = top; if (bottom != -1) - m_bottom_padding = bottom; + m_bottomPadding = bottom; } bool wxAuiToolBar::GetGripperVisible() const { - return m_gripper_visible; + return m_gripperVisible; } void wxAuiToolBar::SetGripperVisible(bool visible) { - m_gripper_visible = visible; + m_gripperVisible = visible; if (visible) m_style |= wxAUI_TB_GRIPPER; else @@ -1410,12 +1378,12 @@ void wxAuiToolBar::SetGripperVisible(bool visible) bool wxAuiToolBar::GetOverflowVisible() const { - return m_overflow_visible; + return m_overflowVisible; } void wxAuiToolBar::SetOverflowVisible(bool visible) { - m_overflow_visible = visible; + m_overflowVisible = visible; if (visible) m_style |= wxAUI_TB_OVERFLOW; else @@ -1444,14 +1412,14 @@ void wxAuiToolBar::SetHoverItem(wxAuiToolBarItem* pitem) for (i = 0, count = m_items.GetCount(); i < count; ++i) { wxAuiToolBarItem& item = m_items.Item(i); - if (item.state & wxAUI_BUTTON_STATE_HOVER) + if (item.m_state & wxAUI_BUTTON_STATE_HOVER) former_hover = &item; - item.state &= ~wxAUI_BUTTON_STATE_HOVER; + item.m_state &= ~wxAUI_BUTTON_STATE_HOVER; } if (pitem) { - pitem->state |= wxAUI_BUTTON_STATE_HOVER; + pitem->m_state |= wxAUI_BUTTON_STATE_HOVER; } if (former_hover != pitem) @@ -1469,15 +1437,15 @@ void wxAuiToolBar::SetPressedItem(wxAuiToolBarItem* pitem) for (i = 0, count = m_items.GetCount(); i < count; ++i) { wxAuiToolBarItem& item = m_items.Item(i); - if (item.state & wxAUI_BUTTON_STATE_PRESSED) + if (item.m_state & wxAUI_BUTTON_STATE_PRESSED) former_item = &item; - item.state &= ~wxAUI_BUTTON_STATE_PRESSED; + item.m_state &= ~wxAUI_BUTTON_STATE_PRESSED; } if (pitem) { - pitem->state &= ~wxAUI_BUTTON_STATE_HOVER; - pitem->state |= wxAUI_BUTTON_STATE_PRESSED; + pitem->m_state &= ~wxAUI_BUTTON_STATE_HOVER; + pitem->m_state |= wxAUI_BUTTON_STATE_PRESSED; } if (former_item != pitem) @@ -1489,9 +1457,9 @@ void wxAuiToolBar::SetPressedItem(wxAuiToolBarItem* pitem) void wxAuiToolBar::RefreshOverflowState() { - if (!m_overflow_sizer_item) + if (!m_overflowSizerItem) { - m_overflow_state = 0; + m_overflowState = 0; return; } @@ -1513,23 +1481,23 @@ void wxAuiToolBar::RefreshOverflowState() overflow_state = wxAUI_BUTTON_STATE_HOVER; } - if (overflow_state != m_overflow_state) + if (overflow_state != m_overflowState) { - m_overflow_state = overflow_state; + m_overflowState = overflow_state; Refresh(false); Update(); } - m_overflow_state = overflow_state; + m_overflowState = overflow_state; } void wxAuiToolBar::ToggleTool(int tool_id, bool state) { wxAuiToolBarItem* tool = FindTool(tool_id); - if (tool && (tool->kind == wxITEM_CHECK || tool->kind == wxITEM_RADIO)) + if (tool && (tool->m_kind == wxITEM_CHECK || tool->m_kind == wxITEM_RADIO)) { - if (tool->kind == wxITEM_RADIO) + if (tool->m_kind == wxITEM_RADIO) { int i, idx, count; idx = GetToolIndex(tool_id); @@ -1537,28 +1505,28 @@ void wxAuiToolBar::ToggleTool(int tool_id, bool state) if (idx >= 0 && idx < count) { - for (i = idx; i < count; ++i) + for (i = idx + 1; i < count; ++i) { - if (m_items[i].kind != wxITEM_RADIO) + if (m_items[i].m_kind != wxITEM_RADIO) break; - m_items[i].state &= ~wxAUI_BUTTON_STATE_CHECKED; + m_items[i].m_state &= ~wxAUI_BUTTON_STATE_CHECKED; } - for (i = idx; i > 0; i--) + for (i = idx - 1; i >= 0; i--) { - if (m_items[i].kind != wxITEM_RADIO) + if (m_items[i].m_kind != wxITEM_RADIO) break; - m_items[i].state &= ~wxAUI_BUTTON_STATE_CHECKED; + m_items[i].m_state &= ~wxAUI_BUTTON_STATE_CHECKED; } } - tool->state |= wxAUI_BUTTON_STATE_CHECKED; + tool->m_state |= wxAUI_BUTTON_STATE_CHECKED; } - else if (tool->kind == wxITEM_CHECK) + else if (tool->m_kind == wxITEM_CHECK) { if (state == true) - tool->state |= wxAUI_BUTTON_STATE_CHECKED; + tool->m_state |= wxAUI_BUTTON_STATE_CHECKED; else - tool->state &= ~wxAUI_BUTTON_STATE_CHECKED; + tool->m_state &= ~wxAUI_BUTTON_STATE_CHECKED; } } } @@ -1569,10 +1537,10 @@ bool wxAuiToolBar::GetToolToggled(int tool_id) const if (tool) { - if ( (tool->kind != wxITEM_CHECK) && (tool->kind != wxITEM_RADIO) ) + if ( (tool->m_kind != wxITEM_CHECK) && (tool->m_kind != wxITEM_RADIO) ) return false; - return (tool->state & wxAUI_BUTTON_STATE_CHECKED) ? true : false; + return (tool->m_state & wxAUI_BUTTON_STATE_CHECKED) ? true : false; } return false; @@ -1585,9 +1553,9 @@ void wxAuiToolBar::EnableTool(int tool_id, bool state) if (tool) { if (state == true) - tool->state &= ~wxAUI_BUTTON_STATE_DISABLED; + tool->m_state &= ~wxAUI_BUTTON_STATE_DISABLED; else - tool->state |= wxAUI_BUTTON_STATE_DISABLED; + tool->m_state |= wxAUI_BUTTON_STATE_DISABLED; } } @@ -1596,7 +1564,7 @@ bool wxAuiToolBar::GetToolEnabled(int tool_id) const wxAuiToolBarItem* tool = FindTool(tool_id); if (tool) - return (tool->state & wxAUI_BUTTON_STATE_DISABLED) ? false : true; + return (tool->m_state & wxAUI_BUTTON_STATE_DISABLED) ? false : true; return false; } @@ -1608,7 +1576,7 @@ wxString wxAuiToolBar::GetToolLabel(int tool_id) const if (!tool) return wxEmptyString; - return tool->label; + return tool->m_label; } void wxAuiToolBar::SetToolLabel(int tool_id, const wxString& label) @@ -1616,7 +1584,7 @@ void wxAuiToolBar::SetToolLabel(int tool_id, const wxString& label) wxAuiToolBarItem* tool = FindTool(tool_id); if (tool) { - tool->label = label; + tool->m_label = label; } } @@ -1627,7 +1595,7 @@ wxBitmap wxAuiToolBar::GetToolBitmap(int tool_id) const if (!tool) return wxNullBitmap; - return tool->bitmap; + return tool->m_bitmap; } void wxAuiToolBar::SetToolBitmap(int tool_id, const wxBitmap& bitmap) @@ -1635,7 +1603,7 @@ void wxAuiToolBar::SetToolBitmap(int tool_id, const wxBitmap& bitmap) wxAuiToolBarItem* tool = FindTool(tool_id); if (tool) { - tool->bitmap = bitmap; + tool->m_bitmap = bitmap; } } @@ -1646,7 +1614,7 @@ wxString wxAuiToolBar::GetToolShortHelp(int tool_id) const if (!tool) return wxEmptyString; - return tool->short_help; + return tool->m_shortHelp; } void wxAuiToolBar::SetToolShortHelp(int tool_id, const wxString& help_string) @@ -1654,7 +1622,7 @@ void wxAuiToolBar::SetToolShortHelp(int tool_id, const wxString& help_string) wxAuiToolBarItem* tool = FindTool(tool_id); if (tool) { - tool->short_help = help_string; + tool->m_shortHelp = help_string; } } @@ -1665,7 +1633,7 @@ wxString wxAuiToolBar::GetToolLongHelp(int tool_id) const if (!tool) return wxEmptyString; - return tool->long_help; + return tool->m_longHelp; } void wxAuiToolBar::SetToolLongHelp(int tool_id, const wxString& help_string) @@ -1673,15 +1641,15 @@ void wxAuiToolBar::SetToolLongHelp(int tool_id, const wxString& help_string) wxAuiToolBarItem* tool = FindTool(tool_id); if (tool) { - tool->long_help = help_string; + tool->m_longHelp = help_string; } } void wxAuiToolBar::SetCustomOverflowItems(const wxAuiToolBarItemArray& prepend, const wxAuiToolBarItemArray& append) { - m_custom_overflow_prepend = prepend; - m_custom_overflow_append = append; + m_customOverflowPrepend = prepend; + m_customOverflowAppend = append; } // get size of hint rectangle for a particular dock location @@ -1696,8 +1664,9 @@ wxSize wxAuiToolBar::GetHintSize(int dock_direction) const case wxAUI_DOCK_LEFT: return m_vertHintSize; default: - wxCHECK_MSG(false, wxDefaultSize, "invalid dock location value"); + wxFAIL_MSG("invalid dock location value"); } + return wxDefaultSize; } bool wxAuiToolBar::IsPaneValid(const wxAuiPaneInfo& pane) const @@ -1760,7 +1729,7 @@ int wxAuiToolBar::GetToolIndex(int tool_id) const for (i = 0; i < count; ++i) { wxAuiToolBarItem& item = m_items.Item(i); - if (item.toolid == tool_id) + if (item.m_toolId == tool_id) return i; } @@ -1772,19 +1741,19 @@ bool wxAuiToolBar::GetToolFitsByIndex(int tool_idx) const if (tool_idx < 0 || tool_idx >= (int)m_items.GetCount()) return false; - if (!m_items[tool_idx].sizer_item) + if (!m_items[tool_idx].m_sizerItem) return false; int cli_w, cli_h; GetClientSize(&cli_w, &cli_h); - wxRect rect = m_items[tool_idx].sizer_item->GetRect(); + wxRect rect = m_items[tool_idx].m_sizerItem->GetRect(); if (m_orientation == wxVERTICAL) { // take the dropdown size into account - if (m_overflow_visible) - cli_h -= m_overflow_sizer_item->GetSize().y; + if (m_overflowVisible) + cli_h -= m_overflowSizerItem->GetSize().y; if (rect.y+rect.height < cli_h) return true; @@ -1792,8 +1761,8 @@ bool wxAuiToolBar::GetToolFitsByIndex(int tool_idx) const else { // take the dropdown size into account - if (m_overflow_visible) - cli_w -= m_overflow_sizer_item->GetSize().x; + if (m_overflowVisible) + cli_w -= m_overflowSizerItem->GetSize().x; if (rect.x+rect.width < cli_w) return true; @@ -1811,9 +1780,9 @@ bool wxAuiToolBar::GetToolFits(int tool_id) const wxRect wxAuiToolBar::GetToolRect(int tool_id) const { wxAuiToolBarItem* tool = FindTool(tool_id); - if (tool && tool->sizer_item) + if (tool && tool->m_sizerItem) { - return tool->sizer_item->GetRect(); + return tool->m_sizerItem->GetRect(); } return wxRect(); @@ -1875,47 +1844,47 @@ bool wxAuiToolBar::RealizeHelper(wxClientDC& dc, bool horizontal) wxBoxSizer* sizer = new wxBoxSizer(horizontal ? wxHORIZONTAL : wxVERTICAL); // add gripper area - int separator_size = m_art->GetElementSize(wxAUI_TBART_SEPARATOR_SIZE); - int gripper_size = m_art->GetElementSize(wxAUI_TBART_GRIPPER_SIZE); - if (gripper_size > 0 && m_gripper_visible) + int separatorSize = m_art->GetElementSize(wxAUI_TBART_SEPARATOR_SIZE); + int gripperSize = m_art->GetElementSize(wxAUI_TBART_GRIPPER_SIZE); + if (gripperSize > 0 && m_gripperVisible) { if (horizontal) - m_gripper_sizer_item = sizer->Add(gripper_size, 1, 0, wxEXPAND); + m_gripperSizerItem = sizer->Add(gripperSize, 1, 0, wxEXPAND); else - m_gripper_sizer_item = sizer->Add(1, gripper_size, 0, wxEXPAND); + m_gripperSizerItem = sizer->Add(1, gripperSize, 0, wxEXPAND); } else { - m_gripper_sizer_item = NULL; + m_gripperSizerItem = NULL; } // add "left" padding - if (m_left_padding > 0) + if (m_leftPadding > 0) { if (horizontal) - sizer->Add(m_left_padding, 1); + sizer->Add(m_leftPadding, 1); else - sizer->Add(1, m_left_padding); + sizer->Add(1, m_leftPadding); } size_t i, count; for (i = 0, count = m_items.GetCount(); i < count; ++i) { wxAuiToolBarItem& item = m_items.Item(i); - wxSizerItem* sizer_item = NULL; + wxSizerItem* m_sizerItem = NULL; - switch (item.kind) + switch (item.m_kind) { case wxITEM_LABEL: { wxSize size = m_art->GetLabelSize(dc, this, item); - sizer_item = sizer->Add(size.x + (m_tool_border_padding*2), - size.y + (m_tool_border_padding*2), - item.proportion, - item.alignment); + m_sizerItem = sizer->Add(size.x + (m_toolBorderPadding*2), + size.y + (m_toolBorderPadding*2), + item.m_proportion, + item.m_alignment); if (i+1 < count) { - sizer->AddSpacer(m_tool_packing); + sizer->AddSpacer(m_toolPacking); } break; @@ -1926,14 +1895,14 @@ bool wxAuiToolBar::RealizeHelper(wxClientDC& dc, bool horizontal) case wxITEM_RADIO: { wxSize size = m_art->GetToolSize(dc, this, item); - sizer_item = sizer->Add(size.x + (m_tool_border_padding*2), - size.y + (m_tool_border_padding*2), + m_sizerItem = sizer->Add(size.x + (m_toolBorderPadding*2), + size.y + (m_toolBorderPadding*2), 0, - item.alignment); + item.m_alignment); // add tool packing if (i+1 < count) { - sizer->AddSpacer(m_tool_packing); + sizer->AddSpacer(m_toolPacking); } break; @@ -1942,37 +1911,37 @@ bool wxAuiToolBar::RealizeHelper(wxClientDC& dc, bool horizontal) case wxITEM_SEPARATOR: { if (horizontal) - sizer_item = sizer->Add(separator_size, 1, 0, wxEXPAND); + m_sizerItem = sizer->Add(separatorSize, 1, 0, wxEXPAND); else - sizer_item = sizer->Add(1, separator_size, 0, wxEXPAND); + m_sizerItem = sizer->Add(1, separatorSize, 0, wxEXPAND); // add tool packing if (i+1 < count) { - sizer->AddSpacer(m_tool_packing); + sizer->AddSpacer(m_toolPacking); } break; } case wxITEM_SPACER: - if (item.proportion > 0) - sizer_item = sizer->AddStretchSpacer(item.proportion); + if (item.m_proportion > 0) + m_sizerItem = sizer->AddStretchSpacer(item.m_proportion); else - sizer_item = sizer->Add(item.spacer_pixels, 1); + m_sizerItem = sizer->Add(item.m_spacerPixels, 1); break; case wxITEM_CONTROL: { - //sizer_item = sizer->Add(item.window, item.proportion, wxEXPAND); - wxSizerItem* ctrl_sizer_item; + //m_sizerItem = sizer->Add(item.m_window, item.m_proportion, wxEXPAND); + wxSizerItem* ctrl_m_sizerItem; wxBoxSizer* vert_sizer = new wxBoxSizer(wxVERTICAL); vert_sizer->AddStretchSpacer(1); - ctrl_sizer_item = vert_sizer->Add(item.window, 0, wxEXPAND); + ctrl_m_sizerItem = vert_sizer->Add(item.m_window, 0, wxEXPAND); vert_sizer->AddStretchSpacer(1); if ( (m_style & wxAUI_TB_TEXT) && - m_tool_text_orientation == wxAUI_TBTOOL_TEXT_BOTTOM && + m_toolTextOrientation == wxAUI_TBTOOL_TEXT_BOTTOM && !item.GetLabel().empty() ) { wxSize s = GetLabelSize(item.GetLabel()); @@ -1980,60 +1949,60 @@ bool wxAuiToolBar::RealizeHelper(wxClientDC& dc, bool horizontal) } - sizer_item = sizer->Add(vert_sizer, item.proportion, wxEXPAND); + m_sizerItem = sizer->Add(vert_sizer, item.m_proportion, wxEXPAND); - wxSize min_size = item.min_size; + wxSize min_size = item.m_minSize; // proportional items will disappear from the toolbar if // their min width is not set to something really small - if (item.proportion != 0) + if (item.m_proportion != 0) { min_size.x = 1; } if (min_size.IsFullySpecified()) { - sizer_item->SetMinSize(min_size); - ctrl_sizer_item->SetMinSize(min_size); + m_sizerItem->SetMinSize(min_size); + ctrl_m_sizerItem->SetMinSize(min_size); } // add tool packing if (i+1 < count) { - sizer->AddSpacer(m_tool_packing); + sizer->AddSpacer(m_toolPacking); } } } - item.sizer_item = sizer_item; + item.m_sizerItem = m_sizerItem; } // add "right" padding - if (m_right_padding > 0) + if (m_rightPadding > 0) { if (horizontal) - sizer->Add(m_right_padding, 1); + sizer->Add(m_rightPadding, 1); else - sizer->Add(1, m_right_padding); + sizer->Add(1, m_rightPadding); } // add drop down area - m_overflow_sizer_item = NULL; + m_overflowSizerItem = NULL; if (m_style & wxAUI_TB_OVERFLOW) { int overflow_size = m_art->GetElementSize(wxAUI_TBART_OVERFLOW_SIZE); - if (overflow_size > 0 && m_overflow_visible) + if (overflow_size > 0 && m_overflowVisible) { if (horizontal) - m_overflow_sizer_item = sizer->Add(overflow_size, 1, 0, wxEXPAND); + m_overflowSizerItem = sizer->Add(overflow_size, 1, 0, wxEXPAND); else - m_overflow_sizer_item = sizer->Add(1, overflow_size, 0, wxEXPAND); + m_overflowSizerItem = sizer->Add(1, overflow_size, 0, wxEXPAND); } else { - m_overflow_sizer_item = NULL; + m_overflowSizerItem = NULL; } } @@ -2042,24 +2011,24 @@ bool wxAuiToolBar::RealizeHelper(wxClientDC& dc, bool horizontal) wxBoxSizer* outside_sizer = new wxBoxSizer(horizontal ? wxVERTICAL : wxHORIZONTAL); // add "top" padding - if (m_top_padding > 0) + if (m_topPadding > 0) { if (horizontal) - outside_sizer->Add(1, m_top_padding); + outside_sizer->Add(1, m_topPadding); else - outside_sizer->Add(m_top_padding, 1); + outside_sizer->Add(m_topPadding, 1); } // add the sizer that contains all of the toolbar elements outside_sizer->Add(sizer, 1, wxEXPAND); // add "bottom" padding - if (m_bottom_padding > 0) + if (m_bottomPadding > 0) { if (horizontal) - outside_sizer->Add(1, m_bottom_padding); + outside_sizer->Add(1, m_bottomPadding); else - outside_sizer->Add(m_bottom_padding, 1); + outside_sizer->Add(m_bottomPadding, 1); } delete m_sizer; // remove old sizer @@ -2069,18 +2038,18 @@ bool wxAuiToolBar::RealizeHelper(wxClientDC& dc, bool horizontal) for (i = 0, count = m_items.GetCount(); i < count; ++i) { wxAuiToolBarItem& item = m_items.Item(i); - if (item.sizer_item && item.proportion > 0 && item.min_size.IsFullySpecified()) - item.sizer_item->SetMinSize(0,0); + if (item.m_sizerItem && item.m_proportion > 0 && item.m_minSize.IsFullySpecified()) + item.m_sizerItem->SetMinSize(0,0); } - m_absolute_min_size = m_sizer->GetMinSize(); + m_absoluteMinSize = m_sizer->GetMinSize(); // reset the min sizes to what they were for (i = 0, count = m_items.GetCount(); i < count; ++i) { wxAuiToolBarItem& item = m_items.Item(i); - if (item.sizer_item && item.proportion > 0 && item.min_size.IsFullySpecified()) - item.sizer_item->SetMinSize(item.min_size); + if (item.m_sizerItem && item.m_proportion > 0 && item.m_minSize.IsFullySpecified()) + item.m_sizerItem->SetMinSize(item.m_minSize); } // set control size @@ -2090,21 +2059,21 @@ bool wxAuiToolBar::RealizeHelper(wxClientDC& dc, bool horizontal) if ((m_style & wxAUI_TB_NO_AUTORESIZE) == 0) { - wxSize cur_size = GetClientSize(); + wxSize curSize = GetClientSize(); wxSize new_size = GetMinSize(); - if (new_size != cur_size) + if (new_size != curSize) { SetClientSize(new_size); } else { - m_sizer->SetDimension(0, 0, cur_size.x, cur_size.y); + m_sizer->SetDimension(0, 0, curSize.x, curSize.y); } } else { - wxSize cur_size = GetClientSize(); - m_sizer->SetDimension(0, 0, cur_size.x, cur_size.y); + wxSize curSize = GetClientSize(); + m_sizer->SetDimension(0, 0, curSize.x, curSize.y); } return true; @@ -2112,13 +2081,13 @@ bool wxAuiToolBar::RealizeHelper(wxClientDC& dc, bool horizontal) int wxAuiToolBar::GetOverflowState() const { - return m_overflow_state; + return m_overflowState; } wxRect wxAuiToolBar::GetOverflowRect() const { wxRect cli_rect(wxPoint(0,0), GetClientSize()); - wxRect overflow_rect = m_overflow_sizer_item->GetRect(); + wxRect overflow_rect = m_overflowSizerItem->GetRect(); int overflow_size = m_art->GetElementSize(wxAUI_TBART_OVERFLOW_SIZE); if (m_orientation == wxVERTICAL) @@ -2144,17 +2113,17 @@ wxSize wxAuiToolBar::GetLabelSize(const wxString& label) wxClientDC dc(this); int tx, ty; - int text_width = 0, text_height = 0; + int textWidth = 0, textHeight = 0; dc.SetFont(m_font); // get the text height - dc.GetTextExtent(wxT("ABCDHgj"), &tx, &text_height); + dc.GetTextExtent(wxT("ABCDHgj"), &tx, &textHeight); // get the text width - dc.GetTextExtent(label, &text_width, &ty); + dc.GetTextExtent(label, &textWidth, &ty); - return wxSize(text_width, text_height); + return wxSize(textWidth, textHeight); } @@ -2169,10 +2138,10 @@ void wxAuiToolBar::DoIdleUpdate() { wxAuiToolBarItem& item = m_items.Item(i); - if (item.toolid == -1) + if (item.m_toolId == -1) continue; - wxUpdateUIEvent evt(item.toolid); + wxUpdateUIEvent evt(item.m_toolId); evt.SetEventObject(this); if (handler->ProcessEvent(evt)) @@ -2180,24 +2149,24 @@ void wxAuiToolBar::DoIdleUpdate() if (evt.GetSetEnabled()) { bool is_enabled; - if (item.window) - is_enabled = item.window->IsEnabled(); + if (item.m_window) + is_enabled = item.m_window->IsThisEnabled(); else - is_enabled = (item.state & wxAUI_BUTTON_STATE_DISABLED) ? false : true; + is_enabled = (item.m_state & wxAUI_BUTTON_STATE_DISABLED) ? false : true; bool new_enabled = evt.GetEnabled(); if (new_enabled != is_enabled) { - if (item.window) + if (item.m_window) { - item.window->Enable(new_enabled); + item.m_window->Enable(new_enabled); } else { if (new_enabled) - item.state &= ~wxAUI_BUTTON_STATE_DISABLED; + item.m_state &= ~wxAUI_BUTTON_STATE_DISABLED; else - item.state |= wxAUI_BUTTON_STATE_DISABLED; + item.m_state |= wxAUI_BUTTON_STATE_DISABLED; } need_refresh = true; } @@ -2206,18 +2175,18 @@ void wxAuiToolBar::DoIdleUpdate() if (evt.GetSetChecked()) { // make sure we aren't checking an item that can't be - if (item.kind != wxITEM_CHECK && item.kind != wxITEM_RADIO) + if (item.m_kind != wxITEM_CHECK && item.m_kind != wxITEM_RADIO) continue; - bool is_checked = (item.state & wxAUI_BUTTON_STATE_CHECKED) ? true : false; + bool is_checked = (item.m_state & wxAUI_BUTTON_STATE_CHECKED) ? true : false; bool new_checked = evt.GetChecked(); if (new_checked != is_checked) { if (new_checked) - item.state |= wxAUI_BUTTON_STATE_CHECKED; + item.m_state |= wxAUI_BUTTON_STATE_CHECKED; else - item.state &= ~wxAUI_BUTTON_STATE_CHECKED; + item.m_state &= ~wxAUI_BUTTON_STATE_CHECKED; need_refresh = true; } @@ -2239,18 +2208,18 @@ void wxAuiToolBar::OnSize(wxSizeEvent& WXUNUSED(evt)) int x, y; GetClientSize(&x, &y); - if (((x >= y) && m_absolute_min_size.x > x) || - ((y > x) && m_absolute_min_size.y > y)) + if (((x >= y) && m_absoluteMinSize.x > x) || + ((y > x) && m_absoluteMinSize.y > y)) { // hide all flexible items size_t i, count; for (i = 0, count = m_items.GetCount(); i < count; ++i) { wxAuiToolBarItem& item = m_items.Item(i); - if (item.sizer_item && item.proportion > 0 && item.sizer_item->IsShown()) + if (item.m_sizerItem && item.m_proportion > 0 && item.m_sizerItem->IsShown()) { - item.sizer_item->Show(false); - item.sizer_item->SetProportion(0); + item.m_sizerItem->Show(false); + item.m_sizerItem->SetProportion(0); } } } @@ -2261,10 +2230,10 @@ void wxAuiToolBar::OnSize(wxSizeEvent& WXUNUSED(evt)) for (i = 0, count = m_items.GetCount(); i < count; ++i) { wxAuiToolBarItem& item = m_items.Item(i); - if (item.sizer_item && item.proportion > 0 && !item.sizer_item->IsShown()) + if (item.m_sizerItem && item.m_proportion > 0 && !item.m_sizerItem->IsShown()) { - item.sizer_item->Show(true); - item.sizer_item->SetProportion(item.proportion); + item.m_sizerItem->Show(true); + item.m_sizerItem->SetProportion(item.m_proportion); } } } @@ -2369,11 +2338,19 @@ void wxAuiToolBar::OnIdle(wxIdleEvent& evt) } } } - - DoIdleUpdate(); evt.Skip(); } +void wxAuiToolBar::UpdateWindowUI(long flags) +{ + if ( flags & wxUPDATE_UI_FROMIDLE ) + { + DoIdleUpdate(); + } + + wxControl::UpdateWindowUI(flags); +} + void wxAuiToolBar::OnPaint(wxPaintEvent& WXUNUSED(evt)) { wxAutoBufferedPaintDC dc(this); @@ -2385,17 +2362,17 @@ void wxAuiToolBar::OnPaint(wxPaintEvent& WXUNUSED(evt)) m_art->DrawBackground(dc, this, cli_rect); - int gripper_size = m_art->GetElementSize(wxAUI_TBART_GRIPPER_SIZE); + int gripperSize = m_art->GetElementSize(wxAUI_TBART_GRIPPER_SIZE); int dropdown_size = m_art->GetElementSize(wxAUI_TBART_OVERFLOW_SIZE); // paint the gripper - if (gripper_size > 0 && m_gripper_sizer_item) + if (gripperSize > 0 && m_gripperSizerItem) { - wxRect gripper_rect = m_gripper_sizer_item->GetRect(); + wxRect gripper_rect = m_gripperSizerItem->GetRect(); if (horizontal) - gripper_rect.width = gripper_size; + gripper_rect.width = gripperSize; else - gripper_rect.height = gripper_size; + gripper_rect.height = gripperSize; m_art->DrawGripper(dc, this, gripper_rect); } @@ -2405,7 +2382,7 @@ void wxAuiToolBar::OnPaint(wxPaintEvent& WXUNUSED(evt)) last_extent = cli_rect.width; else last_extent = cli_rect.height; - if (m_overflow_visible) + if (m_overflowVisible) last_extent -= dropdown_size; // paint each individual tool @@ -2414,10 +2391,10 @@ void wxAuiToolBar::OnPaint(wxPaintEvent& WXUNUSED(evt)) { wxAuiToolBarItem& item = m_items.Item(i); - if (!item.sizer_item) + if (!item.m_sizerItem) continue; - wxRect item_rect = item.sizer_item->GetRect(); + wxRect item_rect = item.m_sizerItem->GetRect(); if ((horizontal && item_rect.x + item_rect.width >= last_extent) || @@ -2426,35 +2403,38 @@ void wxAuiToolBar::OnPaint(wxPaintEvent& WXUNUSED(evt)) break; } - if (item.kind == wxITEM_SEPARATOR) + if (item.m_kind == wxITEM_SEPARATOR) { // draw a separator m_art->DrawSeparator(dc, this, item_rect); } - else if (item.kind == wxITEM_LABEL) + else if (item.m_kind == wxITEM_LABEL) { // draw a text label only m_art->DrawLabel(dc, this, item, item_rect); } - else if (item.kind == wxITEM_NORMAL) + else if (item.m_kind == wxITEM_NORMAL) { // draw a regular button or dropdown button - if (!item.dropdown) + if (!item.m_dropDown) m_art->DrawButton(dc, this, item, item_rect); else m_art->DrawDropDownButton(dc, this, item, item_rect); } - else if (item.kind == wxITEM_CHECK) + else if (item.m_kind == wxITEM_CHECK) + { + // draw either a regular or dropdown toggle button + if (!item.m_dropDown) + m_art->DrawButton(dc, this, item, item_rect); + else + m_art->DrawDropDownButton(dc, this, item, item_rect); + } + else if (item.m_kind == wxITEM_RADIO) { // draw a toggle button m_art->DrawButton(dc, this, item, item_rect); } - else if (item.kind == wxITEM_RADIO) - { - // draw a toggle button - m_art->DrawButton(dc, this, item, item_rect); - } - else if (item.kind == wxITEM_CONTROL) + else if (item.m_kind == wxITEM_CONTROL) { // draw the control's label m_art->DrawControlLabel(dc, this, item, item_rect); @@ -2465,10 +2445,10 @@ void wxAuiToolBar::OnPaint(wxPaintEvent& WXUNUSED(evt)) } // paint the overflow button - if (dropdown_size > 0 && m_overflow_sizer_item) + if (dropdown_size > 0 && m_overflowSizerItem) { - wxRect dropdown_rect = GetOverflowRect(); - m_art->DrawOverflowButton(dc, this, dropdown_rect, m_overflow_state); + wxRect dropDownRect = GetOverflowRect(); + m_art->DrawOverflowButton(dc, this, dropDownRect, m_overflowState); } } @@ -2481,9 +2461,9 @@ void wxAuiToolBar::OnLeftDown(wxMouseEvent& evt) { wxRect cli_rect(wxPoint(0,0), GetClientSize()); - if (m_gripper_sizer_item) + if (m_gripperSizerItem) { - wxRect gripper_rect = m_gripper_sizer_item->GetRect(); + wxRect gripper_rect = m_gripperSizerItem->GetRect(); if (gripper_rect.Contains(evt.GetX(), evt.GetY())) { // find aui manager @@ -2500,12 +2480,12 @@ void wxAuiToolBar::OnLeftDown(wxMouseEvent& evt) } } - if (m_overflow_sizer_item) + if (m_overflowSizerItem) { wxRect overflow_rect = GetOverflowRect(); if (m_art && - m_overflow_visible && + m_overflowVisible && overflow_rect.Contains(evt.m_x, evt.m_y)) { wxAuiToolBarEvent e(wxEVT_COMMAND_AUITOOLBAR_OVERFLOW_CLICK, -1); @@ -2525,9 +2505,9 @@ void wxAuiToolBar::OnLeftDown(wxMouseEvent& evt) // add custom overflow prepend items, if any - count = m_custom_overflow_prepend.GetCount(); + count = m_customOverflowPrepend.GetCount(); for (i = 0; i < count; ++i) - overflow_items.Add(m_custom_overflow_prepend[i]); + overflow_items.Add(m_customOverflowPrepend[i]); // only show items that don't fit in the dropdown count = m_items.GetCount(); @@ -2538,12 +2518,12 @@ void wxAuiToolBar::OnLeftDown(wxMouseEvent& evt) } // add custom overflow append items, if any - count = m_custom_overflow_append.GetCount(); + count = m_customOverflowAppend.GetCount(); for (i = 0; i < count; ++i) - overflow_items.Add(m_custom_overflow_append[i]); + overflow_items.Add(m_customOverflowAppend[i]); int res = m_art->ShowDropDown(this, overflow_items); - m_overflow_state = 0; + m_overflowState = 0; Refresh(false); if (res != -1) { @@ -2558,28 +2538,28 @@ void wxAuiToolBar::OnLeftDown(wxMouseEvent& evt) } m_dragging = false; - m_action_pos = wxPoint(evt.GetX(), evt.GetY()); - m_action_item = FindToolByPosition(evt.GetX(), evt.GetY()); + m_actionPos = wxPoint(evt.GetX(), evt.GetY()); + m_actionItem = FindToolByPosition(evt.GetX(), evt.GetY()); - if (m_action_item) + if (m_actionItem) { - if (m_action_item->state & wxAUI_BUTTON_STATE_DISABLED) + if (m_actionItem->m_state & wxAUI_BUTTON_STATE_DISABLED) { - m_action_pos = wxPoint(-1,-1); - m_action_item = NULL; + m_actionPos = wxPoint(-1,-1); + m_actionItem = NULL; return; } UnsetToolTip(); // fire the tool dropdown event - wxAuiToolBarEvent e(wxEVT_COMMAND_AUITOOLBAR_TOOL_DROPDOWN, m_action_item->toolid); + wxAuiToolBarEvent e(wxEVT_COMMAND_AUITOOLBAR_TOOL_DROPDOWN, m_actionItem->m_toolId); e.SetEventObject(this); - e.SetToolId(m_action_item->toolid); + e.SetToolId(m_actionItem->m_toolId); int mouse_x = evt.GetX(); - wxRect rect = m_action_item->sizer_item->GetRect(); - const bool dropDownHit = m_action_item->dropdown && + wxRect rect = m_actionItem->m_sizerItem->GetRect(); + const bool dropDownHit = m_actionItem->m_dropDown && mouse_x >= (rect.x+rect.width-BUTTON_DROPDOWN_WIDTH-1) && mouse_x < (rect.x+rect.width); e.SetDropDownClicked(dropDownHit); @@ -2589,12 +2569,12 @@ void wxAuiToolBar::OnLeftDown(wxMouseEvent& evt) // we only set the 'pressed button' state if we hit the actual button // and not just the drop-down - SetPressedItem(dropDownHit ? 0 : m_action_item); + SetPressedItem(dropDownHit ? 0 : m_actionItem); if(dropDownHit) { - m_action_pos = wxPoint(-1,-1); - m_action_item = NULL; + m_actionPos = wxPoint(-1,-1); + m_actionItem = NULL; } if(!GetEventHandler()->ProcessEvent(e) || e.GetSkipped()) @@ -2611,10 +2591,10 @@ void wxAuiToolBar::OnLeftUp(wxMouseEvent& evt) SetPressedItem(NULL); - wxAuiToolBarItem* hit_item = FindToolByPosition(evt.GetX(), evt.GetY()); - if (hit_item && !(hit_item->state & wxAUI_BUTTON_STATE_DISABLED)) + wxAuiToolBarItem* hitItem = FindToolByPosition(evt.GetX(), evt.GetY()); + if (hitItem && !(hitItem->m_state & wxAUI_BUTTON_STATE_DISABLED)) { - SetHoverItem(hit_item); + SetHoverItem(hitItem); } if (m_dragging) @@ -2629,21 +2609,18 @@ void wxAuiToolBar::OnLeftUp(wxMouseEvent& evt) } else { - wxAuiToolBarItem* hit_item; - hit_item = FindToolByPosition(evt.GetX(), evt.GetY()); - - if (m_action_item && hit_item == m_action_item) + if (m_actionItem && hitItem == m_actionItem) { UnsetToolTip(); - wxCommandEvent e(wxEVT_COMMAND_MENU_SELECTED, m_action_item->toolid); + wxCommandEvent e(wxEVT_COMMAND_MENU_SELECTED, m_actionItem->m_toolId); e.SetEventObject(this); - if (hit_item->kind == wxITEM_CHECK || hit_item->kind == wxITEM_RADIO) + if (hitItem->m_kind == wxITEM_CHECK || hitItem->m_kind == wxITEM_RADIO) { - const bool toggle = !(m_action_item->state & wxAUI_BUTTON_STATE_CHECKED); + const bool toggle = !(m_actionItem->m_state & wxAUI_BUTTON_STATE_CHECKED); - ToggleTool(m_action_item->toolid, toggle); + ToggleTool(m_actionItem->m_toolId, toggle); // repaint immediately Refresh(false); @@ -2670,33 +2647,32 @@ void wxAuiToolBar::OnRightDown(wxMouseEvent& evt) { wxRect cli_rect(wxPoint(0,0), GetClientSize()); - if (m_gripper_sizer_item) + if (m_gripperSizerItem) { - wxRect gripper_rect = m_gripper_sizer_item->GetRect(); + wxRect gripper_rect = m_gripperSizerItem->GetRect(); if (gripper_rect.Contains(evt.GetX(), evt.GetY())) return; } - if (m_overflow_sizer_item) + if (m_overflowSizerItem && m_art) { int dropdown_size = m_art->GetElementSize(wxAUI_TBART_OVERFLOW_SIZE); if (dropdown_size > 0 && evt.m_x > cli_rect.width - dropdown_size && evt.m_y >= 0 && - evt.m_y < cli_rect.height && - m_art) + evt.m_y < cli_rect.height) { return; } } - m_action_pos = wxPoint(evt.GetX(), evt.GetY()); - m_action_item = FindToolByPosition(evt.GetX(), evt.GetY()); + m_actionPos = wxPoint(evt.GetX(), evt.GetY()); + m_actionItem = FindToolByPosition(evt.GetX(), evt.GetY()); - if (m_action_item && m_action_item->state & wxAUI_BUTTON_STATE_DISABLED) + if (m_actionItem && m_actionItem->m_state & wxAUI_BUTTON_STATE_DISABLED) { - m_action_pos = wxPoint(-1,-1); - m_action_item = NULL; + m_actionPos = wxPoint(-1,-1); + m_actionItem = NULL; return; } @@ -2705,20 +2681,17 @@ void wxAuiToolBar::OnRightDown(wxMouseEvent& evt) void wxAuiToolBar::OnRightUp(wxMouseEvent& evt) { - wxAuiToolBarItem* hit_item; - hit_item = FindToolByPosition(evt.GetX(), evt.GetY()); + wxAuiToolBarItem* hitItem; + hitItem = FindToolByPosition(evt.GetX(), evt.GetY()); - if (m_action_item && hit_item == m_action_item) + if (m_actionItem && hitItem == m_actionItem) { - if (hit_item->kind == wxITEM_NORMAL) - { - wxAuiToolBarEvent e(wxEVT_COMMAND_AUITOOLBAR_RIGHT_CLICK, m_action_item->toolid); - e.SetEventObject(this); - e.SetToolId(m_action_item->toolid); - e.SetClickPoint(m_action_pos); - GetEventHandler()->ProcessEvent(e); - DoIdleUpdate(); - } + wxAuiToolBarEvent e(wxEVT_COMMAND_AUITOOLBAR_RIGHT_CLICK, m_actionItem->m_toolId); + e.SetEventObject(this); + e.SetToolId(m_actionItem->m_toolId); + e.SetClickPoint(m_actionPos); + GetEventHandler()->ProcessEvent(e); + DoIdleUpdate(); } else { @@ -2726,49 +2699,48 @@ void wxAuiToolBar::OnRightUp(wxMouseEvent& evt) wxAuiToolBarEvent e(wxEVT_COMMAND_AUITOOLBAR_RIGHT_CLICK, -1); e.SetEventObject(this); e.SetToolId(-1); - e.SetClickPoint(m_action_pos); + e.SetClickPoint(m_actionPos); GetEventHandler()->ProcessEvent(e); DoIdleUpdate(); } // reset member variables - m_action_pos = wxPoint(-1,-1); - m_action_item = NULL; + m_actionPos = wxPoint(-1,-1); + m_actionItem = NULL; } void wxAuiToolBar::OnMiddleDown(wxMouseEvent& evt) { wxRect cli_rect(wxPoint(0,0), GetClientSize()); - if (m_gripper_sizer_item) + if (m_gripperSizerItem) { - wxRect gripper_rect = m_gripper_sizer_item->GetRect(); + wxRect gripper_rect = m_gripperSizerItem->GetRect(); if (gripper_rect.Contains(evt.GetX(), evt.GetY())) return; } - if (m_overflow_sizer_item) + if (m_overflowSizerItem && m_art) { int dropdown_size = m_art->GetElementSize(wxAUI_TBART_OVERFLOW_SIZE); if (dropdown_size > 0 && evt.m_x > cli_rect.width - dropdown_size && evt.m_y >= 0 && - evt.m_y < cli_rect.height && - m_art) + evt.m_y < cli_rect.height) { return; } } - m_action_pos = wxPoint(evt.GetX(), evt.GetY()); - m_action_item = FindToolByPosition(evt.GetX(), evt.GetY()); + m_actionPos = wxPoint(evt.GetX(), evt.GetY()); + m_actionItem = FindToolByPosition(evt.GetX(), evt.GetY()); - if (m_action_item) + if (m_actionItem) { - if (m_action_item->state & wxAUI_BUTTON_STATE_DISABLED) + if (m_actionItem->m_state & wxAUI_BUTTON_STATE_DISABLED) { - m_action_pos = wxPoint(-1,-1); - m_action_item = NULL; + m_actionPos = wxPoint(-1,-1); + m_actionItem = NULL; return; } } @@ -2778,25 +2750,25 @@ void wxAuiToolBar::OnMiddleDown(wxMouseEvent& evt) void wxAuiToolBar::OnMiddleUp(wxMouseEvent& evt) { - wxAuiToolBarItem* hit_item; - hit_item = FindToolByPosition(evt.GetX(), evt.GetY()); + wxAuiToolBarItem* hitItem; + hitItem = FindToolByPosition(evt.GetX(), evt.GetY()); - if (m_action_item && hit_item == m_action_item) + if (m_actionItem && hitItem == m_actionItem) { - if (hit_item->kind == wxITEM_NORMAL) + if (hitItem->m_kind == wxITEM_NORMAL) { - wxAuiToolBarEvent e(wxEVT_COMMAND_AUITOOLBAR_MIDDLE_CLICK, m_action_item->toolid); + wxAuiToolBarEvent e(wxEVT_COMMAND_AUITOOLBAR_MIDDLE_CLICK, m_actionItem->m_toolId); e.SetEventObject(this); - e.SetToolId(m_action_item->toolid); - e.SetClickPoint(m_action_pos); + e.SetToolId(m_actionItem->m_toolId); + e.SetClickPoint(m_actionPos); GetEventHandler()->ProcessEvent(e); DoIdleUpdate(); } } // reset member variables - m_action_pos = wxPoint(-1,-1); - m_action_item = NULL; + m_actionPos = wxPoint(-1,-1); + m_actionItem = NULL; } void wxAuiToolBar::OnMotion(wxMouseEvent& evt) @@ -2805,13 +2777,13 @@ void wxAuiToolBar::OnMotion(wxMouseEvent& evt) // start a drag event if (!m_dragging && button_pressed && - abs(evt.GetX() - m_action_pos.x) + abs(evt.GetY() - m_action_pos.y) > 5) + abs(evt.GetX() - m_actionPos.x) + abs(evt.GetY() - m_actionPos.y) > 5) { // TODO: sending this event only makes sense if there is an 'END_DRAG' // event sent sometime in the future (see OnLeftUp()) wxAuiToolBarEvent e(wxEVT_COMMAND_AUITOOLBAR_BEGIN_DRAG, GetId()); e.SetEventObject(this); - e.SetToolId(m_action_item->toolid); + e.SetToolId(m_actionItem->m_toolId); m_dragging = GetEventHandler()->ProcessEvent(e) && !e.GetSkipped(); DoIdleUpdate(); @@ -2820,38 +2792,38 @@ void wxAuiToolBar::OnMotion(wxMouseEvent& evt) if(m_dragging) return; - wxAuiToolBarItem* hit_item = FindToolByPosition(evt.GetX(), evt.GetY()); + wxAuiToolBarItem* hitItem = FindToolByPosition(evt.GetX(), evt.GetY()); if(button_pressed) { // if we have a button pressed we want it to be shown in 'depressed' // state unless we move the mouse outside the button, then we want it // to show as just 'highlighted' - if (hit_item == m_action_item) - SetPressedItem(m_action_item); + if (hitItem == m_actionItem) + SetPressedItem(m_actionItem); else { SetPressedItem(NULL); - SetHoverItem(m_action_item); + SetHoverItem(m_actionItem); } } else { - if (hit_item && (hit_item->state & wxAUI_BUTTON_STATE_DISABLED)) + if (hitItem && (hitItem->m_state & wxAUI_BUTTON_STATE_DISABLED)) SetHoverItem(NULL); else - SetHoverItem(hit_item); + SetHoverItem(hitItem); // tooltips handling - wxAuiToolBarItem* packing_hit_item; - packing_hit_item = FindToolByPositionWithPacking(evt.GetX(), evt.GetY()); - if (packing_hit_item) + wxAuiToolBarItem* packingHitItem; + packingHitItem = FindToolByPositionWithPacking(evt.GetX(), evt.GetY()); + if (packingHitItem) { - if (packing_hit_item != m_tip_item) + if (packingHitItem != m_tipItem) { - m_tip_item = packing_hit_item; + m_tipItem = packingHitItem; - if ( !packing_hit_item->short_help.empty() ) - SetToolTip(packing_hit_item->short_help); + if ( !packingHitItem->m_shortHelp.empty() ) + SetToolTip(packingHitItem->m_shortHelp); else UnsetToolTip(); } @@ -2859,7 +2831,7 @@ void wxAuiToolBar::OnMotion(wxMouseEvent& evt) else { UnsetToolTip(); - m_tip_item = NULL; + m_tipItem = NULL; } // figure out the dropdown button state (are we hovering or pressing it?) @@ -2873,13 +2845,13 @@ void wxAuiToolBar::DoResetMouseState() SetHoverItem(NULL); SetPressedItem(NULL); - m_tip_item = NULL; + m_tipItem = NULL; // we have to reset those here, because the mouse-up handlers which do // it usually won't be called if we let go of a mouse button while we // are outside of the window - m_action_pos = wxPoint(-1,-1); - m_action_item = NULL; + m_actionPos = wxPoint(-1,-1); + m_actionItem = NULL; } void wxAuiToolBar::OnLeaveWindow(wxMouseEvent& evt) @@ -2904,9 +2876,9 @@ void wxAuiToolBar::OnSetCursor(wxSetCursorEvent& evt) { wxCursor cursor = wxNullCursor; - if (m_gripper_sizer_item) + if (m_gripperSizerItem) { - wxRect gripper_rect = m_gripper_sizer_item->GetRect(); + wxRect gripper_rect = m_gripperSizerItem->GetRect(); if (gripper_rect.Contains(evt.GetX(), evt.GetY())) { cursor = wxCursor(wxCURSOR_SIZING); diff --git a/Externals/wxWidgets3/src/aui/auibook.cpp b/Externals/wxWidgets3/src/aui/auibook.cpp index 5e6ef680ed..f299944023 100644 --- a/Externals/wxWidgets3/src/aui/auibook.cpp +++ b/Externals/wxWidgets3/src/aui/auibook.cpp @@ -48,6 +48,7 @@ wxDEFINE_EVENT(wxEVT_COMMAND_AUINOTEBOOK_PAGE_CHANGED, wxAuiNotebookEvent); wxDEFINE_EVENT(wxEVT_COMMAND_AUINOTEBOOK_BUTTON, wxAuiNotebookEvent); wxDEFINE_EVENT(wxEVT_COMMAND_AUINOTEBOOK_BEGIN_DRAG, wxAuiNotebookEvent); wxDEFINE_EVENT(wxEVT_COMMAND_AUINOTEBOOK_END_DRAG, wxAuiNotebookEvent); +wxDEFINE_EVENT(wxEVT_COMMAND_AUINOTEBOOK_CANCEL_DRAG, wxAuiNotebookEvent); wxDEFINE_EVENT(wxEVT_COMMAND_AUINOTEBOOK_DRAG_MOTION, wxAuiNotebookEvent); wxDEFINE_EVENT(wxEVT_COMMAND_AUINOTEBOOK_ALLOW_DND, wxAuiNotebookEvent); wxDEFINE_EVENT(wxEVT_COMMAND_AUINOTEBOOK_BG_DCLICK, wxAuiNotebookEvent); @@ -59,7 +60,7 @@ wxDEFINE_EVENT(wxEVT_COMMAND_AUINOTEBOOK_TAB_RIGHT_DOWN, wxAuiNotebookEvent); IMPLEMENT_CLASS(wxAuiNotebook, wxControl) IMPLEMENT_CLASS(wxAuiTabCtrl, wxControl) -IMPLEMENT_DYNAMIC_CLASS(wxAuiNotebookEvent, wxEvent) +IMPLEMENT_DYNAMIC_CLASS(wxAuiNotebookEvent, wxBookCtrlEvent) @@ -118,14 +119,14 @@ class wxAuiCommandCapture : public wxEvtHandler { public: - wxAuiCommandCapture() { m_last_id = 0; } - int GetCommandId() const { return m_last_id; } + wxAuiCommandCapture() { m_lastId = 0; } + int GetCommandId() const { return m_lastId; } bool ProcessEvent(wxEvent& evt) { if (evt.GetEventType() == wxEVT_COMMAND_MENU_SELECTED) { - m_last_id = evt.GetId(); + m_lastId = evt.GetId(); return true; } @@ -136,7 +137,7 @@ public: } private: - int m_last_id; + int m_lastId; }; @@ -183,47 +184,48 @@ static const unsigned char list_bits[] = { wxAuiDefaultTabArt::wxAuiDefaultTabArt() { - m_normal_font = *wxNORMAL_FONT; - m_selected_font = *wxNORMAL_FONT; - m_selected_font.SetWeight(wxBOLD); - m_measuring_font = m_selected_font; + m_normalFont = *wxNORMAL_FONT; + m_selectedFont = *wxNORMAL_FONT; + m_selectedFont.SetWeight(wxBOLD); + m_measuringFont = m_selectedFont; - m_fixed_tab_width = 100; - m_tab_ctrl_height = 0; + m_fixedTabWidth = 100; + m_tabCtrlHeight = 0; #if defined( __WXMAC__ ) && wxOSX_USE_COCOA_OR_CARBON - wxColor base_colour = wxColour( wxMacCreateCGColorFromHITheme(kThemeBrushToolbarBackground)); + wxColor baseColour = wxColour( wxMacCreateCGColorFromHITheme(kThemeBrushToolbarBackground)); #else - wxColor base_colour = wxSystemSettings::GetColour(wxSYS_COLOUR_3DFACE); + wxColor baseColour = wxSystemSettings::GetColour(wxSYS_COLOUR_3DFACE); #endif - // the base_colour is too pale to use as our base colour, + // the baseColour is too pale to use as our base colour, // so darken it a bit -- - if ((255-base_colour.Red()) + - (255-base_colour.Green()) + - (255-base_colour.Blue()) < 60) + if ((255-baseColour.Red()) + + (255-baseColour.Green()) + + (255-baseColour.Blue()) < 60) { - base_colour = base_colour.ChangeLightness(92); + baseColour = baseColour.ChangeLightness(92); } - m_base_colour = base_colour; - wxColor border_colour = base_colour.ChangeLightness(75); + m_activeColour = baseColour; + m_baseColour = baseColour; + wxColor borderColour = baseColour.ChangeLightness(75); - m_border_pen = wxPen(border_colour); - m_base_colour_pen = wxPen(m_base_colour); - m_base_colour_brush = wxBrush(m_base_colour); + m_borderPen = wxPen(borderColour); + m_baseColourPen = wxPen(m_baseColour); + m_baseColourBrush = wxBrush(m_baseColour); - m_active_close_bmp = wxAuiBitmapFromBits(close_bits, 16, 16, *wxBLACK); - m_disabled_close_bmp = wxAuiBitmapFromBits(close_bits, 16, 16, wxColour(128,128,128)); + m_activeCloseBmp = wxAuiBitmapFromBits(close_bits, 16, 16, *wxBLACK); + m_disabledCloseBmp = wxAuiBitmapFromBits(close_bits, 16, 16, wxColour(128,128,128)); - m_active_left_bmp = wxAuiBitmapFromBits(left_bits, 16, 16, *wxBLACK); - m_disabled_left_bmp = wxAuiBitmapFromBits(left_bits, 16, 16, wxColour(128,128,128)); + m_activeLeftBmp = wxAuiBitmapFromBits(left_bits, 16, 16, *wxBLACK); + m_disabledLeftBmp = wxAuiBitmapFromBits(left_bits, 16, 16, wxColour(128,128,128)); - m_active_right_bmp = wxAuiBitmapFromBits(right_bits, 16, 16, *wxBLACK); - m_disabled_right_bmp = wxAuiBitmapFromBits(right_bits, 16, 16, wxColour(128,128,128)); + m_activeRightBmp = wxAuiBitmapFromBits(right_bits, 16, 16, *wxBLACK); + m_disabledRightBmp = wxAuiBitmapFromBits(right_bits, 16, 16, wxColour(128,128,128)); - m_active_windowlist_bmp = wxAuiBitmapFromBits(list_bits, 16, 16, *wxBLACK); - m_disabled_windowlist_bmp = wxAuiBitmapFromBits(list_bits, 16, 16, wxColour(128,128,128)); + m_activeWindowListBmp = wxAuiBitmapFromBits(list_bits, 16, 16, *wxBLACK); + m_disabledWindowListBmp = wxAuiBitmapFromBits(list_bits, 16, 16, wxColour(128,128,128)); m_flags = 0; } @@ -245,31 +247,31 @@ void wxAuiDefaultTabArt::SetFlags(unsigned int flags) void wxAuiDefaultTabArt::SetSizingInfo(const wxSize& tab_ctrl_size, size_t tab_count) { - m_fixed_tab_width = 100; + m_fixedTabWidth = 100; int tot_width = (int)tab_ctrl_size.x - GetIndentSize() - 4; if (m_flags & wxAUI_NB_CLOSE_BUTTON) - tot_width -= m_active_close_bmp.GetWidth(); + tot_width -= m_activeCloseBmp.GetWidth(); if (m_flags & wxAUI_NB_WINDOWLIST_BUTTON) - tot_width -= m_active_windowlist_bmp.GetWidth(); + tot_width -= m_activeWindowListBmp.GetWidth(); if (tab_count > 0) { - m_fixed_tab_width = tot_width/(int)tab_count; + m_fixedTabWidth = tot_width/(int)tab_count; } - if (m_fixed_tab_width < 100) - m_fixed_tab_width = 100; + if (m_fixedTabWidth < 100) + m_fixedTabWidth = 100; - if (m_fixed_tab_width > tot_width/2) - m_fixed_tab_width = tot_width/2; + if (m_fixedTabWidth > tot_width/2) + m_fixedTabWidth = tot_width/2; - if (m_fixed_tab_width > 220) - m_fixed_tab_width = 220; + if (m_fixedTabWidth > 220) + m_fixedTabWidth = 220; - m_tab_ctrl_height = tab_ctrl_size.y; + m_tabCtrlHeight = tab_ctrl_size.y; } @@ -279,8 +281,8 @@ void wxAuiDefaultTabArt::DrawBackground(wxDC& dc, { // draw background - wxColor top_color = m_base_colour.ChangeLightness(90); - wxColor bottom_color = m_base_colour.ChangeLightness(170); + wxColor top_color = m_baseColour.ChangeLightness(90); + wxColor bottom_color = m_baseColour.ChangeLightness(170); wxRect r; if (m_flags &wxAUI_NB_BOTTOM) @@ -295,7 +297,7 @@ void wxAuiDefaultTabArt::DrawBackground(wxDC& dc, // draw base lines - dc.SetPen(m_border_pen); + dc.SetPen(m_borderPen); int y = rect.GetHeight(); int w = rect.GetWidth(); @@ -308,7 +310,7 @@ void wxAuiDefaultTabArt::DrawBackground(wxDC& dc, // TODO: else if (m_flags &wxAUI_NB_RIGHT) {} else //for wxAUI_NB_TOP { - dc.SetBrush(m_base_colour_brush); + dc.SetBrush(m_baseColourBrush); dc.DrawRectangle(-1, y-4, w+2, 4); } } @@ -341,10 +343,10 @@ void wxAuiDefaultTabArt::DrawTab(wxDC& dc, if (caption.empty()) caption = wxT("Xj"); - dc.SetFont(m_selected_font); + dc.SetFont(m_selectedFont); dc.GetTextExtent(caption, &selected_textx, &selected_texty); - dc.SetFont(m_normal_font); + dc.SetFont(m_normalFont); dc.GetTextExtent(caption, &normal_textx, &normal_texty); // figure out the size of the tab @@ -356,7 +358,7 @@ void wxAuiDefaultTabArt::DrawTab(wxDC& dc, close_button_state, x_extent); - wxCoord tab_height = m_tab_ctrl_height - 3; + wxCoord tab_height = m_tabCtrlHeight - 3; wxCoord tab_width = tab_size.x; wxCoord tab_x = in_rect.x; wxCoord tab_y = in_rect.y + in_rect.height - tab_height; @@ -369,12 +371,12 @@ void wxAuiDefaultTabArt::DrawTab(wxDC& dc, if (page.active) { - dc.SetFont(m_selected_font); + dc.SetFont(m_selectedFont); texty = selected_texty; } else { - dc.SetFont(m_normal_font); + dc.SetFont(m_normalFont); texty = normal_texty; } @@ -438,8 +440,8 @@ void wxAuiDefaultTabArt::DrawTab(wxDC& dc, // draw base background color wxRect r(tab_x, tab_y, tab_width, tab_height); - dc.SetPen(m_base_colour_pen); - dc.SetBrush(m_base_colour_brush); + dc.SetPen(wxPen(m_activeColour)); + dc.SetBrush(wxBrush(m_activeColour)); dc.DrawRectangle(r.x+1, r.y+1, r.width-1, r.height-4); // this white helps fill out the gradient at the top of the tab @@ -448,20 +450,20 @@ void wxAuiDefaultTabArt::DrawTab(wxDC& dc, dc.DrawRectangle(r.x+2, r.y+1, r.width-3, r.height-4); // these two points help the rounded corners appear more antialiased - dc.SetPen(m_base_colour_pen); + dc.SetPen(wxPen(m_activeColour)); dc.DrawPoint(r.x+2, r.y+1); dc.DrawPoint(r.x+r.width-2, r.y+1); // set rectangle down a bit for gradient drawing r.SetHeight(r.GetHeight()/2); r.x += 2; - r.width -= 2; + r.width -= 3; r.y += r.height; r.y -= 2; // draw gradient background wxColor top_color = *wxWHITE; - wxColor bottom_color = m_base_colour; + wxColor bottom_color = m_activeColour; dc.GradientFillLinear(r, bottom_color, top_color, wxNORTH); } else @@ -480,7 +482,7 @@ void wxAuiDefaultTabArt::DrawTab(wxDC& dc, r.height--; // -- draw top gradient fill for glossy look - wxColor top_color = m_base_colour; + wxColor top_color = m_baseColour; wxColor bottom_color = top_color.ChangeLightness(160); dc.GradientFillLinear(r, bottom_color, top_color, wxNORTH); @@ -488,13 +490,13 @@ void wxAuiDefaultTabArt::DrawTab(wxDC& dc, r.y--; // -- draw bottom fill for glossy look - top_color = m_base_colour; - bottom_color = m_base_colour; + top_color = m_baseColour; + bottom_color = m_baseColour; dc.GradientFillLinear(r, top_color, bottom_color, wxSOUTH); } // draw tab outline - dc.SetPen(m_border_pen); + dc.SetPen(m_borderPen); dc.SetBrush(*wxTRANSPARENT_BRUSH); dc.DrawPolygon(WXSIZEOF(border_points), border_points); @@ -503,11 +505,11 @@ void wxAuiDefaultTabArt::DrawTab(wxDC& dc, if (page.active) { if (m_flags &wxAUI_NB_BOTTOM) - dc.SetPen(wxPen(m_base_colour.ChangeLightness(170))); + dc.SetPen(wxPen(m_baseColour.ChangeLightness(170))); // TODO: else if (m_flags &wxAUI_NB_LEFT) {} // TODO: else if (m_flags &wxAUI_NB_RIGHT) {} else //for wxAUI_NB_TOP - dc.SetPen(m_base_colour_pen); + dc.SetPen(m_baseColourPen); dc.DrawLine(border_points[0].x+1, border_points[0].y, border_points[5].x, @@ -519,7 +521,7 @@ void wxAuiDefaultTabArt::DrawTab(wxDC& dc, int close_button_width = 0; if (close_button_state != wxAUI_BUTTON_STATE_HIDDEN) { - close_button_width = m_active_close_bmp.GetWidth(); + close_button_width = m_activeCloseBmp.GetWidth(); } int bitmap_offset = 0; @@ -580,12 +582,12 @@ void wxAuiDefaultTabArt::DrawTab(wxDC& dc, // draw close button if necessary if (close_button_state != wxAUI_BUTTON_STATE_HIDDEN) { - wxBitmap bmp = m_disabled_close_bmp; + wxBitmap bmp = m_disabledCloseBmp; if (close_button_state == wxAUI_BUTTON_STATE_HOVER || close_button_state == wxAUI_BUTTON_STATE_PRESSED) { - bmp = m_active_close_bmp; + bmp = m_activeCloseBmp; } int offsetY = tab_y-1; @@ -623,7 +625,7 @@ wxSize wxAuiDefaultTabArt::GetTabSize(wxDC& dc, { wxCoord measured_textx, measured_texty, tmp; - dc.SetFont(m_measuring_font); + dc.SetFont(m_measuringFont); dc.GetTextExtent(caption, &measured_textx, &measured_texty); dc.GetTextExtent(wxT("ABCDEFXj"), &tmp, &measured_texty); @@ -634,7 +636,7 @@ wxSize wxAuiDefaultTabArt::GetTabSize(wxDC& dc, // if the close button is showing, add space for it if (close_button_state != wxAUI_BUTTON_STATE_HIDDEN) - tab_width += m_active_close_bmp.GetWidth() + 3; + tab_width += m_activeCloseBmp.GetWidth() + 3; // if there's a bitmap, add space for it if (bitmap.IsOk()) @@ -650,7 +652,7 @@ wxSize wxAuiDefaultTabArt::GetTabSize(wxDC& dc, if (m_flags & wxAUI_NB_TAB_FIXED_WIDTH) { - tab_width = m_fixed_tab_width; + tab_width = m_fixedTabWidth; } *x_extent = tab_width; @@ -674,27 +676,27 @@ void wxAuiDefaultTabArt::DrawButton(wxDC& dc, { case wxAUI_BUTTON_CLOSE: if (button_state & wxAUI_BUTTON_STATE_DISABLED) - bmp = m_disabled_close_bmp; + bmp = m_disabledCloseBmp; else - bmp = m_active_close_bmp; + bmp = m_activeCloseBmp; break; case wxAUI_BUTTON_LEFT: if (button_state & wxAUI_BUTTON_STATE_DISABLED) - bmp = m_disabled_left_bmp; + bmp = m_disabledLeftBmp; else - bmp = m_active_left_bmp; + bmp = m_activeLeftBmp; break; case wxAUI_BUTTON_RIGHT: if (button_state & wxAUI_BUTTON_STATE_DISABLED) - bmp = m_disabled_right_bmp; + bmp = m_disabledRightBmp; else - bmp = m_active_right_bmp; + bmp = m_activeRightBmp; break; case wxAUI_BUTTON_WINDOWLIST: if (button_state & wxAUI_BUTTON_STATE_DISABLED) - bmp = m_disabled_windowlist_bmp; + bmp = m_disabledWindowListBmp; else - bmp = m_active_windowlist_bmp; + bmp = m_activeWindowListBmp; break; } @@ -769,19 +771,19 @@ int wxAuiDefaultTabArt::ShowDropDown(wxWindow* wnd, int wxAuiDefaultTabArt::GetBestTabCtrlSize(wxWindow* wnd, const wxAuiNotebookPageArray& pages, - const wxSize& required_bmp_size) + const wxSize& requiredBmp_size) { wxClientDC dc(wnd); - dc.SetFont(m_measuring_font); + dc.SetFont(m_measuringFont); // sometimes a standard bitmap size needs to be enforced, especially // if some tabs have bitmaps and others don't. This is important because // it prevents the tab control from resizing when tabs are added. - wxBitmap measure_bmp; - if (required_bmp_size.IsFullySpecified()) + wxBitmap measureBmp; + if (requiredBmp_size.IsFullySpecified()) { - measure_bmp.Create(required_bmp_size.x, - required_bmp_size.y); + measureBmp.Create(requiredBmp_size.x, + requiredBmp_size.y); } @@ -792,8 +794,8 @@ int wxAuiDefaultTabArt::GetBestTabCtrlSize(wxWindow* wnd, wxAuiNotebookPage& page = pages.Item(i); wxBitmap bmp; - if (measure_bmp.IsOk()) - bmp = measure_bmp; + if (measureBmp.IsOk()) + bmp = measureBmp; else bmp = page.bitmap; @@ -818,55 +820,67 @@ int wxAuiDefaultTabArt::GetBestTabCtrlSize(wxWindow* wnd, void wxAuiDefaultTabArt::SetNormalFont(const wxFont& font) { - m_normal_font = font; + m_normalFont = font; } void wxAuiDefaultTabArt::SetSelectedFont(const wxFont& font) { - m_selected_font = font; + m_selectedFont = font; } void wxAuiDefaultTabArt::SetMeasuringFont(const wxFont& font) { - m_measuring_font = font; + m_measuringFont = font; } +void wxAuiDefaultTabArt::SetColour(const wxColour& colour) +{ + m_baseColour = colour; + m_borderPen = wxPen(m_baseColour.ChangeLightness(75)); + m_baseColourPen = wxPen(m_baseColour); + m_baseColourBrush = wxBrush(m_baseColour); +} + +void wxAuiDefaultTabArt::SetActiveColour(const wxColour& colour) +{ + m_activeColour = colour; +} // -- wxAuiSimpleTabArt class implementation -- wxAuiSimpleTabArt::wxAuiSimpleTabArt() { - m_normal_font = *wxNORMAL_FONT; - m_selected_font = *wxNORMAL_FONT; - m_selected_font.SetWeight(wxBOLD); - m_measuring_font = m_selected_font; + m_normalFont = *wxNORMAL_FONT; + m_selectedFont = *wxNORMAL_FONT; + m_selectedFont.SetWeight(wxBOLD); + m_measuringFont = m_selectedFont; m_flags = 0; - m_fixed_tab_width = 100; + m_fixedTabWidth = 100; - wxColour base_colour = wxSystemSettings::GetColour(wxSYS_COLOUR_3DFACE); + wxColour baseColour = wxSystemSettings::GetColour(wxSYS_COLOUR_3DFACE); - wxColour background_colour = base_colour; - wxColour normaltab_colour = base_colour; - wxColour selectedtab_colour = *wxWHITE; + wxColour backgroundColour = baseColour; + wxColour normaltabColour = baseColour; + wxColour selectedtabColour = *wxWHITE; - m_bkbrush = wxBrush(background_colour); - m_normal_bkbrush = wxBrush(normaltab_colour); - m_normal_bkpen = wxPen(normaltab_colour); - m_selected_bkbrush = wxBrush(selectedtab_colour); - m_selected_bkpen = wxPen(selectedtab_colour); + m_bkBrush = wxBrush(backgroundColour); + m_normalBkBrush = wxBrush(normaltabColour); + m_normalBkPen = wxPen(normaltabColour); + m_selectedBkBrush = wxBrush(selectedtabColour); + m_selectedBkPen = wxPen(selectedtabColour); - m_active_close_bmp = wxAuiBitmapFromBits(close_bits, 16, 16, *wxBLACK); - m_disabled_close_bmp = wxAuiBitmapFromBits(close_bits, 16, 16, wxColour(128,128,128)); + m_activeCloseBmp = wxAuiBitmapFromBits(close_bits, 16, 16, *wxBLACK); + m_disabledCloseBmp = wxAuiBitmapFromBits(close_bits, 16, 16, wxColour(128,128,128)); - m_active_left_bmp = wxAuiBitmapFromBits(left_bits, 16, 16, *wxBLACK); - m_disabled_left_bmp = wxAuiBitmapFromBits(left_bits, 16, 16, wxColour(128,128,128)); + m_activeLeftBmp = wxAuiBitmapFromBits(left_bits, 16, 16, *wxBLACK); + m_disabledLeftBmp = wxAuiBitmapFromBits(left_bits, 16, 16, wxColour(128,128,128)); - m_active_right_bmp = wxAuiBitmapFromBits(right_bits, 16, 16, *wxBLACK); - m_disabled_right_bmp = wxAuiBitmapFromBits(right_bits, 16, 16, wxColour(128,128,128)); + m_activeRightBmp = wxAuiBitmapFromBits(right_bits, 16, 16, *wxBLACK); + m_disabledRightBmp = wxAuiBitmapFromBits(right_bits, 16, 16, wxColour(128,128,128)); - m_active_windowlist_bmp = wxAuiBitmapFromBits(list_bits, 16, 16, *wxBLACK); - m_disabled_windowlist_bmp = wxAuiBitmapFromBits(list_bits, 16, 16, wxColour(128,128,128)); + m_activeWindowListBmp = wxAuiBitmapFromBits(list_bits, 16, 16, *wxBLACK); + m_disabledWindowListBmp = wxAuiBitmapFromBits(list_bits, 16, 16, wxColour(128,128,128)); } @@ -876,10 +890,9 @@ wxAuiSimpleTabArt::~wxAuiSimpleTabArt() wxAuiTabArt* wxAuiSimpleTabArt::Clone() { - return static_cast(new wxAuiSimpleTabArt); + return new wxAuiSimpleTabArt(*this); } - void wxAuiSimpleTabArt::SetFlags(unsigned int flags) { m_flags = flags; @@ -888,29 +901,42 @@ void wxAuiSimpleTabArt::SetFlags(unsigned int flags) void wxAuiSimpleTabArt::SetSizingInfo(const wxSize& tab_ctrl_size, size_t tab_count) { - m_fixed_tab_width = 100; + m_fixedTabWidth = 100; int tot_width = (int)tab_ctrl_size.x - GetIndentSize() - 4; if (m_flags & wxAUI_NB_CLOSE_BUTTON) - tot_width -= m_active_close_bmp.GetWidth(); + tot_width -= m_activeCloseBmp.GetWidth(); if (m_flags & wxAUI_NB_WINDOWLIST_BUTTON) - tot_width -= m_active_windowlist_bmp.GetWidth(); + tot_width -= m_activeWindowListBmp.GetWidth(); if (tab_count > 0) { - m_fixed_tab_width = tot_width/(int)tab_count; + m_fixedTabWidth = tot_width/(int)tab_count; } - if (m_fixed_tab_width < 100) - m_fixed_tab_width = 100; + if (m_fixedTabWidth < 100) + m_fixedTabWidth = 100; - if (m_fixed_tab_width > tot_width/2) - m_fixed_tab_width = tot_width/2; + if (m_fixedTabWidth > tot_width/2) + m_fixedTabWidth = tot_width/2; - if (m_fixed_tab_width > 220) - m_fixed_tab_width = 220; + if (m_fixedTabWidth > 220) + m_fixedTabWidth = 220; +} + +void wxAuiSimpleTabArt::SetColour(const wxColour& colour) +{ + m_bkBrush = wxBrush(colour); + m_normalBkBrush = wxBrush(colour); + m_normalBkPen = wxPen(colour); +} + +void wxAuiSimpleTabArt::SetActiveColour(const wxColour& colour) +{ + m_selectedBkBrush = wxBrush(colour); + m_selectedBkPen = wxPen(colour); } void wxAuiSimpleTabArt::DrawBackground(wxDC& dc, @@ -918,7 +944,7 @@ void wxAuiSimpleTabArt::DrawBackground(wxDC& dc, const wxRect& rect) { // draw background - dc.SetBrush(m_bkbrush); + dc.SetBrush(m_bkBrush); dc.SetPen(*wxTRANSPARENT_PEN); dc.DrawRectangle(-1, -1, rect.GetWidth()+2, rect.GetHeight()+2); @@ -955,10 +981,10 @@ void wxAuiSimpleTabArt::DrawTab(wxDC& dc, if (caption.empty()) caption = wxT("Xj"); - dc.SetFont(m_selected_font); + dc.SetFont(m_selectedFont); dc.GetTextExtent(caption, &selected_textx, &selected_texty); - dc.SetFont(m_normal_font); + dc.SetFont(m_normalFont); dc.GetTextExtent(caption, &normal_textx, &normal_texty); // figure out the size of the tab @@ -981,17 +1007,17 @@ void wxAuiSimpleTabArt::DrawTab(wxDC& dc, if (page.active) { - dc.SetPen(m_selected_bkpen); - dc.SetBrush(m_selected_bkbrush); - dc.SetFont(m_selected_font); + dc.SetPen(m_selectedBkPen); + dc.SetBrush(m_selectedBkBrush); + dc.SetFont(m_selectedFont); textx = selected_textx; texty = selected_texty; } else { - dc.SetPen(m_normal_bkpen); - dc.SetBrush(m_normal_bkbrush); - dc.SetFont(m_normal_font); + dc.SetPen(m_normalBkPen); + dc.SetBrush(m_normalBkBrush); + dc.SetFont(m_normalFont); textx = normal_textx; texty = normal_texty; } @@ -1029,7 +1055,7 @@ void wxAuiSimpleTabArt::DrawTab(wxDC& dc, int close_button_width = 0; if (close_button_state != wxAUI_BUTTON_STATE_HIDDEN) { - close_button_width = m_active_close_bmp.GetWidth(); + close_button_width = m_activeCloseBmp.GetWidth(); text_offset = tab_x + (tab_height/2) + ((tab_width-close_button_width)/2) - (textx/2); } else @@ -1068,9 +1094,9 @@ void wxAuiSimpleTabArt::DrawTab(wxDC& dc, { wxBitmap bmp; if (page.active) - bmp = m_active_close_bmp; + bmp = m_activeCloseBmp; else - bmp = m_disabled_close_bmp; + bmp = m_disabledCloseBmp; wxRect rect(tab_x + tab_width - close_button_width - 1, tab_y + (tab_height/2) - (bmp.GetHeight()/2) + 1, @@ -1102,18 +1128,18 @@ wxSize wxAuiSimpleTabArt::GetTabSize(wxDC& dc, { wxCoord measured_textx, measured_texty; - dc.SetFont(m_measuring_font); + dc.SetFont(m_measuringFont); dc.GetTextExtent(caption, &measured_textx, &measured_texty); wxCoord tab_height = measured_texty + 4; wxCoord tab_width = measured_textx + tab_height + 5; if (close_button_state != wxAUI_BUTTON_STATE_HIDDEN) - tab_width += m_active_close_bmp.GetWidth(); + tab_width += m_activeCloseBmp.GetWidth(); if (m_flags & wxAUI_NB_TAB_FIXED_WIDTH) { - tab_width = m_fixed_tab_width; + tab_width = m_fixedTabWidth; } *x_extent = tab_width - (tab_height/2) - 1; @@ -1137,27 +1163,27 @@ void wxAuiSimpleTabArt::DrawButton(wxDC& dc, { case wxAUI_BUTTON_CLOSE: if (button_state & wxAUI_BUTTON_STATE_DISABLED) - bmp = m_disabled_close_bmp; + bmp = m_disabledCloseBmp; else - bmp = m_active_close_bmp; + bmp = m_activeCloseBmp; break; case wxAUI_BUTTON_LEFT: if (button_state & wxAUI_BUTTON_STATE_DISABLED) - bmp = m_disabled_left_bmp; + bmp = m_disabledLeftBmp; else - bmp = m_active_left_bmp; + bmp = m_activeLeftBmp; break; case wxAUI_BUTTON_RIGHT: if (button_state & wxAUI_BUTTON_STATE_DISABLED) - bmp = m_disabled_right_bmp; + bmp = m_disabledRightBmp; else - bmp = m_active_right_bmp; + bmp = m_activeRightBmp; break; case wxAUI_BUTTON_WINDOWLIST: if (button_state & wxAUI_BUTTON_STATE_DISABLED) - bmp = m_disabled_windowlist_bmp; + bmp = m_disabledWindowListBmp; else - bmp = m_active_windowlist_bmp; + bmp = m_activeWindowListBmp; break; } @@ -1232,10 +1258,10 @@ int wxAuiSimpleTabArt::ShowDropDown(wxWindow* wnd, int wxAuiSimpleTabArt::GetBestTabCtrlSize(wxWindow* wnd, const wxAuiNotebookPageArray& WXUNUSED(pages), - const wxSize& WXUNUSED(required_bmp_size)) + const wxSize& WXUNUSED(requiredBmp_size)) { wxClientDC dc(wnd); - dc.SetFont(m_measuring_font); + dc.SetFont(m_measuringFont); int x_ext = 0; wxSize s = GetTabSize(dc, wnd, @@ -1249,17 +1275,17 @@ int wxAuiSimpleTabArt::GetBestTabCtrlSize(wxWindow* wnd, void wxAuiSimpleTabArt::SetNormalFont(const wxFont& font) { - m_normal_font = font; + m_normalFont = font; } void wxAuiSimpleTabArt::SetSelectedFont(const wxFont& font) { - m_selected_font = font; + m_selectedFont = font; } void wxAuiSimpleTabArt::SetMeasuringFont(const wxFont& font) { - m_measuring_font = font; + m_measuringFont = font; } @@ -1280,7 +1306,7 @@ void wxAuiSimpleTabArt::SetMeasuringFont(const wxFont& font) wxAuiTabContainer::wxAuiTabContainer() { - m_tab_offset = 0; + m_tabOffset = 0; m_flags = 0; m_art = new wxAuiDefaultTabArt; @@ -1365,6 +1391,16 @@ void wxAuiTabContainer::SetMeasuringFont(const wxFont& font) m_art->SetMeasuringFont(font); } +void wxAuiTabContainer::SetColour(const wxColour& colour) +{ + m_art->SetColour(colour); +} + +void wxAuiTabContainer::SetActiveColour(const wxColour& colour) +{ + m_art->SetActiveColour(colour); +} + void wxAuiTabContainer::SetRect(const wxRect& rect) { m_rect = rect; @@ -1556,15 +1592,15 @@ size_t wxAuiTabContainer::GetPageCount() const void wxAuiTabContainer::AddButton(int id, int location, - const wxBitmap& normal_bitmap, - const wxBitmap& disabled_bitmap) + const wxBitmap& normalBitmap, + const wxBitmap& disabledBitmap) { wxAuiTabContainerButton button; button.id = id; - button.bitmap = normal_bitmap; - button.dis_bitmap = disabled_bitmap; + button.bitmap = normalBitmap; + button.disBitmap = disabledBitmap; button.location = location; - button.cur_state = wxAUI_BUTTON_STATE_NORMAL; + button.curState = wxAUI_BUTTON_STATE_NORMAL; m_buttons.Add(button); } @@ -1587,12 +1623,12 @@ void wxAuiTabContainer::RemoveButton(int id) size_t wxAuiTabContainer::GetTabOffset() const { - return m_tab_offset; + return m_tabOffset; } void wxAuiTabContainer::SetTabOffset(size_t offset) { - m_tab_offset = offset; + m_tabOffset = offset; } @@ -1657,7 +1693,7 @@ void wxAuiTabContainer::Render(wxDC* raw_dc, wxWindow* wnd) else total_width += size.x; - if (i >= m_tab_offset) + if (i >= m_tabOffset) { if (i+1 < page_count) visible_width += x_extent; @@ -1666,7 +1702,7 @@ void wxAuiTabContainer::Render(wxDC* raw_dc, wxWindow* wnd) } } - if (total_width > m_rect.GetWidth() || m_tab_offset != 0) + if (total_width > m_rect.GetWidth() || m_tabOffset != 0) { // show left/right buttons for (i = 0; i < button_count; ++i) @@ -1675,7 +1711,7 @@ void wxAuiTabContainer::Render(wxDC* raw_dc, wxWindow* wnd) if (button.id == wxAUI_BUTTON_LEFT || button.id == wxAUI_BUTTON_RIGHT) { - button.cur_state &= ~wxAUI_BUTTON_STATE_HIDDEN; + button.curState &= ~wxAUI_BUTTON_STATE_HIDDEN; } } } @@ -1688,7 +1724,7 @@ void wxAuiTabContainer::Render(wxDC* raw_dc, wxWindow* wnd) if (button.id == wxAUI_BUTTON_LEFT || button.id == wxAUI_BUTTON_RIGHT) { - button.cur_state |= wxAUI_BUTTON_STATE_HIDDEN; + button.curState |= wxAUI_BUTTON_STATE_HIDDEN; } } } @@ -1699,17 +1735,17 @@ void wxAuiTabContainer::Render(wxDC* raw_dc, wxWindow* wnd) wxAuiTabContainerButton& button = m_buttons.Item(i); if (button.id == wxAUI_BUTTON_LEFT) { - if (m_tab_offset == 0) - button.cur_state |= wxAUI_BUTTON_STATE_DISABLED; + if (m_tabOffset == 0) + button.curState |= wxAUI_BUTTON_STATE_DISABLED; else - button.cur_state &= ~wxAUI_BUTTON_STATE_DISABLED; + button.curState &= ~wxAUI_BUTTON_STATE_DISABLED; } if (button.id == wxAUI_BUTTON_RIGHT) { if (visible_width < m_rect.GetWidth() - ((int)button_count*16)) - button.cur_state |= wxAUI_BUTTON_STATE_DISABLED; + button.curState |= wxAUI_BUTTON_STATE_DISABLED; else - button.cur_state &= ~wxAUI_BUTTON_STATE_DISABLED; + button.curState &= ~wxAUI_BUTTON_STATE_DISABLED; } } @@ -1732,7 +1768,7 @@ void wxAuiTabContainer::Render(wxDC* raw_dc, wxWindow* wnd) if (button.location != wxRIGHT) continue; - if (button.cur_state & wxAUI_BUTTON_STATE_HIDDEN) + if (button.curState & wxAUI_BUTTON_STATE_HIDDEN) continue; wxRect button_rect = m_rect; @@ -1743,7 +1779,7 @@ void wxAuiTabContainer::Render(wxDC* raw_dc, wxWindow* wnd) wnd, button_rect, button.id, - button.cur_state, + button.curState, wxRIGHT, &button.rect); @@ -1763,7 +1799,7 @@ void wxAuiTabContainer::Render(wxDC* raw_dc, wxWindow* wnd) if (button.location != wxLEFT) continue; - if (button.cur_state & wxAUI_BUTTON_STATE_HIDDEN) + if (button.curState & wxAUI_BUTTON_STATE_HIDDEN) continue; wxRect button_rect(offset, 1, 1000, m_rect.height); @@ -1772,7 +1808,7 @@ void wxAuiTabContainer::Render(wxDC* raw_dc, wxWindow* wnd) wnd, button_rect, button.id, - button.cur_state, + button.curState, wxLEFT, &button.rect); @@ -1788,24 +1824,24 @@ void wxAuiTabContainer::Render(wxDC* raw_dc, wxWindow* wnd) // prepare the tab-close-button array // make sure tab button entries which aren't used are marked as hidden - for (i = page_count; i < m_tab_close_buttons.GetCount(); ++i) - m_tab_close_buttons.Item(i).cur_state = wxAUI_BUTTON_STATE_HIDDEN; + for (i = page_count; i < m_tabCloseButtons.GetCount(); ++i) + m_tabCloseButtons.Item(i).curState = wxAUI_BUTTON_STATE_HIDDEN; // make sure there are enough tab button entries to accommodate all tabs - while (m_tab_close_buttons.GetCount() < page_count) + while (m_tabCloseButtons.GetCount() < page_count) { wxAuiTabContainerButton tempbtn; tempbtn.id = wxAUI_BUTTON_CLOSE; tempbtn.location = wxCENTER; - tempbtn.cur_state = wxAUI_BUTTON_STATE_HIDDEN; - m_tab_close_buttons.Add(tempbtn); + tempbtn.curState = wxAUI_BUTTON_STATE_HIDDEN; + m_tabCloseButtons.Add(tempbtn); } // buttons before the tab offset must be set to hidden - for (i = 0; i < m_tab_offset; ++i) + for (i = 0; i < m_tabOffset; ++i) { - m_tab_close_buttons.Item(i).cur_state = wxAUI_BUTTON_STATE_HIDDEN; + m_tabCloseButtons.Item(i).curState = wxAUI_BUTTON_STATE_HIDDEN; } @@ -1820,25 +1856,25 @@ void wxAuiTabContainer::Render(wxDC* raw_dc, wxWindow* wnd) rect.y = 0; rect.height = m_rect.height; - for (i = m_tab_offset; i < page_count; ++i) + for (i = m_tabOffset; i < page_count; ++i) { wxAuiNotebookPage& page = m_pages.Item(i); - wxAuiTabContainerButton& tab_button = m_tab_close_buttons.Item(i); + wxAuiTabContainerButton& tab_button = m_tabCloseButtons.Item(i); // determine if a close button is on this tab if ((m_flags & wxAUI_NB_CLOSE_ON_ALL_TABS) != 0 || ((m_flags & wxAUI_NB_CLOSE_ON_ACTIVE_TAB) != 0 && page.active)) { - if (tab_button.cur_state == wxAUI_BUTTON_STATE_HIDDEN) + if (tab_button.curState == wxAUI_BUTTON_STATE_HIDDEN) { tab_button.id = wxAUI_BUTTON_CLOSE; - tab_button.cur_state = wxAUI_BUTTON_STATE_NORMAL; + tab_button.curState = wxAUI_BUTTON_STATE_NORMAL; tab_button.location = wxCENTER; } } else { - tab_button.cur_state = wxAUI_BUTTON_STATE_HIDDEN; + tab_button.curState = wxAUI_BUTTON_STATE_HIDDEN; } rect.x = offset; @@ -1851,7 +1887,7 @@ void wxAuiTabContainer::Render(wxDC* raw_dc, wxWindow* wnd) wnd, page, rect, - tab_button.cur_state, + tab_button.curState, &page.rect, &tab_button.rect, &x_extent); @@ -1868,25 +1904,25 @@ void wxAuiTabContainer::Render(wxDC* raw_dc, wxWindow* wnd) // make sure to deactivate buttons which are off the screen to the right - for (++i; i < m_tab_close_buttons.GetCount(); ++i) + for (++i; i < m_tabCloseButtons.GetCount(); ++i) { - m_tab_close_buttons.Item(i).cur_state = wxAUI_BUTTON_STATE_HIDDEN; + m_tabCloseButtons.Item(i).curState = wxAUI_BUTTON_STATE_HIDDEN; } // draw the active tab again so it stands in the foreground - if (active >= m_tab_offset && active < m_pages.GetCount()) + if (active >= m_tabOffset && active < m_pages.GetCount()) { wxAuiNotebookPage& page = m_pages.Item(active); - wxAuiTabContainerButton& tab_button = m_tab_close_buttons.Item(active); + wxAuiTabContainerButton& tab_button = m_tabCloseButtons.Item(active); rect.x = active_offset; m_art->DrawTab(dc, wnd, page, active_rect, - tab_button.cur_state, + tab_button.curState, &page.rect, &tab_button.rect, &x_extent); @@ -1909,7 +1945,7 @@ bool wxAuiTabContainer::IsTabVisible(int tabPage, int tabOffset, wxDC* dc, wxWin size_t button_count = m_buttons.GetCount(); // Hasn't been rendered yet; assume it's visible - if (m_tab_close_buttons.GetCount() < page_count) + if (m_tabCloseButtons.GetCount() < page_count) return true; // First check if both buttons are disabled - if so, there's no need to @@ -1921,7 +1957,7 @@ bool wxAuiTabContainer::IsTabVisible(int tabPage, int tabOffset, wxDC* dc, wxWin if (button.id == wxAUI_BUTTON_LEFT || button.id == wxAUI_BUTTON_RIGHT) { - if ((button.cur_state & wxAUI_BUTTON_STATE_HIDDEN) == 0) + if ((button.curState & wxAUI_BUTTON_STATE_HIDDEN) == 0) arrowButtonVisibleCount ++; } } @@ -1948,7 +1984,7 @@ bool wxAuiTabContainer::IsTabVisible(int tabPage, int tabOffset, wxDC* dc, wxWin if (button.location != wxRIGHT) continue; - if (button.cur_state & wxAUI_BUTTON_STATE_HIDDEN) + if (button.curState & wxAUI_BUTTON_STATE_HIDDEN) continue; offset -= button.rect.GetWidth(); @@ -1964,7 +2000,7 @@ bool wxAuiTabContainer::IsTabVisible(int tabPage, int tabOffset, wxDC* dc, wxWin if (button.location != wxLEFT) continue; - if (button.cur_state & wxAUI_BUTTON_STATE_HIDDEN) + if (button.curState & wxAUI_BUTTON_STATE_HIDDEN) continue; offset += button.rect.GetWidth(); @@ -1986,7 +2022,7 @@ bool wxAuiTabContainer::IsTabVisible(int tabPage, int tabOffset, wxDC* dc, wxWin for (i = tabOffset; i < page_count; ++i) { wxAuiNotebookPage& page = m_pages.Item(i); - wxAuiTabContainerButton& tab_button = m_tab_close_buttons.Item(i); + wxAuiTabContainerButton& tab_button = m_tabCloseButtons.Item(i); rect.x = offset; rect.width = m_rect.width - right_buttons_width - offset - 2; @@ -1995,12 +2031,12 @@ bool wxAuiTabContainer::IsTabVisible(int tabPage, int tabOffset, wxDC* dc, wxWin return false; // haven't found the tab, and we've run out of space, so return false int x_extent = 0; - wxSize size = m_art->GetTabSize(*dc, + m_art->GetTabSize(*dc, wnd, page.caption, page.bitmap, page.active, - tab_button.cur_state, + tab_button.curState, &x_extent); offset += x_extent; @@ -2049,7 +2085,7 @@ bool wxAuiTabContainer::TabHitTest(int x, int y, wxWindow** hit) const return false; wxAuiTabContainerButton* btn = NULL; - if (ButtonHitTest(x, y, &btn) && !(btn->cur_state & wxAUI_BUTTON_STATE_DISABLED)) + if (ButtonHitTest(x, y, &btn) && !(btn->curState & wxAUI_BUTTON_STATE_DISABLED)) { if (m_buttons.Index(*btn) != wxNOT_FOUND) return false; @@ -2057,7 +2093,7 @@ bool wxAuiTabContainer::TabHitTest(int x, int y, wxWindow** hit) const size_t i, page_count = m_pages.GetCount(); - for (i = m_tab_offset; i < page_count; ++i) + for (i = m_tabOffset; i < page_count; ++i) { wxAuiNotebookPage& page = m_pages.Item(i); if (page.rect.Contains(x,y)) @@ -2087,7 +2123,7 @@ bool wxAuiTabContainer::ButtonHitTest(int x, int y, { wxAuiTabContainerButton& button = m_buttons.Item(i); if (button.rect.Contains(x,y) && - !(button.cur_state & wxAUI_BUTTON_STATE_HIDDEN )) + !(button.curState & wxAUI_BUTTON_STATE_HIDDEN )) { if (hit) *hit = &button; @@ -2095,12 +2131,12 @@ bool wxAuiTabContainer::ButtonHitTest(int x, int y, } } - button_count = m_tab_close_buttons.GetCount(); + button_count = m_tabCloseButtons.GetCount(); for (i = 0; i < button_count; ++i) { - wxAuiTabContainerButton& button = m_tab_close_buttons.Item(i); + wxAuiTabContainerButton& button = m_tabCloseButtons.Item(i); if (button.rect.Contains(x,y) && - !(button.cur_state & (wxAUI_BUTTON_STATE_HIDDEN | + !(button.curState & (wxAUI_BUTTON_STATE_HIDDEN | wxAUI_BUTTON_STATE_DISABLED))) { if (hit) @@ -2197,10 +2233,10 @@ wxAuiTabCtrl::wxAuiTabCtrl(wxWindow* parent, long style) : wxControl(parent, id, pos, size, style) { SetName(wxT("wxAuiTabCtrl")); - m_click_pt = wxDefaultPosition; - m_is_dragging = false; - m_hover_button = NULL; - m_pressed_button = NULL; + m_clickPt = wxDefaultPosition; + m_isDragging = false; + m_hoverButton = NULL; + m_pressedButton = NULL; } wxAuiTabCtrl::~wxAuiTabCtrl() @@ -2231,10 +2267,10 @@ void wxAuiTabCtrl::OnSize(wxSizeEvent& evt) void wxAuiTabCtrl::OnLeftDown(wxMouseEvent& evt) { CaptureMouse(); - m_click_pt = wxDefaultPosition; - m_is_dragging = false; - m_click_tab = NULL; - m_pressed_button = NULL; + m_clickPt = wxDefaultPosition; + m_isDragging = false; + m_clickTab = NULL; + m_pressedButton = NULL; wxWindow* wnd; @@ -2255,15 +2291,15 @@ void wxAuiTabCtrl::OnLeftDown(wxMouseEvent& evt) GetEventHandler()->ProcessEvent(e); } - m_click_pt.x = evt.m_x; - m_click_pt.y = evt.m_y; - m_click_tab = wnd; + m_clickPt.x = evt.m_x; + m_clickPt.y = evt.m_y; + m_clickTab = wnd; } - if (m_hover_button) + if (m_hoverButton) { - m_pressed_button = m_hover_button; - m_pressed_button->cur_state = wxAUI_BUTTON_STATE_PRESSED; + m_pressedButton = m_hoverButton; + m_pressedButton->curState = wxAUI_BUTTON_STATE_PRESSED; Refresh(); Update(); } @@ -2271,6 +2307,16 @@ void wxAuiTabCtrl::OnLeftDown(wxMouseEvent& evt) void wxAuiTabCtrl::OnCaptureLost(wxMouseCaptureLostEvent& WXUNUSED(event)) { + if (m_isDragging) + { + m_isDragging = false; + + wxAuiNotebookEvent evt(wxEVT_COMMAND_AUINOTEBOOK_CANCEL_DRAG, m_windowId); + evt.SetSelection(GetIdxFromWindow(m_clickTab)); + evt.SetOldSelection(evt.GetSelection()); + evt.SetEventObject(this); + GetEventHandler()->ProcessEvent(evt); + } } void wxAuiTabCtrl::OnLeftUp(wxMouseEvent& evt) @@ -2278,12 +2324,12 @@ void wxAuiTabCtrl::OnLeftUp(wxMouseEvent& evt) if (GetCapture() == this) ReleaseMouse(); - if (m_is_dragging) + if (m_isDragging) { - m_is_dragging = false; + m_isDragging = false; wxAuiNotebookEvent evt(wxEVT_COMMAND_AUINOTEBOOK_END_DRAG, m_windowId); - evt.SetSelection(GetIdxFromWindow(m_click_tab)); + evt.SetSelection(GetIdxFromWindow(m_clickTab)); evt.SetOldSelection(evt.GetSelection()); evt.SetEventObject(this); GetEventHandler()->ProcessEvent(evt); @@ -2291,38 +2337,38 @@ void wxAuiTabCtrl::OnLeftUp(wxMouseEvent& evt) return; } - if (m_pressed_button) + if (m_pressedButton) { // make sure we're still clicking the button wxAuiTabContainerButton* button = NULL; if (!ButtonHitTest(evt.m_x, evt.m_y, &button) || - button->cur_state & wxAUI_BUTTON_STATE_DISABLED) + button->curState & wxAUI_BUTTON_STATE_DISABLED) return; - if (button != m_pressed_button) + if (button != m_pressedButton) { - m_pressed_button = NULL; + m_pressedButton = NULL; return; } Refresh(); Update(); - if (!(m_pressed_button->cur_state & wxAUI_BUTTON_STATE_DISABLED)) + if (!(m_pressedButton->curState & wxAUI_BUTTON_STATE_DISABLED)) { wxAuiNotebookEvent evt(wxEVT_COMMAND_AUINOTEBOOK_BUTTON, m_windowId); - evt.SetSelection(GetIdxFromWindow(m_click_tab)); - evt.SetInt(m_pressed_button->id); + evt.SetSelection(GetIdxFromWindow(m_clickTab)); + evt.SetInt(m_pressedButton->id); evt.SetEventObject(this); GetEventHandler()->ProcessEvent(evt); } - m_pressed_button = NULL; + m_pressedButton = NULL; } - m_click_pt = wxDefaultPosition; - m_is_dragging = false; - m_click_tab = NULL; + m_clickPt = wxDefaultPosition; + m_isDragging = false; + m_clickTab = NULL; } void wxAuiTabCtrl::OnMiddleUp(wxMouseEvent& evt) @@ -2391,44 +2437,45 @@ void wxAuiTabCtrl::OnMotion(wxMouseEvent& evt) // check if the mouse is hovering above a button wxAuiTabContainerButton* button; - if (ButtonHitTest(pos.x, pos.y, &button) && !(button->cur_state & wxAUI_BUTTON_STATE_DISABLED)) + if (ButtonHitTest(pos.x, pos.y, &button) && !(button->curState & wxAUI_BUTTON_STATE_DISABLED)) { - if (m_hover_button && button != m_hover_button) + if (m_hoverButton && button != m_hoverButton) { - m_hover_button->cur_state = wxAUI_BUTTON_STATE_NORMAL; - m_hover_button = NULL; + m_hoverButton->curState = wxAUI_BUTTON_STATE_NORMAL; + m_hoverButton = NULL; Refresh(); Update(); } - if (button->cur_state != wxAUI_BUTTON_STATE_HOVER) + if (button->curState != wxAUI_BUTTON_STATE_HOVER) { - button->cur_state = wxAUI_BUTTON_STATE_HOVER; + button->curState = wxAUI_BUTTON_STATE_HOVER; Refresh(); Update(); - m_hover_button = button; + + m_hoverButton = button; return; } } else { - if (m_hover_button) + if (m_hoverButton) { - m_hover_button->cur_state = wxAUI_BUTTON_STATE_NORMAL; - m_hover_button = NULL; + m_hoverButton->curState = wxAUI_BUTTON_STATE_NORMAL; + m_hoverButton = NULL; Refresh(); Update(); } } - if (!evt.LeftIsDown() || m_click_pt == wxDefaultPosition) + if (!evt.LeftIsDown() || m_clickPt == wxDefaultPosition) return; - if (m_is_dragging) + if (m_isDragging) { wxAuiNotebookEvent evt(wxEVT_COMMAND_AUINOTEBOOK_DRAG_MOTION, m_windowId); - evt.SetSelection(GetIdxFromWindow(m_click_tab)); + evt.SetSelection(GetIdxFromWindow(m_clickTab)); evt.SetOldSelection(evt.GetSelection()); evt.SetEventObject(this); GetEventHandler()->ProcessEvent(evt); @@ -2439,25 +2486,25 @@ void wxAuiTabCtrl::OnMotion(wxMouseEvent& evt) int drag_x_threshold = wxSystemSettings::GetMetric(wxSYS_DRAG_X); int drag_y_threshold = wxSystemSettings::GetMetric(wxSYS_DRAG_Y); - if (abs(pos.x - m_click_pt.x) > drag_x_threshold || - abs(pos.y - m_click_pt.y) > drag_y_threshold) + if (abs(pos.x - m_clickPt.x) > drag_x_threshold || + abs(pos.y - m_clickPt.y) > drag_y_threshold) { wxAuiNotebookEvent evt(wxEVT_COMMAND_AUINOTEBOOK_BEGIN_DRAG, m_windowId); - evt.SetSelection(GetIdxFromWindow(m_click_tab)); + evt.SetSelection(GetIdxFromWindow(m_clickTab)); evt.SetOldSelection(evt.GetSelection()); evt.SetEventObject(this); GetEventHandler()->ProcessEvent(evt); - m_is_dragging = true; + m_isDragging = true; } } void wxAuiTabCtrl::OnLeaveWindow(wxMouseEvent& WXUNUSED(event)) { - if (m_hover_button) + if (m_hoverButton) { - m_hover_button->cur_state = wxAUI_BUTTON_STATE_NORMAL; - m_hover_button = NULL; + m_hoverButton->curState = wxAUI_BUTTON_STATE_NORMAL; + m_hoverButton = NULL; Refresh(); Update(); } @@ -2653,7 +2700,7 @@ public: { m_tabs = NULL; m_rect = wxRect(0,0,200,200); - m_tab_ctrl_height = 20; + m_tabCtrlHeight = 20; } ~wxTabFrame() @@ -2663,7 +2710,7 @@ public: void SetTabCtrlHeight(int h) { - m_tab_ctrl_height = h; + m_tabCtrlHeight = h; } protected: @@ -2692,18 +2739,18 @@ public: if (m_tabs->IsFrozen() || m_tabs->GetParent()->IsFrozen()) return; - m_tab_rect = wxRect(m_rect.x, m_rect.y, m_rect.width, m_tab_ctrl_height); + m_tab_rect = wxRect(m_rect.x, m_rect.y, m_rect.width, m_tabCtrlHeight); if (m_tabs->GetFlags() & wxAUI_NB_BOTTOM) { - m_tab_rect = wxRect (m_rect.x, m_rect.y + m_rect.height - m_tab_ctrl_height, m_rect.width, m_tab_ctrl_height); - m_tabs->SetSize (m_rect.x, m_rect.y + m_rect.height - m_tab_ctrl_height, m_rect.width, m_tab_ctrl_height); - m_tabs->SetRect (wxRect(0, 0, m_rect.width, m_tab_ctrl_height)); + m_tab_rect = wxRect (m_rect.x, m_rect.y + m_rect.height - m_tabCtrlHeight, m_rect.width, m_tabCtrlHeight); + m_tabs->SetSize (m_rect.x, m_rect.y + m_rect.height - m_tabCtrlHeight, m_rect.width, m_tabCtrlHeight); + m_tabs->SetRect (wxRect(0, 0, m_rect.width, m_tabCtrlHeight)); } else //TODO: if (GetFlags() & wxAUI_NB_TOP) { - m_tab_rect = wxRect (m_rect.x, m_rect.y, m_rect.width, m_tab_ctrl_height); - m_tabs->SetSize (m_rect.x, m_rect.y, m_rect.width, m_tab_ctrl_height); - m_tabs->SetRect (wxRect(0, 0, m_rect.width, m_tab_ctrl_height)); + m_tab_rect = wxRect (m_rect.x, m_rect.y, m_rect.width, m_tabCtrlHeight); + m_tabs->SetSize (m_rect.x, m_rect.y, m_rect.width, m_tabCtrlHeight); + m_tabs->SetRect (wxRect(0, 0, m_rect.width, m_tabCtrlHeight)); } // TODO: else if (GetFlags() & wxAUI_NB_LEFT){} // TODO: else if (GetFlags() & wxAUI_NB_RIGHT){} @@ -2716,7 +2763,7 @@ public: for (i = 0; i < page_count; ++i) { - int height = m_rect.height - m_tab_ctrl_height; + int height = m_rect.height - m_tabCtrlHeight; if ( height < 0 ) { // avoid passing negative height to wxWindow::SetSize(), this @@ -2731,7 +2778,7 @@ public: } else //TODO: if (GetFlags() & wxAUI_NB_TOP) { - page.window->SetSize(m_rect.x, m_rect.y + m_tab_ctrl_height, + page.window->SetSize(m_rect.x, m_rect.y + m_tabCtrlHeight, m_rect.width, height); } // TODO: else if (GetFlags() & wxAUI_NB_LEFT){} @@ -2765,7 +2812,7 @@ public: wxRect m_rect; wxRect m_tab_rect; wxAuiTabCtrl* m_tabs; - int m_tab_ctrl_height; + int m_tabCtrlHeight; }; @@ -2789,6 +2836,9 @@ BEGIN_EVENT_TABLE(wxAuiNotebook, wxControl) EVT_AUI_RANGE(wxAuiBaseTabCtrlId, wxAuiBaseTabCtrlId+500, wxEVT_COMMAND_AUINOTEBOOK_END_DRAG, wxAuiNotebook::OnTabEndDrag) + EVT_AUI_RANGE(wxAuiBaseTabCtrlId, wxAuiBaseTabCtrlId+500, + wxEVT_COMMAND_AUINOTEBOOK_CANCEL_DRAG, + wxAuiNotebook::OnTabCancelDrag) EVT_AUI_RANGE(wxAuiBaseTabCtrlId, wxAuiBaseTabCtrlId+500, wxEVT_COMMAND_AUINOTEBOOK_DRAG_MOTION, wxAuiNotebook::OnTabDragMotion) @@ -2811,37 +2861,16 @@ BEGIN_EVENT_TABLE(wxAuiNotebook, wxControl) wxEVT_COMMAND_AUINOTEBOOK_BG_DCLICK, wxAuiNotebook::OnTabBgDClick) EVT_NAVIGATION_KEY(wxAuiNotebook::OnNavigationKeyNotebook) - -#ifdef wxHAS_NATIVE_TAB_TRAVERSAL - WX_EVENT_TABLE_CONTROL_CONTAINER(wxAuiNotebook) -#else - // Avoid clash with container event handler functions - EVT_SET_FOCUS(wxAuiNotebook::OnFocus) -#endif END_EVENT_TABLE() -WX_DELEGATE_TO_CONTROL_CONTAINER(wxAuiNotebook, wxControl) - -wxAuiNotebook::wxAuiNotebook() +void wxAuiNotebook::Init() { - m_curpage = -1; - m_tab_id_counter = wxAuiBaseTabCtrlId; - m_dummy_wnd = NULL; - m_tab_ctrl_height = 20; - m_requested_bmp_size = wxDefaultSize; - m_requested_tabctrl_height = -1; -} - -wxAuiNotebook::wxAuiNotebook(wxWindow *parent, - wxWindowID id, - const wxPoint& pos, - const wxSize& size, - long style) : wxControl(parent, id, pos, size, style) -{ - m_dummy_wnd = NULL; - m_requested_bmp_size = wxDefaultSize; - m_requested_tabctrl_height = -1; - InitNotebook(style); + m_curPage = -1; + m_tabIdCounter = wxAuiBaseTabCtrlId; + m_dummyWnd = NULL; + m_tabCtrlHeight = 20; + m_requestedBmpSize = wxDefaultSize; + m_requestedTabCtrlHeight = -1; } bool wxAuiNotebook::Create(wxWindow* parent, @@ -2862,31 +2891,28 @@ bool wxAuiNotebook::Create(wxWindow* parent, // code called by all constructors void wxAuiNotebook::InitNotebook(long style) { - WX_INIT_CONTROL_CONTAINER(); - // SetCanFocus(false); - SetName(wxT("wxAuiNotebook")); - m_curpage = -1; - m_tab_id_counter = wxAuiBaseTabCtrlId; - m_dummy_wnd = NULL; + m_curPage = -1; + m_tabIdCounter = wxAuiBaseTabCtrlId; + m_dummyWnd = NULL; m_flags = (unsigned int)style; - m_tab_ctrl_height = 20; + m_tabCtrlHeight = 20; - m_normal_font = *wxNORMAL_FONT; - m_selected_font = *wxNORMAL_FONT; - m_selected_font.SetWeight(wxBOLD); + m_normalFont = *wxNORMAL_FONT; + m_selectedFont = *wxNORMAL_FONT; + m_selectedFont.SetWeight(wxBOLD); SetArtProvider(new wxAuiDefaultTabArt); - m_dummy_wnd = new wxWindow(this, wxID_ANY, wxPoint(0,0), wxSize(0,0)); - m_dummy_wnd->SetSize(200, 200); - m_dummy_wnd->Show(false); + m_dummyWnd = new wxWindow(this, wxID_ANY, wxPoint(0,0), wxSize(0,0)); + m_dummyWnd->SetSize(200, 200); + m_dummyWnd->Show(false); m_mgr.SetManagedWindow(this); m_mgr.SetFlags(wxAUI_MGR_DEFAULT); m_mgr.SetDockSizeConstraint(1.0, 1.0); // no dock size constraint - m_mgr.AddPane(m_dummy_wnd, + m_mgr.AddPane(m_dummyWnd, wxAuiPaneInfo().Name(wxT("dummy")).Bottom().CaptionVisible(false).Show(false)); m_mgr.Update(); @@ -2935,10 +2961,10 @@ void wxAuiNotebook::SetArtProvider(wxAuiTabArt* art) void wxAuiNotebook::SetTabCtrlHeight(int height) { - m_requested_tabctrl_height = height; + m_requestedTabCtrlHeight = height; // if window is already initialized, recalculate the tab height - if (m_dummy_wnd) + if (m_dummyWnd) { UpdateTabCtrlHeight(); } @@ -2954,10 +2980,10 @@ void wxAuiNotebook::SetTabCtrlHeight(int height) void wxAuiNotebook::SetUniformBitmapSize(const wxSize& size) { - m_requested_bmp_size = size; + m_requestedBmpSize = size; // if window is already initialized, recalculate the tab height - if (m_dummy_wnd) + if (m_dummyWnd) { UpdateTabCtrlHeight(); } @@ -2972,12 +2998,12 @@ bool wxAuiNotebook::UpdateTabCtrlHeight() // if the tab control height needs to change, update // all of our tab controls with the new height - if (m_tab_ctrl_height == height) + if (m_tabCtrlHeight == height) return false; wxAuiTabArt* art = m_tabs.GetArtProvider(); - m_tab_ctrl_height = height; + m_tabCtrlHeight = height; wxAuiPaneInfoArray& all_panes = m_mgr.GetAllPanes(); size_t i, pane_count = all_panes.GetCount(); @@ -2988,7 +3014,7 @@ bool wxAuiNotebook::UpdateTabCtrlHeight() continue; wxTabFrame* tab_frame = (wxTabFrame*)pane.window; wxAuiTabCtrl* tabctrl = tab_frame->m_tabs; - tab_frame->SetTabCtrlHeight(m_tab_ctrl_height); + tab_frame->SetTabCtrlHeight(m_tabCtrlHeight); tabctrl->SetArtProvider(art->Clone()); tab_frame->DoSizing(); } @@ -3006,7 +3032,7 @@ void wxAuiNotebook::UpdateHintWindowSize() { info.MinSize(size); info.BestSize(size); - m_dummy_wnd->SetSize(size); + m_dummyWnd->SetSize(size); } } @@ -3051,15 +3077,15 @@ int wxAuiNotebook::CalculateTabCtrlHeight() // if a fixed tab ctrl height is specified, // just return that instead of calculating a // tab height - if (m_requested_tabctrl_height != -1) - return m_requested_tabctrl_height; + if (m_requestedTabCtrlHeight != -1) + return m_requestedTabCtrlHeight; // find out new best tab height wxAuiTabArt* art = m_tabs.GetArtProvider(); return art->GetBestTabCtrlSize(this, m_tabs.GetPages(), - m_requested_bmp_size); + m_requestedBmpSize); } @@ -3135,7 +3161,7 @@ bool wxAuiNotebook::InsertPage(size_t page_idx, // (though no select events will be fired) if (!select && m_tabs.GetPageCount() == 1) select = true; - //m_curpage = GetPageIndex(page); + //m_curPage = GetPageIndex(page); wxAuiTabCtrl* active_tabctrl = GetActiveTabCtrl(); if (page_idx >= active_tabctrl->GetPageCount()) @@ -3148,8 +3174,8 @@ bool wxAuiNotebook::InsertPage(size_t page_idx, active_tabctrl->DoShowHide(); // adjust selected index - if(m_curpage >= (int) page_idx) - m_curpage++; + if(m_curPage >= (int) page_idx) + m_curPage++; if (select) { @@ -3202,8 +3228,8 @@ bool wxAuiNotebook::RemovePage(size_t page_idx) { // save active window pointer wxWindow* active_wnd = NULL; - if (m_curpage >= 0) - active_wnd = m_tabs.GetWindowFromIdx(m_curpage); + if (m_curPage >= 0) + active_wnd = m_tabs.GetWindowFromIdx(m_curPage); // save pointer of window being deleted wxWindow* wnd = m_tabs.GetWindowFromIdx(page_idx); @@ -3219,7 +3245,7 @@ bool wxAuiNotebook::RemovePage(size_t page_idx) if (!FindTab(wnd, &ctrl, &ctrl_idx)) return false; - bool is_curpage = (m_curpage == (int)page_idx); + bool is_curpage = (m_curPage == (int)page_idx); bool is_active_in_split = ctrl->GetPage(ctrl_idx).active; @@ -3278,7 +3304,7 @@ bool wxAuiNotebook::RemovePage(size_t page_idx) RemoveEmptyTabFrames(); - m_curpage = wxNOT_FOUND; + m_curPage = wxNOT_FOUND; // set new active pane unless we're being destroyed anyhow if (new_active && !m_isBeingDeleted) @@ -3371,82 +3397,13 @@ wxBitmap wxAuiNotebook::GetPageBitmap(size_t page_idx) const // GetSelection() returns the index of the currently active page int wxAuiNotebook::GetSelection() const { - return m_curpage; + return m_curPage; } // SetSelection() sets the currently active page -size_t wxAuiNotebook::SetSelection(size_t new_page) +int wxAuiNotebook::SetSelection(size_t new_page) { - wxWindow* wnd = m_tabs.GetWindowFromIdx(new_page); - if (!wnd) - return m_curpage; - - // don't change the page unless necessary; - // however, clicking again on a tab should give it the focus. - if ((int)new_page == m_curpage) - { - wxAuiTabCtrl* ctrl; - int ctrl_idx; - if (FindTab(wnd, &ctrl, &ctrl_idx)) - { - if (FindFocus() != ctrl) - ctrl->SetFocus(); - } - return m_curpage; - } - - wxAuiNotebookEvent evt(wxEVT_COMMAND_AUINOTEBOOK_PAGE_CHANGING, m_windowId); - evt.SetSelection(new_page); - evt.SetOldSelection(m_curpage); - evt.SetEventObject(this); - if (!GetEventHandler()->ProcessEvent(evt) || evt.IsAllowed()) - { - int old_curpage = m_curpage; - m_curpage = new_page; - - // program allows the page change - evt.SetEventType(wxEVT_COMMAND_AUINOTEBOOK_PAGE_CHANGED); - (void)GetEventHandler()->ProcessEvent(evt); - - - wxAuiTabCtrl* ctrl; - int ctrl_idx; - if (FindTab(wnd, &ctrl, &ctrl_idx)) - { - m_tabs.SetActivePage(wnd); - - ctrl->SetActivePage(ctrl_idx); - DoSizing(); - ctrl->DoShowHide(); - - ctrl->MakeTabVisible(ctrl_idx, ctrl); - - // set fonts - wxAuiPaneInfoArray& all_panes = m_mgr.GetAllPanes(); - size_t i, pane_count = all_panes.GetCount(); - for (i = 0; i < pane_count; ++i) - { - wxAuiPaneInfo& pane = all_panes.Item(i); - if (pane.name == wxT("dummy")) - continue; - wxAuiTabCtrl* tabctrl = ((wxTabFrame*)pane.window)->m_tabs; - if (tabctrl != ctrl) - tabctrl->SetSelectedFont(m_normal_font); - else - tabctrl->SetSelectedFont(m_selected_font); - tabctrl->Refresh(); - } - - // Set the focus to the page if we're not currently focused on the tab. - // This is Firefox-like behaviour. - if (wnd->IsShownOnScreen() && FindFocus() != ctrl) - wnd->SetFocus(); - - return old_curpage; - } - } - - return m_curpage; + return DoModifySelection(new_page, true); } void wxAuiNotebook::SetSelectionToWindow(wxWindow *win) @@ -3507,13 +3464,13 @@ void wxAuiNotebook::DoSizing() // called to determine which control gets new windows being added wxAuiTabCtrl* wxAuiNotebook::GetActiveTabCtrl() { - if (m_curpage >= 0 && m_curpage < (int)m_tabs.GetPageCount()) + if (m_curPage >= 0 && m_curPage < (int)m_tabs.GetPageCount()) { wxAuiTabCtrl* ctrl; int idx; // find the tab ctrl with the current page - if (FindTab(m_tabs.GetPage(m_curpage).window, + if (FindTab(m_tabs.GetPage(m_curPage).window, &ctrl, &idx)) { return ctrl; @@ -3534,9 +3491,9 @@ wxAuiTabCtrl* wxAuiNotebook::GetActiveTabCtrl() // If there is no tabframe at all, create one wxTabFrame* tabframe = new wxTabFrame; - tabframe->SetTabCtrlHeight(m_tab_ctrl_height); + tabframe->SetTabCtrlHeight(m_tabCtrlHeight); tabframe->m_tabs = new wxAuiTabCtrl(this, - m_tab_id_counter++, + m_tabIdCounter++, wxDefaultPosition, wxDefaultSize, wxNO_BORDER|wxWANTS_CHARS); @@ -3617,9 +3574,9 @@ void wxAuiNotebook::Split(size_t page, int direction) // create a new tab frame wxTabFrame* new_tabs = new wxTabFrame; new_tabs->m_rect = wxRect(wxPoint(0,0), split_size); - new_tabs->SetTabCtrlHeight(m_tab_ctrl_height); + new_tabs->SetTabCtrlHeight(m_tabCtrlHeight); new_tabs->m_tabs = new wxAuiTabCtrl(this, - m_tab_id_counter++, + m_tabIdCounter++, wxDefaultPosition, wxDefaultSize, wxNO_BORDER|wxWANTS_CHARS); @@ -3629,31 +3586,31 @@ void wxAuiNotebook::Split(size_t page, int direction) // create a pane info structure with the information // about where the pane should be added - wxAuiPaneInfo pane_info = wxAuiPaneInfo().Bottom().CaptionVisible(false); + wxAuiPaneInfo paneInfo = wxAuiPaneInfo().Bottom().CaptionVisible(false); wxPoint mouse_pt; if (direction == wxLEFT) { - pane_info.Left(); + paneInfo.Left(); mouse_pt = wxPoint(0, cli_size.y/2); } else if (direction == wxRIGHT) { - pane_info.Right(); + paneInfo.Right(); mouse_pt = wxPoint(cli_size.x, cli_size.y/2); } else if (direction == wxTOP) { - pane_info.Top(); + paneInfo.Top(); mouse_pt = wxPoint(cli_size.x/2, 0); } else if (direction == wxBOTTOM) { - pane_info.Bottom(); + paneInfo.Bottom(); mouse_pt = wxPoint(cli_size.x/2, cli_size.y); } - m_mgr.AddPane(new_tabs, pane_info, mouse_pt); + m_mgr.AddPane(new_tabs, paneInfo, mouse_pt); m_mgr.Update(); // remove the page from the source tabs @@ -3681,7 +3638,7 @@ void wxAuiNotebook::Split(size_t page, int direction) dest_tabs->Refresh(); // force the set selection function reset the selection - m_curpage = -1; + m_curPage = -1; // set the active page to the one we just split off SetSelectionToPage(page_info); @@ -3718,7 +3675,7 @@ void wxAuiNotebook::OnTabBgDClick(wxAuiNotebookEvent& WXUNUSED(evt)) void wxAuiNotebook::OnTabBeginDrag(wxAuiNotebookEvent&) { - m_last_drag_x = 0; + m_lastDragX = 0; } void wxAuiNotebook::OnTabDragMotion(wxAuiNotebookEvent& evt) @@ -3757,10 +3714,10 @@ void wxAuiNotebook::OnTabDragMotion(wxAuiNotebookEvent& evt) // prevent jumpy drag if ((src_idx == dest_idx) || dest_idx == -1 || - (src_idx > dest_idx && m_last_drag_x <= pt.x) || - (src_idx < dest_idx && m_last_drag_x >= pt.x)) + (src_idx > dest_idx && m_lastDragX <= pt.x) || + (src_idx < dest_idx && m_lastDragX >= pt.x)) { - m_last_drag_x = pt.x; + m_lastDragX = pt.x; return; } @@ -3770,7 +3727,7 @@ void wxAuiNotebook::OnTabDragMotion(wxAuiNotebookEvent& evt) dest_tabs->SetActivePage((size_t)dest_idx); dest_tabs->DoShowHide(); dest_tabs->Refresh(); - m_last_drag_x = pt.x; + m_lastDragX = pt.x; } @@ -3846,7 +3803,7 @@ void wxAuiNotebook::OnTabDragMotion(wxAuiNotebookEvent& evt) } else { - m_mgr.DrawHintRect(m_dummy_wnd, client_pt, zero); + m_mgr.DrawHintRect(m_dummyWnd, client_pt, zero); } } @@ -4003,7 +3960,7 @@ void wxAuiNotebook::OnTabEndDrag(wxAuiNotebookEvent& evt) else { wxPoint zero(0,0); - wxRect rect = m_mgr.CalculateHintRect(m_dummy_wnd, + wxRect rect = m_mgr.CalculateHintRect(m_dummyWnd, mouse_client_pt, zero); if (rect.IsEmpty()) @@ -4015,9 +3972,9 @@ void wxAuiNotebook::OnTabEndDrag(wxAuiNotebookEvent& evt) // If there is no tabframe at all, create one wxTabFrame* new_tabs = new wxTabFrame; new_tabs->m_rect = wxRect(wxPoint(0,0), CalculateNewSplitSize()); - new_tabs->SetTabCtrlHeight(m_tab_ctrl_height); + new_tabs->SetTabCtrlHeight(m_tabCtrlHeight); new_tabs->m_tabs = new wxAuiTabCtrl(this, - m_tab_id_counter++, + m_tabIdCounter++, wxDefaultPosition, wxDefaultSize, wxNO_BORDER|wxWANTS_CHARS); @@ -4061,7 +4018,7 @@ void wxAuiNotebook::OnTabEndDrag(wxAuiNotebookEvent& evt) dest_tabs->Refresh(); // force the set selection function reset the selection - m_curpage = -1; + m_curPage = -1; // set the active page to the one we just split off SetSelectionToPage(page_info); @@ -4079,6 +4036,18 @@ void wxAuiNotebook::OnTabEndDrag(wxAuiNotebookEvent& evt) +void wxAuiNotebook::OnTabCancelDrag(wxAuiNotebookEvent& command_evt) +{ + wxAuiNotebookEvent& evt = (wxAuiNotebookEvent&)command_evt; + + m_mgr.HideHint(); + + wxAuiTabCtrl* src_tabs = (wxAuiTabCtrl*)evt.GetEventObject(); + wxCHECK_RET( src_tabs, wxT("no source object?") ); + + src_tabs->SetCursor(wxCursor(wxCURSOR_ARROW)); +} + wxAuiTabCtrl* wxAuiNotebook::GetTabCtrlFromPoint(const wxPoint& pt) { // if we've just removed the last tab from the source @@ -4198,7 +4167,7 @@ void wxAuiNotebook::OnChildFocusNotebook(wxChildFocusEvent& evt) // change the tab selection to the child // which was focused int idx = m_tabs.GetIdxFromWindow(evt.GetWindow()); - if (idx != -1 && idx != m_curpage) + if (idx != -1 && idx != m_curPage) { SetSelection(idx); } @@ -4402,14 +4371,14 @@ void wxAuiNotebook::OnTabRightUp(wxAuiNotebookEvent& evt) // Sets the normal font void wxAuiNotebook::SetNormalFont(const wxFont& font) { - m_normal_font = font; + m_normalFont = font; GetArtProvider()->SetNormalFont(font); } // Sets the selected tab font void wxAuiNotebook::SetSelectedFont(const wxFont& font) { - m_selected_font = font; + m_selectedFont = font; GetArtProvider()->SetSelectedFont(font); } @@ -4438,7 +4407,7 @@ bool wxAuiNotebook::SetFont(const wxFont& font) // Gets the tab control height int wxAuiNotebook::GetTabCtrlHeight() const { - return m_tab_ctrl_height; + return m_tabCtrlHeight; } // Gets the height of the notebook for a given page height @@ -4507,4 +4476,163 @@ void wxAuiNotebook::Thaw() wxControl::Thaw(); } +void wxAuiNotebook::SetPageSize (const wxSize& WXUNUSED(size)) +{ + wxFAIL_MSG("Not implemented for wxAuiNotebook"); +} + +int wxAuiNotebook::HitTest (const wxPoint& WXUNUSED(pt), long* WXUNUSED(flags)) const +{ + wxFAIL_MSG("Not implemented for wxAuiNotebook"); + return wxNOT_FOUND; +} + +int wxAuiNotebook::GetPageImage(size_t WXUNUSED(n)) const +{ + wxFAIL_MSG("Not implemented for wxAuiNotebook"); + return -1; +} + +bool wxAuiNotebook::SetPageImage(size_t n, int imageId) +{ + return SetPageBitmap(n, GetImageList()->GetBitmap(imageId)); +} + +wxWindow* wxAuiNotebook::GetCurrentPage () const +{ + const int sel = GetSelection(); + + return sel == wxNOT_FOUND ? NULL : GetPage(sel); +} + +int wxAuiNotebook::ChangeSelection(size_t n) +{ + return DoModifySelection(n, false); +} + +bool wxAuiNotebook::AddPage(wxWindow *page, const wxString &text, bool select, + int imageId) +{ + if(HasImageList()) + { + return AddPage(page, text, select, GetImageList()->GetBitmap(imageId)); + } + else + { + return AddPage(page, text, select, wxNullBitmap); + } +} + +bool wxAuiNotebook::DeleteAllPages() +{ + size_t count = GetPageCount(); + for(size_t i = 0; i < count; i++) + { + DeletePage(0); + } + return true; +} + +bool wxAuiNotebook::InsertPage(size_t index, wxWindow *page, + const wxString &text, bool select, + int imageId) +{ + if(HasImageList()) + { + return InsertPage(index, page, text, select, + GetImageList()->GetBitmap(imageId)); + } + else + { + return InsertPage(index, page, text, select, wxNullBitmap); + } +} + +int wxAuiNotebook::DoModifySelection(size_t n, bool events) +{ + wxWindow* wnd = m_tabs.GetWindowFromIdx(n); + if (!wnd) + return m_curPage; + + // don't change the page unless necessary; + // however, clicking again on a tab should give it the focus. + if ((int)n == m_curPage) + { + wxAuiTabCtrl* ctrl; + int ctrl_idx; + if (FindTab(wnd, &ctrl, &ctrl_idx)) + { + if (FindFocus() != ctrl) + ctrl->SetFocus(); + } + return m_curPage; + } + + bool vetoed = false; + + wxAuiNotebookEvent evt(wxEVT_COMMAND_AUINOTEBOOK_PAGE_CHANGING, m_windowId); + + if(events) + { + evt.SetSelection(n); + evt.SetOldSelection(m_curPage); + evt.SetEventObject(this); + GetEventHandler()->ProcessEvent(evt); + vetoed = !evt.IsAllowed(); + } + + if (!vetoed) + { + int old_curpage = m_curPage; + m_curPage = n; + + // program allows the page change + if(events) + { + evt.SetEventType(wxEVT_COMMAND_AUINOTEBOOK_PAGE_CHANGED); + (void)GetEventHandler()->ProcessEvent(evt); + } + + + wxAuiTabCtrl* ctrl; + int ctrl_idx; + if (FindTab(wnd, &ctrl, &ctrl_idx)) + { + m_tabs.SetActivePage(wnd); + + ctrl->SetActivePage(ctrl_idx); + DoSizing(); + ctrl->DoShowHide(); + + ctrl->MakeTabVisible(ctrl_idx, ctrl); + + // set fonts + wxAuiPaneInfoArray& all_panes = m_mgr.GetAllPanes(); + size_t i, pane_count = all_panes.GetCount(); + for (i = 0; i < pane_count; ++i) + { + wxAuiPaneInfo& pane = all_panes.Item(i); + if (pane.name == wxT("dummy")) + continue; + wxAuiTabCtrl* tabctrl = ((wxTabFrame*)pane.window)->m_tabs; + if (tabctrl != ctrl) + tabctrl->SetSelectedFont(m_normalFont); + else + tabctrl->SetSelectedFont(m_selectedFont); + tabctrl->Refresh(); + } + + // Set the focus to the page if we're not currently focused on the tab. + // This is Firefox-like behaviour. + if (wnd->IsShownOnScreen() && FindFocus() != ctrl) + wnd->SetFocus(); + + return old_curpage; + } + } + + return m_curPage; +} + + #endif // wxUSE_AUI diff --git a/Externals/wxWidgets3/src/aui/dockart.cpp b/Externals/wxWidgets3/src/aui/dockart.cpp index b84d2bb325..74dac023ce 100644 --- a/Externals/wxWidgets3/src/aui/dockart.cpp +++ b/Externals/wxWidgets3/src/aui/dockart.cpp @@ -4,7 +4,7 @@ // Author: Benjamin I. Williams // Modified by: // Created: 2005-05-17 -// RCS-ID: $Id: dockart.cpp 66670 2011-01-12 13:39:36Z VZ $ +// RCS-ID: $Id: dockart.cpp 69590 2011-10-30 14:20:03Z VZ $ // Copyright: (C) Copyright 2005-2006, Kirix Corporation, All Rights Reserved // Licence: wxWindows Library Licence, Version 3.1 /////////////////////////////////////////////////////////////////////////////// @@ -43,6 +43,11 @@ #ifdef __WXGTK__ #include #include "wx/renderer.h" +#if GTK_CHECK_VERSION(2,0,0) + #include "wx/gtk/private/gtk2-compat.h" +#else + #define gtk_widget_is_drawable GTK_WIDGET_DRAWABLE +#endif #endif @@ -147,64 +152,64 @@ wxString wxAuiChopText(wxDC& dc, const wxString& text, int max_size) wxAuiDefaultDockArt::wxAuiDefaultDockArt() { #if defined( __WXMAC__ ) && wxOSX_USE_COCOA_OR_CARBON - wxColor base_colour = wxColour( wxMacCreateCGColorFromHITheme(kThemeBrushToolbarBackground)); + wxColor baseColour = wxColour( wxMacCreateCGColorFromHITheme(kThemeBrushToolbarBackground)); #else - wxColor base_colour = wxSystemSettings::GetColour(wxSYS_COLOUR_3DFACE); + wxColor baseColour = wxSystemSettings::GetColour(wxSYS_COLOUR_3DFACE); #endif - // the base_colour is too pale to use as our base colour, + // the baseColour is too pale to use as our base colour, // so darken it a bit -- - if ((255-base_colour.Red()) + - (255-base_colour.Green()) + - (255-base_colour.Blue()) < 60) + if ((255-baseColour.Red()) + + (255-baseColour.Green()) + + (255-baseColour.Blue()) < 60) { - base_colour = base_colour.ChangeLightness(92); + baseColour = baseColour.ChangeLightness(92); } - m_base_colour = base_colour; - wxColor darker1_colour = base_colour.ChangeLightness(85); - wxColor darker2_colour = base_colour.ChangeLightness(75); - wxColor darker3_colour = base_colour.ChangeLightness(60); - //wxColor darker4_colour = base_colour.ChangeLightness(50); - wxColor darker5_colour = base_colour.ChangeLightness(40); + m_baseColour = baseColour; + wxColor darker1Colour = baseColour.ChangeLightness(85); + wxColor darker2Colour = baseColour.ChangeLightness(75); + wxColor darker3Colour = baseColour.ChangeLightness(60); + //wxColor darker4Colour = baseColour.ChangeLightness(50); + wxColor darker5Colour = baseColour.ChangeLightness(40); - m_active_caption_colour = wxSystemSettings::GetColour(wxSYS_COLOUR_HIGHLIGHT); - m_active_caption_gradient_colour = wxAuiLightContrastColour(wxSystemSettings::GetColour(wxSYS_COLOUR_HIGHLIGHT)); - m_active_caption_text_colour = wxSystemSettings::GetColour(wxSYS_COLOUR_HIGHLIGHTTEXT); - m_inactive_caption_colour = darker1_colour; - m_inactive_caption_gradient_colour = base_colour.ChangeLightness(97); - m_inactive_caption_text_colour = *wxBLACK; + m_activeCaptionColour = wxSystemSettings::GetColour(wxSYS_COLOUR_HIGHLIGHT); + m_activeCaptionGradientColour = wxAuiLightContrastColour(wxSystemSettings::GetColour(wxSYS_COLOUR_HIGHLIGHT)); + m_activeCaptionTextColour = wxSystemSettings::GetColour(wxSYS_COLOUR_HIGHLIGHTTEXT); + m_inactiveCaptionColour = darker1Colour; + m_inactiveCaptionGradientColour = baseColour.ChangeLightness(97); + m_inactiveCaptionTextColour = *wxBLACK; - m_sash_brush = wxBrush(base_colour); - m_background_brush = wxBrush(base_colour); - m_gripper_brush = wxBrush(base_colour); + m_sashBrush = wxBrush(baseColour); + m_backgroundBrush = wxBrush(baseColour); + m_gripperBrush = wxBrush(baseColour); - m_border_pen = wxPen(darker2_colour); - m_gripper_pen1 = wxPen(darker5_colour); - m_gripper_pen2 = wxPen(darker3_colour); - m_gripper_pen3 = *wxWHITE_PEN; + m_borderPen = wxPen(darker2Colour); + m_gripperPen1 = wxPen(darker5Colour); + m_gripperPen2 = wxPen(darker3Colour); + m_gripperPen3 = *wxWHITE_PEN; #ifdef __WXMAC__ - m_caption_font = *wxSMALL_FONT; + m_captionFont = *wxSMALL_FONT; #else - m_caption_font = wxFont(8, wxDEFAULT, wxNORMAL, wxNORMAL, FALSE); + m_captionFont = wxFont(8, wxDEFAULT, wxNORMAL, wxNORMAL, FALSE); #endif // default metric values #if defined( __WXMAC__ ) && wxOSX_USE_COCOA_OR_CARBON SInt32 height; GetThemeMetric( kThemeMetricSmallPaneSplitterHeight , &height ); - m_sash_size = height; + m_sashSize = height; #elif defined(__WXGTK__) - m_sash_size = wxRendererNative::Get().GetSplitterParams(NULL).widthSash; + m_sashSize = wxRendererNative::Get().GetSplitterParams(NULL).widthSash; #else - m_sash_size = 4; + m_sashSize = 4; #endif - m_caption_size = 17; - m_border_size = 1; - m_button_size = 14; - m_gripper_size = 9; - m_gradient_type = wxAUI_GRADIENT_VERTICAL; + m_captionSize = 17; + m_borderSize = 1; + m_buttonSize = 14; + m_gripperSize = 9; + m_gradientType = wxAUI_GRADIENT_VERTICAL; InitBitmaps(); } @@ -253,43 +258,43 @@ wxAuiDefaultDockArt::InitBitmaps () 0x7f,0xff,0xff,0xff,0xff,0xff,0xff,0xff}; #ifdef __WXMAC__ - m_inactive_close_bitmap = wxAuiBitmapFromBits(close_bits, 16, 16, *wxWHITE); - m_active_close_bitmap = wxAuiBitmapFromBits(close_bits, 16, 16, *wxWHITE ); + m_inactiveCloseBitmap = wxAuiBitmapFromBits(close_bits, 16, 16, *wxWHITE); + m_activeCloseBitmap = wxAuiBitmapFromBits(close_bits, 16, 16, *wxWHITE ); #else - m_inactive_close_bitmap = wxAuiBitmapFromBits(close_bits, 16, 16, m_inactive_caption_text_colour); - m_active_close_bitmap = wxAuiBitmapFromBits(close_bits, 16, 16, m_active_caption_text_colour); + m_inactiveCloseBitmap = wxAuiBitmapFromBits(close_bits, 16, 16, m_inactiveCaptionTextColour); + m_activeCloseBitmap = wxAuiBitmapFromBits(close_bits, 16, 16, m_activeCaptionTextColour); #endif #ifdef __WXMAC__ - m_inactive_maximize_bitmap = wxAuiBitmapFromBits(maximize_bits, 16, 16, *wxWHITE); - m_active_maximize_bitmap = wxAuiBitmapFromBits(maximize_bits, 16, 16, *wxWHITE ); + m_inactiveMaximizeBitmap = wxAuiBitmapFromBits(maximize_bits, 16, 16, *wxWHITE); + m_activeMaximizeBitmap = wxAuiBitmapFromBits(maximize_bits, 16, 16, *wxWHITE ); #else - m_inactive_maximize_bitmap = wxAuiBitmapFromBits(maximize_bits, 16, 16, m_inactive_caption_text_colour); - m_active_maximize_bitmap = wxAuiBitmapFromBits(maximize_bits, 16, 16, m_active_caption_text_colour); + m_inactiveMaximizeBitmap = wxAuiBitmapFromBits(maximize_bits, 16, 16, m_inactiveCaptionTextColour); + m_activeMaximizeBitmap = wxAuiBitmapFromBits(maximize_bits, 16, 16, m_activeCaptionTextColour); #endif #ifdef __WXMAC__ - m_inactive_restore_bitmap = wxAuiBitmapFromBits(restore_bits, 16, 16, *wxWHITE); - m_active_restore_bitmap = wxAuiBitmapFromBits(restore_bits, 16, 16, *wxWHITE ); + m_inactiveRestoreBitmap = wxAuiBitmapFromBits(restore_bits, 16, 16, *wxWHITE); + m_activeRestoreBitmap = wxAuiBitmapFromBits(restore_bits, 16, 16, *wxWHITE ); #else - m_inactive_restore_bitmap = wxAuiBitmapFromBits(restore_bits, 16, 16, m_inactive_caption_text_colour); - m_active_restore_bitmap = wxAuiBitmapFromBits(restore_bits, 16, 16, m_active_caption_text_colour); + m_inactiveRestoreBitmap = wxAuiBitmapFromBits(restore_bits, 16, 16, m_inactiveCaptionTextColour); + m_activeRestoreBitmap = wxAuiBitmapFromBits(restore_bits, 16, 16, m_activeCaptionTextColour); #endif - m_inactive_pin_bitmap = wxAuiBitmapFromBits(pin_bits, 16, 16, m_inactive_caption_text_colour); - m_active_pin_bitmap = wxAuiBitmapFromBits(pin_bits, 16, 16, m_active_caption_text_colour); + m_inactivePinBitmap = wxAuiBitmapFromBits(pin_bits, 16, 16, m_inactiveCaptionTextColour); + m_activePinBitmap = wxAuiBitmapFromBits(pin_bits, 16, 16, m_activeCaptionTextColour); } int wxAuiDefaultDockArt::GetMetric(int id) { switch (id) { - case wxAUI_DOCKART_SASH_SIZE: return m_sash_size; - case wxAUI_DOCKART_CAPTION_SIZE: return m_caption_size; - case wxAUI_DOCKART_GRIPPER_SIZE: return m_gripper_size; - case wxAUI_DOCKART_PANE_BORDER_SIZE: return m_border_size; - case wxAUI_DOCKART_PANE_BUTTON_SIZE: return m_button_size; - case wxAUI_DOCKART_GRADIENT_TYPE: return m_gradient_type; + case wxAUI_DOCKART_SASH_SIZE: return m_sashSize; + case wxAUI_DOCKART_CAPTION_SIZE: return m_captionSize; + case wxAUI_DOCKART_GRIPPER_SIZE: return m_gripperSize; + case wxAUI_DOCKART_PANE_BORDER_SIZE: return m_borderSize; + case wxAUI_DOCKART_PANE_BUTTON_SIZE: return m_buttonSize; + case wxAUI_DOCKART_GRADIENT_TYPE: return m_gradientType; default: wxFAIL_MSG(wxT("Invalid Metric Ordinal")); break; } @@ -300,12 +305,12 @@ void wxAuiDefaultDockArt::SetMetric(int id, int new_val) { switch (id) { - case wxAUI_DOCKART_SASH_SIZE: m_sash_size = new_val; break; - case wxAUI_DOCKART_CAPTION_SIZE: m_caption_size = new_val; break; - case wxAUI_DOCKART_GRIPPER_SIZE: m_gripper_size = new_val; break; - case wxAUI_DOCKART_PANE_BORDER_SIZE: m_border_size = new_val; break; - case wxAUI_DOCKART_PANE_BUTTON_SIZE: m_button_size = new_val; break; - case wxAUI_DOCKART_GRADIENT_TYPE: m_gradient_type = new_val; break; + case wxAUI_DOCKART_SASH_SIZE: m_sashSize = new_val; break; + case wxAUI_DOCKART_CAPTION_SIZE: m_captionSize = new_val; break; + case wxAUI_DOCKART_GRIPPER_SIZE: m_gripperSize = new_val; break; + case wxAUI_DOCKART_PANE_BORDER_SIZE: m_borderSize = new_val; break; + case wxAUI_DOCKART_PANE_BUTTON_SIZE: m_buttonSize = new_val; break; + case wxAUI_DOCKART_GRADIENT_TYPE: m_gradientType = new_val; break; default: wxFAIL_MSG(wxT("Invalid Metric Ordinal")); break; } } @@ -314,16 +319,16 @@ wxColour wxAuiDefaultDockArt::GetColour(int id) { switch (id) { - case wxAUI_DOCKART_BACKGROUND_COLOUR: return m_background_brush.GetColour(); - case wxAUI_DOCKART_SASH_COLOUR: return m_sash_brush.GetColour(); - case wxAUI_DOCKART_INACTIVE_CAPTION_COLOUR: return m_inactive_caption_colour; - case wxAUI_DOCKART_INACTIVE_CAPTION_GRADIENT_COLOUR: return m_inactive_caption_gradient_colour; - case wxAUI_DOCKART_INACTIVE_CAPTION_TEXT_COLOUR: return m_inactive_caption_text_colour; - case wxAUI_DOCKART_ACTIVE_CAPTION_COLOUR: return m_active_caption_colour; - case wxAUI_DOCKART_ACTIVE_CAPTION_GRADIENT_COLOUR: return m_active_caption_gradient_colour; - case wxAUI_DOCKART_ACTIVE_CAPTION_TEXT_COLOUR: return m_active_caption_text_colour; - case wxAUI_DOCKART_BORDER_COLOUR: return m_border_pen.GetColour(); - case wxAUI_DOCKART_GRIPPER_COLOUR: return m_gripper_brush.GetColour(); + case wxAUI_DOCKART_BACKGROUND_COLOUR: return m_backgroundBrush.GetColour(); + case wxAUI_DOCKART_SASH_COLOUR: return m_sashBrush.GetColour(); + case wxAUI_DOCKART_INACTIVE_CAPTION_COLOUR: return m_inactiveCaptionColour; + case wxAUI_DOCKART_INACTIVE_CAPTION_GRADIENT_COLOUR: return m_inactiveCaptionGradientColour; + case wxAUI_DOCKART_INACTIVE_CAPTION_TEXT_COLOUR: return m_inactiveCaptionTextColour; + case wxAUI_DOCKART_ACTIVE_CAPTION_COLOUR: return m_activeCaptionColour; + case wxAUI_DOCKART_ACTIVE_CAPTION_GRADIENT_COLOUR: return m_activeCaptionGradientColour; + case wxAUI_DOCKART_ACTIVE_CAPTION_TEXT_COLOUR: return m_activeCaptionTextColour; + case wxAUI_DOCKART_BORDER_COLOUR: return m_borderPen.GetColour(); + case wxAUI_DOCKART_GRIPPER_COLOUR: return m_gripperBrush.GetColour(); default: wxFAIL_MSG(wxT("Invalid Metric Ordinal")); break; } @@ -334,19 +339,19 @@ void wxAuiDefaultDockArt::SetColour(int id, const wxColor& colour) { switch (id) { - case wxAUI_DOCKART_BACKGROUND_COLOUR: m_background_brush.SetColour(colour); break; - case wxAUI_DOCKART_SASH_COLOUR: m_sash_brush.SetColour(colour); break; - case wxAUI_DOCKART_INACTIVE_CAPTION_COLOUR: m_inactive_caption_colour = colour; break; - case wxAUI_DOCKART_INACTIVE_CAPTION_GRADIENT_COLOUR: m_inactive_caption_gradient_colour = colour; break; - case wxAUI_DOCKART_INACTIVE_CAPTION_TEXT_COLOUR: m_inactive_caption_text_colour = colour; break; - case wxAUI_DOCKART_ACTIVE_CAPTION_COLOUR: m_active_caption_colour = colour; break; - case wxAUI_DOCKART_ACTIVE_CAPTION_GRADIENT_COLOUR: m_active_caption_gradient_colour = colour; break; - case wxAUI_DOCKART_ACTIVE_CAPTION_TEXT_COLOUR: m_active_caption_text_colour = colour; break; - case wxAUI_DOCKART_BORDER_COLOUR: m_border_pen.SetColour(colour); break; + case wxAUI_DOCKART_BACKGROUND_COLOUR: m_backgroundBrush.SetColour(colour); break; + case wxAUI_DOCKART_SASH_COLOUR: m_sashBrush.SetColour(colour); break; + case wxAUI_DOCKART_INACTIVE_CAPTION_COLOUR: m_inactiveCaptionColour = colour; break; + case wxAUI_DOCKART_INACTIVE_CAPTION_GRADIENT_COLOUR: m_inactiveCaptionGradientColour = colour; break; + case wxAUI_DOCKART_INACTIVE_CAPTION_TEXT_COLOUR: m_inactiveCaptionTextColour = colour; break; + case wxAUI_DOCKART_ACTIVE_CAPTION_COLOUR: m_activeCaptionColour = colour; break; + case wxAUI_DOCKART_ACTIVE_CAPTION_GRADIENT_COLOUR: m_activeCaptionGradientColour = colour; break; + case wxAUI_DOCKART_ACTIVE_CAPTION_TEXT_COLOUR: m_activeCaptionTextColour = colour; break; + case wxAUI_DOCKART_BORDER_COLOUR: m_borderPen.SetColour(colour); break; case wxAUI_DOCKART_GRIPPER_COLOUR: - m_gripper_brush.SetColour(colour); - m_gripper_pen1.SetColour(colour.ChangeLightness(40)); - m_gripper_pen2.SetColour(colour.ChangeLightness(60)); + m_gripperBrush.SetColour(colour); + m_gripperPen1.SetColour(colour.ChangeLightness(40)); + m_gripperPen2.SetColour(colour.ChangeLightness(60)); break; default: wxFAIL_MSG(wxT("Invalid Metric Ordinal")); break; } @@ -357,13 +362,13 @@ void wxAuiDefaultDockArt::SetColour(int id, const wxColor& colour) void wxAuiDefaultDockArt::SetFont(int id, const wxFont& font) { if (id == wxAUI_DOCKART_CAPTION_FONT) - m_caption_font = font; + m_captionFont = font; } wxFont wxAuiDefaultDockArt::GetFont(int id) { if (id == wxAUI_DOCKART_CAPTION_FONT) - return m_caption_font; + return m_captionFont; return wxNullFont; } @@ -387,7 +392,7 @@ void wxAuiDefaultDockArt::DrawSash(wxDC& dc, wxWindow *window, int orientation, #elif defined(__WXGTK__) // clear out the rectangle first dc.SetPen(*wxTRANSPARENT_PEN); - dc.SetBrush(m_sash_brush); + dc.SetBrush(m_sashBrush); dc.DrawRectangle(rect.x, rect.y, rect.width, rect.height); #if 0 @@ -396,7 +401,7 @@ void wxAuiDefaultDockArt::DrawSash(wxDC& dc, wxWindow *window, int orientation, { gdk_rect.x = rect.x; gdk_rect.y = rect.y; - gdk_rect.width = m_sash_size; + gdk_rect.width = m_sashSize; gdk_rect.height = rect.height; } else @@ -404,17 +409,17 @@ void wxAuiDefaultDockArt::DrawSash(wxDC& dc, wxWindow *window, int orientation, gdk_rect.x = rect.x; gdk_rect.y = rect.y; gdk_rect.width = rect.width; - gdk_rect.height = m_sash_size; + gdk_rect.height = m_sashSize; } #endif if (!window) return; if (!window->m_wxwindow) return; - if (!GTK_WIDGET_DRAWABLE(window->m_wxwindow)) return; + if (!gtk_widget_is_drawable(window->m_wxwindow)) return; gtk_paint_handle ( - window->m_wxwindow->style, + gtk_widget_get_style(window->m_wxwindow), window->GTKGetDrawingWindow(), // flags & wxCONTROL_CURRENT ? GTK_STATE_PRELIGHT : GTK_STATE_NORMAL, GTK_STATE_NORMAL, @@ -433,7 +438,7 @@ void wxAuiDefaultDockArt::DrawSash(wxDC& dc, wxWindow *window, int orientation, wxUnusedVar(window); wxUnusedVar(orientation); dc.SetPen(*wxTRANSPARENT_PEN); - dc.SetBrush(m_sash_brush); + dc.SetBrush(m_sashBrush); dc.DrawRectangle(rect.x, rect.y, rect.width, rect.height); #endif } @@ -448,14 +453,14 @@ void wxAuiDefaultDockArt::DrawBackground(wxDC& dc, wxWindow *WXUNUSED(window), i dc.SetBrush(*wxWHITE_BRUSH) ; dc.DrawRectangle(rect.x, rect.y, rect.width, rect.height); #endif - dc.SetBrush(m_background_brush); + dc.SetBrush(m_backgroundBrush); dc.DrawRectangle(rect.x, rect.y, rect.width, rect.height); } void wxAuiDefaultDockArt::DrawBorder(wxDC& dc, wxWindow *WXUNUSED(window), const wxRect& _rect, wxAuiPaneInfo& pane) { - dc.SetPen(m_border_pen); + dc.SetPen(m_borderPen); dc.SetBrush(*wxTRANSPARENT_BRUSH); wxRect rect = _rect; @@ -468,7 +473,7 @@ void wxAuiDefaultDockArt::DrawBorder(wxDC& dc, wxWindow *WXUNUSED(window), const dc.SetPen(*wxWHITE_PEN); dc.DrawLine(rect.x, rect.y, rect.x+rect.width, rect.y); dc.DrawLine(rect.x, rect.y, rect.x, rect.y+rect.height); - dc.SetPen(m_border_pen); + dc.SetPen(m_borderPen); dc.DrawLine(rect.x, rect.y+rect.height-1, rect.x+rect.width, rect.y+rect.height-1); dc.DrawLine(rect.x+rect.width-1, rect.y, @@ -489,12 +494,12 @@ void wxAuiDefaultDockArt::DrawBorder(wxDC& dc, wxWindow *WXUNUSED(window), const void wxAuiDefaultDockArt::DrawCaptionBackground(wxDC& dc, const wxRect& rect, bool active) { - if (m_gradient_type == wxAUI_GRADIENT_NONE) + if (m_gradientType == wxAUI_GRADIENT_NONE) { if (active) - dc.SetBrush(wxBrush(m_active_caption_colour)); + dc.SetBrush(wxBrush(m_activeCaptionColour)); else - dc.SetBrush(wxBrush(m_inactive_caption_colour)); + dc.SetBrush(wxBrush(m_inactiveCaptionColour)); dc.DrawRectangle(rect.x, rect.y, rect.width, rect.height); } @@ -505,15 +510,15 @@ void wxAuiDefaultDockArt::DrawCaptionBackground(wxDC& dc, const wxRect& rect, bo // on mac the gradients are expected to become darker from the top #ifdef __WXMAC__ DrawGradientRectangle(dc, rect, - m_active_caption_colour, - m_active_caption_gradient_colour, - m_gradient_type); + m_activeCaptionColour, + m_activeCaptionGradientColour, + m_gradientType); #else // on other platforms, active gradients become lighter at the top DrawGradientRectangle(dc, rect, - m_active_caption_gradient_colour, - m_active_caption_colour, - m_gradient_type); + m_activeCaptionGradientColour, + m_activeCaptionColour, + m_gradientType); #endif } else @@ -521,15 +526,15 @@ void wxAuiDefaultDockArt::DrawCaptionBackground(wxDC& dc, const wxRect& rect, bo #ifdef __WXMAC__ // on mac the gradients are expected to become darker from the top DrawGradientRectangle(dc, rect, - m_inactive_caption_gradient_colour, - m_inactive_caption_colour, - m_gradient_type); + m_inactiveCaptionGradientColour, + m_inactiveCaptionColour, + m_gradientType); #else // on other platforms, inactive gradients become lighter at the bottom DrawGradientRectangle(dc, rect, - m_inactive_caption_colour, - m_inactive_caption_gradient_colour, - m_gradient_type); + m_inactiveCaptionColour, + m_inactiveCaptionGradientColour, + m_gradientType); #endif } } @@ -542,7 +547,7 @@ void wxAuiDefaultDockArt::DrawCaption(wxDC& dc, wxWindow *WXUNUSED(window), wxAuiPaneInfo& pane) { dc.SetPen(*wxTRANSPARENT_PEN); - dc.SetFont(m_caption_font); + dc.SetFont(m_captionFont); DrawCaptionBackground(dc, rect, (pane.state & wxAuiPaneInfo::optionActive)?true:false); @@ -556,9 +561,9 @@ void wxAuiDefaultDockArt::DrawCaption(wxDC& dc, wxWindow *WXUNUSED(window), } if (pane.state & wxAuiPaneInfo::optionActive) - dc.SetTextForeground(m_active_caption_text_colour); + dc.SetTextForeground(m_activeCaptionTextColour); else - dc.SetTextForeground(m_inactive_caption_text_colour); + dc.SetTextForeground(m_inactiveCaptionTextColour); wxCoord w,h; @@ -568,11 +573,11 @@ void wxAuiDefaultDockArt::DrawCaption(wxDC& dc, wxWindow *WXUNUSED(window), clip_rect.width -= 3; // text offset clip_rect.width -= 2; // button padding if (pane.HasCloseButton()) - clip_rect.width -= m_button_size; + clip_rect.width -= m_buttonSize; if (pane.HasPinButton()) - clip_rect.width -= m_button_size; + clip_rect.width -= m_buttonSize; if (pane.HasMaximizeButton()) - clip_rect.width -= m_button_size; + clip_rect.width -= m_buttonSize; wxString draw_text = wxAuiChopText(dc, text, clip_rect.width); @@ -595,7 +600,7 @@ void wxAuiDefaultDockArt::DrawGripper(wxDC& dc, wxWindow *WXUNUSED(window), wxAuiPaneInfo& pane) { dc.SetPen(*wxTRANSPARENT_PEN); - dc.SetBrush(m_gripper_brush); + dc.SetBrush(m_gripperBrush); dc.DrawRectangle(rect.x, rect.y, rect.width,rect.height); @@ -604,12 +609,12 @@ void wxAuiDefaultDockArt::DrawGripper(wxDC& dc, wxWindow *WXUNUSED(window), int y = 5; while (1) { - dc.SetPen(m_gripper_pen1); + dc.SetPen(m_gripperPen1); dc.DrawPoint(rect.x+3, rect.y+y); - dc.SetPen(m_gripper_pen2); + dc.SetPen(m_gripperPen2); dc.DrawPoint(rect.x+3, rect.y+y+1); dc.DrawPoint(rect.x+4, rect.y+y); - dc.SetPen(m_gripper_pen3); + dc.SetPen(m_gripperPen3); dc.DrawPoint(rect.x+5, rect.y+y+1); dc.DrawPoint(rect.x+5, rect.y+y+2); dc.DrawPoint(rect.x+4, rect.y+y+2); @@ -624,12 +629,12 @@ void wxAuiDefaultDockArt::DrawGripper(wxDC& dc, wxWindow *WXUNUSED(window), int x = 5; while (1) { - dc.SetPen(m_gripper_pen1); + dc.SetPen(m_gripperPen1); dc.DrawPoint(rect.x+x, rect.y+3); - dc.SetPen(m_gripper_pen2); + dc.SetPen(m_gripperPen2); dc.DrawPoint(rect.x+x+1, rect.y+3); dc.DrawPoint(rect.x+x, rect.y+4); - dc.SetPen(m_gripper_pen3); + dc.SetPen(m_gripperPen3); dc.DrawPoint(rect.x+x+1, rect.y+5); dc.DrawPoint(rect.x+x+2, rect.y+5); dc.DrawPoint(rect.x+x+2, rect.y+4); @@ -655,30 +660,30 @@ void wxAuiDefaultDockArt::DrawPaneButton(wxDC& dc, wxWindow *WXUNUSED(window), default: case wxAUI_BUTTON_CLOSE: if (pane.state & wxAuiPaneInfo::optionActive) - bmp = m_active_close_bitmap; + bmp = m_activeCloseBitmap; else - bmp = m_inactive_close_bitmap; + bmp = m_inactiveCloseBitmap; break; case wxAUI_BUTTON_PIN: if (pane.state & wxAuiPaneInfo::optionActive) - bmp = m_active_pin_bitmap; + bmp = m_activePinBitmap; else - bmp = m_inactive_pin_bitmap; + bmp = m_inactivePinBitmap; break; case wxAUI_BUTTON_MAXIMIZE_RESTORE: if (pane.IsMaximized()) { if (pane.state & wxAuiPaneInfo::optionActive) - bmp = m_active_restore_bitmap; + bmp = m_activeRestoreBitmap; else - bmp = m_inactive_restore_bitmap; + bmp = m_inactiveRestoreBitmap; } else { if (pane.state & wxAuiPaneInfo::optionActive) - bmp = m_active_maximize_bitmap; + bmp = m_activeMaximizeBitmap; else - bmp = m_inactive_maximize_bitmap; + bmp = m_inactiveMaximizeBitmap; } break; } @@ -702,13 +707,13 @@ void wxAuiDefaultDockArt::DrawPaneButton(wxDC& dc, wxWindow *WXUNUSED(window), { if (pane.state & wxAuiPaneInfo::optionActive) { - dc.SetBrush(wxBrush(m_active_caption_colour.ChangeLightness(120))); - dc.SetPen(wxPen(m_active_caption_colour.ChangeLightness(70))); + dc.SetBrush(wxBrush(m_activeCaptionColour.ChangeLightness(120))); + dc.SetPen(wxPen(m_activeCaptionColour.ChangeLightness(70))); } else { - dc.SetBrush(wxBrush(m_inactive_caption_colour.ChangeLightness(120))); - dc.SetPen(wxPen(m_inactive_caption_colour.ChangeLightness(70))); + dc.SetBrush(wxBrush(m_inactiveCaptionColour.ChangeLightness(120))); + dc.SetPen(wxPen(m_inactiveCaptionColour.ChangeLightness(70))); } // draw the background behind the button diff --git a/Externals/wxWidgets3/src/aui/floatpane.cpp b/Externals/wxWidgets3/src/aui/floatpane.cpp index f55082d56a..a4ce130fd8 100644 --- a/Externals/wxWidgets3/src/aui/floatpane.cpp +++ b/Externals/wxWidgets3/src/aui/floatpane.cpp @@ -4,7 +4,7 @@ // Author: Benjamin I. Williams // Modified by: // Created: 2005-05-17 -// RCS-ID: $Id: floatpane.cpp 64454 2010-05-31 14:59:18Z VZ $ +// RCS-ID: $Id: floatpane.cpp 69590 2011-10-30 14:20:03Z VZ $ // Copyright: (C) Copyright 2005-2006, Kirix Corporation, All Rights Reserved // Licence: wxWindows Library Licence, Version 3.1 /////////////////////////////////////////////////////////////////////////////// @@ -54,17 +54,17 @@ wxAuiFloatingFrame::wxAuiFloatingFrame(wxWindow* parent, (pane.IsFixed()?0:wxRESIZE_BORDER) ) { - m_owner_mgr = owner_mgr; + m_ownerMgr = owner_mgr; m_moving = false; m_mgr.SetManagedWindow(this); - m_solid_drag = true; + m_solidDrag = true; // find out if the system supports solid window drag. // on non-msw systems, this is assumed to be the case #ifdef __WXMSW__ BOOL b = TRUE; SystemParametersInfo(38 /*SPI_GETDRAGFULLWINDOWS*/, 0, &b, 0); - m_solid_drag = b ? true : false; + m_solidDrag = b ? true : false; #endif SetExtraStyle(wxWS_EX_PROCESS_IDLE); @@ -73,9 +73,9 @@ wxAuiFloatingFrame::wxAuiFloatingFrame(wxWindow* parent, wxAuiFloatingFrame::~wxAuiFloatingFrame() { // if we do not do this, then we can crash... - if (m_owner_mgr && m_owner_mgr->m_action_window == this) + if (m_ownerMgr && m_ownerMgr->m_actionWindow == this) { - m_owner_mgr->m_action_window = NULL; + m_ownerMgr->m_actionWindow = NULL; } m_mgr.UnInit(); @@ -83,8 +83,8 @@ wxAuiFloatingFrame::~wxAuiFloatingFrame() void wxAuiFloatingFrame::SetPaneWindow(const wxAuiPaneInfo& pane) { - m_pane_window = pane.window; - m_pane_window->Reparent(this); + m_paneWindow = pane.window; + m_paneWindow->Reparent(this); wxAuiPaneInfo contained_pane = pane; contained_pane.Dock().Center().Show(). @@ -108,7 +108,7 @@ void wxAuiFloatingFrame::SetPaneWindow(const wxAuiPaneInfo& pane) SetMinSize(pane.window->GetMinSize()); - m_mgr.AddPane(m_pane_window, contained_pane); + m_mgr.AddPane(m_paneWindow, contained_pane); m_mgr.Update(); if (pane.min_size.IsFullySpecified()) @@ -123,7 +123,22 @@ void wxAuiFloatingFrame::SetPaneWindow(const wxAuiPaneInfo& pane) SetTitle(pane.caption); - if (pane.floating_size != wxDefaultSize) + // This code is slightly awkward because we need to reset wxRESIZE_BORDER + // before calling SetClientSize() below as doing it after setting the + // client size would actually change it, at least under MSW, where the + // total window size doesn't change and hence, as the borders size changes, + // the client size does change. + // + // So we must call it first but doing it generates a size event and updates + // pane.floating_size from inside it so we must also record its original + // value before doing it. + const bool hasFloatingSize = pane.floating_size != wxDefaultSize; + if (pane.IsFixed()) + { + SetWindowStyleFlag(GetWindowStyleFlag() & ~wxRESIZE_BORDER); + } + + if ( hasFloatingSize ) { SetSize(pane.floating_size); } @@ -133,54 +148,49 @@ void wxAuiFloatingFrame::SetPaneWindow(const wxAuiPaneInfo& pane) if (size == wxDefaultSize) size = pane.min_size; if (size == wxDefaultSize) - size = m_pane_window->GetSize(); - if (m_owner_mgr && pane.HasGripper()) + size = m_paneWindow->GetSize(); + if (m_ownerMgr && pane.HasGripper()) { if (pane.HasGripperTop()) - size.y += m_owner_mgr->m_art->GetMetric(wxAUI_DOCKART_GRIPPER_SIZE); + size.y += m_ownerMgr->m_art->GetMetric(wxAUI_DOCKART_GRIPPER_SIZE); else - size.x += m_owner_mgr->m_art->GetMetric(wxAUI_DOCKART_GRIPPER_SIZE); + size.x += m_ownerMgr->m_art->GetMetric(wxAUI_DOCKART_GRIPPER_SIZE); } SetClientSize(size); } - - if (pane.IsFixed()) - { - SetWindowStyleFlag(GetWindowStyleFlag() & ~wxRESIZE_BORDER); - } } wxAuiManager* wxAuiFloatingFrame::GetOwnerManager() const { - return m_owner_mgr; + return m_ownerMgr; } void wxAuiFloatingFrame::OnSize(wxSizeEvent& WXUNUSED(event)) { - if (m_owner_mgr) + if (m_ownerMgr) { - m_owner_mgr->OnFloatingPaneResized(m_pane_window, GetRect()); + m_ownerMgr->OnFloatingPaneResized(m_paneWindow, GetRect()); } } void wxAuiFloatingFrame::OnClose(wxCloseEvent& evt) { - if (m_owner_mgr) + if (m_ownerMgr) { - m_owner_mgr->OnFloatingPaneClosed(m_pane_window, evt); + m_ownerMgr->OnFloatingPaneClosed(m_paneWindow, evt); } if (!evt.GetVeto()) { - m_mgr.DetachPane(m_pane_window); + m_mgr.DetachPane(m_paneWindow); Destroy(); } } void wxAuiFloatingFrame::OnMoveEvent(wxMoveEvent& event) { - if (!m_solid_drag) + if (!m_solidDrag) { // systems without solid window dragging need to be // handled slightly differently, due to the lack of @@ -194,61 +204,70 @@ void wxAuiFloatingFrame::OnMoveEvent(wxMoveEvent& event) } - wxRect win_rect = GetRect(); + wxRect winRect = GetRect(); - if (win_rect == m_last_rect) + if (winRect == m_lastRect) return; // skip the first move event - if (m_last_rect.IsEmpty()) + if (m_lastRect.IsEmpty()) { - m_last_rect = win_rect; + m_lastRect = winRect; return; } // skip if moving too fast to avoid massive redraws and // jumping hint windows - if ((abs(win_rect.x - m_last_rect.x) > 3) || - (abs(win_rect.y - m_last_rect.y) > 3)) + if ((abs(winRect.x - m_lastRect.x) > 3) || + (abs(winRect.y - m_lastRect.y) > 3)) { - m_last3_rect = m_last2_rect; - m_last2_rect = m_last_rect; - m_last_rect = win_rect; + m_last3Rect = m_last2Rect; + m_last2Rect = m_lastRect; + m_lastRect = winRect; + + // However still update the internally stored position to avoid + // snapping back to the old one later. + if (m_ownerMgr) + { + m_ownerMgr->GetPane(m_paneWindow). + floating_pos = winRect.GetPosition(); + } + return; } // prevent frame redocking during resize - if (m_last_rect.GetSize() != win_rect.GetSize()) + if (m_lastRect.GetSize() != winRect.GetSize()) { - m_last3_rect = m_last2_rect; - m_last2_rect = m_last_rect; - m_last_rect = win_rect; + m_last3Rect = m_last2Rect; + m_last2Rect = m_lastRect; + m_lastRect = winRect; return; } wxDirection dir = wxALL; - int horiz_dist = abs(win_rect.x - m_last3_rect.x); - int vert_dist = abs(win_rect.y - m_last3_rect.y); + int horiz_dist = abs(winRect.x - m_last3Rect.x); + int vert_dist = abs(winRect.y - m_last3Rect.y); if (vert_dist >= horiz_dist) { - if (win_rect.y < m_last3_rect.y) + if (winRect.y < m_last3Rect.y) dir = wxNORTH; else dir = wxSOUTH; } else { - if (win_rect.x < m_last3_rect.x) + if (winRect.x < m_last3Rect.x) dir = wxWEST; else dir = wxEAST; } - m_last3_rect = m_last2_rect; - m_last2_rect = m_last_rect; - m_last_rect = win_rect; + m_last3Rect = m_last2Rect; + m_last2Rect = m_lastRect; + m_lastRect = winRect; if (!isMouseDown()) return; @@ -259,7 +278,7 @@ void wxAuiFloatingFrame::OnMoveEvent(wxMoveEvent& event) m_moving = true; } - if (m_last3_rect.IsEmpty()) + if (m_last3Rect.IsEmpty()) return; OnMoving(event.GetRect(), dir); @@ -284,18 +303,18 @@ void wxAuiFloatingFrame::OnIdle(wxIdleEvent& event) void wxAuiFloatingFrame::OnMoveStart() { // notify the owner manager that the pane has started to move - if (m_owner_mgr) + if (m_ownerMgr) { - m_owner_mgr->OnFloatingPaneMoveStart(m_pane_window); + m_ownerMgr->OnFloatingPaneMoveStart(m_paneWindow); } } void wxAuiFloatingFrame::OnMoving(const wxRect& WXUNUSED(window_rect), wxDirection dir) { // notify the owner manager that the pane is moving - if (m_owner_mgr) + if (m_ownerMgr) { - m_owner_mgr->OnFloatingPaneMoving(m_pane_window, dir); + m_ownerMgr->OnFloatingPaneMoving(m_paneWindow, dir); } m_lastDirection = dir; } @@ -303,17 +322,17 @@ void wxAuiFloatingFrame::OnMoving(const wxRect& WXUNUSED(window_rect), wxDirecti void wxAuiFloatingFrame::OnMoveFinished() { // notify the owner manager that the pane has finished moving - if (m_owner_mgr) + if (m_ownerMgr) { - m_owner_mgr->OnFloatingPaneMoved(m_pane_window, m_lastDirection); + m_ownerMgr->OnFloatingPaneMoved(m_paneWindow, m_lastDirection); } } void wxAuiFloatingFrame::OnActivate(wxActivateEvent& event) { - if (m_owner_mgr && event.GetActive()) + if (m_ownerMgr && event.GetActive()) { - m_owner_mgr->OnFloatingPaneActivated(m_pane_window); + m_ownerMgr->OnFloatingPaneActivated(m_paneWindow); } } diff --git a/Externals/wxWidgets3/src/aui/framemanager.cpp b/Externals/wxWidgets3/src/aui/framemanager.cpp index a44db9ccd0..1fee9e8ffa 100644 --- a/Externals/wxWidgets3/src/aui/framemanager.cpp +++ b/Externals/wxWidgets3/src/aui/framemanager.cpp @@ -4,7 +4,7 @@ // Author: Benjamin I. Williams // Modified by: // Created: 2005-05-17 -// RCS-ID: $Id: framemanager.cpp 67280 2011-03-22 14:17:38Z DS $ +// RCS-ID: $Id: framemanager.cpp 70807 2012-03-04 20:31:34Z VZ $ // Copyright: (C) Copyright 2005-2006, Kirix Corporation, All Rights Reserved // Licence: wxWindows Library Licence, Version 3.1 /////////////////////////////////////////////////////////////////////////////// @@ -59,6 +59,7 @@ wxDEFINE_EVENT( wxEVT_AUI_PANE_BUTTON, wxAuiManagerEvent ); wxDEFINE_EVENT( wxEVT_AUI_PANE_CLOSE, wxAuiManagerEvent ); wxDEFINE_EVENT( wxEVT_AUI_PANE_MAXIMIZE, wxAuiManagerEvent ); wxDEFINE_EVENT( wxEVT_AUI_PANE_RESTORE, wxAuiManagerEvent ); +wxDEFINE_EVENT( wxEVT_AUI_PANE_ACTIVATED, wxAuiManagerEvent ); wxDEFINE_EVENT( wxEVT_AUI_RENDER, wxAuiManagerEvent ); wxDEFINE_EVENT( wxEVT_AUI_FIND_MANAGER, wxAuiManagerEvent ); @@ -98,44 +99,44 @@ public: : wxFrame(parent, id, title, pos, size, style | wxFRAME_SHAPED, name) { SetBackgroundStyle(wxBG_STYLE_CUSTOM); - m_Amount=0; - m_MaxWidth=0; - m_MaxHeight=0; + m_amount=0; + m_maxWidth=0; + m_maxHeight=0; m_lastWidth=0; m_lastHeight=0; #ifdef __WXGTK__ - m_CanSetShape = false; // have to wait for window create event on GTK + m_canSetShape = false; // have to wait for window create event on GTK #else - m_CanSetShape = true; + m_canSetShape = true; #endif - m_Region = wxRegion(0, 0, 0, 0); + m_region = wxRegion(0, 0, 0, 0); SetTransparent(0); } virtual bool SetTransparent(wxByte alpha) { - if (m_CanSetShape) + if (m_canSetShape) { int w=100; // some defaults int h=100; GetClientSize(&w, &h); - m_MaxWidth = w; - m_MaxHeight = h; - m_Amount = alpha; - m_Region.Clear(); -// m_Region.Union(0, 0, 1, m_MaxWidth); - if (m_Amount) + m_maxWidth = w; + m_maxHeight = h; + m_amount = alpha; + m_region.Clear(); +// m_region.Union(0, 0, 1, m_maxWidth); + if (m_amount) { - for (int y=0; y +#include "wx/gtk/private/gtk2-compat.h" static void gtk_pseudo_window_realized_callback( GtkWidget *m_widget, void *WXUNUSED(win) ) @@ -237,7 +239,7 @@ gtk_pseudo_window_realized_callback( GtkWidget *m_widget, void *WXUNUSED(win) ) if ((j*16+8)window, region.GetRegion(), 0, 0); + gdk_window_shape_combine_region(gtk_widget_get_window(m_widget), region.GetRegion(), 0, 0); } @@ -549,15 +551,28 @@ static void RenumberDockRows(wxAuiDockInfoPtrArray& docks) // SetActivePane() sets the active pane, as well as cycles through // every other pane and makes sure that all others' active flags // are turned off -static void SetActivePane(wxAuiPaneInfoArray& panes, wxWindow* active_pane) +void wxAuiManager::SetActivePane(wxWindow* active_pane) { int i, pane_count; - for (i = 0, pane_count = panes.GetCount(); i < pane_count; ++i) + wxAuiPaneInfo* active_paneinfo = NULL; + for (i = 0, pane_count = m_panes.GetCount(); i < pane_count; ++i) { - wxAuiPaneInfo& pane = panes.Item(i); + wxAuiPaneInfo& pane = m_panes.Item(i); pane.state &= ~wxAuiPaneInfo::optionActive; if (pane.window == active_pane) + { pane.state |= wxAuiPaneInfo::optionActive; + active_paneinfo = &pane; + } + } + + // send the 'activated' event after all panes have been updated + if ( active_paneinfo ) + { + wxAuiManagerEvent evt(wxEVT_AUI_PANE_ACTIVATED); + evt.SetManager(this); + evt.SetPane(active_paneinfo); + ProcessMgrEvent(evt); } } @@ -601,17 +616,17 @@ END_EVENT_TABLE() wxAuiManager::wxAuiManager(wxWindow* managed_wnd, unsigned int flags) { m_action = actionNone; - m_action_window = NULL; - m_last_mouse_move = wxPoint(); - m_hover_button = NULL; + m_actionWindow = NULL; + m_lastMouseMove = wxPoint(); + m_hoverButton = NULL; m_art = new wxAuiDefaultDockArt; - m_hint_wnd = NULL; + m_hintWnd = NULL; m_flags = flags; m_skipping = false; - m_has_maximized = false; + m_hasMaximized = false; m_frame = NULL; - m_dock_constraint_x = 0.3; - m_dock_constraint_y = 0.3; + m_dockConstraintX = 0.3; + m_dockConstraintY = 0.3; m_reserved = NULL; m_currentDragItem = -1; @@ -641,9 +656,9 @@ wxAuiManager::~wxAuiManager() // creates a floating frame for the windows wxAuiFloatingFrame* wxAuiManager::CreateFloatingFrame(wxWindow* parent, - const wxAuiPaneInfo& pane_info) + const wxAuiPaneInfo& paneInfo) { - return new wxAuiFloatingFrame(parent, this, pane_info); + return new wxAuiFloatingFrame(parent, this, paneInfo); } bool wxAuiManager::CanDockPanel(const wxAuiPaneInfo & WXUNUSED(p)) @@ -702,9 +717,9 @@ wxAuiDockUIPart* wxAuiManager::HitTest(int x, int y) wxAuiDockUIPart* result = NULL; int i, part_count; - for (i = 0, part_count = m_uiparts.GetCount(); i < part_count; ++i) + for (i = 0, part_count = m_uiParts.GetCount(); i < part_count; ++i) { - wxAuiDockUIPart* item = &m_uiparts.Item(i); + wxAuiDockUIPart* item = &m_uiParts.Item(i); // we are not interested in typeDock, because this space // isn't used to draw anything, just for measurements; @@ -819,39 +834,39 @@ void wxAuiManager::UpdateHintWindowConfig() } // if there is an existing hint window, delete it - if (m_hint_wnd) + if (m_hintWnd) { - m_hint_wnd->Destroy(); - m_hint_wnd = NULL; + m_hintWnd->Destroy(); + m_hintWnd = NULL; } - m_hint_fademax = 50; - m_hint_wnd = NULL; + m_hintFadeMax = 50; + m_hintWnd = NULL; if ((m_flags & wxAUI_MGR_TRANSPARENT_HINT) && can_do_transparent) { // Make a window to use for a transparent hint #if defined(__WXMSW__) || defined(__WXGTK__) - m_hint_wnd = new wxFrame(m_frame, wxID_ANY, wxEmptyString, + m_hintWnd = new wxFrame(m_frame, wxID_ANY, wxEmptyString, wxDefaultPosition, wxSize(1,1), wxFRAME_TOOL_WINDOW | wxFRAME_FLOAT_ON_PARENT | wxFRAME_NO_TASKBAR | wxNO_BORDER); - m_hint_wnd->SetBackgroundColour(wxSystemSettings::GetColour(wxSYS_COLOUR_ACTIVECAPTION)); + m_hintWnd->SetBackgroundColour(wxSystemSettings::GetColour(wxSYS_COLOUR_ACTIVECAPTION)); #elif defined(__WXMAC__) // Using a miniframe with float and tool styles keeps the parent // frame activated and highlighted as such... - m_hint_wnd = new wxMiniFrame(m_frame, wxID_ANY, wxEmptyString, + m_hintWnd = new wxMiniFrame(m_frame, wxID_ANY, wxEmptyString, wxDefaultPosition, wxSize(1,1), wxFRAME_FLOAT_ON_PARENT | wxFRAME_TOOL_WINDOW ); - m_hint_wnd->Connect(wxEVT_ACTIVATE, + m_hintWnd->Connect(wxEVT_ACTIVATE, wxActivateEventHandler(wxAuiManager::OnHintActivate), NULL, this); // Can't set the bg colour of a Frame in wxMac - wxPanel* p = new wxPanel(m_hint_wnd); + wxPanel* p = new wxPanel(m_hintWnd); // The default wxSYS_COLOUR_ACTIVECAPTION colour is a light silver // color that is really hard to see, especially transparent. @@ -868,7 +883,7 @@ void wxAuiManager::UpdateHintWindowConfig() { // system can't support transparent fade, or the venetian // blinds effect was explicitly requested - m_hint_wnd = new wxPseudoTransparentFrame(m_frame, + m_hintWnd = new wxPseudoTransparentFrame(m_frame, wxID_ANY, wxEmptyString, wxDefaultPosition, @@ -877,7 +892,7 @@ void wxAuiManager::UpdateHintWindowConfig() wxFRAME_FLOAT_ON_PARENT | wxFRAME_NO_TASKBAR | wxNO_BORDER); - m_hint_fademax = 128; + m_hintFadeMax = 128; } } } @@ -975,7 +990,7 @@ void wxAuiManager::SetArtProvider(wxAuiDockArt* art_provider) } -bool wxAuiManager::AddPane(wxWindow* window, const wxAuiPaneInfo& pane_info) +bool wxAuiManager::AddPane(wxWindow* window, const wxAuiPaneInfo& paneInfo) { wxASSERT_MSG(window, wxT("NULL window ptrs are not allowed")); @@ -984,24 +999,24 @@ bool wxAuiManager::AddPane(wxWindow* window, const wxAuiPaneInfo& pane_info) return false; // check if the window is already managed by us - if (GetPane(pane_info.window).IsOk()) + if (GetPane(paneInfo.window).IsOk()) return false; // check if the pane name already exists, this could reveal a // bug in the library user's application bool already_exists = false; - if (!pane_info.name.empty() && GetPane(pane_info.name).IsOk()) + if (!paneInfo.name.empty() && GetPane(paneInfo.name).IsOk()) { wxFAIL_MSG(wxT("A pane with that name already exists in the manager!")); already_exists = true; } // if the new pane is docked then we should undo maximize - if (pane_info.IsDocked()) + if (paneInfo.IsDocked()) RestoreMaximizedPane(); // special case: wxAuiToolBar style interacts with docking flags - wxAuiPaneInfo test(pane_info); + wxAuiPaneInfo test(paneInfo); wxAuiToolBar* toolbar = wxDynamicCast(window, wxAuiToolBar); if (toolbar) { @@ -1143,10 +1158,10 @@ bool wxAuiManager::AddPane(wxWindow* window, } bool wxAuiManager::AddPane(wxWindow* window, - const wxAuiPaneInfo& pane_info, + const wxAuiPaneInfo& paneInfo, const wxPoint& drop_pos) { - if (!AddPane(window, pane_info)) + if (!AddPane(window, paneInfo)) return false; wxAuiPaneInfo& pane = GetPane(window); @@ -1156,7 +1171,7 @@ bool wxAuiManager::AddPane(wxWindow* window, return true; } -bool wxAuiManager::InsertPane(wxWindow* window, const wxAuiPaneInfo& pane_info, +bool wxAuiManager::InsertPane(wxWindow* window, const wxAuiPaneInfo& paneInfo, int insert_level) { wxASSERT_MSG(window, wxT("NULL window ptrs are not allowed")); @@ -1166,21 +1181,21 @@ bool wxAuiManager::InsertPane(wxWindow* window, const wxAuiPaneInfo& pane_info, { case wxAUI_INSERT_PANE: DoInsertPane(m_panes, - pane_info.dock_direction, - pane_info.dock_layer, - pane_info.dock_row, - pane_info.dock_pos); + paneInfo.dock_direction, + paneInfo.dock_layer, + paneInfo.dock_row, + paneInfo.dock_pos); break; case wxAUI_INSERT_ROW: DoInsertDockRow(m_panes, - pane_info.dock_direction, - pane_info.dock_layer, - pane_info.dock_row); + paneInfo.dock_direction, + paneInfo.dock_layer, + paneInfo.dock_row); break; case wxAUI_INSERT_DOCK: DoInsertDockLayer(m_panes, - pane_info.dock_direction, - pane_info.dock_layer); + paneInfo.dock_direction, + paneInfo.dock_layer); break; } @@ -1189,27 +1204,27 @@ bool wxAuiManager::InsertPane(wxWindow* window, const wxAuiPaneInfo& pane_info, wxAuiPaneInfo& existing_pane = GetPane(window); if (!existing_pane.IsOk()) { - return AddPane(window, pane_info); + return AddPane(window, paneInfo); } else { - if (pane_info.IsFloating()) + if (paneInfo.IsFloating()) { existing_pane.Float(); - if (pane_info.floating_pos != wxDefaultPosition) - existing_pane.FloatingPosition(pane_info.floating_pos); - if (pane_info.floating_size != wxDefaultSize) - existing_pane.FloatingSize(pane_info.floating_size); + if (paneInfo.floating_pos != wxDefaultPosition) + existing_pane.FloatingPosition(paneInfo.floating_pos); + if (paneInfo.floating_size != wxDefaultSize) + existing_pane.FloatingSize(paneInfo.floating_size); } else { // if the new pane is docked then we should undo maximize RestoreMaximizedPane(); - existing_pane.Direction(pane_info.dock_direction); - existing_pane.Layer(pane_info.dock_layer); - existing_pane.Row(pane_info.dock_row); - existing_pane.Position(pane_info.dock_pos); + existing_pane.Direction(paneInfo.dock_direction); + existing_pane.Layer(paneInfo.dock_layer); + existing_pane.Row(paneInfo.dock_row); + existing_pane.Position(paneInfo.dock_pos); } } @@ -1241,9 +1256,9 @@ bool wxAuiManager::DetachPane(wxWindow* window) p.frame->Show(false); // reparent to m_frame and destroy the pane - if (m_action_window == p.frame) + if (m_actionWindow == p.frame) { - m_action_window = NULL; + m_actionWindow = NULL; } p.window->Reparent(m_frame); @@ -1257,12 +1272,12 @@ bool wxAuiManager::DetachPane(wxWindow* window) // the DetachPane() call. This prevets obscure crashes which would // happen at window repaint if the caller forgets to call Update() int pi, part_count; - for (pi = 0, part_count = (int)m_uiparts.GetCount(); pi < part_count; ++pi) + for (pi = 0, part_count = (int)m_uiParts.GetCount(); pi < part_count; ++pi) { - wxAuiDockUIPart& part = m_uiparts.Item(pi); + wxAuiDockUIPart& part = m_uiParts.Item(pi); if (part.pane == &p) { - m_uiparts.RemoveAt(pi); + m_uiParts.RemoveAt(pi); part_count--; pi--; continue; @@ -1277,37 +1292,37 @@ bool wxAuiManager::DetachPane(wxWindow* window) } // ClosePane() destroys or hides the pane depending on its flags -void wxAuiManager::ClosePane(wxAuiPaneInfo& pane_info) +void wxAuiManager::ClosePane(wxAuiPaneInfo& paneInfo) { // if we were maximized, restore - if (pane_info.IsMaximized()) + if (paneInfo.IsMaximized()) { - RestorePane(pane_info); + RestorePane(paneInfo); } // first, hide the window - if (pane_info.window && pane_info.window->IsShown()) + if (paneInfo.window && paneInfo.window->IsShown()) { - pane_info.window->Show(false); + paneInfo.window->Show(false); } // make sure that we are the parent of this window - if (pane_info.window && pane_info.window->GetParent() != m_frame) + if (paneInfo.window && paneInfo.window->GetParent() != m_frame) { - pane_info.window->Reparent(m_frame); + paneInfo.window->Reparent(m_frame); } // if we have a frame, destroy it - if (pane_info.frame) + if (paneInfo.frame) { - pane_info.frame->Destroy(); - pane_info.frame = NULL; + paneInfo.frame->Destroy(); + paneInfo.frame = NULL; } // now we need to either destroy or hide the pane - if (pane_info.IsDestroyOnClose()) + if (paneInfo.IsDestroyOnClose()) { - wxWindow * window = pane_info.window; + wxWindow * window = paneInfo.window; DetachPane(window); if (window) { @@ -1316,11 +1331,11 @@ void wxAuiManager::ClosePane(wxAuiPaneInfo& pane_info) } else { - pane_info.Hide(); + paneInfo.Hide(); } } -void wxAuiManager::MaximizePane(wxAuiPaneInfo& pane_info) +void wxAuiManager::MaximizePane(wxAuiPaneInfo& paneInfo) { int i, pane_count; @@ -1343,18 +1358,18 @@ void wxAuiManager::MaximizePane(wxAuiPaneInfo& pane_info) } // mark ourselves maximized - pane_info.Maximize(); - pane_info.Show(); - m_has_maximized = true; + paneInfo.Maximize(); + paneInfo.Show(); + m_hasMaximized = true; // last, show the window - if (pane_info.window && !pane_info.window->IsShown()) + if (paneInfo.window && !paneInfo.window->IsShown()) { - pane_info.window->Show(true); + paneInfo.window->Show(true); } } -void wxAuiManager::RestorePane(wxAuiPaneInfo& pane_info) +void wxAuiManager::RestorePane(wxAuiPaneInfo& paneInfo) { int i, pane_count; @@ -1370,13 +1385,13 @@ void wxAuiManager::RestorePane(wxAuiPaneInfo& pane_info) } // mark ourselves non-maximized - pane_info.Restore(); - m_has_maximized = false; + paneInfo.Restore(); + m_hasMaximized = false; // last, show the window - if (pane_info.window && !pane_info.window->IsShown()) + if (paneInfo.window && !paneInfo.window->IsShown()) { - pane_info.window->Show(true); + paneInfo.window->Show(true); } } @@ -1588,6 +1603,7 @@ bool wxAuiManager::LoadPerspective(const wxString& layout, bool update) input.Replace(wxT("\\|"), wxT("\a")); input.Replace(wxT("\\;"), wxT("\b")); + m_hasMaximized = false; while (1) { wxAuiPaneInfo pane; @@ -1630,6 +1646,9 @@ bool wxAuiManager::LoadPerspective(const wxString& layout, bool update) LoadPaneInfo(pane_part, pane); + if ( pane.IsMaximized() ) + m_hasMaximized = true; + wxAuiPaneInfo& p = GetPane(pane.name); if (!p.IsOk()) { @@ -1652,8 +1671,8 @@ void wxAuiManager::GetPanePositionsAndSizes(wxAuiDockInfo& dock, wxArrayInt& sizes) { int caption_size = m_art->GetMetric(wxAUI_DOCKART_CAPTION_SIZE); - int pane_border_size = m_art->GetMetric(wxAUI_DOCKART_PANE_BORDER_SIZE); - int gripper_size = m_art->GetMetric(wxAUI_DOCKART_GRIPPER_SIZE); + int pane_borderSize = m_art->GetMetric(wxAUI_DOCKART_PANE_BORDER_SIZE); + int gripperSize = m_art->GetMetric(wxAUI_DOCKART_GRIPPER_SIZE); positions.Empty(); sizes.Empty(); @@ -1683,18 +1702,18 @@ void wxAuiManager::GetPanePositionsAndSizes(wxAuiDockInfo& dock, int size = 0; if (pane.HasBorder()) - size += (pane_border_size*2); + size += (pane_borderSize*2); if (dock.IsHorizontal()) { if (pane.HasGripper() && !pane.HasGripperTop()) - size += gripper_size; + size += gripperSize; size += pane.best_size.x; } else { if (pane.HasGripper() && pane.HasGripperTop()) - size += gripper_size; + size += gripperSize; if (pane.HasCaption()) size += caption_size; @@ -1748,8 +1767,8 @@ void wxAuiManager::LayoutAddPane(wxSizer* cont, wxSizerItem* sizer_item; int caption_size = m_art->GetMetric(wxAUI_DOCKART_CAPTION_SIZE); - int gripper_size = m_art->GetMetric(wxAUI_DOCKART_GRIPPER_SIZE); - int pane_border_size = m_art->GetMetric(wxAUI_DOCKART_PANE_BORDER_SIZE); + int gripperSize = m_art->GetMetric(wxAUI_DOCKART_GRIPPER_SIZE); + int pane_borderSize = m_art->GetMetric(wxAUI_DOCKART_PANE_BORDER_SIZE); int pane_button_size = m_art->GetMetric(wxAUI_DOCKART_PANE_BUTTON_SIZE); // find out the orientation of the item (orientation for panes @@ -1770,9 +1789,9 @@ void wxAuiManager::LayoutAddPane(wxSizer* cont, if (pane.HasGripper()) { if (pane.HasGripperTop()) - sizer_item = vert_pane_sizer ->Add(1, gripper_size, 0, wxEXPAND); + sizer_item = vert_pane_sizer ->Add(1, gripperSize, 0, wxEXPAND); else - sizer_item = horz_pane_sizer ->Add(gripper_size, 1, 0, wxEXPAND); + sizer_item = horz_pane_sizer ->Add(gripperSize, 1, 0, wxEXPAND); part.type = wxAuiDockUIPart::typeGripper; part.dock = &dock; @@ -1891,7 +1910,7 @@ void wxAuiManager::LayoutAddPane(wxSizer* cont, { // allowing space for the pane's border sizer_item = cont->Add(horz_pane_sizer, pane_proportion, - wxEXPAND | wxALL, pane_border_size); + wxEXPAND | wxALL, pane_borderSize); part.type = wxAuiDockUIPart::typePaneBorder; part.dock = &dock; @@ -1916,14 +1935,14 @@ void wxAuiManager::LayoutAddDock(wxSizer* cont, wxSizerItem* sizer_item; wxAuiDockUIPart part; - int sash_size = m_art->GetMetric(wxAUI_DOCKART_SASH_SIZE); + int sashSize = m_art->GetMetric(wxAUI_DOCKART_SASH_SIZE); int orientation = dock.IsHorizontal() ? wxHORIZONTAL : wxVERTICAL; // resizable bottom and right docks have a sash before them - if (!m_has_maximized && !dock.fixed && (dock.dock_direction == wxAUI_DOCK_BOTTOM || + if (!m_hasMaximized && !dock.fixed && (dock.dock_direction == wxAUI_DOCK_BOTTOM || dock.dock_direction == wxAUI_DOCK_RIGHT)) { - sizer_item = cont->Add(sash_size, sash_size, 0, wxEXPAND); + sizer_item = cont->Add(sashSize, sashSize, 0, wxEXPAND); part.type = wxAuiDockUIPart::typeDockSizer; part.orientation = orientation; @@ -2008,9 +2027,9 @@ void wxAuiManager::LayoutAddDock(wxSizer* cont, // if this is not the first pane being added, // we need to add a pane sizer - if (!m_has_maximized && pane_i > 0) + if (!m_hasMaximized && pane_i > 0) { - sizer_item = dock_sizer->Add(sash_size, sash_size, 0, wxEXPAND); + sizer_item = dock_sizer->Add(sashSize, sashSize, 0, wxEXPAND); part.type = wxAuiDockUIPart::typePaneSizer; part.dock = &dock; @@ -2046,12 +2065,12 @@ void wxAuiManager::LayoutAddDock(wxSizer* cont, cont->SetItemMinSize(dock_sizer, dock.size, 0); // top and left docks have a sash after them - if (!m_has_maximized && + if (!m_hasMaximized && !dock.fixed && (dock.dock_direction == wxAUI_DOCK_TOP || dock.dock_direction == wxAUI_DOCK_LEFT)) { - sizer_item = cont->Add(sash_size, sash_size, 0, wxEXPAND); + sizer_item = cont->Add(sashSize, sashSize, 0, wxEXPAND); part.type = wxAuiDockUIPart::typeDockSizer; part.dock = &dock; @@ -2071,7 +2090,7 @@ wxSizer* wxAuiManager::LayoutAll(wxAuiPaneInfoArray& panes, { wxBoxSizer* container = new wxBoxSizer(wxVERTICAL); - int pane_border_size = m_art->GetMetric(wxAUI_DOCKART_PANE_BORDER_SIZE); + int pane_borderSize = m_art->GetMetric(wxAUI_DOCKART_PANE_BORDER_SIZE); int caption_size = m_art->GetMetric(wxAUI_DOCKART_CAPTION_SIZE); wxSize cli_size = m_frame->GetClientSize(); int i, dock_count, pane_count; @@ -2185,7 +2204,7 @@ wxSizer* wxAuiManager::LayoutAll(wxAuiPaneInfoArray& panes, { if (dock.panes.Item(j)->HasBorder()) { - size += (pane_border_size*2); + size += (pane_borderSize*2); break; } } @@ -2208,8 +2227,8 @@ wxSizer* wxAuiManager::LayoutAll(wxAuiPaneInfoArray& panes, // new dock's size may not be more than the dock constraint // parameter specifies. See SetDockSizeConstraint() - int max_dock_x_size = (int)(m_dock_constraint_x * ((double)cli_size.x)); - int max_dock_y_size = (int)(m_dock_constraint_y * ((double)cli_size.y)); + int max_dock_x_size = (int)(m_dockConstraintX * ((double)cli_size.x)); + int max_dock_y_size = (int)(m_dockConstraintY * ((double)cli_size.y)); if (dock.IsHorizontal()) size = wxMin(size, max_dock_y_size); @@ -2251,7 +2270,7 @@ wxSizer* wxAuiManager::LayoutAll(wxAuiPaneInfoArray& panes, } if (plus_border) - dock_min_size += (pane_border_size*2); + dock_min_size += (pane_borderSize*2); if (plus_caption && dock.IsHorizontal()) dock_min_size += (caption_size); @@ -2388,7 +2407,7 @@ wxSizer* wxAuiManager::LayoutAll(wxAuiPaneInfoArray& panes, for (row = 0,row_count = arr.GetCount(); rowAdd(1,1, 1, wxEXPAND); @@ -2459,17 +2478,17 @@ wxSizer* wxAuiManager::LayoutAll(wxAuiPaneInfoArray& panes, void wxAuiManager::SetDockSizeConstraint(double width_pct, double height_pct) { - m_dock_constraint_x = wxMax(0.0, wxMin(1.0, width_pct)); - m_dock_constraint_y = wxMax(0.0, wxMin(1.0, height_pct)); + m_dockConstraintX = wxMax(0.0, wxMin(1.0, width_pct)); + m_dockConstraintY = wxMax(0.0, wxMin(1.0, height_pct)); } void wxAuiManager::GetDockSizeConstraint(double* width_pct, double* height_pct) const { if (width_pct) - *width_pct = m_dock_constraint_x; + *width_pct = m_dockConstraintX; if (height_pct) - *height_pct = m_dock_constraint_y; + *height_pct = m_dockConstraintY; } @@ -2480,8 +2499,8 @@ void wxAuiManager::GetDockSizeConstraint(double* width_pct, double* height_pct) void wxAuiManager::Update() { - m_hover_button = NULL; - m_action_part = NULL; + m_hoverButton = NULL; + m_actionPart = NULL; wxSizer* sizer; int i, pane_count = m_panes.GetCount(); @@ -2508,12 +2527,12 @@ void wxAuiManager::Update() // also gets fired. Because we may be dragging around // a pane, we need to cancel that action here to prevent // a spurious crash. - if (m_action_window == p.frame) + if (m_actionWindow == p.frame) { if (wxWindow::GetCapture() == m_frame) m_frame->ReleaseMouse(); m_action = actionNone; - m_action_window = NULL; + m_actionWindow = NULL; } // hide the frame @@ -2521,9 +2540,9 @@ void wxAuiManager::Update() p.frame->Show(false); // reparent to m_frame and destroy the pane - if (m_action_window == p.frame) + if (m_actionWindow == p.frame) { - m_action_window = NULL; + m_actionWindow = NULL; } p.window->Reparent(m_frame); @@ -2538,7 +2557,7 @@ void wxAuiManager::Update() m_frame->SetSizer(NULL); // create a layout for all of the panes - sizer = LayoutAll(m_panes, m_docks, m_uiparts, false); + sizer = LayoutAll(m_panes, m_docks, m_uiParts, false); // hide or show panes as necessary, // and float panes as necessary @@ -2691,9 +2710,9 @@ void wxAuiManager::DoFrameLayout() m_frame->Layout(); int i, part_count; - for (i = 0, part_count = m_uiparts.GetCount(); i < part_count; ++i) + for (i = 0, part_count = m_uiParts.GetCount(); i < part_count; ++i) { - wxAuiDockUIPart& part = m_uiparts.Item(i); + wxAuiDockUIPart& part = m_uiParts.Item(i); // get the rectangle of the UI part // originally, this code looked like this: @@ -2741,16 +2760,16 @@ void wxAuiManager::DoFrameLayout() wxAuiDockUIPart* wxAuiManager::GetPanePart(wxWindow* wnd) { int i, part_count; - for (i = 0, part_count = m_uiparts.GetCount(); i < part_count; ++i) + for (i = 0, part_count = m_uiParts.GetCount(); i < part_count; ++i) { - wxAuiDockUIPart& part = m_uiparts.Item(i); + wxAuiDockUIPart& part = m_uiParts.Item(i); if (part.type == wxAuiDockUIPart::typePaneBorder && part.pane && part.pane->window == wnd) return ∂ } - for (i = 0, part_count = m_uiparts.GetCount(); i < part_count; ++i) + for (i = 0, part_count = m_uiParts.GetCount(); i < part_count; ++i) { - wxAuiDockUIPart& part = m_uiparts.Item(i); + wxAuiDockUIPart& part = m_uiParts.Item(i); if (part.type == wxAuiDockUIPart::typePane && part.pane && part.pane->window == wnd) return ∂ @@ -2888,7 +2907,9 @@ bool wxAuiManager::DoDrop(wxAuiDockInfoArray& docks, if (pt.x < layer_insert_offset && - pt.x > layer_insert_offset-auiLayerInsertPixels) + pt.x > layer_insert_offset-auiLayerInsertPixels && + pt.y > 0 && + pt.y < cli_size.y) { int new_layer = wxMax(wxMax(GetMaxLayer(docks, wxAUI_DOCK_LEFT), GetMaxLayer(docks, wxAUI_DOCK_BOTTOM)), @@ -2904,7 +2925,9 @@ bool wxAuiManager::DoDrop(wxAuiDockInfoArray& docks, return ProcessDockResult(target, drop); } else if (pt.y < layer_insert_offset && - pt.y > layer_insert_offset-auiLayerInsertPixels) + pt.y > layer_insert_offset-auiLayerInsertPixels && + pt.x > 0 && + pt.x < cli_size.x) { int new_layer = wxMax(wxMax(GetMaxLayer(docks, wxAUI_DOCK_TOP), GetMaxLayer(docks, wxAUI_DOCK_LEFT)), @@ -2920,7 +2943,9 @@ bool wxAuiManager::DoDrop(wxAuiDockInfoArray& docks, return ProcessDockResult(target, drop); } else if (pt.x >= cli_size.x - layer_insert_offset && - pt.x < cli_size.x - layer_insert_offset + auiLayerInsertPixels) + pt.x < cli_size.x - layer_insert_offset + auiLayerInsertPixels && + pt.y > 0 && + pt.y < cli_size.y) { int new_layer = wxMax(wxMax(GetMaxLayer(docks, wxAUI_DOCK_RIGHT), GetMaxLayer(docks, wxAUI_DOCK_TOP)), @@ -2936,7 +2961,9 @@ bool wxAuiManager::DoDrop(wxAuiDockInfoArray& docks, return ProcessDockResult(target, drop); } else if (pt.y >= cli_size.y - layer_insert_offset && - pt.y < cli_size.y - layer_insert_offset + auiLayerInsertPixels) + pt.y < cli_size.y - layer_insert_offset + auiLayerInsertPixels && + pt.x > 0 && + pt.x < cli_size.x) { int new_layer = wxMax( wxMax( GetMaxLayer(docks, wxAUI_DOCK_BOTTOM), GetMaxLayer(docks, wxAUI_DOCK_LEFT)), @@ -2976,7 +3003,7 @@ bool wxAuiManager::DoDrop(wxAuiDockInfoArray& docks, if (!part->dock->fixed || part->dock->dock_direction == wxAUI_DOCK_CENTER || pt.x >= cli_size.x || pt.x <= 0 || pt.y >= cli_size.y || pt.y <= 0) { - if (m_last_rect.IsEmpty() || m_last_rect.Contains(pt.x, pt.y )) + if (m_lastRect.IsEmpty() || m_lastRect.Contains(pt.x, pt.y )) { m_skipping = true; } @@ -2999,8 +3026,8 @@ bool wxAuiManager::DoDrop(wxAuiDockInfoArray& docks, m_skipping = false; - m_last_rect = part->dock->rect; - m_last_rect.Inflate( 15, 15 ); + m_lastRect = part->dock->rect; + m_lastRect.Inflate( 15, 15 ); drop.Dock(). Direction(part->dock->dock_direction). @@ -3262,55 +3289,55 @@ bool wxAuiManager::DoDrop(wxAuiDockInfoArray& docks, void wxAuiManager::OnHintFadeTimer(wxTimerEvent& WXUNUSED(event)) { - if (!m_hint_wnd || m_hint_fadeamt >= m_hint_fademax) + if (!m_hintWnd || m_hintFadeAmt >= m_hintFadeMax) { - m_hint_fadetimer.Stop(); - Disconnect(m_hint_fadetimer.GetId(), wxEVT_TIMER, + m_hintFadeTimer.Stop(); + Disconnect(m_hintFadeTimer.GetId(), wxEVT_TIMER, wxTimerEventHandler(wxAuiManager::OnHintFadeTimer)); return; } - m_hint_fadeamt += 4; - m_hint_wnd->SetTransparent(m_hint_fadeamt); + m_hintFadeAmt += 4; + m_hintWnd->SetTransparent(m_hintFadeAmt); } void wxAuiManager::ShowHint(const wxRect& rect) { - if (m_hint_wnd) + if (m_hintWnd) { // if the hint rect is the same as last time, don't do anything - if (m_last_hint == rect) + if (m_lastHint == rect) return; - m_last_hint = rect; + m_lastHint = rect; - m_hint_fadeamt = m_hint_fademax; + m_hintFadeAmt = m_hintFadeMax; if ((m_flags & wxAUI_MGR_HINT_FADE) - && !((m_hint_wnd->IsKindOf(CLASSINFO(wxPseudoTransparentFrame))) && + && !((m_hintWnd->IsKindOf(CLASSINFO(wxPseudoTransparentFrame))) && (m_flags & wxAUI_MGR_NO_VENETIAN_BLINDS_FADE)) ) - m_hint_fadeamt = 0; + m_hintFadeAmt = 0; - m_hint_wnd->SetSize(rect); - m_hint_wnd->SetTransparent(m_hint_fadeamt); + m_hintWnd->SetSize(rect); + m_hintWnd->SetTransparent(m_hintFadeAmt); - if (!m_hint_wnd->IsShown()) - m_hint_wnd->Show(); + if (!m_hintWnd->IsShown()) + m_hintWnd->Show(); // if we are dragging a floating pane, set the focus // back to that floating pane (otherwise it becomes unfocused) - if (m_action == actionDragFloatingPane && m_action_window) - m_action_window->SetFocus(); + if (m_action == actionDragFloatingPane && m_actionWindow) + m_actionWindow->SetFocus(); - m_hint_wnd->Raise(); + m_hintWnd->Raise(); - if (m_hint_fadeamt != m_hint_fademax) // Only fade if we need to + if (m_hintFadeAmt != m_hintFadeMax) // Only fade if we need to { // start fade in timer - m_hint_fadetimer.SetOwner(this); - m_hint_fadetimer.Start(5); - Connect(m_hint_fadetimer.GetId(), wxEVT_TIMER, + m_hintFadeTimer.SetOwner(this); + m_hintFadeTimer.Start(5); + Connect(m_hintFadeTimer.GetId(), wxEVT_TIMER, wxTimerEventHandler(wxAuiManager::OnHintFadeTimer)); } } @@ -3319,10 +3346,10 @@ void wxAuiManager::ShowHint(const wxRect& rect) if (!(m_flags & wxAUI_MGR_RECTANGLE_HINT)) return; - if (m_last_hint != rect) + if (m_lastHint != rect) { // remove the last hint rectangle - m_last_hint = rect; + m_lastHint = rect; m_frame->Refresh(); m_frame->Update(); } @@ -3337,7 +3364,8 @@ void wxAuiManager::ShowHint(const wxRect& rect) wxAuiPaneInfo& pane = m_panes.Item(i); if (pane.IsFloating() && - pane.frame->IsShown()) + pane.frame && + pane.frame->IsShown()) { wxRect rect = pane.frame->GetRect(); #ifdef __WXGTK__ @@ -3373,26 +3401,26 @@ void wxAuiManager::ShowHint(const wxRect& rect) void wxAuiManager::HideHint() { // hides a transparent window hint, if there is one - if (m_hint_wnd) + if (m_hintWnd) { - if (m_hint_wnd->IsShown()) - m_hint_wnd->Show(false); - m_hint_wnd->SetTransparent(0); - m_hint_fadetimer.Stop(); + if (m_hintWnd->IsShown()) + m_hintWnd->Show(false); + m_hintWnd->SetTransparent(0); + m_hintFadeTimer.Stop(); // In case this is called while a hint fade is going, we need to // disconnect the event handler. - Disconnect(m_hint_fadetimer.GetId(), wxEVT_TIMER, + Disconnect(m_hintFadeTimer.GetId(), wxEVT_TIMER, wxTimerEventHandler(wxAuiManager::OnHintFadeTimer)); - m_last_hint = wxRect(); + m_lastHint = wxRect(); return; } // hides a painted hint by redrawing the frame window - if (!m_last_hint.IsEmpty()) + if (!m_lastHint.IsEmpty()) { m_frame->Refresh(); m_frame->Update(); - m_last_hint = wxRect(); + m_lastHint = wxRect(); } } @@ -3425,9 +3453,18 @@ void wxAuiManager::StartPaneDrag(wxWindow* pane_window, m_action = actionDragFloatingPane; } - m_action_window = pane_window; - m_action_offset = offset; + m_actionWindow = pane_window; + m_actionOffset = offset; m_frame->CaptureMouse(); + + if (pane.frame) + { + wxRect window_rect = pane.frame->GetRect(); + wxRect client_rect = pane.frame->GetClientRect(); + wxPoint client_pt = pane.frame->ClientToScreen(client_rect.GetTopLeft()); + wxPoint origin_pt = client_pt - window_rect.GetTopLeft(); + m_actionOffset += origin_pt; + } } @@ -3628,7 +3665,7 @@ void wxAuiManager::OnFloatingPaneMoving(wxWindow* wnd, wxDirection dir) pane = hint; m_action = actionDragToolbarPane; - m_action_window = pane.window; + m_actionWindow = pane.window; Update(); @@ -3730,7 +3767,7 @@ void wxAuiManager::OnFloatingPaneMoved(wxWindow* wnd, wxDirection dir) if (m_flags & wxAUI_MGR_TRANSPARENT_DRAG) pane.frame->SetTransparent(255); } - else if (m_has_maximized) + else if (m_hasMaximized) { RestoreMaximizedPane(); } @@ -3791,7 +3828,7 @@ void wxAuiManager::OnFloatingPaneActivated(wxWindow* wnd) { if ((GetFlags() & wxAUI_MGR_ALLOW_ACTIVE_PANE) && GetPane(wnd).IsOk()) { - SetActivePane(m_panes, wnd); + SetActivePane(wnd); Repaint(); } } @@ -3812,10 +3849,10 @@ void wxAuiManager::OnRender(wxAuiManagerEvent& evt) dc->Clear() ; #endif int i, part_count; - for (i = 0, part_count = m_uiparts.GetCount(); + for (i = 0, part_count = m_uiParts.GetCount(); i < part_count; ++i) { - wxAuiDockUIPart& part = m_uiparts.Item(i); + wxAuiDockUIPart& part = m_uiParts.Item(i); // don't draw hidden pane items or items that aren't windows if (part.sizer_item && ((!part.sizer_item->IsWindow() && !part.sizer_item->IsSpacer() && !part.sizer_item->IsSizer()) || !part.sizer_item->IsShown())) @@ -3864,7 +3901,7 @@ void wxAuiManager::Render(wxDC* dc) void wxAuiManager::Repaint(wxDC* dc) { -#ifdef __WXMAC__ +#ifdef __WXMAC__ if ( dc == NULL ) { m_frame->Refresh() ; @@ -4062,18 +4099,18 @@ void wxAuiManager::OnLeftDown(wxMouseEvent& event) return; m_action = actionResize; - m_action_part = part; - m_action_hintrect = wxRect(); - m_action_start = wxPoint(event.m_x, event.m_y); - m_action_offset = wxPoint(event.m_x - part->rect.x, + m_actionPart = part; + m_actionHintRect = wxRect(); + m_actionStart = wxPoint(event.m_x, event.m_y); + m_actionOffset = wxPoint(event.m_x - part->rect.x, event.m_y - part->rect.y); m_frame->CaptureMouse(); } else if (part->type == wxAuiDockUIPart::typePaneButton) { m_action = actionClickButton; - m_action_part = part; - m_action_start = wxPoint(event.m_x, event.m_y); + m_actionPart = part; + m_actionStart = wxPoint(event.m_x, event.m_y); m_frame->CaptureMouse(); UpdateButtonOnScreen(part, event); @@ -4104,7 +4141,7 @@ void wxAuiManager::OnLeftDown(wxMouseEvent& event) if (GetFlags() & wxAUI_MGR_ALLOW_ACTIVE_PANE) { // set the caption as active - SetActivePane(m_panes, part->pane->window); + SetActivePane(part->pane->window); Repaint(); } @@ -4112,9 +4149,9 @@ void wxAuiManager::OnLeftDown(wxMouseEvent& event) return; m_action = actionClickCaption; - m_action_part = part; - m_action_start = wxPoint(event.m_x, event.m_y); - m_action_offset = wxPoint(event.m_x - part->rect.x, + m_actionPart = part; + m_actionStart = wxPoint(event.m_x, event.m_y); + m_actionOffset = wxPoint(event.m_x - part->rect.x, event.m_y - part->rect.y); m_frame->CaptureMouse(); } @@ -4139,10 +4176,10 @@ void wxAuiManager::OnLeftDown(wxMouseEvent& event) bool wxAuiManager::DoEndResizeAction(wxMouseEvent& event) { // resize the dock or the pane - if (m_action_part && m_action_part->type==wxAuiDockUIPart::typeDockSizer) + if (m_actionPart && m_actionPart->type==wxAuiDockUIPart::typeDockSizer) { // first, we must calculate the maximum size the dock may be - int sash_size = m_art->GetMetric(wxAUI_DOCKART_SASH_SIZE); + int sashSize = m_art->GetMetric(wxAUI_DOCKART_SASH_SIZE); int used_width = 0, used_height = 0; @@ -4163,7 +4200,7 @@ bool wxAuiManager::DoEndResizeAction(wxMouseEvent& event) used_width += dock.size; } if (dock.resizable) - used_width += sash_size; + used_width += sashSize; } @@ -4186,61 +4223,61 @@ bool wxAuiManager::DoEndResizeAction(wxMouseEvent& event) } #endif - wxRect& rect = m_action_part->dock->rect; + wxRect& rect = m_actionPart->dock->rect; - wxPoint new_pos(event.m_x - m_action_offset.x, - event.m_y - m_action_offset.y); - int new_size, old_size = m_action_part->dock->size; + wxPoint new_pos(event.m_x - m_actionOffset.x, + event.m_y - m_actionOffset.y); + int new_size, old_size = m_actionPart->dock->size; - switch (m_action_part->dock->dock_direction) + switch (m_actionPart->dock->dock_direction) { case wxAUI_DOCK_LEFT: new_size = new_pos.x - rect.x; if (new_size-old_size > available_width) new_size = old_size+available_width; - m_action_part->dock->size = new_size; + m_actionPart->dock->size = new_size; break; case wxAUI_DOCK_TOP: new_size = new_pos.y - rect.y; if (new_size-old_size > available_height) new_size = old_size+available_height; - m_action_part->dock->size = new_size; + m_actionPart->dock->size = new_size; break; case wxAUI_DOCK_RIGHT: new_size = rect.x + rect.width - new_pos.x - - m_action_part->rect.GetWidth(); + m_actionPart->rect.GetWidth(); if (new_size-old_size > available_width) new_size = old_size+available_width; - m_action_part->dock->size = new_size; + m_actionPart->dock->size = new_size; break; case wxAUI_DOCK_BOTTOM: new_size = rect.y + rect.height - - new_pos.y - m_action_part->rect.GetHeight(); + new_pos.y - m_actionPart->rect.GetHeight(); if (new_size-old_size > available_height) new_size = old_size+available_height; - m_action_part->dock->size = new_size; + m_actionPart->dock->size = new_size; break; } Update(); Repaint(NULL); } - else if (m_action_part && - m_action_part->type == wxAuiDockUIPart::typePaneSizer) + else if (m_actionPart && + m_actionPart->type == wxAuiDockUIPart::typePaneSizer) { - wxAuiDockInfo& dock = *m_action_part->dock; - wxAuiPaneInfo& pane = *m_action_part->pane; + wxAuiDockInfo& dock = *m_actionPart->dock; + wxAuiPaneInfo& pane = *m_actionPart->pane; int total_proportion = 0; int dock_pixels = 0; int new_pixsize = 0; int caption_size = m_art->GetMetric(wxAUI_DOCKART_CAPTION_SIZE); - int pane_border_size = m_art->GetMetric(wxAUI_DOCKART_PANE_BORDER_SIZE); - int sash_size = m_art->GetMetric(wxAUI_DOCKART_SASH_SIZE); + int pane_borderSize = m_art->GetMetric(wxAUI_DOCKART_PANE_BORDER_SIZE); + int sashSize = m_art->GetMetric(wxAUI_DOCKART_SASH_SIZE); - wxPoint new_pos(event.m_x - m_action_offset.x, - event.m_y - m_action_offset.y); + wxPoint new_pos(event.m_x - m_actionOffset.x, + event.m_y - m_actionOffset.y); // determine the pane rectangle by getting the pane part wxAuiDockUIPart* pane_part = GetPanePart(pane.window); @@ -4275,7 +4312,7 @@ bool wxAuiManager::DoEndResizeAction(wxMouseEvent& event) // width from the dock width, because this would // skew our proportion calculations if (i > 0) - dock_pixels -= sash_size; + dock_pixels -= sashSize; // also, the whole size (including decorations) of // all fixed panes must also be subtracted, because they @@ -4340,7 +4377,7 @@ bool wxAuiManager::DoEndResizeAction(wxMouseEvent& event) min_size = 0; if (pane.HasBorder()) - min_size += (pane_border_size*2); + min_size += (pane_borderSize*2); // calculate minimum size with decorations (border,caption) if (pane_part->orientation == wxVERTICAL) @@ -4410,10 +4447,10 @@ void wxAuiManager::OnLeftUp(wxMouseEvent& event) { // get rid of the hint rectangle wxScreenDC dc; - DrawResizeHint(dc, m_action_hintrect); + DrawResizeHint(dc, m_actionHintRect); } if (m_currentDragItem != -1 && wxAuiManager_HasLiveResize(*this)) - m_action_part = & (m_uiparts.Item(m_currentDragItem)); + m_actionPart = & (m_uiParts.Item(m_currentDragItem)); DoEndResizeAction(event); @@ -4422,21 +4459,21 @@ void wxAuiManager::OnLeftUp(wxMouseEvent& event) } else if (m_action == actionClickButton) { - m_hover_button = NULL; + m_hoverButton = NULL; m_frame->ReleaseMouse(); - if (m_action_part) + if (m_actionPart) { - UpdateButtonOnScreen(m_action_part, event); + UpdateButtonOnScreen(m_actionPart, event); // make sure we're still over the item that was originally clicked - if (m_action_part == HitTest(event.GetX(), event.GetY())) + if (m_actionPart == HitTest(event.GetX(), event.GetY())) { // fire button-click event wxAuiManagerEvent e(wxEVT_AUI_PANE_BUTTON); e.SetManager(this); - e.SetPane(m_action_part->pane); - e.SetButton(m_action_part->button->button_id); + e.SetPane(m_actionPart->pane); + e.SetButton(m_actionPart->button->button_id); ProcessMgrEvent(e); } } @@ -4453,7 +4490,7 @@ void wxAuiManager::OnLeftUp(wxMouseEvent& event) { m_frame->ReleaseMouse(); - wxAuiPaneInfo& pane = GetPane(m_action_window); + wxAuiPaneInfo& pane = GetPane(m_actionWindow); wxASSERT_MSG(pane.IsOk(), wxT("Pane window not found")); // save the new positions @@ -4481,7 +4518,7 @@ void wxAuiManager::OnLeftUp(wxMouseEvent& event) } m_action = actionNone; - m_last_mouse_move = wxPoint(); // see comment in OnMotion() + m_lastMouseMove = wxPoint(); // see comment in OnMotion() } @@ -4494,27 +4531,27 @@ void wxAuiManager::OnMotion(wxMouseEvent& event) // mouse move event is being generated. only verified on MSW wxPoint mouse_pos = event.GetPosition(); - if (m_last_mouse_move == mouse_pos) + if (m_lastMouseMove == mouse_pos) return; - m_last_mouse_move = mouse_pos; + m_lastMouseMove = mouse_pos; if (m_action == actionResize) { - // It's necessary to reset m_action_part since it destroyed + // It's necessary to reset m_actionPart since it destroyed // by the Update within DoEndResizeAction. if (m_currentDragItem != -1) - m_action_part = & (m_uiparts.Item(m_currentDragItem)); + m_actionPart = & (m_uiParts.Item(m_currentDragItem)); else - m_currentDragItem = m_uiparts.Index(* m_action_part); + m_currentDragItem = m_uiParts.Index(* m_actionPart); - if (m_action_part) + if (m_actionPart) { - wxPoint pos = m_action_part->rect.GetPosition(); - if (m_action_part->orientation == wxHORIZONTAL) - pos.y = wxMax(0, event.m_y - m_action_offset.y); + wxPoint pos = m_actionPart->rect.GetPosition(); + if (m_actionPart->orientation == wxHORIZONTAL) + pos.y = wxMax(0, event.m_y - m_actionOffset.y); else - pos.x = wxMax(0, event.m_x - m_action_offset.x); + pos.x = wxMax(0, event.m_x - m_actionOffset.x); if (wxAuiManager_HasLiveResize(*this)) { @@ -4525,22 +4562,22 @@ void wxAuiManager::OnMotion(wxMouseEvent& event) else { wxRect rect(m_frame->ClientToScreen(pos), - m_action_part->rect.GetSize()); + m_actionPart->rect.GetSize()); wxScreenDC dc; - if (!m_action_hintrect.IsEmpty()) + if (!m_actionHintRect.IsEmpty()) { // remove old resize hint - DrawResizeHint(dc, m_action_hintrect); - m_action_hintrect = wxRect(); + DrawResizeHint(dc, m_actionHintRect); + m_actionHintRect = wxRect(); } // draw new resize hint, if it's inside the managed frame - wxRect frame_screen_rect = m_frame->GetScreenRect(); - if (frame_screen_rect.Contains(rect)) + wxRect frameScreenRect = m_frame->GetScreenRect(); + if (frameScreenRect.Contains(rect)) { DrawResizeHint(dc, rect); - m_action_hintrect = rect; + m_actionHintRect = rect; } } } @@ -4553,75 +4590,84 @@ void wxAuiManager::OnMotion(wxMouseEvent& event) // caption has been clicked. we need to check if the mouse // is now being dragged. if it is, we need to change the // mouse action to 'drag' - if (m_action_part && - (abs(event.m_x - m_action_start.x) > drag_x_threshold || - abs(event.m_y - m_action_start.y) > drag_y_threshold)) + if (m_actionPart && + (abs(event.m_x - m_actionStart.x) > drag_x_threshold || + abs(event.m_y - m_actionStart.y) > drag_y_threshold)) { - wxAuiPaneInfo* pane_info = m_action_part->pane; + wxAuiPaneInfo* paneInfo = m_actionPart->pane; - if (!pane_info->IsToolbar()) + if (!paneInfo->IsToolbar()) { if ((m_flags & wxAUI_MGR_ALLOW_FLOATING) && - pane_info->IsFloatable()) + paneInfo->IsFloatable()) { m_action = actionDragFloatingPane; // set initial float position wxPoint pt = m_frame->ClientToScreen(event.GetPosition()); - pane_info->floating_pos = wxPoint(pt.x - m_action_offset.x, - pt.y - m_action_offset.y); + paneInfo->floating_pos = wxPoint(pt.x - m_actionOffset.x, + pt.y - m_actionOffset.y); // float the window - if (pane_info->IsMaximized()) - RestorePane(*pane_info); - pane_info->Float(); + if (paneInfo->IsMaximized()) + RestorePane(*paneInfo); + paneInfo->Float(); Update(); - m_action_window = pane_info->frame; + m_actionWindow = paneInfo->frame; // action offset is used here to make it feel "natural" to the user // to drag a docked pane and suddenly have it become a floating frame. // Sometimes, however, the offset where the user clicked on the docked // caption is bigger than the width of the floating frame itself, so // in that case we need to set the action offset to a sensible value - wxSize frame_size = m_action_window->GetSize(); - if (frame_size.x <= m_action_offset.x) - m_action_offset.x = 30; + wxSize frame_size = m_actionWindow->GetSize(); + if (frame_size.x <= m_actionOffset.x) + m_actionOffset.x = 30; } } else { m_action = actionDragToolbarPane; - m_action_window = pane_info->window; + m_actionWindow = paneInfo->window; } } } else if (m_action == actionDragFloatingPane) { - if (m_action_window) + if (m_actionWindow) { + // We can't move the child window so we need to get the frame that + // we want to be really moving. This is probably not the best place + // to do this but at least it fixes the bug (#13177) for now. + if (!m_actionWindow->IsKindOf(CLASSINFO(wxAuiFloatingFrame))) + { + wxAuiPaneInfo& pane = GetPane(m_actionWindow); + m_actionWindow = pane.frame; + } + wxPoint pt = m_frame->ClientToScreen(event.GetPosition()); - m_action_window->Move(pt.x - m_action_offset.x, - pt.y - m_action_offset.y); + m_actionWindow->Move(pt.x - m_actionOffset.x, + pt.y - m_actionOffset.y); } } else if (m_action == actionDragToolbarPane) { - wxAuiPaneInfo& pane = GetPane(m_action_window); + wxAuiPaneInfo& pane = GetPane(m_actionWindow); wxASSERT_MSG(pane.IsOk(), wxT("Pane window not found")); pane.SetFlag(wxAuiPaneInfo::actionPane, true); wxPoint pt = event.GetPosition(); - DoDrop(m_docks, m_panes, pane, pt, m_action_offset); + DoDrop(m_docks, m_panes, pane, pt, m_actionOffset); // if DoDrop() decided to float the pane, set up // the floating pane's initial position if (pane.IsFloating()) { wxPoint pt = m_frame->ClientToScreen(event.GetPosition()); - pane.floating_pos = wxPoint(pt.x - m_action_offset.x, - pt.y - m_action_offset.y); + pane.floating_pos = wxPoint(pt.x - m_actionOffset.x, + pt.y - m_actionOffset.y); } // this will do the actiual move operation; @@ -4637,7 +4683,7 @@ void wxAuiManager::OnMotion(wxMouseEvent& event) { pane.state &= ~wxAuiPaneInfo::actionPane; m_action = actionDragFloatingPane; - m_action_window = pane.frame; + m_actionWindow = pane.frame; } } else @@ -4645,27 +4691,27 @@ void wxAuiManager::OnMotion(wxMouseEvent& event) wxAuiDockUIPart* part = HitTest(event.GetX(), event.GetY()); if (part && part->type == wxAuiDockUIPart::typePaneButton) { - if (part != m_hover_button) + if (part != m_hoverButton) { // make the old button normal - if (m_hover_button) + if (m_hoverButton) { - UpdateButtonOnScreen(m_hover_button, event); + UpdateButtonOnScreen(m_hoverButton, event); Repaint(); } // mouse is over a button, so repaint the // button in hover mode UpdateButtonOnScreen(part, event); - m_hover_button = part; + m_hoverButton = part; } } else { - if (m_hover_button) + if (m_hoverButton) { - m_hover_button = NULL; + m_hoverButton = NULL; Repaint(); } else @@ -4678,9 +4724,9 @@ void wxAuiManager::OnMotion(wxMouseEvent& event) void wxAuiManager::OnLeaveWindow(wxMouseEvent& WXUNUSED(event)) { - if (m_hover_button) + if (m_hoverButton) { - m_hover_button = NULL; + m_hoverButton = NULL; Repaint(); } } @@ -4705,7 +4751,7 @@ void wxAuiManager::OnChildFocus(wxChildFocusEvent& event) wxAuiPaneInfo& pane = GetPane(event.GetWindow()); if (pane.IsOk() && (pane.state & wxAuiPaneInfo::optionActive) == 0) { - SetActivePane(m_panes, event.GetWindow()); + SetActivePane(event.GetWindow()); m_frame->Refresh(); } } diff --git a/Externals/wxWidgets3/src/aui/tabmdi.cpp b/Externals/wxWidgets3/src/aui/tabmdi.cpp index 152dba137a..413bfaf780 100644 --- a/Externals/wxWidgets3/src/aui/tabmdi.cpp +++ b/Externals/wxWidgets3/src/aui/tabmdi.cpp @@ -4,7 +4,7 @@ // Author: Hans Van Leemputten // Modified by: Benjamin I. Williams / Kirix Corporation // Created: 29/07/2002 -// RCS-ID: $Id: tabmdi.cpp 58227 2009-01-19 13:55:27Z VZ $ +// RCS-ID: $Id: tabmdi.cpp 70909 2012-03-15 13:49:54Z VZ $ // Copyright: (c) Hans Van Leemputten // Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// @@ -56,6 +56,7 @@ IMPLEMENT_DYNAMIC_CLASS(wxAuiMDIParentFrame, wxFrame) BEGIN_EVENT_TABLE(wxAuiMDIParentFrame, wxFrame) #if wxUSE_MENUS EVT_MENU (wxID_ANY, wxAuiMDIParentFrame::DoHandleMenu) + EVT_UPDATE_UI (wxID_ANY, wxAuiMDIParentFrame::DoHandleUpdateUI) #endif END_EVENT_TABLE() @@ -347,6 +348,35 @@ void wxAuiMDIParentFrame::DoHandleMenu(wxCommandEvent& event) event.Skip(); } } + +void wxAuiMDIParentFrame::DoHandleUpdateUI(wxUpdateUIEvent& event) +{ + switch (event.GetId()) + { + case wxWINDOWCLOSE: + case wxWINDOWCLOSEALL: + { + wxAuiMDIClientWindow* client_window = GetClientWindow(); + wxCHECK_RET(client_window, wxS("Missing MDI Client Window")); + size_t pages = client_window->GetPageCount(); + event.Enable(pages >= 1); + break; + } + + case wxWINDOWNEXT: + case wxWINDOWPREV: + { + wxAuiMDIClientWindow* client_window = GetClientWindow(); + wxCHECK_RET(client_window, wxS("Missing MDI Client Window")); + size_t pages = client_window->GetPageCount(); + event.Enable(pages >= 2); + break; + } + + default: + event.Skip(); + } +} #endif // wxUSE_MENUS void wxAuiMDIParentFrame::DoGetClientSize(int* width, int* height) const @@ -409,7 +439,7 @@ wxAuiMDIChildFrame::wxAuiMDIChildFrame(wxAuiMDIParentFrame *parent, // is, but those are the expected symantics. No style flag is passed // onto the panel underneath. if (style & wxMINIMIZE) - m_activate_on_create = false; + m_activateOnCreate = false; Create(parent, id, title, wxDefaultPosition, size, 0, name); } @@ -451,7 +481,7 @@ bool wxAuiMDIChildFrame::Create(wxAuiMDIParentFrame* parent, // see comment in constructor if (style & wxMINIMIZE) - m_activate_on_create = false; + m_activateOnCreate = false; wxSize cli_size = pClientWindow->GetClientSize(); @@ -471,7 +501,7 @@ bool wxAuiMDIChildFrame::Create(wxAuiMDIParentFrame* parent, m_title = title; - pClientWindow->AddPage(this, title, m_activate_on_create); + pClientWindow->AddPage(this, title, m_activateOnCreate); pClientWindow->Refresh(); return true; @@ -565,12 +595,12 @@ void wxAuiMDIChildFrame::SetIcons(const wxIconBundle& icons) { // get icon with the system icon size SetIcon(icons.GetIcon(-1)); - m_icon_bundle = icons; + m_iconBundle = icons; } const wxIconBundle& wxAuiMDIChildFrame::GetIcons() const { - return m_icon_bundle; + return m_iconBundle; } void wxAuiMDIChildFrame::SetIcon(const wxIcon& icon) @@ -658,7 +688,7 @@ wxAuiMDIParentFrame* wxAuiMDIChildFrame::GetMDIParentFrame() const void wxAuiMDIChildFrame::Init() { - m_activate_on_create = true; + m_activateOnCreate = true; m_pMDIParentFrame = NULL; #if wxUSE_MENUS m_pMenuBar = NULL; @@ -667,7 +697,7 @@ void wxAuiMDIChildFrame::Init() bool wxAuiMDIChildFrame::Show(bool show) { - m_activate_on_create = show; + m_activateOnCreate = show; // do nothing return true; @@ -680,7 +710,7 @@ void wxAuiMDIChildFrame::DoShow(bool show) void wxAuiMDIChildFrame::DoSetSize(int x, int y, int width, int height, int sizeFlags) { - m_mdi_newrect = wxRect(x, y, width, height); + m_mdiNewRect = wxRect(x, y, width, height); #ifdef __WXGTK__ wxPanel::DoSetSize(x,y,width, height, sizeFlags); #else @@ -690,16 +720,16 @@ void wxAuiMDIChildFrame::DoSetSize(int x, int y, int width, int height, int size void wxAuiMDIChildFrame::DoMoveWindow(int x, int y, int width, int height) { - m_mdi_newrect = wxRect(x, y, width, height); + m_mdiNewRect = wxRect(x, y, width, height); } void wxAuiMDIChildFrame::ApplyMDIChildFrameRect() { - if (m_mdi_currect != m_mdi_newrect) + if (m_mdiCurRect != m_mdiNewRect) { - wxPanel::DoMoveWindow(m_mdi_newrect.x, m_mdi_newrect.y, - m_mdi_newrect.width, m_mdi_newrect.height); - m_mdi_currect = m_mdi_newrect; + wxPanel::DoMoveWindow(m_mdiNewRect.x, m_mdiNewRect.y, + m_mdiNewRect.width, m_mdiNewRect.height); + m_mdiCurRect = m_mdiNewRect; } } @@ -725,11 +755,6 @@ wxAuiMDIClientWindow::wxAuiMDIClientWindow(wxAuiMDIParentFrame* parent, long sty CreateClient(parent, style); } -wxAuiMDIClientWindow::~wxAuiMDIClientWindow() -{ - DestroyChildren(); -} - bool wxAuiMDIClientWindow::CreateClient(wxAuiMDIParentFrame* parent, long style) { SetWindowStyleFlag(style); diff --git a/Externals/wxWidgets3/src/common/accelcmn.cpp b/Externals/wxWidgets3/src/common/accelcmn.cpp index b241d2e3a6..960c6ac7c3 100644 --- a/Externals/wxWidgets3/src/common/accelcmn.cpp +++ b/Externals/wxWidgets3/src/common/accelcmn.cpp @@ -3,7 +3,7 @@ // Purpose: implementation of platform-independent wxAcceleratorEntry parts // Author: Vadim Zeitlin // Created: 2007-05-05 -// RCS-ID: $Id: accelcmn.cpp 66592 2011-01-05 18:27:58Z PC $ +// RCS-ID: $Id: accelcmn.cpp 69853 2011-11-28 10:24:13Z SC $ // Copyright: (c) 2007 Vadim Zeitlin // Licence: wxWindows licence /////////////////////////////////////////////////////////////////////////////// @@ -186,6 +186,8 @@ wxAcceleratorEntry::ParseAccel(const wxString& text, int *flagsOut, int *keyOut) accelFlags |= wxACCEL_ALT; else if ( CompareAccelString(current, wxTRANSLATE("shift")) ) accelFlags |= wxACCEL_SHIFT; + else if ( CompareAccelString(current, wxTRANSLATE("rawctrl")) ) + accelFlags |= wxACCEL_RAW_CTRL; else // not a recognized modifier name { // we may have "Ctrl-+", for example, but we still want to @@ -311,7 +313,11 @@ wxString wxAcceleratorEntry::ToString() const text += _("Ctrl+"); if ( flags & wxACCEL_SHIFT ) text += _("Shift+"); - +#if defined(__WXMAC__) || defined(__WXCOCOA__) + if ( flags & wxACCEL_RAW_CTRL ) + text += _("RawCtrl+"); +#endif + const int code = GetKeyCode(); if ( code >= WXK_F1 && code <= WXK_F12 ) @@ -342,7 +348,7 @@ wxString wxAcceleratorEntry::ToString() const // build as they're only defined for the ASCII range (or EOF) wxIsascii(code) && #endif // ANSI - wxIsalnum(code) ) + wxIsprint(code) ) { text << (wxChar)code; } diff --git a/Externals/wxWidgets3/src/common/affinematrix2d.cpp b/Externals/wxWidgets3/src/common/affinematrix2d.cpp new file mode 100644 index 0000000000..0b1b9207dc --- /dev/null +++ b/Externals/wxWidgets3/src/common/affinematrix2d.cpp @@ -0,0 +1,186 @@ +/////////////////////////////////////////////////////////////////////////////// +// Name: affinematrix2d.cpp +// Purpose: implementation of wxAffineMatrix2D +// Author: Based on wxTransformMatrix by Chris Breeze, Julian Smart +// Created: 2011-04-05 +// Copyright: (c) wxWidgets team +// Licence: wxWindows licence +/////////////////////////////////////////////////////////////////////////////// + +#include "wx/wxprec.h" + +#ifdef __BORLANDC__ + #pragma hdrstop +#endif + +#if wxUSE_GEOMETRY + +#include "wx/affinematrix2d.h" +#include "wx/math.h" + +// sets the matrix to the respective values +void wxAffineMatrix2D::Set(const wxMatrix2D &mat2D, const wxPoint2DDouble &tr) +{ + m_11 = mat2D.m_11; + m_12 = mat2D.m_12; + m_21 = mat2D.m_21; + m_22 = mat2D.m_22; + m_tx = tr.m_x; + m_ty = tr.m_y; +} + +// gets the component valuess of the matrix +void wxAffineMatrix2D::Get(wxMatrix2D *mat2D, wxPoint2DDouble *tr) const +{ + mat2D->m_11 = m_11; + mat2D->m_12 = m_12; + mat2D->m_21 = m_21; + mat2D->m_22 = m_22; + + if ( tr ) + { + tr->m_x = m_tx; + tr->m_y = m_ty; + } +} + +// concatenates the matrix +// | t.m_11 t.m_12 0 | | m_11 m_12 0 | +// | t.m_21 t.m_22 0 | x | m_21 m_22 0 | +// | t.m_tx t.m_ty 1 | | m_tx m_ty 1 | +void wxAffineMatrix2D::Concat(const wxAffineMatrix2DBase &t) +{ + wxMatrix2D mat; + wxPoint2DDouble tr; + t.Get(&mat, &tr); + + m_tx += tr.m_x*m_11 + tr.m_y*m_21; + m_ty += tr.m_x*m_12 + tr.m_y*m_22; + wxDouble e11 = mat.m_11*m_11 + mat.m_12*m_21; + wxDouble e12 = mat.m_11*m_12 + mat.m_12*m_22; + wxDouble e21 = mat.m_21*m_11 + mat.m_22*m_21; + m_22 = mat.m_21*m_12 + mat.m_22*m_22; + m_11 = e11; + m_12 = e12; + m_21 = e21; +} + +// makes this its inverse matrix. +// Invert +// | m_11 m_12 0 | +// | m_21 m_22 0 | +// | m_tx m_ty 1 | +bool wxAffineMatrix2D::Invert() +{ + const wxDouble det = m_11*m_22 - m_12*m_21; + + if ( !det ) + return false; + + wxDouble ex = (m_21*m_ty - m_22*m_tx) / det; + m_ty = (-m_11*m_ty + m_12*m_tx) / det; + m_tx = ex; + wxDouble e11 = m_22 / det; + m_12 = -m_12 / det; + m_21 = -m_21 / det; + m_22 = m_11 / det; + m_11 = e11; + + return true; +} + +// returns true if the elements of the transformation matrix are equal +bool wxAffineMatrix2D::IsEqual(const wxAffineMatrix2DBase& t) const +{ + wxMatrix2D mat; + wxPoint2DDouble tr; + t.Get(&mat, &tr); + + return m_11 == mat.m_11 && m_12 == mat.m_12 && + m_21 == mat.m_21 && m_22 == mat.m_22 && + m_tx == tr.m_x && m_ty == tr.m_y; +} + +// +// transformations +// + +// add the translation to this matrix +// | 1 0 0 | | m_11 m_12 0 | +// | 0 1 0 | x | m_21 m_22 0 | +// | dx dy 1 | | m_tx m_ty 1 | +void wxAffineMatrix2D::Translate(wxDouble dx, wxDouble dy) +{ + m_tx += m_11 * dx + m_21 * dy; + m_ty += m_12 * dx + m_22 * dy; +} + +// add the scale to this matrix +// | xScale 0 0 | | m_11 m_12 0 | +// | 0 yScale 0 | x | m_21 m_22 0 | +// | 0 0 1 | | m_tx m_ty 1 | +void wxAffineMatrix2D::Scale(wxDouble xScale, wxDouble yScale) +{ + m_11 *= xScale; + m_12 *= xScale; + m_21 *= yScale; + m_22 *= yScale; +} + +// add the rotation to this matrix (counter clockwise, radians) +// | cos -sin 0 | | m_11 m_12 0 | +// | sin cos 0 | x | m_21 m_22 0 | +// | 0 0 1 | | m_tx m_ty 1 | +void wxAffineMatrix2D::Rotate(wxDouble ccRadians) +{ + wxDouble c = cos(ccRadians); + wxDouble s = sin(ccRadians); + + wxDouble e11 = c*m_11 - s*m_21; + wxDouble e12 = c*m_12 - s*m_22; + m_21 = s*m_11 + c*m_21; + m_22 = s*m_12 + c*m_22; + m_11 = e11; + m_12 = e12; +} + +// +// apply the transforms +// + +// applies that matrix to the point +// | m_11 m_12 0 | +// | src.m_x src._my 1 | x | m_21 m_22 0 | +// | m_tx m_ty 1 | +wxPoint2DDouble +wxAffineMatrix2D::DoTransformPoint(const wxPoint2DDouble& src) const +{ + if ( IsIdentity() ) + return src; + + return wxPoint2DDouble(src.m_x * m_11 + src.m_y * m_21 + m_tx, + src.m_y * m_12 + src.m_y * m_22 + m_ty); +} + +// applies the matrix except for translations +// | m_11 m_12 0 | +// | src.m_x src._my 0 | x | m_21 m_22 0 | +// | m_tx m_ty 1 | +wxPoint2DDouble +wxAffineMatrix2D::DoTransformDistance(const wxPoint2DDouble& src) const +{ + if ( IsIdentity() ) + return src; + + return wxPoint2DDouble(src.m_x * m_11 + src.m_y * m_21, + src.m_y * m_12 + src.m_y * m_22); +} + +bool wxAffineMatrix2D::IsIdentity() const +{ + return m_11 == 1 && m_12 == 0 && + m_21 == 0 && m_22 == 1 && + m_tx == 0 && m_ty == 0; +} + +#endif // wxUSE_GEOMETRY diff --git a/Externals/wxWidgets3/src/common/anidecod.cpp b/Externals/wxWidgets3/src/common/anidecod.cpp index 917a048b7d..841d4d7483 100644 --- a/Externals/wxWidgets3/src/common/anidecod.cpp +++ b/Externals/wxWidgets3/src/common/anidecod.cpp @@ -2,7 +2,7 @@ // Name: src/common/anidecod.cpp // Purpose: wxANIDecoder, ANI reader for wxImage and wxAnimation // Author: Francesco Montorsi -// RCS-ID: $Id: anidecod.cpp 60852 2009-06-01 11:43:36Z FM $ +// RCS-ID: $Id: anidecod.cpp 67708 2011-05-05 23:52:07Z DS $ // Copyright: (c) Francesco Montorsi // Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// @@ -127,6 +127,11 @@ bool wxANIDecoder::DoCanRead(wxInputStream& stream) const wxInt32 anih32; memcpy( &anih32, "anih", 4 ); + if ( stream.IsSeekable() && stream.SeekI(0) == wxInvalidOffset ) + { + return false; + } + if ( !stream.Read(&FCC1, 4) ) return false; @@ -220,6 +225,11 @@ bool wxANIDecoder::Load( wxInputStream& stream ) wxInt32 seq32; memcpy( &seq32, "seq ", 4 ); + if ( stream.IsSeekable() && stream.SeekI(0) == wxInvalidOffset ) + { + return false; + } + if ( !stream.Read(&FCC1, 4) ) return false; if ( FCC1 != riff32 ) diff --git a/Externals/wxWidgets3/src/common/appbase.cpp b/Externals/wxWidgets3/src/common/appbase.cpp index a5c65bcd2f..8cdf4e26fe 100644 --- a/Externals/wxWidgets3/src/common/appbase.cpp +++ b/Externals/wxWidgets3/src/common/appbase.cpp @@ -4,7 +4,7 @@ // Author: Vadim Zeitlin // Modified by: // Created: 19.06.2003 (extracted from common/appcmn.cpp) -// RCS-ID: $Id: appbase.cpp 66229 2010-11-22 01:22:56Z VZ $ +// RCS-ID: $Id: appbase.cpp 70796 2012-03-04 00:29:31Z VZ $ // Copyright: (c) 2003 Vadim Zeitlin // Licence: wxWindows licence /////////////////////////////////////////////////////////////////////////////// @@ -25,7 +25,7 @@ #endif #ifndef WX_PRECOMP - #ifdef __WXMSW__ + #ifdef __WINDOWS__ #include "wx/msw/wrapwin.h" // includes windows.h for MessageBox() #endif #include "wx/list.h" @@ -52,13 +52,11 @@ #include #endif -#ifndef __WXPALMOS5__ -#if !defined(__WXMSW__) || defined(__WXMICROWIN__) +#if !defined(__WINDOWS__) || defined(__WXMICROWIN__) #include // for SIGTRAP used by wxTrap() #endif //Win/Unix #include -#endif // ! __WXPALMOS5__ #if wxUSE_FONTMAP #include "wx/fontmap.h" @@ -67,7 +65,7 @@ #if wxDEBUG_LEVEL #if wxUSE_STACKWALKER #include "wx/stackwalk.h" - #ifdef __WXMSW__ + #ifdef __WINDOWS__ #include "wx/msw/debughlp.h" #endif #endif // wxUSE_STACKWALKER @@ -150,10 +148,14 @@ wxAppConsoleBase::wxAppConsoleBase() wxDELETE(m_traits); #endif #endif + + wxEvtHandler::AddFilter(this); } wxAppConsoleBase::~wxAppConsoleBase() { + wxEvtHandler::RemoveFilter(this); + // we're being destroyed and using this object from now on may not work or // even crash so don't leave dangling pointers to it ms_appInstance = NULL; @@ -177,7 +179,6 @@ bool wxAppConsoleBase::Initialize(int& WXUNUSED(argc), wxChar **WXUNUSED(argv)) wxString wxAppConsoleBase::GetAppName() const { wxString name = m_appName; -#ifndef __WXPALMOS__ if ( name.empty() ) { if ( argv ) @@ -186,7 +187,6 @@ wxString wxAppConsoleBase::GetAppName() const wxFileName::SplitPath(argv[0], NULL, &name, NULL); } } -#endif // !__WXPALMOS__ return name; } @@ -345,8 +345,11 @@ bool wxAppConsoleBase::Dispatch() bool wxAppConsoleBase::Yield(bool onlyIfNeeded) { wxEventLoopBase * const loop = wxEventLoopBase::GetActive(); + if ( loop ) + return loop->Yield(onlyIfNeeded); - return loop && loop->Yield(onlyIfNeeded); + wxScopedPtr tmpLoop(CreateMainLoop()); + return tmpLoop->Yield(onlyIfNeeded); } void wxAppConsoleBase::WakeUpIdle() @@ -398,7 +401,7 @@ bool wxAppConsoleBase::IsMainLoopRunning() int wxAppConsoleBase::FilterEvent(wxEvent& WXUNUSED(event)) { // process the events normally by default - return -1; + return Event_Skip; } void wxAppConsoleBase::DelayPendingEventHandler(wxEvtHandler* toDelay) @@ -893,12 +896,12 @@ wxString wxAppTraitsBase::GetAssertStackTrace() { #if wxDEBUG_LEVEL -#if !defined(__WXMSW__) +#if !defined(__WINDOWS__) // on Unix stack frame generation may take some time, depending on the // size of the executable mainly... warn the user that we are working wxFprintf(stderr, "Collecting stack trace information, please wait..."); fflush(stderr); -#endif // !__WXMSW__ +#endif // !__WINDOWS__ wxString stackTrace; @@ -999,12 +1002,21 @@ bool wxAssertIsEqual(int x, int y) return x == y; } +void wxAbort() +{ +#ifdef __WXWINCE__ + ExitThread(3); +#else + abort(); +#endif +} + #if wxDEBUG_LEVEL // break into the debugger void wxTrap() { -#if defined(__WXMSW__) && !defined(__WXMICROWIN__) +#if defined(__WINDOWS__) && !defined(__WXMICROWIN__) DebugBreak(); #elif defined(_MSL_USING_MW_C_HEADERS) && _MSL_USING_MW_C_HEADERS Debugger(); @@ -1025,7 +1037,7 @@ wxDefaultAssertHandler(const wxString& file, { // If this option is set, we should abort immediately when assert happens. if ( wxSystemOptions::GetOptionInt("exit-on-assert") ) - abort(); + wxAbort(); // FIXME MT-unsafe static int s_bInAssert = 0; @@ -1167,8 +1179,8 @@ static void LINKAGEMODE SetTraceMasks() static bool DoShowAssertDialog(const wxString& msg) { - // under MSW we can show the dialog even in the console mode -#if defined(__WXMSW__) && !defined(__WXMICROWIN__) + // under Windows we can show the dialog even in the console mode +#if defined(__WINDOWS__) && !defined(__WXMICROWIN__) wxString msgDlg(msg); // this message is intentionally not translated -- it is for developers @@ -1191,9 +1203,9 @@ bool DoShowAssertDialog(const wxString& msg) //case IDNO: nothing to do } -#else // !__WXMSW__ +#else // !__WINDOWS__ wxUnusedVar(msg); -#endif // __WXMSW__/!__WXMSW__ +#endif // __WINDOWS__/!__WINDOWS__ // continue with the asserts by default return false; diff --git a/Externals/wxWidgets3/src/common/appcmn.cpp b/Externals/wxWidgets3/src/common/appcmn.cpp index bad98c12b0..6c7129139a 100644 --- a/Externals/wxWidgets3/src/common/appcmn.cpp +++ b/Externals/wxWidgets3/src/common/appcmn.cpp @@ -4,7 +4,7 @@ // Author: Vadim Zeitlin // Modified by: // Created: 18.10.99 -// RCS-ID: $Id: appcmn.cpp 66648 2011-01-08 06:42:41Z PC $ +// RCS-ID: $Id: appcmn.cpp 70353 2012-01-15 14:46:41Z VZ $ // Copyright: (c) Vadim Zeitlin // Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// @@ -196,10 +196,10 @@ void wxAppBase::OnInitCmdLine(wxCmdLineParser& parser) }, #endif // __WXUNIVERSAL__ -#if defined(__WXMGL__) - // VS: this is not specific to wxMGL, all fullscreen (framebuffer) ports +#if defined(__WXDFB__) + // VS: this is not specific to wxDFB, all fullscreen (framebuffer) ports // should provide this option. That's why it is in common/appcmn.cpp - // and not mgl/app.cpp + // and not dfb/app.cpp { wxCMD_LINE_OPTION, NULL, @@ -208,7 +208,7 @@ void wxAppBase::OnInitCmdLine(wxCmdLineParser& parser) wxCMD_LINE_VAL_STRING, 0x0 }, -#endif // __WXMGL__ +#endif // __WXDFB__ // terminator wxCMD_LINE_DESC_END @@ -236,7 +236,7 @@ bool wxAppBase::OnCmdLineParsed(wxCmdLineParser& parser) } #endif // __WXUNIVERSAL__ -#if defined(__WXMGL__) +#if defined(__WXDFB__) wxString modeDesc; if ( parser.Found(OPTION_MODE, &modeDesc) ) { @@ -250,7 +250,7 @@ bool wxAppBase::OnCmdLineParsed(wxCmdLineParser& parser) if ( !SetDisplayMode(wxVideoMode(w, h, bpp)) ) return false; } -#endif // __WXMGL__ +#endif // __WXDFB__ return wxAppConsole::OnCmdLineParsed(parser); } @@ -349,7 +349,10 @@ bool wxAppBase::ProcessIdle() while (node) { wxWindow* win = node->GetData(); - if (win->SendIdleEvents(event)) + + // Don't send idle events to the windows that are about to be destroyed + // anyhow, this is wasteful and unexpected. + if ( !wxPendingDelete.Member(win) && win->SendIdleEvents(event) ) needMore = true; node = node->GetNext(); } diff --git a/Externals/wxWidgets3/src/common/arrstr.cpp b/Externals/wxWidgets3/src/common/arrstr.cpp index 9e9da5f35e..c186bb0da2 100644 --- a/Externals/wxWidgets3/src/common/arrstr.cpp +++ b/Externals/wxWidgets3/src/common/arrstr.cpp @@ -4,7 +4,7 @@ // Author: Vadim Zeitlin // Modified by: // Created: 29/01/98 -// RCS-ID: $Id: arrstr.cpp 61947 2009-09-16 23:18:48Z VZ $ +// RCS-ID: $Id: arrstr.cpp 67343 2011-03-30 14:16:04Z VZ $ // Copyright: (c) 1998 Vadim Zeitlin // Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// @@ -33,7 +33,7 @@ wxArrayString::wxArrayString(size_t sz, const char** a) { -#if !wxUSE_STL +#if !wxUSE_STD_CONTAINERS Init(false); #endif for (size_t i=0; i < sz; i++) @@ -42,7 +42,7 @@ wxArrayString::wxArrayString(size_t sz, const char** a) wxArrayString::wxArrayString(size_t sz, const wchar_t** a) { -#if !wxUSE_STL +#if !wxUSE_STD_CONTAINERS Init(false); #endif for (size_t i=0; i < sz; i++) @@ -51,14 +51,14 @@ wxArrayString::wxArrayString(size_t sz, const wchar_t** a) wxArrayString::wxArrayString(size_t sz, const wxString* a) { -#if !wxUSE_STL +#if !wxUSE_STD_CONTAINERS Init(false); #endif for (size_t i=0; i < sz; i++) Add(a[i]); } -#if !wxUSE_STL +#if !wxUSE_STD_CONTAINERS // size increment = min(50% of current size, ARRAY_MAXSIZE_INCREMENT) #define ARRAY_MAXSIZE_INCREMENT 4096 @@ -462,7 +462,7 @@ bool wxArrayString::operator==(const wxArrayString& a) const return true; } -#endif // !wxUSE_STL +#endif // !wxUSE_STD_CONTAINERS // =========================================================================== // wxJoin and wxSplit diff --git a/Externals/wxWidgets3/src/common/artprov.cpp b/Externals/wxWidgets3/src/common/artprov.cpp index c56761f3bb..5377d3e560 100644 --- a/Externals/wxWidgets3/src/common/artprov.cpp +++ b/Externals/wxWidgets3/src/common/artprov.cpp @@ -4,7 +4,7 @@ // Author: Vaclav Slavik // Modified by: // Created: 18/03/2002 -// RCS-ID: $Id: artprov.cpp 66506 2010-12-31 17:39:37Z VZ $ +// RCS-ID: $Id: artprov.cpp 70154 2011-12-28 13:51:29Z VZ $ // Copyright: (c) Vaclav Slavik // Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// @@ -231,12 +231,12 @@ wxArtProvider::~wxArtProvider() node; node = node->GetNext()) { bmp = node->GetData()->CreateBitmap(id, client, size); - if ( bmp.Ok() ) + if ( bmp.IsOk() ) break; } wxSize sizeNeeded = size; - if ( !bmp.Ok() ) + if ( !bmp.IsOk() ) { // no bitmap created -- as a fallback, try if we can find desired // icon in a bundle @@ -407,7 +407,7 @@ bool wxArtProvider::HasNativeProvider() /* static */ void wxArtProvider::InsertProvider(wxArtProvider *provider) { - Insert(provider); + PushBack(provider); } /* static */ bool wxArtProvider::PopProvider() @@ -440,13 +440,16 @@ class wxArtProviderModule: public wxModule public: bool OnInit() { -#if wxUSE_ARTPROVIDER_STD - wxArtProvider::InitStdProvider(); -#endif // wxUSE_ARTPROVIDER_STD + // The order here is such that the native provider will be used first + // and the standard one last as all these default providers add + // themselves to the bottom of the stack. + wxArtProvider::InitNativeProvider(); #if wxUSE_ARTPROVIDER_TANGO wxArtProvider::InitTangoProvider(); #endif // wxUSE_ARTPROVIDER_TANGO - wxArtProvider::InitNativeProvider(); +#if wxUSE_ARTPROVIDER_STD + wxArtProvider::InitStdProvider(); +#endif // wxUSE_ARTPROVIDER_STD return true; } void OnExit() diff --git a/Externals/wxWidgets3/src/common/artstd.cpp b/Externals/wxWidgets3/src/common/artstd.cpp index 5a86d0523f..fe65503986 100644 --- a/Externals/wxWidgets3/src/common/artstd.cpp +++ b/Externals/wxWidgets3/src/common/artstd.cpp @@ -4,7 +4,7 @@ // Author: Vaclav Slavik // Modified by: // Created: 18/03/2002 -// RCS-ID: $Id: artstd.cpp 66506 2010-12-31 17:39:37Z VZ $ +// RCS-ID: $Id: artstd.cpp 70893 2012-03-13 17:23:58Z JS $ // Copyright: (c) Vaclav Slavik // Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// @@ -45,7 +45,7 @@ protected: /*static*/ void wxArtProvider::InitStdProvider() { - wxArtProvider::Push(new wxDefaultArtProvider); + wxArtProvider::PushBack(new wxDefaultArtProvider); } // ---------------------------------------------------------------------------- @@ -207,7 +207,7 @@ wxBitmap wxDefaultArtProvider::CreateBitmap(const wxArtID& id, wxBitmap bmp = wxDefaultArtProvider_CreateBitmap(id); #if wxUSE_IMAGE && (!defined(__WXMSW__) || wxUSE_WXDIB) - if (bmp.Ok()) + if (bmp.IsOk()) { // fit into transparent image with desired size hint from the client if (reqSize == wxDefaultSize) @@ -219,7 +219,12 @@ wxBitmap wxDefaultArtProvider::CreateBitmap(const wxArtID& id, int bmp_w = bmp.GetWidth(); int bmp_h = bmp.GetHeight(); - if ((bmp_h < bestSize.x) && (bmp_w < bestSize.y)) + if (bmp_w == 16 && bmp_h == 15 && bestSize == wxSize(16, 16)) + { + // Do nothing in this special but quite common case, because scaling + // with only a pixel difference will look horrible. + } + else if ((bmp_h < bestSize.x) && (bmp_w < bestSize.y)) { // the caller wants default size, which is larger than // the image we have; to avoid degrading it visually by diff --git a/Externals/wxWidgets3/src/common/arttango.cpp b/Externals/wxWidgets3/src/common/arttango.cpp index 1bf02bd9ff..ae01e9e85a 100644 --- a/Externals/wxWidgets3/src/common/arttango.cpp +++ b/Externals/wxWidgets3/src/common/arttango.cpp @@ -3,7 +3,7 @@ // Purpose: art provider using embedded PNG versions of Tango icons // Author: Vadim Zeitlin // Created: 2010-12-27 -// RCS-ID: $Id: arttango.cpp 66510 2010-12-31 19:38:49Z VZ $ +// RCS-ID: $Id: arttango.cpp 70154 2011-12-28 13:51:29Z VZ $ // Copyright: (c) 2010 Vadim Zeitlin // Licence: wxWindows licence /////////////////////////////////////////////////////////////////////////////// @@ -322,7 +322,7 @@ wxTangoArtProvider::CreateBitmap(const wxArtID& id, /* static */ void wxArtProvider::InitTangoProvider() { - wxArtProvider::Push(new wxTangoArtProvider); + wxArtProvider::PushBack(new wxTangoArtProvider); } #endif // wxUSE_ARTPROVIDER_TANGO diff --git a/Externals/wxWidgets3/src/common/bmpbase.cpp b/Externals/wxWidgets3/src/common/bmpbase.cpp index 60e1ea50c8..403470fe29 100644 --- a/Externals/wxWidgets3/src/common/bmpbase.cpp +++ b/Externals/wxWidgets3/src/common/bmpbase.cpp @@ -3,7 +3,7 @@ // Purpose: wxBitmapBase // Author: VaclavSlavik // Created: 2001/04/11 -// RCS-ID: $Id: bmpbase.cpp 66630 2011-01-07 17:49:18Z SC $ +// RCS-ID: $Id: bmpbase.cpp 67681 2011-05-03 16:29:04Z DS $ // Copyright: (c) 2001, Vaclav Slavik // Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// @@ -156,7 +156,7 @@ wxBitmap::wxBitmap(const char* const* bits) #if wxUSE_IMAGE && wxUSE_XPM wxImage image(bits); - wxCHECK2_MSG(image.Ok(), return, wxT("invalid bitmap data")); + wxCHECK2_MSG(image.IsOk(), return, wxT("invalid bitmap data")); *this = wxBitmap(image); #else diff --git a/Externals/wxWidgets3/src/common/bookctrl.cpp b/Externals/wxWidgets3/src/common/bookctrl.cpp index 7cc2bceea5..c722822df5 100644 --- a/Externals/wxWidgets3/src/common/bookctrl.cpp +++ b/Externals/wxWidgets3/src/common/bookctrl.cpp @@ -4,7 +4,7 @@ // Author: Vadim Zeitlin // Modified by: // Created: 19.08.03 -// RCS-ID: $Id: bookctrl.cpp 65967 2010-10-31 13:33:34Z VZ $ +// RCS-ID: $Id: bookctrl.cpp 70153 2011-12-28 13:51:25Z VZ $ // Copyright: (c) 2003 Vadim Zeitlin // Licence: wxWindows licence /////////////////////////////////////////////////////////////////////////////// @@ -55,8 +55,6 @@ void wxBookCtrlBase::Init() { m_selection = wxNOT_FOUND; m_bookctrl = NULL; - m_imageList = NULL; - m_ownsImageList = false; m_fitToCurrentPage = false; #if defined(__WXWINCE__) @@ -89,39 +87,6 @@ wxBookCtrlBase::Create(wxWindow *parent, ); } -wxBookCtrlBase::~wxBookCtrlBase() -{ - if ( m_ownsImageList ) - { - // may be NULL, ok - delete m_imageList; - } -} - -// ---------------------------------------------------------------------------- -// image list -// ---------------------------------------------------------------------------- - -void wxBookCtrlBase::SetImageList(wxImageList *imageList) -{ - if ( m_ownsImageList ) - { - // may be NULL, ok - delete m_imageList; - - m_ownsImageList = false; - } - - m_imageList = imageList; -} - -void wxBookCtrlBase::AssignImageList(wxImageList* imageList) -{ - SetImageList(imageList); - - m_ownsImageList = true; -} - // ---------------------------------------------------------------------------- // geometry // ---------------------------------------------------------------------------- @@ -140,8 +105,13 @@ void wxBookCtrlBase::DoInvalidateBestSize() wxSize wxBookCtrlBase::CalcSizeFromPage(const wxSize& sizePage) const { - // we need to add the size of the choice control and the border between - const wxSize sizeController = GetControllerSize(); + // We need to add the size of the controller and the border between if it's + // shown. Notice that we don't use GetControllerSize() here as it returns + // the actual size while we want the best size here. + if ( !m_bookctrl || !m_bookctrl->IsShown() ) + return sizePage; + + const wxSize sizeController = m_bookctrl->GetBestSize(); wxSize size = sizePage; if ( IsVertical() ) diff --git a/Externals/wxWidgets3/src/common/btncmn.cpp b/Externals/wxWidgets3/src/common/btncmn.cpp index f8e14d750b..e59d7118ac 100644 --- a/Externals/wxWidgets3/src/common/btncmn.cpp +++ b/Externals/wxWidgets3/src/common/btncmn.cpp @@ -3,7 +3,7 @@ // Purpose: implementation of wxButtonBase // Author: Vadim Zeitlin // Created: 2007-04-08 -// RCS-ID: $Id: btncmn.cpp 66592 2011-01-05 18:27:58Z PC $ +// RCS-ID: $Id: btncmn.cpp 67931 2011-06-14 13:00:42Z VZ $ // Copyright: (c) 2007 Vadim Zeitlin // Licence: wxWindows licence /////////////////////////////////////////////////////////////////////////////// @@ -107,7 +107,7 @@ wxWindow *wxButtonBase::SetDefault() return tlw->SetDefaultItem(this); } -void wxButtonBase::SetBitmapPosition(wxDirection dir) +void wxAnyButtonBase::SetBitmapPosition(wxDirection dir) { wxASSERT_MSG( !(dir & ~wxDIRECTION_MASK), "non-direction flag used" ); wxASSERT_MSG( !!(dir & wxLEFT) + diff --git a/Externals/wxWidgets3/src/common/cairo.cpp b/Externals/wxWidgets3/src/common/cairo.cpp index 724c816bce..7425bf2afa 100644 --- a/Externals/wxWidgets3/src/common/cairo.cpp +++ b/Externals/wxWidgets3/src/common/cairo.cpp @@ -3,7 +3,7 @@ // Purpose: Cairo library // Author: Anthony Betaudeau // Created: 2007-08-25 -// RCS-ID: $Id: cairo.cpp 65561 2010-09-17 11:17:55Z DS $ +// RCS-ID: $Id: cairo.cpp 69486 2011-10-20 04:58:00Z RD $ // Copyright: (c) Anthony Bretaudeau // Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// @@ -16,31 +16,299 @@ #pragma hdrstop #endif +// keep cairo.h from defining dllimport as we're defining the symbols inside +// the wx dll in order to load them dynamically. +#define cairo_public + #include "wx/cairo.h" +#include "wx/dynlib.h" #if wxUSE_CAIRO +#ifdef __WXMAC__ +#include "wx/osx/private.h" +#include +#endif + #ifndef WX_PRECOMP #include "wx/module.h" #include "wx/log.h" #endif +#define wxCAIRO_METHOD_TYPE(name) \ + wxCairo##name##_t + +#define wxCAIRO_STATIC_METHOD_DEFINE(rettype, name, args, argnames, defret) \ + static wxCAIRO_METHOD_TYPE(name) name; -wxCairoLibrary *wxCairoLibrary::ms_lib = NULL; +#define wxCAIRO_STATIC_VOIDMETHOD_DEFINE(name, args, argnames) \ + wxCAIRO_STATIC_METHOD_DEFINE(void, name, args, argnames, NULL) + +#define wxFOR_ALL_CAIRO_VOIDMETHODS(m) \ + m( cairo_append_path, \ + (cairo_t *cr, const cairo_path_t *path), (cr, path) ) \ + m( cairo_arc, \ + (cairo_t *cr, double xc, double yc, double radius, double angle1, double angle2), (cr, xc, yc, radius, angle1, angle2) ) \ + m( cairo_arc_negative, \ + (cairo_t *cr, double xc, double yc, double radius, double angle1, double angle2), (cr, xc, yc, radius, angle1, angle2) ) \ + m( cairo_clip, \ + (cairo_t *cr), (cr) ) \ + m( cairo_close_path, \ + (cairo_t *cr), (cr) ) \ + m( cairo_curve_to, \ + (cairo_t *cr, double x1, double y1, double x2, double y2, double x3, double y3), (cr, x1, y1, x2, y2, x3, y3) ) \ + m( cairo_destroy, \ + (cairo_t *cr), (cr) ) \ + m( cairo_fill, \ + (cairo_t *cr), (cr) ) \ + m( cairo_fill_preserve, \ + (cairo_t *cr), (cr) ) \ + m( cairo_font_extents, \ + (cairo_t *cr, cairo_font_extents_t *extents), (cr, extents) ) \ + m( cairo_font_face_destroy, \ + (cairo_font_face_t *font_face), (font_face) ) \ + m( cairo_get_current_point, \ + (cairo_t *cr, double *x, double *y), (cr, x, y) ) \ + m( cairo_get_matrix, \ + (cairo_t *cr, cairo_matrix_t *matrix), (cr, matrix) ) \ + m( cairo_line_to, \ + (cairo_t *cr, double x, double y), (cr, x, y) ) \ + m( cairo_matrix_init, \ + (cairo_matrix_t *matrix, double xx, double yx, double xy, double yy, double x0, double y0), (matrix, xx, yx, xy, yy, x0, y0) ) \ + m( cairo_matrix_multiply, \ + (cairo_matrix_t *result, const cairo_matrix_t *a, const cairo_matrix_t *b), (result, a, b) ) \ + m( cairo_matrix_rotate, \ + (cairo_matrix_t *matrix, double radians), (matrix, radians) ) \ + m( cairo_matrix_scale, \ + (cairo_matrix_t *matrix, double sx, double sy), (matrix, sx, sy) ) \ + m( cairo_matrix_transform_distance, \ + (const cairo_matrix_t *matrix, double *dx, double *dy), (matrix, dx, dy) ) \ + m( cairo_matrix_transform_point, \ + (const cairo_matrix_t *matrix, double *x, double *y), (matrix, x, y) ) \ + m( cairo_matrix_translate, \ + (cairo_matrix_t *matrix, double tx, double ty), (matrix, tx, ty) ) \ + m( cairo_move_to, \ + (cairo_t *cr, double x, double y), (cr, x, y) ) \ + m( cairo_new_path, \ + (cairo_t *cr), (cr) ) \ + m( cairo_paint, \ + (cairo_t *cr), (cr) ) \ + m( cairo_paint_with_alpha, \ + (cairo_t *cr, double alpha), (cr, alpha) ) \ + m( cairo_path_destroy, \ + (cairo_path_t *path), (path) ) \ + m( cairo_pattern_add_color_stop_rgba, \ + (cairo_pattern_t *pattern, double offset, double red, double green, double blue, double alpha), (pattern, offset, red, green, blue, alpha) ) \ + m( cairo_pattern_destroy, \ + (cairo_pattern_t *pattern), (pattern) ) \ + m( cairo_pattern_set_extend, \ + (cairo_pattern_t *pattern, cairo_extend_t extend), (pattern, extend) ) \ + m( cairo_pattern_set_filter, \ + (cairo_pattern_t *pattern, cairo_filter_t filter), (pattern, filter) ) \ + m( cairo_pop_group_to_source, \ + (cairo_t *cr), (cr) ) \ + m( cairo_push_group, \ + (cairo_t *cr), (cr) ) \ + m( cairo_rectangle, \ + (cairo_t *cr, double x, double y, double width, double height), (cr, x, y, width, height) ) \ + m( cairo_reset_clip, \ + (cairo_t *cr), (cr) ) \ + m( cairo_restore, \ + (cairo_t *cr), (cr) ) \ + m( cairo_rotate, \ + (cairo_t *cr, double angle), (cr, angle) ) \ + m( cairo_save, \ + (cairo_t *cr), (cr) ) \ + m( cairo_scale, \ + (cairo_t *cr, double sx, double sy), (cr, sx, sy) ) \ + m( cairo_select_font_face, \ + (cairo_t *cr, const char *family, cairo_font_slant_t slant, cairo_font_weight_t weight), (cr, family, slant, weight) ) \ + m( cairo_set_antialias, \ + (cairo_t *cr, cairo_antialias_t antialias), (cr, antialias) ) \ + m( cairo_set_dash, \ + (cairo_t *cr, const double *dashes, int num_dashes, double offset), (cr, dashes, num_dashes, offset) ) \ + m( cairo_set_fill_rule, \ + (cairo_t *cr, cairo_fill_rule_t fill_rule), (cr, fill_rule) ) \ + m( cairo_set_font_face, \ + (cairo_t *cr, cairo_font_face_t *font_face), (cr, font_face) ) \ + m( cairo_set_font_size, \ + (cairo_t *cr, double size), (cr, size) ) \ + m( cairo_set_line_cap, \ + (cairo_t *cr, cairo_line_cap_t line_cap), (cr, line_cap) ) \ + m( cairo_set_line_join, \ + (cairo_t *cr, cairo_line_join_t line_join), (cr, line_join) ) \ + m( cairo_set_line_width, \ + (cairo_t *cr, double width), (cr, width) ) \ + m( cairo_set_matrix, \ + (cairo_t *cr, const cairo_matrix_t *matrix), (cr, matrix) ) \ + m( cairo_set_operator, \ + (cairo_t *cr, cairo_operator_t op), (cr, op) ) \ + m( cairo_set_source, \ + (cairo_t *cr, cairo_pattern_t *source), (cr, source) ) \ + m( cairo_set_source_rgba, \ + (cairo_t *cr, double red, double green, double blue, double alpha), (cr, red, green, blue, alpha) ) \ + m( cairo_show_text, \ + (cairo_t *cr, const char *utf8), (cr, utf8) ) \ + m( cairo_stroke, \ + (cairo_t *cr), (cr) ) \ + m( cairo_stroke_extents, \ + (cairo_t *cr, double *x1, double *y1, double *x2, double *y2), (cr, x1, y1, x2, y2) ) \ + m( cairo_stroke_preserve, \ + (cairo_t *cr), (cr) ) \ + m( cairo_surface_destroy, \ + (cairo_surface_t *surface), (surface) ) \ + m( cairo_text_extents, \ + (cairo_t *cr, const char *utf8, cairo_text_extents_t *extents), (cr, utf8, extents) ) \ + m( cairo_transform, \ + (cairo_t *cr, const cairo_matrix_t *matrix), (cr, matrix) ) \ + m( cairo_translate, \ + (cairo_t *cr, double tx, double ty), (cr, tx, ty) ) \ + +#ifdef __WXMAC__ +#define wxCAIRO_PLATFORM_METHODS(m) \ + m( cairo_font_face_t*, cairo_quartz_font_face_create_for_cgfont, \ + (CGFontRef font), (font), NULL ) \ + m( cairo_surface_t*, cairo_quartz_surface_create_for_cg_context, \ + (CGContextRef cgContext, unsigned int width, unsigned int height), (cgContext, width, height), NULL ) +#elif defined(__WXMSW__) +#define wxCAIRO_PLATFORM_METHODS(m) \ + m( cairo_surface_t*, cairo_win32_surface_create, \ + (HDC hdc), (hdc), NULL ) \ + m( cairo_surface_t*, cairo_win32_printing_surface_create, \ + (HDC hdc), (hdc), NULL ) +#else +#define wxCAIRO_PLATFORM_METHODS(m) +#endif + +#define wxFOR_ALL_CAIRO_METHODS(m) \ + m( cairo_path_t*, cairo_copy_path, \ + (cairo_t *cr), (cr), NULL ) \ + m( cairo_t*, cairo_create, \ + (cairo_surface_t *target), (target), NULL) \ + m( cairo_surface_t*, cairo_get_target, \ + (cairo_t *cr), (cr), NULL) \ + m( cairo_surface_t*, cairo_image_surface_create, \ + (cairo_format_t format, int width, int height), (format, width, height), NULL ) \ + m( cairo_surface_t*, cairo_image_surface_create_for_data, \ + (unsigned char *data, cairo_format_t format, int width, int height, int stride), (data, format, width, height, stride), NULL) \ + m( cairo_bool_t, cairo_in_fill, \ + (cairo_t *cr, double x, double y), (cr, x, y), false ) \ + m( cairo_status_t, cairo_matrix_invert, \ + (cairo_matrix_t *matrix), (matrix), NULL) \ + m( cairo_pattern_t*, cairo_pattern_create_for_surface, \ + (cairo_surface_t *surface), (surface), NULL) \ + m( cairo_pattern_t*, cairo_pattern_create_linear, \ + (double x0, double y0, double x1, double y1), (x0, y0, x1, y1), NULL) \ + m( cairo_pattern_t*, cairo_pattern_create_radial, \ + (double cx0, double cy0, double radius0, double cx1, double cy1, double radius1), (cx0, cy0, radius0, cx1, cy1, radius1), NULL) \ + m( cairo_status_t, cairo_pattern_status, \ + (cairo_pattern_t *pattern), (pattern), 4) \ + m( cairo_t*, cairo_reference, \ + (cairo_t *cr), (cr), NULL ) \ + m( cairo_surface_t*, cairo_surface_create_similar, \ + (cairo_surface_t *other, cairo_content_t content, int width, int height), (other, content, width, height), NULL) \ + m( int, cairo_format_stride_for_width, \ + (cairo_format_t format, int width), (format, width), 0) \ + m( int, cairo_version, \ + (), (), 0) \ + m( int, cairo_image_surface_get_stride, \ + (cairo_surface_t *surface), (surface), 0) \ + m( unsigned char *, cairo_image_surface_get_data, \ + (cairo_surface_t *surface), (surface), NULL) \ + m( cairo_format_t, cairo_image_surface_get_format, \ + (cairo_surface_t *surface), (surface), CAIRO_FORMAT_INVALID) \ + m( cairo_surface_type_t, cairo_surface_get_type, \ + (cairo_surface_t *surface), (surface), -1) \ + wxCAIRO_PLATFORM_METHODS(m) + + +#if wxUSE_PANGO +#define wxFOR_ALL_PANGO_CAIRO_VOIDMETHODS(m) \ + m( pango_cairo_update_layout, \ + (cairo_t *cr, PangoLayout *layout), (cr, layout) ) \ + m( pango_cairo_show_layout, \ + (cairo_t *cr, PangoLayout *layout), (cr, layout) ) +#endif + +#define wxCAIRO_DECLARE_TYPE(rettype, name, args, argnames, defret) \ + typedef rettype (*wxCAIRO_METHOD_TYPE(name)) args ; \ + wxCAIRO_METHOD_TYPE(name) wxDL_METHOD_NAME(name); + +#define wxCAIRO_DECLARE_VOIDTYPE(name, args, argnames) \ + wxCAIRO_DECLARE_TYPE(void, name, args, argnames, NULL) + +wxFOR_ALL_CAIRO_VOIDMETHODS(wxCAIRO_DECLARE_VOIDTYPE) +wxFOR_ALL_CAIRO_METHODS(wxCAIRO_DECLARE_TYPE) + + +class wxCairo +{ +public: + static bool Initialize(); + + // for internal use only + static void CleanUp(); + +private: + // the single wxCairo instance or NULL + static wxCairo *ms_lib; + + wxCairo(); + ~wxCairo(); + + bool IsOk(); + + wxDynamicLibrary m_libCairo; + wxDynamicLibrary m_libPangoCairo; + + // true if we successfully loaded the libraries and can use them + // + // note that this field must have this name as it's used by wxDL_XXX macros + bool m_ok; + +public: + + wxFOR_ALL_CAIRO_VOIDMETHODS(wxCAIRO_STATIC_VOIDMETHOD_DEFINE) + wxFOR_ALL_CAIRO_METHODS(wxCAIRO_STATIC_METHOD_DEFINE) +#if wxUSE_PANGO // untested, uncomment to test compilation. + //wxFOR_ALL_PANGO_METHODS(wxDL_STATIC_METHOD_DEFINE) +#endif + + wxDECLARE_NO_COPY_CLASS(wxCairo); +}; + +#define wxINIT_CAIRO_VOIDFUNC(name, params, args) \ + wxCAIRO_METHOD_TYPE(name) wxCairo::name = NULL; + +#define wxINIT_CAIRO_FUNC(rettype, name, params, args, defret) \ + wxCAIRO_METHOD_TYPE(name) wxCairo::name = NULL; + +wxFOR_ALL_CAIRO_VOIDMETHODS(wxINIT_CAIRO_VOIDFUNC) +wxFOR_ALL_CAIRO_METHODS(wxINIT_CAIRO_FUNC) + +#undef wxINIT_CAIRO_FUNC + +wxCairo *wxCairo::ms_lib = NULL; //---------------------------------------------------------------------------- // wxCairoLibrary //---------------------------------------------------------------------------- -wxCairoLibrary::wxCairoLibrary() +wxCairo::wxCairo() { wxLogNull log; - m_libCairo.Load("libcairo.so.2"); +#ifdef __WXMSW__ + wxString cairoDllStr("libcairo-2.dll"); +#else + wxString cairoDllStr("libcairo.so.2"); +#endif + m_libCairo.Load(cairoDllStr); m_ok = m_libCairo.IsLoaded(); if ( !m_ok ) return; +#if wxUSE_PANGO m_libPangoCairo.Load("libpangocairo-1.0.so.0"); m_ok = m_libPangoCairo.IsLoaded(); if ( !m_ok ) @@ -48,19 +316,37 @@ wxCairoLibrary::wxCairoLibrary() m_libCairo.Unload(); return; } +#endif - m_ok = InitializeMethods(); + +#define wxDO_LOAD_FUNC(name, nameStr) \ + name = (wxCAIRO_METHOD_TYPE(name))m_libCairo.RawGetSymbol(nameStr); \ + if ( !name ) \ + return; + +#define wxLOAD_CAIRO_VOIDFUNC(name, params, args) \ + wxDO_LOAD_FUNC(name, wxSTRINGIZE_T(name)) + +#define wxLOAD_CAIRO_FUNC(rettype, name, params, args, defret) \ + wxDO_LOAD_FUNC(name, wxSTRINGIZE_T(name)) + +wxFOR_ALL_CAIRO_VOIDMETHODS(wxLOAD_CAIRO_VOIDFUNC) +wxFOR_ALL_CAIRO_METHODS(wxLOAD_CAIRO_FUNC) + +#undef wxLOAD_CAIRO_FUNC + + m_ok = true; } -wxCairoLibrary::~wxCairoLibrary() +wxCairo::~wxCairo() { } -/* static */ wxCairoLibrary* wxCairoLibrary::Get() +/* static */ bool wxCairo::Initialize() { if ( !ms_lib ) { - ms_lib = new wxCairoLibrary(); + ms_lib = new wxCairo(); if ( !ms_lib->IsOk() ) { delete ms_lib; @@ -68,10 +354,10 @@ wxCairoLibrary::~wxCairoLibrary() } } - return ms_lib; + return ms_lib != NULL; } -/* static */ void wxCairoLibrary::CleanUp() +/* static */ void wxCairo::CleanUp() { if (ms_lib) { @@ -80,61 +366,48 @@ wxCairoLibrary::~wxCairoLibrary() } } -bool wxCairoLibrary::IsOk() +bool wxCairo::IsOk() { return m_ok; } -bool wxCairoLibrary::InitializeMethods() +// ============================================================================ +// implementation of the functions themselves +// ============================================================================ + +extern "C" { - wxDL_METHOD_LOAD(m_libCairo, cairo_arc); - wxDL_METHOD_LOAD(m_libCairo, cairo_arc_negative); - wxDL_METHOD_LOAD(m_libCairo, cairo_clip); - wxDL_METHOD_LOAD(m_libCairo, cairo_close_path); - wxDL_METHOD_LOAD(m_libCairo, cairo_create); - wxDL_METHOD_LOAD(m_libCairo, cairo_curve_to); - wxDL_METHOD_LOAD(m_libCairo, cairo_destroy); - wxDL_METHOD_LOAD(m_libCairo, cairo_fill); - wxDL_METHOD_LOAD(m_libCairo, cairo_fill_preserve); - wxDL_METHOD_LOAD(m_libCairo, cairo_get_target); - wxDL_METHOD_LOAD(m_libCairo, cairo_image_surface_create_for_data); - wxDL_METHOD_LOAD(m_libCairo, cairo_line_to); - wxDL_METHOD_LOAD(m_libCairo, cairo_move_to); - wxDL_METHOD_LOAD(m_libCairo, cairo_new_path); - wxDL_METHOD_LOAD(m_libCairo, cairo_paint); - wxDL_METHOD_LOAD(m_libCairo, cairo_pattern_add_color_stop_rgba); - wxDL_METHOD_LOAD(m_libCairo, cairo_pattern_create_for_surface); - wxDL_METHOD_LOAD(m_libCairo, cairo_pattern_create_linear); - wxDL_METHOD_LOAD(m_libCairo, cairo_pattern_create_radial); - wxDL_METHOD_LOAD(m_libCairo, cairo_pattern_destroy); - wxDL_METHOD_LOAD(m_libCairo, cairo_pattern_set_extend); - wxDL_METHOD_LOAD(m_libCairo, cairo_pattern_set_filter); - wxDL_METHOD_LOAD(m_libCairo, cairo_rectangle); - wxDL_METHOD_LOAD(m_libCairo, cairo_reset_clip); - wxDL_METHOD_LOAD(m_libCairo, cairo_restore); - wxDL_METHOD_LOAD(m_libCairo, cairo_rotate); - wxDL_METHOD_LOAD(m_libCairo, cairo_save); - wxDL_METHOD_LOAD(m_libCairo, cairo_scale); - wxDL_METHOD_LOAD(m_libCairo, cairo_set_dash); - wxDL_METHOD_LOAD(m_libCairo, cairo_set_fill_rule); - wxDL_METHOD_LOAD(m_libCairo, cairo_set_line_cap); - wxDL_METHOD_LOAD(m_libCairo, cairo_set_line_join); - wxDL_METHOD_LOAD(m_libCairo, cairo_set_line_width); - wxDL_METHOD_LOAD(m_libCairo, cairo_set_operator); - wxDL_METHOD_LOAD(m_libCairo, cairo_set_source); - wxDL_METHOD_LOAD(m_libCairo, cairo_set_source_rgba); - wxDL_METHOD_LOAD(m_libCairo, cairo_stroke); - wxDL_METHOD_LOAD(m_libCairo, cairo_stroke_preserve); - wxDL_METHOD_LOAD(m_libCairo, cairo_surface_create_similar); - wxDL_METHOD_LOAD(m_libCairo, cairo_surface_destroy); - wxDL_METHOD_LOAD(m_libCairo, cairo_translate); - wxDL_METHOD_LOAD(m_libPangoCairo, pango_cairo_update_layout); - wxDL_METHOD_LOAD(m_libPangoCairo, pango_cairo_show_layout); - - return true; +bool wxCairoInit() +{ + return wxCairo::Initialize(); } +void wxCairoCleanUp() +{ + wxCairo::CleanUp(); +} + +#define wxIMPL_CAIRO_FUNC(rettype, name, params, args, defret) \ + rettype name params \ + { \ + wxASSERT_MSG(wxCairo::Initialize(), "Cairo not initialized"); \ + return wxCairo::name args; \ + } + +#define wxIMPL_CAIRO_VOIDFUNC(name, params, args) \ + wxIMPL_CAIRO_FUNC(void, name, params, args, NULL) + +// we currently link directly to Cairo on GTK since it is usually available there, +// so don't use our cairo_xyz wrapper functions until the decision is made to +// always load Cairo dynamically there. +#ifndef __WXGTK__ +wxFOR_ALL_CAIRO_VOIDMETHODS(wxIMPL_CAIRO_VOIDFUNC) +wxFOR_ALL_CAIRO_METHODS(wxIMPL_CAIRO_FUNC) +#endif + +} // extern "C" + //---------------------------------------------------------------------------- // wxCairoModule //---------------------------------------------------------------------------- @@ -147,7 +420,7 @@ public: virtual void OnExit(); private: - DECLARE_DYNAMIC_CLASS(wxCairotModule) + DECLARE_DYNAMIC_CLASS(wxCairoModule) }; bool wxCairoModule::OnInit() @@ -157,7 +430,7 @@ bool wxCairoModule::OnInit() void wxCairoModule::OnExit() { - wxCairoLibrary::CleanUp(); + wxCairo::CleanUp(); } IMPLEMENT_DYNAMIC_CLASS(wxCairoModule, wxModule) diff --git a/Externals/wxWidgets3/src/common/calctrlcmn.cpp b/Externals/wxWidgets3/src/common/calctrlcmn.cpp index 4dde0060e0..93ac0dbc9f 100644 --- a/Externals/wxWidgets3/src/common/calctrlcmn.cpp +++ b/Externals/wxWidgets3/src/common/calctrlcmn.cpp @@ -2,7 +2,7 @@ // Name: src/common/calctrlcmn.cpp // Author: Marcin Wojdyr // Created: 2008-03-26 -// RCS-ID: $Id: calctrlcmn.cpp 67254 2011-03-20 00:14:35Z DS $ +// RCS-ID: $Id: calctrlcmn.cpp 69224 2011-09-29 13:43:15Z VZ $ // Copyright: (C) Marcin Wojdyr // Licence: wxWindows licence /////////////////////////////////////////////////////////////////////////////// @@ -16,13 +16,14 @@ #ifndef WX_PRECOMP #endif //WX_PRECOMP -#if wxUSE_CALENDARCTRL || wxUSE_DATEPICKCTRL +#if wxUSE_CALENDARCTRL || wxUSE_DATEPICKCTRL || wxUSE_TIMEPICKCTRL #include "wx/dateevt.h" IMPLEMENT_DYNAMIC_CLASS(wxDateEvent, wxCommandEvent) wxDEFINE_EVENT(wxEVT_DATE_CHANGED, wxDateEvent); +wxDEFINE_EVENT(wxEVT_TIME_CHANGED, wxDateEvent); -#endif // wxUSE_CALENDARCTRL || wxUSE_DATEPICKCTRL +#endif // wxUSE_CALENDARCTRL || wxUSE_DATEPICKCTRL || wxUSE_TIMEPICKCTRL #if wxUSE_CALENDARCTRL diff --git a/Externals/wxWidgets3/src/common/clrpickercmn.cpp b/Externals/wxWidgets3/src/common/clrpickercmn.cpp index a8df9d4837..1dc183a0af 100644 --- a/Externals/wxWidgets3/src/common/clrpickercmn.cpp +++ b/Externals/wxWidgets3/src/common/clrpickercmn.cpp @@ -4,7 +4,7 @@ // Author: Francesco Montorsi (readapted code written by Vadim Zeitlin) // Modified by: // Created: 15/04/2006 -// RCS-ID: $Id: clrpickercmn.cpp 58718 2009-02-07 18:59:25Z VZ $ +// RCS-ID: $Id: clrpickercmn.cpp 67681 2011-05-03 16:29:04Z DS $ // Copyright: (c) Vadim Zeitlin, Francesco Montorsi // Licence: wxWindows licence /////////////////////////////////////////////////////////////////////////////// @@ -84,7 +84,7 @@ void wxColourPickerCtrl::SetColour(const wxColour &col) bool wxColourPickerCtrl::SetColour(const wxString &text) { wxColour col(text); // smart wxString->wxColour conversion - if ( !col.Ok() ) + if ( !col.IsOk() ) return false; M_PICKER->SetColour(col); UpdateTextCtrlFromPicker(); @@ -105,7 +105,7 @@ void wxColourPickerCtrl::UpdatePickerFromTextCtrl() // wxString -> wxColour conversion wxColour col(m_text->GetValue()); - if ( !col.Ok() ) + if ( !col.IsOk() ) return; // invalid user input if (M_PICKER->GetColour() != col) diff --git a/Externals/wxWidgets3/src/common/cmdline.cpp b/Externals/wxWidgets3/src/common/cmdline.cpp index c02721ab6b..e270ade86f 100644 --- a/Externals/wxWidgets3/src/common/cmdline.cpp +++ b/Externals/wxWidgets3/src/common/cmdline.cpp @@ -4,7 +4,7 @@ // Author: Vadim Zeitlin // Modified by: // Created: 05.01.00 -// RCS-ID: $Id: cmdline.cpp 66253 2010-11-24 00:42:53Z VZ $ +// RCS-ID: $Id: cmdline.cpp 68316 2011-07-21 13:49:55Z VZ $ // Copyright: (c) 2000 Vadim Zeitlin // Licence: wxWindows licence /////////////////////////////////////////////////////////////////////////////// @@ -106,8 +106,7 @@ struct wxCmdLineOption type = typ; flags = fl; - m_hasVal = false; - m_isNegated = false; + Reset(); } // can't use union easily here, so just store all possible data fields, we @@ -142,12 +141,19 @@ struct wxCmdLineOption { Check(wxCMD_LINE_VAL_DATE); m_dateVal = val; m_hasVal = true; } #endif // wxUSE_DATETIME - void SetHasValue(bool hasValue = true) { m_hasVal = hasValue; } + void SetHasValue() { m_hasVal = true; } bool HasValue() const { return m_hasVal; } void SetNegated() { m_isNegated = true; } bool IsNegated() const { return m_isNegated; } + // Reset to the initial state, called before parsing another command line. + void Reset() + { + m_hasVal = + m_isNegated = false; + } + public: wxCmdLineEntryType kind; wxString shortName, @@ -637,8 +643,7 @@ void wxCmdLineParser::Reset() { for ( size_t i = 0; i < m_data->m_options.GetCount(); i++ ) { - wxCmdLineOption& opt = m_data->m_options[i]; - opt.SetHasValue(false); + m_data->m_options[i].Reset(); } } @@ -702,11 +707,45 @@ int wxCmdLineParser::Parse(bool showUsage) if (longOptionsEnabled) { + wxString errorOpt; + optInd = m_data->FindOptionByLongName(name); if ( optInd == wxNOT_FOUND ) { - errorMsg << wxString::Format(_("Unknown long option '%s'"), name.c_str()) - << wxT('\n'); + // Check if this could be a negatable long option. + if ( name.Last() == '-' ) + { + name.RemoveLast(); + + optInd = m_data->FindOptionByLongName(name); + if ( optInd != wxNOT_FOUND ) + { + if ( !(m_data->m_options[optInd].flags & + wxCMD_LINE_SWITCH_NEGATABLE) ) + { + errorOpt.Printf + ( + _("Option '%s' can't be negated"), + name + ); + optInd = wxNOT_FOUND; + } + } + } + + if ( optInd == wxNOT_FOUND ) + { + if ( errorOpt.empty() ) + { + errorOpt.Printf + ( + _("Unknown long option '%s'"), + name + ); + } + + errorMsg << errorOpt << wxT('\n'); + } } } else @@ -1171,7 +1210,6 @@ wxString wxCmdLineParser::GetUsageString() const option << (!opt.longName ? wxT(':') : wxT('=')) << val; } - usage << negator; if ( !(opt.flags & wxCMD_LINE_OPTION_MANDATORY) ) { usage << wxT(']'); diff --git a/Externals/wxWidgets3/src/common/cmdproc.cpp b/Externals/wxWidgets3/src/common/cmdproc.cpp index 772097b6c3..75ef4d3166 100644 --- a/Externals/wxWidgets3/src/common/cmdproc.cpp +++ b/Externals/wxWidgets3/src/common/cmdproc.cpp @@ -4,7 +4,7 @@ // Author: Julian Smart (extracted from docview.h by VZ) // Modified by: // Created: 05.11.00 -// RCS-ID: $Id: cmdproc.cpp 66287 2010-11-28 15:14:49Z VZ $ +// RCS-ID: $Id: cmdproc.cpp 70460 2012-01-25 00:05:12Z VZ $ // Copyright: (c) wxWidgets team // Licence: wxWindows licence /////////////////////////////////////////////////////////////////////////////// @@ -172,9 +172,9 @@ bool wxCommandProcessor::Redo() { wxCommand *redoCommand = NULL; wxList::compatibility_iterator redoNode -#if !wxUSE_STL +#if !wxUSE_STD_CONTAINERS = NULL // just to avoid warnings -#endif // !wxUSE_STL +#endif // !wxUSE_STD_CONTAINERS ; if ( m_currentCommand ) @@ -328,4 +328,28 @@ void wxCommandProcessor::ClearCommands() m_lastSavedCommand = wxList::compatibility_iterator(); } +bool wxCommandProcessor::IsDirty() const +{ + if ( m_commands.empty() ) + { + // If we have never been modified, we can't be dirty. + return false; + } + + if ( !m_lastSavedCommand ) + { + // If we have been modified but have never been saved, we're dirty. + return true; + } + + if ( !m_currentCommand ) + { + // This only happens if all commands were undone after saving the + // document: we're dirty then. + return true; + } + + // Finally if both iterators are valid, we may just compare them. + return m_currentCommand != m_lastSavedCommand; +} diff --git a/Externals/wxWidgets3/src/common/cmndata.cpp b/Externals/wxWidgets3/src/common/cmndata.cpp index d8b26aea46..95de654375 100644 --- a/Externals/wxWidgets3/src/common/cmndata.cpp +++ b/Externals/wxWidgets3/src/common/cmndata.cpp @@ -4,7 +4,7 @@ // Author: Julian Smart // Modified by: // Created: 01/02/97 -// RCS-ID: $Id: cmndata.cpp 66615 2011-01-07 05:26:57Z PC $ +// RCS-ID: $Id: cmndata.cpp 67681 2011-05-03 16:29:04Z DS $ // Copyright: (c) Julian Smart // Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// @@ -170,7 +170,7 @@ bool wxPrintData::IsOk() const { m_nativeData->TransferFrom( *this ); - return m_nativeData->Ok(); + return m_nativeData->IsOk(); } // ---------------------------------------------------------------------------- diff --git a/Externals/wxWidgets3/src/common/colourcmn.cpp b/Externals/wxWidgets3/src/common/colourcmn.cpp index ed9315ae5d..d596deec62 100644 --- a/Externals/wxWidgets3/src/common/colourcmn.cpp +++ b/Externals/wxWidgets3/src/common/colourcmn.cpp @@ -4,7 +4,7 @@ // Author: Francesco Montorsi // Modified by: // Created: 20/4/2006 -// RCS-ID: $Id: colourcmn.cpp 66630 2011-01-07 17:49:18Z SC $ +// RCS-ID: $Id: colourcmn.cpp 67681 2011-05-03 16:29:04Z DS $ // Copyright: (c) Francesco Montorsi // Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// @@ -101,10 +101,48 @@ bool wxColourBase::FromString(const wxString& str) alpha = wxALPHA_OPAQUE; if ( str.length() > 3 && (str[3] == wxT('a') || str[3] == wxT('A')) ) { - float a; - // TODO: use locale-independent function - if ( wxSscanf(str.wx_str() + 4, wxT("( %d , %d , %d , %f )"), - &red, &green, &blue, &a) != 4 ) + // We can't use sscanf() for the alpha value as sscanf() uses the + // current locale while the floating point numbers in CSS always + // use point as decimal separator, regardless of locale. So parse + // the tail of the string manually by putting it in a buffer and + // using wxString::ToCDouble() below. Notice that we can't use "%s" + // for this as it stops at white space and we need "%c" to avoid + // this and really get all the rest of the string into the buffer. + + const unsigned len = str.length(); // always big enough + wxCharBuffer alphaBuf(len); + char * const alphaPtr = alphaBuf.data(); + + for ( unsigned n = 0; n < len; n++ ) + alphaPtr[n] = '\0'; + + // Construct the format string which ensures that the last argument + // receives all the rest of the string. + wxString formatStr; + formatStr << wxS("( %d , %d , %d , %") << len << 'c'; + + // Notice that we use sscanf() here because if the string is not + // ASCII it can't represent a valid RGB colour specification anyhow + // and like this we can be sure that %c corresponds to "char *" + // while with wxSscanf() it depends on the type of the string + // passed as first argument: if it is a wide string, then %c + // expects "wchar_t *" matching parameter under MSW for example. + if ( sscanf(str.c_str() + 4, + formatStr.mb_str(), + &red, &green, &blue, alphaPtr) != 4 ) + return false; + + // Notice that we must explicitly specify the length to get rid of + // trailing NULs. + wxString alphaStr(alphaPtr, wxStrlen(alphaPtr)); + if ( alphaStr.empty() || alphaStr.Last() != ')' ) + return false; + + alphaStr.RemoveLast(); + alphaStr.Trim(); + + double a; + if ( !alphaStr.ToCDouble(&a) ) return false; alpha = wxRound(a * 255); @@ -139,13 +177,13 @@ bool wxColourBase::FromString(const wxString& str) // because this place can be called from constructor // and 'this' could not be available yet wxColour clr = wxTheColourDatabase->Find(str); - if (clr.Ok()) + if (clr.IsOk()) Set((unsigned char)clr.Red(), (unsigned char)clr.Green(), (unsigned char)clr.Blue()); } - if (Ok()) + if (IsOk()) return true; wxLogDebug(wxT("wxColour::Set - couldn't set to colour string '%s'"), str); @@ -181,9 +219,9 @@ wxString wxColourBase::GetAsString(long flags) const } else // use rgba() form { - // TODO: use locale-independent function - colName.Printf(wxT("rgba(%d, %d, %d, %.3f)"), - red, green, blue, Alpha() / 255.); + colName.Printf(wxT("rgba(%d, %d, %d, %s)"), + red, green, blue, + wxString::FromCDouble(Alpha() / 255., 3)); } } else if ( flags & wxC2S_HTML_SYNTAX ) diff --git a/Externals/wxWidgets3/src/common/combocmn.cpp b/Externals/wxWidgets3/src/common/combocmn.cpp index 70564bfbf3..de33d29646 100644 --- a/Externals/wxWidgets3/src/common/combocmn.cpp +++ b/Externals/wxWidgets3/src/common/combocmn.cpp @@ -4,7 +4,7 @@ // Author: Jaakko Salli // Modified by: // Created: Apr-30-2006 -// RCS-ID: $Id: combocmn.cpp 67280 2011-03-22 14:17:38Z DS $ +// RCS-ID: $Id: combocmn.cpp 69005 2011-09-05 20:08:04Z RD $ // Copyright: (c) 2005 Jaakko Salli // Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// @@ -674,6 +674,34 @@ void wxComboPopup::Dismiss() m_combo->HidePopup(true); } +void wxComboPopup::DestroyPopup() +{ + // Here we make sure that the popup control's Destroy() gets called. + // This is necessary for the wxPersistentWindow to work properly. + wxWindow* popupCtrl = GetControl(); + if ( popupCtrl ) + { + // While all wxComboCtrl examples have m_popupInterface and + // popupCtrl as the same class (that will be deleted via the + // Destroy() call below), it is technically still possible to + // have implementations where they are in fact not same + // multiple-inherited class. Here we use C++ RTTI to check for + // this rare case. + #ifndef wxNO_RTTI + // It is probably better to delete m_popupInterface first, so + // that it retains access to its popup control window. + if ( dynamic_cast(this) != + dynamic_cast(popupCtrl) ) + delete this; + #endif + popupCtrl->Destroy(); + } + else + { + delete this; + } +} + // ---------------------------------------------------------------------------- // input handling // ---------------------------------------------------------------------------- @@ -932,7 +960,6 @@ public: BEGIN_EVENT_TABLE(wxComboCtrlBase, wxControl) - EVT_TEXT(wxID_ANY,wxComboCtrlBase::OnTextCtrlEvent) EVT_SIZE(wxComboCtrlBase::OnSizeEvent) EVT_SET_FOCUS(wxComboCtrlBase::OnFocusEvent) EVT_KILL_FOCUS(wxComboCtrlBase::OnFocusEvent) @@ -940,7 +967,6 @@ BEGIN_EVENT_TABLE(wxComboCtrlBase, wxControl) //EVT_BUTTON(wxID_ANY,wxComboCtrlBase::OnButtonClickEvent) EVT_KEY_DOWN(wxComboCtrlBase::OnKeyEvent) EVT_CHAR(wxComboCtrlBase::OnCharEvent) - EVT_TEXT_ENTER(wxID_ANY,wxComboCtrlBase::OnTextCtrlEvent) EVT_SYS_COLOUR_CHANGED(wxComboCtrlBase::OnSysColourChanged) END_EVENT_TABLE() @@ -1018,10 +1044,11 @@ bool wxComboCtrlBase::Create(wxWindow *parent, m_iFlags |= wxCC_IFLAG_CREATED; // If x and y indicate valid size, wxSizeEvent won't be - // emitted automatically, so we need to add artifical one. + // emitted automatically, so we need to add artificial one. if ( size.x > 0 && size.y > 0 ) { wxSizeEvent evt(size,GetId()); + evt.SetEventObject(this); GetEventHandler()->AddPendingEvent(evt); } @@ -1066,6 +1093,16 @@ wxComboCtrlBase::CreateTextCtrl(int style) m_text->Create(this, wxID_ANY, m_valueString, wxDefaultPosition, wxSize(10,-1), style); + + // Connecting the events is currently the most reliable way + wxWindowID id = m_text->GetId(); + m_text->Connect(id, wxEVT_COMMAND_TEXT_UPDATED, + wxCommandEventHandler(wxComboCtrlBase::OnTextCtrlEvent), + NULL, this); + m_text->Connect(id, wxEVT_COMMAND_TEXT_ENTER, + wxCommandEventHandler(wxComboCtrlBase::OnTextCtrlEvent), + NULL, this); + m_text->SetHint(m_hintText); } } @@ -1135,7 +1172,7 @@ void wxComboCtrlBase::CalculateAreas( int btnWidth ) // its platform default or bitmap+pushbutton background is used, but not if // there is vertical size adjustment or horizontal spacing. if ( ( (m_iFlags & wxCC_BUTTON_OUTSIDE_BORDER) || - (m_bmpNormal.Ok() && m_blankButtonBg) ) && + (m_bmpNormal.IsOk() && m_blankButtonBg) ) && m_btnSpacingX == 0 && m_btnHei <= 0 ) { @@ -1143,7 +1180,7 @@ void wxComboCtrlBase::CalculateAreas( int btnWidth ) btnBorder = 0; } else if ( (m_iFlags & wxCC_BUTTON_COVERS_BORDER) && - m_btnSpacingX == 0 && !m_bmpNormal.Ok() ) + m_btnSpacingX == 0 && !m_bmpNormal.IsOk() ) { m_iFlags &= ~(wxCC_IFLAG_BUTTON_OUTSIDE); btnBorder = 0; @@ -1200,7 +1237,7 @@ void wxComboCtrlBase::CalculateAreas( int btnWidth ) // It is larger // OR // button width is set to default and blank button bg is not drawn - if ( m_bmpNormal.Ok() ) + if ( m_bmpNormal.IsOk() ) { int bmpReqWidth = m_bmpNormal.GetWidth(); int bmpReqHeight = m_bmpNormal.GetHeight(); @@ -1222,7 +1259,7 @@ void wxComboCtrlBase::CalculateAreas( int btnWidth ) { int newY = butHeight+(customBorder*2); SetClientSize(wxDefaultCoord,newY); - if ( m_bmpNormal.Ok() || m_btnArea.width != butWidth || m_btnArea.height != butHeight ) + if ( m_bmpNormal.IsOk() || m_btnArea.width != butWidth || m_btnArea.height != butHeight ) m_iFlags |= wxCC_IFLAG_HAS_NONSTANDARD_BUTTON; else m_iFlags &= ~wxCC_IFLAG_HAS_NONSTANDARD_BUTTON; @@ -1331,16 +1368,16 @@ wxSize wxComboCtrlBase::DoGetBestSize() const // TODO: Better method to calculate close-to-native control height. int fhei; - if ( m_font.Ok() ) + if ( m_font.IsOk() ) fhei = (m_font.GetPointSize()*2) + 5; - else if ( wxNORMAL_FONT->Ok() ) + else if ( wxNORMAL_FONT->IsOk() ) fhei = (wxNORMAL_FONT->GetPointSize()*2) + 5; else fhei = sizeText.y + 4; // Need to force height to accomodate bitmap? int btnSizeY = m_btnSize.y; - if ( m_bmpNormal.Ok() && fhei < btnSizeY ) + if ( m_bmpNormal.IsOk() && fhei < btnSizeY ) fhei = btnSizeY; // Control height doesn't depend on border @@ -1665,7 +1702,7 @@ void wxComboCtrlBase::DrawButton( wxDC& dc, const wxRect& rect, int flags ) dc.DrawRectangle(rect); } - if ( !m_bmpNormal.Ok() ) + if ( !m_bmpNormal.IsOk() ) { if ( flags & Button_BitmapOnly ) return; @@ -1715,6 +1752,7 @@ void wxComboCtrlBase::RecalcAndRefresh() if ( IsCreated() ) { wxSizeEvent evt(GetSize(),GetId()); + evt.SetEventObject(this); GetEventHandler()->ProcessEvent(evt); Refresh(); } @@ -1726,6 +1764,13 @@ void wxComboCtrlBase::RecalcAndRefresh() void wxComboCtrlBase::OnTextCtrlEvent(wxCommandEvent& event) { + // Avoid infinite recursion + if ( event.GetEventObject() == this ) + { + event.Skip(); + return; + } + if ( event.GetEventType() == wxEVT_COMMAND_TEXT_UPDATED ) { if ( m_ignoreEvtText > 0 ) @@ -1735,12 +1780,13 @@ void wxComboCtrlBase::OnTextCtrlEvent(wxCommandEvent& event) } } - // Change event id, object and string before relaying it forward - event.SetId(GetId()); - wxString s = event.GetString(); - event.SetEventObject(this); - event.SetString(s); - event.Skip(); + // For safety, completely re-create a new wxCommandEvent + wxCommandEvent evt2(event); + evt2.SetId(GetId()); + evt2.SetEventObject(this); + HandleWindowEvent(evt2); + + event.StopPropagation(); } // call if cursor is on button area or mouse is captured for the button @@ -1988,6 +2034,8 @@ void wxComboCtrlBase::OnCharEvent(wxKeyEvent& event) void wxComboCtrlBase::OnFocusEvent( wxFocusEvent& event ) { +// On Mac, this leads to infinite recursion and eventually a crash +#ifndef __WXMAC__ if ( event.GetEventType() == wxEVT_SET_FOCUS ) { wxWindow* tc = GetTextCtrl(); @@ -1998,6 +2046,7 @@ void wxComboCtrlBase::OnFocusEvent( wxFocusEvent& event ) } Refresh(); +#endif } void wxComboCtrlBase::OnIdleEvent( wxIdleEvent& WXUNUSED(event) ) @@ -2089,7 +2138,12 @@ void wxComboCtrlBase::DestroyPopup() wxDELETE(m_popupEvtHandler); - wxDELETE(m_popupInterface); + if ( m_popupInterface ) + { + // NB: DestroyPopup() performs 'delete this'. + m_popupInterface->DestroyPopup(); + m_popupInterface = NULL; + } if ( m_winPopup ) { @@ -2513,17 +2567,17 @@ void wxComboCtrlBase::SetButtonBitmaps( const wxBitmap& bmpNormal, m_bmpNormal = bmpNormal; m_blankButtonBg = blankButtonBg; - if ( bmpPressed.Ok() ) + if ( bmpPressed.IsOk() ) m_bmpPressed = bmpPressed; else m_bmpPressed = bmpNormal; - if ( bmpHover.Ok() ) + if ( bmpHover.IsOk() ) m_bmpHover = bmpHover; else m_bmpHover = bmpNormal; - if ( bmpDisabled.Ok() ) + if ( bmpDisabled.IsOk() ) m_bmpDisabled = bmpDisabled; else m_bmpDisabled = bmpNormal; diff --git a/Externals/wxWidgets3/src/common/config.cpp b/Externals/wxWidgets3/src/common/config.cpp index b806464a0c..e6916ff8d9 100644 --- a/Externals/wxWidgets3/src/common/config.cpp +++ b/Externals/wxWidgets3/src/common/config.cpp @@ -4,7 +4,7 @@ // Author: Vadim Zeitlin // Modified by: // Created: 07.04.98 -// RCS-ID: $Id: config.cpp 66140 2010-11-13 15:03:10Z VZ $ +// RCS-ID: $Id: config.cpp 70796 2012-03-04 00:29:31Z VZ $ // Copyright: (c) 1997 Karsten Ballueder Ballueder@usa.net // Vadim Zeitlin // Licence: wxWindows licence @@ -63,10 +63,8 @@ bool wxConfigBase::ms_bAutoCreate = true; wxConfigBase *wxAppTraitsBase::CreateConfig() { return new - #if defined(__WXMSW__) && wxUSE_CONFIG_NATIVE + #if defined(__WINDOWS__) && wxUSE_CONFIG_NATIVE wxRegConfig(wxTheApp->GetAppName(), wxTheApp->GetVendorName()); - #elif defined(__WXPALMOS__) && wxUSE_CONFIG_NATIVE - wxPrefConfig(wxTheApp->GetAppName()); #else // either we're under Unix or wish to use files even under Windows wxFileConfig(wxTheApp->GetAppName()); #endif @@ -387,7 +385,7 @@ enum Bracket Bracket_None, Bracket_Normal = ')', Bracket_Curly = '}', -#ifdef __WXMSW__ +#ifdef __WINDOWS__ Bracket_Windows = '%', // yeah, Windows people are a bit strange ;-) #endif Bracket_Max @@ -401,17 +399,17 @@ wxString wxExpandEnvVars(const wxString& str) size_t m; for ( size_t n = 0; n < str.length(); n++ ) { switch ( str[n].GetValue() ) { -#ifdef __WXMSW__ +#ifdef __WINDOWS__ case wxT('%'): -#endif //WINDOWS +#endif // __WINDOWS__ case wxT('$'): { Bracket bracket; - #ifdef __WXMSW__ + #ifdef __WINDOWS__ if ( str[n] == wxT('%') ) bracket = Bracket_Windows; else - #endif //WINDOWS + #endif // __WINDOWS__ if ( n == str.length() - 1 ) { bracket = Bracket_None; } @@ -455,7 +453,7 @@ wxString wxExpandEnvVars(const wxString& str) #endif { // variable doesn't exist => don't change anything - #ifdef __WXMSW__ + #ifdef __WINDOWS__ if ( bracket != Bracket_Windows ) #endif if ( bracket != Bracket_None ) @@ -472,10 +470,10 @@ wxString wxExpandEnvVars(const wxString& str) // // under Unix, OTOH, this warning could be useful for the user to // understand why isn't the variable expanded as intended - #ifndef __WXMSW__ + #ifndef __WINDOWS__ wxLogWarning(_("Environment variables expansion failed: missing '%c' at position %u in '%s'."), (char)bracket, (unsigned int) (m + 1), str.c_str()); - #endif // __WXMSW__ + #endif // __WINDOWS__ } else { // skip closing bracket unless the variables wasn't expanded diff --git a/Externals/wxWidgets3/src/common/containr.cpp b/Externals/wxWidgets3/src/common/containr.cpp index 8e595b273d..2b3e7d414e 100644 --- a/Externals/wxWidgets3/src/common/containr.cpp +++ b/Externals/wxWidgets3/src/common/containr.cpp @@ -4,7 +4,7 @@ // Author: Vadim Zeitlin // Modified by: // Created: 06.08.01 -// RCS-ID: $Id: containr.cpp 64940 2010-07-13 13:29:13Z VZ $ +// RCS-ID: $Id: containr.cpp 68502 2011-08-03 00:45:42Z VZ $ // Copyright: (c) 2001 Vadim Zeitlin // Licence: wxWindows licence /////////////////////////////////////////////////////////////////////////////// @@ -472,18 +472,21 @@ void wxControlContainer::HandleOnNavigationKey( wxNavigationKeyEvent& event ) // looping inside this panel (normally, the focus will go to // the next/previous item after this panel in the parent // panel). - wxWindow *focussed_child_of_parent = m_winParent; + wxWindow *focusedParent = m_winParent; while ( parent ) { - // we don't want to tab into a different dialog or frame - if ( focussed_child_of_parent->IsTopLevel() ) + // We don't want to tab into a different dialog or frame or + // even an MDI child frame, so test for this explicitly + // (and in particular don't just use IsTopLevel() which + // would return false in the latter case). + if ( focusedParent->IsTopNavigationDomain() ) break; - event.SetCurrentFocus( focussed_child_of_parent ); + event.SetCurrentFocus( focusedParent ); if ( parent->GetEventHandler()->ProcessEvent( event ) ) return; - focussed_child_of_parent = parent; + focusedParent = parent; parent = parent->GetParent(); } @@ -650,14 +653,26 @@ bool wxSetFocusToChild(wxWindow *win, wxWindow **childLastFocused) // It might happen that the window got reparented if ( (*childLastFocused)->GetParent() == win ) { - wxLogTrace(TRACE_FOCUS, - wxT("SetFocusToChild() => last child (0x%p)."), - (*childLastFocused)->GetHandle()); + // And it also could have become hidden in the meanwhile, in this + // case focus its parent instead. + while ( !(*childLastFocused)->IsShown() ) + { + *childLastFocused = (*childLastFocused)->GetParent(); + if ( !*childLastFocused ) + break; + } - // not SetFocusFromKbd(): we're restoring focus back to the old - // window and not setting it as the result of a kbd action - (*childLastFocused)->SetFocus(); - return true; + if ( *childLastFocused ) + { + wxLogTrace(TRACE_FOCUS, + wxT("SetFocusToChild() => last child (0x%p)."), + (*childLastFocused)->GetHandle()); + + // not SetFocusFromKbd(): we're restoring focus back to the old + // window and not setting it as the result of a kbd action + (*childLastFocused)->SetFocus(); + return true; + } } else { diff --git a/Externals/wxWidgets3/src/common/convauto.cpp b/Externals/wxWidgets3/src/common/convauto.cpp index 62a470aa7d..83c1ec3d0f 100644 --- a/Externals/wxWidgets3/src/common/convauto.cpp +++ b/Externals/wxWidgets3/src/common/convauto.cpp @@ -3,7 +3,7 @@ // Purpose: implementation of wxConvAuto // Author: Vadim Zeitlin // Created: 2006-04-04 -// RCS-ID: $Id: convauto.cpp 66657 2011-01-08 18:05:33Z PC $ +// RCS-ID: $Id: convauto.cpp 69675 2011-11-05 11:23:41Z VZ $ // Copyright: (c) 2006 Vadim Zeitlin // Licence: wxWindows licence /////////////////////////////////////////////////////////////////////////////// @@ -31,6 +31,17 @@ // seem to be a good idea and there is no other reasonable alternative wxFontEncoding wxConvAuto::ms_defaultMBEncoding = wxFONTENCODING_ISO8859_1; +namespace +{ + +const char BOM_UTF32BE[] = { '\x00', '\x00', '\xFE', '\xFF' }; +const char BOM_UTF32LE[] = { '\xFF', '\xFE', '\x00', '\x00' }; +const char BOM_UTF16BE[] = { '\xFE', '\xFF' }; +const char BOM_UTF16LE[] = { '\xFF', '\xFE' }; +const char BOM_UTF8[] = { '\xEF', '\xBB', '\xBF' }; + +} // anonymous namespace + // ============================================================================ // implementation // ============================================================================ @@ -45,7 +56,29 @@ void wxConvAuto::SetFallbackEncoding(wxFontEncoding enc) } /* static */ -wxConvAuto::BOMType wxConvAuto::DetectBOM(const char *src, size_t srcLen) +const char* wxConvAuto::GetBOMChars(wxBOM bom, size_t* count) +{ + wxCHECK_MSG( count , NULL, wxS("count pointer must be provided") ); + + switch ( bom ) + { + case wxBOM_UTF32BE: *count = WXSIZEOF(BOM_UTF32BE); return BOM_UTF32BE; + case wxBOM_UTF32LE: *count = WXSIZEOF(BOM_UTF32LE); return BOM_UTF32LE; + case wxBOM_UTF16BE: *count = WXSIZEOF(BOM_UTF16BE); return BOM_UTF16BE; + case wxBOM_UTF16LE: *count = WXSIZEOF(BOM_UTF16LE); return BOM_UTF16LE; + case wxBOM_UTF8 : *count = WXSIZEOF(BOM_UTF8 ); return BOM_UTF8; + case wxBOM_Unknown: + case wxBOM_None: + wxFAIL_MSG( wxS("Invalid BOM type") ); + return NULL; + } + + wxFAIL_MSG( wxS("Unknown BOM type") ); + return NULL; +} + +/* static */ +wxBOM wxConvAuto::DetectBOM(const char *src, size_t srcLen) { // examine the buffer for BOM presence // @@ -65,14 +98,14 @@ wxConvAuto::BOMType wxConvAuto::DetectBOM(const char *src, size_t srcLen) switch ( srcLen ) { case 0: - return BOM_Unknown; + return wxBOM_Unknown; case 1: if ( src[0] == '\x00' || src[0] == '\xFF' || src[0] == '\xFE' || src[0] == '\xEF') { // this could be a BOM but we don't know yet - return BOM_Unknown; + return wxBOM_Unknown; } break; @@ -81,22 +114,22 @@ wxConvAuto::BOMType wxConvAuto::DetectBOM(const char *src, size_t srcLen) if ( src[0] == '\xEF' && src[1] == '\xBB' ) { if ( srcLen == 3 ) - return src[2] == '\xBF' ? BOM_UTF8 : BOM_None; + return src[2] == '\xBF' ? wxBOM_UTF8 : wxBOM_None; - return BOM_Unknown; + return wxBOM_Unknown; } if ( src[0] == '\xFE' && src[1] == '\xFF' ) - return BOM_UTF16BE; + return wxBOM_UTF16BE; if ( src[0] == '\xFF' && src[1] == '\xFE' ) { // if the next byte is 0, it could be an UTF-32LE BOM but if it // isn't we can be sure it's UTF-16LE if ( srcLen == 3 && src[2] != '\x00' ) - return BOM_UTF16LE; + return wxBOM_UTF16LE; - return BOM_Unknown; + return wxBOM_Unknown; } if ( src[0] == '\x00' && src[1] == '\x00' ) @@ -104,9 +137,9 @@ wxConvAuto::BOMType wxConvAuto::DetectBOM(const char *src, size_t srcLen) // this could only be UTF-32BE, check that the data we have so // far allows for it if ( srcLen == 3 && src[2] != '\xFE' ) - return BOM_None; + return wxBOM_None; - return BOM_Unknown; + return wxBOM_Unknown; } break; @@ -114,61 +147,61 @@ wxConvAuto::BOMType wxConvAuto::DetectBOM(const char *src, size_t srcLen) // we have at least 4 characters so we may finally decide whether // we have a BOM or not if ( src[0] == '\xEF' && src[1] == '\xBB' && src[2] == '\xBF' ) - return BOM_UTF8; + return wxBOM_UTF8; if ( src[0] == '\x00' && src[1] == '\x00' && src[2] == '\xFE' && src[3] == '\xFF' ) - return BOM_UTF32BE; + return wxBOM_UTF32BE; if ( src[0] == '\xFF' && src[1] == '\xFE' && src[2] == '\x00' && src[3] == '\x00' ) - return BOM_UTF32LE; + return wxBOM_UTF32LE; if ( src[0] == '\xFE' && src[1] == '\xFF' ) - return BOM_UTF16BE; + return wxBOM_UTF16BE; if ( src[0] == '\xFF' && src[1] == '\xFE' ) - return BOM_UTF16LE; + return wxBOM_UTF16LE; } - return BOM_None; + return wxBOM_None; } -void wxConvAuto::InitFromBOM(BOMType bomType) +void wxConvAuto::InitFromBOM(wxBOM bomType) { m_consumedBOM = false; switch ( bomType ) { - case BOM_Unknown: + case wxBOM_Unknown: wxFAIL_MSG( "shouldn't be called for this BOM type" ); break; - case BOM_None: + case wxBOM_None: // use the default break; - case BOM_UTF32BE: + case wxBOM_UTF32BE: m_conv = new wxMBConvUTF32BE; m_ownsConv = true; break; - case BOM_UTF32LE: + case wxBOM_UTF32LE: m_conv = new wxMBConvUTF32LE; m_ownsConv = true; break; - case BOM_UTF16BE: + case wxBOM_UTF16BE: m_conv = new wxMBConvUTF16BE; m_ownsConv = true; break; - case BOM_UTF16LE: + case wxBOM_UTF16LE: m_conv = new wxMBConvUTF16LE; m_ownsConv = true; break; - case BOM_UTF8: + case wxBOM_UTF8: InitWithUTF8(); break; @@ -191,25 +224,25 @@ void wxConvAuto::SkipBOM(const char **src, size_t *len) const int ofs; switch ( m_bomType ) { - case BOM_Unknown: + case wxBOM_Unknown: wxFAIL_MSG( "shouldn't be called for this BOM type" ); return; - case BOM_None: + case wxBOM_None: ofs = 0; break; - case BOM_UTF32BE: - case BOM_UTF32LE: + case wxBOM_UTF32BE: + case wxBOM_UTF32LE: ofs = 4; break; - case BOM_UTF16BE: - case BOM_UTF16LE: + case wxBOM_UTF16BE: + case wxBOM_UTF16LE: ofs = 2; break; - case BOM_UTF8: + case wxBOM_UTF8: ofs = 3; break; @@ -226,7 +259,7 @@ void wxConvAuto::SkipBOM(const char **src, size_t *len) const bool wxConvAuto::InitFromInput(const char *src, size_t len) { m_bomType = DetectBOM(src, len == wxNO_LEN ? strlen(src) : len); - if ( m_bomType == BOM_Unknown ) + if ( m_bomType == wxBOM_Unknown ) return false; InitFromBOM(m_bomType); @@ -275,7 +308,7 @@ wxConvAuto::ToWChar(wchar_t *dst, size_t dstLen, // try to convert using the auto-detected encoding size_t rc = m_conv->ToWChar(dst, dstLen, src, srcLen); - if ( rc == wxCONV_FAILED && m_bomType == BOM_None ) + if ( rc == wxCONV_FAILED && m_bomType == wxBOM_None ) { // if the conversion failed but we didn't really detect anything and // simply tried UTF-8 by default, retry it using the fall-back diff --git a/Externals/wxWidgets3/src/common/cshelp.cpp b/Externals/wxWidgets3/src/common/cshelp.cpp index 69c48d46fd..d05bb9265d 100644 --- a/Externals/wxWidgets3/src/common/cshelp.cpp +++ b/Externals/wxWidgets3/src/common/cshelp.cpp @@ -4,7 +4,7 @@ // Author: Julian Smart, Vadim Zeitlin // Modified by: // Created: 08/09/2000 -// RCS-ID: $Id: cshelp.cpp 61508 2009-07-23 20:30:22Z VZ $ +// RCS-ID: $Id: cshelp.cpp 68859 2011-08-23 04:55:46Z DS $ // Copyright: (c) 2000 Julian Smart, Vadim Zeitlin // Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// @@ -284,7 +284,7 @@ wxContextHelpButton::wxContextHelpButton(wxWindow* parent, long style) #if defined(__WXPM__) : wxBitmapButton(parent, id, wxBitmap(wxCSQUERY_BITMAP - ,wxBITMAP_TYPE_RESOURCE + ,wxBITMAP_TYPE_BMP_RESOURCE ), pos, size, style) #else diff --git a/Externals/wxWidgets3/src/common/ctrlcmn.cpp b/Externals/wxWidgets3/src/common/ctrlcmn.cpp index 8798b1ad4a..3fc3cd64a3 100644 --- a/Externals/wxWidgets3/src/common/ctrlcmn.cpp +++ b/Externals/wxWidgets3/src/common/ctrlcmn.cpp @@ -4,7 +4,7 @@ // Author: Vadim Zeitlin // Modified by: // Created: 26.07.99 -// RCS-ID: $Id: ctrlcmn.cpp 67062 2011-02-27 12:48:07Z VZ $ +// RCS-ID: $Id: ctrlcmn.cpp 67681 2011-05-03 16:29:04Z DS $ // Copyright: (c) wxWidgets team // Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// @@ -588,7 +588,7 @@ wxSize wxStaticBitmapBase::DoGetBestSize() const { wxSize best; wxBitmap bmp = GetBitmap(); - if ( bmp.Ok() ) + if ( bmp.IsOk() ) best = wxSize(bmp.GetWidth(), bmp.GetHeight()); else // this is completely arbitrary diff --git a/Externals/wxWidgets3/src/common/datavcmn.cpp b/Externals/wxWidgets3/src/common/datavcmn.cpp index 69894acbe5..2eb5731566 100644 --- a/Externals/wxWidgets3/src/common/datavcmn.cpp +++ b/Externals/wxWidgets3/src/common/datavcmn.cpp @@ -3,7 +3,7 @@ // Purpose: wxDataViewCtrl base classes and common parts // Author: Robert Roebling // Created: 2006/02/20 -// RCS-ID: $Id: datavcmn.cpp 66403 2010-12-19 15:02:56Z VZ $ +// RCS-ID: $Id: datavcmn.cpp 70377 2012-01-17 14:05:17Z VS $ // Copyright: (c) 2006, Robert Roebling // Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// @@ -26,6 +26,7 @@ #include "wx/crt.h" #endif +#include "wx/datectrl.h" #include "wx/spinctrl.h" #include "wx/choice.h" #include "wx/imaglist.h" @@ -40,7 +41,7 @@ namespace class wxDataViewEditorCtrlEvtHandler: public wxEvtHandler { public: - wxDataViewEditorCtrlEvtHandler(wxControl *editor, wxDataViewRenderer *owner) + wxDataViewEditorCtrlEvtHandler(wxWindow *editor, wxDataViewRenderer *owner) { m_editorCtrl = editor; m_owner = owner; @@ -59,7 +60,7 @@ protected: private: wxDataViewRenderer *m_owner; - wxControl *m_editorCtrl; + wxWindow *m_editorCtrl; bool m_finished; bool m_focusOnIdle; @@ -387,7 +388,7 @@ wxDataViewIndexListModel::wxDataViewIndexListModel( unsigned int initial_size ) // build initial index unsigned int i; for (i = 1; i < initial_size+1; i++) - m_hash.Add( wxUIntToPtr(i) ); + m_hash.Add( wxDataViewItem(wxUIntToPtr(i)) ); m_nextFreeID = initial_size + 1; } @@ -403,7 +404,7 @@ void wxDataViewIndexListModel::Reset( unsigned int new_size ) // build initial index unsigned int i; for (i = 1; i < new_size+1; i++) - m_hash.Add( wxUIntToPtr(i) ); + m_hash.Add( wxDataViewItem(wxUIntToPtr(i)) ); m_nextFreeID = new_size + 1; @@ -417,8 +418,8 @@ void wxDataViewIndexListModel::RowPrepended() unsigned int id = m_nextFreeID; m_nextFreeID++; - m_hash.Insert( wxUIntToPtr(id), 0 ); wxDataViewItem item( wxUIntToPtr(id) ); + m_hash.Insert( item, 0 ); ItemAdded( wxDataViewItem(0), item ); } @@ -430,8 +431,8 @@ void wxDataViewIndexListModel::RowInserted( unsigned int before ) unsigned int id = m_nextFreeID; m_nextFreeID++; - m_hash.Insert( wxUIntToPtr(id), before ); wxDataViewItem item( wxUIntToPtr(id) ); + m_hash.Insert( item, before ); ItemAdded( wxDataViewItem(0), item ); } @@ -440,8 +441,8 @@ void wxDataViewIndexListModel::RowAppended() unsigned int id = m_nextFreeID; m_nextFreeID++; - m_hash.Add( wxUIntToPtr(id) ); wxDataViewItem item( wxUIntToPtr(id) ); + m_hash.Add( item ); ItemAdded( wxDataViewItem(0), item ); } @@ -450,15 +451,12 @@ void wxDataViewIndexListModel::RowDeleted( unsigned int row ) m_ordered = false; wxDataViewItem item( m_hash[row] ); - /* wxDataViewModel:: */ ItemDeleted( wxDataViewItem(0), item ); m_hash.RemoveAt( row ); + /* wxDataViewModel:: */ ItemDeleted( wxDataViewItem(0), item ); } void wxDataViewIndexListModel::RowsDeleted( const wxArrayInt &rows ) { - wxArrayInt sorted = rows; - sorted.Sort( my_sort ); - m_ordered = false; wxDataViewItemArray array; @@ -468,10 +466,13 @@ void wxDataViewIndexListModel::RowsDeleted( const wxArrayInt &rows ) wxDataViewItem item( m_hash[rows[i]] ); array.Add( item ); } - /* wxDataViewModel:: */ ItemsDeleted( wxDataViewItem(0), array ); + wxArrayInt sorted = rows; + sorted.Sort( my_sort ); for (i = 0; i < sorted.GetCount(); i++) m_hash.RemoveAt( sorted[i] ); + + /* wxDataViewModel:: */ ItemsDeleted( wxDataViewItem(0), array ); } void wxDataViewIndexListModel::RowChanged( unsigned int row ) @@ -490,7 +491,7 @@ unsigned int wxDataViewIndexListModel::GetRow( const wxDataViewItem &item ) cons return wxPtrToUInt(item.GetID())-1; // assert for not found - return (unsigned int) m_hash.Index( item.GetID() ); + return (unsigned int) m_hash.Index( item ); } wxDataViewItem wxDataViewIndexListModel::GetItem( unsigned int row ) const @@ -671,9 +672,11 @@ wxDataViewRendererBase::wxDataViewRendererBase( const wxString &varianttype, wxDataViewRendererBase::~wxDataViewRendererBase() { + if ( m_editorCtrl ) + DestroyEditControl(); } -const wxDataViewCtrl* wxDataViewRendererBase::GetView() const +wxDataViewCtrl* wxDataViewRendererBase::GetView() const { return const_cast(this)->GetOwner()->GetOwner(); } @@ -728,12 +731,15 @@ bool wxDataViewRendererBase::StartEditing( const wxDataViewItem &item, wxRect la void wxDataViewRendererBase::DestroyEditControl() { + // Remove our event handler first to prevent it from (recursively) calling + // us again as it would do via a call to FinishEditing() when the editor + // loses focus when we hide it below. + wxEvtHandler * const handler = m_editorCtrl->PopEventHandler(); + // Hide the control immediately but don't delete it yet as there could be // some pending messages for it. m_editorCtrl->Hide(); - wxEvtHandler * const handler = m_editorCtrl->PopEventHandler(); - wxPendingDelete.Append(handler); wxPendingDelete.Append(m_editorCtrl); } @@ -743,8 +749,6 @@ void wxDataViewRendererBase::CancelEditing() if (!m_editorCtrl) return; - GetOwner()->GetOwner()->GetMainWindow()->SetFocus(); - DestroyEditControl(); } @@ -758,25 +762,31 @@ bool wxDataViewRendererBase::FinishEditing() wxDataViewCtrl* dv_ctrl = GetOwner()->GetOwner(); - dv_ctrl->GetMainWindow()->SetFocus(); - DestroyEditControl(); - if (!Validate(value)) - return false; + dv_ctrl->GetMainWindow()->SetFocus(); + bool isValid = Validate(value); unsigned int col = GetOwner()->GetModelColumn(); - dv_ctrl->GetModel()->ChangeValue(value, m_item, col); // Now we should send Editing Done event wxDataViewEvent event( wxEVT_COMMAND_DATAVIEW_ITEM_EDITING_DONE, dv_ctrl->GetId() ); event.SetDataViewColumn( GetOwner() ); event.SetModel( dv_ctrl->GetModel() ); event.SetItem( m_item ); + event.SetValue( value ); + event.SetColumn( col ); + event.SetEditCanceled( !isValid ); event.SetEventObject( dv_ctrl ); dv_ctrl->GetEventHandler()->ProcessEvent( event ); - return true; + if ( isValid && event.IsAllowed() ) + { + dv_ctrl->GetModel()->ChangeValue(value, m_item, col); + return true; + } + + return false; } void wxDataViewRendererBase::PrepareForItem(const wxDataViewModel *model, @@ -799,6 +809,31 @@ void wxDataViewRendererBase::PrepareForItem(const wxDataViewModel *model, // wxDataViewCustomRendererBase // ---------------------------------------------------------------------------- +bool wxDataViewCustomRendererBase::ActivateCell(const wxRect& cell, + wxDataViewModel *model, + const wxDataViewItem & item, + unsigned int col, + const wxMouseEvent* mouseEvent) +{ + // Compatibility code + if ( mouseEvent ) + return LeftClick(mouseEvent->GetPosition(), cell, model, item, col); + else + return Activate(cell, model, item, col); +} + +void wxDataViewCustomRendererBase::RenderBackground(wxDC* dc, const wxRect& rect) +{ + if ( !m_attr.HasBackgroundColour() ) + return; + + const wxColour& colour = m_attr.GetBackgroundColour(); + wxDCPenChanger changePen(*dc, colour); + wxDCBrushChanger changeBrush(*dc, colour); + + dc->DrawRectangle(rect); +} + void wxDataViewCustomRendererBase::WXCallRender(wxRect rectCell, wxDC *dc, int state) { @@ -1087,6 +1122,16 @@ void wxDataViewCtrlBase::SetCurrentItem(const wxDataViewItem& item) Select(item); } +wxDataViewItem wxDataViewCtrlBase::GetSelection() const +{ + if ( GetSelectedItemsCount() != 1 ) + return wxDataViewItem(); + + wxDataViewItemArray selections; + GetSelections(selections); + return selections[0]; +} + wxDataViewColumn * wxDataViewCtrlBase::AppendTextColumn( const wxString &label, unsigned int model_column, wxDataViewCellMode mode, int width, wxAlignment align, int flags ) @@ -1373,6 +1418,11 @@ wxDataViewCtrlBase::InsertColumn( unsigned int WXUNUSED(pos), wxDataViewColumn * return true; } +void wxDataViewCtrlBase::StartEditor(const wxDataViewItem& item, unsigned int column) +{ + EditItem(item, GetColumn(column)); +} + // --------------------------------------------------------- // wxDataViewEvent // --------------------------------------------------------- @@ -1417,7 +1467,7 @@ wxDataViewSpinRenderer::wxDataViewSpinRenderer( int min, int max, wxDataViewCell m_max = max; } -wxControl* wxDataViewSpinRenderer::CreateEditorCtrl( wxWindow *parent, wxRect labelRect, const wxVariant &value ) +wxWindow* wxDataViewSpinRenderer::CreateEditorCtrl( wxWindow *parent, wxRect labelRect, const wxVariant &value ) { long l = value; wxSize size = labelRect.GetSize(); @@ -1437,7 +1487,7 @@ wxControl* wxDataViewSpinRenderer::CreateEditorCtrl( wxWindow *parent, wxRect la return sc; } -bool wxDataViewSpinRenderer::GetValueFromEditorCtrl( wxControl* editor, wxVariant &value ) +bool wxDataViewSpinRenderer::GetValueFromEditorCtrl( wxWindow* editor, wxVariant &value ) { wxSpinCtrl *sc = (wxSpinCtrl*) editor; long l = sc->GetValue(); @@ -1455,7 +1505,15 @@ bool wxDataViewSpinRenderer::Render( wxRect rect, wxDC *dc, int state ) wxSize wxDataViewSpinRenderer::GetSize() const { - return wxSize(80,16); + wxSize sz = GetTextExtent(wxString::Format("%d", (int)m_data)); + + // Allow some space for the spin buttons, which is approximately the size + // of a scrollbar (and getting pixel-exact value would be complicated). + // Also add some whitespace between the text and the button: + sz.x += wxSystemSettings::GetMetric(wxSYS_VSCROLL_X); + sz.x += GetTextExtent("M").x; + + return sz; } bool wxDataViewSpinRenderer::SetValue( const wxVariant &value ) @@ -1482,15 +1540,22 @@ wxDataViewChoiceRenderer::wxDataViewChoiceRenderer( const wxArrayString& choices m_choices = choices; } -wxControl* wxDataViewChoiceRenderer::CreateEditorCtrl( wxWindow *parent, wxRect labelRect, const wxVariant &value ) +wxWindow* wxDataViewChoiceRenderer::CreateEditorCtrl( wxWindow *parent, wxRect labelRect, const wxVariant &value ) { - wxChoice* c = new wxChoice(parent, wxID_ANY, labelRect.GetTopLeft(), wxDefaultSize, m_choices ); + wxChoice* c = new wxChoice + ( + parent, + wxID_ANY, + labelRect.GetTopLeft(), + wxSize(labelRect.GetWidth(), -1), + m_choices + ); c->Move(labelRect.GetRight() - c->GetRect().width, wxDefaultCoord); c->SetStringSelection( value.GetString() ); return c; } -bool wxDataViewChoiceRenderer::GetValueFromEditorCtrl( wxControl* editor, wxVariant &value ) +bool wxDataViewChoiceRenderer::GetValueFromEditorCtrl( wxWindow* editor, wxVariant &value ) { wxChoice *c = (wxChoice*) editor; wxString s = c->GetStringSelection(); @@ -1506,7 +1571,18 @@ bool wxDataViewChoiceRenderer::Render( wxRect rect, wxDC *dc, int state ) wxSize wxDataViewChoiceRenderer::GetSize() const { - return wxSize(80,16); + wxSize sz; + + for ( wxArrayString::const_iterator i = m_choices.begin(); i != m_choices.end(); ++i ) + sz.IncTo(GetTextExtent(*i)); + + // Allow some space for the right-side button, which is approximately the + // size of a scrollbar (and getting pixel-exact value would be complicated). + // Also add some whitespace between the text and the button: + sz.x += wxSystemSettings::GetMetric(wxSYS_VSCROLL_X); + sz.x += GetTextExtent("M").x; + + return sz; } bool wxDataViewChoiceRenderer::SetValue( const wxVariant &value ) @@ -1531,14 +1607,14 @@ wxDataViewChoiceByIndexRenderer::wxDataViewChoiceByIndexRenderer( const wxArrayS { } -wxControl* wxDataViewChoiceByIndexRenderer::CreateEditorCtrl( wxWindow *parent, wxRect labelRect, const wxVariant &value ) +wxWindow* wxDataViewChoiceByIndexRenderer::CreateEditorCtrl( wxWindow *parent, wxRect labelRect, const wxVariant &value ) { wxVariant string_value = GetChoice( value.GetLong() ); return wxDataViewChoiceRenderer::CreateEditorCtrl( parent, labelRect, string_value ); } -bool wxDataViewChoiceByIndexRenderer::GetValueFromEditorCtrl( wxControl* editor, wxVariant &value ) +bool wxDataViewChoiceByIndexRenderer::GetValueFromEditorCtrl( wxWindow* editor, wxVariant &value ) { wxVariant string_value; if (!wxDataViewChoiceRenderer::GetValueFromEditorCtrl( editor, string_value )) @@ -1566,6 +1642,64 @@ bool wxDataViewChoiceByIndexRenderer::GetValue( wxVariant &value ) const #endif +// --------------------------------------------------------- +// wxDataViewDateRenderer +// --------------------------------------------------------- + +#if (defined(wxHAS_GENERIC_DATAVIEWCTRL) || defined(__WXGTK__)) && wxUSE_DATEPICKCTRL + +wxDataViewDateRenderer::wxDataViewDateRenderer(const wxString& varianttype, + wxDataViewCellMode mode, int align) + : wxDataViewCustomRenderer(varianttype, mode, align) +{ +} + +wxWindow * +wxDataViewDateRenderer::CreateEditorCtrl(wxWindow *parent, wxRect labelRect, const wxVariant& value) +{ + return new wxDatePickerCtrl + ( + parent, + wxID_ANY, + value.GetDateTime(), + labelRect.GetTopLeft(), + labelRect.GetSize() + ); +} + +bool wxDataViewDateRenderer::GetValueFromEditorCtrl(wxWindow *editor, wxVariant& value) +{ + wxDatePickerCtrl *ctrl = static_cast(editor); + value = ctrl->GetValue(); + return true; +} + +bool wxDataViewDateRenderer::SetValue(const wxVariant& value) +{ + m_date = value.GetDateTime(); + return true; +} + +bool wxDataViewDateRenderer::GetValue(wxVariant& value) const +{ + value = m_date; + return true; +} + +bool wxDataViewDateRenderer::Render(wxRect cell, wxDC* dc, int state) +{ + wxString tmp = m_date.FormatDate(); + RenderText( tmp, 0, cell, dc, state ); + return true; +} + +wxSize wxDataViewDateRenderer::GetSize() const +{ + return GetTextExtent(m_date.FormatDate()); +} + +#endif // (defined(wxHAS_GENERIC_DATAVIEWCTRL) || defined(__WXGTK__)) && wxUSE_DATEPICKCTRL + //----------------------------------------------------------------------------- // wxDataViewListStore //----------------------------------------------------------------------------- @@ -1972,7 +2106,7 @@ wxDataViewItem wxDataViewTreeStore::GetNthChild( const wxDataViewItem& parent, u wxDataViewTreeStoreNodeList::compatibility_iterator node = parent_node->GetChildren().Item( pos ); if (node) - return node->GetData(); + return wxDataViewItem(node->GetData()); return wxDataViewItem(0); } @@ -2078,7 +2212,7 @@ void wxDataViewTreeStore::DeleteChildren( const wxDataViewItem& item ) void wxDataViewTreeStore::DeleteAllItems() { - DeleteChildren(m_root); + DeleteChildren(wxDataViewItem(m_root)); } void @@ -2215,11 +2349,6 @@ BEGIN_EVENT_TABLE(wxDataViewTreeCtrl,wxDataViewCtrl) EVT_SIZE( wxDataViewTreeCtrl::OnSize ) END_EVENT_TABLE() -wxDataViewTreeCtrl::~wxDataViewTreeCtrl() -{ - delete m_imageList; -} - bool wxDataViewTreeCtrl::Create( wxWindow *parent, wxWindowID id, const wxPoint& pos, const wxSize& size, long style, const wxValidator& validator ) { @@ -2238,27 +2367,17 @@ bool wxDataViewTreeCtrl::Create( wxWindow *parent, wxWindowID id, wxDATAVIEW_CELL_EDITABLE, -1, // default width wxALIGN_NOT, // and alignment - 0 // not resizeable + 0 // not resizable ); return true; } -void wxDataViewTreeCtrl::SetImageList( wxImageList *imagelist ) -{ - delete m_imageList; - - m_imageList = imagelist; -} - wxDataViewItem wxDataViewTreeCtrl::AppendItem( const wxDataViewItem& parent, const wxString &text, int iconIndex, wxClientData *data ) { - wxIcon icon = wxNullIcon; - if (m_imageList && (iconIndex != -1)) - icon = m_imageList->GetIcon( iconIndex ); - - wxDataViewItem res = GetStore()->AppendItem( parent, text, icon, data ); + wxDataViewItem res = GetStore()-> + AppendItem( parent, text, GetImage(iconIndex), data ); GetStore()->ItemAdded( parent, res ); @@ -2268,11 +2387,8 @@ wxDataViewItem wxDataViewTreeCtrl::AppendItem( const wxDataViewItem& parent, wxDataViewItem wxDataViewTreeCtrl::PrependItem( const wxDataViewItem& parent, const wxString &text, int iconIndex, wxClientData *data ) { - wxIcon icon = wxNullIcon; - if (m_imageList && (iconIndex != -1)) - icon = m_imageList->GetIcon( iconIndex ); - - wxDataViewItem res = GetStore()->PrependItem( parent, text, icon, data ); + wxDataViewItem res = GetStore()-> + PrependItem( parent, text, GetImage(iconIndex), data ); GetStore()->ItemAdded( parent, res ); @@ -2282,11 +2398,8 @@ wxDataViewItem wxDataViewTreeCtrl::PrependItem( const wxDataViewItem& parent, wxDataViewItem wxDataViewTreeCtrl::InsertItem( const wxDataViewItem& parent, const wxDataViewItem& previous, const wxString &text, int iconIndex, wxClientData *data ) { - wxIcon icon = wxNullIcon; - if (m_imageList && (iconIndex != -1)) - icon = m_imageList->GetIcon( iconIndex ); - - wxDataViewItem res = GetStore()->InsertItem( parent, previous, text, icon, data ); + wxDataViewItem res = GetStore()-> + InsertItem( parent, previous, text, GetImage(iconIndex), data ); GetStore()->ItemAdded( parent, res ); @@ -2296,15 +2409,9 @@ wxDataViewItem wxDataViewTreeCtrl::InsertItem( const wxDataViewItem& parent, con wxDataViewItem wxDataViewTreeCtrl::PrependContainer( const wxDataViewItem& parent, const wxString &text, int iconIndex, int expandedIndex, wxClientData *data ) { - wxIcon icon = wxNullIcon; - if (m_imageList && (iconIndex != -1)) - icon = m_imageList->GetIcon( iconIndex ); - - wxIcon expanded = wxNullIcon; - if (m_imageList && (expandedIndex != -1)) - expanded = m_imageList->GetIcon( expandedIndex ); - - wxDataViewItem res = GetStore()->PrependContainer( parent, text, icon, expanded, data ); + wxDataViewItem res = GetStore()-> + PrependContainer( parent, text, + GetImage(iconIndex), GetImage(expandedIndex), data ); GetStore()->ItemAdded( parent, res ); @@ -2314,15 +2421,9 @@ wxDataViewItem wxDataViewTreeCtrl::PrependContainer( const wxDataViewItem& paren wxDataViewItem wxDataViewTreeCtrl::AppendContainer( const wxDataViewItem& parent, const wxString &text, int iconIndex, int expandedIndex, wxClientData *data ) { - wxIcon icon = wxNullIcon; - if (m_imageList && (iconIndex != -1)) - icon = m_imageList->GetIcon( iconIndex ); - - wxIcon expanded = wxNullIcon; - if (m_imageList && (expandedIndex != -1)) - expanded = m_imageList->GetIcon( expandedIndex ); - - wxDataViewItem res = GetStore()->AppendContainer( parent, text, icon, expanded, data ); + wxDataViewItem res = GetStore()-> + AppendContainer( parent, text, + GetImage(iconIndex), GetImage(expandedIndex), data ); GetStore()->ItemAdded( parent, res ); @@ -2332,15 +2433,9 @@ wxDataViewItem wxDataViewTreeCtrl::AppendContainer( const wxDataViewItem& parent wxDataViewItem wxDataViewTreeCtrl::InsertContainer( const wxDataViewItem& parent, const wxDataViewItem& previous, const wxString &text, int iconIndex, int expandedIndex, wxClientData *data ) { - wxIcon icon = wxNullIcon; - if (m_imageList && (iconIndex != -1)) - icon = m_imageList->GetIcon( iconIndex ); - - wxIcon expanded = wxNullIcon; - if (m_imageList && (expandedIndex != -1)) - expanded = m_imageList->GetIcon( expandedIndex ); - - wxDataViewItem res = GetStore()->InsertContainer( parent, previous, text, icon, expanded, data ); + wxDataViewItem res = GetStore()-> + InsertContainer( parent, previous, text, + GetImage(iconIndex), GetImage(expandedIndex), data ); GetStore()->ItemAdded( parent, res ); @@ -2409,7 +2504,7 @@ void wxDataViewTreeCtrl::DeleteAllItems() void wxDataViewTreeCtrl::OnExpanded( wxDataViewEvent &event ) { - if (m_imageList) return; + if (HasImageList()) return; wxDataViewTreeStoreContainerNode* container = GetStore()->FindContainerNode( event.GetItem() ); if (!container) return; @@ -2421,7 +2516,7 @@ void wxDataViewTreeCtrl::OnExpanded( wxDataViewEvent &event ) void wxDataViewTreeCtrl::OnCollapsed( wxDataViewEvent &event ) { - if (m_imageList) return; + if (HasImageList()) return; wxDataViewTreeStoreContainerNode* container = GetStore()->FindContainerNode( event.GetItem() ); if (!container) return; diff --git a/Externals/wxWidgets3/src/common/datetime.cpp b/Externals/wxWidgets3/src/common/datetime.cpp index 19e3b3e291..e131abdbc8 100644 --- a/Externals/wxWidgets3/src/common/datetime.cpp +++ b/Externals/wxWidgets3/src/common/datetime.cpp @@ -5,7 +5,7 @@ // Author: Vadim Zeitlin // Modified by: // Created: 11.05.99 -// RCS-ID: $Id: datetime.cpp 66245 2010-11-23 13:11:10Z VZ $ +// RCS-ID: $Id: datetime.cpp 70796 2012-03-04 00:29:31Z VZ $ // Copyright: (c) 1999 Vadim Zeitlin // parts of code taken from sndcal library by Scott E. Lee: // @@ -63,7 +63,7 @@ #if !defined(wxUSE_DATETIME) || wxUSE_DATETIME #ifndef WX_PRECOMP - #ifdef __WXMSW__ + #ifdef __WINDOWS__ #include "wx/msw/wrapwin.h" #endif #include "wx/string.h" @@ -75,6 +75,7 @@ #endif // WX_PRECOMP #include "wx/thread.h" +#include "wx/time.h" #include "wx/tokenzr.h" #include @@ -108,98 +109,6 @@ wxCUSTOM_TYPE_INFO(wxDateTime, wxToStringConverter , wxFromStringCon #endif // wxUSE_EXTENDED_RTTI - -// ---------------------------------------------------------------------------- -// conditional compilation -// ---------------------------------------------------------------------------- - -#if defined(__MWERKS__) && wxUSE_UNICODE - #include -#endif - -#if defined(__DJGPP__) || defined(__WINE__) - #include - #include -#endif - -#ifndef WX_GMTOFF_IN_TM - // Define it for some systems which don't (always) use configure but are - // known to have tm_gmtoff field. - #if defined(__WXPALMOS__) || defined(__DARWIN__) - #define WX_GMTOFF_IN_TM - #endif -#endif - -// NB: VC8 safe time functions could/should be used for wxMSW as well probably -#if defined(__WXWINCE__) && defined(__VISUALC8__) - -struct tm *wxLocaltime_r(const time_t *t, struct tm* tm) -{ - __time64_t t64 = *t; - return _localtime64_s(tm, &t64) == 0 ? tm : NULL; -} - -struct tm *wxGmtime_r(const time_t* t, struct tm* tm) -{ - __time64_t t64 = *t; - return _gmtime64_s(tm, &t64) == 0 ? tm : NULL; -} - -#else // !wxWinCE with VC8 - -#if (!defined(HAVE_LOCALTIME_R) || !defined(HAVE_GMTIME_R)) && wxUSE_THREADS && !defined(__WINDOWS__) -static wxMutex timeLock; -#endif - -#ifndef HAVE_LOCALTIME_R -struct tm *wxLocaltime_r(const time_t* ticks, struct tm* temp) -{ -#if wxUSE_THREADS && !defined(__WINDOWS__) - // No need to waste time with a mutex on windows since it's using - // thread local storage for localtime anyway. - wxMutexLocker locker(timeLock); -#endif - - // Borland CRT crashes when passed 0 ticks for some reason, see SF bug 1704438 -#ifdef __BORLANDC__ - if ( !*ticks ) - return NULL; -#endif - - const tm * const t = localtime(ticks); - if ( !t ) - return NULL; - - memcpy(temp, t, sizeof(struct tm)); - return temp; -} -#endif // !HAVE_LOCALTIME_R - -#ifndef HAVE_GMTIME_R -struct tm *wxGmtime_r(const time_t* ticks, struct tm* temp) -{ -#if wxUSE_THREADS && !defined(__WINDOWS__) - // No need to waste time with a mutex on windows since it's - // using thread local storage for gmtime anyway. - wxMutexLocker locker(timeLock); -#endif - -#ifdef __BORLANDC__ - if ( !*ticks ) - return NULL; -#endif - - const tm * const t = gmtime(ticks); - if ( !t ) - return NULL; - - memcpy(temp, gmtime(ticks), sizeof(struct tm)); - return temp; -} -#endif // !HAVE_GMTIME_R - -#endif // wxWinCE with VC8/other platforms - // ---------------------------------------------------------------------------- // macros // ---------------------------------------------------------------------------- @@ -327,63 +236,6 @@ wxDateTime::wxDateTime_t GetNumOfDaysInMonth(int year, wxDateTime::Month month) return daysInMonth[wxDateTime::IsLeapYear(year)][month]; } -// returns the time zone in the C sense, i.e. the difference UTC - local -// (in seconds) -// NOTE: not static because used by datetimefmt.cpp -int GetTimeZone() -{ -#ifdef WX_GMTOFF_IN_TM - // set to true when the timezone is set - static bool s_timezoneSet = false; - static long gmtoffset = LONG_MAX; // invalid timezone - - // ensure that the timezone variable is set by calling wxLocaltime_r - if ( !s_timezoneSet ) - { - // just call wxLocaltime_r() instead of figuring out whether this - // system supports tzset(), _tzset() or something else - time_t t = 0; - struct tm tm; - - wxLocaltime_r(&t, &tm); - s_timezoneSet = true; - - // note that GMT offset is the opposite of time zone and so to return - // consistent results in both WX_GMTOFF_IN_TM and !WX_GMTOFF_IN_TM - // cases we have to negate it - gmtoffset = -tm.tm_gmtoff; - } - return (int)gmtoffset; -#elif defined(__DJGPP__) || defined(__WINE__) - struct timeb tb; - ftime(&tb); - return tb.timezone*60; -#elif defined(__VISUALC__) - // We must initialize the time zone information before using it (this will - // be done only once internally). - _tzset(); - - // Starting with VC++ 8 timezone variable is deprecated and is not even - // available in some standard library version so use the new function for - // accessing it instead. - #if wxCHECK_VISUALC_VERSION(8) - long t; - _get_timezone(&t); - return t; - #else // VC++ < 8 - return timezone; - #endif -#elif defined(WX_TIMEZONE) // If WX_TIMEZONE was defined by configure, use it. - return WX_TIMEZONE; -#elif defined(__BORLANDC__) || defined(__MINGW32__) || defined(__VISAGECPP__) - return _timezone; -#elif defined(__MWERKS__) - return 28800; -#else // unknown platform -- assume it has timezone - return timezone; -#endif // WX_GMTOFF_IN_TM/!WX_GMTOFF_IN_TM -} - // return the integral part of the JDN for the midnight of the given date (to // get the real JDN you need to add 0.5, this is, in fact, JDN of the // noon of the previous day) @@ -437,8 +289,15 @@ wxString CallStrftime(const wxString& format, const tm* tm) if ( !wxStrftime(buf, WXSIZEOF(buf), format, tm) ) { - // if the format is valid, buffer must be too small? - wxFAIL_MSG(wxT("strftime() failed")); + // There is one special case in which strftime() can return 0 without + // indicating an error: "%p" may give empty string depending on the + // locale, so check for it explicitly. Apparently it's really the only + // exception. + if ( format != wxS("%p") ) + { + // if the format is valid, buffer must be too small? + wxFAIL_MSG(wxT("strftime() failed")); + } buf[0] = '\0'; } @@ -602,7 +461,7 @@ wxDateTime::TimeZone::TimeZone(wxDateTime::TZ tz) case wxDateTime::Local: // get the offset from C RTL: it returns the difference GMT-local // while we want to have the offset _from_ GMT, hence the '-' - m_offset = -GetTimeZone(); + m_offset = -wxGetTimeZone(); break; case wxDateTime::GMT_12: @@ -1243,7 +1102,7 @@ wxDateTime wxDateTime::GetEndDST(int year, Country country) // return the current time with ms precision /* static */ wxDateTime wxDateTime::UNow() { - return wxDateTime(wxGetLocalTimeMillis()); + return wxDateTime(wxGetUTCTimeMillis()); } // the values in the tm structure contain the local time @@ -1259,7 +1118,7 @@ wxDateTime& wxDateTime::Set(const struct tm& tm) if ( tm2.tm_year == 70 && tm2.tm_mon == 0 && tm2.tm_mday == 1 ) { return Set((time_t)( - GetTimeZone() + + wxGetTimeZone() + tm2.tm_hour * MIN_PER_HOUR * SEC_PER_MIN + tm2.tm_min * SEC_PER_MIN + tm2.tm_sec)); @@ -1373,7 +1232,7 @@ wxDateTime& wxDateTime::Set(wxDateTime_t day, m_time *= SECONDS_PER_DAY * TIME_T_FACTOR; // JDN corresponds to GMT, we take localtime - Add(wxTimeSpan(hour, minute, second + GetTimeZone(), millisec)); + Add(wxTimeSpan(hour, minute, second + wxGetTimeZone(), millisec)); } return *this; @@ -1512,7 +1371,7 @@ wxDateTime::Tm wxDateTime::GetTm(const TimeZone& tz) const // use C RTL functions struct tm tmstruct; tm *tm; - if ( tz.GetOffset() == -GetTimeZone() ) + if ( tz.GetOffset() == -wxGetTimeZone() ) { // we are working with local time tm = wxLocaltime_r(&time, &tmstruct); @@ -2146,7 +2005,7 @@ int wxDateTime::IsDST(wxDateTime::Country country) const wxDateTime& wxDateTime::MakeTimezone(const TimeZone& tz, bool noDST) { - long secDiff = GetTimeZone() + tz.GetOffset(); + long secDiff = wxGetTimeZone() + tz.GetOffset(); // we need to know whether DST is or not in effect for this date unless // the test disabled by the caller @@ -2161,7 +2020,7 @@ wxDateTime& wxDateTime::MakeTimezone(const TimeZone& tz, bool noDST) wxDateTime& wxDateTime::MakeFromTimezone(const TimeZone& tz, bool noDST) { - long secDiff = GetTimeZone() + tz.GetOffset(); + long secDiff = wxGetTimeZone() + tz.GetOffset(); // we need to know whether DST is or not in effect for this date unless // the test disabled by the caller @@ -2339,7 +2198,7 @@ WXDLLIMPEXP_BASE void wxPrevWDay(wxDateTime::WeekDay& wd) : (wxDateTime::WeekDay)(wd - 1); } -#ifdef __WXMSW__ +#ifdef __WINDOWS__ wxDateTime& wxDateTime::SetFromMSWSysTime(const SYSTEMTIME& st) { @@ -2387,6 +2246,6 @@ void wxDateTime::GetAsMSWSysDate(SYSTEMTIME* st) const st->wMilliseconds = 0; } -#endif // __WXMSW__ +#endif // __WINDOWS__ #endif // wxUSE_DATETIME diff --git a/Externals/wxWidgets3/src/common/datetimefmt.cpp b/Externals/wxWidgets3/src/common/datetimefmt.cpp index 7b9e61a5a9..a96f09e2ce 100644 --- a/Externals/wxWidgets3/src/common/datetimefmt.cpp +++ b/Externals/wxWidgets3/src/common/datetimefmt.cpp @@ -4,7 +4,7 @@ // Author: Vadim Zeitlin // Modified by: // Created: 11.05.99 -// RCS-ID: $Id: datetimefmt.cpp 66166 2010-11-16 22:37:52Z VZ $ +// RCS-ID: $Id: datetimefmt.cpp 70847 2012-03-09 01:09:25Z VZ $ // Copyright: (c) 1999 Vadim Zeitlin // parts of code taken from sndcal library by Scott E. Lee: // @@ -34,7 +34,7 @@ #if !defined(wxUSE_DATETIME) || wxUSE_DATETIME #ifndef WX_PRECOMP - #ifdef __WXMSW__ + #ifdef __WINDOWS__ #include "wx/msw/wrapwin.h" #endif #include "wx/string.h" @@ -57,6 +57,7 @@ #endif #include "wx/datetime.h" +#include "wx/time.h" // ============================================================================ // implementation of wxDateTime @@ -68,8 +69,6 @@ extern void InitTm(struct tm& tm); -extern int GetTimeZone(); - extern wxString CallStrftime(const wxString& format, const tm* tm); // ---------------------------------------------------------------------------- @@ -320,16 +319,22 @@ wxString wxDateTime::Format(const wxString& formatp, const TimeZone& tz) const format.Replace("%X",wxLocale::GetInfo(wxLOCALE_TIME_FMT)); #endif // we have to use our own implementation if the date is out of range of - // strftime() or if we use non standard specificators + // strftime() or if we use non standard specifiers (notice that "%z" is + // special because it is de facto standard under Unix but is not supported + // under Windows) #ifdef wxHAS_STRFTIME time_t time = GetTicks(); - if ( (time != (time_t)-1) && !wxStrstr(format, wxT("%l")) ) + if ( (time != (time_t)-1) && !wxStrstr(format, wxT("%l")) +#ifdef __WINDOWS__ + && !wxStrstr(format, wxT("%z")) +#endif + ) { // use strftime() struct tm tmstruct; struct tm *tm; - if ( tz.GetOffset() == -GetTimeZone() ) + if ( tz.GetOffset() == -wxGetTimeZone() ) { // we are working with local time tm = wxLocaltime_r(&time, &tmstruct); @@ -398,6 +403,7 @@ wxString wxDateTime::Format(const wxString& formatp, const TimeZone& tz) const switch ( (*++p).GetValue() ) { case wxT('Y'): // year has 4 digits + case wxT('z'): // time zone as well fmt = wxT("%04d"); break; @@ -640,6 +646,25 @@ wxString wxDateTime::Format(const wxString& formatp, const TimeZone& tz) const res += wxString::Format(fmt, tm.year); break; + case wxT('z'): // time zone as [-+]HHMM + { + int ofs = tz.GetOffset(); + if ( ofs < 0 ) + { + res += '-'; + ofs = -ofs; + } + else + { + res += '+'; + } + + // Converts seconds to HHMM representation. + res += wxString::Format(fmt, + 100*(ofs/3600) + (ofs/60)%60); + } + break; + case wxT('Z'): // timezone name #ifdef wxHAS_STRFTIME res += CallStrftime(wxT("%Z"), &tmTimeOnly); @@ -668,7 +693,7 @@ wxString wxDateTime::Format(const wxString& formatp, const TimeZone& tz) const } // no, it wasn't the width - wxFAIL_MSG(wxT("unknown format specificator")); + wxFAIL_MSG(wxT("unknown format specifier")); // fall through and just copy it nevertheless @@ -930,6 +955,8 @@ wxDateTime::ParseFormat(const wxString& date, bool hourIsIn12hFormat = false, // or in 24h one? isPM = false; // AM by default + bool haveTimeZone = false; + // and the value of the items we have (init them to get rid of warnings) wxDateTime_t msec = 0, sec = 0, @@ -940,6 +967,7 @@ wxDateTime::ParseFormat(const wxString& date, mday = 0; wxDateTime::Month mon = Inv_Month; int year = 0; + long timeZone = 0; // time zone in seconds as expected in Tm structure wxString::const_iterator input = date.begin(); const wxString::const_iterator end = date.end(); @@ -1378,6 +1406,41 @@ wxDateTime::ParseFormat(const wxString& date, year = (wxDateTime_t)num; break; + case wxT('z'): + { + // check that we have something here at all + if ( input == end ) + return false; + + // and then check that it's either plus or minus sign + bool minusFound; + if ( *input == wxT('-') ) + minusFound = true; + else if ( *input == wxT('+') ) + minusFound = false; + else + return false; // no match + + // here should follow 4 digits HHMM + ++input; + unsigned long tzHourMin; + if ( !GetNumericToken(4, input, end, &tzHourMin) ) + return false; // no match + + const unsigned hours = tzHourMin / 100; + const unsigned minutes = tzHourMin % 100; + + if ( hours > 12 || minutes > 59 ) + return false; // bad format + + timeZone = 3600*hours + 60*minutes; + if ( minusFound ) + timeZone = -timeZone; + + haveTimeZone = true; + } + break; + case wxT('Z'): // timezone name // FIXME: currently we just ignore everything that looks like a // time zone here @@ -1385,7 +1448,7 @@ wxDateTime::ParseFormat(const wxString& date, break; case wxT('%'): // a percent sign - if ( *input++ != wxT('%') ) + if ( input == end || *input++ != wxT('%') ) { // no match return false; @@ -1483,6 +1546,14 @@ wxDateTime::ParseFormat(const wxString& date, Set(tm); + // If a time zone was specified and it is not the local time zone, we need + // to shift the time accordingly. + // + // Note that avoiding the call to MakeFromTimeZone is necessary to avoid + // DST problems. + if ( haveTimeZone && timeZone != -wxGetTimeZone() ) + MakeFromTimezone(timeZone); + // finally check that the week day is consistent -- if we had it if ( haveWDay && GetWeekDay() != wday ) return false; diff --git a/Externals/wxWidgets3/src/common/dcbase.cpp b/Externals/wxWidgets3/src/common/dcbase.cpp index e181a3581c..5394c8af17 100644 --- a/Externals/wxWidgets3/src/common/dcbase.cpp +++ b/Externals/wxWidgets3/src/common/dcbase.cpp @@ -4,7 +4,7 @@ // Author: Vadim Zeitlin // Modified by: // Created: 05/25/99 -// RCS-ID: $Id: dcbase.cpp 67063 2011-02-27 12:48:13Z VZ $ +// RCS-ID: $Id: dcbase.cpp 70345 2012-01-15 01:05:28Z VZ $ // Copyright: (c) wxWidgets team // Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// @@ -35,6 +35,7 @@ #ifndef WX_PRECOMP #include "wx/math.h" #include "wx/module.h" + #include "wx/window.h" #endif #ifdef __WXMSW__ @@ -89,12 +90,6 @@ #include "wx/dfb/dcscreen.h" #endif -#ifdef __WXPALMOS__ - #include "wx/palmos/dcclient.h" - #include "wx/palmos/dcmemory.h" - #include "wx/palmos/dcscreen.h" -#endif - //---------------------------------------------------------------------------- // wxDCFactory //---------------------------------------------------------------------------- @@ -927,9 +922,9 @@ void wxDCImpl::DoDrawSpline( const wxPointList *points ) wx_spline_add_point(x1, y1); while ((node = node->GetNext()) -#if !wxUSE_STL +#if !wxUSE_STD_CONTAINERS != NULL -#endif // !wxUSE_STL +#endif // !wxUSE_STD_CONTAINERS ) { p = node->GetData(); @@ -1182,7 +1177,7 @@ void wxDC::DrawLabel(const wxString& text, GetMultiLineTextExtent(text, &widthText, &heightText, &heightLine); wxCoord width, height; - if ( bitmap.Ok() ) + if ( bitmap.IsOk() ) { width = widthText + bitmap.GetWidth(); height = bitmap.GetHeight(); @@ -1224,7 +1219,7 @@ void wxDC::DrawLabel(const wxString& text, wxCoord x0 = x, y0 = y, width0 = width; - if ( bitmap.Ok() ) + if ( bitmap.IsOk() ) { DrawBitmap(bitmap, x, y, true /* use mask */); @@ -1602,7 +1597,7 @@ void wxDCImpl::CalculateEllipticPoints( wxPointList* points, y2 = y2-y-y+1; --y; } - // old y now to big: set point with old y, old x + // old y now too big: set point with old y, old x if( bNewPoint && x>1) { int x1 = x - 1; diff --git a/Externals/wxWidgets3/src/common/dcbufcmn.cpp b/Externals/wxWidgets3/src/common/dcbufcmn.cpp index 765a50b636..8b230ad299 100644 --- a/Externals/wxWidgets3/src/common/dcbufcmn.cpp +++ b/Externals/wxWidgets3/src/common/dcbufcmn.cpp @@ -4,7 +4,7 @@ // Author: Ron Lee, Jaakko Salli // Modified by: // Created: Sep-20-2006 -// RCS-ID: $Id: dcbufcmn.cpp 65680 2010-09-30 11:44:45Z VZ $ +// RCS-ID: $Id: dcbufcmn.cpp 67659 2011-05-01 15:47:46Z VZ $ // Copyright: (c) wxWidgets team // Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// @@ -105,6 +105,8 @@ IMPLEMENT_DYNAMIC_CLASS(wxSharedDCBufferManager, wxModule) void wxBufferedDC::UseBuffer(wxCoord w, wxCoord h) { + wxCHECK_RET( w >= -1 && h >= -1, "Invalid buffer size" ); + if ( !m_buffer || !m_buffer->IsOk() ) { if ( w == -1 || h == -1 ) diff --git a/Externals/wxWidgets3/src/common/dcgraph.cpp b/Externals/wxWidgets3/src/common/dcgraph.cpp index 6d65764510..633c482240 100644 --- a/Externals/wxWidgets3/src/common/dcgraph.cpp +++ b/Externals/wxWidgets3/src/common/dcgraph.cpp @@ -4,7 +4,7 @@ // Author: Stefan Csomor // Modified by: // Created: -// RCS-ID: $Id: dcgraph.cpp 67280 2011-03-22 14:17:38Z DS $ +// RCS-ID: $Id: dcgraph.cpp 70844 2012-03-08 17:06:06Z PC $ // Copyright: (c) Stefan Csomor // Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// @@ -53,27 +53,26 @@ static inline double DegToRad(double deg) return (deg * M_PI) / 180.0; } -static bool TranslateRasterOp(wxRasterOperationMode function, wxCompositionMode *op) +static wxCompositionMode TranslateRasterOp(wxRasterOperationMode function) { switch ( function ) { case wxCOPY: // src // since we are supporting alpha, _OVER is closer to the intention than _SOURCE - // since the latter would overwrite even when alpha is is not set to opaque - *op = wxCOMPOSITION_OVER; - break; + // since the latter would overwrite even when alpha is not set to opaque + return wxCOMPOSITION_OVER; + case wxOR: // src OR dst - *op = wxCOMPOSITION_ADD; - break; + return wxCOMPOSITION_ADD; + case wxNO_OP: // dst - *op = wxCOMPOSITION_DEST; // ignore the source - break; + return wxCOMPOSITION_DEST; // ignore the source + case wxCLEAR: // 0 - *op = wxCOMPOSITION_CLEAR;// clear dst - break; + return wxCOMPOSITION_CLEAR;// clear dst + case wxXOR: // src XOR dst - *op = wxCOMPOSITION_XOR; - break; + return wxCOMPOSITION_XOR; case wxAND: // src AND dst case wxAND_INVERT: // (NOT src) AND dst @@ -86,10 +85,10 @@ static bool TranslateRasterOp(wxRasterOperationMode function, wxCompositionMode case wxOR_REVERSE: // src OR (NOT dst) case wxSET: // 1 case wxSRC_INVERT: // NOT src - default: - return false; + break; } - return true; + + return wxCOMPOSITION_INVALID; } //----------------------------------------------------------------------------- @@ -115,6 +114,19 @@ wxGCDC::wxGCDC( const wxPrinterDC& dc) : } #endif +#if defined(__WXMSW__) && wxUSE_ENH_METAFILE +wxGCDC::wxGCDC(const wxEnhMetaFileDC& dc) + : wxDC(new wxGCDCImpl(this, dc)) +{ +} +#endif + +wxGCDC::wxGCDC(wxGraphicsContext* context) : + wxDC( new wxGCDCImpl( this ) ) +{ + SetGraphicsContext(context); +} + wxGCDC::wxGCDC() : wxDC( new wxGCDCImpl( this ) ) { @@ -124,7 +136,7 @@ wxGCDC::~wxGCDC() { } -wxGraphicsContext* wxGCDC::GetGraphicsContext() +wxGraphicsContext* wxGCDC::GetGraphicsContext() const { if (!m_pimpl) return NULL; wxGCDCImpl *gc_impl = (wxGCDCImpl*) m_pimpl; @@ -175,13 +187,7 @@ wxGCDCImpl::wxGCDCImpl( wxDC *owner, const wxMemoryDC& dc ) : { Init(); wxGraphicsContext* context; -#if wxUSE_CAIRO - wxGraphicsRenderer* renderer = wxGraphicsRenderer::GetCairoRenderer(); - context = renderer->CreateContext(dc); -#else context = wxGraphicsContext::Create(dc); -#endif - SetGraphicsContext( context ); } @@ -194,6 +200,15 @@ wxGCDCImpl::wxGCDCImpl( wxDC *owner, const wxPrinterDC& dc ) : } #endif +#if defined(__WXMSW__) && wxUSE_ENH_METAFILE +wxGCDCImpl::wxGCDCImpl(wxDC *owner, const wxEnhMetaFileDC& dc) + : wxDCImpl(owner) +{ + Init(); + SetGraphicsContext(wxGraphicsContext::Create(dc)); +} +#endif + void wxGCDCImpl::Init() { m_ok = false; @@ -367,7 +382,10 @@ void wxGCDCImpl::SetTextForeground( const wxColour &col ) { wxCHECK_RET( IsOk(), wxT("wxGCDC(cg)::SetTextForeground - invalid DC") ); - if ( col != m_textForegroundColour ) + // don't set m_textForegroundColour to an invalid colour as we'd crash + // later then (we use m_textForegroundColour.GetColor() without checking + // in a few places) + if ( col.IsOk() && col != m_textForegroundColour ) { m_textForegroundColour = col; m_graphicContext->SetFont( m_font, m_textForegroundColour ); @@ -502,8 +520,8 @@ void wxGCDCImpl::SetLogicalFunction( wxRasterOperationMode function ) m_logicalFunction = function; - wxCompositionMode mode; - m_logicalFunctionSupported = TranslateRasterOp( function, &mode); + wxCompositionMode mode = TranslateRasterOp( function ); + m_logicalFunctionSupported = mode != wxCOMPOSITION_INVALID; if (m_logicalFunctionSupported) m_logicalFunctionSupported = m_graphicContext->SetCompositionMode(mode); @@ -696,13 +714,13 @@ void wxGCDCImpl::DoDrawSpline(const wxPointList *points) path.MoveToPoint( x1 , y1 ); path.AddLineToPoint( cx1 , cy1 ); -#if !wxUSE_STL +#if !wxUSE_STD_CONTAINERS while ((node = node->GetNext()) != NULL) #else while ((node = node->GetNext())) -#endif // !wxUSE_STL +#endif // !wxUSE_STD_CONTAINERS { p = node->GetData(); @@ -874,13 +892,25 @@ bool wxGCDCImpl::DoStretchBlit( if ( logical_func == wxNO_OP ) return true; - wxCompositionMode mode; - if ( !TranslateRasterOp(logical_func, &mode) ) + wxCompositionMode mode = TranslateRasterOp(logical_func); + if ( mode == wxCOMPOSITION_INVALID ) { wxFAIL_MSG( wxT("Blitting is not supported with this logical operation.") ); return false; } + wxRect subrect(source->LogicalToDeviceX(xsrc), + source->LogicalToDeviceY(ysrc), + source->LogicalToDeviceXRel(srcWidth), + source->LogicalToDeviceYRel(srcHeight)); + const wxRect subrectOrig = subrect; + // clip the subrect down to the size of the source DC + wxRect clip; + source->GetSize(&clip.width, &clip.height); + subrect.Intersect(clip); + if (subrect.width == 0) + return true; + bool retval = true; wxCompositionMode formerMode = m_graphicContext->GetCompositionMode(); @@ -898,21 +928,6 @@ bool wxGCDCImpl::DoStretchBlit( ysrcMask = ysrc; } - wxRect subrect(source->LogicalToDeviceX(xsrc), - source->LogicalToDeviceY(ysrc), - source->LogicalToDeviceXRel(srcWidth), - source->LogicalToDeviceYRel(srcHeight)); - - // if needed clip the subrect down to the size of the source DC - wxCoord sw, sh; - source->GetSize(&sw, &sh); - sw = source->LogicalToDeviceXRel(sw); - sh = source->LogicalToDeviceYRel(sh); - if (subrect.x + subrect.width > sw) - subrect.width = sw - subrect.x; - if (subrect.y + subrect.height > sh) - subrect.height = sh - subrect.y; - wxBitmap blit = source->GetAsBitmap( &subrect ); if ( blit.IsOk() ) @@ -920,8 +935,19 @@ bool wxGCDCImpl::DoStretchBlit( if ( !useMask && blit.GetMask() ) blit.SetMask(NULL); - m_graphicContext->DrawBitmap( blit, xdest, ydest, - dstWidth, dstHeight); + double x = xdest; + double y = ydest; + double w = dstWidth; + double h = dstHeight; + // adjust dest rect if source rect is clipped + if (subrect.width != subrectOrig.width || subrect.height != subrectOrig.height) + { + x += (subrect.x - subrectOrig.x) / double(subrectOrig.width) * dstWidth; + y += (subrect.y - subrectOrig.y) / double(subrectOrig.height) * dstHeight; + w *= double(subrect.width) / subrectOrig.width; + h *= double(subrect.height) / subrectOrig.height; + } + m_graphicContext->DrawBitmap(blit, x, y, w, h); } else { @@ -958,6 +984,18 @@ void wxGCDCImpl::DoDrawRotatedText(const wxString& str, wxCoord x, wxCoord y, void wxGCDCImpl::DoDrawText(const wxString& str, wxCoord x, wxCoord y) { + // For compatibility with other ports (notably wxGTK) and because it's + // genuinely useful, we allow passing multiline strings to DrawText(). + // However there is no native OSX function to draw them directly so we + // instead reuse the generic DrawLabel() method to render them. Of course, + // DrawLabel() itself will call back to us but with single line strings + // only so there won't be any infinite recursion here. + if ( str.find('\n') != wxString::npos ) + { + GetOwner()->DrawLabel(str, wxRect(x, y, 0, 0)); + return; + } + wxCHECK_RET( IsOk(), wxT("wxGCDC(cg)::DoDrawText - invalid DC") ); if ( str.empty() ) @@ -1145,4 +1183,21 @@ void wxGCDCImpl::DoDrawCheckMark(wxCoord x, wxCoord y, wxDCImpl::DoDrawCheckMark(x,y,width,height); } +#ifdef __WXMSW__ +wxRect wxGCDCImpl::MSWApplyGDIPlusTransform(const wxRect& r) const +{ + wxGraphicsContext* const gc = GetGraphicsContext(); + wxCHECK_MSG( gc, r, wxT("Invalid wxGCDC") ); + + double x = 0, + y = 0; + gc->GetTransform().TransformPoint(&x, &y); + + wxRect rect(r); + rect.Offset(x, y); + + return rect; +} +#endif // __WXMSW__ + #endif // wxUSE_GRAPHICS_CONTEXT diff --git a/Externals/wxWidgets3/src/common/dcsvg.cpp b/Externals/wxWidgets3/src/common/dcsvg.cpp index c161b8964e..5f4514e9bb 100644 --- a/Externals/wxWidgets3/src/common/dcsvg.cpp +++ b/Externals/wxWidgets3/src/common/dcsvg.cpp @@ -3,7 +3,7 @@ // Purpose: SVG sample // Author: Chris Elliott // Modified by: -// RCS-ID: $Id: dcsvg.cpp 67254 2011-03-20 00:14:35Z DS $ +// RCS-ID: $Id: dcsvg.cpp 67883 2011-06-07 22:27:35Z VZ $ // Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// @@ -28,9 +28,6 @@ #include "wx/wfstream.h" #include "wx/filename.h" -#define wxSVG_DEBUG false -// or true to see the calls being executed - // ---------------------------------------------------------- // Global utilities // ---------------------------------------------------------- @@ -40,26 +37,6 @@ namespace inline double DegToRad(double deg) { return (deg * M_PI) / 180.0; } -wxString wxBrushString ( wxColour c, int style ) -{ - wxString s = wxT("fill:") + c.GetAsString(wxC2S_HTML_SYNTAX) + wxT("; "); - switch ( style ) - { - case wxBRUSHSTYLE_SOLID : - s = s + wxT("fill-opacity:1.0; "); - break; - case wxBRUSHSTYLE_TRANSPARENT: - s = s + wxT("fill-opacity:0.0; "); - break; - - default : - wxASSERT_MSG(false, wxT("wxSVGFileDC::Requested Brush Style not available")); - - } - s = s + wxT("\n"); - return s; -} - // This function returns a string representation of a floating point number in // C locale (i.e. always using "." for the decimal separator) and with the // fixed precision (which is 2 for some unknown reason but this is what it was @@ -69,6 +46,66 @@ inline wxString NumStr(double f) return wxString::FromCDouble(f, 2); } +// Return the colour representation as HTML-like "#rrggbb" string and also +// returns its alpha as opacity number in 0..1 range. +wxString Col2SVG(wxColour c, float *opacity) +{ + if ( c.Alpha() != wxALPHA_OPAQUE ) + { + *opacity = c.Alpha()/255.; + + // Remove the alpha before using GetAsString(wxC2S_HTML_SYNTAX) as it + // doesn't support colours with alpha channel. + c = wxColour(c.GetRGB()); + } + else // No alpha. + { + *opacity = 1.; + } + + return c.GetAsString(wxC2S_HTML_SYNTAX); +} + +wxString wxPenString(wxColour c, int style = wxPENSTYLE_SOLID) +{ + float opacity; + wxString s = wxT("stroke:") + Col2SVG(c, &opacity) + wxT("; "); + + switch ( style ) + { + case wxPENSTYLE_SOLID: + s += wxString::Format(wxT("stroke-opacity:%s; "), NumStr(opacity)); + break; + case wxPENSTYLE_TRANSPARENT: + s += wxT("stroke-opacity:0.0; "); + break; + default : + wxASSERT_MSG(false, wxT("wxSVGFileDC::Requested Pen Style not available")); + } + + return s; +} + +wxString wxBrushString(wxColour c, int style = wxBRUSHSTYLE_SOLID) +{ + float opacity; + wxString s = wxT("fill:") + Col2SVG(c, &opacity) + wxT("; "); + + switch ( style ) + { + case wxBRUSHSTYLE_SOLID: + s += wxString::Format(wxT("fill-opacity:%s; "), NumStr(opacity)); + break; + case wxBRUSHSTYLE_TRANSPARENT: + s += wxT("fill-opacity:0.0; "); + break; + default : + wxASSERT_MSG(false, wxT("wxSVGFileDC::Requested Brush Style not available")); + } + + return s; +} + } // anonymous namespace // ---------------------------------------------------------- @@ -110,7 +147,7 @@ void wxSVGFileDCImpl::Init (const wxString &filename, int Width, int Height, dou ////////////////////code here m_outfile = new wxFileOutputStream(filename); - m_OK = m_outfile->Ok (); + m_OK = m_outfile->IsOk(); if (m_OK) { m_filename = filename; @@ -158,17 +195,15 @@ wxSize wxSVGFileDCImpl::GetPPI() const void wxSVGFileDCImpl::DoDrawLine (wxCoord x1, wxCoord y1, wxCoord x2, wxCoord y2) { - if (m_graphics_changed) NewGraphics (); + if (m_graphics_changed) NewGraphics(); wxString s; s.Printf ( wxT(" \n"), x1,y1,x2,y2 ); if (m_OK) { write(s); } - wxASSERT_MSG(!wxSVG_DEBUG, wxT("wxSVGFileDC::DrawLine Call executed")); CalcBoundingBox(x1, y1); CalcBoundingBox(x2, y2); - return; } void wxSVGFileDCImpl::DoDrawLines(int n, wxPoint points[], wxCoord xoffset , wxCoord yoffset ) @@ -183,7 +218,7 @@ void wxSVGFileDCImpl::DoDrawLines(int n, wxPoint points[], wxCoord xoffset , wxC void wxSVGFileDCImpl::DoDrawPoint (wxCoord x1, wxCoord y1) { wxString s; - if (m_graphics_changed) NewGraphics (); + if (m_graphics_changed) NewGraphics(); s = wxT(" ") + wxString(wxT("\n")); write(s); DoDrawLine ( x1,y1,x1,y1 ); @@ -199,13 +234,12 @@ void wxSVGFileDCImpl::DoDrawCheckMark(wxCoord x1, wxCoord y1, wxCoord width, wxC void wxSVGFileDCImpl::DoDrawText(const wxString& text, wxCoord x1, wxCoord y1) { DoDrawRotatedText(text, x1,y1,0.0); - wxASSERT_MSG(!wxSVG_DEBUG, wxT("wxSVGFileDC::DrawText Call executed")); } void wxSVGFileDCImpl::DoDrawRotatedText(const wxString& sText, wxCoord x, wxCoord y, double angle) { //known bug; if the font is drawn in a scaled DC, it will not behave exactly as wxMSW - if (m_graphics_changed) NewGraphics (); + if (m_graphics_changed) NewGraphics(); wxString s, sTmp; // calculate bounding box @@ -229,37 +263,36 @@ void wxSVGFileDCImpl::DoDrawRotatedText(const wxString& sText, wxCoord x, wxCoor // draw background first // just like DoDrawRectangle except we pass the text color to it and set the border to a 1 pixel wide text background - wxASSERT_MSG(!wxSVG_DEBUG, wxT("wxSVGFileDC::Draw Rotated Text Call plotting text background")); - sTmp.Printf ( wxT(" "), NumStr(-angle), x,y ); - s = s + sTmp + wxT("\n"); + sTmp.Printf ( wxT(" "), NumStr(-angle), x,y ); + s += sTmp + wxT("\n"); write(s); } //now do the text itself s.Printf (wxT(" 0) s = s + wxT("style=\"font-family:") + sTmp + wxT("; "); - else s = s + wxT("style=\" "); + sTmp = m_font.GetFaceName(); + if (sTmp.Len() > 0) s += wxT("style=\"font-family:") + sTmp + wxT("; "); + else s += wxT("style=\" "); wxString fontweights [3] = { wxT("normal"), wxT("lighter"), wxT("bold") }; - s = s + wxT("font-weight:") + fontweights[m_font.GetWeight() - wxNORMAL] + wxT("; "); + s += wxT("font-weight:") + fontweights[m_font.GetWeight() - wxNORMAL] + wxT("; "); wxString fontstyles [5] = { wxT("normal"), wxT("style error"), wxT("style error"), wxT("italic"), wxT("oblique") }; - s = s + wxT("font-style:") + fontstyles[m_font.GetStyle() - wxNORMAL] + wxT("; "); + s += wxT("font-style:") + fontstyles[m_font.GetStyle() - wxNORMAL] + wxT("; "); - sTmp.Printf (wxT("font-size:%dpt; fill:"), m_font.GetPointSize () ); - s = s + sTmp; - s = s + m_textForegroundColour.GetAsString(wxC2S_HTML_SYNTAX) + wxT("; stroke:") + m_textForegroundColour.GetAsString(wxC2S_HTML_SYNTAX) + wxT("; "); + sTmp.Printf (wxT("font-size:%dpt; "), m_font.GetPointSize() ); + s += sTmp; + //text will be solid, unless alpha value isn't opaque in the foreground colour + s += wxBrushString(m_textForegroundColour) + wxPenString(m_textForegroundColour); sTmp.Printf ( wxT("stroke-width:0;\" transform=\"rotate( %s %d %d ) \" >"), NumStr(-angle), x,y ); - s = s + sTmp + sText + wxT(" ") + wxT("\n"); + s += sTmp + sText + wxT(" ") + wxT("\n"); if (m_OK) { write(s); } - wxASSERT_MSG(!wxSVG_DEBUG, wxT("wxSVGFileDC::DrawRotatedText Call executed")); } void wxSVGFileDCImpl::DoDrawRectangle(wxCoord x, wxCoord y, wxCoord width, wxCoord height) @@ -270,16 +303,15 @@ void wxSVGFileDCImpl::DoDrawRectangle(wxCoord x, wxCoord y, wxCoord width, wxCoo void wxSVGFileDCImpl::DoDrawRoundedRectangle(wxCoord x, wxCoord y, wxCoord width, wxCoord height, double radius ) { - if (m_graphics_changed) NewGraphics (); + if (m_graphics_changed) NewGraphics(); wxString s; s.Printf ( wxT(" ") + wxT("\n"); + s += wxT(" /> \n"); write(s); - wxASSERT_MSG(!wxSVG_DEBUG, wxT("wxSVGFileDC::DoDrawRoundedRectangle Call executed")); CalcBoundingBox(x, y); CalcBoundingBox(x + width, y + height); } @@ -288,44 +320,40 @@ void wxSVGFileDCImpl::DoDrawPolygon(int n, wxPoint points[], wxCoord xoffset, wxCoord yoffset, wxPolygonFillMode fillStyle) { - if (m_graphics_changed) NewGraphics (); + if (m_graphics_changed) NewGraphics(); wxString s, sTmp; s = wxT(" "); - s = s + wxT("\n"); + s += wxT("\" /> \n"); write(s); - - wxASSERT_MSG(!wxSVG_DEBUG, wxT("wxSVGFileDC::DoDrawPolygon Call executed")); } void wxSVGFileDCImpl::DoDrawEllipse (wxCoord x, wxCoord y, wxCoord width, wxCoord height) { - if (m_graphics_changed) NewGraphics (); + if (m_graphics_changed) NewGraphics(); int rh = height /2; int rw = width /2; wxString s; s.Printf ( wxT(" ") + wxT("\n"); + s += wxT(" /> \n"); write(s); - wxASSERT_MSG(!wxSVG_DEBUG, wxT("wxSVGFileDC::DoDrawEllipse Call executed")); CalcBoundingBox(x, y); CalcBoundingBox(x + width, y + height); } @@ -341,7 +369,7 @@ void wxSVGFileDCImpl::DoDrawArc(wxCoord x1, wxCoord y1, wxCoord x2, wxCoord y2, Might be better described as Pie drawing */ - if (m_graphics_changed) NewGraphics (); + if (m_graphics_changed) NewGraphics(); wxString s; // we need the radius of the circle which has two estimates @@ -370,15 +398,13 @@ void wxSVGFileDCImpl::DoDrawArc(wxCoord x1, wxCoord y1, wxCoord x2, wxCoord y2, x1,y1, NumStr(r1), NumStr(r2), fArc, fSweep, x2, y2, xc, yc ); // the z means close the path and fill - s = s + wxT(" \" /> ") + wxT("\n"); + s += wxT(" \" /> \n"); if (m_OK) { write(s); } - - wxASSERT_MSG(!wxSVG_DEBUG, wxT("wxSVGFileDC::DoDrawArc Call executed")); } void wxSVGFileDCImpl::DoDrawEllipticArc(wxCoord x,wxCoord y,wxCoord w,wxCoord h,double sa,double ea) @@ -402,7 +428,7 @@ void wxSVGFileDCImpl::DoDrawEllipticArc(wxCoord x,wxCoord y,wxCoord w,wxCoord h, //known bug: SVG draws with the current pen along the radii, but this does not happen in wxMSW - if (m_graphics_changed) NewGraphics (); + if (m_graphics_changed) NewGraphics(); wxString s; //radius @@ -433,15 +459,12 @@ void wxSVGFileDCImpl::DoDrawEllipticArc(wxCoord x,wxCoord y,wxCoord w,wxCoord h, int(xs), int(ys), int(rx), int(ry), fArc, fSweep, int(xe), int(ye), int(xc), int(yc) ); - - s = s + wxT(" \" /> ") + wxT("\n"); + s += wxT(" \" /> \n"); if (m_OK) { write(s); } - - wxASSERT_MSG(!wxSVG_DEBUG, wxT("wxSVGFileDC::DoDrawEllipticArc Call executed")); } void wxSVGFileDCImpl::DoGetTextExtent(const wxString& string, wxCoord *w, wxCoord *h, wxCoord *descent , wxCoord *externalLeading , const wxFont *font) const @@ -452,17 +475,14 @@ void wxSVGFileDCImpl::DoGetTextExtent(const wxString& string, wxCoord *w, wxCoor sDC.SetFont (m_font); if ( font != NULL ) sDC.SetFont ( *font ); sDC.GetTextExtent(string, w, h, descent, externalLeading ); - wxASSERT_MSG(!wxSVG_DEBUG, wxT("wxSVGFileDC::GetTextExtent Call executed")); } wxCoord wxSVGFileDCImpl::GetCharHeight() const - { wxScreenDC sDC; sDC.SetFont (m_font); - wxASSERT_MSG(!wxSVG_DEBUG, wxT("wxSVGFileDC::GetCharHeight Call executing")); - return ( sDC.GetCharHeight() ); + return sDC.GetCharHeight(); } @@ -471,9 +491,7 @@ wxCoord wxSVGFileDCImpl::GetCharWidth() const wxScreenDC sDC; sDC.SetFont (m_font); - wxASSERT_MSG(!wxSVG_DEBUG, wxT("wxSVGFileDC::GetCharWidth Call executing")); - return ( sDC.GetCharWidth() ); - + return sDC.GetCharWidth(); } @@ -483,16 +501,13 @@ wxCoord wxSVGFileDCImpl::GetCharWidth() const void wxSVGFileDCImpl::SetBackground( const wxBrush &brush ) { - m_backgroundBrush = brush; - return; } void wxSVGFileDCImpl::SetBackgroundMode( int mode ) { m_backgroundMode = mode; - return; } @@ -502,7 +517,6 @@ void wxSVGFileDCImpl::SetBrush(const wxBrush& brush) m_brush = brush; m_graphics_changed = true; - wxASSERT_MSG(!wxSVG_DEBUG, wxT("wxSVGFileDC::SetBrush Call executed")); } @@ -513,21 +527,16 @@ void wxSVGFileDCImpl::SetPen(const wxPen& pen) m_pen = pen; m_graphics_changed = true; - wxASSERT_MSG(!wxSVG_DEBUG, wxT("wxSVGFileDC::SetPen Call executed")); } -void wxSVGFileDCImpl::NewGraphics () +void wxSVGFileDCImpl::NewGraphics() { - - int w = m_pen.GetWidth (); - wxColour c = m_pen.GetColour (); - wxString s, sBrush, sPenCap, sPenJoin, sPenStyle, sLast, sWarn; - sBrush = wxT("\n\n \n"); } sLast.Printf( wxT("stroke-width:%d\" \n transform=\"translate(%s %s) scale(%s %s)\">"), - w, NumStr(m_logicalOriginX), NumStr(m_logicalOriginY), NumStr(m_scaleX), NumStr(m_scaleY) ); + m_pen.GetWidth(), NumStr(m_logicalOriginX), NumStr(m_logicalOriginY), NumStr(m_scaleX), NumStr(m_scaleY) ); s = sBrush + sPenCap + sPenJoin + sPenStyle + sLast + wxT("\n") + sWarn; write(s); m_graphics_changed = false; - wxASSERT_MSG(!wxSVG_DEBUG, wxT("wxSVGFileDC::NewGraphics Call executed")); } @@ -579,8 +575,6 @@ void wxSVGFileDCImpl::SetFont(const wxFont& font) { m_font = font; - - wxASSERT_MSG(!wxSVG_DEBUG, wxT("wxSVGFileDC::SetFont Call executed")); } // export a bitmap as a raster image in png @@ -605,7 +599,6 @@ bool wxSVGFileDCImpl::DoBlit(wxCoord xdest, wxCoord ydest, wxCoord width, wxCoor memDC.Blit(0, 0, width, height, source, xsrc, ysrc); memDC.SelectObject( wxNullBitmap ); DoDrawBitmap(myBitmap, xdest, ydest); - wxASSERT_MSG(!wxSVG_DEBUG, wxT("wxSVGFileDC::DoBlit Call executed")); return false; } @@ -617,13 +610,11 @@ void wxSVGFileDCImpl::DoDrawIcon(const class wxIcon & myIcon, wxCoord x, wxCoord memDC.DrawIcon(myIcon,0,0); memDC.SelectObject( wxNullBitmap ); DoDrawBitmap(myBitmap, x, y); - wxASSERT_MSG(!wxSVG_DEBUG, wxT("wxSVGFileDC::DoDrawIcon Call executed")); - return; } void wxSVGFileDCImpl::DoDrawBitmap(const class wxBitmap & bmp, wxCoord x, wxCoord y , bool WXUNUSED(bTransparent) /*=0*/ ) { - if (m_graphics_changed) NewGraphics (); + if (m_graphics_changed) NewGraphics(); wxString sTmp, s, sPNG; if ( wxImage::FindHandler(wxBITMAP_TYPE_PNG) == NULL ) @@ -652,25 +643,22 @@ void wxSVGFileDCImpl::DoDrawBitmap(const class wxBitmap & bmp, wxCoord x, wxCoor int w = myBitmap.GetWidth(); int h = myBitmap.GetHeight(); sTmp.Printf ( wxT(" \n"), sPNG.c_str() ); - s = s + sTmp + wxT("Image from wxSVG ") + wxT("\n"); + s += sTmp + wxT("Image from wxSVG ") + wxT("\n"); if (m_OK && bPNG_OK) { write(s); } - m_OK = m_outfile->Ok () && bPNG_OK; - wxASSERT_MSG(!wxSVG_DEBUG, wxT("wxSVGFileDC::DoDrawBitmap Call executed")); - - return; + m_OK = m_outfile->IsOk() && bPNG_OK; } void wxSVGFileDCImpl::write(const wxString &s) { const wxCharBuffer buf = s.utf8_str(); m_outfile->Write(buf, strlen((const char *)buf)); - m_OK = m_outfile->Ok(); + m_OK = m_outfile->IsOk(); } diff --git a/Externals/wxWidgets3/src/common/descrip.mms b/Externals/wxWidgets3/src/common/descrip.mms index b1141822d7..8273a164af 100644 --- a/Externals/wxWidgets3/src/common/descrip.mms +++ b/Externals/wxWidgets3/src/common/descrip.mms @@ -2,7 +2,7 @@ # * # Make file for VMS * # Author : J.Jansen (joukj@hrem.nano.tudelft.nl) * -# Date : 21 March 2011 * +# Date : 6 December 2011 * # * #***************************************************************************** .first @@ -209,8 +209,9 @@ OBJECTS2=tbarbase.obj,srchcmn.obj,\ clrpickercmn.obj,\ filepickercmn.obj,\ fontpickercmn.obj,\ - pickerbase.obj,\ - listctrlcmn.obj,socketiohandler.obj,fdiodispatcher.obj,\ + pickerbase.obj + +OBJECTS3=listctrlcmn.obj,socketiohandler.obj,fdiodispatcher.obj,\ selectdispatcher.obj,overlaycmn.obj,windowid.obj,sstream.obj,\ wrapsizer.obj,headerctrlcmn.obj,headercolcmn.obj,\ rearrangectrl.obj,spinctrlcmn.obj,datetimefmt.obj,xlocale.obj,\ @@ -222,7 +223,8 @@ OBJECTS2=tbarbase.obj,srchcmn.obj,\ statlinecmn.obj,radiobtncmn.obj,bmpbtncmn.obj,checklstcmn.obj,\ statbmpcmn.obj,dirctrlcmn.obj,gridcmn.obj,odcombocmn.obj,\ spinbtncmn.obj,scrolbarcmn.obj,colourdata.obj,fontdata.obj,\ - valnum.obj,numformatter.obj,markupparser.obj + valnum.obj,numformatter.obj,markupparser.obj,\ + affinematrix2d.obj,richtooltipcmn.obj,persist.obj,time.obj OBJECTS_MOTIF=radiocmn.obj,combocmn.obj @@ -425,17 +427,20 @@ SOURCES = \ statboxcmn.cpp,slidercmn.cpp,statlinecmn.cpp,radiobtncmn.cpp,\ bmpbtncmn.cpp,checklstcmn.cpp,statbmpcmn.cpp,dirctrlcmn.cpp,\ gridcmn.cpp,odcombocmn.cpp,spinbtncmn.cpp,scrolbarcmn.cpp,\ - colourdata.cpp,fontdata.cpp + colourdata.cpp,fontdata.cpp affinematrix2d.cpp\ + richtooltipcmn.cpp persist.cpp time.cpp all : $(SOURCES) $(MMS)$(MMSQUALIFIERS) $(OBJECTS) $(MMS)$(MMSQUALIFIERS) $(OBJECTS1) $(MMS)$(MMSQUALIFIERS) $(OBJECTS2) + $(MMS)$(MMSQUALIFIERS) $(OBJECTS3) .ifdef __WXMOTIF__ $(MMS)$(MMSQUALIFIERS) $(OBJECTS_MOTIF) library [--.lib]libwx_motif.olb $(OBJECTS) library [--.lib]libwx_motif.olb $(OBJECTS1) library [--.lib]libwx_motif.olb $(OBJECTS2) + library [--.lib]libwx_motif.olb $(OBJECTS3) library [--.lib]libwx_motif.olb $(OBJECTS_MOTIF) .else .ifdef __WXGTK__ @@ -443,6 +448,7 @@ all : $(SOURCES) library [--.lib]libwx_gtk.olb $(OBJECTS) library [--.lib]libwx_gtk.olb $(OBJECTS1) library [--.lib]libwx_gtk.olb $(OBJECTS2) + library [--.lib]libwx_gtk.olb $(OBJECTS3) library [--.lib]libwx_gtk.olb $(OBJECTS_X11) .else .ifdef __WXGTK2__ @@ -451,6 +457,7 @@ all : $(SOURCES) library [--.lib]libwx_gtk2.olb $(OBJECTS) library [--.lib]libwx_gtk2.olb $(OBJECTS1) library [--.lib]libwx_gtk2.olb $(OBJECTS2) + library [--.lib]libwx_gtk2.olb $(OBJECTS3) library [--.lib]libwx_gtk2.olb $(OBJECTS_X11) library [--.lib]libwx_gtk2.olb $(OBJECTS_GTK2) .else @@ -459,6 +466,7 @@ all : $(SOURCES) library [--.lib]libwx_x11_univ.olb $(OBJECTS) library [--.lib]libwx_x11_univ.olb $(OBJECTS1) library [--.lib]libwx_x11_univ.olb $(OBJECTS2) + library [--.lib]libwx_x11_univ.olb $(OBJECTS3) library [--.lib]libwx_x11_univ.olb $(OBJECTS_X11) .endif .endif @@ -468,6 +476,7 @@ all : $(SOURCES) $(OBJECTS) : [--.include.wx]setup.h $(OBJECTS1) : [--.include.wx]setup.h $(OBJECTS2) : [--.include.wx]setup.h +$(OBJECTS3) : [--.include.wx]setup.h $(OBJECTS_X11) : [--.include.wx]setup.h $(OBJECTS_GTK2) : [--.include.wx]setup.h $(OBJECTS_MOTIF) : [--.include.wx]setup.h @@ -700,3 +709,7 @@ fontdata.obj : fontdata.cpp valnum.obj : valnum.cpp numformatter.obj : numformatter.cpp markupparser.obj : markupparser.cpp +affinematrix2d.obj : affinematrix2d.cpp +richtooltipcmn.obj : richtooltipcmn.cpp +persist.obj : persist.cpp +time.obj : time.cpp diff --git a/Externals/wxWidgets3/src/common/dlgcmn.cpp b/Externals/wxWidgets3/src/common/dlgcmn.cpp index d42c05e87f..1fb9b03f7d 100644 --- a/Externals/wxWidgets3/src/common/dlgcmn.cpp +++ b/Externals/wxWidgets3/src/common/dlgcmn.cpp @@ -4,7 +4,7 @@ // Author: Vadim Zeitlin // Modified by: // Created: 28.06.99 -// RCS-ID: $Id: dlgcmn.cpp 66592 2011-01-05 18:27:58Z PC $ +// RCS-ID: $Id: dlgcmn.cpp 69458 2011-10-18 21:56:36Z VZ $ // Copyright: (c) Vadim Zeitlin // Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// @@ -224,13 +224,7 @@ wxSizer *wxDialogBase::CreateTextSizer(const wxString& message, widthMax = wxSystemSettings::GetMetric( wxSYS_SCREEN_X ) - 25; } - // '&' is used as accel mnemonic prefix in the wxWidgets controls but in - // the static messages created by CreateTextSizer() (used by wxMessageBox, - // for example), we don't want this special meaning, so we need to quote it - wxString text(message); - text.Replace(wxT("&"), wxT("&&")); - - return wrapper.CreateSizer(text, widthMax); + return wrapper.CreateSizer(message, widthMax); } #endif // wxUSE_STATTEXT diff --git a/Externals/wxWidgets3/src/common/dobjcmn.cpp b/Externals/wxWidgets3/src/common/dobjcmn.cpp index c160b7b79f..14f40b8ff1 100644 --- a/Externals/wxWidgets3/src/common/dobjcmn.cpp +++ b/Externals/wxWidgets3/src/common/dobjcmn.cpp @@ -4,7 +4,7 @@ // Author: Vadim Zeitlin, Robert Roebling // Modified by: // Created: 19.10.99 -// RCS-ID: $Id: dobjcmn.cpp 65510 2010-09-10 19:28:52Z VZ $ +// RCS-ID: $Id: dobjcmn.cpp 70908 2012-03-15 13:49:49Z VZ $ // Copyright: (c) wxWidgets Team // Licence: wxWindows licence /////////////////////////////////////////////////////////////////////////////// @@ -234,7 +234,12 @@ bool wxDataObjectComposite::SetData(const wxDataFormat& format, wxT("unsupported format in wxDataObjectComposite")); m_receivedFormat = format; - return dataObj->SetData( len, buf ); + + // Notice that we must pass "format" here as wxTextDataObject, that we can + // have as one of our "simple" sub-objects actually is not that simple and + // can support multiple formats (ASCII/UTF-8/UTF-16/...) and so needs to + // know which one it is given. + return dataObj->SetData( format, len, buf ); } // ---------------------------------------------------------------------------- diff --git a/Externals/wxWidgets3/src/common/docview.cpp b/Externals/wxWidgets3/src/common/docview.cpp index 168cba6422..94f6d8650a 100644 --- a/Externals/wxWidgets3/src/common/docview.cpp +++ b/Externals/wxWidgets3/src/common/docview.cpp @@ -4,7 +4,7 @@ // Author: Julian Smart // Modified by: Vadim Zeitlin // Created: 01/02/97 -// RCS-ID: $Id: docview.cpp 67280 2011-03-22 14:17:38Z DS $ +// RCS-ID: $Id: docview.cpp 70790 2012-03-04 00:29:03Z VZ $ // Copyright: (c) Julian Smart // Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// @@ -122,8 +122,12 @@ wxString FindExtension(const wxString& path) wxDocument::wxDocument(wxDocument *parent) { m_documentModified = false; - m_documentParent = parent; m_documentTemplate = NULL; + + m_documentParent = parent; + if ( parent ) + parent->m_childDocuments.push_back(this); + m_commandProcessor = NULL; m_savedYet = false; } @@ -140,6 +144,9 @@ wxDocument::~wxDocument() if (GetDocumentManager()) GetDocumentManager()->RemoveDocument(this); + if ( m_documentParent ) + m_documentParent->m_childDocuments.remove(this); + // Not safe to do here, since it'll invoke virtual view functions // expecting to see valid derived objects: and by the time we get here, // we've called destructors higher up. @@ -151,6 +158,40 @@ bool wxDocument::Close() if ( !OnSaveModified() ) return false; + // When the parent document closes, its children must be closed as well as + // they can't exist without the parent. + + // As usual, first check if all children can be closed. + DocsList::const_iterator it = m_childDocuments.begin(); + for ( DocsList::const_iterator end = m_childDocuments.end(); it != end; ++it ) + { + if ( !(*it)->OnSaveModified() ) + { + // Leave the parent document opened if a child can't close. + return false; + } + } + + // Now that they all did, do close them: as m_childDocuments is modified as + // we iterate over it, don't use the usual for-style iteration here. + while ( !m_childDocuments.empty() ) + { + wxDocument * const childDoc = m_childDocuments.front(); + + // This will call OnSaveModified() once again but it shouldn't do + // anything as the document was just saved or marked as not needing to + // be saved by the call to OnSaveModified() that returned true above. + if ( !childDoc->Close() ) + { + wxFAIL_MSG( "Closing the child document unexpectedly failed " + "after its OnSaveModified() returned true" ); + } + + // Delete the child document by deleting all its views. + childDoc->DeleteAllViews(); + } + + return OnCloseDocument(); } @@ -231,6 +272,12 @@ void wxDocument::Modify(bool mod) wxDocManager *wxDocument::GetDocumentManager() const { + // For child documents we use the same document manager as the parent, even + // though we don't have our own template (as children are not opened/saved + // directly). + if ( m_documentParent ) + return m_documentParent->GetDocumentManager(); + return m_documentTemplate ? m_documentTemplate->GetDocumentManager() : NULL; } @@ -350,6 +397,9 @@ bool wxDocument::OnSaveDocument(const wxString& file) if ( !DoSaveDocument(file) ) return false; + if ( m_commandProcessor ) + m_commandProcessor->MarkAsSaved(); + Modify(false); SetFilename(file); SetDocumentSaved(true); @@ -895,7 +945,7 @@ BEGIN_EVENT_TABLE(wxDocManager, wxEvtHandler) EVT_UPDATE_UI(wxID_REVERT, wxDocManager::OnUpdateFileRevert) EVT_UPDATE_UI(wxID_NEW, wxDocManager::OnUpdateFileNew) EVT_UPDATE_UI(wxID_SAVE, wxDocManager::OnUpdateFileSave) - EVT_UPDATE_UI(wxID_SAVEAS, wxDocManager::OnUpdateDisableIfNoDoc) + EVT_UPDATE_UI(wxID_SAVEAS, wxDocManager::OnUpdateFileSaveAs) EVT_UPDATE_UI(wxID_UNDO, wxDocManager::OnUpdateUndo) EVT_UPDATE_UI(wxID_REDO, wxDocManager::OnUpdateRedo) @@ -1106,26 +1156,27 @@ void wxDocManager::DoOpenMRUFile(unsigned n) wxString errMsg; // must contain exactly one "%s" if non-empty if ( wxFile::Exists(filename) ) { - // try to open it - if ( CreateDocument(filename, wxDOC_SILENT) ) - return; - - errMsg = _("The file '%s' couldn't be opened."); + // Try to open it but don't give an error if it failed: this could be + // normal, e.g. because the user cancelled opening it, and we don't + // have any useful information to put in the error message anyhow, so + // we assume that in case of an error the appropriate message had been + // already logged. + (void)CreateDocument(filename, wxDOC_SILENT); } else // file doesn't exist { - errMsg = _("The file '%s' doesn't exist and couldn't be opened."); + OnMRUFileNotExist(n, filename); } +} - - wxASSERT_MSG( !errMsg.empty(), "should have an error message" ); - +void wxDocManager::OnMRUFileNotExist(unsigned n, const wxString& filename) +{ // remove the file which we can't open from the MRU list RemoveFileFromHistory(n); // and tell the user about it - wxLogError(errMsg + '\n' + - _("It has been removed from the most recently used files list."), + wxLogError(_("The file '%s' doesn't exist and couldn't be opened.\n" + "It has been removed from the most recently used files list."), filename); } @@ -1181,7 +1232,7 @@ void wxDocManager::OnPreview(wxCommandEvent& WXUNUSED(event)) preview = new wxPrintPreview(printout, view->OnCreatePrintout(), &printDialogData); - if ( !preview->Ok() ) + if ( !preview->IsOk() ) { delete preview; wxLogError(_("Print preview creation failed.")); @@ -1254,7 +1305,13 @@ void wxDocManager::OnUpdateFileNew(wxUpdateUIEvent& event) void wxDocManager::OnUpdateFileSave(wxUpdateUIEvent& event) { wxDocument * const doc = GetCurrentDocument(); - event.Enable( doc && !doc->AlreadySaved() ); + event.Enable( doc && !doc->IsChildDocument() && !doc->AlreadySaved() ); +} + +void wxDocManager::OnUpdateFileSaveAs(wxUpdateUIEvent& event) +{ + wxDocument * const doc = GetCurrentDocument(); + event.Enable( doc && !doc->IsChildDocument() ); } void wxDocManager::OnUpdateUndo(wxUpdateUIEvent& event) @@ -1262,10 +1319,14 @@ void wxDocManager::OnUpdateUndo(wxUpdateUIEvent& event) wxCommandProcessor * const cmdproc = GetCurrentCommandProcessor(); if ( !cmdproc ) { - event.Enable(false); + // If we don't have any document at all, the menu item should really be + // disabled. + if ( !GetCurrentDocument() ) + event.Enable(false); + else // But if we do have it, it might handle wxID_UNDO on its own + event.Skip(); return; } - event.Enable(cmdproc->CanUndo()); cmdproc->SetMenuStrings(); } @@ -1275,10 +1336,13 @@ void wxDocManager::OnUpdateRedo(wxUpdateUIEvent& event) wxCommandProcessor * const cmdproc = GetCurrentCommandProcessor(); if ( !cmdproc ) { - event.Enable(false); + // Use same logic as in OnUpdateUndo() above. + if ( !GetCurrentDocument() ) + event.Enable(false); + else + event.Skip(); return; } - event.Enable(cmdproc->CanRedo()); cmdproc->SetMenuStrings(); } @@ -1350,7 +1414,7 @@ void wxDocManager::ActivateDocument(wxDocument *doc) view->Activate(true); if ( wxWindow *win = view->GetFrame() ) - win->SetFocus(); + win->Raise(); } wxDocument *wxDocManager::CreateDocument(const wxString& pathOrig, long flags) diff --git a/Externals/wxWidgets3/src/common/dummy.cpp b/Externals/wxWidgets3/src/common/dummy.cpp index db74ef7c68..98044d0f4d 100644 --- a/Externals/wxWidgets3/src/common/dummy.cpp +++ b/Externals/wxWidgets3/src/common/dummy.cpp @@ -23,7 +23,7 @@ #pragma hdrstop #endif -#ifdef __WXMSW__ +#ifdef __WINDOWS__ #include "wx/msw/msvcrt.h" #endif diff --git a/Externals/wxWidgets3/src/common/dynarray.cpp b/Externals/wxWidgets3/src/common/dynarray.cpp index b9b3e5c934..7859e12ee2 100644 --- a/Externals/wxWidgets3/src/common/dynarray.cpp +++ b/Externals/wxWidgets3/src/common/dynarray.cpp @@ -4,7 +4,7 @@ // Author: Vadim Zeitlin // Modified by: // Created: 12.09.97 -// RCS-ID: $Id: dynarray.cpp 61279 2009-07-02 09:08:50Z VZ $ +// RCS-ID: $Id: dynarray.cpp 68470 2011-07-31 12:19:51Z VZ $ // Copyright: (c) 1998 Vadim Zeitlin // Licence: wxWindows licence /////////////////////////////////////////////////////////////////////////////// @@ -28,7 +28,7 @@ #include #include // for memmove -#if !wxUSE_STL +#if !wxUSE_STD_CONTAINERS // we cast the value to long from which we cast it to void * in IndexForInsert: // this can't work if the pointers are not big enough @@ -358,6 +358,9 @@ void name::insert(iterator it, const_iterator first, const_iterator last) \ return; \ Grow(nInsert); \ \ + /* old iterator could have been invalidated by Grow(). */ \ + it = begin() + nIndex; \ + \ memmove(&m_pItems[nIndex + nInsert], &m_pItems[nIndex], \ (m_nCount - nIndex)*sizeof(T)); \ for (size_t i = 0; i < nInsert; ++i, ++it, ++first) \ @@ -383,7 +386,7 @@ _WX_DEFINE_BASEARRAY(double, wxBaseArrayDouble) #pragma warning(pop) #endif -#else // wxUSE_STL +#else // wxUSE_STD_CONTAINERS #include "wx/arrstr.h" @@ -491,4 +494,4 @@ int wxSortedArrayString::Index(const wxString& str, return it - begin(); } -#endif // !wxUSE_STL/wxUSE_STL +#endif // !wxUSE_STD_CONTAINERS/wxUSE_STD_CONTAINERS diff --git a/Externals/wxWidgets3/src/common/dynlib.cpp b/Externals/wxWidgets3/src/common/dynlib.cpp index ac87179c56..61fda2dcd5 100644 --- a/Externals/wxWidgets3/src/common/dynlib.cpp +++ b/Externals/wxWidgets3/src/common/dynlib.cpp @@ -4,7 +4,7 @@ // Author: Guilhem Lavaux // Modified by: // Created: 20/07/98 -// RCS-ID: $Id: dynlib.cpp 61508 2009-07-23 20:30:22Z VZ $ +// RCS-ID: $Id: dynlib.cpp 70796 2012-03-04 00:29:31Z VZ $ // Copyright: (c) 1998 Guilhem Lavaux // 2000-2005 Vadim Zeitlin // Licence: wxWindows licence @@ -59,7 +59,7 @@ WX_DEFINE_USER_EXPORTED_OBJARRAY(wxDynamicLibraryDetailsArray) #endif // for MSW/Unix it is defined in platform-specific file -#if !(defined(__WXMSW__) || defined(__UNIX__)) || defined(__EMX__) +#if !(defined(__WINDOWS__) || defined(__UNIX__)) || defined(__EMX__) wxDllType wxDynamicLibrary::GetProgramHandle() { @@ -67,7 +67,7 @@ wxDllType wxDynamicLibrary::GetProgramHandle() return 0; } -#endif // __WXMSW__ || __UNIX__ +#endif // __WINDOWS__ || __UNIX__ bool wxDynamicLibrary::Load(const wxString& libnameOrig, int flags) @@ -112,7 +112,7 @@ bool wxDynamicLibrary::Load(const wxString& libnameOrig, int flags) // for MSW and Unix this is implemented in the platform-specific file // // TODO: move the rest to os2/dlpm.cpp and mac/dlmac.cpp! -#if (!defined(__WXMSW__) && !defined(__UNIX__)) || defined(__EMX__) +#if (!defined(__WINDOWS__) && !defined(__UNIX__)) || defined(__EMX__) /* static */ void wxDynamicLibrary::Unload(wxDllType handle) @@ -124,7 +124,7 @@ void wxDynamicLibrary::Unload(wxDllType handle) #endif } -#endif // !(__WXMSW__ || __UNIX__) +#endif // !(__WINDOWS__ || __UNIX__) void *wxDynamicLibrary::DoGetSymbol(const wxString &name, bool *success) const { diff --git a/Externals/wxWidgets3/src/common/encconv.cpp b/Externals/wxWidgets3/src/common/encconv.cpp index fdfa64eb6a..e666b9f245 100644 --- a/Externals/wxWidgets3/src/common/encconv.cpp +++ b/Externals/wxWidgets3/src/common/encconv.cpp @@ -444,7 +444,7 @@ wxFontEncodingArray wxEncodingConverter::GetPlatformEquivalents(wxFontEncoding e { if (platform == wxPLATFORM_CURRENT) { -#if defined(__WXMSW__) +#if defined(__WINDOWS__) platform = wxPLATFORM_WINDOWS; #elif defined(__WXGTK__) || defined(__WXMOTIF__) platform = wxPLATFORM_UNIX; diff --git a/Externals/wxWidgets3/src/common/event.cpp b/Externals/wxWidgets3/src/common/event.cpp index 496e2caa85..34c3c16dde 100644 --- a/Externals/wxWidgets3/src/common/event.cpp +++ b/Externals/wxWidgets3/src/common/event.cpp @@ -4,7 +4,7 @@ // Author: Julian Smart // Modified by: // Created: 01/02/97 -// RCS-ID: $Id: event.cpp 67280 2011-03-22 14:17:38Z DS $ +// RCS-ID: $Id: event.cpp 69893 2011-12-02 00:50:25Z VZ $ // Copyright: (c) Julian Smart // Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// @@ -25,6 +25,7 @@ #endif #include "wx/event.h" +#include "wx/eventfilter.h" #include "wx/evtloop.h" #ifndef WX_PRECOMP @@ -62,11 +63,11 @@ IMPLEMENT_DYNAMIC_CLASS(wxEvtHandler, wxObject) IMPLEMENT_ABSTRACT_CLASS(wxEvent, wxObject) IMPLEMENT_DYNAMIC_CLASS(wxIdleEvent, wxEvent) + IMPLEMENT_DYNAMIC_CLASS(wxThreadEvent, wxEvent) #endif // wxUSE_BASE #if wxUSE_GUI IMPLEMENT_DYNAMIC_CLASS(wxCommandEvent, wxEvent) - IMPLEMENT_DYNAMIC_CLASS(wxThreadEvent, wxCommandEvent) IMPLEMENT_DYNAMIC_CLASS(wxNotifyEvent, wxCommandEvent) IMPLEMENT_DYNAMIC_CLASS(wxScrollEvent, wxCommandEvent) IMPLEMENT_DYNAMIC_CLASS(wxScrollWinEvent, wxEvent) @@ -155,6 +156,9 @@ const wxEventType wxEVT_NULL = wxNewEventType(); wxDEFINE_EVENT( wxEVT_IDLE, wxIdleEvent ); +// Thread event +wxDEFINE_EVENT( wxEVT_THREAD, wxThreadEvent ); + #endif // wxUSE_BASE #if wxUSE_GUI @@ -206,6 +210,7 @@ wxDEFINE_EVENT( wxEVT_AUX2_DCLICK, wxMouseEvent ); // Character input event type wxDEFINE_EVENT( wxEVT_CHAR, wxKeyEvent ); +wxDEFINE_EVENT( wxEVT_AFTER_CHAR, wxKeyEvent ); wxDEFINE_EVENT( wxEVT_CHAR_HOOK, wxKeyEvent ); wxDEFINE_EVENT( wxEVT_NAVIGATION_KEY, wxNavigationKeyEvent ); wxDEFINE_EVENT( wxEVT_KEY_DOWN, wxKeyEvent ); @@ -311,9 +316,6 @@ wxDEFINE_EVENT( wxEVT_COMMAND_ENTER, wxCommandEvent ); wxDEFINE_EVENT( wxEVT_HELP, wxHelpEvent ); wxDEFINE_EVENT( wxEVT_DETAILED_HELP, wxHelpEvent ); -// Thread event -wxDEFINE_EVENT( wxEVT_COMMAND_THREAD, wxThreadEvent ); - #endif // wxUSE_GUI #if wxUSE_BASE @@ -411,28 +413,17 @@ wxEvent& wxEvent::operator=(const wxEvent& src) // wxCommandEvent // ---------------------------------------------------------------------------- -#ifdef __VISUALC__ - // 'this' : used in base member initializer list (for m_commandString) - #pragma warning(disable:4355) -#endif - wxCommandEvent::wxCommandEvent(wxEventType commandType, int theId) : wxEvent(theId, commandType) { m_clientData = NULL; m_clientObject = NULL; - m_extraLong = 0; - m_commandInt = 0; m_isCommandEvent = true; // the command events are propagated upwards by default m_propagationLevel = wxEVENT_PROPAGATE_MAX; } -#ifdef __VISUALC__ - #pragma warning(default:4355) -#endif - wxString wxCommandEvent::GetString() const { if (m_eventType != wxEVT_COMMAND_TEXT_UPDATED || !m_eventObject) @@ -473,6 +464,13 @@ bool wxUpdateUIEvent::CanUpdate(wxWindowBase *win) ((win->GetExtraStyle() & wxWS_EX_PROCESS_UI_UPDATES) == 0))) return false; + // Don't update children of the hidden windows: this is useless as any + // change to their state won't be seen by the user anyhow. Notice that this + // argument doesn't apply to the hidden windows (with visible parent) + // themselves as they could be shown by their EVT_UPDATE_UI handler. + if ( win->GetParent() && !win->GetParent()->IsShownOnScreen() ) + return false; + if (sm_updateInterval == -1) return false; @@ -737,22 +735,28 @@ wxKeyEvent::wxKeyEvent(wxEventType type) #if wxUSE_UNICODE m_uniChar = WXK_NONE; #endif + + InitPropagation(); } wxKeyEvent::wxKeyEvent(const wxKeyEvent& evt) : wxEvent(evt), wxKeyboardState(evt) { - m_x = evt.m_x; - m_y = evt.m_y; + DoAssignMembers(evt); - m_keyCode = evt.m_keyCode; - m_rawCode = evt.m_rawCode; - m_rawFlags = evt.m_rawFlags; + InitPropagation(); +} -#if wxUSE_UNICODE - m_uniChar = evt.m_uniChar; -#endif +wxKeyEvent::wxKeyEvent(wxEventType eventType, const wxKeyEvent& evt) + : wxEvent(evt), + wxKeyboardState(evt) +{ + DoAssignMembers(evt); + + m_eventType = eventType; + + InitPropagation(); } bool wxKeyEvent::IsKeyInCategory(int category) const @@ -1126,6 +1130,43 @@ bool wxEvtHandler::IsUnlinked() const m_nextHandler == NULL; } +wxEventFilter* wxEvtHandler::ms_filterList = NULL; + +/* static */ void wxEvtHandler::AddFilter(wxEventFilter* filter) +{ + wxCHECK_RET( filter, "NULL filter" ); + + filter->m_next = ms_filterList; + ms_filterList = filter; +} + +/* static */ void wxEvtHandler::RemoveFilter(wxEventFilter* filter) +{ + wxEventFilter* prev = NULL; + for ( wxEventFilter* f = ms_filterList; f; f = f->m_next ) + { + if ( f == filter ) + { + // Set the previous list element or the list head to the next + // element. + if ( prev ) + prev->m_next = f->m_next; + else + ms_filterList = f->m_next; + + // Also reset the next pointer in the filter itself just to avoid + // having possibly dangling pointers, even though it's not strictly + // necessary. + f->m_next = NULL; + + // Skip the assert below. + return; + } + } + + wxFAIL_MSG( "Filter not found" ); +} + #if wxUSE_THREADS bool wxEvtHandler::ProcessThreadEvent(const wxEvent& event) @@ -1354,23 +1395,24 @@ bool wxEvtHandler::TryAfter(wxEvent& event) bool wxEvtHandler::ProcessEvent(wxEvent& event) { - // The very first thing we do is to allow the application to hook into - // event processing in order to globally pre-process all events. + // The very first thing we do is to allow any registered filters to hook + // into event processing in order to globally pre-process all events. // // Note that we should only do it if we're the first event handler called // to avoid calling FilterEvent() multiple times as the event goes through // the event handler chain and possibly upwards the window hierarchy. if ( !event.WasProcessed() ) { - if ( wxTheApp ) + for ( wxEventFilter* f = ms_filterList; f; f = f->m_next ) { - int rc = wxTheApp->FilterEvent(event); - if ( rc != -1 ) + int rc = f->FilterEvent(event); + if ( rc != wxEventFilter::Event_Skip ) { - wxASSERT_MSG( rc == 1 || rc == 0, - "unexpected wxApp::FilterEvent return value" ); + wxASSERT_MSG( rc == wxEventFilter::Event_Ignore || + rc == wxEventFilter::Event_Processed, + "unexpected FilterEvent() return value" ); - return rc != 0; + return rc != wxEventFilter::Event_Ignore; } //else: proceed normally } diff --git a/Externals/wxWidgets3/src/common/evtloopcmn.cpp b/Externals/wxWidgets3/src/common/evtloopcmn.cpp index f30b3e9998..a8abd2b297 100644 --- a/Externals/wxWidgets3/src/common/evtloopcmn.cpp +++ b/Externals/wxWidgets3/src/common/evtloopcmn.cpp @@ -4,7 +4,7 @@ // Author: Vadim Zeitlin // Modified by: // Created: 2006-01-12 -// RCS-ID: $Id: evtloopcmn.cpp 66229 2010-11-22 01:22:56Z VZ $ +// RCS-ID: $Id: evtloopcmn.cpp 70796 2012-03-04 00:29:31Z VZ $ // Copyright: (c) 2006 Vadim Zeitlin // Licence: wxWindows licence /////////////////////////////////////////////////////////////////////////////// @@ -82,7 +82,7 @@ bool wxEventLoopBase::Yield(bool onlyIfNeeded) } // wxEventLoopManual is unused in the other ports -#if defined(__WXMSW__) || defined(__WXDFB__) || ( ( defined(__UNIX__) && !defined(__WXOSX__) ) && wxUSE_BASE) +#if defined(__WINDOWS__) || defined(__WXDFB__) || ( ( defined(__UNIX__) && !defined(__WXOSX__) ) && wxUSE_BASE) // ============================================================================ // wxEventLoopManual implementation @@ -213,5 +213,5 @@ void wxEventLoopManual::Exit(int rc) WakeUp(); } -#endif // __WXMSW__ || __WXMAC__ || __WXDFB__ +#endif // __WINDOWS__ || __WXMAC__ || __WXDFB__ diff --git a/Externals/wxWidgets3/src/common/file.cpp b/Externals/wxWidgets3/src/common/file.cpp index 3ddfcad6ac..77e14d443f 100644 --- a/Externals/wxWidgets3/src/common/file.cpp +++ b/Externals/wxWidgets3/src/common/file.cpp @@ -5,7 +5,7 @@ // Author: Vadim Zeitlin // Modified by: // Created: 29/01/98 -// RCS-ID: $Id: file.cpp 66150 2010-11-14 12:09:59Z VZ $ +// RCS-ID: $Id: file.cpp 70796 2012-03-04 00:29:31Z VZ $ // Copyright: (c) 1998 Vadim Zeitlin // Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// @@ -24,7 +24,7 @@ #if wxUSE_FILE // standard -#if defined(__WXMSW__) && !defined(__GNUWIN32__) && !defined(__WXMICROWIN__) && !defined(__WXWINCE__) +#if defined(__WINDOWS__) && !defined(__GNUWIN32__) && !defined(__WXMICROWIN__) && !defined(__WXWINCE__) #define WIN32_LEAN_AND_MEAN #define NOSERVICE @@ -47,7 +47,7 @@ #define NOCRYPT #define NOMCX -#elif defined(__WXMSW__) && defined(__WXWINCE__) +#elif defined(__WINDOWS__) && defined(__WXWINCE__) #include "wx/msw/missing.h" #elif (defined(__OS2__)) #include @@ -80,8 +80,6 @@ char* mktemp( char * path ) { return path ;} #include #include -#elif defined(__WXPALMOS__) - #include "wx/palmos/missing.h" #else #error "Please specify the header with file functions declarations." #endif //Win/UNIX @@ -121,7 +119,7 @@ #define O_BINARY (0) #endif //__UNIX__ -#ifdef __WXMSW__ +#ifdef __WINDOWS__ #include "wx/msw/mslu.h" #endif diff --git a/Externals/wxWidgets3/src/common/fileconf.cpp b/Externals/wxWidgets3/src/common/fileconf.cpp index 1ad679ce70..3604443340 100644 --- a/Externals/wxWidgets3/src/common/fileconf.cpp +++ b/Externals/wxWidgets3/src/common/fileconf.cpp @@ -4,7 +4,7 @@ // Author: Vadim Zeitlin // Modified by: // Created: 07.04.98 (adapted from appconf.cpp) -// RCS-ID: $Id: fileconf.cpp 67280 2011-03-22 14:17:38Z DS $ +// RCS-ID: $Id: fileconf.cpp 70796 2012-03-04 00:29:31Z VZ $ // Copyright: (c) 1997 Karsten Ballueder & Vadim Zeitlin // Ballueder@usa.net // Licence: wxWindows licence @@ -46,7 +46,7 @@ #include "wx/stdpaths.h" -#if defined(__WXMSW__) +#if defined(__WINDOWS__) #include "wx/msw/private.h" #endif //windows.h #if defined(__WXPM__) @@ -2111,7 +2111,7 @@ static wxString FilterOutEntryName(const wxString& str) #if !wxUSE_UNICODE ((unsigned char)c < 127) && #endif // ANSI - !wxIsalnum(c) && !wxStrchr(wxT("@_/-!.*%"), c) ) + !wxIsalnum(c) && !wxStrchr(wxT("@_/-!.*%()"), c) ) { strResult += wxT('\\'); } diff --git a/Externals/wxWidgets3/src/common/filefn.cpp b/Externals/wxWidgets3/src/common/filefn.cpp index eb4b401eb8..e0663b3085 100644 --- a/Externals/wxWidgets3/src/common/filefn.cpp +++ b/Externals/wxWidgets3/src/common/filefn.cpp @@ -4,7 +4,7 @@ // Author: Julian Smart // Modified by: // Created: 29/01/98 -// RCS-ID: $Id: filefn.cpp 67280 2011-03-22 14:17:38Z DS $ +// RCS-ID: $Id: filefn.cpp 70796 2012-03-04 00:29:31Z VZ $ // Copyright: (c) 1998 Julian Smart // Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// @@ -367,7 +367,7 @@ template static CharType *wxDoRealPath (CharType *path) { static const CharType SEP = wxFILE_SEP_PATH; -#ifdef __WXMSW__ +#ifdef __WINDOWS__ wxUnix2DosFilename(path); #endif if (path[0] && path[1]) { @@ -398,7 +398,7 @@ static CharType *wxDoRealPath (CharType *path) path[0] = SEP; path[1] = wxT('\0'); } -#if defined(__WXMSW__) || defined(__OS2__) +#if defined(__WINDOWS__) || defined(__OS2__) /* Check that path[2] is NULL! */ else if (path[1] == wxT(':') && !path[2]) { @@ -447,7 +447,7 @@ wxChar *wxCopyAbsolutePath(const wxString& filename) { wxString buf = ::wxGetCwd(); wxChar ch = buf.Last(); -#ifdef __WXMSW__ +#ifdef __WINDOWS__ if (ch != wxT('\\') && ch != wxT('/')) buf << wxT("\\"); #else @@ -501,7 +501,7 @@ static CharType *wxDoExpandPath(CharType *buf, const wxString& name) trimchars[3] = 0; static const CharType SEP = wxFILE_SEP_PATH; -#ifdef __WXMSW__ +#ifdef __WINDOWS__ //wxUnix2DosFilename(path); #endif @@ -521,7 +521,7 @@ static CharType *wxDoExpandPath(CharType *buf, const wxString& name) s = nm; d = lnm; -#ifdef __WXMSW__ +#ifdef __WINDOWS__ q = FALSE; #else q = nm[0] == wxT('\\') && nm[1] == wxT('~'); @@ -546,7 +546,7 @@ static CharType *wxDoExpandPath(CharType *buf, const wxString& name) else #else while ((*d++ = *s) != 0) { -# ifndef __WXMSW__ +# ifndef __WINDOWS__ if (*s == wxT('\\')) { if ((*(d - 1) = *++s)!=0) { s++; @@ -558,7 +558,7 @@ static CharType *wxDoExpandPath(CharType *buf, const wxString& name) #endif // No env variables on WinCE #ifndef __WXWINCE__ -#ifdef __WXMSW__ +#ifdef __WINDOWS__ if (*s++ == wxT('$') && (*s == wxT('{') || *s == wxT(')'))) #else if (*s++ == wxT('$')) @@ -677,7 +677,7 @@ wxContractPath (const wxString& filename, return NULL; wxStrcpy (dest, filename); -#ifdef __WXMSW__ +#ifdef __WINDOWS__ wxUnix2DosFilename(dest); #endif @@ -767,7 +767,7 @@ wxPathOnly (wxChar *path) i --; } -#if defined(__WXMSW__) || defined(__OS2__) +#if defined(__WINDOWS__) || defined(__OS2__) // Try Drive specifier if (wxIsalpha (buf[0]) && buf[1] == wxT(':')) { @@ -816,7 +816,7 @@ wxString wxPathOnly (const wxString& path) i --; } -#if defined(__WXMSW__) || defined(__OS2__) +#if defined(__WINDOWS__) || defined(__OS2__) // Try Drive specifier if (wxIsalpha (buf[0]) && buf[1] == wxT(':')) { @@ -923,7 +923,7 @@ static void wxDoDos2UnixFilename(T *s) { if (*s == wxT('\\')) *s = wxT('/'); -#ifdef __WXMSW__ +#ifdef __WINDOWS__ else *s = wxTolower(*s); // Case INDEPENDENT #endif @@ -936,14 +936,14 @@ void wxDos2UnixFilename(wchar_t *s) { wxDoDos2UnixFilename(s); } template static void -#if defined(__WXMSW__) || defined(__OS2__) +#if defined(__WINDOWS__) || defined(__OS2__) wxDoUnix2DosFilename(T *s) #else wxDoUnix2DosFilename(T *WXUNUSED(s) ) #endif { // Yes, I really mean this to happen under DOS only! JACS -#if defined(__WXMSW__) || defined(__OS2__) +#if defined(__WINDOWS__) || defined(__OS2__) if (s) while (*s) { @@ -998,8 +998,7 @@ wxConcatFiles (const wxString& file1, const wxString& file2, const wxString& fil } // helper of generic implementation of wxCopyFile() -#if !(defined(__WIN32__) || defined(__OS2__) || defined(__PALMOS__)) && \ - wxUSE_FILE +#if !(defined(__WIN32__) || defined(__OS2__)) && wxUSE_FILE static bool wxDoCopyFile(wxFile& fileIn, @@ -1061,9 +1060,6 @@ wxCopyFile (const wxString& file1, const wxString& file2, bool overwrite) #elif defined(__OS2__) if ( ::DosCopy(file1.c_str(), file2.c_str(), overwrite ? DCPY_EXISTING : 0) != 0 ) return false; -#elif defined(__PALMOS__) - // TODO with http://www.palmos.com/dev/support/docs/protein_books/Memory_Databases_Files/ - return false; #elif wxUSE_FILE // !Win32 wxStructStat fbuf; @@ -1154,7 +1150,7 @@ wxCopyFile (const wxString& file1, const wxString& file2, bool overwrite) wxUnusedVar(overwrite); return false; -#endif // __WXMSW__ && __WIN32__ +#endif // __WINDOWS__ && __WIN32__ return true; } @@ -1173,7 +1169,7 @@ wxRenameFile(const wxString& file1, const wxString& file2, bool overwrite) return false; } -#if !defined(__WXWINCE__) && !defined(__WXPALMOS__) +#if !defined(__WXWINCE__) // Normal system call if ( wxRename (file1, file2) == 0 ) return true; @@ -1185,6 +1181,7 @@ wxRenameFile(const wxString& file1, const wxString& file2, bool overwrite) return true; } // Give up + wxLogSysError(_("File '%s' couldn't be renamed '%s'"), file1, file2); return false; } @@ -1199,27 +1196,24 @@ bool wxRemoveFile(const wxString& file) int res = wxRemove(file); #elif defined(__WXMAC__) int res = unlink(file.fn_str()); -#elif defined(__WXPALMOS__) - int res = 1; - // TODO with VFSFileDelete() #else int res = unlink(file.fn_str()); #endif - + if ( res ) + { + wxLogSysError(_("File '%s' couldn't be removed"), file); + } return res == 0; } bool wxMkdir(const wxString& dir, int perm) { -#if defined(__WXPALMOS__) - return false; -#else #if defined(__WXMAC__) && !defined(__UNIX__) if ( mkdir(dir.fn_str(), 0) != 0 ) // assume mkdir() has 2 args on non Windows-OS/2 platforms and on Windows too // for the GNU compiler -#elif (!(defined(__WXMSW__) || defined(__OS2__) || defined(__DOS__))) || \ +#elif (!(defined(__WINDOWS__) || defined(__OS2__) || defined(__DOS__))) || \ (defined(__GNUWIN32__) && !defined(__MINGW32__)) || \ defined(__WINE__) || defined(__WXMICROWIN__) const wxChar *dirname = dir.c_str(); @@ -1256,16 +1250,12 @@ bool wxMkdir(const wxString& dir, int perm) } return true; -#endif // PALMOS/!PALMOS } bool wxRmdir(const wxString& dir, int WXUNUSED(flags)) { #if defined(__VMS__) return false; //to be changed since rmdir exists in VMS7.x -#elif defined(__WXPALMOS__) - // TODO with VFSFileRename() - return false; #else #if defined(__OS2__) if ( ::DosDeleteDir(dir.c_str()) != 0 ) @@ -1280,7 +1270,7 @@ bool wxRmdir(const wxString& dir, int WXUNUSED(flags)) } return true; -#endif // PALMOS/!PALMOS +#endif } // does the path exists? (may have or not '/' or '\\' at the end) @@ -1299,12 +1289,7 @@ wxChar *wxGetTempFileName(const wxString& prefix, wxChar *buf) return NULL; if ( buf ) -#ifdef _PACC_VER - // work around the PalmOS pacc compiler bug - wxStrcpy(buf, filename.data()); -#else wxStrcpy(buf, filename); -#endif else buf = MYcopystring(filename); @@ -1394,11 +1379,7 @@ wxString wxFindNextFile() wxChar *wxDoGetCwd(wxChar *buf, int sz) { -#if defined(__WXPALMOS__) - // TODO - if(buf && sz>0) buf[0] = wxT('\0'); - return buf; -#elif defined(__WXWINCE__) +#if defined(__WXWINCE__) // TODO if(buf && sz>0) buf[0] = wxT('\0'); return buf; @@ -1537,6 +1518,7 @@ wxString wxGetCwd() bool wxSetWorkingDirectory(const wxString& d) { + bool success = false; #if defined(__OS2__) if (d[1] == ':') { @@ -1546,18 +1528,17 @@ bool wxSetWorkingDirectory(const wxString& d) if (d.length() == 2) return true; } - return (::DosSetCurrentDir(d.c_str()) == 0); + success = (::DosSetCurrentDir(d.c_str()) == 0); #elif defined(__UNIX__) || defined(__WXMAC__) || defined(__DOS__) - return (chdir(wxFNSTRINGCAST d.fn_str()) == 0); + success = (chdir(wxFNSTRINGCAST d.fn_str()) == 0); #elif defined(__WINDOWS__) #ifdef __WIN32__ #ifdef __WXWINCE__ // No equivalent in WinCE wxUnusedVar(d); - return false; #else - return (bool)(SetCurrentDirectory(d.fn_str()) != 0); + success = (SetCurrentDirectory(d.fn_str()) != 0); #endif #else // Must change drive, too. @@ -1578,12 +1559,15 @@ bool wxSetWorkingDirectory(const wxString& d) _dos_setdrive(driveNo, &noDrives); } } - bool success = (chdir(WXSTRINGCAST d) == 0); + success = (chdir(WXSTRINGCAST d) == 0); +#endif +#endif + if ( !success ) + { + wxLogSysError(_("Could not set current working directory")); + } return success; -#endif - -#endif } // Get the OS directory if appropriate (such as the Windows directory). @@ -1879,7 +1863,7 @@ bool wxIsExecutable(const wxString &path) // wxFileKind wxGetFileKind(int fd) { -#if defined __WXMSW__ && !defined __WXWINCE__ && defined wxGetOSFHandle +#if defined __WINDOWS__ && !defined __WXWINCE__ && defined wxGetOSFHandle switch (::GetFileType(wxGetOSFHandle(fd)) & ~FILE_TYPE_REMOTE) { case FILE_TYPE_CHAR: diff --git a/Externals/wxWidgets3/src/common/filehistorycmn.cpp b/Externals/wxWidgets3/src/common/filehistorycmn.cpp index 0cc23ac338..0ce3bd6a58 100644 --- a/Externals/wxWidgets3/src/common/filehistorycmn.cpp +++ b/Externals/wxWidgets3/src/common/filehistorycmn.cpp @@ -3,7 +3,7 @@ // Purpose: wxFileHistory class // Author: Julian Smart, Vaclav Slavik, Vadim Zeitlin // Created: 2010-05-03 -// RCS-ID: $Id: filehistorycmn.cpp 64240 2010-05-07 06:45:48Z VS $ +// RCS-ID: $Id: filehistorycmn.cpp 70503 2012-02-03 17:27:13Z VZ $ // Copyright: (c) Julian Smart // Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// @@ -68,15 +68,36 @@ wxFileHistoryBase::wxFileHistoryBase(size_t maxFiles, wxWindowID idBase) m_idBase = idBase; } +/* static */ +wxString wxFileHistoryBase::NormalizeFileName(const wxFileName& fn) +{ + // We specifically exclude wxPATH_NORM_LONG here as it can take a long time + // (several seconds) for network file paths under MSW, resulting in huge + // delays when opening a program using wxFileHistory. We also exclude + // wxPATH_NORM_ENV_VARS as the file names here are supposed to be "real" + // file names and not have any environment variables in them. + wxFileName fnNorm(fn); + fnNorm.Normalize(wxPATH_NORM_DOTS | + wxPATH_NORM_TILDE | + wxPATH_NORM_CASE | + wxPATH_NORM_ABSOLUTE); + return fnNorm.GetFullPath(); +} + void wxFileHistoryBase::AddFileToHistory(const wxString& file) { - // check if we don't already have this file + // Check if we don't already have this file. Notice that we avoid + // wxFileName::operator==(wxString) here as it converts the string to + // wxFileName and then normalizes it using all normalizations which is too + // slow (see the comment above), so we use our own quick normalization + // functions and a string comparison. const wxFileName fnNew(file); + const wxString newFile = NormalizeFileName(fnNew); size_t i, numFiles = m_fileHistory.size(); for ( i = 0; i < numFiles; i++ ) { - if ( fnNew == m_fileHistory[i] ) + if ( newFile == NormalizeFileName(m_fileHistory[i]) ) { // we do have it, move it to the top of the history RemoveFileFromHistory(i); diff --git a/Externals/wxWidgets3/src/common/filename.cpp b/Externals/wxWidgets3/src/common/filename.cpp index 539a8f68d9..0614b8047c 100644 --- a/Externals/wxWidgets3/src/common/filename.cpp +++ b/Externals/wxWidgets3/src/common/filename.cpp @@ -4,7 +4,7 @@ // Author: Robert Roebling, Vadim Zeitlin // Modified by: // Created: 28.12.2000 -// RCS-ID: $Id: filename.cpp 66996 2011-02-22 13:26:06Z VZ $ +// RCS-ID: $Id: filename.cpp 70796 2012-03-04 00:29:31Z VZ $ // Copyright: (c) 2000 Robert Roebling // Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// @@ -77,7 +77,7 @@ #endif #ifndef WX_PRECOMP - #ifdef __WXMSW__ + #ifdef __WINDOWS__ #include "wx/msw/wrapwin.h" // For GetShort/LongPathName #endif #include "wx/dynarray.h" @@ -98,7 +98,7 @@ #include "wx/msw/gccpriv.h" #endif -#ifdef __WXMSW__ +#ifdef __WINDOWS__ #include "wx/msw/private.h" #endif @@ -148,6 +148,12 @@ #define MAX_PATH _MAX_PATH #endif +#ifndef S_ISREG + #define S_ISREG(mode) ((mode) & S_IFREG) +#endif +#ifndef S_ISDIR + #define S_ISDIR(mode) ((mode) & S_IFDIR) +#endif #if wxUSE_LONGLONG extern const wxULongLong wxInvalidSize = (unsigned)-1; @@ -593,6 +599,117 @@ wxFileName wxFileName::DirName(const wxString& dir, wxPathFormat format) // existence tests // ---------------------------------------------------------------------------- +namespace +{ + +// Flags for wxFileSystemObjectExists() asking it to check for: +enum +{ + wxFileSystemObject_File = 1, // file existence + wxFileSystemObject_Dir = 2, // directory existence + wxFileSystemObject_Other = 4, // existence of something else, e.g. + // device, socket, FIFO under Unix + wxFileSystemObject_Any = 7 // existence of anything at all +}; + +#if defined(__WINDOWS__) && !defined(__WXMICROWIN__) + +void RemoveTrailingSeparatorsFromPath(wxString& strPath) +{ + // Windows fails to find directory named "c:\dir\" even if "c:\dir" exists, + // so remove all trailing backslashes from the path - but don't do this for + // the paths "d:\" (which are different from "d:"), for just "\" or for + // windows unique volume names ("\\?\Volume{GUID}\") + while ( wxEndsWithPathSeparator( strPath ) ) + { + size_t len = strPath.length(); + if ( len == 1 || (len == 3 && strPath[len - 2] == wxT(':')) || + (len == wxMSWUniqueVolumePrefixLength && + wxFileName::IsMSWUniqueVolumeNamePath(strPath))) + { + break; + } + + strPath.Truncate(len - 1); + } +} + +#endif // __WINDOWS__ || __OS2__ + +bool wxFileSystemObjectExists(const wxString& path, int flags) +{ + // Should the existence of file/directory with this name be accepted, i.e. + // result in the true return value from this function? + const bool acceptFile = (flags & wxFileSystemObject_File) != 0; + const bool acceptDir = (flags & wxFileSystemObject_Dir) != 0; + + wxString strPath(path); + +#if defined(__WINDOWS__) && !defined(__WXMICROWIN__) + if ( acceptDir ) + { + // Ensure that the path doesn't have any trailing separators when + // checking for directories. + RemoveTrailingSeparatorsFromPath(strPath); + } + + // we must use GetFileAttributes() instead of the ANSI C functions because + // it can cope with network (UNC) paths unlike them + DWORD ret = ::GetFileAttributes(path.t_str()); + + if ( ret == INVALID_FILE_ATTRIBUTES ) + return false; + + if ( ret & FILE_ATTRIBUTE_DIRECTORY ) + return acceptDir; + + // Anything else must be a file (perhaps we should check for + // FILE_ATTRIBUTE_REPARSE_POINT?) + return acceptFile; +#elif defined(__OS2__) + if ( acceptDir ) + { + // OS/2 can't handle "d:", it wants either "d:\" or "d:." + if (strPath.length() == 2 && strPath[1u] == wxT(':')) + strPath << wxT('.'); + } + + FILESTATUS3 Info = {{0}}; + APIRET rc = ::DosQueryPathInfo((PSZ)(WXSTRINGCAST strPath), FIL_STANDARD, + (void*) &Info, sizeof(FILESTATUS3)); + + if ( rc == NO_ERROR ) + { + if ( Info.attrFile & FILE_DIRECTORY ) + return acceptDir; + else + return acceptFile; + } + + // We consider that the path must exist if we get a sharing violation for + // it but we don't know what is it in this case. + if ( rc == ERROR_SHARING_VIOLATION ) + return flags & wxFileSystemObject_Other; + + // Any other error (usually ERROR_PATH_NOT_FOUND), means there is nothing + // there. + return false; +#else // Non-MSW, non-OS/2 + wxStructStat st; + if ( wxStat(strPath, &st) != 0 ) + return false; + + if ( S_ISREG(st.st_mode) ) + return acceptFile; + if ( S_ISDIR(st.st_mode) ) + return acceptDir; + + return flags & wxFileSystemObject_Other; +#endif // Platforms +} + +} // anonymous namespace + bool wxFileName::FileExists() const { return wxFileName::FileExists( GetFullPath() ); @@ -601,27 +718,7 @@ bool wxFileName::FileExists() const /* static */ bool wxFileName::FileExists( const wxString &filePath ) { -#if defined(__WXPALMOS__) - return false; -#elif defined(__WIN32__) && !defined(__WXMICROWIN__) - // we must use GetFileAttributes() instead of the ANSI C functions because - // it can cope with network (UNC) paths unlike them - DWORD ret = ::GetFileAttributes(filePath.t_str()); - - return (ret != INVALID_FILE_ATTRIBUTES) && !(ret & FILE_ATTRIBUTE_DIRECTORY); -#else // !__WIN32__ - #ifndef S_ISREG - #define S_ISREG(mode) ((mode) & S_IFREG) - #endif - wxStructStat st; - - return (wxStat( filePath, &st) == 0 && S_ISREG(st.st_mode)) -#ifdef __OS2__ - || (errno == EACCES) // if access is denied something with that name - // exists and is opened in exclusive mode. -#endif - ; -#endif // __WIN32__/!__WIN32__ + return wxFileSystemObjectExists(filePath, wxFileSystemObject_File); } bool wxFileName::DirExists() const @@ -632,59 +729,13 @@ bool wxFileName::DirExists() const /* static */ bool wxFileName::DirExists( const wxString &dirPath ) { - wxString strPath(dirPath); + return wxFileSystemObjectExists(dirPath, wxFileSystemObject_Dir); +} -#if defined(__WINDOWS__) || defined(__OS2__) - // Windows fails to find directory named "c:\dir\" even if "c:\dir" exists, - // so remove all trailing backslashes from the path - but don't do this for - // the paths "d:\" (which are different from "d:"), for just "\" or for - // windows unique volume names ("\\?\Volume{GUID}\") - while ( wxEndsWithPathSeparator(strPath) ) - { - size_t len = strPath.length(); - if ( len == 1 || (len == 3 && strPath[len - 2] == wxT(':')) || - (len == wxMSWUniqueVolumePrefixLength && - wxFileName::IsMSWUniqueVolumeNamePath(strPath))) - { - break; - } - - strPath.Truncate(len - 1); - } -#endif // __WINDOWS__ - -#ifdef __OS2__ - // OS/2 can't handle "d:", it wants either "d:\" or "d:." - if (strPath.length() == 2 && strPath[1u] == wxT(':')) - strPath << wxT('.'); -#endif - -#if defined(__WXPALMOS__) - return false; -#elif defined(__WIN32__) && !defined(__WXMICROWIN__) - // stat() can't cope with network paths - DWORD ret = ::GetFileAttributes(strPath.t_str()); - - return (ret != INVALID_FILE_ATTRIBUTES) && (ret & FILE_ATTRIBUTE_DIRECTORY); -#elif defined(__OS2__) - FILESTATUS3 Info = {{0}}; - APIRET rc = ::DosQueryPathInfo((PSZ)(WXSTRINGCAST strPath), FIL_STANDARD, - (void*) &Info, sizeof(FILESTATUS3)); - - return ((rc == NO_ERROR) && (Info.attrFile & FILE_DIRECTORY)) || - (rc == ERROR_SHARING_VIOLATION); - // If we got a sharing violation, there must be something with this name. -#else // !__WIN32__ - - wxStructStat st; -#ifndef __VISAGECPP__ - return wxStat(strPath, &st) == 0 && ((st.st_mode & S_IFMT) == S_IFDIR); -#else - // S_IFMT not supported in VA compilers.. st_mode is a 2byte value only - return wxStat(strPath, &st) == 0 && (st.st_mode == S_IFDIR); -#endif - -#endif // __WIN32__/!__WIN32__ +/* static */ +bool wxFileName::Exists(const wxString& path) +{ + return wxFileSystemObjectExists(path, wxFileSystemObject_Any); } // ---------------------------------------------------------------------------- @@ -809,7 +860,7 @@ static bool wxTempOpen(wxFFile *file, const wxString& path, bool *deleteOnClose) int fd = wxTempOpen(path, deleteOnClose); if (fd == -1) return false; - file->Attach(wx_fdopen(fd, "w+b")); + file->Attach(wx_fdopen(fd, "w+b"), path); return file->IsOpened(); #endif // wx_fdopen } @@ -920,7 +971,7 @@ static wxString wxCreateTempImpl( if ( ffileTemp ) { #ifdef wx_fdopen - ffileTemp->Attach(wx_fdopen(fdTemp, "r+b")); + ffileTemp->Attach(wx_fdopen(fdTemp, "r+b"), path); #else ffileTemp->Open(path, wxT("r+b")); close(fdTemp); @@ -950,7 +1001,7 @@ static wxString wxCreateTempImpl( } #else // !HAVE_MKTEMP (includes __DOS__) // generate the unique file name ourselves - #if !defined(__DOS__) && !defined(__PALMOS__) && (!defined(__MWERKS__) || defined(__DARWIN__) ) + #if !defined(__DOS__) && (!defined(__MWERKS__) || defined(__DARWIN__) ) path << (unsigned int)getpid(); #endif @@ -1267,7 +1318,7 @@ bool wxFileName::Rmdir(int flags) const bool wxFileName::Rmdir(const wxString& dir, int flags) { -#ifdef __WXMSW__ +#ifdef __WINDOWS__ if ( flags & wxPATH_RMDIR_RECURSIVE ) { // SHFileOperation needs double null termination string @@ -1303,9 +1354,9 @@ bool wxFileName::Rmdir(const wxString& dir, int flags) return true; } else if ( flags & wxPATH_RMDIR_FULL ) -#else // !__WXMSW__ +#else // !__WINDOWS__ if ( flags != 0 ) // wxPATH_RMDIR_FULL or wxPATH_RMDIR_RECURSIVE -#endif // !__WXMSW__ +#endif // !__WINDOWS__ { wxString path(dir); if ( path.Last() != wxFILE_SEP_PATH ) @@ -1326,7 +1377,7 @@ bool wxFileName::Rmdir(const wxString& dir, int flags) cont = d.GetNext(&filename); } -#ifndef __WXMSW__ +#ifndef __WINDOWS__ if ( flags & wxPATH_RMDIR_RECURSIVE ) { // delete all files too @@ -1337,7 +1388,7 @@ bool wxFileName::Rmdir(const wxString& dir, int flags) cont = d.GetNext(&filename); } } -#endif // !__WXMSW__ +#endif // !__WINDOWS__ } return ::wxRmdir(dir); @@ -1743,8 +1794,16 @@ bool wxFileName::SameAs(const wxFileName& filepath, wxPathFormat format) const if ( fn1.GetFullPath() == fn2.GetFullPath() ) return true; - // TODO: compare inodes for Unix, this works even when filenames are - // different but files are the same (symlinks) (VZ) +#if defined(__UNIX__) + wxStructStat st1, st2; + if ( wxStat(fn1.GetFullPath(), &st1) == 0 && + wxStat(fn2.GetFullPath(), &st2) == 0 ) + { + if ( st1.st_ino == st2.st_ino && st1.st_dev == st2.st_dev ) + return true; + } + //else: It's not an error if one or both files don't exist. +#endif // defined __UNIX__ return false; } @@ -2063,7 +2122,7 @@ wxString wxFileName::GetShortPath() const { wxString path(GetFullPath()); -#if defined(__WXMSW__) && defined(__WIN32__) && !defined(__WXMICROWIN__) && !defined(__WXWINCE__) +#if defined(__WINDOWS__) && defined(__WIN32__) && !defined(__WXMICROWIN__) && !defined(__WXWINCE__) DWORD sz = ::GetShortPathName(path.t_str(), NULL, 0); if ( sz != 0 ) { @@ -2213,7 +2272,7 @@ wxPathFormat wxFileName::GetFormat( wxPathFormat format ) { if (format == wxPATH_NATIVE) { -#if defined(__WXMSW__) || defined(__OS2__) || defined(__DOS__) +#if defined(__WINDOWS__) || defined(__OS2__) || defined(__DOS__) format = wxPATH_DOS; #elif defined(__VMS) format = wxPATH_VMS; @@ -2607,12 +2666,14 @@ bool wxFileName::GetTimes(wxDateTime *dtAccess, wxStructStat stBuf; if ( wxStat( GetFullPath(), &stBuf) == 0 ) { + // Android defines st_*time fields as unsigned long, but time_t as long, + // hence the static_casts. if ( dtAccess ) - dtAccess->Set(stBuf.st_atime); + dtAccess->Set(static_cast(stBuf.st_atime)); if ( dtMod ) - dtMod->Set(stBuf.st_mtime); + dtMod->Set(static_cast(stBuf.st_mtime)); if ( dtCreate ) - dtCreate->Set(stBuf.st_ctime); + dtCreate->Set(static_cast(stBuf.st_ctime)); return true; } @@ -2643,10 +2704,7 @@ wxULongLong wxFileName::GetSize(const wxString &filename) if (!wxFileExists(filename)) return wxInvalidSize; -#if defined(__WXPALMOS__) - // TODO - return wxInvalidSize; -#elif defined(__WIN32__) +#if defined(__WIN32__) wxFileHandle f(filename, wxFileHandle::ReadAttr); if (!f.IsOk()) return wxInvalidSize; diff --git a/Externals/wxWidgets3/src/common/filepickercmn.cpp b/Externals/wxWidgets3/src/common/filepickercmn.cpp index b57466283b..6044dffa6d 100644 --- a/Externals/wxWidgets3/src/common/filepickercmn.cpp +++ b/Externals/wxWidgets3/src/common/filepickercmn.cpp @@ -4,7 +4,7 @@ // Author: Francesco Montorsi (readapted code written by Vadim Zeitlin) // Modified by: // Created: 15/04/2006 -// RCS-ID: $Id: filepickercmn.cpp 61508 2009-07-23 20:30:22Z VZ $ +// RCS-ID: $Id: filepickercmn.cpp 68920 2011-08-27 14:11:20Z VZ $ // Copyright: (c) Vadim Zeitlin, Francesco Montorsi // Licence: wxWindows licence /////////////////////////////////////////////////////////////////////////////// @@ -183,6 +183,30 @@ void wxFileDirPickerCtrlBase::OnFileDirChange(wxFileDirPickerEvent &ev) IMPLEMENT_DYNAMIC_CLASS(wxFilePickerCtrl, wxPickerBase) +bool wxFilePickerCtrl::Create(wxWindow *parent, + wxWindowID id, + const wxString& path, + const wxString& message, + const wxString& wildcard, + const wxPoint& pos, + const wxSize& size, + long style, + const wxValidator& validator, + const wxString& name) +{ + if ( !wxFileDirPickerCtrlBase::CreateBase + ( + parent, id, path, message, wildcard, + pos, size, style, validator, name + ) ) + return false; + + if ( HasTextCtrl() ) + GetTextCtrl()->AutoCompleteFileNames(); + + return true; +} + bool wxFilePickerCtrl::CheckPath(const wxString& path) const { // if wxFLP_SAVE was given or wxFLP_FILE_MUST_EXIST has NOT been given we @@ -207,6 +231,29 @@ wxString wxFilePickerCtrl::GetTextCtrlValue() const #if wxUSE_DIRPICKERCTRL IMPLEMENT_DYNAMIC_CLASS(wxDirPickerCtrl, wxPickerBase) +bool wxDirPickerCtrl::Create(wxWindow *parent, + wxWindowID id, + const wxString& path, + const wxString& message, + const wxPoint& pos, + const wxSize& size, + long style, + const wxValidator& validator, + const wxString& name) +{ + if ( !wxFileDirPickerCtrlBase::CreateBase + ( + parent, id, path, message, wxString(), + pos, size, style, validator, name + ) ) + return false; + + if ( HasTextCtrl() ) + GetTextCtrl()->AutoCompleteDirectories(); + + return true; +} + bool wxDirPickerCtrl::CheckPath(const wxString& path) const { // if wxDIRP_DIR_MUST_EXIST has NOT been given we must accept any path diff --git a/Externals/wxWidgets3/src/common/filesys.cpp b/Externals/wxWidgets3/src/common/filesys.cpp index 1460be8b87..82e1ada6c4 100644 --- a/Externals/wxWidgets3/src/common/filesys.cpp +++ b/Externals/wxWidgets3/src/common/filesys.cpp @@ -3,7 +3,7 @@ // Purpose: wxFileSystem class - interface for opening files // Author: Vaclav Slavik // Copyright: (c) 1999 Vaclav Slavik -// CVS-ID: $Id: filesys.cpp 66728 2011-01-22 14:38:36Z DS $ +// CVS-ID: $Id: filesys.cpp 70796 2012-03-04 00:29:31Z VZ $ // Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// @@ -255,7 +255,7 @@ wxFSFile* wxLocalFSHandler::OpenFile(wxFileSystem& WXUNUSED(fs), const wxString& #else #error One of wxUSE_FILE or wxUSE_FFILE must be set to 1 for wxFSHandler to work #endif - if ( !is->Ok() ) + if ( !is->IsOk() ) { delete is; return NULL; @@ -635,11 +635,11 @@ wxFileName wxFileSystem::URLToFileName(const wxString& url) path = wxURI::Unescape(path); -#ifdef __WXMSW__ +#ifdef __WINDOWS__ // file urls either start with a forward slash (local harddisk), // otherwise they have a servername/sharename notation, // which only exists on msw and corresponds to a unc - if ( path[0u] == wxT('/') && path [1u] != wxT('/')) + if ( path.length() > 1 && (path[0u] == wxT('/') && path [1u] != wxT('/')) ) { path = path.Mid(1); } diff --git a/Externals/wxWidgets3/src/common/fmapbase.cpp b/Externals/wxWidgets3/src/common/fmapbase.cpp index d75e991a17..56ce5f73a6 100644 --- a/Externals/wxWidgets3/src/common/fmapbase.cpp +++ b/Externals/wxWidgets3/src/common/fmapbase.cpp @@ -4,7 +4,7 @@ // Author: Vadim Zeitlin // Modified by: // Created: 21.06.2003 (extracted from common/fontmap.cpp) -// RCS-ID: $Id: fmapbase.cpp 65062 2010-07-23 23:33:16Z VZ $ +// RCS-ID: $Id: fmapbase.cpp 70796 2012-03-04 00:29:31Z VZ $ // Copyright: (c) 1999-2003 Vadim Zeitlin // Licence: wxWindows licence /////////////////////////////////////////////////////////////////////////////// @@ -34,7 +34,7 @@ #include "wx/wxcrtvararg.h" #endif //WX_PRECOMP -#if defined(__WXMSW__) +#if defined(__WINDOWS__) #include "wx/msw/private.h" // includes windows.h for LOGFONT #include "wx/msw/winundef.h" #endif @@ -97,9 +97,6 @@ static const wxFontEncoding gs_encodings[] = wxFONTENCODING_UTF32LE, wxFONTENCODING_EUC_JP, wxFONTENCODING_DEFAULT, - wxFONTENCODING_BIG5, - wxFONTENCODING_SHIFT_JIS, - wxFONTENCODING_GB2312, wxFONTENCODING_ISO2022_JP, wxFONTENCODING_MACROMAN, @@ -166,10 +163,10 @@ static const char* const gs_encodingDescs[] = wxTRANSLATE( "KOI8-U" ), wxTRANSLATE( "Windows/DOS OEM Cyrillic (CP 866)" ), wxTRANSLATE( "Windows Thai (CP 874)" ), - wxTRANSLATE( "Windows Japanese (CP 932)" ), - wxTRANSLATE( "Windows Chinese Simplified (CP 936)" ), + wxTRANSLATE( "Windows Japanese (CP 932) or Shift-JIS" ), + wxTRANSLATE( "Windows Chinese Simplified (CP 936) or GB-2312" ), wxTRANSLATE( "Windows Korean (CP 949)" ), - wxTRANSLATE( "Windows Chinese Traditional (CP 950)" ), + wxTRANSLATE( "Windows Chinese Traditional (CP 950) or Big-5" ), wxTRANSLATE( "Windows Central European (CP 1250)" ), wxTRANSLATE( "Windows Cyrillic (CP 1251)" ), wxTRANSLATE( "Windows Western European (CP 1252)" ), @@ -194,9 +191,6 @@ static const char* const gs_encodingDescs[] = #endif // WORDS_BIGENDIAN wxTRANSLATE( "Extended Unix Codepage for Japanese (EUC-JP)" ), wxTRANSLATE( "US-ASCII" ), - wxTRANSLATE( "BIG5" ), - wxTRANSLATE( "SHIFT-JIS" ), - wxTRANSLATE( "GB-2312" ), wxTRANSLATE( "ISO-2022-JP" ), wxTRANSLATE( "MacRoman" ), @@ -242,7 +236,7 @@ static const char* const gs_encodingDescs[] = }; // and the internal names (these are not translated on purpose!) -static const wxChar* const gs_encodingNames[WXSIZEOF(gs_encodingDescs)][9] = +static const wxChar* const gs_encodingNames[][9] = { // names from the columns correspond to these OS: // Linux Solaris and IRIX HP-UX AIX @@ -271,10 +265,10 @@ static const wxChar* const gs_encodingNames[WXSIZEOF(gs_encodingDescs)][9] = { wxT( "WINDOWS-866" ), wxT( "CP866" ), NULL }, { wxT( "WINDOWS-874" ), wxT( "CP874" ), wxT( "MS874" ), wxT( "IBM-874" ), NULL }, - { wxT( "WINDOWS-932" ), wxT( "CP932" ), wxT( "MS932" ), wxT( "IBM-932" ), NULL }, - { wxT( "WINDOWS-936" ), wxT( "CP936" ), wxT( "MS936" ), wxT( "IBM-936" ), NULL }, + { wxT( "WINDOWS-932" ), wxT( "CP932" ), wxT( "MS932" ), wxT( "IBM-932" ), wxT( "SJIS" ), wxT( "SHIFT-JIS" ), wxT( "SHIFT_JIS" ), NULL }, + { wxT( "WINDOWS-936" ), wxT( "CP936" ), wxT( "MS936" ), wxT( "IBM-936" ), wxT( "GB2312" ), NULL }, { wxT( "WINDOWS-949" ), wxT( "CP949" ), wxT( "MS949" ), wxT( "IBM-949" ), wxT( "EUC-KR" ), wxT( "eucKR" ), wxT( "euc_kr" ), NULL }, - { wxT( "WINDOWS-950" ), wxT( "CP950" ), wxT( "MS950" ), wxT( "IBM-950" ), NULL }, + { wxT( "WINDOWS-950" ), wxT( "CP950" ), wxT( "MS950" ), wxT( "IBM-950" ), wxT( "BIG5" ), wxT( "BIG-5" ), wxT( "BIG-FIVE" ), NULL }, { wxT( "WINDOWS-1250" ),wxT( "CP1250" ),wxT( "MS1250" ),wxT( "IBM-1250" ),NULL }, { wxT( "WINDOWS-1251" ),wxT( "CP1251" ),wxT( "MS1251" ),wxT( "IBM-1251" ),NULL }, { wxT( "WINDOWS-1252" ),wxT( "CP1252" ),wxT( "MS1252" ),wxT( "IBM-1252" ),NULL }, @@ -305,9 +299,6 @@ static const wxChar* const gs_encodingNames[WXSIZEOF(gs_encodingDescs)][9] = { wxT( "US-ASCII" ), wxT( "ASCII" ), wxT("C"), wxT("POSIX"), wxT("ANSI_X3.4-1968"), wxT("646"), wxT("roman8"), wxT( "" ), NULL }, - { wxT( "BIG5" ), wxT("big5"), NULL }, - { wxT( "SJIS" ), wxT( "SHIFT-JIS" ), wxT( "SHIFT_JIS" ), NULL }, - { wxT( "GB2312" ), NULL }, { wxT( "ISO-2022-JP" ), NULL }, diff --git a/Externals/wxWidgets3/src/common/fontcmn.cpp b/Externals/wxWidgets3/src/common/fontcmn.cpp index df3b3e8db0..0d27ca12f0 100644 --- a/Externals/wxWidgets3/src/common/fontcmn.cpp +++ b/Externals/wxWidgets3/src/common/fontcmn.cpp @@ -4,7 +4,7 @@ // Author: Vadim Zeitlin // Modified by: // Created: 20.09.99 -// RCS-ID: $Id: fontcmn.cpp 67280 2011-03-22 14:17:38Z DS $ +// RCS-ID: $Id: fontcmn.cpp 70564 2012-02-10 23:34:45Z VZ $ // Copyright: (c) wxWidgets team // Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// @@ -29,6 +29,7 @@ #ifndef WX_PRECOMP #include "wx/dc.h" #include "wx/intl.h" + #include "wx/math.h" #include "wx/dcscreen.h" #include "wx/log.h" #include "wx/gdicmn.h" @@ -112,6 +113,8 @@ wxPROPERTY( Weight, wxFontWeight, SetWeight, GetWeight, (wxFontWeight)wxNORMAL, wxT("Helpstring"), wxT("group")) // wxFontWeight wxPROPERTY( Underlined, bool, SetUnderlined, GetUnderlined, false, 0 /*flags*/, \ wxT("Helpstring"), wxT("group")) +wxPROPERTY( Strikethrough, bool, SetStrikethrough, GetStrikethrough, false, 0, \ + wxT("Helpstring"), wxT("group")) wxPROPERTY( Face, wxString, SetFaceName, GetFaceName, wxEMPTY_PARAMETER_VALUE, \ 0 /*flags*/, wxT("Helpstring"), wxT("group")) wxPROPERTY( Encoding, wxFontEncoding, SetEncoding, GetEncoding, \ @@ -127,33 +130,6 @@ wxEMPTY_HANDLERS_TABLE(wxFont) // implementation // ============================================================================ -// ---------------------------------------------------------------------------- -// helper functions -// ---------------------------------------------------------------------------- - -static inline int flags2Style(int flags) -{ - return flags & wxFONTFLAG_ITALIC - ? wxFONTSTYLE_ITALIC - : flags & wxFONTFLAG_SLANT - ? wxFONTSTYLE_SLANT - : wxFONTSTYLE_NORMAL; -} - -static inline int flags2Weight(int flags) -{ - return flags & wxFONTFLAG_LIGHT - ? wxFONTWEIGHT_LIGHT - : flags & wxFONTFLAG_BOLD - ? wxFONTWEIGHT_BOLD - : wxFONTWEIGHT_NORMAL; -} - -static inline bool flags2Underlined(int flags) -{ - return (flags & wxFONTFLAG_UNDERLINED) != 0; -} - // ---------------------------------------------------------------------------- // wxFontBase // ---------------------------------------------------------------------------- @@ -208,8 +184,11 @@ wxFont *wxFontBase::New(int pointSize, const wxString& face, wxFontEncoding encoding) { - return New(pointSize, family, flags2Style(flags), flags2Weight(flags), - flags2Underlined(flags), face, encoding); + return New(pointSize, family, + GetStyleFromFlags(flags), + GetWeightFromFlags(flags), + GetUnderlinedFromFlags(flags), + face, encoding); } /* static */ @@ -219,8 +198,11 @@ wxFont *wxFontBase::New(const wxSize& pixelSize, const wxString& face, wxFontEncoding encoding) { - return New(pixelSize, family, flags2Style(flags), flags2Weight(flags), - flags2Underlined(flags), face, encoding); + return New(pixelSize, family, + GetStyleFromFlags(flags), + GetWeightFromFlags(flags), + GetUnderlinedFromFlags(flags), + face, encoding); } /* static */ @@ -327,6 +309,7 @@ void wxFontBase::DoSetNativeFontInfo(const wxNativeFontInfo& info) SetStyle(info.style); SetWeight(info.weight); SetUnderlined(info.underlined); + SetStrikethrough(info.strikethrough); SetFaceName(info.faceName); SetEncoding(info.encoding); #else @@ -414,6 +397,7 @@ bool wxFontBase::operator==(const wxFont& font) const GetStyle() == font.GetStyle() && GetWeight() == font.GetWeight() && GetUnderlined() == font.GetUnderlined() && + GetStrikethrough() == font.GetStrikethrough() && GetFaceName().IsSameAs(font.GetFaceName(), false) && GetEncoding() == font.GetEncoding() ); @@ -511,7 +495,7 @@ int wxFontBase::AdjustToSymbolicSize(wxFontSymbolicSize size, int base) WrongFontSizeFactorsSize ); - return factors[size - wxFONTSIZE_XX_SMALL]*base; + return wxRound(factors[size - wxFONTSIZE_XX_SMALL]*base); } wxFont& wxFont::MakeBold() @@ -553,6 +537,19 @@ wxFont wxFont::Underlined() const return font; } +wxFont wxFont::Strikethrough() const +{ + wxFont font(*this); + font.MakeStrikethrough(); + return font; +} + +wxFont& wxFont::MakeStrikethrough() +{ + SetStrikethrough(true); + return *this; +} + wxFont& wxFont::Scale(float x) { SetPointSize(int(x*GetPointSize() + 0.5)); @@ -597,19 +594,22 @@ void wxNativeFontInfo::SetFaceName(const wxArrayString& facenames) // These are the generic forms of FromString()/ToString. // -// convert to/from the string representation: format is -// version;pointsize;family;style;weight;underlined;facename;encoding +// convert to/from the string representation: the general format is +// "version;the rest..." with currently defined versions being: +// +// 0;pointsize;family;style;weight;underlined;facename;encoding +// 1;pointsize;family;style;weight;underlined;strikethrough;facename;encoding bool wxNativeFontInfo::FromString(const wxString& s) { long l; + unsigned long version; wxStringTokenizer tokenizer(s, wxT(";")); wxString token = tokenizer.GetNextToken(); - // - // Ignore the version for now - // + if ( !token.ToULong(&version) || version > 1 ) + return false; token = tokenizer.GetNextToken(); if ( !token.ToLong(&l) ) @@ -636,6 +636,14 @@ bool wxNativeFontInfo::FromString(const wxString& s) return false; underlined = l != 0; + if ( version == 1 ) + { + token = tokenizer.GetNextToken(); + if ( !token.ToLong(&l) ) + return false; + strikethrough = l != 0; + } + faceName = tokenizer.GetNextToken(); #ifndef __WXMAC__ @@ -655,13 +663,14 @@ wxString wxNativeFontInfo::ToString() const { wxString s; - s.Printf(wxT("%d;%d;%d;%d;%d;%d;%s;%d"), - 0, // version + s.Printf(wxT("%d;%d;%d;%d;%d;%d;%d;%s;%d"), + 1, // version pointSize, family, (int)style, (int)weight, underlined, + strikethrough, faceName.GetData(), (int)encoding); @@ -675,6 +684,7 @@ void wxNativeFontInfo::Init() style = wxFONTSTYLE_NORMAL; weight = wxFONTWEIGHT_NORMAL; underlined = false; + strikethrough = false; faceName.clear(); encoding = wxFONTENCODING_DEFAULT; } @@ -699,6 +709,11 @@ bool wxNativeFontInfo::GetUnderlined() const return underlined; } +bool wxNativeFontInfo::GetStrikethrough() const +{ + return strikethrough; +} + wxString wxNativeFontInfo::GetFaceName() const { return faceName; @@ -734,6 +749,11 @@ void wxNativeFontInfo::SetUnderlined(bool underlined_) underlined = underlined_; } +void wxNativeFontInfo::SetStrikethrough(bool strikethrough_) +{ + strikethrough = strikethrough_; +} + bool wxNativeFontInfo::SetFaceName(const wxString& facename_) { faceName = facename_; @@ -770,6 +790,11 @@ wxString wxNativeFontInfo::ToUserString() const desc << _("underlined"); } + if ( GetStrikethrough() ) + { + desc << _("strikethrough"); + } + switch ( GetWeight() ) { default: @@ -942,6 +967,10 @@ bool wxNativeFontInfo::FromUserString(const wxString& s) { SetUnderlined(true); } + else if ( token == wxT("strikethrough") || token == _("strikethrough") ) + { + SetStrikethrough(true); + } else if ( token == wxT("light") || token == _("light") ) { SetWeight(wxFONTWEIGHT_LIGHT); diff --git a/Externals/wxWidgets3/src/common/fontmgrcmn.cpp b/Externals/wxWidgets3/src/common/fontmgrcmn.cpp index 1e89dde607..527352373c 100644 --- a/Externals/wxWidgets3/src/common/fontmgrcmn.cpp +++ b/Externals/wxWidgets3/src/common/fontmgrcmn.cpp @@ -3,7 +3,7 @@ // Purpose: font management for ports that don't have their own // Author: Vaclav Slavik // Created: 2006-11-18 -// RCS-ID: $Id: fontmgrcmn.cpp 62349 2009-10-09 13:04:59Z VZ $ +// RCS-ID: $Id: fontmgrcmn.cpp 70353 2012-01-15 14:46:41Z VZ $ // Copyright: (c) 2001-2002 SciTech Software, Inc. (www.scitechsoft.com) // (c) 2006 REA Elektronik GmbH // Licence: wxWindows licence @@ -123,8 +123,8 @@ wxFontBundleBase::GetFaceForFont(const wxFontMgrFontRefData& font) const type |= FaceType_Bold; // FIXME -- this should read "if ( font->GetStyle() == wxITALIC )", - // but since MGL neither DFB supports slant, we try to display it with - // italic face (better than nothing...) + // but since DFB doesn't support slant, we try to display it with italic + // face (better than nothing...) if ( font.GetStyle() == wxITALIC || font.GetStyle() == wxSLANT ) { if ( HasFace((FaceType)(type | FaceType_Italic)) ) diff --git a/Externals/wxWidgets3/src/common/fontpickercmn.cpp b/Externals/wxWidgets3/src/common/fontpickercmn.cpp index 673a6e6417..5d2c33c8a9 100644 --- a/Externals/wxWidgets3/src/common/fontpickercmn.cpp +++ b/Externals/wxWidgets3/src/common/fontpickercmn.cpp @@ -4,7 +4,7 @@ // Author: Francesco Montorsi // Modified by: // Created: 15/04/2006 -// RCS-ID: $Id: fontpickercmn.cpp 58718 2009-02-07 18:59:25Z VZ $ +// RCS-ID: $Id: fontpickercmn.cpp 67681 2011-05-03 16:29:04Z DS $ // Copyright: (c) Francesco Montorsi // Licence: wxWindows licence /////////////////////////////////////////////////////////////////////////////// @@ -137,7 +137,7 @@ void wxFontPickerCtrl::UpdatePickerFromTextCtrl() // string returned by wxFont::GetNativeFontInfoDesc() and not // the user-friendly one returned by wxFont::GetNativeFontInfoUserDesc() wxFont f = String2Font(m_text->GetValue()); - if (!f.Ok()) + if (!f.IsOk()) return; // invalid user input if (M_PICKER->GetSelectedFont() != f) diff --git a/Externals/wxWidgets3/src/common/framecmn.cpp b/Externals/wxWidgets3/src/common/framecmn.cpp index db2120b7fd..aab30e9c81 100644 --- a/Externals/wxWidgets3/src/common/framecmn.cpp +++ b/Externals/wxWidgets3/src/common/framecmn.cpp @@ -3,7 +3,7 @@ // Purpose: common (for all platforms) wxFrame functions // Author: Julian Smart, Vadim Zeitlin // Created: 01/02/97 -// Id: $Id: framecmn.cpp 66592 2011-01-05 18:27:58Z PC $ +// Id: $Id: framecmn.cpp 69101 2011-09-16 13:23:14Z VZ $ // Copyright: (c) 1998 Robert Roebling and Julian Smart // Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// @@ -271,6 +271,10 @@ bool wxFrameBase::ProcessCommand(wxMenuItem *item) // use the new value commandEvent.SetInt(item->IsChecked()); } + else // Uncheckable item. + { + commandEvent.SetInt(-1); + } return HandleWindowEvent(commandEvent); } diff --git a/Externals/wxWidgets3/src/common/fs_mem.cpp b/Externals/wxWidgets3/src/common/fs_mem.cpp index e826765b79..b2d18134e3 100644 --- a/Externals/wxWidgets3/src/common/fs_mem.cpp +++ b/Externals/wxWidgets3/src/common/fs_mem.cpp @@ -2,7 +2,7 @@ // Name: src/common/fs_mem.cpp // Purpose: in-memory file system // Author: Vaclav Slavik -// RCS-ID: $Id: fs_mem.cpp 60774 2009-05-28 09:59:32Z SC $ +// RCS-ID: $Id: fs_mem.cpp 70392 2012-01-18 19:42:58Z VZ $ // Copyright: (c) 2000 Vaclav Slavik // Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// @@ -186,13 +186,9 @@ void wxMemoryFSHandlerBase::AddFileWithMimeType(const wxString& filename, const wxString& textdata, const wxString& mimetype) { - AddFileWithMimeType - ( - filename, - static_cast(textdata.To8BitData()), - wxStrlen(static_cast(textdata.To8BitData())), - mimetype - ); + const wxCharBuffer buf(textdata.To8BitData()); + + AddFileWithMimeType(filename, buf.data(), buf.length(), mimetype); } @@ -253,7 +249,7 @@ wxMemoryFSHandler::AddFile(const wxString& filename, return; wxMemoryOutputStream mems; - if ( image.Ok() && image.SaveFile(mems, type) ) + if ( image.IsOk() && image.SaveFile(mems, type) ) { m_Hash[filename] = new wxMemoryFSFile ( diff --git a/Externals/wxWidgets3/src/common/fswatchercmn.cpp b/Externals/wxWidgets3/src/common/fswatchercmn.cpp index 0a239790b0..eadf694d4d 100644 --- a/Externals/wxWidgets3/src/common/fswatchercmn.cpp +++ b/Externals/wxWidgets3/src/common/fswatchercmn.cpp @@ -3,7 +3,7 @@ // Purpose: wxMswFileSystemWatcher // Author: Bartosz Bekier // Created: 2009-05-26 -// RCS-ID: $Id: fswatchercmn.cpp 67254 2011-03-20 00:14:35Z DS $ +// RCS-ID: $Id: fswatchercmn.cpp 67693 2011-05-03 23:31:39Z VZ $ // Copyright: (c) 2009 Bartosz Bekier // Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// @@ -79,10 +79,30 @@ wxFileSystemWatcherBase::~wxFileSystemWatcherBase() bool wxFileSystemWatcherBase::Add(const wxFileName& path, int events) { - // args validation & consistency checks - if (!path.FileExists() && !path.DirExists()) + wxFSWPathType type = wxFSWPath_None; + if ( path.FileExists() ) + { + type = wxFSWPath_File; + } + else if ( path.DirExists() ) + { + type = wxFSWPath_Dir; + } + else + { + wxLogError(_("Can't monitor non-existent path \"%s\" for changes."), + path.GetFullPath()); return false; + } + return DoAdd(path, events, type); +} + +bool +wxFileSystemWatcherBase::DoAdd(const wxFileName& path, + int events, + wxFSWPathType type) +{ wxString canonical = GetCanonicalPath(path); if (canonical.IsEmpty()) return false; @@ -91,7 +111,7 @@ bool wxFileSystemWatcherBase::Add(const wxFileName& path, int events) wxString::Format("Path '%s' is already watched", canonical)); // adding a path in a platform specific way - wxFSWatchInfo watch(canonical, events); + wxFSWatchInfo watch(canonical, events, type); if ( !m_service->Add(watch) ) return false; diff --git a/Externals/wxWidgets3/src/common/ftp.cpp b/Externals/wxWidgets3/src/common/ftp.cpp index 8bd4cb21eb..db7537a94a 100644 --- a/Externals/wxWidgets3/src/common/ftp.cpp +++ b/Externals/wxWidgets3/src/common/ftp.cpp @@ -9,7 +9,7 @@ // robust Abort(), support for arbitrary FTP commands, ...) // Randall Fox (support for active mode) // Created: 07/07/1997 -// RCS-ID: $Id: ftp.cpp 67280 2011-03-22 14:17:38Z DS $ +// RCS-ID: $Id: ftp.cpp 67681 2011-05-03 16:29:04Z DS $ // Copyright: (c) 1997, 1998 Guilhem Lavaux // (c) 1998-2004 wxWidgets team // Licence: wxWindows licence @@ -587,9 +587,9 @@ wxSocketBase *wxFTP::GetActivePort() addrNew.Service(0); // pick an open port number. wxSocketServer *sockSrv = new wxSocketServer(addrNew); - if (!sockSrv->Ok()) + if (!sockSrv->IsOk()) { - // We use Ok() here to see if everything is ok + // We use IsOk() here to see if everything is ok m_lastError = wxPROTO_PROTERR; delete sockSrv; return NULL; diff --git a/Externals/wxWidgets3/src/common/gdicmn.cpp b/Externals/wxWidgets3/src/common/gdicmn.cpp index cc022e57c4..2854a7e6ee 100644 --- a/Externals/wxWidgets3/src/common/gdicmn.cpp +++ b/Externals/wxWidgets3/src/common/gdicmn.cpp @@ -4,7 +4,7 @@ // Author: Julian Smart // Modified by: // Created: 01/02/97 -// RCS-ID: $Id: gdicmn.cpp 65680 2010-09-30 11:44:45Z VZ $ +// RCS-ID: $Id: gdicmn.cpp 67681 2011-05-03 16:29:04Z DS $ // Copyright: (c) Julian Smart // Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// @@ -499,7 +499,7 @@ wxColour *wxColourDatabase::FindColour(const wxString& name) static wxColour s_col; s_col = Find(name); - if ( !s_col.Ok() ) + if ( !s_col.IsOk() ) return NULL; return new wxColour(s_col); @@ -655,7 +655,19 @@ const wxFont* wxStockGDI::GetFont(Item item) font = new wxFont(wxSystemSettings::GetFont(wxSYS_DEFAULT_GUI_FONT)); break; case FONT_SMALL: - font = new wxFont(GetFont(FONT_NORMAL)->GetPointSize() - 2, wxSWISS, wxNORMAL, wxNORMAL); + font = new wxFont(GetFont(FONT_NORMAL)->GetPointSize() + // Using the font 2 points smaller than the normal one + // results in font so small as to be unreadable under MSW. + // We might want to actually use -1 under the other + // platforms too but for now be conservative and keep -2 + // there for compatibility with the old behaviour as the + // small font seems to be readable enough there as it is. +#ifdef __WXMSW__ + - 1, +#else + - 2, +#endif + wxSWISS, wxNORMAL, wxNORMAL); break; case FONT_SWISS: font = new wxFont(GetFont(FONT_NORMAL)->GetPointSize(), wxSWISS, wxNORMAL, wxNORMAL); @@ -768,7 +780,7 @@ wxPen *wxPenList::FindOrCreatePen (const wxColour& colour, int width, wxPenStyle wxPen* pen = NULL; wxPen penTmp(colour, width, style); - if (penTmp.Ok()) + if (penTmp.IsOk()) { pen = new wxPen(penTmp); list.Append(pen); @@ -790,7 +802,7 @@ wxBrush *wxBrushList::FindOrCreateBrush (const wxColour& colour, wxBrushStyle st wxBrush* brush = NULL; wxBrush brushTmp(colour, style); - if (brushTmp.Ok()) + if (brushTmp.IsOk()) { brush = new wxBrush(brushTmp); list.Append(brush); @@ -860,7 +872,7 @@ wxFont *wxFontList::FindOrCreateFont(int pointSize, // font not found, create the new one font = NULL; wxFont fontTmp(pointSize, family, style, weight, underline, facename, encoding); - if (fontTmp.Ok()) + if (fontTmp.IsOk()) { font = new wxFont(fontTmp); list.Append(font); diff --git a/Externals/wxWidgets3/src/common/gifdecod.cpp b/Externals/wxWidgets3/src/common/gifdecod.cpp index 343dba3d2b..c0a7b713da 100644 --- a/Externals/wxWidgets3/src/common/gifdecod.cpp +++ b/Externals/wxWidgets3/src/common/gifdecod.cpp @@ -3,7 +3,7 @@ // Purpose: wxGIFDecoder, GIF reader for wxImage and wxAnimation // Author: Guillermo Rodriguez Garcia // Version: 3.04 -// RCS-ID: $Id: gifdecod.cpp 66828 2011-02-02 11:19:30Z DS $ +// RCS-ID: $Id: gifdecod.cpp 67681 2011-05-03 16:29:04Z DS $ // Copyright: (c) Guillermo Rodriguez Garcia // Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// @@ -138,7 +138,7 @@ bool wxGIFDecoder::ConvertToImage(unsigned int frame, wxImage *image) const image->Create(sz.GetWidth(), sz.GetHeight()); image->SetType(wxBITMAP_TYPE_GIF); - if (!image->Ok()) + if (!image->IsOk()) return false; pal = GetPalette(frame); diff --git a/Externals/wxWidgets3/src/common/glcmn.cpp b/Externals/wxWidgets3/src/common/glcmn.cpp index fa0457ad6f..35b022bd74 100644 --- a/Externals/wxWidgets3/src/common/glcmn.cpp +++ b/Externals/wxWidgets3/src/common/glcmn.cpp @@ -3,7 +3,7 @@ // Purpose: wxGLCanvasBase implementation // Author: Vadim Zeitlin // Created: 2007-04-09 -// RCS-ID: $Id: glcmn.cpp 65680 2010-09-30 11:44:45Z VZ $ +// RCS-ID: $Id: glcmn.cpp 67681 2011-05-03 16:29:04Z DS $ // Copyright: (c) 2007 Vadim Zeitlin // Licence: wxWindows licence /////////////////////////////////////////////////////////////////////////////// @@ -66,7 +66,7 @@ bool wxGLCanvasBase::SetCurrent(const wxGLContext& context) const bool wxGLCanvasBase::SetColour(const wxString& colour) { wxColour col = wxTheColourDatabase->Find(colour); - if ( !col.Ok() ) + if ( !col.IsOk() ) return false; #ifdef wxHAS_OPENGL_ES diff --git a/Externals/wxWidgets3/src/common/graphcmn.cpp b/Externals/wxWidgets3/src/common/graphcmn.cpp index 1cb561e3c3..c4331e464c 100644 --- a/Externals/wxWidgets3/src/common/graphcmn.cpp +++ b/Externals/wxWidgets3/src/common/graphcmn.cpp @@ -4,7 +4,7 @@ // Author: Stefan Csomor // Modified by: // Created: -// RCS-ID: $Id: graphcmn.cpp 66514 2011-01-01 11:10:35Z SC $ +// RCS-ID: $Id: graphcmn.cpp 69360 2011-10-09 22:07:29Z VZ $ // Copyright: (c) Stefan Csomor // Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// @@ -534,7 +534,8 @@ IMPLEMENT_ABSTRACT_CLASS(wxGraphicsContext, wxObject) wxGraphicsContext::wxGraphicsContext(wxGraphicsRenderer* renderer) : wxGraphicsObject(renderer), m_antialias(wxANTIALIAS_DEFAULT), - m_composition(wxCOMPOSITION_OVER) + m_composition(wxCOMPOSITION_OVER), + m_enableOffset(false) { } @@ -564,6 +565,11 @@ void wxGraphicsContext::Flush() { } +void wxGraphicsContext::EnableOffset(bool enable) +{ + m_enableOffset = enable; +} + #if 0 void wxGraphicsContext::SetAlpha( wxDouble WXUNUSED(alpha) ) { @@ -575,12 +581,6 @@ wxDouble wxGraphicsContext::GetAlpha() const } #endif -void wxGraphicsContext::GetSize( wxDouble* width, wxDouble* height) -{ - *width = 10000.0; - *height = 10000.0; -} - void wxGraphicsContext::GetDPI( wxDouble* dpiX, wxDouble* dpiY) { *dpiX = 72.0; @@ -595,7 +595,7 @@ void wxGraphicsContext::SetPen( const wxGraphicsPen& pen ) void wxGraphicsContext::SetPen( const wxPen& pen ) { - if ( !pen.Ok() || pen.GetStyle() == wxPENSTYLE_TRANSPARENT ) + if ( !pen.IsOk() || pen.GetStyle() == wxPENSTYLE_TRANSPARENT ) SetPen( wxNullGraphicsPen ); else SetPen( CreatePen( pen ) ); @@ -609,7 +609,7 @@ void wxGraphicsContext::SetBrush( const wxGraphicsBrush& brush ) void wxGraphicsContext::SetBrush( const wxBrush& brush ) { - if ( !brush.Ok() || brush.GetStyle() == wxBRUSHSTYLE_TRANSPARENT ) + if ( !brush.IsOk() || brush.GetStyle() == wxBRUSHSTYLE_TRANSPARENT ) SetBrush( wxNullGraphicsBrush ); else SetBrush( CreateBrush( brush ) ); @@ -623,7 +623,7 @@ void wxGraphicsContext::SetFont( const wxGraphicsFont& font ) void wxGraphicsContext::SetFont( const wxFont& font, const wxColour& colour ) { - if ( font.Ok() ) + if ( font.IsOk() ) SetFont( CreateFont( font, colour ) ); else SetFont( wxNullGraphicsFont ); @@ -665,9 +665,7 @@ wxGraphicsContext::DoDrawFilledText(const wxString &str, // to make sure our 'OffsetToPixelBoundaries' doesn't move the fill shape SetPen( wxNullGraphicsPen ); - wxGraphicsPath path = CreatePath(); - path.AddRectangle( x , y, width, height ); - FillPath( path ); + DrawRectangle(x , y, width, height); DrawText( str, x ,y); SetBrush( formerBrush ); @@ -839,17 +837,32 @@ wxGraphicsContext::CreateRadialGradientBrush( ); } -// sets the font wxGraphicsFont wxGraphicsContext::CreateFont( const wxFont &font , const wxColour &col ) const { return GetRenderer()->CreateFont(font,col); } +wxGraphicsFont +wxGraphicsContext::CreateFont(double size, + const wxString& facename, + int flags, + const wxColour& col) const +{ + return GetRenderer()->CreateFont(size, facename, flags, col); +} + wxGraphicsBitmap wxGraphicsContext::CreateBitmap( const wxBitmap& bmp ) const { return GetRenderer()->CreateBitmap(bmp); } +#if wxUSE_IMAGE +wxGraphicsBitmap wxGraphicsContext::CreateBitmapFromImage(const wxImage& image) const +{ + return GetRenderer()->CreateBitmapFromImage(image); +} +#endif // wxUSE_IMAGE + wxGraphicsBitmap wxGraphicsContext::CreateSubBitmap( const wxGraphicsBitmap &bmp, wxDouble x, wxDouble y, wxDouble w, wxDouble h ) const { return GetRenderer()->CreateSubBitmap(bmp,x,y,w,h); @@ -896,6 +909,13 @@ wxGraphicsContext* wxGraphicsContext::Create( wxWindow* window ) return wxGraphicsRenderer::GetDefaultRenderer()->CreateContext(window); } +#if wxUSE_IMAGE +/* static */ wxGraphicsContext* wxGraphicsContext::Create(wxImage& image) +{ + return wxGraphicsRenderer::GetDefaultRenderer()->CreateContextFromImage(image); +} +#endif // wxUSE_IMAGE + wxGraphicsContext* wxGraphicsContext::Create() { return wxGraphicsRenderer::GetDefaultRenderer()->CreateMeasuringContext(); diff --git a/Externals/wxWidgets3/src/common/headerctrlcmn.cpp b/Externals/wxWidgets3/src/common/headerctrlcmn.cpp index 8fd4afa408..74c195eb57 100644 --- a/Externals/wxWidgets3/src/common/headerctrlcmn.cpp +++ b/Externals/wxWidgets3/src/common/headerctrlcmn.cpp @@ -3,7 +3,7 @@ // Purpose: implementation of wxHeaderCtrlBase // Author: Vadim Zeitlin // Created: 2008-12-02 -// RCS-ID: $Id: headerctrlcmn.cpp 66740 2011-01-24 14:35:33Z VS $ +// RCS-ID: $Id: headerctrlcmn.cpp 70338 2012-01-14 16:51:57Z VS $ // Copyright: (c) 2008 Vadim Zeitlin // Licence: wxWindows licence /////////////////////////////////////////////////////////////////////////////// @@ -31,6 +31,7 @@ #include "wx/headerctrl.h" #include "wx/rearrangectrl.h" +#include "wx/renderer.h" namespace { @@ -107,6 +108,21 @@ void wxHeaderCtrlBase::SetColumnCount(unsigned int count) DoSetCount(count); } +int wxHeaderCtrlBase::GetColumnTitleWidth(const wxHeaderColumn& col) +{ + int w = wxWindowBase::GetTextExtent(col.GetTitle()).x; + + // add some margin: + w += wxRendererNative::Get().GetHeaderButtonMargin(this); + + // if a bitmap is used, add space for it and 2px border: + wxBitmap bmp = col.GetBitmap(); + if ( bmp.IsOk() ) + w += bmp.GetWidth() + 2; + + return w; +} + // ---------------------------------------------------------------------------- // wxHeaderCtrlBase event handling // ---------------------------------------------------------------------------- @@ -122,8 +138,7 @@ void wxHeaderCtrlBase::OnSeparatorDClick(wxHeaderCtrlEvent& event) return; } - int w = wxWindowBase::GetTextExtent(column.GetTitle()).x; - w += 4*GetCharWidth(); // add some arbitrary margins around text + int w = GetColumnTitleWidth(column); if ( !UpdateColumnWidthToFit(col, w) ) event.Skip(); @@ -443,7 +458,7 @@ void wxHeaderCtrlSimple::DoShowSortIndicator(unsigned int idx, bool ascending) { RemoveSortIndicator(); - m_cols[idx].SetAsSortKey(ascending); + m_cols[idx].SetSortOrder(ascending); m_sortKey = idx; UpdateColumn(idx); diff --git a/Externals/wxWidgets3/src/common/http.cpp b/Externals/wxWidgets3/src/common/http.cpp index fdb2cf67ea..6a2ef68647 100644 --- a/Externals/wxWidgets3/src/common/http.cpp +++ b/Externals/wxWidgets3/src/common/http.cpp @@ -4,7 +4,7 @@ // Author: Guilhem Lavaux // Modified by: Simo Virokannas (authentication, Dec 2005) // Created: August 1997 -// RCS-ID: $Id: http.cpp 66728 2011-01-22 14:38:36Z DS $ +// RCS-ID: $Id: http.cpp 70485 2012-01-31 13:09:11Z VZ $ // Copyright: (c) 1997, 1998 Guilhem Lavaux // Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// @@ -48,7 +48,6 @@ wxHTTP::wxHTTP() m_addr = NULL; m_read = false; m_proxy_mode = false; - m_post_buf = wxEmptyString; m_http_response = 0; SetNotify(wxSOCKET_LOST_FLAG); @@ -193,7 +192,49 @@ wxString wxHTTP::GenerateAuthString(const wxString& user, const wxString& pass) void wxHTTP::SetPostBuffer(const wxString& post_buf) { - m_post_buf = post_buf; + // Use To8BitData() for backwards compatibility in this deprecated method. + // The new code should use the other overload or SetPostText() and specify + // the encoding to use for the text explicitly. + wxScopedCharBuffer scb = post_buf.To8BitData(); + if ( scb.length() ) + { + m_postBuffer.Clear(); + m_postBuffer.AppendData(scb.data(), scb.length()); + } +} + +bool +wxHTTP::SetPostBuffer(const wxString& contentType, + const wxMemoryBuffer& data) +{ + m_postBuffer = data; + m_contentType = contentType; + + return !m_postBuffer.IsEmpty(); +} + +bool +wxHTTP::SetPostText(const wxString& contentType, + const wxString& data, + const wxMBConv& conv) +{ +#if wxUSE_UNICODE + wxScopedCharBuffer scb = data.mb_str(conv); + const size_t len = scb.length(); + const char* const buf = scb.data(); +#else // !wxUSE_UNICODE + const size_t len = data.length(); + const char* const buf = data.mb_str(conv); +#endif // wxUSE_UNICODE/!wxUSE_UNICODE + + if ( !len ) + return false; + + m_postBuffer.Clear(); + m_postBuffer.AppendData(buf, len); + m_contentType = contentType; + + return true; } void wxHTTP::SendHeaders() @@ -312,8 +353,21 @@ bool wxHTTP::BuildRequest(const wxString& path, wxHTTP_Req req) case wxHTTP_POST: request = wxT("POST"); - if ( GetHeader( wxT("Content-Length") ).empty() ) - SetHeader( wxT("Content-Length"), wxString::Format( wxT("%lu"), (unsigned long)m_post_buf.Len() ) ); + // Content length must be correct, so always set, possibly + // overriding the value set explicitly by a previous call to + // SetHeader("Content-Length"). + if ( !m_postBuffer.IsEmpty() ) + { + wxString len; + len << m_postBuffer.GetDataLen(); + + SetHeader(wxS("Content-Length"), len); + } + + // However if the user had explicitly set the content type, don't + // override it with the content type passed to SetPostText(). + if ( !m_contentType.empty() && GetContentType().empty() ) + SetHeader(wxS("Content-Type"), m_contentType); break; default: @@ -346,18 +400,10 @@ bool wxHTTP::BuildRequest(const wxString& path, wxHTTP_Req req) Write("\r\n", 2); if ( req == wxHTTP_POST ) { - // Post data can be arbitrary binary data when the "binary" content - // transfer encoding is used so don't assume it's ASCII only or - // NUL-terminated. - { - const wxScopedCharBuffer buf(m_post_buf.To8BitData()); - Write(buf, buf.length()); - } // delete the buffer before modifying the string it points to, it - // wouldn't really be a problem here even if we didn't do this - // because we won't use this buffer again but this will avoid any - // nasty surprises in the future if this code changes + if ( !m_postBuffer.IsEmpty() ) + Write(m_postBuffer.GetData(), m_postBuffer.GetDataLen()); - m_post_buf = wxEmptyString; + m_postBuffer.Clear(); } wxString tmp_str; @@ -483,7 +529,7 @@ wxInputStream *wxHTTP::GetInputStream(const wxString& path) return NULL; #endif - if (!BuildRequest(path, m_post_buf.empty() ? wxHTTP_GET : wxHTTP_POST)) + if (!BuildRequest(path, m_postBuffer.IsEmpty() ? wxHTTP_GET : wxHTTP_POST)) return NULL; inp_stream = new wxHTTPStream(this); diff --git a/Externals/wxWidgets3/src/common/iconbndl.cpp b/Externals/wxWidgets3/src/common/iconbndl.cpp index f3bf18a7af..d79aaf5479 100644 --- a/Externals/wxWidgets3/src/common/iconbndl.cpp +++ b/Externals/wxWidgets3/src/common/iconbndl.cpp @@ -3,7 +3,7 @@ // Purpose: wxIconBundle // Author: Mattia Barbon, Vadim Zeitlin // Created: 23.03.2002 -// RCS-ID: $Id: iconbndl.cpp 66374 2010-12-14 18:43:49Z VZ $ +// RCS-ID: $Id: iconbndl.cpp 70455 2012-01-24 22:17:47Z VZ $ // Copyright: (c) Mattia barbon // Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// @@ -163,7 +163,7 @@ void wxIconBundle::AddIcon(const wxString& file, wxBitmapType type) if ( type == wxBITMAP_TYPE_ICON_RESOURCE ) { wxIcon tmp(file, type); - if (tmp.Ok()) + if (tmp.IsOk()) { AddIcon(tmp); return; @@ -193,49 +193,91 @@ void wxIconBundle::AddIcon(wxInputStream& stream, wxBitmapType type) #endif // wxUSE_STREAMS && wxUSE_IMAGE -wxIcon wxIconBundle::GetIcon(const wxSize& size) const +wxIcon wxIconBundle::GetIcon(const wxSize& size, int flags) const { + wxASSERT( size == wxDefaultSize || (size.x >= 0 && size.y > 0) ); + + // We need the standard system icon size when using FALLBACK_SYSTEM. + wxCoord sysX = 0, + sysY = 0; + if ( flags & FALLBACK_SYSTEM ) + { + sysX = wxSystemSettings::GetMetric(wxSYS_ICON_X); + sysY = wxSystemSettings::GetMetric(wxSYS_ICON_Y); + } + + // If size == wxDefaultSize, we use system default icon size by convention. + wxCoord sizeX = size.x; + wxCoord sizeY = size.y; + if ( size == wxDefaultSize ) + { + wxASSERT_MSG( flags == FALLBACK_SYSTEM, + wxS("Must have valid size if not using FALLBACK_SYSTEM") ); + + sizeX = sysX; + sizeY = sysY; + } + + // Iterate over all icons searching for the exact match or the closest icon + // for FALLBACK_NEAREST_LARGER. + wxIcon iconBest; + int bestDiff = 0; + bool bestIsLarger = false; + bool bestIsSystem = false; + const size_t count = GetIconCount(); - // optimize for the common case of icon bundles containing one icon only - wxIcon iconBest; - switch ( count ) + const wxIconArray& iconArray = M_ICONBUNDLEDATA->m_icons; + for ( size_t i = 0; i < count; i++ ) { - case 0: - // nothing to do, iconBest is already invalid + const wxIcon& icon = iconArray[i]; + if ( !icon.IsOk() ) + continue; + wxCoord sx = icon.GetWidth(), + sy = icon.GetHeight(); + + // Exact match ends search immediately in any case. + if ( sx == sizeX && sy == sizeY ) + { + iconBest = icon; break; + } - case 1: - iconBest = M_ICONBUNDLEDATA->m_icons[0]; - break; - - default: - // there is more than one icon, find the best match: - wxCoord sysX = wxSystemSettings::GetMetric( wxSYS_ICON_X ), - sysY = wxSystemSettings::GetMetric( wxSYS_ICON_Y ); - - const wxIconArray& iconArray = M_ICONBUNDLEDATA->m_icons; - for ( size_t i = 0; i < count; i++ ) + if ( flags & FALLBACK_SYSTEM ) + { + if ( sx == sysX && sy == sysY ) { - const wxIcon& icon = iconArray[i]; - wxCoord sx = icon.GetWidth(), - sy = icon.GetHeight(); - - // if we got an icon of exactly the requested size, we're done - if ( sx == size.x && sy == size.y ) - { - iconBest = icon; - break; - } - - // the best icon is by default (arbitrarily) the first one but - // if we find a system-sized icon, take it instead - if ((sx == sysX && sy == sysY) || !iconBest.IsOk()) - iconBest = icon; + iconBest = icon; + bestIsSystem = true; + continue; } + } + + if ( !bestIsSystem && (flags & FALLBACK_NEAREST_LARGER) ) + { + bool iconLarger = (sx >= sizeX) && (sy >= sizeY); + int iconDiff = abs(sx - sizeX) + abs(sy - sizeY); + + // Use current icon as candidate for the best icon, if either: + // - we have no candidate yet + // - we have no candidate larger than desired size and current icon is + // - current icon is closer to desired size than candidate + if ( !iconBest.IsOk() || + (!bestIsLarger && iconLarger) || + (iconLarger && (iconDiff < bestDiff)) ) + { + iconBest = icon; + bestIsLarger = iconLarger; + bestDiff = iconDiff; + continue; + } + } } #if defined( __WXMAC__ ) && wxOSX_USE_CARBON + if (!iconBest.IsOk()) + return wxNullIcon; + return wxIcon(iconBest.GetHICON(), size); #else return iconBest; @@ -244,14 +286,7 @@ wxIcon wxIconBundle::GetIcon(const wxSize& size) const wxIcon wxIconBundle::GetIconOfExactSize(const wxSize& size) const { - wxIcon icon = GetIcon(size); - if ( icon.Ok() && - (icon.GetWidth() != size.x || icon.GetHeight() != size.y) ) - { - icon = wxNullIcon; - } - - return icon; + return GetIcon(size, FALLBACK_NONE); } void wxIconBundle::AddIcon(const wxIcon& icon) @@ -267,7 +302,7 @@ void wxIconBundle::AddIcon(const wxIcon& icon) for ( size_t i = 0; i < count; ++i ) { wxIcon& tmp = iconArray[i]; - if ( tmp.Ok() && + if ( tmp.IsOk() && tmp.GetWidth() == icon.GetWidth() && tmp.GetHeight() == icon.GetHeight() ) { diff --git a/Externals/wxWidgets3/src/common/imagbmp.cpp b/Externals/wxWidgets3/src/common/imagbmp.cpp index 70ecc97fed..eb232c216b 100644 --- a/Externals/wxWidgets3/src/common/imagbmp.cpp +++ b/Externals/wxWidgets3/src/common/imagbmp.cpp @@ -2,7 +2,7 @@ // Name: src/common/imagbmp.cpp // Purpose: wxImage BMP,ICO and CUR handlers // Author: Robert Roebling, Chris Elliott -// RCS-ID: $Id: imagbmp.cpp 66491 2010-12-29 12:31:37Z DS $ +// RCS-ID: $Id: imagbmp.cpp 68766 2011-08-17 21:01:09Z DS $ // Copyright: (c) Robert Roebling, Chris Elliott // Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// @@ -91,7 +91,7 @@ bool wxBMPHandler::SaveDib(wxImage *image, { wxCHECK_MSG( image, false, wxT("invalid pointer in wxBMPHandler::SaveFile") ); - if ( !image->Ok() ) + if ( !image->IsOk() ) { if ( verbose ) { @@ -146,8 +146,8 @@ bool wxBMPHandler::SaveDib(wxImage *image, } unsigned width = image->GetWidth(); - unsigned row_padding = (4 - int(width*bpp/8.0) % 4) % 4; // # bytes to pad to dword - unsigned row_width = int(width * bpp/8.0) + row_padding; // # of bytes per row + unsigned row_padding = (4 - ((width * bpp + 7) / 8) % 4) % 4; // # bytes to pad to dword + unsigned row_width = (width * bpp + 7) / 8 + row_padding; // # of bytes per row struct { @@ -351,7 +351,7 @@ bool wxBMPHandler::SaveDib(wxImage *image, // pointer to the image data, use quantized if available wxUint8 *data = (wxUint8*) image->GetData(); - if (q_image) if (q_image->Ok()) data = (wxUint8*) q_image->GetData(); + if (q_image) if (q_image->IsOk()) data = (wxUint8*) q_image->GetData(); wxUint8 *buffer = new wxUint8[row_width]; memset(buffer, 0, row_width); @@ -533,6 +533,14 @@ bool wxBMPHandler::DoLoadDib(wxImage * image, int width, int height, wxON_BLOCK_EXIT1(&BMPPalette::Free, cmap); + bool isUpsideDown = true; + + if (height < 0) + { + isUpsideDown = false; + height = -height; + } + // destroy existing here instead of: image->Destroy(); image->Create(width, height); @@ -702,9 +710,10 @@ bool wxBMPHandler::DoLoadDib(wxImage * image, int width, int height, // this case (see #10915) bool hasValidAlpha = false; - /* BMPs are stored upside down */ - for ( int line = (height - 1); line >= 0; line-- ) + for ( int row = 0; row < height; row++ ) { + int line = isUpsideDown ? height - 1 - row : row; + int linepos = 0; for ( int column = 0; column < width ; ) { @@ -734,21 +743,24 @@ bool wxBMPHandler::DoLoadDib(wxImage * image, int width, int height, { if ( aByte == 0 ) { - if ( column > 0 ) - column = width; + // end of scanline marker + column = width; + row--; } else if ( aByte == 1 ) { + // end of RLE data marker, stop decoding column = width; - line = -1; + row = height; } else if ( aByte == 2 ) { + // delta marker, move in image aByte = stream.GetC(); column += aByte; linepos = column * bpp / 4; aByte = stream.GetC(); - line -= aByte; // upside down + row += aByte; // upside down } else { @@ -817,20 +829,24 @@ bool wxBMPHandler::DoLoadDib(wxImage * image, int width, int height, { if ( aByte == 0 ) { - /* column = width; */ + // end of scanline marker + column = width; + row--; } else if ( aByte == 1 ) { + // end of RLE data marker, stop decoding column = width; - line = -1; + row = height; } else if ( aByte == 2 ) { + // delta marker, move in image aByte = stream.GetC(); column += aByte; linepos = column * bpp / 8; aByte = stream.GetC(); - line += aByte; + row -= aByte; } else { @@ -1249,7 +1265,7 @@ bool wxICOHandler::SaveFile(wxImage *image, // wxCountingOutputStream::IsOk() always returns true for now and this // "if" provokes VC++ warnings in optimized build #if 0 - if ( !cStream.Ok() ) + if ( !cStream.IsOk() ) { if ( verbose ) { @@ -1335,6 +1351,11 @@ bool wxICOHandler::SaveFile(wxImage *image, bool wxICOHandler::LoadFile(wxImage *image, wxInputStream& stream, bool verbose, int index) { + if ( stream.IsSeekable() && stream.SeekI(0) == wxInvalidOffset ) + { + return false; + } + return DoLoadFile(image, stream, verbose, index); } @@ -1423,10 +1444,16 @@ bool wxICOHandler::DoLoadFile(wxImage *image, wxInputStream& stream, int wxICOHandler::DoGetImageCount(wxInputStream& stream) { + // It's ok to modify the stream position in this function. + + if ( stream.IsSeekable() && stream.SeekI(0) == wxInvalidOffset ) + { + return 0; + } + ICONDIR IconDir; if (stream.Read(&IconDir, sizeof(IconDir)).LastRead() != sizeof(IconDir)) - // it's ok to modify the stream position here return 0; return (int)wxUINT16_SWAP_ON_BE(IconDir.idCount); @@ -1492,8 +1519,15 @@ int wxANIHandler::DoGetImageCount(wxInputStream& stream) static bool CanReadICOOrCUR(wxInputStream *stream, wxUint16 resourceType) { + // It's ok to modify the stream position in this function. + + if ( stream->IsSeekable() && stream->SeekI(0) == wxInvalidOffset ) + { + return false; + } + ICONDIR iconDir; - if ( !stream->Read(&iconDir, sizeof(iconDir)) ) // it's ok to modify the stream position here + if ( !stream->Read(&iconDir, sizeof(iconDir)) ) { return false; } diff --git a/Externals/wxWidgets3/src/common/image.cpp b/Externals/wxWidgets3/src/common/image.cpp index 8eb6ac2c9b..637c93dcdb 100644 --- a/Externals/wxWidgets3/src/common/image.cpp +++ b/Externals/wxWidgets3/src/common/image.cpp @@ -2,7 +2,7 @@ // Name: src/common/image.cpp // Purpose: wxImage // Author: Robert Roebling -// RCS-ID: $Id: image.cpp 67203 2011-03-15 16:42:34Z DS $ +// RCS-ID: $Id: image.cpp 70656 2012-02-20 21:57:17Z VZ $ // Copyright: (c) Robert Roebling // Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// @@ -140,8 +140,9 @@ bool wxImage::Create(const char* const* xpmData) wxXPMDecoder decoder; (*this) = decoder.ReadData(xpmData); - return Ok(); + return IsOk(); #else + wxUnusedVar(xpmData); return false; #endif } @@ -258,7 +259,7 @@ wxImage wxImage::MakeEmptyClone(int flags) const { wxImage image; - wxCHECK_MSG( Ok(), image, wxS("invalid image") ); + wxCHECK_MSG( IsOk(), image, wxS("invalid image") ); long height = M_IMGDATA->m_height; long width = M_IMGDATA->m_width; @@ -293,7 +294,7 @@ wxImage wxImage::Copy() const { wxImage image; - wxCHECK_MSG( Ok(), image, wxT("invalid image") ); + wxCHECK_MSG( IsOk(), image, wxT("invalid image") ); image.m_refData = CloneRefData(m_refData); @@ -307,7 +308,7 @@ wxImage wxImage::ShrinkBy( int xFactor , int yFactor ) const wxImage image; - wxCHECK_MSG( Ok(), image, wxT("invalid image") ); + wxCHECK_MSG( IsOk(), image, wxT("invalid image") ); // can't scale to/from 0 size wxCHECK_MSG( (xFactor > 0) && (yFactor > 0), image, @@ -426,7 +427,7 @@ wxImage::Scale( int width, int height, wxImageResizeQuality quality ) const { wxImage image; - wxCHECK_MSG( Ok(), image, wxT("invalid image") ); + wxCHECK_MSG( IsOk(), image, wxT("invalid image") ); // can't scale to/from 0 size wxCHECK_MSG( (width > 0) && (height > 0), image, @@ -856,7 +857,7 @@ wxImage wxImage::BlurHorizontal(int blurRadius) const { wxImage ret_image(MakeEmptyClone()); - wxCHECK( ret_image.Ok(), ret_image ); + wxCHECK( ret_image.IsOk(), ret_image ); const unsigned char* src_data = M_IMGDATA->m_data; unsigned char* dst_data = ret_image.GetData(); @@ -959,7 +960,7 @@ wxImage wxImage::BlurVertical(int blurRadius) const { wxImage ret_image(MakeEmptyClone()); - wxCHECK( ret_image.Ok(), ret_image ); + wxCHECK( ret_image.IsOk(), ret_image ); const unsigned char* src_data = M_IMGDATA->m_data; unsigned char* dst_data = ret_image.GetData(); @@ -1074,7 +1075,7 @@ wxImage wxImage::Rotate90( bool clockwise ) const { wxImage image(MakeEmptyClone(Clone_SwapOrientation)); - wxCHECK( image.Ok(), image ); + wxCHECK( image.IsOk(), image ); long height = M_IMGDATA->m_height; long width = M_IMGDATA->m_width; @@ -1099,7 +1100,7 @@ wxImage wxImage::Rotate90( bool clockwise ) const // we rotate the image in 21-pixel (63-byte) wide strips // to make better use of cpu cache - memory transfers // (note: while much better than single-pixel "strips", - // our vertical strips will still generally straddle cachelines) + // our vertical strips will still generally straddle 64-byte cachelines) for (long ii = 0; ii < width; ) { long next_ii = wxMin(ii + 21, width); @@ -1113,11 +1114,11 @@ wxImage wxImage::Rotate90( bool clockwise ) const { if ( clockwise ) { - target_data = data + (((i+1)*height) - j - 1)*3; + target_data = data + ((i + 1)*height - j - 1)*3; } else { - target_data = data + ((height*(width - 1 - i)) + j)*3; + target_data = data + (height*(width - 1 - i) + j)*3; } memcpy( target_data, source_data, 3 ); source_data += 3; @@ -1134,21 +1135,30 @@ wxImage wxImage::Rotate90( bool clockwise ) const unsigned char *alpha_data = image.GetAlpha(); unsigned char *target_alpha = 0 ; - for (long j = 0; j < height; j++) + for (long ii = 0; ii < width; ) { - for (long i = 0; i < width; i++) - { - if ( clockwise ) - { - target_alpha = alpha_data + (((i+1)*height) - j - 1); - } - else - { - target_alpha = alpha_data + ((height*(width-1)) + j - (i*height)); - } + long next_ii = wxMin(ii + 64, width); - *target_alpha = *source_alpha++; + for (long j = 0; j < height; j++) + { + source_alpha = M_IMGDATA->m_alpha + j*width + ii; + + for (long i = ii; i < next_ii; i++) + { + if ( clockwise ) + { + target_alpha = alpha_data + (i+1)*height - j - 1; + } + else + { + target_alpha = alpha_data + height*(width - i - 1) + j; + } + + *target_alpha = *source_alpha++; + } } + + ii = next_ii; } } @@ -1159,7 +1169,7 @@ wxImage wxImage::Rotate180() const { wxImage image(MakeEmptyClone()); - wxCHECK( image.Ok(), image ); + wxCHECK( image.IsOk(), image ); long height = M_IMGDATA->m_height; long width = M_IMGDATA->m_width; @@ -1212,7 +1222,7 @@ wxImage wxImage::Mirror( bool horizontally ) const { wxImage image(MakeEmptyClone()); - wxCHECK( image.Ok(), image ); + wxCHECK( image.IsOk(), image ); long height = M_IMGDATA->m_height; long width = M_IMGDATA->m_width; @@ -1289,7 +1299,7 @@ wxImage wxImage::GetSubImage( const wxRect &rect ) const { wxImage image; - wxCHECK_MSG( Ok(), image, wxT("invalid image") ); + wxCHECK_MSG( IsOk(), image, wxT("invalid image") ); wxCHECK_MSG( (rect.GetLeft()>=0) && (rect.GetTop()>=0) && (rect.GetRight()<=GetWidth()) && (rect.GetBottom()<=GetHeight()), @@ -1342,7 +1352,7 @@ wxImage wxImage::Size( const wxSize& size, const wxPoint& pos, { wxImage image; - wxCHECK_MSG( Ok(), image, wxT("invalid image") ); + wxCHECK_MSG( IsOk(), image, wxT("invalid image") ); wxCHECK_MSG( (size.GetWidth() > 0) && (size.GetHeight() > 0), image, wxT("invalid size") ); int width = GetWidth(), height = GetHeight(); @@ -1390,8 +1400,8 @@ wxImage wxImage::Size( const wxSize& size, const wxPoint& pos, void wxImage::Paste( const wxImage &image, int x, int y ) { - wxCHECK_RET( Ok(), wxT("invalid image") ); - wxCHECK_RET( image.Ok(), wxT("invalid image") ); + wxCHECK_RET( IsOk(), wxT("invalid image") ); + wxCHECK_RET( image.IsOk(), wxT("invalid image") ); AllocExclusive(); @@ -1419,12 +1429,15 @@ void wxImage::Paste( const wxImage &image, int x, int y ) if (width < 1) return; if (height < 1) return; - if ((!HasMask() && !image.HasMask()) || - (HasMask() && !image.HasMask()) || - ((HasMask() && image.HasMask() && + // If we can, copy the data using memcpy() as this is the fastest way. But + // for this the image being pasted must have "compatible" mask with this + // one meaning that either it must not have one at all or it must use the + // same masked colour. + if ( !image.HasMask() || + ((HasMask() && (GetMaskRed()==image.GetMaskRed()) && (GetMaskGreen()==image.GetMaskGreen()) && - (GetMaskBlue()==image.GetMaskBlue())))) + (GetMaskBlue()==image.GetMaskBlue()))) ) { const unsigned char* source_data = image.GetData() + 3*(xx + yy*image.GetWidth()); int source_step = image.GetWidth()*3; @@ -1491,7 +1504,7 @@ void wxImage::Paste( const wxImage &image, int x, int y ) void wxImage::Replace( unsigned char r1, unsigned char g1, unsigned char b1, unsigned char r2, unsigned char g2, unsigned char b2 ) { - wxCHECK_RET( Ok(), wxT("invalid image") ); + wxCHECK_RET( IsOk(), wxT("invalid image") ); AllocExclusive(); @@ -1522,7 +1535,7 @@ wxImage wxImage::ConvertToGreyscale(double weight_r, double weight_g, double wei { wxImage image(MakeEmptyClone()); - wxCHECK( image.Ok(), image ); + wxCHECK( image.IsOk(), image ); const unsigned char *src = M_IMGDATA->m_data; unsigned char *dest = image.GetData(); @@ -1556,7 +1569,7 @@ wxImage wxImage::ConvertToMono( unsigned char r, unsigned char g, unsigned char { wxImage image; - wxCHECK_MSG( Ok(), image, wxT("invalid image") ); + wxCHECK_MSG( IsOk(), image, wxT("invalid image") ); image.Create( M_IMGDATA->m_width, M_IMGDATA->m_height, false ); @@ -1619,14 +1632,14 @@ wxImage wxImage::ConvertToDisabled(unsigned char brightness) const int wxImage::GetWidth() const { - wxCHECK_MSG( Ok(), 0, wxT("invalid image") ); + wxCHECK_MSG( IsOk(), 0, wxT("invalid image") ); return M_IMGDATA->m_width; } int wxImage::GetHeight() const { - wxCHECK_MSG( Ok(), 0, wxT("invalid image") ); + wxCHECK_MSG( IsOk(), 0, wxT("invalid image") ); return M_IMGDATA->m_height; } @@ -1650,7 +1663,7 @@ void wxImage::SetType(wxBitmapType type) long wxImage::XYToIndex(int x, int y) const { - if ( Ok() && + if ( IsOk() && x >= 0 && y >= 0 && x < M_IMGDATA->m_width && y < M_IMGDATA->m_height ) { @@ -1676,7 +1689,7 @@ void wxImage::SetRGB( int x, int y, unsigned char r, unsigned char g, unsigned c void wxImage::SetRGB( const wxRect& rect_, unsigned char r, unsigned char g, unsigned char b ) { - wxCHECK_RET( Ok(), wxT("invalid image") ); + wxCHECK_RET( IsOk(), wxT("invalid image") ); AllocExclusive(); @@ -1752,14 +1765,14 @@ bool wxImage::IsOk() const unsigned char *wxImage::GetData() const { - wxCHECK_MSG( Ok(), (unsigned char *)NULL, wxT("invalid image") ); + wxCHECK_MSG( IsOk(), (unsigned char *)NULL, wxT("invalid image") ); return M_IMGDATA->m_data; } void wxImage::SetData( unsigned char *data, bool static_data ) { - wxCHECK_RET( Ok(), wxT("invalid image") ); + wxCHECK_RET( IsOk(), wxT("invalid image") ); wxImageRefData *newRefData = new wxImageRefData(); @@ -1860,7 +1873,7 @@ wxImage::ConvertColourToAlpha(unsigned char r, unsigned char g, unsigned char b) void wxImage::SetAlpha( unsigned char *alpha, bool static_data ) { - wxCHECK_RET( Ok(), wxT("invalid image") ); + wxCHECK_RET( IsOk(), wxT("invalid image") ); AllocExclusive(); @@ -1878,7 +1891,7 @@ void wxImage::SetAlpha( unsigned char *alpha, bool static_data ) unsigned char *wxImage::GetAlpha() const { - wxCHECK_MSG( Ok(), (unsigned char *)NULL, wxT("invalid image") ); + wxCHECK_MSG( IsOk(), (unsigned char *)NULL, wxT("invalid image") ); return M_IMGDATA->m_alpha; } @@ -1936,7 +1949,7 @@ void wxImage::ClearAlpha() void wxImage::SetMaskColour( unsigned char r, unsigned char g, unsigned char b ) { - wxCHECK_RET( Ok(), wxT("invalid image") ); + wxCHECK_RET( IsOk(), wxT("invalid image") ); AllocExclusive(); @@ -1948,7 +1961,7 @@ void wxImage::SetMaskColour( unsigned char r, unsigned char g, unsigned char b ) bool wxImage::GetOrFindMaskColour( unsigned char *r, unsigned char *g, unsigned char *b ) const { - wxCHECK_MSG( Ok(), false, wxT("invalid image") ); + wxCHECK_MSG( IsOk(), false, wxT("invalid image") ); if (M_IMGDATA->m_hasMask) { @@ -1966,28 +1979,28 @@ bool wxImage::GetOrFindMaskColour( unsigned char *r, unsigned char *g, unsigned unsigned char wxImage::GetMaskRed() const { - wxCHECK_MSG( Ok(), 0, wxT("invalid image") ); + wxCHECK_MSG( IsOk(), 0, wxT("invalid image") ); return M_IMGDATA->m_maskRed; } unsigned char wxImage::GetMaskGreen() const { - wxCHECK_MSG( Ok(), 0, wxT("invalid image") ); + wxCHECK_MSG( IsOk(), 0, wxT("invalid image") ); return M_IMGDATA->m_maskGreen; } unsigned char wxImage::GetMaskBlue() const { - wxCHECK_MSG( Ok(), 0, wxT("invalid image") ); + wxCHECK_MSG( IsOk(), 0, wxT("invalid image") ); return M_IMGDATA->m_maskBlue; } void wxImage::SetMask( bool mask ) { - wxCHECK_RET( Ok(), wxT("invalid image") ); + wxCHECK_RET( IsOk(), wxT("invalid image") ); AllocExclusive(); @@ -1996,7 +2009,7 @@ void wxImage::SetMask( bool mask ) bool wxImage::HasMask() const { - wxCHECK_MSG( Ok(), false, wxT("invalid image") ); + wxCHECK_MSG( IsOk(), false, wxT("invalid image") ); return M_IMGDATA->m_hasMask; } @@ -2143,22 +2156,22 @@ bool wxImage::ConvertAlphaToMask(unsigned char mr, bool wxImage::HasPalette() const { - if (!Ok()) + if (!IsOk()) return false; - return M_IMGDATA->m_palette.Ok(); + return M_IMGDATA->m_palette.IsOk(); } const wxPalette& wxImage::GetPalette() const { - wxCHECK_MSG( Ok(), wxNullPalette, wxT("invalid image") ); + wxCHECK_MSG( IsOk(), wxNullPalette, wxT("invalid image") ); return M_IMGDATA->m_palette; } void wxImage::SetPalette(const wxPalette& palette) { - wxCHECK_RET( Ok(), wxT("invalid image") ); + wxCHECK_RET( IsOk(), wxT("invalid image") ); AllocExclusive(); @@ -2280,7 +2293,7 @@ bool wxImage::SaveFile( const wxString& WXUNUSED_UNLESS_STREAMS(filename), wxBitmapType WXUNUSED_UNLESS_STREAMS(type) ) const { #if HAS_FILE_STREAMS - wxCHECK_MSG( Ok(), false, wxT("invalid image") ); + wxCHECK_MSG( IsOk(), false, wxT("invalid image") ); ((wxImage*)this)->SetOption(wxIMAGE_OPTION_FILENAME, filename); @@ -2300,7 +2313,7 @@ bool wxImage::SaveFile( const wxString& WXUNUSED_UNLESS_STREAMS(filename), const wxString& WXUNUSED_UNLESS_STREAMS(mimetype) ) const { #if HAS_FILE_STREAMS - wxCHECK_MSG( Ok(), false, wxT("invalid image") ); + wxCHECK_MSG( IsOk(), false, wxT("invalid image") ); ((wxImage*)this)->SetOption(wxIMAGE_OPTION_FILENAME, filename); @@ -2331,7 +2344,7 @@ int wxImage::GetImageCount( const wxString& WXUNUSED_UNLESS_STREAMS(name), { #if HAS_FILE_STREAMS wxImageFileInputStream stream(name); - if (stream.Ok()) + if (stream.IsOk()) return GetImageCount(stream, type); #endif @@ -2438,7 +2451,17 @@ bool wxImage::DoLoad(wxImageHandler& handler, wxInputStream& stream, int index) } if ( width != widthOrig || height != heightOrig ) + { + // get the original size if it was set by the image handler + // but also in order to restore it after Rescale + int widthOrigOption = GetOptionInt(wxIMAGE_OPTION_ORIGINAL_WIDTH), + heightOrigOption = GetOptionInt(wxIMAGE_OPTION_ORIGINAL_HEIGHT); + Rescale(width, height, wxIMAGE_QUALITY_HIGH); + + SetOption(wxIMAGE_OPTION_ORIGINAL_WIDTH, widthOrigOption ? widthOrigOption : widthOrig); + SetOption(wxIMAGE_OPTION_ORIGINAL_HEIGHT, heightOrigOption ? heightOrigOption : heightOrig); + } } // Set this after Rescale, which currently does not preserve it @@ -2533,7 +2556,7 @@ bool wxImage::DoSave(wxImageHandler& handler, wxOutputStream& stream) const bool wxImage::SaveFile( wxOutputStream& stream, wxBitmapType type ) const { - wxCHECK_MSG( Ok(), false, wxT("invalid image") ); + wxCHECK_MSG( IsOk(), false, wxT("invalid image") ); wxImageHandler *handler = FindHandler(type); if ( !handler ) @@ -2547,12 +2570,13 @@ bool wxImage::SaveFile( wxOutputStream& stream, wxBitmapType type ) const bool wxImage::SaveFile( wxOutputStream& stream, const wxString& mimetype ) const { - wxCHECK_MSG( Ok(), false, wxT("invalid image") ); + wxCHECK_MSG( IsOk(), false, wxT("invalid image") ); wxImageHandler *handler = FindHandlerMime(mimetype); if ( !handler ) { wxLogWarning( _("No image handler for type %s defined."), mimetype.GetData() ); + return false; } return DoSave(*handler, stream); diff --git a/Externals/wxWidgets3/src/common/imagfill.cpp b/Externals/wxWidgets3/src/common/imagfill.cpp index c105bf2f26..c93229d14f 100644 --- a/Externals/wxWidgets3/src/common/imagfill.cpp +++ b/Externals/wxWidgets3/src/common/imagfill.cpp @@ -2,7 +2,7 @@ // Name: src/common/imagfill.cpp // Purpose: FloodFill for wxImage // Author: Julian Smart -// RCS-ID: $Id: imagfill.cpp 65820 2010-10-15 23:46:46Z VZ $ +// RCS-ID: $Id: imagfill.cpp 70868 2012-03-10 16:58:05Z PC $ // Copyright: (c) Julian Smart // Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// @@ -58,8 +58,7 @@ static bool LINKAGEMODE MatchBoundaryPixel(wxImage *img, int x, int y, int w, in static void LINKAGEMODE wxImageFloodFill(wxImage *image, wxCoord x, wxCoord y, const wxBrush & fillBrush, - const wxColour& testColour, int style, - int WXUNUSED(LogicalFunction)) + const wxColour& testColour, int style) { /* A diamond flood-fill using a circular queue system. Each pixel surrounding the current pixel is added to @@ -313,8 +312,7 @@ bool wxDoFloodFill(wxDC *dc, wxCoord x, wxCoord y, memdc.SelectObject(wxNullBitmap); wxImage image = bitmap.ConvertToImage(); - wxImageFloodFill(&image, x_dev, y_dev, dc->GetBrush(), col, style, - dc->GetLogicalFunction()); + wxImageFloodFill(&image, x_dev, y_dev, dc->GetBrush(), col, style); bitmap = wxBitmap(image); memdc.SelectObject(bitmap); dc->Blit(x0_log, y0_log, w_log, h_log, &memdc, 0, 0); diff --git a/Externals/wxWidgets3/src/common/imaggif.cpp b/Externals/wxWidgets3/src/common/imaggif.cpp index d61fb53a5a..536aecf743 100644 --- a/Externals/wxWidgets3/src/common/imaggif.cpp +++ b/Externals/wxWidgets3/src/common/imaggif.cpp @@ -2,7 +2,7 @@ // Name: src/common/imaggif.cpp // Purpose: wxGIFHandler // Author: Vaclav Slavik, Guillermo Rodriguez Garcia, Gershon Elber, Troels K -// RCS-ID: $Id: imaggif.cpp 66803 2011-01-28 08:36:34Z DS $ +// RCS-ID: $Id: imaggif.cpp 67802 2011-05-27 12:25:25Z DS $ // Copyright: (c) 1999-2011 Vaclav Slavik, Guillermo Rodriguez Garcia, Gershon Elber, Troels K // Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// @@ -643,7 +643,7 @@ bool wxGIFHandler_WriteWord(wxOutputStream *stream, wxUint16 word) buf[0] = word & 0xff; buf[1] = (word >> 8) & 0xff; - return wxGIFHandler_Write(stream, &word, sizeof(word)); + return wxGIFHandler_Write(stream, &buf, sizeof(buf)); } bool wxGIFHandler_WriteHeader(wxOutputStream *stream, int width, int height, diff --git a/Externals/wxWidgets3/src/common/imagiff.cpp b/Externals/wxWidgets3/src/common/imagiff.cpp index f7fe0360f5..2ac1595a93 100644 --- a/Externals/wxWidgets3/src/common/imagiff.cpp +++ b/Externals/wxWidgets3/src/common/imagiff.cpp @@ -2,7 +2,7 @@ // Name: src/common/imagiff.cpp // Purpose: wxImage handler for Amiga IFF images // Author: Steffen Gutmann, Thomas Meyer -// RCS-ID: $Id: imagiff.cpp 67254 2011-03-20 00:14:35Z DS $ +// RCS-ID: $Id: imagiff.cpp 69562 2011-10-27 21:10:38Z VZ $ // Copyright: (c) Steffen Gutmann, 2002 // Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// @@ -81,7 +81,6 @@ private: IFFImage *m_image; // image data wxInputStream *m_f; // input stream unsigned char *databuf; - unsigned char *picptr; unsigned char *decomp_mem; void Destroy(); @@ -140,7 +139,7 @@ bool wxIFFDecoder::ConvertToImage(wxImage *image) const // create the image image->Create(GetWidth(), GetHeight()); - if (!image->Ok()) + if (!image->IsOk()) return false; unsigned char *pal = GetPalette(); @@ -546,7 +545,7 @@ int wxIFFDecoder::ReadIFF() } m_image->p = new byte[bmhd_width * bmhd_height * 3]; - byte *picptr = m_image->p; + byte *picptr = m_image->p; if (!picptr) { Destroy(); return wxIFF_MEMERR; diff --git a/Externals/wxWidgets3/src/common/imagjpeg.cpp b/Externals/wxWidgets3/src/common/imagjpeg.cpp index e048ac59f3..3c52b8e6f7 100644 --- a/Externals/wxWidgets3/src/common/imagjpeg.cpp +++ b/Externals/wxWidgets3/src/common/imagjpeg.cpp @@ -2,7 +2,7 @@ // Name: src/common/imagjpeg.cpp // Purpose: wxImage JPEG handler // Author: Vaclav Slavik -// RCS-ID: $Id: imagjpeg.cpp 66259 2010-11-25 00:53:44Z VZ $ +// RCS-ID: $Id: imagjpeg.cpp 69759 2011-11-14 13:35:48Z VZ $ // Copyright: (c) Vaclav Slavik // Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// @@ -257,7 +257,7 @@ bool wxJPEGHandler::LoadFile( wxImage *image, wxInputStream& stream, bool verbos } (cinfo.src->term_source)(&cinfo); jpeg_destroy_decompress(&cinfo); - if (image->Ok()) image->Destroy(); + if (image->IsOk()) image->Destroy(); return false; } @@ -291,7 +291,7 @@ bool wxJPEGHandler::LoadFile( wxImage *image, wxInputStream& stream, bool verbos jpeg_start_decompress( &cinfo ); image->Create( cinfo.output_width, cinfo.output_height ); - if (!image->Ok()) { + if (!image->IsOk()) { jpeg_finish_decompress( &cinfo ); jpeg_destroy_decompress( &cinfo ); return false; @@ -334,6 +334,13 @@ bool wxJPEGHandler::LoadFile( wxImage *image, wxInputStream& stream, bool verbos image->SetOption(wxIMAGE_OPTION_RESOLUTIONUNIT, cinfo.density_unit); } + if ( cinfo.image_width != cinfo.output_width || cinfo.image_height != cinfo.output_height ) + { + // save the original image size + image->SetOption(wxIMAGE_OPTION_ORIGINAL_WIDTH, cinfo.image_width); + image->SetOption(wxIMAGE_OPTION_ORIGINAL_HEIGHT, cinfo.image_height); + } + jpeg_finish_decompress( &cinfo ); jpeg_destroy_decompress( &cinfo ); return true; diff --git a/Externals/wxWidgets3/src/common/imagpcx.cpp b/Externals/wxWidgets3/src/common/imagpcx.cpp index d18c1b412a..fcd4a1e6a4 100644 --- a/Externals/wxWidgets3/src/common/imagpcx.cpp +++ b/Externals/wxWidgets3/src/common/imagpcx.cpp @@ -3,7 +3,7 @@ // Purpose: wxImage PCX handler // Author: Guillermo Rodriguez Garcia // Version: 1.1 -// CVS-ID: $Id: imagpcx.cpp 61363 2009-07-09 20:26:34Z VZ $ +// CVS-ID: $Id: imagpcx.cpp 67681 2011-05-03 16:29:04Z DS $ // Copyright: (c) 1999 Guillermo Rodriguez Garcia // Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// @@ -214,7 +214,7 @@ int ReadPCX(wxImage *image, wxInputStream& stream) image->Create(width, height); - if (!image->Ok()) + if (!image->IsOk()) return wxPCX_MEMERR; if ((p = (unsigned char *) malloc(bytesperline * nplanes)) == NULL) @@ -331,7 +331,7 @@ int SavePCX(wxImage *image, wxOutputStream& stream) // according to PCX specs) and allocate space for one complete // scanline. - if (!image->Ok()) + if (!image->IsOk()) return wxPCX_INVFORMAT; width = image->GetWidth(); diff --git a/Externals/wxWidgets3/src/common/imagpng.cpp b/Externals/wxWidgets3/src/common/imagpng.cpp index 6a0c86b224..64bc0aa402 100644 --- a/Externals/wxWidgets3/src/common/imagpng.cpp +++ b/Externals/wxWidgets3/src/common/imagpng.cpp @@ -2,7 +2,7 @@ // Name: src/common/imagpng.cpp // Purpose: wxImage PNG handler // Author: Robert Roebling -// RCS-ID: $Id: imagpng.cpp 67280 2011-03-22 14:17:38Z DS $ +// RCS-ID: $Id: imagpng.cpp 70353 2012-01-15 14:46:41Z VZ $ // Copyright: (c) Robert Roebling // Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// @@ -116,11 +116,9 @@ IMPLEMENT_DYNAMIC_CLASS(wxPNGHandler,wxImageHandler) // First, let me describe what's the problem: libpng uses jmp_buf in // its png_struct structure. Unfortunately, this structure is // compiler-specific and may vary in size, so if you use libpng compiled -// as DLL with another compiler than the main executable, it may not work -// (this is for example the case with wxMGL port and SciTech MGL library -// that provides custom runtime-loadable libpng implementation with jmpbuf -// disabled altogether). Luckily, it is still possible to use setjmp() & -// longjmp() as long as the structure is not part of png_struct. +// as DLL with another compiler than the main executable, it may not work. +// Luckily, it is still possible to use setjmp() & longjmp() as long as the +// structure is not part of png_struct. // // Sadly, there's no clean way to attach user-defined data to png_struct. // There is only one customizable place, png_struct.io_ptr, which is meant @@ -558,7 +556,7 @@ wxPNGHandler::LoadFile(wxImage *image, image->Create((int)width, (int)height, (bool) false /* no need to init pixels */); - if (!image->Ok()) + if (!image->IsOk()) goto error; // initialize all line pointers to NULL to ensure that they can be safely @@ -660,7 +658,7 @@ error: wxLogError(_("Couldn't load a PNG image - file is corrupted or not enough memory.")); } - if ( image->Ok() ) + if ( image->IsOk() ) { image->Destroy(); } @@ -795,15 +793,13 @@ bool wxPNGHandler::SaveFile( wxImage *image, wxOutputStream& stream, bool verbos #endif ; - png_color_8 mask; + png_color_8 mask = { 0, 0, 0, 0, 0 }; if (bHasMask) { mask.red = image->GetMaskRed(); mask.green = image->GetMaskGreen(); mask.blue = image->GetMaskBlue(); - mask.alpha = 0; - mask.gray = 0; } PaletteMap palette; diff --git a/Externals/wxWidgets3/src/common/imagtga.cpp b/Externals/wxWidgets3/src/common/imagtga.cpp index 909eb5a4c8..2b0f27a2cd 100644 --- a/Externals/wxWidgets3/src/common/imagtga.cpp +++ b/Externals/wxWidgets3/src/common/imagtga.cpp @@ -2,7 +2,7 @@ // Name: src/common/imagtga.cpp // Purpose: wxImage TGA handler // Author: Seth Jackson -// CVS-ID: $Id: imagtga.cpp 67254 2011-03-20 00:14:35Z DS $ +// CVS-ID: $Id: imagtga.cpp 67681 2011-05-03 16:29:04Z DS $ // Copyright: (c) 2005 Seth Jackson // Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// @@ -227,7 +227,7 @@ int ReadTGA(wxImage* image, wxInputStream& stream) image->Create(width, height); - if (!image->Ok()) + if (!image->IsOk()) { return wxTGA_MEMERR; } @@ -846,7 +846,7 @@ bool wxTGAHandler::DoCanRead(wxInputStream& stream) unsigned char hdr[HDR_SIZE]; stream.Read(hdr, HDR_SIZE); // it's ok to modify the stream position here - // Check wether we can read the file or not. + // Check whether we can read the file or not. short colorType = hdr[HDR_COLORTYPE]; if ( colorType != wxTGA_UNMAPPED && colorType != wxTGA_MAPPED ) diff --git a/Externals/wxWidgets3/src/common/imagtiff.cpp b/Externals/wxWidgets3/src/common/imagtiff.cpp index 3f62a07948..bae7261404 100644 --- a/Externals/wxWidgets3/src/common/imagtiff.cpp +++ b/Externals/wxWidgets3/src/common/imagtiff.cpp @@ -2,7 +2,7 @@ // Name: src/common/imagtiff.cpp // Purpose: wxImage TIFF handler // Author: Robert Roebling -// RCS-ID: $Id: imagtiff.cpp 67264 2011-03-20 19:48:03Z DS $ +// RCS-ID: $Id: imagtiff.cpp 70353 2012-01-15 14:46:41Z VZ $ // Copyright: (c) Robert Roebling // Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// @@ -48,11 +48,7 @@ extern "C" #include "wx/wfstream.h" #ifndef TIFFLINKAGEMODE - #if defined(__WATCOMC__) && defined(__WXMGL__) - #define TIFFLINKAGEMODE cdecl - #else - #define TIFFLINKAGEMODE LINKAGEMODE - #endif + #define TIFFLINKAGEMODE LINKAGEMODE #endif // ============================================================================ @@ -110,7 +106,7 @@ wxTIFFHandler::wxTIFFHandler() m_name = wxT("TIFF file"); m_extension = wxT("tif"); m_altExtensions.Add(wxT("tiff")); - m_type = wxBITMAP_TYPE_TIF; + m_type = wxBITMAP_TYPE_TIFF; m_mime = wxT("image/tiff"); TIFFSetWarningHandler((TIFFErrorHandler) TIFFwxWarningHandler); TIFFSetErrorHandler((TIFFErrorHandler) TIFFwxErrorHandler); @@ -192,8 +188,42 @@ wxTIFFSeekOProc(thandle_t handle, toff_t off, int whence) { wxOutputStream *stream = (wxOutputStream*) handle; - return wxFileOffsetToTIFF(stream->SeekO((wxFileOffset)off, - wxSeekModeFromTIFF(whence))); + toff_t offset = wxFileOffsetToTIFF( + stream->SeekO((wxFileOffset)off, wxSeekModeFromTIFF(whence)) ); + + if (offset != (toff_t) -1 || whence != SEEK_SET) + { + return offset; + } + + + /* + Try to workaround problems with libtiff seeking past the end of streams. + + This occurs when libtiff is writing tag entries past the end of a + stream but hasn't written the directory yet (which will be placed + before the tags and contain offsets to the just written tags). + The behaviour for seeking past the end of a stream is not consistent + and doesn't work with for example wxMemoryOutputStream. When this type + of seeking fails (with SEEK_SET), fill in the gap with zeroes and try + again. + */ + + wxFileOffset streamLength = stream->GetLength(); + if (streamLength != wxInvalidOffset && (wxFileOffset) off > streamLength) + { + if (stream->SeekO(streamLength, wxFromStart) == wxInvalidOffset) + { + return (toff_t) -1; + } + + for (wxFileOffset i = 0; i < (wxFileOffset) off - streamLength; ++i) + { + stream->PutC(0); + } + } + + return wxFileOffsetToTIFF( stream->TellO() ); } int TIFFLINKAGEMODE @@ -296,19 +326,24 @@ bool wxTIFFHandler::LoadFile( wxImage *image, wxInputStream& stream, bool verbos TIFFGetField( tif, TIFFTAG_IMAGEWIDTH, &w ); TIFFGetField( tif, TIFFTAG_IMAGELENGTH, &h ); - uint16 photometric; - uint16 samplesPerPixel; + uint16 samplesPerPixel = 0; + (void) TIFFGetFieldDefaulted(tif, TIFFTAG_SAMPLESPERPIXEL, &samplesPerPixel); + + uint16 bitsPerSample = 0; + (void) TIFFGetFieldDefaulted(tif, TIFFTAG_BITSPERSAMPLE, &bitsPerSample); + uint16 extraSamples; uint16* samplesInfo; - TIFFGetFieldDefaulted(tif, TIFFTAG_SAMPLESPERPIXEL, &samplesPerPixel); TIFFGetFieldDefaulted(tif, TIFFTAG_EXTRASAMPLES, &extraSamples, &samplesInfo); + + uint16 photometric; if (!TIFFGetField(tif, TIFFTAG_PHOTOMETRIC, &photometric)) { photometric = PHOTOMETRIC_MINISWHITE; } const bool hasAlpha = (extraSamples >= 1 - && ((samplesInfo[0] == EXTRASAMPLE_UNSPECIFIED && samplesPerPixel > 3) + && ((samplesInfo[0] == EXTRASAMPLE_UNSPECIFIED) || samplesInfo[0] == EXTRASAMPLE_ASSOCALPHA || samplesInfo[0] == EXTRASAMPLE_UNASSALPHA)) || (extraSamples == 0 && samplesPerPixel == 4 @@ -344,7 +379,7 @@ bool wxTIFFHandler::LoadFile( wxImage *image, wxInputStream& stream, bool verbos } image->Create( (int)w, (int)h ); - if (!image->Ok()) + if (!image->IsOk()) { if (verbose) { @@ -360,7 +395,77 @@ bool wxTIFFHandler::LoadFile( wxImage *image, wxInputStream& stream, bool verbos if ( hasAlpha ) image->SetAlpha(); - if (!TIFFReadRGBAImage( tif, w, h, raster, 0 )) + uint16 planarConfig = PLANARCONFIG_CONTIG; + (void) TIFFGetField(tif, TIFFTAG_PLANARCONFIG, &planarConfig); + + bool ok = true; + char msg[1024] = ""; + if + ( + (planarConfig == PLANARCONFIG_CONTIG && samplesPerPixel == 2 + && extraSamples == 1) + && + ( + ( !TIFFRGBAImageOK(tif, msg) ) + || (bitsPerSample == 8) + ) + ) + { + const bool isGreyScale = (bitsPerSample == 8); + unsigned char *buf = (unsigned char *)_TIFFmalloc(TIFFScanlineSize(tif)); + uint32 pos = 0; + const bool minIsWhite = (photometric == PHOTOMETRIC_MINISWHITE); + const int minValue = minIsWhite ? 255 : 0; + const int maxValue = 255 - minValue; + + /* + Decode to ABGR format as that is what the code, that converts to + wxImage, later on expects (normally TIFFReadRGBAImageOriented is + used to decode which uses an ABGR layout). + */ + for (uint32 y = 0; y < h; ++y) + { + if (TIFFReadScanline(tif, buf, y, 0) != 1) + { + ok = false; + break; + } + + if (isGreyScale) + { + for (uint32 x = 0; x < w; ++x) + { + uint8 val = minIsWhite ? 255 - buf[x*2] : buf[x*2]; + uint8 alpha = minIsWhite ? 255 - buf[x*2+1] : buf[x*2+1]; + raster[pos] = val + (val << 8) + (val << 16) + + (alpha << 24); + pos++; + } + } + else + { + for (uint32 x = 0; x < w; ++x) + { + int mask = buf[x*2/8] << ((x*2)%8); + + uint8 val = mask & 128 ? maxValue : minValue; + raster[pos] = val + (val << 8) + (val << 16) + + ((mask & 64 ? maxValue : minValue) << 24); + pos++; + } + } + } + + _TIFFfree(buf); + } + else + { + ok = TIFFReadRGBAImageOriented( tif, w, h, raster, + ORIENTATION_TOPLEFT, 0 ) != 0; + } + + + if (!ok) { if (verbose) { @@ -375,11 +480,8 @@ bool wxTIFFHandler::LoadFile( wxImage *image, wxInputStream& stream, bool verbos } unsigned char *ptr = image->GetData(); - ptr += w*3*(h-1); - unsigned char *alpha = hasAlpha ? image->GetAlpha() : NULL; - if ( hasAlpha ) - alpha += w*(h-1); + unsigned char *alpha = image->GetAlpha(); uint32 pos = 0; @@ -395,32 +497,29 @@ bool wxTIFFHandler::LoadFile( wxImage *image, wxInputStream& stream, bool verbos pos++; } - - // subtract line we just added plus one line: - ptr -= 2*w*3; - if ( hasAlpha ) - alpha -= 2*w; } - uint16 spp, bpp, compression; + image->SetOption(wxIMAGE_OPTION_TIFF_PHOTOMETRIC, photometric); + + uint16 compression; /* - Read some baseline TIFF tags which helps when re-saving a TIFF + Copy some baseline TIFF tags which helps when re-saving a TIFF to be similar to the original image. */ - if ( TIFFGetFieldDefaulted(tif, TIFFTAG_SAMPLESPERPIXEL, &spp) ) + if (samplesPerPixel) { - image->SetOption(wxIMAGE_OPTION_SAMPLESPERPIXEL, spp); + image->SetOption(wxIMAGE_OPTION_TIFF_SAMPLESPERPIXEL, samplesPerPixel); } - if ( TIFFGetFieldDefaulted(tif, TIFFTAG_BITSPERSAMPLE, &bpp) ) + if (bitsPerSample) { - image->SetOption(wxIMAGE_OPTION_BITSPERSAMPLE, bpp); + image->SetOption(wxIMAGE_OPTION_TIFF_BITSPERSAMPLE, bitsPerSample); } if ( TIFFGetFieldDefaulted(tif, TIFFTAG_COMPRESSION, &compression) ) { - image->SetOption(wxIMAGE_OPTION_COMPRESSION, compression); + image->SetOption(wxIMAGE_OPTION_TIFF_COMPRESSION, compression); } // Set the resolution unit. @@ -516,8 +615,8 @@ bool wxTIFFHandler::SaveFile( wxImage *image, wxOutputStream& stream, bool verbo return false; } - TIFFSetField(tif, TIFFTAG_ORIENTATION, ORIENTATION_TOPLEFT); - TIFFSetField(tif, TIFFTAG_IMAGEWIDTH, (uint32)image->GetWidth()); + const int imageWidth = image->GetWidth(); + TIFFSetField(tif, TIFFTAG_IMAGEWIDTH, (uint32) imageWidth); TIFFSetField(tif, TIFFTAG_IMAGELENGTH, (uint32)image->GetHeight()); TIFFSetField(tif, TIFFTAG_ORIENTATION, ORIENTATION_TOPLEFT); TIFFSetField(tif, TIFFTAG_PLANARCONFIG, PLANARCONFIG_CONTIG); @@ -553,39 +652,90 @@ bool wxTIFFHandler::SaveFile( wxImage *image, wxOutputStream& stream, bool verbo } - int spp = image->GetOptionInt(wxIMAGE_OPTION_SAMPLESPERPIXEL); + int spp = image->GetOptionInt(wxIMAGE_OPTION_TIFF_SAMPLESPERPIXEL); if ( !spp ) spp = 3; - int bpp = image->GetOptionInt(wxIMAGE_OPTION_BITSPERSAMPLE); - if ( !bpp ) - bpp = 8; - - int compression = image->GetOptionInt(wxIMAGE_OPTION_COMPRESSION); - if ( !compression ) + int bps = image->GetOptionInt(wxIMAGE_OPTION_TIFF_BITSPERSAMPLE); + if ( !bps ) { - // we can't use COMPRESSION_LZW because current version of libtiff + bps = 8; + } + else if (bps == 1) + { + // One bit per sample combined with 3 samples per pixel is + // not allowed and crashes libtiff. + spp = 1; + } + + int photometric = PHOTOMETRIC_RGB; + + if ( image->HasOption(wxIMAGE_OPTION_TIFF_PHOTOMETRIC) ) + { + photometric = image->GetOptionInt(wxIMAGE_OPTION_TIFF_PHOTOMETRIC); + if (photometric == PHOTOMETRIC_MINISWHITE + || photometric == PHOTOMETRIC_MINISBLACK) + { + // either b/w or greyscale + spp = 1; + } + } + else if (spp <= 2) + { + photometric = PHOTOMETRIC_MINISWHITE; + } + + const bool hasAlpha = image->HasAlpha(); + + int compression = image->GetOptionInt(wxIMAGE_OPTION_TIFF_COMPRESSION); + if ( !compression || (compression == COMPRESSION_JPEG && hasAlpha) ) + { + // We can't use COMPRESSION_LZW because current version of libtiff // doesn't implement it ("no longer implemented due to Unisys patent // enforcement") and other compression methods are lossy so we - // shouldn't use them by default -- and the only remaining one is none + // shouldn't use them by default -- and the only remaining one is none. + // Also JPEG compression for alpha images is not a good idea (viewers + // not opening the image properly). compression = COMPRESSION_NONE; } - TIFFSetField(tif, TIFFTAG_SAMPLESPERPIXEL, spp); - TIFFSetField(tif, TIFFTAG_BITSPERSAMPLE, bpp); - TIFFSetField(tif, TIFFTAG_PHOTOMETRIC, spp*bpp == 1 ? PHOTOMETRIC_MINISBLACK - : PHOTOMETRIC_RGB); + if + ( + (photometric == PHOTOMETRIC_RGB && spp == 4) + || (photometric <= PHOTOMETRIC_MINISBLACK && spp == 2) + ) + { + // Compensate for user passing a SamplesPerPixel that includes + // the alpha channel. + spp--; + } + + + int extraSamples = hasAlpha ? 1 : 0; + + TIFFSetField(tif, TIFFTAG_SAMPLESPERPIXEL, spp + extraSamples); + TIFFSetField(tif, TIFFTAG_BITSPERSAMPLE, bps); + TIFFSetField(tif, TIFFTAG_PHOTOMETRIC, photometric); TIFFSetField(tif, TIFFTAG_COMPRESSION, compression); - // scanlinesize if determined by spp and bpp - tsize_t linebytes = (tsize_t)image->GetWidth() * spp * bpp / 8; + if (extraSamples) + { + uint16 extra[] = { EXTRASAMPLE_UNSPECIFIED }; + TIFFSetField(tif, TIFFTAG_EXTRASAMPLES, (long) 1, &extra); + } - if ( (image->GetWidth() % 8 > 0) && (spp * bpp < 8) ) - linebytes+=1; + // scanlinesize is determined by spp+extraSamples and bps + const tsize_t linebytes = + (tsize_t)((imageWidth * (spp + extraSamples) * bps + 7) / 8); unsigned char *buf; - if (TIFFScanlineSize(tif) > linebytes || (spp * bpp < 24)) + const bool isColouredImage = (spp > 1) + && (photometric != PHOTOMETRIC_MINISWHITE) + && (photometric != PHOTOMETRIC_MINISBLACK); + + + if (TIFFScanlineSize(tif) > linebytes || !isColouredImage || hasAlpha) { buf = (unsigned char *)_TIFFmalloc(TIFFScanlineSize(tif)); if (!buf) @@ -607,27 +757,84 @@ bool wxTIFFHandler::SaveFile( wxImage *image, wxOutputStream& stream, bool verbo TIFFSetField(tif, TIFFTAG_ROWSPERSTRIP,TIFFDefaultStripSize(tif, (uint32) -1)); + const int bitsPerPixel = (spp + extraSamples) * bps; + const int bytesPerPixel = (bitsPerPixel + 7) / 8; + const int pixelsPerByte = 8 / bitsPerPixel; + int remainingPixelCount = 0; + + if (pixelsPerByte) + { + // How many pixels to write in the last byte column? + remainingPixelCount = imageWidth % pixelsPerByte; + if (!remainingPixelCount) remainingPixelCount = pixelsPerByte; + } + + const bool minIsWhite = (photometric == PHOTOMETRIC_MINISWHITE); unsigned char *ptr = image->GetData(); for ( int row = 0; row < image->GetHeight(); row++ ) { if ( buf ) { - if ( spp * bpp > 1 ) + if (isColouredImage) { - // color image - memcpy(buf, ptr, image->GetWidth()); + // colour image + if (hasAlpha) + { + for ( int column = 0; column < imageWidth; column++ ) + { + buf[column*4 ] = ptr[column*3 ]; + buf[column*4 + 1] = ptr[column*3 + 1]; + buf[column*4 + 2] = ptr[column*3 + 2]; + buf[column*4 + 3] = image->GetAlpha(column, row); + } + } + else + { + memcpy(buf, ptr, imageWidth * 3); + } + } + else if (spp * bps == 8) // greyscale image + { + for ( int column = 0; column < imageWidth; column++ ) + { + uint8 value = ptr[column*3 + 1]; + if (minIsWhite) + { + value = 255 - value; + } + + buf[column * bytesPerPixel] = value; + + if (hasAlpha) + { + value = image->GetAlpha(column, row); + buf[column*bytesPerPixel+1] + = minIsWhite ? 255 - value : value; + } + } } else // black and white image { for ( int column = 0; column < linebytes; column++ ) { uint8 reverse = 0; - for ( int bp = 0; bp < 8; bp++ ) + int pixelsPerByteCount = (column + 1 != linebytes) + ? pixelsPerByte + : remainingPixelCount; + for ( int bp = 0; bp < pixelsPerByteCount; bp++ ) { - if ( ptr[column*24 + bp*3] > 0 ) + if ( (ptr[column * 3 * pixelsPerByte + bp*3 + 1] <=127) + == minIsWhite ) { - // check only red as this is sufficient - reverse = (uint8)(reverse | 128 >> bp); + // check only green as this is sufficient + reverse |= (uint8) (128 >> (bp * bitsPerPixel)); + } + + if (hasAlpha + && (image->GetAlpha(column * pixelsPerByte + bp, + row) <= 127) == minIsWhite) + { + reverse |= (uint8) (64 >> (bp * bitsPerPixel)); } } @@ -650,7 +857,7 @@ bool wxTIFFHandler::SaveFile( wxImage *image, wxOutputStream& stream, bool verbo return false; } - ptr += image->GetWidth()*3; + ptr += imageWidth * 3; } (void) TIFFClose(tif); diff --git a/Externals/wxWidgets3/src/common/imagxpm.cpp b/Externals/wxWidgets3/src/common/imagxpm.cpp index 1b1fea5924..917b0aa157 100644 --- a/Externals/wxWidgets3/src/common/imagxpm.cpp +++ b/Externals/wxWidgets3/src/common/imagxpm.cpp @@ -2,7 +2,7 @@ // Name: src/common/imagxpm.cpp // Purpose: wxXPMHandler // Author: Vaclav Slavik, Robert Roebling -// RCS-ID: $Id: imagxpm.cpp 60852 2009-06-01 11:43:36Z FM $ +// RCS-ID: $Id: imagxpm.cpp 67681 2011-05-03 16:29:04Z DS $ // Copyright: (c) 2001 Vaclav Slavik // Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// @@ -97,7 +97,7 @@ bool wxXPMHandler::LoadFile(wxImage *image, wxXPMDecoder decoder; wxImage img = decoder.ReadFile(stream); - if ( !img.Ok() ) + if ( !img.IsOk() ) return false; *image = img; return true; diff --git a/Externals/wxWidgets3/src/common/init.cpp b/Externals/wxWidgets3/src/common/init.cpp index 654cb99976..fa8e2bef32 100644 --- a/Externals/wxWidgets3/src/common/init.cpp +++ b/Externals/wxWidgets3/src/common/init.cpp @@ -4,7 +4,7 @@ // Author: Vadim Zeitlin // Modified by: // Created: 04.10.99 -// RCS-ID: $Id: init.cpp 64656 2010-06-20 18:18:23Z VZ $ +// RCS-ID: $Id: init.cpp 70796 2012-03-04 00:29:31Z VZ $ // Copyright: (c) Vadim Zeitlin // Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// @@ -37,7 +37,7 @@ #include "wx/scopedptr.h" #include "wx/except.h" -#if defined(__WXMSW__) +#if defined(__WINDOWS__) #include "wx/msw/private.h" #include "wx/msw/msvcrt.h" @@ -53,7 +53,7 @@ } } gs_enableLeakChecks; #endif // wxCrtSetDbgFlag -#endif // __WXMSW__ +#endif // __WINDOWS__ // ---------------------------------------------------------------------------- // private classes @@ -238,7 +238,7 @@ static bool DoCommonPreInit() wxLog::GetActiveTarget(); #endif // wxUSE_LOG -#ifdef __WXMSW__ +#ifdef __WINDOWS__ // GUI applications obtain HINSTANCE in their WinMain() but we also need to // initialize the global wxhInstance variable for the console programs as // they may need it too, so set it here if it wasn't done yet @@ -246,7 +246,7 @@ static bool DoCommonPreInit() { wxSetInstance(::GetModuleHandle(NULL)); } -#endif // __WXMSW__ +#endif // __WINDOWS__ return true; } @@ -432,9 +432,9 @@ void wxEntryCleanup() // ---------------------------------------------------------------------------- // for MSW the real wxEntry is defined in msw/main.cpp -#ifndef __WXMSW__ +#ifndef __WINDOWS__ #define wxEntryReal wxEntry -#endif // !__WXMSW__ +#endif // !__WINDOWS__ int wxEntryReal(int& argc, wxChar **argv) { diff --git a/Externals/wxWidgets3/src/common/intl.cpp b/Externals/wxWidgets3/src/common/intl.cpp index dc3d1ca154..2f1874f363 100644 --- a/Externals/wxWidgets3/src/common/intl.cpp +++ b/Externals/wxWidgets3/src/common/intl.cpp @@ -5,7 +5,7 @@ // Modified by: Michael N. Filippov // (2003/09/30 - PluralForms support) // Created: 29/01/98 -// RCS-ID: $Id: intl.cpp 67280 2011-03-22 14:17:38Z DS $ +// RCS-ID: $Id: intl.cpp 70796 2012-03-04 00:29:31Z VZ $ // Copyright: (c) 1998 Vadim Zeitlin // Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// @@ -121,7 +121,7 @@ inline wxString ExtractNotLang(const wxString& langFull) // wxLanguageInfo // ---------------------------------------------------------------------------- -#ifdef __WXMSW__ +#ifdef __WINDOWS__ // helper used by wxLanguageInfo::GetLocaleName() and elsewhere to determine // whether the locale is Unicode-only (it is if this function returns empty @@ -177,7 +177,7 @@ wxString wxLanguageInfo::GetLocaleName() const return locale; } -#endif // __WXMSW__ +#endif // __WINDOWS__ // ---------------------------------------------------------------------------- // wxLocale @@ -1033,7 +1033,14 @@ wxLocale::~wxLocale() bool wxLocale::IsAvailable(int lang) { const wxLanguageInfo *info = wxLocale::GetLanguageInfo(lang); - wxCHECK_MSG( info, false, wxS("invalid language") ); + if ( !info ) + { + // The language is unknown (this normally only happens when we're + // passed wxLANGUAGE_DEFAULT), so we can't support it. + wxASSERT_MSG( lang == wxLANGUAGE_DEFAULT, + wxS("No info for a valid language?") ); + return false; + } #if defined(__WIN32__) if ( !info->WinLang ) @@ -1045,16 +1052,21 @@ bool wxLocale::IsAvailable(int lang) #elif defined(__UNIX__) // Test if setting the locale works, then set it back. - const char *oldLocale = wxSetlocaleTryUTF8(LC_ALL, info->CanonicalName); - if ( !oldLocale ) - { - // Some C libraries don't like xx_YY form and require xx only - oldLocale = wxSetlocaleTryUTF8(LC_ALL, ExtractLang(info->CanonicalName)); - if ( !oldLocale ) - return false; - } + char * const oldLocale = wxStrdupA(setlocale(LC_ALL, NULL)); + + // Some platforms don't like xx_YY form and require xx only so test for + // it too. + const bool + available = wxSetlocaleTryUTF8(LC_ALL, info->CanonicalName) || + wxSetlocaleTryUTF8(LC_ALL, ExtractLang(info->CanonicalName)); + // restore the original locale wxSetlocale(LC_ALL, oldLocale); + + free(oldLocale); + + if ( !available ) + return false; #endif return true; @@ -1114,7 +1126,7 @@ wxString wxLocale::GetHeaderValue(const wxString& header, // accessors for locale-dependent data // ---------------------------------------------------------------------------- -#if defined(__WXMSW__) || defined(__WXOSX__) +#if defined(__WINDOWS__) || defined(__WXOSX__) namespace { @@ -1136,7 +1148,7 @@ static wxString TranslateFromUnicodeFormat(const wxString& fmt) const char* formatchars = "dghHmMsSy" -#ifdef __WXMSW__ +#ifdef __WINDOWS__ "t" #else "EawD" @@ -1176,7 +1188,7 @@ static wxString TranslateFromUnicodeFormat(const wxString& fmt) // between 1 and 2 digits for days fmtWX += "%d"; break; -#ifdef __WXMSW__ +#ifdef __WINDOWS__ case 3: // ddd fmtWX += "%a"; break; @@ -1189,7 +1201,7 @@ static wxString TranslateFromUnicodeFormat(const wxString& fmt) wxFAIL_MSG( "too many 'd's" ); } break; -#ifndef __WXMSW__ +#ifndef __WINDOWS__ case 'D': switch ( lastCount ) { @@ -1332,12 +1344,12 @@ static wxString TranslateFromUnicodeFormat(const wxString& fmt) wxASSERT_MSG( lastCount <= 2, "too many 'g's" ); break; -#ifndef __WXMSW__ +#ifndef __WINDOWS__ case 'a': fmtWX += "%p"; break; #endif -#ifdef __WXMSW__ +#ifdef __WINDOWS__ case 't': switch ( lastCount ) { @@ -1377,9 +1389,9 @@ static wxString TranslateFromUnicodeFormat(const wxString& fmt) } // anonymous namespace -#endif // __WXMSW__ || __WXOSX__ +#endif // __WINDOWS__ || __WXOSX__ -#if defined(__WXMSW__) +#if defined(__WINDOWS__) namespace { @@ -1437,7 +1449,23 @@ wxString wxLocale::GetInfo(wxLocaleInfo index, wxLocaleCategory cat) : LOCALE_SDECIMAL, buf, WXSIZEOF(buf)) ) + { str = buf; + + // As we get our decimal point separator from Win32 and not the + // CRT there is a possibility of mismatch between them and this + // can easily happen if the user code called setlocale() + // instead of using wxLocale to change the locale. And this can + // result in very strange bugs elsewhere in the code as the + // assumptions that formatted strings do use the decimal + // separator actually fail, so check for it here. + wxASSERT_MSG + ( + wxString::Format("%.3f", 1.23).find(str) != wxString::npos, + "Decimal separator mismatch -- did you use setlocale()?" + "If so, use wxLocale to change the locale instead." + ); + } break; case wxLOCALE_SHORT_DATE_FMT: @@ -1554,7 +1582,7 @@ wxString wxLocale::GetInfo(wxLocaleInfo index, wxLocaleCategory WXUNUSED(cat)) return str.AsString(); } -#else // !__WXMSW__ && !__WXOSX__, assume generic POSIX +#else // !__WINDOWS__ && !__WXOSX__, assume generic POSIX namespace { diff --git a/Externals/wxWidgets3/src/common/languageinfo.cpp b/Externals/wxWidgets3/src/common/languageinfo.cpp index c476d3147e..a04c16e078 100644 --- a/Externals/wxWidgets3/src/common/languageinfo.cpp +++ b/Externals/wxWidgets3/src/common/languageinfo.cpp @@ -3,7 +3,7 @@ // Purpose: wxLocale::InitLanguagesDB() // Author: Vadim Zeitlin, Vaclav Slavik // Created: 2010-04-23 -// RCS-ID: $Id: languageinfo.cpp 67254 2011-03-20 00:14:35Z DS $ +// RCS-ID: $Id: languageinfo.cpp 67426 2011-04-10 15:35:56Z VZ $ // Copyright: (c) 1998 Vadim Zeitlin // Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// @@ -663,7 +663,7 @@ void wxLocale::InitLanguagesDB() LNG(wxLANGUAGE_ITALIAN, "it_IT", LANG_ITALIAN , SUBLANG_ITALIAN , wxLayout_LeftToRight, "Italian") LNG(wxLANGUAGE_ITALIAN_SWISS, "it_CH", LANG_ITALIAN , SUBLANG_ITALIAN_SWISS , wxLayout_LeftToRight, "Italian (Swiss)") LNG(wxLANGUAGE_JAPANESE, "ja_JP", LANG_JAPANESE , SUBLANG_DEFAULT , wxLayout_LeftToRight, "Japanese") - LNG(wxLANGUAGE_JAVANESE, "jw" , 0 , 0 , wxLayout_LeftToRight, "Javanese") + LNG(wxLANGUAGE_JAVANESE, "jv" , 0 , 0 , wxLayout_LeftToRight, "Javanese") LNG(wxLANGUAGE_KANNADA, "kn" , LANG_KANNADA , SUBLANG_DEFAULT , wxLayout_LeftToRight, "Kannada") LNG(wxLANGUAGE_KASHMIRI, "ks" , LANG_KASHMIRI , SUBLANG_DEFAULT , wxLayout_LeftToRight, "Kashmiri") LNG(wxLANGUAGE_KASHMIRI_INDIA, "ks_IN", LANG_KASHMIRI , SUBLANG_KASHMIRI_INDIA , wxLayout_LeftToRight, "Kashmiri (India)") diff --git a/Externals/wxWidgets3/src/common/list.cpp b/Externals/wxWidgets3/src/common/list.cpp index 4a397d04a6..6ad2926ac9 100644 --- a/Externals/wxWidgets3/src/common/list.cpp +++ b/Externals/wxWidgets3/src/common/list.cpp @@ -4,7 +4,7 @@ // Author: Julian Smart // Modified by: VZ at 16/11/98: WX_DECLARE_LIST() and typesafe lists added // Created: 04/01/98 -// RCS-ID: $Id: list.cpp 61508 2009-07-23 20:30:22Z VZ $ +// RCS-ID: $Id: list.cpp 67769 2011-05-20 14:29:07Z VZ $ // Copyright: (c) Julian Smart // Licence: wxWindows licence //////////////////////////////////////////////////////////////////////////////// @@ -33,7 +33,7 @@ #include "wx/crt.h" #endif -#if !wxUSE_STL +#if !wxUSE_STD_CONTAINERS // ============================================================================= // implementation @@ -171,22 +171,18 @@ void wxListBase::DoCopy(const wxListBase& list) { case wxKEY_INTEGER: { - long key; for ( wxNodeBase *node = list.GetFirst(); node; node = node->GetNext() ) { - key = node->GetKeyInteger(); - Append(key, node->GetData()); + Append(node->GetKeyInteger(), node->GetData()); } break; } case wxKEY_STRING: { - const wxChar *key; for ( wxNodeBase *node = list.GetFirst(); node; node = node->GetNext() ) { - key = node->GetKeyString(); - Append(key, node->GetData()); + Append(node->GetKeyString(), node->GetData()); } break; } @@ -756,16 +752,16 @@ wxNode *wxStringList::Prepend(const wxChar *s) #endif // wxLIST_COMPATIBILITY -#else // wxUSE_STL = 1 +#else // wxUSE_STD_CONTAINERS = 1 #include "wx/listimpl.cpp" WX_DEFINE_LIST(wxObjectList) -// with wxUSE_STL wxStringList contains wxString objects, not pointers +// with wxUSE_STD_CONTAINERS wxStringList contains wxString objects, not pointers void _WX_LIST_HELPER_wxStringListBase::DeleteFunction( wxString WXUNUSED(X) ) { } wxStringListBase::BaseListType wxStringListBase::EmptyList; -#endif // !wxUSE_STL +#endif // !wxUSE_STD_CONTAINERS diff --git a/Externals/wxWidgets3/src/common/listctrlcmn.cpp b/Externals/wxWidgets3/src/common/listctrlcmn.cpp index 220eaa3f0e..dd7fc610b0 100644 --- a/Externals/wxWidgets3/src/common/listctrlcmn.cpp +++ b/Externals/wxWidgets3/src/common/listctrlcmn.cpp @@ -3,7 +3,7 @@ // Purpose: Common defines for wxListCtrl and wxListCtrl-based classes. // Author: Kevin Ollivier // Created: 09/15/06 -// RCS-ID: $Id: listctrlcmn.cpp 66555 2011-01-04 08:31:53Z SC $ +// RCS-ID: $Id: listctrlcmn.cpp 70284 2012-01-07 15:09:51Z VZ $ // Copyright: (c) Kevin Ollivier // Licence: wxWindows licence //////////////////////////////////////////////////////////////////////////////// @@ -27,6 +27,10 @@ #include "wx/listctrl.h" +#ifndef WX_PRECOMP + #include "wx/dcclient.h" +#endif + const char wxListCtrlNameStr[] = "listCtrl"; // ListCtrl events @@ -128,4 +132,83 @@ IMPLEMENT_DYNAMIC_CLASS(wxListView, wxListCtrl) IMPLEMENT_DYNAMIC_CLASS(wxListItem, wxObject) IMPLEMENT_DYNAMIC_CLASS(wxListEvent, wxNotifyEvent) +// ---------------------------------------------------------------------------- +// wxListCtrlBase implementation +// ---------------------------------------------------------------------------- + +long +wxListCtrlBase::AppendColumn(const wxString& heading, + int format, + int width) +{ + return InsertColumn(GetColumnCount(), heading, format, width); +} + +long +wxListCtrlBase::InsertColumn(long col, + const wxString& heading, + int format, + int width) +{ + wxListItem item; + item.m_mask = wxLIST_MASK_TEXT | wxLIST_MASK_FORMAT; + item.m_text = heading; + if ( width >= 0 + || width == wxLIST_AUTOSIZE + || width == wxLIST_AUTOSIZE_USEHEADER ) + { + item.m_mask |= wxLIST_MASK_WIDTH; + item.m_width = width; + } + item.m_format = format; + + return InsertColumn(col, item); +} + +long wxListCtrlBase::InsertColumn(long col, const wxListItem& info) +{ + long rc = DoInsertColumn(col, info); + if ( rc != -1 ) + { + // As our best size calculation depends on the column headers, + // invalidate the previously cached best size when a column is added. + InvalidateBestSize(); + } + + return rc; +} + +wxSize wxListCtrlBase::DoGetBestClientSize() const +{ + // There is no obvious way to determine the best size in icon and list + // modes so just don't do it for now. + if ( !InReportView() ) + return wxControl::DoGetBestClientSize(); + + // In report mode, we use only the column headers, not items, to determine + // the best width. The reason for this is that it's easier (we can't just + // iterate over all items, especially not in a virtual control, so we'd + // have to do something relatively complicated such as checking the size of + // some items in the beginning and the end only) and also because the + // columns are usually static while the list contents is dynamic so it + // usually doesn't make much sense to adjust the control size to it anyhow. + // And finally, scrollbars can always be used with the items while the + // headers are just truncated if there is not enough place for them. + const int columns = GetColumnCount(); + if ( HasFlag(wxLC_NO_HEADER) || !columns ) + return wxControl::DoGetBestClientSize(); + + wxClientDC dc(const_cast(this)); + + // Total width of all headers determines the best control width. + int totalWidth = 0; + for ( int col = 0; col < columns; col++ ) + { + totalWidth += GetColumnWidth(col); + } + + // Use some arbitrary height, there is no good way to determine it. + return wxSize(totalWidth, 10*dc.GetCharHeight()); +} + #endif // wxUSE_LISTCTRL diff --git a/Externals/wxWidgets3/src/common/log.cpp b/Externals/wxWidgets3/src/common/log.cpp index 0a3ae3d03a..33a86d1763 100644 --- a/Externals/wxWidgets3/src/common/log.cpp +++ b/Externals/wxWidgets3/src/common/log.cpp @@ -4,7 +4,7 @@ // Author: Vadim Zeitlin // Modified by: // Created: 29/01/98 -// RCS-ID: $Id: log.cpp 67268 2011-03-21 10:59:59Z VZ $ +// RCS-ID: $Id: log.cpp 70796 2012-03-04 00:29:31Z VZ $ // Copyright: (c) 1998 Vadim Zeitlin // Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// @@ -53,13 +53,11 @@ #include -#ifndef __WXPALMOS5__ #ifndef __WXWINCE__ #include #else #include "wx/msw/wince/time.h" #endif -#endif /* ! __WXPALMOS5__ */ #if defined(__WINDOWS__) #include "wx/msw/private.h" // includes windows.h @@ -204,6 +202,62 @@ void wxSafeShowMessage(const wxString& title, const wxString& text) #endif } +// ---------------------------------------------------------------------------- +// wxLogFormatter class implementation +// ---------------------------------------------------------------------------- + +wxString +wxLogFormatter::Format(wxLogLevel level, + const wxString& msg, + const wxLogRecordInfo& info) const +{ + wxString prefix; + + // don't time stamp debug messages under MSW as debug viewers usually + // already have an option to do it +#ifdef __WINDOWS__ + if ( level != wxLOG_Debug && level != wxLOG_Trace ) +#endif // __WINDOWS__ + prefix = FormatTime(info.timestamp); + + switch ( level ) + { + case wxLOG_Error: + prefix += _("Error: "); + break; + + case wxLOG_Warning: + prefix += _("Warning: "); + break; + + // don't prepend "debug/trace" prefix under MSW as it goes to the debug + // window anyhow and so can't be confused with something else +#ifndef __WINDOWS__ + case wxLOG_Debug: + // this prefix (as well as the one below) is intentionally not + // translated as nobody translates debug messages anyhow + prefix += "Debug: "; + break; + + case wxLOG_Trace: + prefix += "Trace: "; + break; +#endif // !__WINDOWS__ + } + + return prefix + msg; +} + +wxString +wxLogFormatter::FormatTime(time_t t) const +{ + wxString str; + wxLog::TimeStamp(&str, t); + + return str; +} + + // ---------------------------------------------------------------------------- // wxLog class implementation // ---------------------------------------------------------------------------- @@ -216,12 +270,24 @@ unsigned wxLog::LogLastRepeatIfNeeded() { wxString msg; #if wxUSE_INTL - msg.Printf(wxPLURAL("The previous message repeated once.", - "The previous message repeated %lu times.", - gs_prevLog.numRepeated), - gs_prevLog.numRepeated); + if ( gs_prevLog.numRepeated == 1 ) + { + // We use a separate message for this case as "repeated 1 time" + // looks somewhat strange. + msg = _("The previous message repeated once."); + } + else + { + // Notice that we still use wxPLURAL() to ensure that multiple + // numbers of times are correctly formatted, even though we never + // actually use the singular string. + msg.Printf(wxPLURAL("The previous message repeated %lu time.", + "The previous message repeated %lu times.", + gs_prevLog.numRepeated), + gs_prevLog.numRepeated); + } #else - msg.Printf(wxS("The previous message was repeated %lu times."), + msg.Printf(wxS("The previous message was repeated %lu time(s)."), gs_prevLog.numRepeated); #endif gs_prevLog.numRepeated = 0; @@ -240,11 +306,22 @@ wxLog::~wxLog() { wxMessageOutputDebug().Printf ( - wxS("Last repeated message (\"%s\", %lu times) wasn't output"), +#if wxUSE_INTL + wxPLURAL + ( + "Last repeated message (\"%s\", %lu time) wasn't output", + "Last repeated message (\"%s\", %lu times) wasn't output", + gs_prevLog.numRepeated + ), +#else + wxS("Last repeated message (\"%s\", %lu time(s)) wasn't output"), +#endif gs_prevLog.msg, gs_prevLog.numRepeated ); } + + delete m_formatter; } // ---------------------------------------------------------------------------- @@ -276,11 +353,7 @@ wxLog::OnLog(wxLogLevel level, { wxSafeShowMessage(wxS("Fatal Error"), msg); -#ifdef __WXWINCE__ - ExitThread(3); -#else - abort(); -#endif + wxAbort(); } wxLog *logger; @@ -383,47 +456,8 @@ void wxLog::DoLogRecord(wxLogLevel level, wxUnusedVar(info); #endif // WXWIN_COMPATIBILITY_2_8/!WXWIN_COMPATIBILITY_2_8 - - // TODO: it would be better to extract message formatting in a separate - // wxLogFormatter class but for now we hard code formatting here - - wxString prefix; - - // don't time stamp debug messages under MSW as debug viewers usually - // already have an option to do it -#ifdef __WXMSW__ - if ( level != wxLOG_Debug && level != wxLOG_Trace ) -#endif // __WXMSW__ - TimeStamp(&prefix); - - // TODO: use the other wxLogRecordInfo fields - - switch ( level ) - { - case wxLOG_Error: - prefix += _("Error: "); - break; - - case wxLOG_Warning: - prefix += _("Warning: "); - break; - - // don't prepend "debug/trace" prefix under MSW as it goes to the debug - // window anyhow and so can't be confused with something else -#ifndef __WXMSW__ - case wxLOG_Debug: - // this prefix (as well as the one below) is intentionally not - // translated as nobody translates debug messages anyhow - prefix += "Debug: "; - break; - - case wxLOG_Trace: - prefix += "Trace: "; - break; -#endif // !__WXMSW__ - } - - DoLogTextAtLevel(level, prefix + msg); + // Use wxLogFormatter to format the message + DoLogTextAtLevel(level, m_formatter->Format (level, msg, info)); } void wxLog::DoLogTextAtLevel(wxLogLevel level, const wxString& msg) @@ -671,17 +705,38 @@ void wxLog::ClearTraceMasks() // wxLog miscellaneous other methods // ---------------------------------------------------------------------------- +#if wxUSE_DATETIME + void wxLog::TimeStamp(wxString *str) { -#if wxUSE_DATETIME if ( !ms_timestamp.empty() ) { *str = wxDateTime::UNow().Format(ms_timestamp); *str += wxS(": "); } -#endif // wxUSE_DATETIME } +void wxLog::TimeStamp(wxString *str, time_t t) +{ + if ( !ms_timestamp.empty() ) + { + *str = wxDateTime(t).Format(ms_timestamp); + *str += wxS(": "); + } +} + +#else // !wxUSE_DATETIME + +void wxLog::TimeStamp(wxString*) +{ +} + +void wxLog::TimeStamp(wxString*, time_t) +{ +} + +#endif // wxUSE_DATETIME/!wxUSE_DATETIME + #if wxUSE_THREADS void wxLog::FlushThreadMessages() @@ -724,6 +779,14 @@ bool wxLog::EnableThreadLogging(bool enable) #endif // wxUSE_THREADS +wxLogFormatter *wxLog::SetFormatter(wxLogFormatter* formatter) +{ + wxLogFormatter* formatterOld = m_formatter; + m_formatter = formatter ? formatter : new wxLogFormatter; + + return formatterOld; +} + void wxLog::Flush() { LogLastRepeatIfNeeded(); @@ -985,7 +1048,7 @@ static void wxLogWrap(FILE *f, const char *pszPrefix, const char *psz) // get error code from syste unsigned long wxSysErrorCode() { -#if defined(__WXMSW__) && !defined(__WXMICROWIN__) +#if defined(__WINDOWS__) && !defined(__WXMICROWIN__) return ::GetLastError(); #else //Unix return errno; @@ -998,7 +1061,7 @@ const wxChar *wxSysErrorMsg(unsigned long nErrCode) if ( nErrCode == 0 ) nErrCode = wxSysErrorCode(); -#if defined(__WXMSW__) && !defined(__WXMICROWIN__) +#if defined(__WINDOWS__) && !defined(__WXMICROWIN__) static wxChar s_szBuf[1024]; // get error message from system @@ -1046,7 +1109,7 @@ const wxChar *wxSysErrorMsg(unsigned long nErrCode) } return s_szBuf; -#else // !__WXMSW__ +#else // !__WINDOWS__ #if wxUSE_UNICODE static wchar_t s_wzBuf[1024]; wxConvCurrent->MB2WC(s_wzBuf, strerror((int)nErrCode), @@ -1055,7 +1118,7 @@ const wxChar *wxSysErrorMsg(unsigned long nErrCode) #else return strerror((int)nErrCode); #endif -#endif // __WXMSW__/!__WXMSW__ +#endif // __WINDOWS__/!__WINDOWS__ } #endif // wxUSE_LOG diff --git a/Externals/wxWidgets3/src/common/longlong.cpp b/Externals/wxWidgets3/src/common/longlong.cpp index 4358a51220..b34d53373c 100644 --- a/Externals/wxWidgets3/src/common/longlong.cpp +++ b/Externals/wxWidgets3/src/common/longlong.cpp @@ -6,7 +6,7 @@ // not documented and is for private use only. // Modified by: // Created: 10.02.99 -// RCS-ID: $Id: longlong.cpp 61508 2009-07-23 20:30:22Z VZ $ +// RCS-ID: $Id: longlong.cpp 67643 2011-04-28 16:16:16Z VZ $ // Copyright: (c) 1998 Vadim Zeitlin // Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// @@ -133,6 +133,22 @@ wxULongLongNative& wxULongLongNative::operator=(const class wxULongLongWx &ll) } #endif +#ifdef __VISUALC6__ +double wxULongLongNative::ToDouble() const +{ + // Work around the problem of casting unsigned __int64 to double in VC6 + // (which for unknown reasons only manifests itself in DLL builds, i.e. + // when using /MD). + static const __int64 int64_t_max = 9223372036854775807i64; + if ( m_ll <= int64_t_max ) + return wx_truncate_cast(double, (wxLongLong_t)m_ll); + + double d = wx_truncate_cast(double, int64_t_max); + d += (__int64)(m_ll - int64_t_max - 1); // The cast is safe because of -1 + return d + 1; +} +#endif // __VISUALC6__ + #endif // wxUSE_LONGLONG_NATIVE // ============================================================================ diff --git a/Externals/wxWidgets3/src/common/memory.cpp b/Externals/wxWidgets3/src/common/memory.cpp index b0001b1898..7eed146a4d 100644 --- a/Externals/wxWidgets3/src/common/memory.cpp +++ b/Externals/wxWidgets3/src/common/memory.cpp @@ -4,7 +4,7 @@ // Author: Arthur Seaton, Julian Smart // Modified by: // Created: 04/01/98 -// RCS-ID: $Id: memory.cpp 66898 2011-02-16 05:13:00Z PC $ +// RCS-ID: $Id: memory.cpp 70796 2012-03-04 00:29:31Z VZ $ // Copyright: (c) Julian Smart // Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// @@ -21,7 +21,7 @@ #include "wx/memory.h" #ifndef WX_PRECOMP - #ifdef __WXMSW__ + #ifdef __WINDOWS__ #include "wx/msw/wrapwin.h" #endif #include "wx/utils.h" @@ -888,7 +888,7 @@ static MemoryCriticalSection memLocker; #endif // USE_THREADSAFE_MEMORY_ALLOCATION -#if !(defined(__WXMSW__) && (defined(WXUSINGDLL) || defined(WXMAKINGDLL_BASE))) +#if !(defined(__WINDOWS__) && (defined(WXUSINGDLL) || defined(WXMAKINGDLL_BASE))) #if wxUSE_GLOBAL_MEMORY_OPERATORS void * operator new (size_t size, wxChar * fileName, int lineNum) { @@ -922,7 +922,7 @@ void operator delete[] (void * buf) } #endif // wxUSE_ARRAY_MEMORY_OPERATORS #endif // wxUSE_GLOBAL_MEMORY_OPERATORS -#endif // !(defined(__WXMSW__) && (defined(WXUSINGDLL) || defined(WXMAKINGDLL_BASE))) +#endif // !(defined(__WINDOWS__) && (defined(WXUSINGDLL) || defined(WXMAKINGDLL_BASE))) // TODO: store whether this is a vector or not. void * wxDebugAlloc(size_t size, wxChar * fileName, int lineNum, bool isObject, bool WXUNUSED(isVect) ) @@ -1045,7 +1045,7 @@ void wxTrace(const wxChar * ...) va_start(ap, fmt); -#ifdef __WXMSW__ +#ifdef __WINDOWS__ wvsprintf(buffer,fmt,ap) ; #else vsprintf(buffer,fmt,ap) ; @@ -1059,7 +1059,7 @@ void wxTrace(const wxChar * ...) wxDebugContext::GetStream().flush(); } else -#ifdef __WXMSW__ +#ifdef __WINDOWS__ #ifdef __WIN32__ OutputDebugString((LPCTSTR)buffer) ; #else @@ -1085,7 +1085,7 @@ void wxTraceLevel(int, const wxChar * ...) va_start(ap, fmt); -#ifdef __WXMSW__ +#ifdef __WINDOWS__ wxWvsprintf(buffer,fmt,ap) ; #else vsprintf(buffer,fmt,ap) ; @@ -1099,7 +1099,7 @@ void wxTraceLevel(int, const wxChar * ...) wxDebugContext::GetStream().flush(); } else -#ifdef __WXMSW__ +#ifdef __WINDOWS__ #ifdef __WIN32__ OutputDebugString((LPCTSTR)buffer) ; #else diff --git a/Externals/wxWidgets3/src/common/menucmn.cpp b/Externals/wxWidgets3/src/common/menucmn.cpp index 0f7cd52ca7..78d78e0b08 100644 --- a/Externals/wxWidgets3/src/common/menucmn.cpp +++ b/Externals/wxWidgets3/src/common/menucmn.cpp @@ -4,7 +4,7 @@ // Author: Vadim Zeitlin // Modified by: // Created: 26.10.99 -// RCS-ID: $Id: menucmn.cpp 67210 2011-03-16 07:00:59Z SC $ +// RCS-ID: $Id: menucmn.cpp 70479 2012-01-30 16:05:03Z SC $ // Copyright: (c) wxWidgets team // Licence: wxWindows licence /////////////////////////////////////////////////////////////////////////////// @@ -597,17 +597,10 @@ wxMenuItem* wxMenuBase::FindItemByPosition(size_t position) const // window will be used. void wxMenuBase::UpdateUI(wxEvtHandler* source) { - if (GetInvokingWindow()) - { - // Don't update menus if the parent - // frame is about to get deleted - wxWindow *tlw = wxGetTopLevelParent( GetInvokingWindow() ); - if (tlw && wxPendingDelete.Member(tlw)) - return; - } + wxWindow * const win = GetWindow(); - if ( !source && GetInvokingWindow() ) - source = GetInvokingWindow()->GetEventHandler(); + if ( !source && win ) + source = win->GetEventHandler(); if ( !source ) source = GetEventHandler(); if ( !source ) @@ -1045,18 +1038,13 @@ wxString wxMenuBarBase::GetHelpString(int itemid) const void wxMenuBarBase::UpdateMenus() { - wxEvtHandler* source; wxMenu* menu; int nCount = GetMenuCount(); for (int n = 0; n < nCount; n++) { menu = GetMenu( n ); if (menu != NULL) - { - source = menu->GetEventHandler(); - if (source != NULL) - menu->UpdateUI( source ); - } + menu->UpdateUI( NULL ); } } diff --git a/Externals/wxWidgets3/src/common/mimecmn.cpp b/Externals/wxWidgets3/src/common/mimecmn.cpp index 52cfcf6afe..e8b7652175 100644 --- a/Externals/wxWidgets3/src/common/mimecmn.cpp +++ b/Externals/wxWidgets3/src/common/mimecmn.cpp @@ -5,7 +5,7 @@ // Modified by: // Chris Elliott (biol75@york.ac.uk) 5 Dec 00: write support for Win32 // Created: 23.09.98 -// RCS-ID: $Id: mimecmn.cpp 64671 2010-06-21 16:36:45Z SC $ +// RCS-ID: $Id: mimecmn.cpp 70796 2012-03-04 00:29:31Z VZ $ // Copyright: (c) 1998 Vadim Zeitlin // Licence: wxWindows licence (part of wxExtra library) ///////////////////////////////////////////////////////////////////////////// @@ -46,7 +46,7 @@ #include // implementation classes: -#if defined(__WXMSW__) +#if defined(__WINDOWS__) #include "wx/msw/mimetype.h" #elif ( defined(__WXMAC__) ) #include "wx/osx/mimetype.h" @@ -346,9 +346,9 @@ bool wxFileType::GetIcon(wxIconLocation *iconLoc) const if ( iconLoc ) { iconLoc->SetFileName(m_info->GetIconFile()); -#ifdef __WXMSW__ +#ifdef __WINDOWS__ iconLoc->SetIndex(m_info->GetIconIndex()); -#endif // __WXMSW__ +#endif // __WINDOWS__ } return true; @@ -444,9 +444,9 @@ size_t wxFileType::GetAllCommands(wxArrayString *verbs, if ( commands ) commands->Clear(); -#if defined (__WXMSW__) || defined(__UNIX__) +#if defined (__WINDOWS__) || defined(__UNIX__) return m_impl->GetAllCommands(verbs, commands, params); -#else // !__WXMSW__ || Unix +#else // !__WINDOWS__ || __UNIX__ // we don't know how to retrieve all commands, so just try the 2 we know // about size_t count = 0; @@ -471,12 +471,12 @@ size_t wxFileType::GetAllCommands(wxArrayString *verbs, } return count; -#endif // __WXMSW__/| __UNIX__ +#endif // __WINDOWS__/| __UNIX__ } bool wxFileType::Unassociate() { -#if defined(__WXMSW__) +#if defined(__WINDOWS__) return m_impl->Unassociate(); #elif defined(__UNIX__) return m_impl->Unassociate(this); @@ -490,7 +490,7 @@ bool wxFileType::SetCommand(const wxString& cmd, const wxString& verb, bool overwriteprompt) { -#if defined (__WXMSW__) || defined(__UNIX__) +#if defined (__WINDOWS__) || defined(__UNIX__) return m_impl->SetCommand(cmd, verb, overwriteprompt); #else wxUnusedVar(cmd); @@ -504,7 +504,7 @@ bool wxFileType::SetCommand(const wxString& cmd, bool wxFileType::SetDefaultIcon(const wxString& cmd, int index) { wxString sTmp = cmd; -#ifdef __WXMSW__ +#ifdef __WINDOWS__ // VZ: should we do this? // chris elliott : only makes sense in MS windows if ( sTmp.empty() ) @@ -512,7 +512,7 @@ bool wxFileType::SetDefaultIcon(const wxString& cmd, int index) #endif wxCHECK_MSG( !sTmp.empty(), false, wxT("need the icon file") ); -#if defined (__WXMSW__) || defined(__UNIX__) +#if defined (__WINDOWS__) || defined(__UNIX__) return m_impl->SetDefaultIcon (cmd, index); #else wxUnusedVar(index); @@ -610,7 +610,7 @@ wxMimeTypesManager::Associate(const wxFileTypeInfo& ftInfo) { EnsureImpl(); -#if defined(__WXMSW__) || defined(__UNIX__) +#if defined(__WINDOWS__) || defined(__UNIX__) return m_impl->Associate(ftInfo); #else // other platforms wxUnusedVar(ftInfo); diff --git a/Externals/wxWidgets3/src/common/msgout.cpp b/Externals/wxWidgets3/src/common/msgout.cpp index ae08c17a94..1b2a30e624 100644 --- a/Externals/wxWidgets3/src/common/msgout.cpp +++ b/Externals/wxWidgets3/src/common/msgout.cpp @@ -4,7 +4,7 @@ // Author: Mattia Barbon // Modified by: // Created: 17.07.02 -// RCS-ID: $Id: msgout.cpp 66592 2011-01-05 18:27:58Z PC $ +// RCS-ID: $Id: msgout.cpp 70808 2012-03-04 20:31:42Z VZ $ // Copyright: (c) the wxWidgets team // Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// @@ -163,7 +163,7 @@ void wxMessageOutputStderr::Output(const wxString& str) void wxMessageOutputDebug::Output(const wxString& str) { -#if defined(__WXMSW__) && !defined(__WXMICROWIN__) +#if defined(__WINDOWS__) && !defined(__WXMICROWIN__) wxString out(AppendLineFeedIfNeeded(str)); out.Replace(wxT("\t"), wxT(" ")); out.Replace(wxT("\n"), wxT("\r\n")); @@ -202,7 +202,7 @@ void wxMessageOutputMessageBox::Output(const wxString& str) wxString out(str); // the native MSW msg box understands the TABs, others don't -#ifndef __WXMSW__ +#ifndef __WINDOWS__ out.Replace(wxT("\t"), wxT(" ")); #endif diff --git a/Externals/wxWidgets3/src/common/nbkbase.cpp b/Externals/wxWidgets3/src/common/nbkbase.cpp index f491ec76e9..bbad0aa2ce 100644 --- a/Externals/wxWidgets3/src/common/nbkbase.cpp +++ b/Externals/wxWidgets3/src/common/nbkbase.cpp @@ -4,7 +4,7 @@ // Author: Vadim Zeitlin // Modified by: // Created: 02.07.01 -// RCS-ID: $Id: nbkbase.cpp 66643 2011-01-07 22:31:26Z SC $ +// RCS-ID: $Id: nbkbase.cpp 70814 2012-03-05 18:00:34Z JS $ // Copyright: (c) 2001 Vadim Zeitlin // Licence: wxWindows licence /////////////////////////////////////////////////////////////////////////////// @@ -84,7 +84,7 @@ wxFLAGS_MEMBER(wxNB_NOPAGETHEME) wxFLAGS_MEMBER(wxNB_FLAT) wxEND_FLAGS( wxNotebookStyle ) -#if wxUSE_EXTENDED_RTTI +#if wxUSE_EXTENDED_RTTI WX_DEFINE_LIST( wxNotebookPageInfoList ) @@ -119,7 +119,7 @@ wxCONSTRUCTOR_4( wxNotebookPageInfo, wxNotebookPage*, Page, \ void wxNotebookBase::AddPageInfo( wxNotebookPageInfo* info ) { - AddPage( info->GetPage(), info->GetText(), info->GetSelected(), info->GetImageId() ); + AddPage( info->GetPage(), info->GetText(), info->GetSelected(), info->GetImageId() ); } const wxNotebookPageInfoList& wxNotebookBase::GetPageInfos() const @@ -138,7 +138,7 @@ const wxNotebookPageInfoList& wxNotebookBase::GetPageInfos() const #endif -wxIMPLEMENT_DYNAMIC_CLASS_XTI(wxNotebook, wxControl, "wx/notebook.h") +wxIMPLEMENT_DYNAMIC_CLASS_XTI(wxNotebook, wxBookCtrlBase, "wx/notebook.h") wxBEGIN_PROPERTIES_TABLE(wxNotebook) wxEVENT_PROPERTY( PageChanging, wxEVT_COMMAND_NOTEBOOK_PAGE_CHANGING, wxNotebookEvent ) wxEVENT_PROPERTY( PageChanged, wxEVT_COMMAND_NOTEBOOK_PAGE_CHANGED, wxNotebookEvent ) diff --git a/Externals/wxWidgets3/src/common/numformatter.cpp b/Externals/wxWidgets3/src/common/numformatter.cpp index ab990d4d59..eb4583b520 100644 --- a/Externals/wxWidgets3/src/common/numformatter.cpp +++ b/Externals/wxWidgets3/src/common/numformatter.cpp @@ -21,6 +21,8 @@ #include "wx/numformatter.h" #include "wx/intl.h" +#include // for setlocale and LC_ALL + // ---------------------------------------------------------------------------- // local helpers // ---------------------------------------------------------------------------- @@ -39,7 +41,9 @@ class LocaleId public: LocaleId() { +#if wxUSE_INTL m_wxloc = NULL; +#endif // wxUSE_INTL m_cloc = NULL; } @@ -48,6 +52,7 @@ public: Free(); } +#if wxUSE_INTL // Return true if this is the first time this function is called for this // object or if the program locale has changed since the last time it was // called. Otherwise just return false indicating that updating locale- @@ -70,15 +75,20 @@ public: return true; } +#endif // wxUSE_INTL private: void Free() { +#if wxUSE_INTL free(m_cloc); +#endif // wxUSE_INTL } +#if wxUSE_INTL // Non-owned pointer to wxLocale which was used. wxLocale *m_wxloc; +#endif // wxUSE_INTL // Owned pointer to the C locale string. char *m_cloc; @@ -98,6 +108,7 @@ private: wxChar wxNumberFormatter::GetDecimalSeparator() { +#if wxUSE_INTL // Notice that while using static variable here is not MT-safe, the worst // that can happen is that we redo the initialization if we're called // concurrently from more than one thread so it's not a real problem. @@ -128,10 +139,14 @@ wxChar wxNumberFormatter::GetDecimalSeparator() } return s_decimalSeparator; +#else // !wxUSE_INTL + return wxT('.'); +#endif // wxUSE_INTL/!wxUSE_INTL } bool wxNumberFormatter::GetThousandsSeparatorIfUsed(wxChar *sep) { +#if wxUSE_INTL static wxChar s_thousandsSeparator = 0; static LocaleId s_localeUsedForInit; @@ -157,6 +172,10 @@ bool wxNumberFormatter::GetThousandsSeparatorIfUsed(wxChar *sep) *sep = s_thousandsSeparator; return true; +#else // !wxUSE_INTL + wxUnusedVar(sep); + return false; +#endif // wxUSE_INTL/!wxUSE_INTL } // ---------------------------------------------------------------------------- diff --git a/Externals/wxWidgets3/src/common/overlaycmn.cpp b/Externals/wxWidgets3/src/common/overlaycmn.cpp index e0bf7fd57b..4704a3114f 100644 --- a/Externals/wxWidgets3/src/common/overlaycmn.cpp +++ b/Externals/wxWidgets3/src/common/overlaycmn.cpp @@ -4,7 +4,7 @@ // Author: Stefan Csomor // Modified by: // Created: 2006-10-20 -// RCS-ID: $Id: overlaycmn.cpp 59033 2009-02-19 17:45:09Z PC $ +// RCS-ID: $Id: overlaycmn.cpp 67681 2011-05-03 16:29:04Z DS $ // Copyright: (c) wxWidgets team // Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// @@ -139,7 +139,7 @@ wxOverlayImpl::~wxOverlayImpl() bool wxOverlayImpl::IsOk() { - return m_bmpSaved.Ok() ; + return m_bmpSaved.IsOk() ; } void wxOverlayImpl::Init( wxDC* dc, int x , int y , int width , int height ) diff --git a/Externals/wxWidgets3/src/common/ownerdrwcmn.cpp b/Externals/wxWidgets3/src/common/ownerdrwcmn.cpp index 8cf566686d..24f8959814 100644 --- a/Externals/wxWidgets3/src/common/ownerdrwcmn.cpp +++ b/Externals/wxWidgets3/src/common/ownerdrwcmn.cpp @@ -4,7 +4,7 @@ // Author: Marcin Malich // Modified by: // Created: 2009-09-22 -// RCS-ID: $Id: ownerdrwcmn.cpp 63223 2010-01-23 13:21:36Z VZ $ +// RCS-ID: $Id: ownerdrwcmn.cpp 67681 2011-05-03 16:29:04Z DS $ // Copyright: (c) 2009 Marcin Malich // Licence: wxWindows licence /////////////////////////////////////////////////////////////////////////////// @@ -93,11 +93,11 @@ void wxOwnerDrawnBase::GetColourToUse(wxODStatus stat, wxColour& colText, wxColo } else { - colText = m_colText.Ok() ? m_colText + colText = m_colText.IsOk() ? m_colText : wxSystemSettings::GetColour(wxSYS_COLOUR_MENUTEXT); } - colBack = m_colBack.Ok() ? m_colBack + colBack = m_colBack.IsOk() ? m_colBack : wxSystemSettings::GetColour(wxSYS_COLOUR_MENU); } } diff --git a/Externals/wxWidgets3/src/common/panelcmn.cpp b/Externals/wxWidgets3/src/common/panelcmn.cpp index a4659cbde0..e91b8c0f66 100644 --- a/Externals/wxWidgets3/src/common/panelcmn.cpp +++ b/Externals/wxWidgets3/src/common/panelcmn.cpp @@ -4,7 +4,7 @@ // Author: Julian Smart, Robert Roebling, Vadim Zeitlin // Modified by: // Created: 04/01/98 -// RCS-ID: $Id: panelcmn.cpp 67251 2011-03-20 00:00:38Z VZ $ +// RCS-ID: $Id: panelcmn.cpp 68366 2011-07-24 22:19:33Z VZ $ // Copyright: (c) Julian Smart // Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// @@ -85,29 +85,14 @@ wxCONSTRUCTOR_6( wxPanel, wxWindow*, Parent, wxWindowID, Id, \ wxString, Name) -// ---------------------------------------------------------------------------- -// wxWin macros -// ---------------------------------------------------------------------------- - -BEGIN_EVENT_TABLE(wxPanelBase, wxWindow) - WX_EVENT_TABLE_CONTROL_CONTAINER(wxPanelBase) -END_EVENT_TABLE() - // ============================================================================ // implementation // ============================================================================ -WX_DELEGATE_TO_CONTROL_CONTAINER(wxPanelBase, wxWindow) - // ---------------------------------------------------------------------------- // wxPanelBase creation // ---------------------------------------------------------------------------- -wxPanelBase::wxPanelBase() -{ - WX_INIT_CONTROL_CONTAINER(); -} - bool wxPanelBase::Create(wxWindow *parent, wxWindowID id, const wxPoint& pos, const wxSize& size, diff --git a/Externals/wxWidgets3/src/common/persist.cpp b/Externals/wxWidgets3/src/common/persist.cpp index d2648cf653..84652a9e56 100644 --- a/Externals/wxWidgets3/src/common/persist.cpp +++ b/Externals/wxWidgets3/src/common/persist.cpp @@ -3,7 +3,7 @@ // Purpose: common persistence support classes // Author: Vadim Zeitlin // Created: 2009-01-20 -// RCS-ID: $Id: persist.cpp 61724 2009-08-21 10:41:26Z VZ $ +// RCS-ID: $Id: persist.cpp 69583 2011-10-30 10:08:18Z VZ $ // Copyright: (c) 2009 Vadim Zeitlin // Licence: wxWindows licence /////////////////////////////////////////////////////////////////////////////// @@ -30,16 +30,34 @@ #include "wx/persist.h" +namespace +{ + +wxPersistenceManager* gs_manager = NULL; + +} // anonymous namespace + // ============================================================================ // wxPersistenceManager implementation // ============================================================================ +/* static */ +void wxPersistenceManager::Set(wxPersistenceManager& manager) +{ + gs_manager = &manager; +} + /* static */ wxPersistenceManager& wxPersistenceManager::Get() { - static wxPersistenceManager s_manager; + if ( !gs_manager ) + { + static wxPersistenceManager s_manager; - return s_manager; + gs_manager = &s_manager; + } + + return *gs_manager; } wxPersistenceManager::~wxPersistenceManager() diff --git a/Externals/wxWidgets3/src/common/pickerbase.cpp b/Externals/wxWidgets3/src/common/pickerbase.cpp index 4dbd470d8f..5da75191e7 100644 --- a/Externals/wxWidgets3/src/common/pickerbase.cpp +++ b/Externals/wxWidgets3/src/common/pickerbase.cpp @@ -4,7 +4,7 @@ // Author: Francesco Montorsi // Modified by: // Created: 15/04/2006 -// RCS-ID: $Id: pickerbase.cpp 61724 2009-08-21 10:41:26Z VZ $ +// RCS-ID: $Id: pickerbase.cpp 68921 2011-08-27 14:11:25Z VZ $ // Copyright: (c) Francesco Montorsi // Licence: wxWindows licence /////////////////////////////////////////////////////////////////////////////// @@ -43,13 +43,6 @@ IMPLEMENT_ABSTRACT_CLASS(wxPickerBase, wxControl) -BEGIN_EVENT_TABLE(wxPickerBase, wxControl) - EVT_SIZE(wxPickerBase::OnSize) - WX_EVENT_TABLE_CONTROL_CONTAINER(wxPickerBase) -END_EVENT_TABLE() -WX_DELEGATE_TO_CONTROL_CONTAINER(wxPickerBase, wxControl) - - // ---------------------------------------------------------------------------- // wxPickerBase // ---------------------------------------------------------------------------- @@ -123,6 +116,21 @@ void wxPickerBase::PostCreation() // associated with it - in that case it defaults to 0 m_sizer->Add(m_picker, HasTextCtrl() ? 0 : 1, GetDefaultPickerCtrlFlag(), 5); + // For aesthetic reasons, make sure the picker is at least as high as the + // associated text control and is always at least square, unless we are + // explicitly using wxPB_SMALL style to force it to take as little space as + // possible. + if ( !HasFlag(wxPB_SMALL) ) + { + const wxSize pickerBestSize(m_picker->GetBestSize()); + const wxSize textBestSize( HasTextCtrl() ? m_text->GetBestSize() : wxSize()); + wxSize pickerMinSize; + pickerMinSize.y = wxMax(pickerBestSize.y, textBestSize.y); + pickerMinSize.x = wxMax(pickerBestSize.x, pickerMinSize.y); + if ( pickerMinSize != pickerBestSize ) + m_picker->SetMinSize(pickerMinSize); + } + SetSizer(m_sizer); SetInitialSize( GetMinSize() ); @@ -169,11 +177,4 @@ void wxPickerBase::OnTextCtrlUpdate(wxCommandEvent &) UpdatePickerFromTextCtrl(); } -void wxPickerBase::OnSize(wxSizeEvent &event) -{ - if (GetAutoLayout()) - Layout(); - event.Skip(); -} - #endif // Any picker in use diff --git a/Externals/wxWidgets3/src/common/platinfo.cpp b/Externals/wxWidgets3/src/common/platinfo.cpp index 895d068b21..30ec0581ef 100644 --- a/Externals/wxWidgets3/src/common/platinfo.cpp +++ b/Externals/wxWidgets3/src/common/platinfo.cpp @@ -4,7 +4,7 @@ // Author: Francesco Montorsi // Modified by: // Created: 07.07.2006 (based on wxToolkitInfo) -// RCS-ID: $Id: platinfo.cpp 64940 2010-07-13 13:29:13Z VZ $ +// RCS-ID: $Id: platinfo.cpp 70353 2012-01-15 14:46:41Z VZ $ // Copyright: (c) 2006 Francesco Montorsi // Licence: wxWindows licence /////////////////////////////////////////////////////////////////////////////// @@ -67,9 +67,6 @@ static const wxChar* const wxOperatingSystemIdNames[] = wxT("DOS"), wxT("OS/2"), - - wxT("PalmOS"), - wxT("PalmOS(Over Linux)"), }; static const wxChar* const wxPortIdNames[] = @@ -78,14 +75,12 @@ static const wxChar* const wxPortIdNames[] = wxT("wxMSW"), wxT("wxMotif"), wxT("wxGTK"), - wxT("wxMGL"), + wxT("wxDFB"), wxT("wxX11"), wxT("wxOS2"), wxT("wxMac"), wxT("wxCocoa"), wxT("wxWinCE"), - wxT("wxPalmOS"), - wxT("wxDFB") }; static const wxChar* const wxArchitectureNames[] = diff --git a/Externals/wxWidgets3/src/common/popupcmn.cpp b/Externals/wxWidgets3/src/common/popupcmn.cpp index 2466863992..81dce737d4 100644 --- a/Externals/wxWidgets3/src/common/popupcmn.cpp +++ b/Externals/wxWidgets3/src/common/popupcmn.cpp @@ -4,7 +4,7 @@ // Author: Vadim Zeitlin // Modified by: // Created: 06.01.01 -// RCS-ID: $Id: popupcmn.cpp 64940 2010-07-13 13:29:13Z VZ $ +// RCS-ID: $Id: popupcmn.cpp 69966 2011-12-09 15:20:55Z VZ $ // Copyright: (c) 2001 Vadim Zeitlin // Licence: wxWindows licence /////////////////////////////////////////////////////////////////////////////// @@ -44,6 +44,11 @@ #ifdef __WXGTK__ #include + #if GTK_CHECK_VERSION(2,0,0) + #include "wx/gtk/private/gtk2-compat.h" + #else + #define gtk_widget_get_window(x) x->window + #endif #elif defined(__WXMSW__) #include "wx/msw/private.h" #elif defined(__WXX11__) @@ -71,6 +76,7 @@ public: protected: // event handlers void OnLeftDown(wxMouseEvent& event); + void OnCaptureLost(wxMouseCaptureLostEvent& event); private: wxPopupTransientWindow *m_popup; @@ -101,6 +107,7 @@ private: BEGIN_EVENT_TABLE(wxPopupWindowHandler, wxEvtHandler) EVT_LEFT_DOWN(wxPopupWindowHandler::OnLeftDown) + EVT_MOUSE_CAPTURE_LOST(wxPopupWindowHandler::OnCaptureLost) END_EVENT_TABLE() BEGIN_EVENT_TABLE(wxPopupFocusHandler, wxEvtHandler) @@ -109,7 +116,7 @@ BEGIN_EVENT_TABLE(wxPopupFocusHandler, wxEvtHandler) END_EVENT_TABLE() BEGIN_EVENT_TABLE(wxPopupTransientWindow, wxPopupWindow) -#if defined( __WXMSW__ ) || ( defined( __WXMAC__ ) && wxOSX_USE_CARBON ) +#if defined(__WXMSW__) ||(defined(__WXMAC__) && wxOSX_USE_CARBON) EVT_IDLE(wxPopupTransientWindow::OnIdle) #endif END_EVENT_TABLE() @@ -343,7 +350,7 @@ bool wxPopupTransientWindow::Show( bool show ) { gtk_grab_add( m_widget ); - gdk_pointer_grab( m_widget->window, TRUE, + gdk_pointer_grab( gtk_widget_get_window(m_widget), true, (GdkEventMask) (GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK | @@ -382,6 +389,20 @@ bool wxPopupTransientWindow::Show( bool show ) return ret; } +bool wxPopupTransientWindow::Destroy() +{ + // The popup window can be deleted at any moment, even while some events + // are still being processed for it, so delay its real destruction until + // the next idle time when we're sure that it's safe to really destroy it. + + wxCHECK_MSG( !wxPendingDelete.Member(this), false, + wxS("Shouldn't destroy the popup twice.") ); + + wxPendingDelete.Append(this); + + return true; +} + void wxPopupTransientWindow::Dismiss() { Hide(); @@ -405,7 +426,7 @@ bool wxPopupTransientWindow::ProcessLeftDown(wxMouseEvent& WXUNUSED(event)) return false; } -#if defined( __WXMSW__ ) || ( defined( __WXMAC__ ) && wxOSX_USE_CARBON ) +#if defined(__WXMSW__) ||(defined(__WXMAC__) && wxOSX_USE_CARBON) void wxPopupTransientWindow::OnIdle(wxIdleEvent& event) { event.Skip(); @@ -431,7 +452,7 @@ void wxPopupTransientWindow::OnIdle(wxIdleEvent& event) } } } -#endif // __WXMSW__ +#endif // wxOSX/Carbon #if wxUSE_COMBOBOX && defined(__WXUNIVERSAL__) @@ -581,6 +602,15 @@ void wxPopupWindowHandler::OnLeftDown(wxMouseEvent& event) #endif // __WXUNIVERSAL__ && wxUSE_SCROLLBAR } +void +wxPopupWindowHandler::OnCaptureLost(wxMouseCaptureLostEvent& WXUNUSED(event)) +{ + m_popup->DismissAndNotify(); + + // There is no need to skip the event here, normally we've already dealt + // with the focus loss. +} + // ---------------------------------------------------------------------------- // wxPopupFocusHandler // ---------------------------------------------------------------------------- diff --git a/Externals/wxWidgets3/src/common/powercmn.cpp b/Externals/wxWidgets3/src/common/powercmn.cpp index ffd7cde09d..c8af67061f 100644 --- a/Externals/wxWidgets3/src/common/powercmn.cpp +++ b/Externals/wxWidgets3/src/common/powercmn.cpp @@ -4,7 +4,7 @@ // Author: Vadim Zeitlin // Modified by: // Created: 2006-05-27 -// RCS-ID: $Id: powercmn.cpp 58718 2009-02-07 18:59:25Z VZ $ +// RCS-ID: $Id: powercmn.cpp 70796 2012-03-04 00:29:31Z VZ $ // Copyright: (c) 2006 Vadim Zeitlin // Licence: wxWindows licence /////////////////////////////////////////////////////////////////////////////// @@ -43,7 +43,7 @@ #endif // provide stubs for the systems not implementing these functions -#if !defined(__WXPALMOS__) && !defined(__WXMSW__) +#if !defined(__WINDOWS__) wxPowerType wxGetPowerType() { diff --git a/Externals/wxWidgets3/src/common/prntbase.cpp b/Externals/wxWidgets3/src/common/prntbase.cpp index 068741712b..2dd209faf5 100644 --- a/Externals/wxWidgets3/src/common/prntbase.cpp +++ b/Externals/wxWidgets3/src/common/prntbase.cpp @@ -4,7 +4,7 @@ // Author: Julian Smart // Modified by: // Created: 04/01/98 -// RCS-ID: $Id: prntbase.cpp 67186 2011-03-14 11:54:35Z VZ $ +// RCS-ID: $Id: prntbase.cpp 68026 2011-06-22 22:58:07Z VZ $ // Copyright: (c) Julian Smart // Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// @@ -999,38 +999,90 @@ void wxPreviewCanvas::OnMouseWheel(wxMouseEvent& event) #endif // wxUSE_MOUSEWHEEL +namespace +{ + +// This is by the controls in the print preview as the maximal (and hence +// longest) page number we may have to display. +enum { MAX_PAGE_NUMBER = 99999 }; + +} // anonymous namespace + +// ---------------------------------------------------------------------------- +// wxPrintPageMaxCtrl +// ---------------------------------------------------------------------------- + +// A simple static control showing the maximal number of pages. +class wxPrintPageMaxCtrl : public wxStaticText +{ +public: + wxPrintPageMaxCtrl(wxWindow *parent) + : wxStaticText( + parent, + wxID_ANY, + wxString(), + wxDefaultPosition, + wxSize + ( + parent->GetTextExtent(MaxAsString(MAX_PAGE_NUMBER)).x, + wxDefaultCoord + ), + wxST_NO_AUTORESIZE | wxALIGN_CENTRE + ) + { + } + + // Set the maximal page to display once we really know what it is. + void SetMaxPage(int maxPage) + { + SetLabel(MaxAsString(maxPage)); + } + +private: + static wxString MaxAsString(int maxPage) + { + return wxString::Format("/ %d", maxPage); + } + + wxDECLARE_NO_COPY_CLASS(wxPrintPageMaxCtrl); +}; + // ---------------------------------------------------------------------------- // wxPrintPageTextCtrl // ---------------------------------------------------------------------------- -// This text control contains the page number in the interval specified during -// its construction. Invalid pages are not accepted and the control contents is -// validated when it loses focus. Conversely, if the user changes the page to -// another valid one or presses Enter, OnGotoPage() method of the preview object -// will be called. +// This text control contains the page number in the specified interval. +// +// Invalid pages are not accepted and the control contents is validated when it +// loses focus. Conversely, if the user changes the page to another valid one +// or presses Enter, OnGotoPage() method of the preview object will be called. class wxPrintPageTextCtrl : public wxTextCtrl { public: - wxPrintPageTextCtrl(wxPreviewControlBar *preview, int minPage, int maxPage) + wxPrintPageTextCtrl(wxPreviewControlBar *preview) : wxTextCtrl(preview, wxID_PREVIEW_GOTO, - PageAsString(minPage), + wxString(), wxDefaultPosition, - // We use hardcoded 99999 for the width instead of fitting - // it to the values we can show because the control looks - // uncomfortably narrow if the real page number is just - // one or two digits. - wxSize(preview->GetTextExtent("99999").x, wxDefaultCoord), + // We use hardcoded maximal page number for the width + // instead of fitting it to the values we can show because + // the control looks uncomfortably narrow if the real page + // number is just one or two digits. + wxSize + ( + preview->GetTextExtent(PageAsString(MAX_PAGE_NUMBER)).x, + wxDefaultCoord + ), wxTE_PROCESS_ENTER #if wxUSE_VALIDATORS , wxTextValidator(wxFILTER_DIGITS) #endif // wxUSE_VALIDATORS ), - m_preview(preview), - m_minPage(minPage), - m_maxPage(maxPage) + m_preview(preview) { - m_page = minPage; + m_minPage = + m_maxPage = + m_page = 1; Connect(wxEVT_KILL_FOCUS, wxFocusEventHandler(wxPrintPageTextCtrl::OnKillFocus)); @@ -1038,6 +1090,17 @@ public: wxCommandEventHandler(wxPrintPageTextCtrl::OnTextEnter)); } + // Update the pages range, must be called after OnPreparePrinting() as + // these values are not known before. + void SetPageInfo(int minPage, int maxPage) + { + m_minPage = minPage; + m_maxPage = maxPage; + + // Show the first page by default. + SetPageNumber(minPage); + } + // Helpers to conveniently set or get the current page number. Return value // is 0 if the current controls contents is invalid. void SetPageNumber(int page) @@ -1108,8 +1171,8 @@ private: wxPreviewControlBar * const m_preview; - const int m_minPage, - m_maxPage; + int m_minPage, + m_maxPage; // This is the last valid page value that we had, we revert to it if an // invalid page is entered. @@ -1155,6 +1218,7 @@ wxPanel(parent, wxID_ANY, pos, size, style, name) m_closeButton = NULL; m_zoomControl = NULL; m_currentPageText = NULL; + m_maxPageText = NULL; m_buttonFlags = buttons; } @@ -1436,18 +1500,11 @@ void wxPreviewControlBar::CreateButtons() if (m_buttonFlags & wxPREVIEW_GOTO) { - int minPage, maxPage, pageFrom, pageTo; - m_printPreview->GetPrintout()->GetPageInfo(&minPage, &maxPage, - &pageFrom, &pageTo); - - m_currentPageText = new wxPrintPageTextCtrl(this, minPage, maxPage); + m_currentPageText = new wxPrintPageTextCtrl(this); sizer.Add(m_currentPageText); - wxStaticText * - maxPageText = new wxStaticText(this, wxID_ANY, - wxString::Format("/ %d", maxPage)); - - sizer.Add(maxPageText); + m_maxPageText = new wxPrintPageMaxCtrl(this); + sizer.Add(m_maxPageText); } if (m_buttonFlags & wxPREVIEW_NEXT) @@ -1489,6 +1546,15 @@ void wxPreviewControlBar::CreateButtons() sizer.AddAtEnd(m_closeButton); } +void wxPreviewControlBar::SetPageInfo(int minPage, int maxPage) +{ + if ( m_currentPageText ) + m_currentPageText->SetPageInfo(minPage, maxPage); + + if ( m_maxPageText ) + m_maxPageText->SetMaxPage(maxPage); +} + void wxPreviewControlBar::SetZoomControl(int zoom) { if (m_zoomControl) @@ -1553,6 +1619,7 @@ wxFrame(parent, wxID_ANY, title, pos, size, style, name) m_controlBar = NULL; m_previewCanvas = NULL; m_windowDisabler = NULL; + m_modalityKind = wxPreviewFrame_NonModal; // Give the application icon #ifdef __WXMSW__ @@ -1564,14 +1631,6 @@ wxFrame(parent, wxID_ANY, title, pos, size, style, name) wxPreviewFrame::~wxPreviewFrame() { -} - -void wxPreviewFrame::OnCloseWindow(wxCloseEvent& WXUNUSED(event)) -{ - if (m_windowDisabler) - delete m_windowDisabler; - - // Need to delete the printout and the print preview wxPrintout *printout = m_printPreview->GetPrintout(); if (printout) { @@ -1582,12 +1641,33 @@ void wxPreviewFrame::OnCloseWindow(wxCloseEvent& WXUNUSED(event)) } m_previewCanvas->SetPreview(NULL); - wxDELETE(m_printPreview); + delete m_printPreview; +} + +void wxPreviewFrame::OnCloseWindow(wxCloseEvent& WXUNUSED(event)) +{ + // Reenable any windows we disabled by undoing whatever we did in our + // Initialize(). + switch ( m_modalityKind ) + { + case wxPreviewFrame_AppModal: + delete m_windowDisabler; + m_windowDisabler = NULL; + break; + + case wxPreviewFrame_WindowModal: + if ( GetParent() ) + GetParent()->Enable(); + break; + + case wxPreviewFrame_NonModal: + break; + } Destroy(); } -void wxPreviewFrame::Initialize() +void wxPreviewFrame::InitializeWithModality(wxPreviewFrameModalityKind kind) { #if wxUSE_STATUSBAR CreateStatusBar(); @@ -1606,7 +1686,25 @@ void wxPreviewFrame::Initialize() SetAutoLayout( true ); SetSizer( item0 ); - m_windowDisabler = new wxWindowDisabler(this); + m_modalityKind = kind; + switch ( m_modalityKind ) + { + case wxPreviewFrame_AppModal: + // Disable everything. + m_windowDisabler = new wxWindowDisabler( this ); + break; + + case wxPreviewFrame_WindowModal: + // Disable our parent if we have one. + if ( GetParent() ) + GetParent()->Disable(); + break; + + case wxPreviewFrame_NonModal: + // Nothing to do, we don't need to disable any windows. + break; + } + Layout(); @@ -1829,13 +1927,23 @@ bool wxPrintPreviewBase::RenderPageIntoDC(wxDC& dc, int pageNum) m_previewPrintout->SetPageSizePixels(m_pageWidth, m_pageHeight); // Need to delay OnPreparePrinting() until here, so we have enough - // information. + // information and a wxDC. if (!m_printingPrepared) { + m_printingPrepared = true; + m_previewPrintout->OnPreparePrinting(); int selFrom, selTo; m_previewPrintout->GetPageInfo(&m_minPage, &m_maxPage, &selFrom, &selTo); - m_printingPrepared = true; + + // Update the wxPreviewControlBar page range display. + if ( m_previewFrame ) + { + wxPreviewControlBar * const + controlBar = ((wxPreviewFrame*)m_previewFrame)->GetControlBar(); + if ( controlBar ) + controlBar->SetPageInfo(m_minPage, m_maxPage); + } } m_previewPrintout->OnBeginPrinting(); @@ -1881,7 +1989,7 @@ bool wxPrintPreviewBase::RenderPage(int pageNum) { m_previewBitmap = new wxBitmap(pageRect.width, pageRect.height); - if (!m_previewBitmap || !m_previewBitmap->Ok()) + if (!m_previewBitmap || !m_previewBitmap->IsOk()) { InvalidatePreviewBitmap(); wxMessageBox(_("Sorry, not enough memory to create a preview."), _("Print Preview Failure"), wxOK); @@ -2102,7 +2210,7 @@ int wxPrintPreview::GetMinPage() const bool wxPrintPreview::IsOk() const { - return m_pimpl->Ok(); + return m_pimpl->IsOk(); } void wxPrintPreview::SetOk(bool ok) diff --git a/Externals/wxWidgets3/src/common/quantize.cpp b/Externals/wxWidgets3/src/common/quantize.cpp index 2b740ec0f9..db58c9e677 100644 --- a/Externals/wxWidgets3/src/common/quantize.cpp +++ b/Externals/wxWidgets3/src/common/quantize.cpp @@ -4,7 +4,7 @@ // Author: Julian Smart // Modified by: // Created: 22/6/2000 -// RCS-ID: $Id: quantize.cpp 50694 2007-12-14 22:35:23Z VZ $ +// RCS-ID: $Id: quantize.cpp 67681 2011-05-03 16:29:04Z DS $ // Copyright: (c) Thomas G. Lane, Vaclav Slavik, Julian Smart // Licence: wxWindows licence + JPEG library licence ///////////////////////////////////////////////////////////////////////////// @@ -1546,7 +1546,7 @@ bool wxQuantize::Quantize(const wxImage& src, wxImage& dest, if (flags & wxQUANTIZE_FILL_DESTINATION_IMAGE) { - if (!dest.Ok()) + if (!dest.IsOk()) dest.Create(w, h); imgdt = dest.GetData(); diff --git a/Externals/wxWidgets3/src/common/richtooltipcmn.cpp b/Externals/wxWidgets3/src/common/richtooltipcmn.cpp new file mode 100644 index 0000000000..2d98ca758b --- /dev/null +++ b/Externals/wxWidgets3/src/common/richtooltipcmn.cpp @@ -0,0 +1,82 @@ +/////////////////////////////////////////////////////////////////////////////// +// Name: src/common/richtooltipcmn.cpp +// Purpose: wxRichToolTip implementation common to all platforms. +// Author: Vadim Zeitlin +// Created: 2011-10-18 +// RCS-ID: $Id: richtooltipcmn.cpp 69463 2011-10-18 21:57:02Z VZ $ +// Copyright: (c) 2011 Vadim Zeitlin +// Licence: wxWindows licence +/////////////////////////////////////////////////////////////////////////////// + +// ============================================================================ +// declarations +// ============================================================================ + +// ---------------------------------------------------------------------------- +// headers +// ---------------------------------------------------------------------------- + +// for compilers that support precompilation, includes "wx.h". +#include "wx/wxprec.h" + +#ifdef __BORLANDC__ + #pragma hdrstop +#endif + +#if wxUSE_RICHTOOLTIP + +#ifndef WX_PRECOMP + #include "wx/icon.h" +#endif // WX_PRECOMP + +#include "wx/private/richtooltip.h" + +// ============================================================================ +// implementation +// ============================================================================ + +wxRichToolTip::wxRichToolTip(const wxString& title, + const wxString& message) : + m_impl(wxRichToolTipImpl::Create(title, message)) +{ +} + +void +wxRichToolTip::SetBackgroundColour(const wxColour& col, const wxColour& colEnd) +{ + m_impl->SetBackgroundColour(col, colEnd); +} + +void wxRichToolTip::SetIcon(int icon) +{ + m_impl->SetStandardIcon(icon); +} + +void wxRichToolTip::SetIcon(const wxIcon& icon) +{ + m_impl->SetCustomIcon(icon); +} + +void wxRichToolTip::SetTimeout(unsigned milliseconds) +{ + m_impl->SetTimeout(milliseconds); +} + +void wxRichToolTip::SetTipKind(wxTipKind tipKind) +{ + m_impl->SetTipKind(tipKind); +} + +void wxRichToolTip::ShowFor(wxWindow* win) +{ + wxCHECK_RET( win, wxS("Must have a valid window") ); + + m_impl->ShowFor(win); +} + +wxRichToolTip::~wxRichToolTip() +{ + delete m_impl; +} + +#endif // wxUSE_RICHTOOLTIP diff --git a/Externals/wxWidgets3/src/common/sckaddr.cpp b/Externals/wxWidgets3/src/common/sckaddr.cpp index 9dd6d3afb4..0992e09859 100644 --- a/Externals/wxWidgets3/src/common/sckaddr.cpp +++ b/Externals/wxWidgets3/src/common/sckaddr.cpp @@ -4,7 +4,7 @@ // Author: Guilhem Lavaux // Created: 26/04/97 // Modified by: Vadim Zeitlin to use wxSockAddressImpl on 2008-12-28 -// RCS-ID: $Id: sckaddr.cpp 65124 2010-07-28 11:26:14Z VZ $ +// RCS-ID: $Id: sckaddr.cpp 70796 2012-03-04 00:29:31Z VZ $ // Copyright: (c) 1997, 1998 Guilhem Lavaux // (c) 2008 Vadim Zeitlin // Licence: wxWindows licence @@ -79,7 +79,7 @@ IMPLEMENT_DYNAMIC_CLASS(wxUNIXaddress, wxSockAddress) // TODO: use POSIX getaddrinfo() (also available in Winsock 2) for simplicity // and to use the same code for IPv4 and IPv6 support -#ifdef __WXMSW__ +#ifdef __WINDOWS__ #define HAVE_INET_ADDR #ifndef HAVE_GETHOSTBYNAME @@ -109,7 +109,7 @@ IMPLEMENT_DYNAMIC_CLASS(wxUNIXaddress, wxSockAddress) #pragma warning(default:4706) #endif #endif -#endif // __WXMSW__ +#endif // __WINDOWS__ // we assume that we have gethostbyaddr_r() if and only if we have // gethostbyname_r() and that it uses the similar conventions to it (see @@ -144,7 +144,7 @@ IMPLEMENT_DYNAMIC_CLASS(wxUNIXaddress, wxSockAddress) #ifdef HAVE_FUNC_GETSERVBYNAME_R_4 struct wxGetservBuf : servent_data { - wxGethostBuf() + wxGetservBuf() { memset(this, 0, sizeof(servent_data)); } @@ -273,8 +273,9 @@ hostent *wxGethostbyname_r(const char *hostname, #elif defined(HAVE_FUNC_GETHOSTBYNAME_R_5) he = gethostbyname_r(hostname, h, buffer, size, err); #elif defined(HAVE_FUNC_GETHOSTBYNAME_R_3) - he = gethostbyname_r(hostname, h, &buffer); - *err = h_errno; + wxUnusedVar(var); + *err = gethostbyname_r(hostname, h, &buffer); + he = h; #elif defined(HAVE_GETHOSTBYNAME) wxLOCK_GETBY_MUTEX(name); @@ -304,8 +305,9 @@ hostent *wxGethostbyaddr_r(const char *addr_buf, #elif defined(HAVE_FUNC_GETHOSTBYADDR_R_5) he = gethostbyaddr_r(addr_buf, buf_size, proto, h, buffer, size, err); #elif defined(HAVE_FUNC_GETHOSTBYADDR_R_3) - he = gethostbyaddr_r(addr_buf, buf_size, proto, h, buffer); - *err = h_errno; + wxUnusedVar(size); + *err = gethostbyaddr_r(addr_buf, buf_size, proto, h, &buffer); + he = h; #elif defined(HAVE_GETHOSTBYADDR) wxLOCK_GETBY_MUTEX(addr); @@ -397,6 +399,7 @@ servent *wxGetservbyname_r(const char *port, #elif defined(HAVE_FUNC_GETSERVBYNAME_R_5) se = getservbyname_r(port, protocol, serv, buffer, size); #elif defined(HAVE_FUNC_GETSERVBYNAME_R_4) + wxUnusedVar(size); if ( getservbyname_r(port, protocol, serv, &buffer) != 0 ) return NULL; #elif defined(HAVE_GETSERVBYNAME) diff --git a/Externals/wxWidgets3/src/common/sckfile.cpp b/Externals/wxWidgets3/src/common/sckfile.cpp index 467c1500a1..b4104065b8 100644 --- a/Externals/wxWidgets3/src/common/sckfile.cpp +++ b/Externals/wxWidgets3/src/common/sckfile.cpp @@ -4,7 +4,7 @@ // Author: Guilhem Lavaux // Modified by: // Created: 20/07/97 -// RCS-ID: $Id: sckfile.cpp 58137 2009-01-16 15:08:13Z FM $ +// RCS-ID: $Id: sckfile.cpp 67681 2011-05-03 16:29:04Z DS $ // Copyright: (c) 1997, 1998 Guilhem Lavaux // Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// @@ -45,7 +45,7 @@ wxFileProto::~wxFileProto() wxInputStream *wxFileProto::GetInputStream(const wxString& path) { wxFileInputStream *retval = new wxFileInputStream(wxURI::Unescape(path)); - if ( retval->Ok() ) + if ( retval->IsOk() ) { m_lastError = wxPROTO_NOERR; return retval; diff --git a/Externals/wxWidgets3/src/common/sckipc.cpp b/Externals/wxWidgets3/src/common/sckipc.cpp index 1088c93dbd..c141d11b74 100644 --- a/Externals/wxWidgets3/src/common/sckipc.cpp +++ b/Externals/wxWidgets3/src/common/sckipc.cpp @@ -8,7 +8,7 @@ // Vadim Zeitlin (added support for Unix sockets) Apr 2002 // (use buffering, many fixes/cleanup) Oct 2008 // Created: 1993 -// RCS-ID: $Id: sckipc.cpp 61508 2009-07-23 20:30:22Z VZ $ +// RCS-ID: $Id: sckipc.cpp 67681 2011-05-03 16:29:04Z DS $ // Copyright: (c) Julian Smart 1993 // (c) Guilhem Lavaux 1997, 1998 // (c) 2000 Guillermo Rodriguez @@ -498,7 +498,7 @@ bool wxTCPServer::Create(const wxString& serverName) delete addr; - if (!m_server->Ok()) + if (!m_server->IsOk()) { m_server->Destroy(); m_server = NULL; @@ -877,7 +877,7 @@ void wxTCPEventHandler::Server_OnRequest(wxSocketEvent &event) wxSocketBase *sock = server->Accept(); if (!sock) return; - if (!sock->Ok()) + if (!sock->IsOk()) { sock->Destroy(); return; diff --git a/Externals/wxWidgets3/src/common/sizer.cpp b/Externals/wxWidgets3/src/common/sizer.cpp index 5858c1218f..06403167dd 100644 --- a/Externals/wxWidgets3/src/common/sizer.cpp +++ b/Externals/wxWidgets3/src/common/sizer.cpp @@ -5,7 +5,7 @@ // Dirk Holtwick, Ron Lee // Modified by: Ron Lee // Created: -// RCS-ID: $Id: sizer.cpp 67280 2011-03-22 14:17:38Z DS $ +// RCS-ID: $Id: sizer.cpp 69172 2011-09-21 15:07:37Z VZ $ // Copyright: (c) Robin Dunn, Robert Roebling // Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// @@ -909,6 +909,11 @@ wxSize wxSizer::ComputeFittingClientSize(wxWindow *window) sizeMax = wxDisplay(disp).GetClientArea().GetSize(); + // If determining the display size failed, skip the max size checks as + // we really don't want to create windows of (0, 0) size. + if ( !sizeMax.x || !sizeMax.y ) + return size; + // space for decorations and toolbars etc. sizeMax = tlw->WindowToClientSize(sizeMax); } diff --git a/Externals/wxWidgets3/src/common/socket.cpp b/Externals/wxWidgets3/src/common/socket.cpp index f99a0333bb..b3e07700b6 100644 --- a/Externals/wxWidgets3/src/common/socket.cpp +++ b/Externals/wxWidgets3/src/common/socket.cpp @@ -6,7 +6,7 @@ // Copyright: (C) 1999-1997, Guilhem Lavaux // (C) 1999-2000, Guillermo Rodriguez Garcia // (C) 2008 Vadim Zeitlin -// RCS_ID: $Id: socket.cpp 65378 2010-08-21 23:33:40Z VZ $ +// RCS_ID: $Id: socket.cpp 70808 2012-03-04 20:31:42Z VZ $ // Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// @@ -1297,17 +1297,31 @@ wxSocketEventFlags wxSocketImpl::Select(wxSocketEventFlags flags, exceptfds; // always want to know about errors if ( flags & wxSOCKET_INPUT_FLAG ) - { preadfds = &readfds; + + if ( flags & wxSOCKET_OUTPUT_FLAG ) + pwritefds = &writefds; + + // When using non-blocking connect() the client socket becomes connected + // (successfully or not) when it becomes writable but when using + // non-blocking accept() the server socket becomes connected when it + // becomes readable. + if ( flags & wxSOCKET_CONNECTION_FLAG ) + { + if ( m_server ) + preadfds = &readfds; + else + pwritefds = &writefds; + } + + if ( preadfds ) + { wxFD_ZERO(preadfds); wxFD_SET(m_fd, preadfds); } - // when using non-blocking connect() the socket becomes connected - // (successfully or not) when it becomes writable - if ( flags & (wxSOCKET_OUTPUT_FLAG | wxSOCKET_CONNECTION_FLAG) ) + if ( pwritefds ) { - pwritefds = &writefds; wxFD_ZERO(pwritefds); wxFD_SET(m_fd, pwritefds); } @@ -2097,7 +2111,7 @@ wxFORCE_LINK_MODULE( socketiohandler ) #endif // same for ManagerSetter in the MSW file -#ifdef __WXMSW__ +#ifdef __WINDOWS__ wxFORCE_LINK_MODULE( mswsocket ) #endif diff --git a/Externals/wxWidgets3/src/common/sstream.cpp b/Externals/wxWidgets3/src/common/sstream.cpp index edc38fd5ef..f7e1f9a647 100644 --- a/Externals/wxWidgets3/src/common/sstream.cpp +++ b/Externals/wxWidgets3/src/common/sstream.cpp @@ -4,7 +4,7 @@ // Author: Vadim Zeitlin // Modified by: Ryan Norton (UTF8 UNICODE) // Created: 2004-09-19 -// RCS-ID: $Id: sstream.cpp 67254 2011-03-20 00:14:35Z DS $ +// RCS-ID: $Id: sstream.cpp 67968 2011-06-16 16:22:15Z VZ $ // Copyright: (c) 2004 Vadim Zeitlin // Licence: wxWindows licence /////////////////////////////////////////////////////////////////////////////// @@ -146,7 +146,7 @@ size_t wxStringOutputStream::OnSysWrite(const void *buffer, size_t size) { const char *p = static_cast(buffer); -#if wxUSE_UNICODE_WCHAR +#if wxUSE_UNICODE // the part of the string we have here may be incomplete, i.e. it can stop // in the middle of an UTF-8 character and so converting it would fail; if // this is the case, accumulate the part which we failed to convert until @@ -188,11 +188,10 @@ size_t wxStringOutputStream::OnSysWrite(const void *buffer, size_t size) // not update m_pos as m_str hasn't changed return size; } -#else // !wxUSE_UNICODE_WCHAR - // no recoding necessary, the data is supposed to already be in UTF-8 (if - // supported) or ASCII otherwise +#else // !wxUSE_UNICODE + // no recoding necessary m_str->append(p, size); -#endif // wxUSE_UNICODE_WCHAR/!wxUSE_UNICODE_WCHAR +#endif // wxUSE_UNICODE/!wxUSE_UNICODE // update position m_pos += size; diff --git a/Externals/wxWidgets3/src/common/stockitem.cpp b/Externals/wxWidgets3/src/common/stockitem.cpp index 19aab1aa28..0c9ea2c496 100644 --- a/Externals/wxWidgets3/src/common/stockitem.cpp +++ b/Externals/wxWidgets3/src/common/stockitem.cpp @@ -4,7 +4,7 @@ // Author: Vaclav Slavik // Modified by: // Created: 2004-08-15 -// RCS-ID: $Id: stockitem.cpp 63383 2010-02-04 01:33:32Z VZ $ +// RCS-ID: $Id: stockitem.cpp 70412 2012-01-20 16:51:09Z DS $ // Copyright: (c) Vaclav Slavik, 2004 // Licence: wxWindows licence /////////////////////////////////////////////////////////////////////////////// @@ -118,85 +118,97 @@ wxString wxGetStockLabel(wxWindowID id, long flags) { wxString stockLabel; - #define STOCKITEM(stockid, label) \ - case stockid: \ - stockLabel = label; \ - break; +#ifdef __WXMSW__ + // special case: the "Cancel" button shouldn't have a mnemonic under MSW + // for consistency with the native dialogs (which don't use any mnemonic + // for it because it is already bound to Esc implicitly) + if ( id == wxID_CANCEL ) + flags &= ~wxSTOCK_WITH_MNEMONIC; +#endif // __WXMSW__ + + + #define STOCKITEM(stockid, labelWithMnemonic, labelPlain) \ + case stockid: \ + if(flags & wxSTOCK_WITH_MNEMONIC) \ + stockLabel = labelWithMnemonic; \ + else \ + stockLabel = labelPlain; \ + break switch (id) { - STOCKITEM(wxID_ABOUT, _("&About...")) - STOCKITEM(wxID_ADD, _("Add")) - STOCKITEM(wxID_APPLY, _("&Apply")) - STOCKITEM(wxID_BACKWARD, _("&Back")) - STOCKITEM(wxID_BOLD, _("&Bold")) - STOCKITEM(wxID_BOTTOM, _("&Bottom")) - STOCKITEM(wxID_CANCEL, _("&Cancel")) - STOCKITEM(wxID_CDROM, _("&CD-Rom")) - STOCKITEM(wxID_CLEAR, _("&Clear")) - STOCKITEM(wxID_CLOSE, _("&Close")) - STOCKITEM(wxID_CONVERT, _("&Convert")) - STOCKITEM(wxID_COPY, _("&Copy")) - STOCKITEM(wxID_CUT, _("Cu&t")) - STOCKITEM(wxID_DELETE, _("&Delete")) - STOCKITEM(wxID_DOWN, _("&Down")) - STOCKITEM(wxID_EDIT, _("&Edit")) - STOCKITEM(wxID_EXECUTE, _("&Execute")) - STOCKITEM(wxID_EXIT, _("&Quit")) - STOCKITEM(wxID_FILE, _("&File")) - STOCKITEM(wxID_FIND, _("&Find")) - STOCKITEM(wxID_FIRST, _("&First")) - STOCKITEM(wxID_FLOPPY, _("&Floppy")) - STOCKITEM(wxID_FORWARD, _("&Forward")) - STOCKITEM(wxID_HARDDISK, _("&Harddisk")) - STOCKITEM(wxID_HELP, _("&Help")) - STOCKITEM(wxID_HOME, _("&Home")) - STOCKITEM(wxID_INDENT, _("Indent")) - STOCKITEM(wxID_INDEX, _("&Index")) - STOCKITEM(wxID_INFO, _("&Info")) - STOCKITEM(wxID_ITALIC, _("&Italic")) - STOCKITEM(wxID_JUMP_TO, _("&Jump to")) - STOCKITEM(wxID_JUSTIFY_CENTER, _("Centered")) - STOCKITEM(wxID_JUSTIFY_FILL, _("Justified")) - STOCKITEM(wxID_JUSTIFY_LEFT, _("Align Left")) - STOCKITEM(wxID_JUSTIFY_RIGHT, _("Align Right")) - STOCKITEM(wxID_LAST, _("&Last")) - STOCKITEM(wxID_NETWORK, _("&Network")) - STOCKITEM(wxID_NEW, _("&New")) - STOCKITEM(wxID_NO, _("&No")) - STOCKITEM(wxID_OK, _("&OK")) - STOCKITEM(wxID_OPEN, _("&Open...")) - STOCKITEM(wxID_PASTE, _("&Paste")) - STOCKITEM(wxID_PREFERENCES, _("&Preferences")) - STOCKITEM(wxID_PREVIEW, _("Print previe&w")) - STOCKITEM(wxID_PRINT, _("&Print...")) - STOCKITEM(wxID_PROPERTIES, _("&Properties")) - STOCKITEM(wxID_REDO, _("&Redo")) - STOCKITEM(wxID_REFRESH, _("Refresh")) - STOCKITEM(wxID_REMOVE, _("Remove")) - STOCKITEM(wxID_REPLACE, _("Rep&lace")) - STOCKITEM(wxID_REVERT_TO_SAVED, _("Revert to Saved")) - STOCKITEM(wxID_SAVE, _("&Save")) - STOCKITEM(wxID_SAVEAS, _("Save &As...")) - STOCKITEM(wxID_SELECTALL, _("Select &All")) - STOCKITEM(wxID_SELECT_COLOR, _("&Color")) - STOCKITEM(wxID_SELECT_FONT, _("&Font")) - STOCKITEM(wxID_SORT_ASCENDING, _("&Ascending")) - STOCKITEM(wxID_SORT_DESCENDING, _("&Descending")) - STOCKITEM(wxID_SPELL_CHECK, _("&Spell Check")) - STOCKITEM(wxID_STOP, _("&Stop")) - STOCKITEM(wxID_STRIKETHROUGH, _("&Strikethrough")) - STOCKITEM(wxID_TOP, _("&Top")) - STOCKITEM(wxID_UNDELETE, _("Undelete")) - STOCKITEM(wxID_UNDERLINE, _("&Underline")) - STOCKITEM(wxID_UNDO, _("&Undo")) - STOCKITEM(wxID_UNINDENT, _("&Unindent")) - STOCKITEM(wxID_UP, _("&Up")) - STOCKITEM(wxID_YES, _("&Yes")) - STOCKITEM(wxID_ZOOM_100, _("&Actual Size")) - STOCKITEM(wxID_ZOOM_FIT, _("Zoom to &Fit")) - STOCKITEM(wxID_ZOOM_IN, _("Zoom &In")) - STOCKITEM(wxID_ZOOM_OUT, _("Zoom &Out")) + STOCKITEM(wxID_ABOUT, _("&About"), _("About")); + STOCKITEM(wxID_ADD, _("Add"), _("Add")); + STOCKITEM(wxID_APPLY, _("&Apply"), _("Apply")); + STOCKITEM(wxID_BACKWARD, _("&Back"), _("Back")); + STOCKITEM(wxID_BOLD, _("&Bold"), _("Bold")); + STOCKITEM(wxID_BOTTOM, _("&Bottom"), _("Bottom")); + STOCKITEM(wxID_CANCEL, _("&Cancel"), _("Cancel")); + STOCKITEM(wxID_CDROM, _("&CD-Rom"), _("CD-Rom")); + STOCKITEM(wxID_CLEAR, _("&Clear"), _("Clear")); + STOCKITEM(wxID_CLOSE, _("&Close"), _("Close")); + STOCKITEM(wxID_CONVERT, _("&Convert"), _("Convert")); + STOCKITEM(wxID_COPY, _("&Copy"), _("Copy")); + STOCKITEM(wxID_CUT, _("Cu&t"), _("Cut")); + STOCKITEM(wxID_DELETE, _("&Delete"), _("Delete")); + STOCKITEM(wxID_DOWN, _("&Down"), _("Down")); + STOCKITEM(wxID_EDIT, _("&Edit"), _("Edit")); + STOCKITEM(wxID_EXECUTE, _("&Execute"), _("Execute")); + STOCKITEM(wxID_EXIT, _("&Quit"), _("Quit")); + STOCKITEM(wxID_FILE, _("&File"), _("File")); + STOCKITEM(wxID_FIND, _("&Find"), _("Find")); + STOCKITEM(wxID_FIRST, _("&First"), _("First")); + STOCKITEM(wxID_FLOPPY, _("&Floppy"), _("Floppy")); + STOCKITEM(wxID_FORWARD, _("&Forward"), _("Forward")); + STOCKITEM(wxID_HARDDISK, _("&Harddisk"), _("Harddisk")); + STOCKITEM(wxID_HELP, _("&Help"), _("Help")); + STOCKITEM(wxID_HOME, _("&Home"), _("Home")); + STOCKITEM(wxID_INDENT, _("Indent"), _("Indent")); + STOCKITEM(wxID_INDEX, _("&Index"), _("Index")); + STOCKITEM(wxID_INFO, _("&Info"), _("Info")); + STOCKITEM(wxID_ITALIC, _("&Italic"), _("Italic")); + STOCKITEM(wxID_JUMP_TO, _("&Jump to"), _("Jump to")); + STOCKITEM(wxID_JUSTIFY_CENTER, _("Centered"), _("Centered")); + STOCKITEM(wxID_JUSTIFY_FILL, _("Justified"), _("Justified")); + STOCKITEM(wxID_JUSTIFY_LEFT, _("Align Left"), _("Align Left")); + STOCKITEM(wxID_JUSTIFY_RIGHT, _("Align Right"), _("Align Right")); + STOCKITEM(wxID_LAST, _("&Last"), _("Last")); + STOCKITEM(wxID_NETWORK, _("&Network"), _("Network")); + STOCKITEM(wxID_NEW, _("&New"), _("New")); + STOCKITEM(wxID_NO, _("&No"), _("No")); + STOCKITEM(wxID_OK, _("&OK"), _("OK")); + STOCKITEM(wxID_OPEN, _("&Open..."), _("Open...")); + STOCKITEM(wxID_PASTE, _("&Paste"), _("Paste")); + STOCKITEM(wxID_PREFERENCES, _("&Preferences"), _("Preferences")); + STOCKITEM(wxID_PREVIEW, _("&Preview..."), _("Preview...")); + STOCKITEM(wxID_PRINT, _("&Print..."), _("Print...")); + STOCKITEM(wxID_PROPERTIES, _("&Properties"), _("Properties")); + STOCKITEM(wxID_REDO, _("&Redo"), _("Redo")); + STOCKITEM(wxID_REFRESH, _("Refresh"), _("Refresh")); + STOCKITEM(wxID_REMOVE, _("Remove"), _("Remove")); + STOCKITEM(wxID_REPLACE, _("Rep&lace"), _("Replace")); + STOCKITEM(wxID_REVERT_TO_SAVED, _("Revert to Saved"), _("Revert to Saved")); + STOCKITEM(wxID_SAVE, _("&Save"), _("Save")); + STOCKITEM(wxID_SAVEAS, _("&Save as"), _("Save as")); + STOCKITEM(wxID_SELECTALL, _("Select &All"), _("Select All")); + STOCKITEM(wxID_SELECT_COLOR, _("&Color"), _("Color")); + STOCKITEM(wxID_SELECT_FONT, _("&Font"), _("Font")); + STOCKITEM(wxID_SORT_ASCENDING, _("&Ascending"), _("Ascending")); + STOCKITEM(wxID_SORT_DESCENDING, _("&Descending"), _("Descending")); + STOCKITEM(wxID_SPELL_CHECK, _("&Spell Check"), _("Spell Check")); + STOCKITEM(wxID_STOP, _("&Stop"), _("Stop")); + STOCKITEM(wxID_STRIKETHROUGH, _("&Strikethrough"), _("Strikethrough")); + STOCKITEM(wxID_TOP, _("&Top"), _("Top")); + STOCKITEM(wxID_UNDELETE, _("Undelete"), _("Undelete")); + STOCKITEM(wxID_UNDERLINE, _("&Underline"), _("Underline")); + STOCKITEM(wxID_UNDO, _("&Undo"), _("Undo")); + STOCKITEM(wxID_UNINDENT, _("&Unindent"), _("Unindent")); + STOCKITEM(wxID_UP, _("&Up"), _("Up")); + STOCKITEM(wxID_YES, _("&Yes"), _("Yes")); + STOCKITEM(wxID_ZOOM_100, _("&Actual Size"), _("Actual Size")); + STOCKITEM(wxID_ZOOM_FIT, _("Zoom to &Fit"), _("Zoom to Fit")); + STOCKITEM(wxID_ZOOM_IN, _("Zoom &In"), _("Zoom In")); + STOCKITEM(wxID_ZOOM_OUT, _("Zoom &Out"), _("Zoom Out")); default: wxFAIL_MSG( wxT("invalid stock item ID") ); @@ -218,19 +230,6 @@ wxString wxGetStockLabel(wxWindowID id, long flags) "labels without ellipsis shouldn't use accelerators" ); } -#ifdef __WXMSW__ - // special case: the "Cancel" button shouldn't have a mnemonic under MSW - // for consistency with the native dialogs (which don't use any mnemonic - // for it because it is already bound to Esc implicitly) - if ( id == wxID_CANCEL ) - flags &= ~wxSTOCK_WITH_MNEMONIC; -#endif // __WXMSW__ - - if ( !(flags & wxSTOCK_WITH_MNEMONIC) ) - { - stockLabel = wxStripMenuCodes(stockLabel); - } - #if wxUSE_ACCEL if ( !stockLabel.empty() && (flags & wxSTOCK_WITH_ACCELERATOR) ) { @@ -292,17 +291,21 @@ wxAcceleratorEntry wxGetStockAccelerator(wxWindowID id) switch (id) { - STOCKITEM(wxID_COPY, wxACCEL_CMD,'C') - STOCKITEM(wxID_CUT, wxACCEL_CMD,'X') - STOCKITEM(wxID_FIND, wxACCEL_CMD,'F') - STOCKITEM(wxID_HELP, wxACCEL_CMD,'H') - STOCKITEM(wxID_NEW, wxACCEL_CMD,'N') - STOCKITEM(wxID_OPEN, wxACCEL_CMD,'O') - STOCKITEM(wxID_PASTE, wxACCEL_CMD,'V') - STOCKITEM(wxID_REDO, wxACCEL_CMD | wxACCEL_SHIFT,'Z') - STOCKITEM(wxID_REPLACE, wxACCEL_CMD,'R') - STOCKITEM(wxID_SAVE, wxACCEL_CMD,'S') - STOCKITEM(wxID_UNDO, wxACCEL_CMD,'Z') + STOCKITEM(wxID_COPY, wxACCEL_CTRL,'C') + STOCKITEM(wxID_CUT, wxACCEL_CTRL,'X') + STOCKITEM(wxID_FIND, wxACCEL_CTRL,'F') + STOCKITEM(wxID_HELP, wxACCEL_CTRL,'H') + STOCKITEM(wxID_NEW, wxACCEL_CTRL,'N') + STOCKITEM(wxID_OPEN, wxACCEL_CTRL,'O') + STOCKITEM(wxID_PASTE, wxACCEL_CTRL,'V') + STOCKITEM(wxID_PRINT, wxACCEL_CTRL,'P') + STOCKITEM(wxID_REDO, wxACCEL_CTRL | wxACCEL_SHIFT,'Z') + STOCKITEM(wxID_REPLACE, wxACCEL_CTRL,'R') + STOCKITEM(wxID_SAVE, wxACCEL_CTRL,'S') + STOCKITEM(wxID_UNDO, wxACCEL_CTRL,'Z') +#ifdef __WXOSX__ + STOCKITEM(wxID_PREFERENCES, wxACCEL_CTRL,',') +#endif default: // set the wxAcceleratorEntry to return into an invalid state: diff --git a/Externals/wxWidgets3/src/common/stopwatch.cpp b/Externals/wxWidgets3/src/common/stopwatch.cpp index 246e778921..dc66848854 100644 --- a/Externals/wxWidgets3/src/common/stopwatch.cpp +++ b/Externals/wxWidgets3/src/common/stopwatch.cpp @@ -8,7 +8,7 @@ // Guillermo Rodriguez rewrote from scratch (Dic/99) // Modified by: // Created: 20.06.2003 (extracted from common/timercmn.cpp) -// RCS-ID: $Id: stopwatch.cpp 64940 2010-07-13 13:29:13Z VZ $ +// RCS-ID: $Id: stopwatch.cpp 70796 2012-03-04 00:29:31Z VZ $ // Copyright: (c) 1998-2003 wxWidgets Team // Licence: wxWindows licence /////////////////////////////////////////////////////////////////////////////// @@ -30,61 +30,16 @@ #include "wx/stopwatch.h" +#if wxUSE_STOPWATCH + #ifndef WX_PRECOMP - #ifdef __WXMSW__ + #ifdef __WINDOWS__ #include "wx/msw/wrapwin.h" #endif - #include "wx/intl.h" #include "wx/log.h" + #include "wx/thread.h" #endif //WX_PRECOMP -// ---------------------------------------------------------------------------- -// System headers -// ---------------------------------------------------------------------------- - -#if defined(__WIN32__) && !defined(HAVE_FTIME) && !defined(__MWERKS__) && !defined(__WXWINCE__) - #define HAVE_FTIME -#endif - -#if defined(__VISAGECPP__) && !defined(HAVE_FTIME) - #define HAVE_FTIME -# if __IBMCPP__ >= 400 - # define ftime(x) _ftime(x) -# endif -#endif - -#if defined(__MWERKS__) && defined(__WXMSW__) -# undef HAVE_FTIME -# undef HAVE_GETTIMEOFDAY -#endif - -#ifndef __WXPALMOS5__ -#ifndef __WXWINCE__ -#include -#else -#include "wx/msw/private.h" -#include "wx/msw/wince/time.h" -#endif -#endif // __WXPALMOS5__ - - -#if !defined(__WXMAC__) && !defined(__WXWINCE__) - #include // for time_t -#endif - -#if defined(HAVE_GETTIMEOFDAY) - #include - #include -#elif defined(HAVE_FTIME) - #include -#endif - -#ifdef __WXPALMOS__ - #include - #include - #include -#endif - // ============================================================================ // implementation // ============================================================================ @@ -93,57 +48,117 @@ // wxStopWatch // ---------------------------------------------------------------------------- -#if wxUSE_STOPWATCH - -void wxStopWatch::Start(long t) +namespace { -#if 0 -// __WXMSW__ - LARGE_INTEGER frequency_li; - ::QueryPerformanceFrequency( &frequency_li ); - m_frequency = frequency_li.QuadPart; - if (m_frequency == 0) + +#ifdef __WINDOWS__ + +struct PerfCounter +{ + PerfCounter() { - m_t0 = wxGetLocalTimeMillis() - t; + init = false; } - else + + bool CanBeUsed() const { - LARGE_INTEGER counter_li; - ::QueryPerformanceCounter( &counter_li ); - wxLongLong counter = counter_li.QuadPart; - m_t0 = (counter * 10000 / m_frequency) - t*10; + return freq.QuadPart != 0; } -#else - m_t0 = wxGetLocalTimeMillis() - t; -#endif - m_pause = 0; + + wxCRIT_SECT_DECLARE_MEMBER(cs); + LARGE_INTEGER freq; + bool init; +} gs_perfCounter; + +#endif // __WINDOWS__ + +const int MILLISECONDS_PER_SECOND = 1000; +const int MICROSECONDS_PER_MILLISECOND = 1000; +const int MICROSECONDS_PER_SECOND = 1000*1000; + +} // anonymous namespace + +void wxStopWatch::DoStart() +{ +#ifdef __WINDOWS__ + if ( !gs_perfCounter.init ) + { + wxCRIT_SECT_LOCKER(lock, gs_perfCounter.cs); + ::QueryPerformanceFrequency(&gs_perfCounter.freq); + + // Just a sanity check: it's not supposed to happen but verify that + // ::QueryPerformanceCounter() succeeds so that we can really use it. + LARGE_INTEGER counter; + if ( !::QueryPerformanceCounter(&counter) ) + { + wxLogDebug("QueryPerformanceCounter() unexpected failed (%s), " + "will not use it.", wxSysErrorMsg()); + + gs_perfCounter.freq.QuadPart = 0; + } + + gs_perfCounter.init = true; + } +#endif // __WINDOWS__ + + m_t0 = GetCurrentClockValue(); +} + +wxLongLong wxStopWatch::GetClockFreq() const +{ +#ifdef __WINDOWS__ + // Under MSW we use the high resolution performance counter timer which has + // its own frequency (usually related to the CPU clock speed). + if ( gs_perfCounter.CanBeUsed() ) + return gs_perfCounter.freq.QuadPart; +#endif // __WINDOWS__ + +#ifdef HAVE_GETTIMEOFDAY + // With gettimeofday() we can have nominally microsecond precision and + // while this is not the case in practice, it's still better than + // millisecond. + return MICROSECONDS_PER_SECOND; +#else // !HAVE_GETTIMEOFDAY + // Currently milliseconds are used everywhere else. + return MILLISECONDS_PER_SECOND; +#endif // HAVE_GETTIMEOFDAY/!HAVE_GETTIMEOFDAY +} + +void wxStopWatch::Start(long t0) +{ + // Calling Start() makes the stop watch run however many times it was + // paused before. m_pauseCount = 0; + + DoStart(); + + m_t0 -= (wxLongLong(t0)*GetClockFreq())/MILLISECONDS_PER_SECOND; } -long wxStopWatch::GetElapsedTime() const +wxLongLong wxStopWatch::GetCurrentClockValue() const { -#if 0 -//__WXMSW__ - if (m_frequency == 0) +#ifdef __WINDOWS__ + if ( gs_perfCounter.CanBeUsed() ) { - return (wxGetLocalTimeMillis() - m_t0).GetLo(); + LARGE_INTEGER counter; + ::QueryPerformanceCounter(&counter); + return counter.QuadPart; } - else - { - LARGE_INTEGER counter_li; - ::QueryPerformanceCounter( &counter_li ); - wxLongLong counter = counter_li.QuadPart; - wxLongLong res = (counter * 10000 / m_frequency) - m_t0; - return res.GetLo() / 10; - } -#else - return (wxGetLocalTimeMillis() - m_t0).GetLo(); -#endif +#endif // __WINDOWS__ + +#ifdef HAVE_GETTIMEOFDAY + return wxGetUTCTimeUSec(); +#else // !HAVE_GETTIMEOFDAY + return wxGetUTCTimeMillis(); +#endif // HAVE_GETTIMEOFDAY/!HAVE_GETTIMEOFDAY } -long wxStopWatch::Time() const +wxLongLong wxStopWatch::TimeInMicro() const { - return m_pauseCount ? m_pause : GetElapsedTime(); + const wxLongLong elapsed(m_pauseCount ? m_elapsedBeforePause + : GetCurrentClockValue() - m_t0); + + return (elapsed*MICROSECONDS_PER_SECOND)/GetClockFreq(); } #endif // wxUSE_STOPWATCH @@ -159,14 +174,14 @@ static wxLongLong wxStartTime = 0l; // starts the global timer void wxStartTimer() { - wxStartTime = wxGetLocalTimeMillis(); + wxStartTime = wxGetUTCTimeMillis(); } // Returns elapsed time in milliseconds long wxGetElapsedTime(bool resetTimer) { wxLongLong oldTime = wxStartTime; - wxLongLong newTime = wxGetLocalTimeMillis(); + wxLongLong newTime = wxGetUTCTimeMillis(); if ( resetTimer ) wxStartTime = newTime; @@ -175,157 +190,3 @@ long wxGetElapsedTime(bool resetTimer) } #endif // wxUSE_LONGLONG - -// ---------------------------------------------------------------------------- -// the functions to get the current time and timezone info -// ---------------------------------------------------------------------------- - -// Get local time as seconds since 00:00:00, Jan 1st 1970 -long wxGetLocalTime() -{ - struct tm tm; - time_t t0, t1; - - // This cannot be made static because mktime can overwrite it. - // - memset(&tm, 0, sizeof(tm)); - tm.tm_year = 70; - tm.tm_mon = 0; - tm.tm_mday = 5; // not Jan 1st 1970 due to mktime 'feature' - tm.tm_hour = 0; - tm.tm_min = 0; - tm.tm_sec = 0; - tm.tm_isdst = -1; // let mktime guess - - // Note that mktime assumes that the struct tm contains local time. - // - t1 = time(&t1); // now - t0 = mktime(&tm); // origin - - // Return the difference in seconds. - // - if (( t0 != (time_t)-1 ) && ( t1 != (time_t)-1 )) - return (long)difftime(t1, t0) + (60 * 60 * 24 * 4); - - wxLogSysError(_("Failed to get the local system time")); - return -1; -} - -// Get UTC time as seconds since 00:00:00, Jan 1st 1970 -long wxGetUTCTime() -{ - return (long)time(NULL); -} - -#if wxUSE_LONGLONG - -// Get local time as milliseconds since 00:00:00, Jan 1st 1970 -wxLongLong wxGetLocalTimeMillis() -{ - wxLongLong val = 1000l; - - // If possible, use a function which avoids conversions from - // broken-up time structures to milliseconds - -#if defined(__WXPALMOS__) - DateTimeType thenst; - thenst.second = 0; - thenst.minute = 0; - thenst.hour = 0; - thenst.day = 1; - thenst.month = 1; - thenst.year = 1970; - thenst.weekDay = 5; - uint32_t now = TimGetSeconds(); - uint32_t then = TimDateTimeToSeconds (&thenst); - return SysTimeToMilliSecs(SysTimeInSecs(now - then)); -#elif defined(__WXMSW__) && (defined(__WINE__) || defined(__MWERKS__)) - // This should probably be the way all WXMSW compilers should do it - // Go direct to the OS for time - - SYSTEMTIME thenst = { 1970, 1, 4, 1, 0, 0, 0, 0 }; // 00:00:00 Jan 1st 1970 - FILETIME thenft; - SystemTimeToFileTime( &thenst, &thenft ); - wxLongLong then( thenft.dwHighDateTime, thenft.dwLowDateTime ); // time in 100 nanoseconds - - SYSTEMTIME nowst; - GetLocalTime( &nowst ); - FILETIME nowft; - SystemTimeToFileTime( &nowst, &nowft ); - wxLongLong now( nowft.dwHighDateTime, nowft.dwLowDateTime ); // time in 100 nanoseconds - - return ( now - then ) / 10000.0; // time from 00:00:00 Jan 1st 1970 to now in milliseconds - -#elif defined(HAVE_GETTIMEOFDAY) - struct timeval tp; - if ( wxGetTimeOfDay(&tp) != -1 ) - { - val *= tp.tv_sec; - return (val + (tp.tv_usec / 1000)); - } - else - { - wxLogError(_("wxGetTimeOfDay failed.")); - return 0; - } -#elif defined(HAVE_FTIME) - struct timeb tp; - - // ftime() is void and not int in some mingw32 headers, so don't - // test the return code (well, it shouldn't fail anyhow...) - (void)::ftime(&tp); - val *= tp.time; - return (val + tp.millitm); -#else // no gettimeofday() nor ftime() - // We use wxGetLocalTime() to get the seconds since - // 00:00:00 Jan 1st 1970 and then whatever is available - // to get millisecond resolution. - // - // NOTE that this might lead to a problem if the clocks - // use different sources, so this approach should be - // avoided where possible. - - val *= wxGetLocalTime(); - -// GRG: This will go soon as all WIN32 seem to have ftime -// JACS: unfortunately not. WinCE doesn't have it. -#if defined (__WIN32__) - // If your platform/compiler needs to use two different functions - // to get ms resolution, please do NOT just shut off these warnings, - // drop me a line instead at - - // FIXME -#ifndef __WXWINCE__ - #warning "Possible clock skew bug in wxGetLocalTimeMillis()!" -#endif - - SYSTEMTIME st; - ::GetLocalTime(&st); - val += st.wMilliseconds; -#else // !Win32 - // If your platform/compiler does not support ms resolution please - // do NOT just shut off these warnings, drop me a line instead at - // - - #if defined(__VISUALC__) || defined (__WATCOMC__) - #pragma message("wxStopWatch will be up to second resolution!") - #elif defined(__BORLANDC__) - #pragma message "wxStopWatch will be up to second resolution!" - #else - #warning "wxStopWatch will be up to second resolution!" - #endif // compiler -#endif - - return val; - -#endif // time functions -} - -#else // !wxUSE_LONGLONG - -double wxGetLocalTimeMillis(void) -{ - return (double(clock()) / double(CLOCKS_PER_SEC)) * 1000.0; -} - -#endif // wxUSE_LONGLONG/!wxUSE_LONGLONG diff --git a/Externals/wxWidgets3/src/common/strconv.cpp b/Externals/wxWidgets3/src/common/strconv.cpp index 25c6051b24..eea3e7c71f 100644 --- a/Externals/wxWidgets3/src/common/strconv.cpp +++ b/Externals/wxWidgets3/src/common/strconv.cpp @@ -5,7 +5,7 @@ // Ryan Norton, Fredrik Roubert (UTF7) // Modified by: // Created: 29/01/98 -// RCS-ID: $Id: strconv.cpp 66523 2011-01-02 16:59:15Z PC $ +// RCS-ID: $Id: strconv.cpp 70462 2012-01-25 00:10:44Z VZ $ // Copyright: (c) 1999 Ove Kaaven, Robert Roebling, Vaclav Slavik // (c) 2000-2003 Vadim Zeitlin // (c) 2004 Ryan Norton, Fredrik Roubert @@ -995,7 +995,7 @@ wxMBConvStrictUTF8::ToWChar(wchar_t *dst, size_t dstLen, for ( const char *p = src; ; p++ ) { - if ( !(srcLen == wxNO_LEN ? *p : srcLen) ) + if ( (srcLen == wxNO_LEN ? !*p : !srcLen) ) { // all done successfully, just add the trailing NULL if we are not // using explicit length @@ -1115,7 +1115,7 @@ wxMBConvStrictUTF8::FromWChar(char *dst, size_t dstLen, for ( const wchar_t *wp = src; ; wp++ ) { - if ( !(srcLen == wxNO_LEN ? *wp : srcLen) ) + if ( (srcLen == wxNO_LEN ? !*wp : !srcLen) ) { // all done successfully, just add the trailing NULL if we are not // using explicit length @@ -1145,6 +1145,8 @@ wxMBConvStrictUTF8::FromWChar(char *dst, size_t dstLen, { // skip the next char too as we decoded a surrogate wp++; + if ( srcLen != wxNO_LEN ) + srcLen--; } #else // wchar_t is UTF-32 code = *wp & 0x7fffffff; @@ -1230,7 +1232,10 @@ size_t wxMBConvUTF8::ToWChar(wchar_t *buf, size_t n, size_t len = 0; - while ((srcLen == wxNO_LEN ? *psz : srcLen--) && ((!buf) || (len < n))) + // The length can be either given explicitly or computed implicitly for the + // NUL-terminated strings. + const bool isNulTerminated = srcLen == wxNO_LEN; + while ((isNulTerminated ? *psz : srcLen--) && ((!buf) || (len < n))) { const char *opsz = psz; bool invalid = false; @@ -1364,10 +1369,17 @@ size_t wxMBConvUTF8::ToWChar(wchar_t *buf, size_t n, } } - if (srcLen == wxNO_LEN && buf && (len < n)) - *buf = 0; + if ( isNulTerminated ) + { + // Add the trailing NUL in this case if we have a large enough buffer. + if ( buf && (len < n) ) + *buf = 0; - return len + 1; + // And count it in any case. + len++; + } + + return len; } static inline bool isoctal(wchar_t wch) @@ -1383,7 +1395,10 @@ size_t wxMBConvUTF8::FromWChar(char *buf, size_t n, size_t len = 0; - while ((srcLen == wxNO_LEN ? *psz : srcLen--) && ((!buf) || (len < n))) + // The length can be either given explicitly or computed implicitly for the + // NUL-terminated strings. + const bool isNulTerminated = srcLen == wxNO_LEN; + while ((isNulTerminated ? *psz : srcLen--) && ((!buf) || (len < n))) { wxUint32 cc; @@ -1451,10 +1466,17 @@ size_t wxMBConvUTF8::FromWChar(char *buf, size_t n, } } - if (srcLen == wxNO_LEN && buf && (len < n)) - *buf = 0; + if ( isNulTerminated ) + { + // Add the trailing NUL in this case if we have a large enough buffer. + if ( buf && (len < n) ) + *buf = 0; - return len + 1; + // And count it in any case. + len++; + } + + return len; } // ============================================================================ @@ -1645,7 +1667,7 @@ wxMBConvUTF16straight::FromWChar(char *dst, size_t dstLen, wxUint16 *outBuff = reinterpret_cast(dst); for ( size_t n = 0; n < srcLen; n++ ) { - wxUint16 cc[2]; + wxUint16 cc[2] = { 0 }; const size_t numChars = encode_utf16(*src++, cc); if ( numChars == wxCONV_FAILED ) return wxCONV_FAILED; @@ -1728,7 +1750,7 @@ wxMBConvUTF16swap::FromWChar(char *dst, size_t dstLen, wxUint16 *outBuff = reinterpret_cast(dst); for ( const wchar_t *srcEnd = src + srcLen; src < srcEnd; src++ ) { - wxUint16 cc[2]; + wxUint16 cc[2] = { 0 }; const size_t numChars = encode_utf16(*src, cc); if ( numChars == wxCONV_FAILED ) return wxCONV_FAILED; @@ -1812,7 +1834,7 @@ wxMBConvUTF32straight::ToWChar(wchar_t *dst, size_t dstLen, size_t outLen = 0; for ( size_t n = 0; n < inLen; n++ ) { - wxUint16 cc[2]; + wxUint16 cc[2] = { 0 }; const size_t numChars = encode_utf16(*inBuff++, cc); if ( numChars == wxCONV_FAILED ) return wxCONV_FAILED; @@ -1890,7 +1912,7 @@ wxMBConvUTF32swap::ToWChar(wchar_t *dst, size_t dstLen, size_t outLen = 0; for ( size_t n = 0; n < inLen; n++, inBuff++ ) { - wxUint16 cc[2]; + wxUint16 cc[2] = { 0 }; const size_t numChars = encode_utf16(wxUINT32_SWAP_ALWAYS(*inBuff), cc); if ( numChars == wxCONV_FAILED ) return wxCONV_FAILED; diff --git a/Externals/wxWidgets3/src/common/string.cpp b/Externals/wxWidgets3/src/common/string.cpp index f232d4aff4..7b95949c01 100644 --- a/Externals/wxWidgets3/src/common/string.cpp +++ b/Externals/wxWidgets3/src/common/string.cpp @@ -4,7 +4,7 @@ // Author: Vadim Zeitlin, Ryan Norton // Modified by: // Created: 29/01/98 -// RCS-ID: $Id: string.cpp 67280 2011-03-22 14:17:38Z DS $ +// RCS-ID: $Id: string.cpp 70796 2012-03-04 00:29:31Z VZ $ // Copyright: (c) 1998 Vadim Zeitlin // (c) 2004 Ryan Norton // Licence: wxWindows licence @@ -41,9 +41,9 @@ #include "wx/vector.h" #include "wx/xlocale.h" -#ifdef __WXMSW__ +#ifdef __WINDOWS__ #include "wx/msw/wrapwin.h" -#endif // __WXMSW__ +#endif // __WINDOWS__ #if wxUSE_STD_IOSTREAM #include diff --git a/Externals/wxWidgets3/src/common/stringimpl.cpp b/Externals/wxWidgets3/src/common/stringimpl.cpp index aa766c0bc1..830ace8284 100644 --- a/Externals/wxWidgets3/src/common/stringimpl.cpp +++ b/Externals/wxWidgets3/src/common/stringimpl.cpp @@ -4,7 +4,7 @@ // Author: Vadim Zeitlin, Ryan Norton // Modified by: // Created: 29/01/98 -// RCS-ID: $Id: stringimpl.cpp 66728 2011-01-22 14:38:36Z DS $ +// RCS-ID: $Id: stringimpl.cpp 70150 2011-12-28 13:51:13Z VZ $ // Copyright: (c) 1998 Vadim Zeitlin // (c) 2004 Ryan Norton // Licence: wxWindows licence @@ -681,7 +681,11 @@ bool wxStringImpl::AssignCopy(size_t nSrcLen, // allocation failure handled by caller return false; } - memcpy(m_pchData, pszSrcData, nSrcLen*sizeof(wxStringCharType)); + + // use memmove() and not memcpy() here as we might be copying from our own + // buffer in case of assignment such as "s = s.c_str()" (see #11294) + memmove(m_pchData, pszSrcData, nSrcLen*sizeof(wxStringCharType)); + GetStringData()->nDataLength = nSrcLen; m_pchData[nSrcLen] = wxT('\0'); } diff --git a/Externals/wxWidgets3/src/common/strvararg.cpp b/Externals/wxWidgets3/src/common/strvararg.cpp index 6f1d678cc6..694a370d77 100644 --- a/Externals/wxWidgets3/src/common/strvararg.cpp +++ b/Externals/wxWidgets3/src/common/strvararg.cpp @@ -3,7 +3,7 @@ // Purpose: macros for implementing type-safe vararg passing of strings // Author: Vaclav Slavik // Created: 2007-02-19 -// RCS-ID: $Id: strvararg.cpp 65057 2010-07-23 23:32:46Z VZ $ +// RCS-ID: $Id: strvararg.cpp 70523 2012-02-06 13:28:34Z VZ $ // Copyright: (c) 2007 REA Elektronik GmbH // Licence: wxWindows licence /////////////////////////////////////////////////////////////////////////////// @@ -161,6 +161,19 @@ public: { if ( CopyFmtChar(*format++) == wxT('%') ) { +#if wxUSE_PRINTF_POS_PARAMS + if ( *format >= '0' && *format <= '9' ) + { + SkipDigits(&format); + if ( *format == '$' ) + { + // It was a positional argument specification. + CopyFmtChar(*format++); + } + //else: it was a width specification, nothing else to do. + } +#endif // wxUSE_PRINTF_POS_PARAMS + // skip any flags while ( IsFlagChar(*format) ) CopyFmtChar(*format++); diff --git a/Externals/wxWidgets3/src/common/sysopt.cpp b/Externals/wxWidgets3/src/common/sysopt.cpp index b7f14a1659..e16ff8256a 100644 --- a/Externals/wxWidgets3/src/common/sysopt.cpp +++ b/Externals/wxWidgets3/src/common/sysopt.cpp @@ -4,7 +4,7 @@ // Author: Julian Smart // Modified by: // Created: 2001-07-10 -// RCS-ID: $Id: sysopt.cpp 67280 2011-03-22 14:17:38Z DS $ +// RCS-ID: $Id: sysopt.cpp 70345 2012-01-15 01:05:28Z VZ $ // Copyright: (c) Julian Smart // Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// @@ -101,12 +101,7 @@ wxString wxSystemOptions::GetOption(const wxString& name) int wxSystemOptions::GetOptionInt(const wxString& name) { -#ifdef _PACC_VER - // work around the PalmOS pacc compiler bug - return wxAtoi (GetOption(name).data()); -#else return wxAtoi (GetOption(name)); -#endif } bool wxSystemOptions::HasOption(const wxString& name) diff --git a/Externals/wxWidgets3/src/common/tbarbase.cpp b/Externals/wxWidgets3/src/common/tbarbase.cpp index f198708da8..0baf8c4d79 100644 --- a/Externals/wxWidgets3/src/common/tbarbase.cpp +++ b/Externals/wxWidgets3/src/common/tbarbase.cpp @@ -4,7 +4,7 @@ // Author: Julian Smart // Modified by: VZ at 11.12.99 (wxScrollableToolBar split off) // Created: 04/01/98 -// RCS-ID: $Id: tbarbase.cpp 67206 2011-03-16 06:36:43Z SC $ +// RCS-ID: $Id: tbarbase.cpp 70179 2011-12-29 22:05:31Z VZ $ // Copyright: (c) Julian Smart // Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// @@ -701,12 +701,6 @@ void wxToolBarBase::UpdateWindowUI(long flags) if ( !IsShown() ) return; - // There is no sense in updating the toolbar UI - // if the parent window is about to get destroyed - wxWindow *tlw = wxGetTopLevelParent( this ); - if (tlw && wxPendingDelete.Member( tlw )) - return; - wxEvtHandler* evtHandler = GetEventHandler() ; for ( wxToolBarToolsList::compatibility_iterator node = m_tools.GetFirst(); @@ -757,7 +751,7 @@ bool wxCreateGreyedImage(const wxImage& in, wxImage& out) { #if wxUSE_IMAGE out = in.ConvertToGreyscale(); - if ( out.Ok() ) + if ( out.IsOk() ) return true; #endif // wxUSE_IMAGE return false; diff --git a/Externals/wxWidgets3/src/common/textbuf.cpp b/Externals/wxWidgets3/src/common/textbuf.cpp index cd46aa9464..28d1e7477c 100644 --- a/Externals/wxWidgets3/src/common/textbuf.cpp +++ b/Externals/wxWidgets3/src/common/textbuf.cpp @@ -3,7 +3,7 @@ // Purpose: implementation of wxTextBuffer class // Created: 14.11.01 // Author: Morten Hanssen, Vadim Zeitlin -// RCS-ID: $Id: textbuf.cpp 61508 2009-07-23 20:30:22Z VZ $ +// RCS-ID: $Id: textbuf.cpp 70345 2012-01-15 01:05:28Z VZ $ // Copyright: (c) 1998-2001 wxWidgets team // Licence: wxWindows licence /////////////////////////////////////////////////////////////////////////////// @@ -40,7 +40,7 @@ // - Mac when compiling with CodeWarrior (__WXMAC__) const wxTextFileType wxTextBuffer::typeDefault = -#if defined(__WINDOWS__) || defined(__DOS__) || defined(__PALMOS__) +#if defined(__WINDOWS__) || defined(__DOS__) wxTextFileType_Dos; #elif defined(__UNIX__) wxTextFileType_Unix; diff --git a/Externals/wxWidgets3/src/common/textcmn.cpp b/Externals/wxWidgets3/src/common/textcmn.cpp index e590bdd9a0..68dfc96258 100644 --- a/Externals/wxWidgets3/src/common/textcmn.cpp +++ b/Externals/wxWidgets3/src/common/textcmn.cpp @@ -4,7 +4,7 @@ // Author: Julian Smart // Modified by: // Created: 13.07.99 -// RCS-ID: $Id: textcmn.cpp 66592 2011-01-05 18:27:58Z PC $ +// RCS-ID: $Id: textcmn.cpp 70448 2012-01-23 12:33:03Z VZ $ // Copyright: (c) wxWidgets team // Licence: wxWindows licence /////////////////////////////////////////////////////////////////////////////// @@ -143,8 +143,8 @@ wxTextAttr::wxTextAttr(const wxColour& colText, { Init(); - if (m_colText.Ok()) m_flags |= wxTEXT_ATTR_TEXT_COLOUR; - if (m_colBack.Ok()) m_flags |= wxTEXT_ATTR_BACKGROUND_COLOUR; + if (m_colText.IsOk()) m_flags |= wxTEXT_ATTR_TEXT_COLOUR; + if (m_colBack.IsOk()) m_flags |= wxTEXT_ATTR_BACKGROUND_COLOUR; if (alignment != wxTEXT_ALIGNMENT_DEFAULT) m_flags |= wxTEXT_ATTR_ALIGNMENT; @@ -164,6 +164,7 @@ void wxTextAttr::Init() m_fontStyle = wxFONTSTYLE_NORMAL; m_fontWeight = wxFONTWEIGHT_NORMAL; m_fontUnderlined = false; + m_fontStrikethrough = false; m_fontEncoding = wxFONTENCODING_DEFAULT; m_fontFamily = wxFONTFAMILY_DEFAULT; @@ -193,6 +194,7 @@ void wxTextAttr::Copy(const wxTextAttr& attr) m_fontStyle = attr.m_fontStyle; m_fontWeight = attr.m_fontWeight; m_fontUnderlined = attr.m_fontUnderlined; + m_fontStrikethrough = attr.m_fontStrikethrough; m_fontFaceName = attr.m_fontFaceName; m_fontEncoding = attr.m_fontEncoding; m_fontFamily = attr.m_fontFamily; @@ -403,6 +405,10 @@ wxFont wxTextAttr::GetFont() const if (HasFontUnderlined()) underlined = GetFontUnderlined(); + bool strikethrough = false; + if ( HasFontStrikethrough() ) + strikethrough = GetFontStrikethrough(); + wxString fontFaceName; if (HasFontFaceName()) fontFaceName = GetFontFaceName(); @@ -416,13 +422,15 @@ wxFont wxTextAttr::GetFont() const fontFamily = GetFontFamily(); wxFont font(fontSize, fontFamily, fontStyle, fontWeight, underlined, fontFaceName, encoding); + if ( strikethrough ) + font.SetStrikethrough( true ); return font; } // Get attributes from font. bool wxTextAttr::GetFontAttributes(const wxFont& font, int flags) { - if (!font.Ok()) + if (!font.IsOk()) return false; if (flags & wxTEXT_ATTR_FONT_SIZE) @@ -437,6 +445,9 @@ bool wxTextAttr::GetFontAttributes(const wxFont& font, int flags) if (flags & wxTEXT_ATTR_FONT_UNDERLINE) m_fontUnderlined = font.GetUnderlined(); + if (flags & wxTEXT_ATTR_FONT_STRIKETHROUGH) + m_fontStrikethrough = font.GetStrikethrough(); + if (flags & wxTEXT_ATTR_FONT_FACE) m_fontFaceName = font.GetFaceName(); @@ -500,6 +511,12 @@ bool wxTextAttr::Apply(const wxTextAttr& style, const wxTextAttr* compareWith) destStyle.SetFontUnderlined(style.GetFontUnderlined()); } + if (style.HasFontStrikethrough()) + { + if (!(compareWith && compareWith->HasFontStrikethrough() && compareWith->GetFontStrikethrough() == style.GetFontStrikethrough())) + destStyle.SetFontStrikethrough(style.GetFontStrikethrough()); + } + if (style.HasFontFaceName()) { if (!(compareWith && compareWith->HasFontFaceName() && compareWith->GetFontFaceName() == style.GetFontFaceName())) @@ -518,13 +535,13 @@ bool wxTextAttr::Apply(const wxTextAttr& style, const wxTextAttr* compareWith) destStyle.SetFontFamily(style.GetFontFamily()); } - if (style.GetTextColour().Ok() && style.HasTextColour()) + if (style.GetTextColour().IsOk() && style.HasTextColour()) { if (!(compareWith && compareWith->HasTextColour() && compareWith->GetTextColour() == style.GetTextColour())) destStyle.SetTextColour(style.GetTextColour()); } - if (style.GetBackgroundColour().Ok() && style.HasBackgroundColour()) + if (style.GetBackgroundColour().IsOk() && style.HasBackgroundColour()) { if (!(compareWith && compareWith->HasBackgroundColour() && compareWith->GetBackgroundColour() == style.GetBackgroundColour())) destStyle.SetBackgroundColour(style.GetBackgroundColour()); @@ -670,30 +687,30 @@ wxTextAttr wxTextAttr::Combine(const wxTextAttr& attr, if (attr.HasFont()) font = attr.GetFont(); - if ( !font.Ok() ) + if ( !font.IsOk() ) { if (attrDef.HasFont()) font = attrDef.GetFont(); - if ( text && !font.Ok() ) + if ( text && !font.IsOk() ) font = text->GetFont(); } wxColour colFg = attr.GetTextColour(); - if ( !colFg.Ok() ) + if ( !colFg.IsOk() ) { colFg = attrDef.GetTextColour(); - if ( text && !colFg.Ok() ) + if ( text && !colFg.IsOk() ) colFg = text->GetForegroundColour(); } wxColour colBg = attr.GetBackgroundColour(); - if ( !colBg.Ok() ) + if ( !colBg.IsOk() ) { colBg = attrDef.GetBackgroundColour(); - if ( text && !colBg.Ok() ) + if ( text && !colBg.IsOk() ) colBg = text->GetBackgroundColour(); } @@ -773,7 +790,7 @@ bool wxTextAttr::BitlistsEqPartial(int valueA, int valueB, int flags) { int relevantBitsA = valueA & flags; int relevantBitsB = valueB & flags; - return (relevantBitsA != relevantBitsB); + return relevantBitsA == relevantBitsB; } /// Split into paragraph and character styles @@ -940,12 +957,47 @@ int wxTextCtrlBase::overflow(int c) bool wxTextCtrlBase::EmulateKeyPress(const wxKeyEvent& event) { + bool handled = false; // we have a native implementation for Win32 and so don't need this one #ifndef __WIN32__ wxChar ch = 0; int keycode = event.GetKeyCode(); + + long from, to; + GetSelection(&from,&to); + long insert = GetInsertionPoint(); + long last = GetLastPosition(); + + // catch arrow left and right + switch ( keycode ) { + case WXK_LEFT: + if ( event.ShiftDown() ) + SetSelection( (from > 0 ? from - 1 : 0) , to ); + else + { + if ( from != to ) + insert = from; + else if ( insert > 0 ) + insert -= 1; + SetInsertionPoint( insert ); + } + handled = true; + break; + case WXK_RIGHT: + if ( event.ShiftDown() ) + SetSelection( from, (to < last ? to + 1 : last) ); + else + { + if ( from != to ) + insert = to; + else if ( insert < last ) + insert += 1; + SetInsertionPoint( insert ); + } + handled = true; + break; case WXK_NUMPAD0: case WXK_NUMPAD1: case WXK_NUMPAD2: @@ -991,6 +1043,7 @@ bool wxTextCtrlBase::EmulateKeyPress(const wxKeyEvent& event) const long pos = GetInsertionPoint(); if ( pos < GetLastPosition() ) Remove(pos, pos + 1); + handled = true; } break; @@ -1000,6 +1053,7 @@ bool wxTextCtrlBase::EmulateKeyPress(const wxKeyEvent& event) const long pos = GetInsertionPoint(); if ( pos > 0 ) Remove(pos - 1, pos); + handled = true; } break; @@ -1031,13 +1085,13 @@ bool wxTextCtrlBase::EmulateKeyPress(const wxKeyEvent& event) { WriteText(ch); - return true; + handled = true; } #else // __WIN32__ wxUnusedVar(event); #endif // !__WIN32__/__WIN32__ - return false; + return handled; } // do the window-specific processing after processing the update event @@ -1084,6 +1138,19 @@ wxTextAreaBase::HitTest(const wxPoint& WXUNUSED(pt), long * WXUNUSED(pos)) const return wxTE_HT_UNKNOWN; } +wxPoint wxTextAreaBase::PositionToCoords(long pos) const +{ + wxCHECK_MSG( IsValidPosition(pos), wxDefaultPosition, + wxS("Position argument out of range.") ); + + return DoPositionToCoords(pos); +} + +wxPoint wxTextAreaBase::DoPositionToCoords(long WXUNUSED(pos)) const +{ + return wxDefaultPosition; +} + #else // !wxUSE_TEXTCTRL // define this one even if !wxUSE_TEXTCTRL because it is also used by other diff --git a/Externals/wxWidgets3/src/common/textentrycmn.cpp b/Externals/wxWidgets3/src/common/textentrycmn.cpp index 281086db98..a344f8319d 100644 --- a/Externals/wxWidgets3/src/common/textentrycmn.cpp +++ b/Externals/wxWidgets3/src/common/textentrycmn.cpp @@ -3,7 +3,7 @@ // Purpose: wxTextEntryBase implementation // Author: Vadim Zeitlin // Created: 2007-09-26 -// RCS-ID: $Id: textentrycmn.cpp 65552 2010-09-15 22:10:20Z VZ $ +// RCS-ID: $Id: textentrycmn.cpp 67515 2011-04-16 17:27:34Z VZ $ // Copyright: (c) 2007 Vadim Zeitlin // Licence: wxWindows licence /////////////////////////////////////////////////////////////////////////////// @@ -31,6 +31,7 @@ #endif //WX_PRECOMP #include "wx/textentry.h" +#include "wx/textcompleter.h" #include "wx/clipbrd.h" // ---------------------------------------------------------------------------- @@ -368,4 +369,39 @@ bool wxTextEntryBase::SendTextUpdatedEvent(wxWindow *win) return win->HandleWindowEvent(event); } +// ---------------------------------------------------------------------------- +// auto-completion stubs +// ---------------------------------------------------------------------------- + +wxTextCompleter::~wxTextCompleter() +{ +} + +bool wxTextCompleterSimple::Start(const wxString& prefix) +{ + m_index = 0; + m_completions.clear(); + GetCompletions(prefix, m_completions); + + return !m_completions.empty(); +} + +wxString wxTextCompleterSimple::GetNext() +{ + if ( m_index == m_completions.size() ) + return wxString(); + + return m_completions[m_index++]; +} + +bool wxTextEntryBase::DoAutoCompleteCustom(wxTextCompleter *completer) +{ + // We don't do anything here but we still need to delete the completer for + // consistency with the ports that do implement this method and take + // ownership of the pointer. + delete completer; + + return false; +} + #endif // wxUSE_TEXTCTRL || wxUSE_COMBOBOX diff --git a/Externals/wxWidgets3/src/common/time.cpp b/Externals/wxWidgets3/src/common/time.cpp new file mode 100644 index 0000000000..0be9306a0b --- /dev/null +++ b/Externals/wxWidgets3/src/common/time.cpp @@ -0,0 +1,372 @@ +/////////////////////////////////////////////////////////////////////////////// +// Name: src/common/time.cpp +// Purpose: Implementation of time-related functions. +// Author: Vadim Zeitlin +// Created: 2011-11-26 +// RCS-ID: $Id: time.cpp 70796 2012-03-04 00:29:31Z VZ $ +// Copyright: (c) 2011 Vadim Zeitlin +// Licence: wxWindows licence +/////////////////////////////////////////////////////////////////////////////// + +// ============================================================================ +// declarations +// ============================================================================ + +// ---------------------------------------------------------------------------- +// headers +// ---------------------------------------------------------------------------- + +// for compilers that support precompilation, includes "wx.h". +#include "wx/wxprec.h" + +#ifdef __BORLANDC__ + #pragma hdrstop +#endif + +#include "wx/time.h" + +#ifndef WX_PRECOMP + #ifdef __WINDOWS__ + #include "wx/msw/wrapwin.h" + #endif + #include "wx/intl.h" + #include "wx/log.h" +#endif + +#ifndef WX_GMTOFF_IN_TM + // Define it for some systems which don't (always) use configure but are + // known to have tm_gmtoff field. + #if defined(__DARWIN__) + #define WX_GMTOFF_IN_TM + #endif +#endif + +#if defined(__VISAGECPP__) && !defined(HAVE_FTIME) + #define HAVE_FTIME +# if __IBMCPP__ >= 400 + # define ftime(x) _ftime(x) +# endif +#endif + +#if defined(__MWERKS__) && defined(__WINDOWS__) +# undef HAVE_FTIME +# undef HAVE_GETTIMEOFDAY +#endif + +#ifndef __WXWINCE__ +#include +#else +#include "wx/msw/private.h" +#include "wx/msw/wince/time.h" +#endif + + +#if !defined(__WXMAC__) && !defined(__WXWINCE__) + #include // for time_t +#endif + +#if defined(HAVE_GETTIMEOFDAY) + #include + #include +#elif defined(HAVE_FTIME) + #include +#endif + +#if defined(__MWERKS__) && wxUSE_UNICODE + #include +#endif + +#if defined(__DJGPP__) || defined(__WINE__) + #include + #include +#endif + +namespace +{ + +const int MILLISECONDS_PER_SECOND = 1000; +const int MICROSECONDS_PER_MILLISECOND = 1000; +const int MICROSECONDS_PER_SECOND = 1000*1000; + +} // anonymous namespace + +// ============================================================================ +// implementation +// ============================================================================ + +// NB: VC8 safe time functions could/should be used for wxMSW as well probably +#if defined(__WXWINCE__) && defined(__VISUALC8__) + +struct tm *wxLocaltime_r(const time_t *t, struct tm* tm) +{ + __time64_t t64 = *t; + return _localtime64_s(tm, &t64) == 0 ? tm : NULL; +} + +struct tm *wxGmtime_r(const time_t* t, struct tm* tm) +{ + __time64_t t64 = *t; + return _gmtime64_s(tm, &t64) == 0 ? tm : NULL; +} + +#else // !wxWinCE with VC8 + +#if (!defined(HAVE_LOCALTIME_R) || !defined(HAVE_GMTIME_R)) && wxUSE_THREADS && !defined(__WINDOWS__) +static wxMutex timeLock; +#endif + +#ifndef HAVE_LOCALTIME_R +struct tm *wxLocaltime_r(const time_t* ticks, struct tm* temp) +{ +#if wxUSE_THREADS && !defined(__WINDOWS__) + // No need to waste time with a mutex on windows since it's using + // thread local storage for localtime anyway. + wxMutexLocker locker(timeLock); +#endif + + // Borland CRT crashes when passed 0 ticks for some reason, see SF bug 1704438 +#ifdef __BORLANDC__ + if ( !*ticks ) + return NULL; +#endif + + const tm * const t = localtime(ticks); + if ( !t ) + return NULL; + + memcpy(temp, t, sizeof(struct tm)); + return temp; +} +#endif // !HAVE_LOCALTIME_R + +#ifndef HAVE_GMTIME_R +struct tm *wxGmtime_r(const time_t* ticks, struct tm* temp) +{ +#if wxUSE_THREADS && !defined(__WINDOWS__) + // No need to waste time with a mutex on windows since it's + // using thread local storage for gmtime anyway. + wxMutexLocker locker(timeLock); +#endif + +#ifdef __BORLANDC__ + if ( !*ticks ) + return NULL; +#endif + + const tm * const t = gmtime(ticks); + if ( !t ) + return NULL; + + memcpy(temp, gmtime(ticks), sizeof(struct tm)); + return temp; +} +#endif // !HAVE_GMTIME_R + +#endif // wxWinCE with VC8/other platforms + +// returns the time zone in the C sense, i.e. the difference UTC - local +// (in seconds) +int wxGetTimeZone() +{ +#ifdef WX_GMTOFF_IN_TM + // set to true when the timezone is set + static bool s_timezoneSet = false; + static long gmtoffset = LONG_MAX; // invalid timezone + + // ensure that the timezone variable is set by calling wxLocaltime_r + if ( !s_timezoneSet ) + { + // just call wxLocaltime_r() instead of figuring out whether this + // system supports tzset(), _tzset() or something else + time_t t = time(NULL); + struct tm tm; + + wxLocaltime_r(&t, &tm); + s_timezoneSet = true; + + // note that GMT offset is the opposite of time zone and so to return + // consistent results in both WX_GMTOFF_IN_TM and !WX_GMTOFF_IN_TM + // cases we have to negate it + gmtoffset = -tm.tm_gmtoff; + + // this function is supposed to return the same value whether DST is + // enabled or not, so we need to use an additional offset if DST is on + // as tm_gmtoff already does include it + if ( tm.tm_isdst ) + gmtoffset += 3600; + } + return (int)gmtoffset; +#elif defined(__DJGPP__) || defined(__WINE__) + struct timeb tb; + ftime(&tb); + return tb.timezone*60; +#elif defined(__VISUALC__) + // We must initialize the time zone information before using it (this will + // be done only once internally). + _tzset(); + + // Starting with VC++ 8 timezone variable is deprecated and is not even + // available in some standard library version so use the new function for + // accessing it instead. + #if wxCHECK_VISUALC_VERSION(8) + long t; + _get_timezone(&t); + return t; + #else // VC++ < 8 + return timezone; + #endif +#else // Use some kind of time zone variable. + // In any case we must initialize the time zone before using it. + tzset(); + + #if defined(WX_TIMEZONE) // If WX_TIMEZONE was defined by configure, use it. + return WX_TIMEZONE; + #elif defined(__BORLANDC__) || defined(__MINGW32__) || defined(__VISAGECPP__) + return _timezone; + #elif defined(__MWERKS__) + // This is just plain wrong but apparently MetroWerks runtime didn't have + // any way to get the time zone. + return 28800; + #else // unknown platform -- assume it has timezone + return timezone; + #endif // different time zone variables +#endif // different ways to determine time zone +} + +// Get local time as seconds since 00:00:00, Jan 1st 1970 +long wxGetLocalTime() +{ + struct tm tm; + time_t t0, t1; + + // This cannot be made static because mktime can overwrite it. + // + memset(&tm, 0, sizeof(tm)); + tm.tm_year = 70; + tm.tm_mon = 0; + tm.tm_mday = 5; // not Jan 1st 1970 due to mktime 'feature' + tm.tm_hour = 0; + tm.tm_min = 0; + tm.tm_sec = 0; + tm.tm_isdst = -1; // let mktime guess + + // Note that mktime assumes that the struct tm contains local time. + // + t1 = time(&t1); // now + t0 = mktime(&tm); // origin + + // Return the difference in seconds. + // + if (( t0 != (time_t)-1 ) && ( t1 != (time_t)-1 )) + return (long)difftime(t1, t0) + (60 * 60 * 24 * 4); + + wxLogSysError(_("Failed to get the local system time")); + return -1; +} + +// Get UTC time as seconds since 00:00:00, Jan 1st 1970 +long wxGetUTCTime() +{ + return (long)time(NULL); +} + +#if wxUSE_LONGLONG + +wxLongLong wxGetUTCTimeUSec() +{ +#if defined(__WINDOWS__) + FILETIME ft; + ::GetSystemTimeAsFileTime(&ft); + + // FILETIME is in 100ns or 0.1us since 1601-01-01, transform to us since + // 1970-01-01. + wxLongLong t(ft.dwHighDateTime, ft.dwLowDateTime); + t /= 10; + t -= wxLL(11644473600000000); // Unix - Windows epochs difference in us. + return t; +#else // non-MSW + +#ifdef HAVE_GETTIMEOFDAY + timeval tv; + if ( wxGetTimeOfDay(&tv) != -1 ) + { + wxLongLong val(tv.tv_sec); + val *= MICROSECONDS_PER_SECOND; + val += tv.tv_usec; + return val; + } +#endif // HAVE_GETTIMEOFDAY + + // Fall back to lesser precision function. + return wxGetUTCTimeMillis()*MICROSECONDS_PER_MILLISECOND; +#endif // MSW/!MSW +} + +// Get local time as milliseconds since 00:00:00, Jan 1st 1970 +wxLongLong wxGetUTCTimeMillis() +{ + wxLongLong val = MILLISECONDS_PER_SECOND; + + // If possible, use a function which avoids conversions from + // broken-up time structures to milliseconds +#if defined(__WINDOWS__) + FILETIME ft; + ::GetSystemTimeAsFileTime(&ft); + + // FILETIME is expressed in 100ns (or 0.1us) units since 1601-01-01, + // transform them to ms since 1970-01-01. + wxLongLong t(ft.dwHighDateTime, ft.dwLowDateTime); + t /= 10000; + t -= wxLL(11644473600000); // Unix - Windows epochs difference in ms. + return t; +#elif defined(HAVE_GETTIMEOFDAY) + struct timeval tp; + if ( wxGetTimeOfDay(&tp) != -1 ) + { + val *= tp.tv_sec; + return (val + (tp.tv_usec / MICROSECONDS_PER_MILLISECOND)); + } + else + { + wxLogError(_("wxGetTimeOfDay failed.")); + return 0; + } +#elif defined(HAVE_FTIME) + struct timeb tp; + + // ftime() is void and not int in some mingw32 headers, so don't + // test the return code (well, it shouldn't fail anyhow...) + (void)::ftime(&tp); + val *= tp.time; + return (val + tp.millitm); +#else // no gettimeofday() nor ftime() + // If your platform/compiler does not support ms resolution please + // do NOT just shut off these warnings, drop me a line instead at + // + + #if defined(__VISUALC__) || defined (__WATCOMC__) + #pragma message("wxStopWatch will be up to second resolution!") + #elif defined(__BORLANDC__) + #pragma message "wxStopWatch will be up to second resolution!" + #else + #warning "wxStopWatch will be up to second resolution!" + #endif // compiler + + val *= wxGetUTCTime(); + return val; +#endif // time functions +} + +wxLongLong wxGetLocalTimeMillis() +{ + return wxGetUTCTimeMillis() - wxGetTimeZone()*MILLISECONDS_PER_SECOND; +} + +#else // !wxUSE_LONGLONG + +double wxGetLocalTimeMillis(void) +{ + return (double(clock()) / double(CLOCKS_PER_SEC)) * 1000.0; +} + +#endif // wxUSE_LONGLONG/!wxUSE_LONGLONG diff --git a/Externals/wxWidgets3/src/common/toplvcmn.cpp b/Externals/wxWidgets3/src/common/toplvcmn.cpp index fa3176bb19..5b4dcb3837 100644 --- a/Externals/wxWidgets3/src/common/toplvcmn.cpp +++ b/Externals/wxWidgets3/src/common/toplvcmn.cpp @@ -3,7 +3,7 @@ // Purpose: common (for all platforms) wxTopLevelWindow functions // Author: Julian Smart, Vadim Zeitlin // Created: 01/02/97 -// Id: $Id: toplvcmn.cpp 63171 2010-01-18 00:28:53Z VZ $ +// Id: $Id: toplvcmn.cpp 68366 2011-07-24 22:19:33Z VZ $ // Copyright: (c) 1998 Robert Roebling and Julian Smart // Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// @@ -39,11 +39,8 @@ BEGIN_EVENT_TABLE(wxTopLevelWindowBase, wxWindow) EVT_CLOSE(wxTopLevelWindowBase::OnCloseWindow) EVT_SIZE(wxTopLevelWindowBase::OnSize) - WX_EVENT_TABLE_CONTROL_CONTAINER(wxTopLevelWindowBase) END_EVENT_TABLE() -WX_DELEGATE_TO_CONTROL_CONTAINER(wxTopLevelWindowBase, wxWindow) - // ============================================================================ // implementation // ============================================================================ @@ -58,8 +55,6 @@ wxTopLevelWindowBase::wxTopLevelWindowBase() { // Unlike windows, top level windows are created hidden by default. m_isShown = false; - - WX_INIT_CONTROL_CONTAINER(); } wxTopLevelWindowBase::~wxTopLevelWindowBase() @@ -352,7 +347,7 @@ void wxTopLevelWindowBase::SetIcon(const wxIcon& icon) // passing wxNullIcon to SetIcon() is possible (it means that we shouldn't // have any icon), but adding an invalid icon to wxIconBundle is not wxIconBundle icons; - if ( icon.Ok() ) + if ( icon.IsOk() ) icons.AddIcon(icon); SetIcons(icons); diff --git a/Externals/wxWidgets3/src/common/translation.cpp b/Externals/wxWidgets3/src/common/translation.cpp index a278f8aa3e..db59ccd0f2 100644 --- a/Externals/wxWidgets3/src/common/translation.cpp +++ b/Externals/wxWidgets3/src/common/translation.cpp @@ -5,7 +5,7 @@ // Michael N. Filippov // (2003/09/30 - PluralForms support) // Created: 2010-04-23 -// RCS-ID: $Id: translation.cpp 67280 2011-03-22 14:17:38Z DS $ +// RCS-ID: $Id: translation.cpp 70796 2012-03-04 00:29:31Z VZ $ // Copyright: (c) 1998 Vadim Zeitlin // Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// @@ -50,7 +50,7 @@ #include "wx/stdpaths.h" #include "wx/hashset.h" -#ifdef __WXMSW__ +#ifdef __WINDOWS__ #include "wx/msw/wrapwin.h" #endif @@ -986,7 +986,7 @@ bool wxMsgCatalogFile::LoadData(const DataBuffer& data, if ( m_charset == wxS("CHARSET") ) { // "CHARSET" is not valid charset, but lazy translator - m_charset.empty(); + m_charset.clear(); } } } @@ -1440,7 +1440,7 @@ wxString wxTranslations::ChooseLanguageForDomain(const wxString& WXUNUSED(domain namespace { -WX_DECLARE_HASH_SET(wxString, wxStringHash, wxStringEqual, +WX_DECLARE_HASH_SET(wxString, ::wxStringHash, ::wxStringEqual, wxLocaleUntranslatedStrings); } diff --git a/Externals/wxWidgets3/src/common/treebase.cpp b/Externals/wxWidgets3/src/common/treebase.cpp index 92134a0a0c..5bb5455d4b 100644 --- a/Externals/wxWidgets3/src/common/treebase.cpp +++ b/Externals/wxWidgets3/src/common/treebase.cpp @@ -4,7 +4,7 @@ // Author: Julian Smart // Created: 01/02/97 // Modified: -// Id: $Id: treebase.cpp 67254 2011-03-20 00:14:35Z DS $ +// Id: $Id: treebase.cpp 70795 2012-03-04 00:29:21Z VZ $ // Copyright: (c) 1998 Robert Roebling, Julian Smart et al // Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// @@ -167,6 +167,22 @@ wxTreeEvent::wxTreeEvent(const wxTreeEvent & event) // wxTreeCtrlBase // ---------------------------------------------------------------------------- +wxTreeCtrlBase::wxTreeCtrlBase() +{ + m_imageListNormal = + m_imageListState = NULL; + m_ownsImageListNormal = + m_ownsImageListState = false; + + // arbitrary default + m_spacing = 18; + + // quick DoGetBestSize calculation + m_quickBestSize = true; + + Connect(wxEVT_CHAR_HOOK, wxKeyEventHandler(wxTreeCtrlBase::OnCharHook)); +} + wxTreeCtrlBase::~wxTreeCtrlBase() { if (m_ownsImageListNormal) @@ -335,4 +351,26 @@ bool wxTreeCtrlBase::IsEmpty() const return !GetRootItem().IsOk(); } +void wxTreeCtrlBase::OnCharHook(wxKeyEvent& event) +{ + if ( GetEditControl() ) + { + bool discardChanges = false; + switch ( event.GetKeyCode() ) + { + case WXK_ESCAPE: + discardChanges = true; + // fall through + + case WXK_RETURN: + EndEditLabel(GetFocusedItem(), discardChanges); + + // Do not call Skip() below. + return; + } + } + + event.Skip(); +} + #endif // wxUSE_TREECTRL diff --git a/Externals/wxWidgets3/src/common/txtstrm.cpp b/Externals/wxWidgets3/src/common/txtstrm.cpp index 52865e8ab5..11da612bb9 100644 --- a/Externals/wxWidgets3/src/common/txtstrm.cpp +++ b/Externals/wxWidgets3/src/common/txtstrm.cpp @@ -4,7 +4,7 @@ // Author: Guilhem Lavaux // Modified by: // Created: 28/06/98 -// RCS-ID: $Id: txtstrm.cpp 63244 2010-01-24 10:13:33Z VZ $ +// RCS-ID: $Id: txtstrm.cpp 70796 2012-03-04 00:29:31Z VZ $ // Copyright: (c) Guilhem Lavaux // Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// @@ -336,7 +336,7 @@ wxTextOutputStream::wxTextOutputStream(wxOutputStream& s, wxEOL mode) m_mode = mode; if (m_mode == wxEOL_NATIVE) { -#if defined(__WXMSW__) || defined(__WXPM__) +#if defined(__WINDOWS__) || defined(__WXPM__) m_mode = wxEOL_DOS; #else m_mode = wxEOL_UNIX; @@ -356,7 +356,7 @@ void wxTextOutputStream::SetMode(wxEOL mode) m_mode = mode; if (m_mode == wxEOL_NATIVE) { -#if defined(__WXMSW__) || defined(__WXPM__) +#if defined(__WINDOWS__) || defined(__WXPM__) m_mode = wxEOL_DOS; #else m_mode = wxEOL_UNIX; diff --git a/Externals/wxWidgets3/src/common/uiactioncmn.cpp b/Externals/wxWidgets3/src/common/uiactioncmn.cpp index 85376a86bf..96097c9e27 100644 --- a/Externals/wxWidgets3/src/common/uiactioncmn.cpp +++ b/Externals/wxWidgets3/src/common/uiactioncmn.cpp @@ -4,7 +4,7 @@ // Author: Kevin Ollivier, Steven Lamerton, Vadim Zeitlin // Modified by: // Created: 2010-03-06 -// RCS-ID: $Id: uiactioncmn.cpp 65561 2010-09-17 11:17:55Z DS $ +// RCS-ID: $Id: uiactioncmn.cpp 69960 2011-12-08 15:55:40Z VZ $ // Copyright: (c) Kevin Ollivier // (c) 2010 Steven Lamerton // (c) 2010 Vadim Zeitlin @@ -80,6 +80,51 @@ void wxUIActionSimulator::SimulateModifiers(int modifiers, bool isDown) bool wxUIActionSimulator::Char(int keycode, int modifiers) { + switch(keycode) + { + case '0': + keycode = '0'; + break; + case '1': + keycode = '1'; + break; + case '2': + keycode = '2'; + break; + case '3': + keycode = '3'; + break; + case '4': + keycode = '4'; + break; + case '5': + keycode = '5'; + break; + case '6': + keycode = '6'; + break; + case '7': + keycode = '7'; + break; + case '8': + keycode = '8'; + break; + case '9': + keycode = '9'; + break; + case '+': + keycode = '+'; + break; + case '-': + keycode = '-'; + break; + case '.': + keycode = '.'; + break; + default: + break; + }; + Key(keycode, modifiers, true); Key(keycode, modifiers, false); @@ -91,9 +136,6 @@ bool wxUIActionSimulator::Text(const char *s) while ( *s != '\0' ) { const char ch = *s++; - - wxASSERT_MSG( ch, "Only letters are allowed" ); - if ( !Char(ch, isupper(ch) ? wxMOD_SHIFT : 0) ) return false; } diff --git a/Externals/wxWidgets3/src/common/utilscmn.cpp b/Externals/wxWidgets3/src/common/utilscmn.cpp index c4d1d6e152..6fdb219826 100644 --- a/Externals/wxWidgets3/src/common/utilscmn.cpp +++ b/Externals/wxWidgets3/src/common/utilscmn.cpp @@ -4,7 +4,7 @@ // Author: Julian Smart // Modified by: // Created: 29/01/98 -// RCS-ID: $Id: utilscmn.cpp 67129 2011-03-05 12:21:20Z SC $ +// RCS-ID: $Id: utilscmn.cpp 70796 2012-03-04 00:29:31Z VZ $ // Copyright: (c) 1998 Julian Smart // Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// @@ -76,26 +76,22 @@ #include "wx/statusbr.h" #endif // wxUSE_GUI -#ifndef __WXPALMOS5__ #ifndef __WXWINCE__ #include #else #include "wx/msw/wince/time.h" #endif -#endif // ! __WXPALMOS5__ #ifdef __WXMAC__ #include "wx/osx/private.h" #endif -#ifndef __WXPALMOS5__ #if !defined(__MWERKS__) && !defined(__WXWINCE__) #include #include #endif -#endif // ! __WXPALMOS5__ -#if defined(__WXMSW__) +#if defined(__WINDOWS__) #include "wx/msw/private.h" #include "wx/filesys.h" #endif @@ -354,7 +350,7 @@ void wxPlatform::ClearPlatforms() bool wxPlatform::Is(int platform) { -#ifdef __WXMSW__ +#ifdef __WINDOWS__ if (platform == wxOS_WINDOWS) return true; #endif @@ -394,10 +390,6 @@ bool wxPlatform::Is(int platform) if (platform == wxOS_UNIX) return true; #endif -#ifdef __WXMGL__ - if (platform == wxPORT_MGL) - return true; -#endif #ifdef __OS2__ if (platform == wxOS_OS2) return true; @@ -580,10 +572,21 @@ bool wxGetEnvMap(wxEnvVariableHashMap *map) #else // non-MSVC non-Mac // Not sure if other compilers have _tenviron so use the (more standard) // ANSI version only for them. -#ifdef __BSD__ - // POSIX, but not in an include file + + // Both POSIX and Single UNIX Specification say that this variable must + // exist but not that it must be declared anywhere and, indeed, it's not + // declared in several common systems (some BSDs, Solaris with native CC) + // so we (re)declare it ourselves to deal with these cases. However we do + // not do this under MSW where there can be DLL-related complications, i.e. + // the variable might be DLL-imported or not. Luckily we don't have to + // worry about this as all MSW compilers do seem to define it in their + // standard headers anyhow so we can just rely on already having the + // correct declaration. And if this turns out to be wrong, we can always + // add a configure test checking whether it is declared later. +#ifndef __WINDOWS__ extern char **environ; -#endif +#endif // !__WINDOWS__ + char **env = environ; #endif @@ -812,8 +815,8 @@ typedef struct smaller partition. This *guarantees* no more than log (n) stack size is needed (actually O(1) in this case)! */ -void wxQsort(void *const pbase, size_t total_elems, - size_t size, CMPFUNCDATA cmp, const void* user_data) +void wxQsort(void* pbase, size_t total_elems, + size_t size, wxSortCallback cmp, const void* user_data) { register char *base_ptr = (char *) pbase; const size_t max_thresh = MAX_THRESH * size; @@ -995,7 +998,7 @@ bool wxSetDetectableAutoRepeat( bool WXUNUSED(flag) ) // Launch default browser // ---------------------------------------------------------------------------- -#if defined(__WXMSW__) +#if defined(__WINDOWS__) // implemented in a port-specific utils source file: bool wxDoLaunchDefaultBrowser(const wxString& url, const wxString& scheme, int flags); @@ -1061,7 +1064,7 @@ static bool DoLaunchDefaultBrowserHelper(const wxString& urlOrig, int flags) // (e.g. "C:\\test.txt" when parsed by wxURI reports a scheme == "C") bool hasValidScheme = uri.HasScheme() && uri.GetScheme().length() > 1; -#if defined(__WXMSW__) +#if defined(__WINDOWS__) // NOTE: when testing wxMSW's wxLaunchDefaultBrowser all possible forms // of the URL/flags should be tested; e.g.: @@ -1361,6 +1364,8 @@ int wxMessageBox(const wxString& message, const wxString& caption, long style, return wxNO; case wxID_CANCEL: return wxCANCEL; + case wxID_HELP: + return wxHELP; } wxFAIL_MSG( wxT("unexpected return code from wxMessageDialog") ); @@ -1406,7 +1411,7 @@ wxVersionInfo wxGetLibraryVersionInfo() wxMINOR_VERSION, wxRELEASE_NUMBER, msg, - wxS("Copyright (c) 1995-2010 wxWidgets team")); + wxS("Copyright (c) 1995-2011 wxWidgets team")); } void wxInfoMessageBox(wxWindow* parent) @@ -1536,7 +1541,7 @@ wxColour wxGetColourFromUser(wxWindow *parent, wxFont wxGetFontFromUser(wxWindow *parent, const wxFont& fontInit, const wxString& caption) { wxFontData data; - if ( fontInit.Ok() ) + if ( fontInit.IsOk() ) { data.SetInitialFont(fontInit); } diff --git a/Externals/wxWidgets3/src/common/valgen.cpp b/Externals/wxWidgets3/src/common/valgen.cpp index fa04139d2f..7bbdc13088 100644 --- a/Externals/wxWidgets3/src/common/valgen.cpp +++ b/Externals/wxWidgets3/src/common/valgen.cpp @@ -4,7 +4,7 @@ // Author: Kevin Smith // Modified by: // Created: Jan 22 1999 -// RCS-ID: $Id: valgen.cpp 66533 2011-01-03 11:23:49Z VZ $ +// RCS-ID: $Id: valgen.cpp 68225 2011-07-11 14:51:32Z VZ $ // Copyright: (c) 1999 Kevin Smith // Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// @@ -46,6 +46,7 @@ #if wxUSE_TOGGLEBTN #include "wx/tglbtn.h" #endif +#include "wx/filename.h" #include "wx/valgen.h" @@ -83,6 +84,24 @@ wxGenericValidator::wxGenericValidator(wxDateTime *val) m_pDateTime = val; } +wxGenericValidator::wxGenericValidator(wxFileName *val) +{ + Initialize(); + m_pFileName = val; +} + +wxGenericValidator::wxGenericValidator(float *val) +{ + Initialize(); + m_pFloat = val; +} + +wxGenericValidator::wxGenericValidator(double *val) +{ + Initialize(); + m_pDouble = val; +} + #endif // wxUSE_DATETIME wxGenericValidator::wxGenericValidator(const wxGenericValidator& val) @@ -102,6 +121,9 @@ bool wxGenericValidator::Copy(const wxGenericValidator& val) #if wxUSE_DATETIME m_pDateTime = val.m_pDateTime; #endif // wxUSE_DATETIME + m_pFileName = val.m_pFileName; + m_pFloat = val.m_pFloat; + m_pDouble = val.m_pDouble; return true; } @@ -321,6 +343,21 @@ bool wxGenericValidator::TransferToWindow(void) pControl->SetValue(str); return true; } + else if (m_pFileName) + { + pControl->SetValue(m_pFileName->GetFullPath()); + return true; + } + else if (m_pFloat) + { + pControl->SetValue(wxString::Format(wxT("%g"), *m_pFloat)); + return true; + } + else if (m_pDouble) + { + pControl->SetValue(wxString::Format(wxT("%g"), *m_pDouble)); + return true; + } } else #endif @@ -582,6 +619,21 @@ bool wxGenericValidator::TransferFromWindow(void) *m_pInt = wxAtoi(pControl->GetValue()); return true; } + else if (m_pFileName) + { + m_pFileName->Assign(pControl->GetValue()); + return true; + } + else if (m_pFloat) + { + *m_pFloat = (float)wxAtof(pControl->GetValue()); + return true; + } + else if (m_pDouble) + { + *m_pDouble = wxAtof(pControl->GetValue()); + return true; + } } else #endif @@ -645,13 +697,16 @@ bool wxGenericValidator::TransferFromWindow(void) */ void wxGenericValidator::Initialize() { - m_pBool = 0; - m_pInt = 0; - m_pString = 0; - m_pArrayInt = 0; + m_pBool = NULL; + m_pInt = NULL; + m_pString = NULL; + m_pArrayInt = NULL; #if wxUSE_DATETIME - m_pDateTime = 0; + m_pDateTime = NULL; #endif // wxUSE_DATETIME + m_pFileName = NULL; + m_pFloat = NULL; + m_pDouble = NULL; } #endif // wxUSE_VALIDATORS diff --git a/Externals/wxWidgets3/src/common/webview.cpp b/Externals/wxWidgets3/src/common/webview.cpp new file mode 100644 index 0000000000..79524c245b --- /dev/null +++ b/Externals/wxWidgets3/src/common/webview.cpp @@ -0,0 +1,119 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: webview.cpp +// Purpose: Common interface and events for web view component +// Author: Marianne Gagnon +// Id: $Id: webview.cpp 69981 2011-12-11 05:36:52Z PC $ +// Copyright: (c) 2010 Marianne Gagnon, 2011 Steven Lamerton +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +// For compilers that support precompilation, includes "wx.h". +#include "wx/wxprec.h" + +#if wxUSE_WEBVIEW + +#if defined(__BORLANDC__) + #pragma hdrstop +#endif + +#include "wx/webview.h" + +#if defined(__WXOSX_COCOA__) || defined(__WXOSX_CARBON__) +#include "wx/osx/webview_webkit.h" +#elif defined(__WXGTK__) +#include "wx/gtk/webview_webkit.h" +#elif defined(__WXMSW__) +#include "wx/msw/webview_ie.h" +#endif + +// DLL options compatibility check: +#include "wx/app.h" +WX_CHECK_BUILD_OPTIONS("wxWEBVIEW") + +extern WXDLLIMPEXP_DATA_WEBVIEW(const char) wxWebViewNameStr[] = "wxWebView"; +extern WXDLLIMPEXP_DATA_WEBVIEW(const char) wxWebViewDefaultURLStr[] = "about:blank"; + +wxIMPLEMENT_ABSTRACT_CLASS(wxWebView, wxControl); +wxIMPLEMENT_DYNAMIC_CLASS(wxWebViewEvent, wxCommandEvent); + +wxDEFINE_EVENT( wxEVT_COMMAND_WEB_VIEW_NAVIGATING, wxWebViewEvent ); +wxDEFINE_EVENT( wxEVT_COMMAND_WEB_VIEW_NAVIGATED, wxWebViewEvent ); +wxDEFINE_EVENT( wxEVT_COMMAND_WEB_VIEW_LOADED, wxWebViewEvent ); +wxDEFINE_EVENT( wxEVT_COMMAND_WEB_VIEW_ERROR, wxWebViewEvent ); +wxDEFINE_EVENT( wxEVT_COMMAND_WEB_VIEW_NEWWINDOW, wxWebViewEvent ); +wxDEFINE_EVENT( wxEVT_COMMAND_WEB_VIEW_TITLE_CHANGED, wxWebViewEvent ); + +// static +wxWebView* wxWebView::New(wxWebViewBackend backend) +{ + switch (backend) + { + #if defined(wxUSE_WEBVIEW_WEBKIT) && \ + (defined(__WXGTK__) || defined(__WXOSX__)) + case wxWEB_VIEW_BACKEND_WEBKIT: + return new wxWebViewWebKit(); + #endif + + #if wxUSE_WEBVIEW_IE + case wxWEB_VIEW_BACKEND_IE: + return new wxWebViewIE(); + #endif + + case wxWEB_VIEW_BACKEND_DEFAULT: + + #if defined(wxUSE_WEBVIEW_WEBKIT) && \ + (defined(__WXGTK__) || defined(__WXOSX__)) + return new wxWebViewWebKit(); + #endif + + #if wxUSE_WEBVIEW_IE + return new wxWebViewIE(); + #endif + + // fall-through intended + default: + return NULL; + } +} + +// static +wxWebView* wxWebView::New(wxWindow* parent, + wxWindowID id, + const wxString& url, + const wxPoint& pos, + const wxSize& size, + wxWebViewBackend backend, + long style, + const wxString& name) +{ + switch (backend) + { + #if defined(wxUSE_WEBVIEW_WEBKIT) && \ + (defined(__WXGTK__) || defined(__WXOSX__)) + case wxWEB_VIEW_BACKEND_WEBKIT: + return new wxWebViewWebKit(parent, id, url, pos, size, style, name); + #endif + + #if wxUSE_WEBVIEW_IE + case wxWEB_VIEW_BACKEND_IE: + return new wxWebViewIE(parent, id, url, pos, size, style, name); + #endif + + case wxWEB_VIEW_BACKEND_DEFAULT: + + #if defined(wxUSE_WEBVIEW_WEBKIT) && \ + (defined(__WXGTK__) || defined(__WXOSX__)) + return new wxWebViewWebKit(parent, id, url, pos, size, style, name); + #endif + + #if wxUSE_WEBVIEW_IE + return new wxWebViewIE(parent, id, url, pos, size, style, name); + #endif + + // fall-through intended + default: + return NULL; + } +} + +#endif // wxUSE_WEBVIEW diff --git a/Externals/wxWidgets3/src/common/webviewarchivehandler.cpp b/Externals/wxWidgets3/src/common/webviewarchivehandler.cpp new file mode 100644 index 0000000000..1752458ad6 --- /dev/null +++ b/Externals/wxWidgets3/src/common/webviewarchivehandler.cpp @@ -0,0 +1,118 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: webviewfilehandler.cpp +// Purpose: Custom webview handler to allow archive browsing +// Author: Steven Lamerton +// Id: $Id: webviewarchivehandler.cpp 69317 2011-10-06 10:01:17Z SJL $ +// Copyright: (c) 2011 Steven Lamerton +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +// For compilers that support precompilation, includes "wx.h". +#include "wx/wxprec.h" + +#if wxUSE_WEBVIEW + +#if defined(__BORLANDC__) + #pragma hdrstop +#endif + +#include "wx/webviewarchivehandler.h" +#include "wx/filesys.h" + +//Taken from wx/filesys.cpp +static wxString EscapeFileNameCharsInURL(const char *in) +{ + wxString s; + + for ( const unsigned char *p = (const unsigned char*)in; *p; ++p ) + { + const unsigned char c = *p; + + if ( c == '/' || c == '-' || c == '.' || c == '_' || c == '~' || + (c >= '0' && c <= '9') || + (c >= 'a' && c <= 'z') || + (c >= 'A' && c <= 'Z') ) + { + s << c; + } + else + { + s << wxString::Format("%%%02x", c); + } + } + + return s; +} + +wxWebViewArchiveHandler::wxWebViewArchiveHandler(const wxString& scheme) : + wxWebViewHandler(scheme) +{ + m_fileSystem = new wxFileSystem(); +} + +wxWebViewArchiveHandler::~wxWebViewArchiveHandler() +{ + wxDELETE(m_fileSystem); +} + +wxFSFile* wxWebViewArchiveHandler::GetFile(const wxString &uri) +{ + //If there is a fragment at the end of the path then we need to strip it + //off as not all backends do this for us + wxString path = uri; + size_t hashloc = uri.find('#'); + if(hashloc != wxString::npos) + { + path = uri.substr(0, hashloc); + } + + //We iterate through the string to see if there is a protocol description + size_t start = wxString::npos; + for(size_t i = 0; i < path.length(); i++) + { + if(path[i] == ';' && path.substr(i, 10) == ";protocol=") + { + start = i; + break; + } + } + + //We do not have a protocol string so we just pass the path withouth the + if(start == wxString::npos) + { + size_t doubleslash = path.find("//"); + //The path is incorrectly formed without // after the scheme + if(doubleslash == wxString::npos) + return NULL; + + wxString fspath = "file:" + + EscapeFileNameCharsInURL(path.substr(doubleslash + 2).c_str()); + return m_fileSystem->OpenFile(fspath); + } + //Otherwise we need to extract the protocol + else + { + size_t end = path.find('/', start); + //For the path to be valid there must to a path after the protocol + if(end == wxString::npos) + { + return NULL; + } + wxString mainpath = path.substr(0, start); + wxString archivepath = path.substr(end); + wxString protstring = path.substr(start, end - start); + wxString protocol = protstring.substr(10); + //We can now construct the correct path + size_t doubleslash = path.find("//"); + //The path is incorrectly formed without // after the first protocol + if(doubleslash == wxString::npos) + return NULL; + + wxString fspath = "file:" + + EscapeFileNameCharsInURL(mainpath.substr(doubleslash + 2).c_str()) + + "#" + protocol +":" + archivepath; + return m_fileSystem->OpenFile(fspath); + } +} + +#endif // wxUSE_WEBVIEW diff --git a/Externals/wxWidgets3/src/common/wincmn.cpp b/Externals/wxWidgets3/src/common/wincmn.cpp index 693af6563b..0abcc2778d 100644 --- a/Externals/wxWidgets3/src/common/wincmn.cpp +++ b/Externals/wxWidgets3/src/common/wincmn.cpp @@ -4,7 +4,7 @@ // Author: Julian Smart, Vadim Zeitlin // Modified by: // Created: 13/07/98 -// RCS-ID: $Id: wincmn.cpp 67285 2011-03-22 17:15:38Z VZ $ +// RCS-ID: $Id: wincmn.cpp 70838 2012-03-07 23:50:21Z VZ $ // Copyright: (c) wxWidgets team // Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// @@ -75,7 +75,7 @@ #include "wx/platinfo.h" #include "wx/private/window.h" -#ifdef __WXMSW__ +#ifdef __WINDOWS__ #include "wx/msw/wrapwin.h" #endif @@ -554,7 +554,14 @@ void wxWindowBase::SendDestroyEvent() bool wxWindowBase::Destroy() { - SendDestroyEvent(); + // If our handle is invalid, it means that this window has never been + // created, either because creating it failed or, more typically, because + // this wxWindow object was default-constructed and its Create() method had + // never been called. As we didn't send wxWindowCreateEvent in this case + // (which is sent after successful creation), don't send the matching + // wxWindowDestroyEvent neither. + if ( GetHandle() ) + SendDestroyEvent(); delete this; @@ -1521,7 +1528,7 @@ wxColour wxWindowBase::GetBackgroundColour() const // wxWidgets versions where GetBackgroundColour() always returned // something -- so give them something even if it doesn't make sense // for this window (e.g. it has a themed background) - if ( !colBg.Ok() ) + if ( !colBg.IsOk() ) colBg = GetClassDefaultAttributes().colBg; return colBg; @@ -1533,7 +1540,7 @@ wxColour wxWindowBase::GetBackgroundColour() const wxColour wxWindowBase::GetForegroundColour() const { // logic is the same as above - if ( !m_hasFgCol && !m_foregroundColour.Ok() ) + if ( !m_hasFgCol && !m_foregroundColour.IsOk() ) { wxColour colFg = GetDefaultAttributes().colFg; @@ -1546,6 +1553,39 @@ wxColour wxWindowBase::GetForegroundColour() const return m_foregroundColour; } +bool wxWindowBase::SetBackgroundStyle(wxBackgroundStyle style) +{ + // The checks below shouldn't be triggered if we're not really changing the + // style. + if ( style == m_backgroundStyle ) + return true; + + // Transparent background style can be only set before creation because of + // wxGTK limitation. + wxCHECK_MSG( (style != wxBG_STYLE_TRANSPARENT) || !GetHandle(), + false, + "wxBG_STYLE_TRANSPARENT style can only be set before " + "Create()-ing the window." ); + + // And once it is set, wxBG_STYLE_TRANSPARENT can't be unset. + wxCHECK_MSG( (m_backgroundStyle != wxBG_STYLE_TRANSPARENT) || + (style == wxBG_STYLE_TRANSPARENT), + false, + "wxBG_STYLE_TRANSPARENT can't be unset once it was set." ); + + m_backgroundStyle = style; + + return true; +} + +bool wxWindowBase::IsTransparentBackgroundSupported(wxString *reason) const +{ + if ( reason ) + *reason = _("This platform does not support background transparency."); + + return false; +} + bool wxWindowBase::SetBackgroundColour( const wxColour &colour ) { if ( colour == m_backgroundColour ) @@ -1555,7 +1595,7 @@ bool wxWindowBase::SetBackgroundColour( const wxColour &colour ) m_inheritBgCol = m_hasBgCol; m_backgroundColour = colour; - SetThemeEnabled( !m_hasBgCol && !m_foregroundColour.Ok() ); + SetThemeEnabled( !m_hasBgCol && !m_foregroundColour.IsOk() ); return true; } @@ -1567,7 +1607,7 @@ bool wxWindowBase::SetForegroundColour( const wxColour &colour ) m_hasFgCol = colour.IsOk(); m_inheritFgCol = m_hasFgCol; m_foregroundColour = colour; - SetThemeEnabled( !m_hasFgCol && !m_backgroundColour.Ok() ); + SetThemeEnabled( !m_hasFgCol && !m_backgroundColour.IsOk() ); return true; } @@ -1876,6 +1916,7 @@ wxWindowBase::FindWindowById( long id, const wxWindow* parent ) // dialog oriented functions // ---------------------------------------------------------------------------- +#if WXWIN_COMPATIBILITY_2_8 void wxWindowBase::MakeModal(bool modal) { // Disable all other windows @@ -1892,6 +1933,7 @@ void wxWindowBase::MakeModal(bool modal) } } } +#endif // WXWIN_COMPATIBILITY_2_8 bool wxWindowBase::Validate() { @@ -2114,6 +2156,13 @@ void wxWindowBase::DoSetToolTip(wxToolTip *tooltip) } } +bool wxWindowBase::CopyToolTip(wxToolTip *tip) +{ + SetToolTip(tip ? new wxToolTip(tip->GetTip()) : NULL); + + return tip != NULL; +} + #endif // wxUSE_TOOLTIPS // ---------------------------------------------------------------------------- @@ -2560,17 +2609,12 @@ void wxWindowBase::GetPositionConstraint(int *x, int *y) const void wxWindowBase::AdjustForParentClientOrigin(int& x, int& y, int sizeFlags) const { - // don't do it for the dialogs/frames - they float independently of their - // parent - if ( !IsTopLevel() ) + wxWindow *parent = GetParent(); + if ( !(sizeFlags & wxSIZE_NO_ADJUSTMENTS) && parent ) { - wxWindow *parent = GetParent(); - if ( !(sizeFlags & wxSIZE_NO_ADJUSTMENTS) && parent ) - { - wxPoint pt(parent->GetClientAreaOrigin()); - x += pt.x; - y += pt.y; - } + wxPoint pt(parent->GetClientAreaOrigin()); + x += pt.x; + y += pt.y; } } @@ -2644,7 +2688,7 @@ bool wxWindowBase::SendIdleEvents(wxIdleEvent& event) void wxWindowBase::OnInternalIdle() { - if (wxUpdateUIEvent::CanUpdate(this) && IsShownOnScreen()) + if ( wxUpdateUIEvent::CanUpdate(this) ) UpdateWindowUI(wxUPDATE_UI_FROMIDLE); } @@ -2967,19 +3011,19 @@ wxAccessible* wxWindowBase::CreateAccessible() // list classes implementation // ---------------------------------------------------------------------------- -#if wxUSE_STL +#if wxUSE_STD_CONTAINERS #include "wx/listimpl.cpp" WX_DEFINE_LIST(wxWindowList) -#else // !wxUSE_STL +#else // !wxUSE_STD_CONTAINERS void wxWindowListNode::DeleteData() { delete (wxWindow *)GetData(); } -#endif // wxUSE_STL/!wxUSE_STL +#endif // wxUSE_STD_CONTAINERS/!wxUSE_STD_CONTAINERS // ---------------------------------------------------------------------------- // borders @@ -3283,8 +3327,8 @@ void wxWindowBase::DoMoveInTabOrder(wxWindow *win, WindowOrder move) wxWindowList::compatibility_iterator i = siblings.Find(win); wxCHECK_RET( i, wxT("MoveBefore/AfterInTabOrder(): win is not a sibling") ); - // unfortunately, when wxUSE_STL == 1 DetachNode() is not implemented so we - // can't just move the node around + // unfortunately, when wxUSE_STD_CONTAINERS == 1 DetachNode() is not + // implemented so we can't just move the node around wxWindow *self = (wxWindow *)this; siblings.DeleteObject(self); if ( move == OrderAfter ) @@ -3314,9 +3358,9 @@ void wxWindowBase::DoMoveInTabOrder(wxWindow *win, WindowOrder move) bool wxWindowBase::HasFocus() const { - wxWindowBase *win = DoFindFocus(); - return win == this || - win == wxConstCast(this, wxWindowBase)->GetMainWindowOfCompositeControl(); + wxWindowBase* const win = DoFindFocus(); + return win && + (this == win || this == win->GetMainWindowOfCompositeControl()); } // ---------------------------------------------------------------------------- diff --git a/Externals/wxWidgets3/src/common/windowid.cpp b/Externals/wxWidgets3/src/common/windowid.cpp index 9cab454730..e4105c0eaf 100644 --- a/Externals/wxWidgets3/src/common/windowid.cpp +++ b/Externals/wxWidgets3/src/common/windowid.cpp @@ -3,7 +3,7 @@ // Purpose: wxWindowID class - a class for managing window ids // Author: Brian Vanderburg II // Created: 2007-09-21 -// RCS-ID: $Id: windowid.cpp 67211 2011-03-16 07:06:43Z SC $ +// RCS-ID: $Id: windowid.cpp 69682 2011-11-05 11:24:04Z VZ $ // Copyright: (c) 2007 Brian Vanderburg II // Licence: wxWindows licence /////////////////////////////////////////////////////////////////////////////// @@ -22,6 +22,8 @@ #include "wx/intl.h" #endif //WX_PRECOMP +#include "wx/hashmap.h" + // Not needed, included in defs.h // #include "wx/windowid.h" @@ -38,11 +40,22 @@ namespace // meanwhile static const wxUint8 ID_FREE = 0; static const wxUint8 ID_STARTCOUNT = 1; -static const wxUint8 ID_MAXCOUNT = 254; +static const wxUint8 ID_COUNTTOOLARGE = 254; static const wxUint8 ID_RESERVED = 255; +// we use a two level count, most IDs will be used less than ID_COUNTTOOLARGE-1 +// thus we store their count directly in this array, however when the same ID +// is reused a great number of times (more than or equal to ID_COUNTTOOLARGE), +// the hash map stores the actual count wxUint8 gs_autoIdsRefCount[wxID_AUTO_HIGHEST - wxID_AUTO_LOWEST + 1] = { 0 }; +// NB: this variable is allocated (again) only when an ID gets at least +// ID_COUNTTOOLARGE refs, and is freed when the latest entry in the map gets +// freed. The cell storing the count for an ID is freed only when its count +// gets to zero (not when it goes below ID_COUNTTOOLARGE, so as to avoid +// degenerate cases) +wxLongToLongHashMap *gs_autoIdsLargeRefCount = NULL; + // this is an optimization used until we wrap around wxID_AUTO_HIGHEST: if this // value is < wxID_AUTO_HIGHEST we know that we haven't wrapped yet and so can // allocate the ids simply by incrementing it @@ -81,7 +94,10 @@ int GetIdRefCount(wxWindowID winid) wxT("invalid id range")); winid -= wxID_AUTO_LOWEST; - return gs_autoIdsRefCount[winid]; + int refCount = gs_autoIdsRefCount[winid]; + if (refCount == ID_COUNTTOOLARGE) + refCount = (*gs_autoIdsLargeRefCount)[winid]; + return refCount; } // Increase the count for an id @@ -92,16 +108,32 @@ void IncIdRefCount(wxWindowID winid) winid -= wxID_AUTO_LOWEST; - wxCHECK_RET(gs_autoIdsRefCount[winid] != ID_MAXCOUNT, wxT("id count at max")); wxCHECK_RET(gs_autoIdsRefCount[winid] != ID_FREE, wxT("id should first be reserved")); if(gs_autoIdsRefCount[winid] == ID_RESERVED) + { gs_autoIdsRefCount[winid] = ID_STARTCOUNT; + } + else if (gs_autoIdsRefCount[winid] >= ID_COUNTTOOLARGE-1) + { + if (gs_autoIdsRefCount[winid] == ID_COUNTTOOLARGE-1) + { + // we need to allocate a cell, and maybe the hash map itself + if (!gs_autoIdsLargeRefCount) + gs_autoIdsLargeRefCount = new wxLongToLongHashMap; + (*gs_autoIdsLargeRefCount)[winid] = ID_COUNTTOOLARGE-1; + + gs_autoIdsRefCount[winid] = ID_COUNTTOOLARGE; + } + ++(*gs_autoIdsLargeRefCount)[winid]; + } else + { gs_autoIdsRefCount[winid]++; + } wxLogTrace(wxTRACE_WINDOWID, wxT("Increasing ref count of ID %d to %d"), - winid + wxID_AUTO_LOWEST, gs_autoIdsRefCount[winid]); + winid + wxID_AUTO_LOWEST, GetIdRefCount(winid + wxID_AUTO_LOWEST)); } // Decrease the count for an id @@ -121,11 +153,24 @@ void DecIdRefCount(wxWindowID winid) wxFAIL_MSG(wxT("reserve id being decreased")); gs_autoIdsRefCount[winid] = ID_FREE; } + else if(gs_autoIdsRefCount[winid] == ID_COUNTTOOLARGE) + { + long &largeCount = (*gs_autoIdsLargeRefCount)[winid]; + --largeCount; + if (largeCount == 0) + { + gs_autoIdsLargeRefCount->erase (winid); + gs_autoIdsRefCount[winid] = ID_FREE; + + if (gs_autoIdsLargeRefCount->empty()) + wxDELETE (gs_autoIdsLargeRefCount); + } + } else gs_autoIdsRefCount[winid]--; wxLogTrace(wxTRACE_WINDOWID, wxT("Decreasing ref count of ID %d to %d"), - winid + wxID_AUTO_LOWEST, gs_autoIdsRefCount[winid]); + winid + wxID_AUTO_LOWEST, GetIdRefCount(winid + wxID_AUTO_LOWEST)); } #else // wxUSE_AUTOID_MANAGEMENT diff --git a/Externals/wxWidgets3/src/common/wxcrt.cpp b/Externals/wxWidgets3/src/common/wxcrt.cpp index 8c6147727d..3bf1855968 100644 --- a/Externals/wxWidgets3/src/common/wxcrt.cpp +++ b/Externals/wxWidgets3/src/common/wxcrt.cpp @@ -4,7 +4,7 @@ // Author: Ove Kaven // Modified by: Ron Lee, Francesco Montorsi // Created: 09/04/99 -// RCS-ID: $Id: wxcrt.cpp 65691 2010-09-30 14:30:41Z VZ $ +// RCS-ID: $Id: wxcrt.cpp 70345 2012-01-15 01:05:28Z VZ $ // Copyright: (c) wxWidgets copyright // Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// @@ -40,14 +40,12 @@ extern "C" int vswscanf(const wchar_t *, const wchar_t *, va_list); #endif -#ifndef __WXPALMOS5__ #ifndef __WXWINCE__ #include #include #else #include "wx/msw/wince/time.h" #endif -#endif // !__WXPALMOS5__ #ifndef WX_PRECOMP #include "wx/string.h" diff --git a/Externals/wxWidgets3/src/common/xlocale.cpp b/Externals/wxWidgets3/src/common/xlocale.cpp index 2a6326c092..cbca33cf31 100644 --- a/Externals/wxWidgets3/src/common/xlocale.cpp +++ b/Externals/wxWidgets3/src/common/xlocale.cpp @@ -3,7 +3,7 @@ // Purpose: xlocale wrappers/impl to provide some xlocale wrappers // Author: Brian Vanderburg II, Vadim Zeitlin // Created: 2008-01-07 -// RCS-ID: $Id: xlocale.cpp 66054 2010-11-07 13:16:20Z VZ $ +// RCS-ID: $Id: xlocale.cpp 67406 2011-04-06 14:37:32Z VZ $ // Copyright: (c) 2008 Brian Vanderburg II // 2008 Vadim Zeitlin // Licence: wxWindows licence @@ -279,70 +279,91 @@ int wxToupper_l(const wxUniChar& c, const wxXLocale& loc) case !wxHAS_XLOCALE_SUPPORT... */ -/* - Note that this code is similar to (a portion of) wxLocale::IsAvailable code -*/ -#define IMPLEMENT_STRTOX_L_START \ - wxCHECK(loc.IsOk(), 0); \ - \ - /* (Try to) temporary set the 'C' locale */ \ - const char *oldLocale = wxSetlocale(LC_NUMERIC, "C"); \ - if ( !oldLocale ) \ - { \ - /* the current locale was not changed; no need to */ \ - /* restore the previous one... */ \ - errno = EINVAL; \ - /* signal an error (better than nothing) */ \ - return 0; \ +namespace +{ + +// Helper class that changes LC_NUMERIC facet of the global locale in its ctor +// to "C" locale and restores it in its dtor later. +class CNumericLocaleSetter +{ +public: + CNumericLocaleSetter() + : m_oldLocale(wxStrdupA(setlocale(LC_NUMERIC, NULL))) + { + if ( !wxSetlocale(LC_NUMERIC, "C") ) + { + // Setting locale to "C" should really always work. + wxFAIL_MSG( wxS("Couldn't set LC_NUMERIC to \"C\"") ); + } } -#define IMPLEMENT_STRTOX_L_END \ - /* restore the original locale */ \ - wxSetlocale(LC_NUMERIC, oldLocale); \ - return ret; + ~CNumericLocaleSetter() + { + wxSetlocale(LC_NUMERIC, m_oldLocale); + free(m_oldLocale); + } + +private: + char * const m_oldLocale; + + wxDECLARE_NO_COPY_CLASS(CNumericLocaleSetter); +}; + +} // anonymous namespace double wxStrtod_l(const wchar_t* str, wchar_t **endptr, const wxXLocale& loc) { - IMPLEMENT_STRTOX_L_START - double ret = wxStrtod(str, endptr); - IMPLEMENT_STRTOX_L_END + wxCHECK( loc.IsOk(), 0. ); + + CNumericLocaleSetter locSetter; + + return wxStrtod(str, endptr); } double wxStrtod_l(const char* str, char **endptr, const wxXLocale& loc) { - IMPLEMENT_STRTOX_L_START - double ret = wxStrtod(str, endptr); - IMPLEMENT_STRTOX_L_END + wxCHECK( loc.IsOk(), 0. ); + + CNumericLocaleSetter locSetter; + + return wxStrtod(str, endptr); } long wxStrtol_l(const wchar_t* str, wchar_t **endptr, int base, const wxXLocale& loc) { - IMPLEMENT_STRTOX_L_START - long ret = wxStrtol(str, endptr, base); - IMPLEMENT_STRTOX_L_END + wxCHECK( loc.IsOk(), 0 ); + + CNumericLocaleSetter locSetter; + + return wxStrtol(str, endptr, base); } long wxStrtol_l(const char* str, char **endptr, int base, const wxXLocale& loc) { - IMPLEMENT_STRTOX_L_START - long ret = wxStrtol(str, endptr, base); - IMPLEMENT_STRTOX_L_END + wxCHECK( loc.IsOk(), 0 ); + + CNumericLocaleSetter locSetter; + + return wxStrtol(str, endptr, base); } unsigned long wxStrtoul_l(const wchar_t* str, wchar_t **endptr, int base, const wxXLocale& loc) { - IMPLEMENT_STRTOX_L_START - unsigned long ret = wxStrtoul(str, endptr, base); - IMPLEMENT_STRTOX_L_END + wxCHECK( loc.IsOk(), 0 ); + + CNumericLocaleSetter locSetter; + + return wxStrtoul(str, endptr, base); } unsigned long wxStrtoul_l(const char* str, char **endptr, int base, const wxXLocale& loc) { - IMPLEMENT_STRTOX_L_START - unsigned long ret = wxStrtoul(str, endptr, base); - IMPLEMENT_STRTOX_L_END -} + wxCHECK( loc.IsOk(), 0 ); + CNumericLocaleSetter locSetter; + + return wxStrtoul(str, endptr, base); +} #endif // !defined(wxHAS_XLOCALE_SUPPORT) diff --git a/Externals/wxWidgets3/src/common/xti.cpp b/Externals/wxWidgets3/src/common/xti.cpp index 9c6e06d1c8..f69652644c 100644 --- a/Externals/wxWidgets3/src/common/xti.cpp +++ b/Externals/wxWidgets3/src/common/xti.cpp @@ -4,7 +4,7 @@ // Author: Stefan Csomor // Modified by: // Created: 27/07/03 -// RCS-ID: $Id: xti.cpp 66651 2011-01-08 10:22:30Z SC $ +// RCS-ID: $Id: xti.cpp 70306 2012-01-09 18:48:39Z VZ $ // Copyright: (c) 1997 Julian Smart // (c) 2003 Stefan Csomor // Licence: wxWindows licence @@ -117,13 +117,13 @@ const wxChar * wxEnumData::GetEnumMemberNameByIndex( int idx ) const template<> void wxStringReadValue(const wxString &s, bool &data ) { int intdata; - wxSscanf(s, _T("%d"), &intdata ); + wxSscanf(s, wxT("%d"), &intdata ); data = (bool)(intdata != 0); } template<> void wxStringWriteValue(wxString &s, const bool &data ) { - s = wxString::Format(_T("%d"), data ); + s = wxString::Format(wxT("%d"), data ); } // char @@ -131,13 +131,13 @@ template<> void wxStringWriteValue(wxString &s, const bool &data ) template<> void wxStringReadValue(const wxString &s, char &data ) { int intdata; - wxSscanf(s, _T("%d"), &intdata ); + wxSscanf(s, wxT("%d"), &intdata ); data = char(intdata); } template<> void wxStringWriteValue(wxString &s, const char &data ) { - s = wxString::Format(_T("%d"), data ); + s = wxString::Format(wxT("%d"), data ); } // unsigned char @@ -145,106 +145,106 @@ template<> void wxStringWriteValue(wxString &s, const char &data ) template<> void wxStringReadValue(const wxString &s, unsigned char &data ) { int intdata; - wxSscanf(s, _T("%d"), &intdata ); + wxSscanf(s, wxT("%d"), &intdata ); data = (unsigned char)(intdata); } template<> void wxStringWriteValue(wxString &s, const unsigned char &data ) { - s = wxString::Format(_T("%d"), data ); + s = wxString::Format(wxT("%d"), data ); } // int template<> void wxStringReadValue(const wxString &s, int &data ) { - wxSscanf(s, _T("%d"), &data ); + wxSscanf(s, wxT("%d"), &data ); } template<> void wxStringWriteValue(wxString &s, const int &data ) { - s = wxString::Format(_T("%d"), data ); + s = wxString::Format(wxT("%d"), data ); } // unsigned int template<> void wxStringReadValue(const wxString &s, unsigned int &data ) { - wxSscanf(s, _T("%d"), &data ); + wxSscanf(s, wxT("%d"), &data ); } template<> void wxStringWriteValue(wxString &s, const unsigned int &data ) { - s = wxString::Format(_T("%d"), data ); + s = wxString::Format(wxT("%d"), data ); } // long template<> void wxStringReadValue(const wxString &s, long &data ) { - wxSscanf(s, _T("%ld"), &data ); + wxSscanf(s, wxT("%ld"), &data ); } template<> void wxStringWriteValue(wxString &s, const long &data ) { - s = wxString::Format(_T("%ld"), data ); + s = wxString::Format(wxT("%ld"), data ); } // unsigned long template<> void wxStringReadValue(const wxString &s, unsigned long &data ) { - wxSscanf(s, _T("%ld"), &data ); + wxSscanf(s, wxT("%ld"), &data ); } template<> void wxStringWriteValue(wxString &s, const unsigned long &data ) { - s = wxString::Format(_T("%ld"), data ); + s = wxString::Format(wxT("%ld"), data ); } #ifdef wxLongLong_t template<> void wxStringReadValue(const wxString &s, wxLongLong_t &data ) { - wxSscanf(s, _T("%lld"), &data ); + wxSscanf(s, wxT("%lld"), &data ); } template<> void wxStringWriteValue(wxString &s, const wxLongLong_t &data ) { - s = wxString::Format(_T("%lld"), data ); + s = wxString::Format(wxT("%lld"), data ); } template<> void wxStringReadValue(const wxString &s, wxULongLong_t &data ) { - wxSscanf(s, _T("%lld"), &data ); + wxSscanf(s, wxT("%lld"), &data ); } template<> void wxStringWriteValue(wxString &s, const wxULongLong_t &data ) { - s = wxString::Format(_T("%lld"), data ); + s = wxString::Format(wxT("%lld"), data ); } #endif // float template<> void wxStringReadValue(const wxString &s, float &data ) { - wxSscanf(s, _T("%f"), &data ); + wxSscanf(s, wxT("%f"), &data ); } template<> void wxStringWriteValue(wxString &s, const float &data ) { - s = wxString::Format(_T("%f"), data ); + s = wxString::Format(wxT("%f"), data ); } // double template<> void wxStringReadValue(const wxString &s, double &data ) { - wxSscanf(s, _T("%lf"), &data ); + wxSscanf(s, wxT("%lf"), &data ); } template<> void wxStringWriteValue(wxString &s, const double &data ) { - s = wxString::Format(_T("%lf"), data ); + s = wxString::Format(wxT("%lf"), data ); } // wxString @@ -931,14 +931,14 @@ void wxGenericPropertyAccessor::SetProperty(wxObject *object, const wxAny &value { wxDynamicObject* dynobj = wx_dynamic_cast(wxDynamicObject*, object); wxASSERT_MSG( dynobj, wxT("cannot call wxDynamicClassInfo::SetProperty on an object other than wxDynamicObject") ); - dynobj->SetProperty(m_propertyName, value ); + dynobj->SetProperty(m_propertyName.c_str(), value ); } void wxGenericPropertyAccessor::GetProperty(const wxObject *object, wxAny& value) const { const wxDynamicObject* dynobj = wx_dynamic_cast( const wxDynamicObject * , object ); wxASSERT_MSG( dynobj, wxT("cannot call wxDynamicClassInfo::SetProperty on an object other than wxDynamicObject") ); - value = dynobj->GetProperty( m_propertyName ); + value = dynobj->GetProperty( m_propertyName.c_str() ); } // ---------------------------------------------------------------------------- diff --git a/Externals/wxWidgets3/src/common/xtistrm.cpp b/Externals/wxWidgets3/src/common/xtistrm.cpp index 95b77afe2b..16881d3b7d 100644 --- a/Externals/wxWidgets3/src/common/xtistrm.cpp +++ b/Externals/wxWidgets3/src/common/xtistrm.cpp @@ -4,7 +4,7 @@ // Author: Stefan Csomor // Modified by: // Created: 27/07/03 -// RCS-ID: $Id: xtistrm.cpp 66630 2011-01-07 17:49:18Z SC $ +// RCS-ID: $Id: xtistrm.cpp 70306 2012-01-09 18:48:39Z VZ $ // Copyright: (c) 2003 Stefan Csomor // Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// @@ -289,8 +289,8 @@ void wxObjectWriter::WriteOneProperty( const wxObject *obj, const wxClassInfo* c } else { - wxLogError( _T("Streaming delegates for not already ") - _T("streamed objects not yet supported") ); + wxLogError( wxT("Streaming delegates for not already ") + wxT("streamed objects not yet supported") ); } } } @@ -577,7 +577,7 @@ void wxObjectRuntimeReaderCallback::SetProperty(int objectID, { wxObject *o; o = m_data->GetObject(objectID); - classInfo->SetProperty( o, propertyInfo->GetName(), value ); + classInfo->SetProperty( o, propertyInfo->GetName().c_str(), value ); } void wxObjectRuntimeReaderCallback::SetPropertyAsObject(int objectID, @@ -599,7 +599,7 @@ void wxObjectRuntimeReaderCallback::SetPropertyAsObject(int objectID, valo = dynvalo->GetSuperClassInstance(); } - classInfo->SetProperty( o, propertyInfo->GetName(), + classInfo->SetProperty( o, propertyInfo->GetName().c_str(), valClassInfo->ObjectPtrToAny(valo) ); } @@ -650,7 +650,7 @@ void wxObjectRuntimeReaderCallback::AddToPropertyCollection( int objectID, { wxObject *o; o = m_data->GetObject(objectID); - classInfo->AddToPropertyCollection( o, propertyInfo->GetName(), value ); + classInfo->AddToPropertyCollection( o, propertyInfo->GetName().c_str(), value ); } void wxObjectRuntimeReaderCallback::AddToPropertyCollectionAsObject(int objectID, @@ -674,7 +674,7 @@ void wxObjectRuntimeReaderCallback::AddToPropertyCollectionAsObject(int objectID valo = dynvalo->GetSuperClassInstance(); } - classInfo->AddToPropertyCollection( o, propertyInfo->GetName(), + classInfo->AddToPropertyCollection( o, propertyInfo->GetName().c_str(), valClassInfo->ObjectPtrToAny(valo) ); } diff --git a/Externals/wxWidgets3/src/common/xtixml.cpp b/Externals/wxWidgets3/src/common/xtixml.cpp index 3bb3dd2d14..892d282e74 100644 --- a/Externals/wxWidgets3/src/common/xtixml.cpp +++ b/Externals/wxWidgets3/src/common/xtixml.cpp @@ -4,7 +4,7 @@ // Author: Stefan Csomor // Modified by: // Created: 27/07/03 -// RCS-ID: $Id: xtixml.cpp 66728 2011-01-22 14:38:36Z DS $ +// RCS-ID: $Id: xtixml.cpp 68949 2011-08-29 12:33:40Z VZ $ // Copyright: (c) 2003 Stefan Csomor // Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// @@ -325,7 +325,7 @@ int wxObjectXmlReader::ReadComponent(wxXmlNode *node, wxObjectReaderCallback *ca const wxPropertyInfo* pi = classInfo->FindPropertyInfo( paramName ); if ( pi == 0 ) { - wxLogError( wxString::Format(_("Unkown Property %s"),paramName) ); + wxLogError( wxString::Format(_("Unknown Property %s"),paramName) ); } // if we don't have the value of a create param set in the xml // we use the default value @@ -483,7 +483,7 @@ int wxObjectXmlReader::ReadComponent(wxXmlNode *node, wxObjectReaderCallback *ca wxClassInfo* sinkClassInfo = GetObjectClassInfo( sinkOid ); callbacks->SetConnect( objectID, classInfo, pi, sinkClassInfo, - sinkClassInfo->FindHandlerInfo(handlerName), sinkOid ); + sinkClassInfo->FindHandlerInfo(handlerName.c_str()), sinkOid ); } else { diff --git a/Externals/wxWidgets3/src/common/zipstrm.cpp b/Externals/wxWidgets3/src/common/zipstrm.cpp index a42686d6f8..2e36c4ac1f 100644 --- a/Externals/wxWidgets3/src/common/zipstrm.cpp +++ b/Externals/wxWidgets3/src/common/zipstrm.cpp @@ -2,7 +2,7 @@ // Name: src/common/zipstrm.cpp // Purpose: Streams for Zip files // Author: Mike Wetherell -// RCS-ID: $Id: zipstrm.cpp 67280 2011-03-22 14:17:38Z DS $ +// RCS-ID: $Id: zipstrm.cpp 67681 2011-05-03 16:29:04Z DS $ // Copyright: (c) Mike Wetherell // Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// @@ -1341,7 +1341,7 @@ void wxZipInputStream::Init(const wxString& file) ffile = static_cast(m_parent_i_stream); wxZipEntryPtr_ entry; - if (ffile->Ok()) { + if (ffile->IsOk()) { do { entry.reset(GetNextEntry()); } diff --git a/Externals/wxWidgets3/src/common/zstream.cpp b/Externals/wxWidgets3/src/common/zstream.cpp index 448be53223..e478441bfa 100644 --- a/Externals/wxWidgets3/src/common/zstream.cpp +++ b/Externals/wxWidgets3/src/common/zstream.cpp @@ -4,7 +4,7 @@ // Author: Guilhem Lavaux // Modified by: Mike Wetherell // Created: 11/07/98 -// RCS-ID: $Id: zstream.cpp 66259 2010-11-25 00:53:44Z VZ $ +// RCS-ID: $Id: zstream.cpp 70796 2012-03-04 00:29:31Z VZ $ // Copyright: (c) Guilhem Lavaux // Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// @@ -32,7 +32,7 @@ // apparently not the case for all MSW makefiles and so, unless we use // configure (which defines __WX_SETUP_H__) or it is explicitly overridden by // the user (who can define wxUSE_ZLIB_H_IN_PATH), we hardcode the path here -#if defined(__WXMSW__) && !defined(__WX_SETUP_H__) && !defined(wxUSE_ZLIB_H_IN_PATH) +#if defined(__WINDOWS__) && !defined(__WX_SETUP_H__) && !defined(wxUSE_ZLIB_H_IN_PATH) #include "../zlib/zlib.h" #else #include "zlib.h" diff --git a/Externals/wxWidgets3/src/generic/aboutdlgg.cpp b/Externals/wxWidgets3/src/generic/aboutdlgg.cpp index 01d6dca7af..b5e507bfd0 100644 --- a/Externals/wxWidgets3/src/generic/aboutdlgg.cpp +++ b/Externals/wxWidgets3/src/generic/aboutdlgg.cpp @@ -3,7 +3,7 @@ // Purpose: implements wxGenericAboutBox() function // Author: Vadim Zeitlin // Created: 2006-10-08 -// RCS-ID: $Id: aboutdlgg.cpp 61534 2009-07-25 22:53:23Z VZ $ +// RCS-ID: $Id: aboutdlgg.cpp 70671 2012-02-22 17:35:21Z JS $ // Copyright: (c) 2006 Vadim Zeitlin // Licence: wxWindows licence /////////////////////////////////////////////////////////////////////////////// @@ -85,7 +85,7 @@ wxString wxAboutDialogInfo::GetDescriptionAndCredits() const wxIcon wxAboutDialogInfo::GetIcon() const { wxIcon icon = m_icon; - if ( !icon.Ok() && wxTheApp ) + if ( !icon.IsOk() && wxTheApp ) { const wxTopLevelWindow * const tlw = wxDynamicCast(wxTheApp->GetTopWindow(), wxTopLevelWindow); @@ -138,7 +138,7 @@ void wxAboutDialogInfo::SetVersion(const wxString& version, bool wxGenericAboutDialog::Create(const wxAboutDialogInfo& info, wxWindow* parent) { - if ( !wxDialog::Create(parent, wxID_ANY, _("About ") + info.GetName(), + if ( !wxDialog::Create(parent, wxID_ANY, wxString::Format(_("About %s"), info.GetName()), wxDefaultPosition, wxDefaultSize, wxRESIZE_BORDER|wxDEFAULT_DIALOG_STYLE) ) return false; @@ -196,7 +196,7 @@ bool wxGenericAboutDialog::Create(const wxAboutDialogInfo& info, wxWindow* paren wxSizer *sizerIconAndText = new wxBoxSizer(wxHORIZONTAL); #if wxUSE_STATBMP wxIcon icon = info.GetIcon(); - if ( icon.Ok() ) + if ( icon.IsOk() ) { sizerIconAndText->Add(new wxStaticBitmap(this, wxID_ANY, icon), wxSizerFlags().Border(wxRIGHT)); @@ -220,6 +220,13 @@ bool wxGenericAboutDialog::Create(const wxAboutDialogInfo& info, wxWindow* paren CentreOnParent(); +#if !wxUSE_MODAL_ABOUT_DIALOG + Connect(wxEVT_CLOSE_WINDOW, + wxCloseEventHandler(wxGenericAboutDialog::OnCloseWindow)); + Connect(wxID_OK, wxEVT_COMMAND_BUTTON_CLICKED, + wxCommandEventHandler(wxGenericAboutDialog::OnOK)); +#endif // !wxUSE_MODAL_ABOUT_DIALOG + return true; } @@ -242,6 +249,7 @@ void wxGenericAboutDialog::AddText(const wxString& text) AddControl(new wxStaticText(this, wxID_ANY, text)); } +#if wxUSE_COLLPANE void wxGenericAboutDialog::AddCollapsiblePane(const wxString& title, const wxString& text) { @@ -264,6 +272,25 @@ void wxGenericAboutDialog::AddCollapsiblePane(const wxString& title, // NB: all the wxCollapsiblePanes must be added with a null proportion value m_sizerText->Add(pane, wxSizerFlags(0).Expand().Border(wxBOTTOM)); } +#endif + +#if !wxUSE_MODAL_ABOUT_DIALOG + +void wxGenericAboutDialog::OnCloseWindow(wxCloseEvent& event) +{ + Destroy(); + + event.Skip(); +} + +void wxGenericAboutDialog::OnOK(wxCommandEvent& WXUNUSED(event)) +{ + // By default a modeless dialog would be just hidden, destroy this one + // instead. + Destroy(); +} + +#endif // !wxUSE_MODAL_ABOUT_DIALOG // ---------------------------------------------------------------------------- // public functions @@ -271,7 +298,7 @@ void wxGenericAboutDialog::AddCollapsiblePane(const wxString& title, void wxGenericAboutBox(const wxAboutDialogInfo& info, wxWindow* parent) { -#if !defined(__WXGTK__) && !defined(__WXMAC__) +#if wxUSE_MODAL_ABOUT_DIALOG wxGenericAboutDialog dlg(info, parent); dlg.ShowModal(); #else diff --git a/Externals/wxWidgets3/src/generic/accel.cpp b/Externals/wxWidgets3/src/generic/accel.cpp index 17daccf0a7..832c357870 100644 --- a/Externals/wxWidgets3/src/generic/accel.cpp +++ b/Externals/wxWidgets3/src/generic/accel.cpp @@ -3,7 +3,7 @@ // Purpose: generic implementation of wxAcceleratorTable class // Author: Robert Roebling // Modified: VZ pn 31.05.01: use typed lists, Unicode cleanup, Add/Remove -// Id: $Id: accel.cpp 63165 2010-01-18 00:28:11Z VZ $ +// Id: $Id: accel.cpp 67681 2011-05-03 16:29:04Z DS $ // Copyright: (c) 1998 Robert Roebling // Licence: wxWindows licence /////////////////////////////////////////////////////////////////////////////// @@ -162,7 +162,7 @@ void wxAcceleratorTable::Remove(const wxAcceleratorEntry& entry) const wxAcceleratorEntry * wxAcceleratorTable::GetEntry(const wxKeyEvent& event) const { - if ( !Ok() ) + if ( !IsOk() ) { // not an error, the accel table is just empty return NULL; diff --git a/Externals/wxWidgets3/src/generic/animateg.cpp b/Externals/wxWidgets3/src/generic/animateg.cpp index da8256b384..af4d2416b8 100644 --- a/Externals/wxWidgets3/src/generic/animateg.cpp +++ b/Externals/wxWidgets3/src/generic/animateg.cpp @@ -4,7 +4,7 @@ // Author: Julian Smart and Guillermo Rodriguez Garcia // Modified by: Francesco Montorsi // Created: 13/8/99 -// RCS-ID: $Id: animateg.cpp 67280 2011-03-22 14:17:38Z DS $ +// RCS-ID: $Id: animateg.cpp 67681 2011-05-03 16:29:04Z DS $ // Copyright: (c) Julian Smart and Guillermo Rodriguez Garcia // Licence: wxWindows licence /////////////////////////////////////////////////////////////////////////////// @@ -308,7 +308,7 @@ wxAnimationCtrl::~wxAnimationCtrl() bool wxAnimationCtrl::LoadFile(const wxString& filename, wxAnimationType type) { wxFileInputStream fis(filename); - if (!fis.Ok()) + if (!fis.IsOk()) return false; return Load(fis, type); } diff --git a/Externals/wxWidgets3/src/generic/bannerwindow.cpp b/Externals/wxWidgets3/src/generic/bannerwindow.cpp new file mode 100644 index 0000000000..450b0a90a2 --- /dev/null +++ b/Externals/wxWidgets3/src/generic/bannerwindow.cpp @@ -0,0 +1,344 @@ +/////////////////////////////////////////////////////////////////////////////// +// Name: wx/bannerwindow.h +// Purpose: wxBannerWindow class implementation +// Author: Vadim Zeitlin +// Created: 2011-08-16 +// RCS-ID: $Id: bannerwindow.cpp 69859 2011-11-28 18:58:52Z VZ $ +// Copyright: (c) 2011 Vadim Zeitlin +// Licence: wxWindows licence +/////////////////////////////////////////////////////////////////////////////// + +#include "wx/wxprec.h" + +#ifdef __BORLANDC__ + #pragma hdrstop +#endif + +#if wxUSE_BANNERWINDOW + +#include "wx/bannerwindow.h" + +#ifndef WX_PRECOMP + #include "wx/bitmap.h" + #include "wx/colour.h" +#endif + +#include "wx/dcbuffer.h" + +namespace +{ + +// Some constants for banner layout, currently they're hard coded but we could +// easily make them configurable if needed later. +const int MARGIN_X = 5; +const int MARGIN_Y = 5; + +} // anonymous namespace + +const char wxBannerWindowNameStr[] = "bannerwindow"; + +BEGIN_EVENT_TABLE(wxBannerWindow, wxWindow) + EVT_SIZE(wxBannerWindow::OnSize) + EVT_PAINT(wxBannerWindow::OnPaint) +END_EVENT_TABLE() + +void wxBannerWindow::Init() +{ + m_direction = wxLEFT; + + m_colStart = *wxWHITE; + m_colEnd = *wxBLUE; +} + +bool +wxBannerWindow::Create(wxWindow* parent, + wxWindowID winid, + wxDirection dir, + const wxPoint& pos, + const wxSize& size, + long style, + const wxString& name) +{ + if ( !wxWindow::Create(parent, winid, pos, size, style, name) ) + return false; + + wxASSERT_MSG + ( + dir == wxLEFT || dir == wxRIGHT || dir == wxTOP || dir == wxBOTTOM, + wxS("Invalid banner direction") + ); + + m_direction = dir; + + SetBackgroundStyle(wxBG_STYLE_PAINT); + + return true; +} + +void wxBannerWindow::SetBitmap(const wxBitmap& bmp) +{ + m_bitmap = bmp; + + m_colBitmapBg = wxColour(); + + InvalidateBestSize(); + + Refresh(); +} + +void wxBannerWindow::SetText(const wxString& title, const wxString& message) +{ + m_title = title; + m_message = message; + + InvalidateBestSize(); + + Refresh(); +} + +void wxBannerWindow::SetGradient(const wxColour& start, const wxColour& end) +{ + m_colStart = start; + m_colEnd = end; + + Refresh(); +} + +wxFont wxBannerWindow::GetTitleFont() const +{ + wxFont font = GetFont(); + font.MakeBold().MakeLarger(); + return font; +} + +wxSize wxBannerWindow::DoGetBestClientSize() const +{ + if ( m_bitmap.IsOk() ) + { + return m_bitmap.GetSize(); + } + else + { + wxClientDC dc(const_cast(this)); + const wxSize sizeText = dc.GetMultiLineTextExtent(m_message); + + dc.SetFont(GetTitleFont()); + + const wxSize sizeTitle = dc.GetTextExtent(m_title); + + wxSize sizeWin(wxMax(sizeTitle.x, sizeText.x), sizeTitle.y + sizeText.y); + + // If we draw the text vertically width and height are swapped. + if ( m_direction == wxLEFT || m_direction == wxRIGHT ) + wxSwap(sizeWin.x, sizeWin.y); + + sizeWin += 2*wxSize(MARGIN_X, MARGIN_Y); + + return sizeWin; + } +} + +void wxBannerWindow::OnSize(wxSizeEvent& event) +{ + Refresh(); + + event.Skip(); +} + +void wxBannerWindow::OnPaint(wxPaintEvent& WXUNUSED(event)) +{ + if ( m_bitmap.IsOk() && m_title.empty() && m_message.empty() ) + { + // No need for buffering in this case. + wxPaintDC dc(this); + + DrawBitmapBackground(dc); + } + else // We need to compose our contents ourselves. + { + wxAutoBufferedPaintDC dc(this); + + // Deal with the background first. + if ( m_bitmap.IsOk() ) + { + DrawBitmapBackground(dc); + } + else // Draw gradient background. + { + wxDirection gradientDir; + if ( m_direction == wxLEFT ) + { + gradientDir = wxTOP; + } + else if ( m_direction == wxRIGHT ) + { + gradientDir = wxBOTTOM; + } + else // For both wxTOP and wxBOTTOM. + { + gradientDir = wxRIGHT; + } + + dc.GradientFillLinear(GetClientRect(), m_colStart, m_colEnd, + gradientDir); + } + + // Now draw the text on top of it. + dc.SetFont(GetTitleFont()); + + wxPoint pos(MARGIN_X, MARGIN_Y); + DrawBannerTextLine(dc, m_title, pos); + pos.y += dc.GetTextExtent(m_title).y; + + dc.SetFont(GetFont()); + + wxArrayString lines = wxSplit(m_message, '\n', '\0'); + const unsigned numLines = lines.size(); + for ( unsigned n = 0; n < numLines; n++ ) + { + const wxString& line = lines[n]; + + DrawBannerTextLine(dc, line, pos); + pos.y += dc.GetTextExtent(line).y; + } + } +} + +wxColour wxBannerWindow::GetBitmapBg() +{ + if ( m_colBitmapBg.IsOk() ) + return m_colBitmapBg; + + // Determine the colour to use to extend the bitmap. It's the colour of the + // bitmap pixels at the edge closest to the area where it can be extended. + wxImage image(m_bitmap.ConvertToImage()); + + // The point we get the colour from. The choice is arbitrary and in general + // the bitmap should have the same colour on the entire edge of this point + // for extending it to look good. + wxPoint p; + + wxSize size = image.GetSize(); + size.x--; + size.y--; + + switch ( m_direction ) + { + case wxTOP: + case wxBOTTOM: + // The bitmap will be extended to the right. + p.x = size.x; + p.y = 0; + break; + + case wxLEFT: + // The bitmap will be extended from the top. + p.x = 0; + p.y = 0; + break; + + case wxRIGHT: + // The bitmap will be extended to the bottom. + p.x = 0; + p.y = size.y; + break; + + // This case is there only to prevent g++ warnings about not handling + // some enum elements in the switch, it can't really happen. + case wxALL: + wxFAIL_MSG( wxS("Unreachable") ); + } + + m_colBitmapBg.Set(image.GetRed(p.x, p.y), + image.GetGreen(p.x, p.y), + image.GetBlue(p.x, p.y)); + + return m_colBitmapBg; +} + +void wxBannerWindow::DrawBitmapBackground(wxDC& dc) +{ + // We may need to fill the part of the background not covered by the bitmap + // with the solid colour extending the bitmap, this rectangle will hold the + // area to be filled (which could be empty if the bitmap is big enough). + wxRect rectSolid; + + const wxSize size = GetClientSize(); + + switch ( m_direction ) + { + case wxTOP: + case wxBOTTOM: + // Draw the bitmap at the origin, its rightmost could be truncated, + // as it's meant to be. + dc.DrawBitmap(m_bitmap, 0, 0); + + rectSolid.x = m_bitmap.GetWidth(); + rectSolid.width = size.x - rectSolid.x; + rectSolid.height = size.y; + break; + + case wxLEFT: + // The top most part of the bitmap may be truncated but its bottom + // must be always visible so intentionally draw it possibly partly + // outside of the window. + rectSolid.width = size.x; + rectSolid.height = size.y - m_bitmap.GetHeight(); + dc.DrawBitmap(m_bitmap, 0, rectSolid.height); + break; + + case wxRIGHT: + // Draw the bitmap at the origin, possibly truncating its + // bottommost part. + dc.DrawBitmap(m_bitmap, 0, 0); + + rectSolid.y = m_bitmap.GetHeight(); + rectSolid.height = size.y - rectSolid.y; + rectSolid.width = size.x; + break; + + // This case is there only to prevent g++ warnings about not handling + // some enum elements in the switch, it can't really happen. + case wxALL: + wxFAIL_MSG( wxS("Unreachable") ); + } + + if ( rectSolid.width > 0 && rectSolid.height > 0 ) + { + dc.SetPen(*wxTRANSPARENT_PEN); + dc.SetBrush(GetBitmapBg()); + dc.DrawRectangle(rectSolid); + } +} + +void +wxBannerWindow::DrawBannerTextLine(wxDC& dc, + const wxString& str, + const wxPoint& pos) +{ + switch ( m_direction ) + { + case wxTOP: + case wxBOTTOM: + // The simple case: we just draw the text normally. + dc.DrawText(str, pos); + break; + + case wxLEFT: + // We draw the text vertically and start from the lower left + // corner and not the upper left one as usual. + dc.DrawRotatedText(str, pos.y, GetClientSize().y - pos.x, 90); + break; + + case wxRIGHT: + // We also draw the text vertically but now we start from the upper + // right corner and draw it from top to bottom. + dc.DrawRotatedText(str, GetClientSize().x - pos.y, pos.x, -90); + break; + + case wxALL: + wxFAIL_MSG( wxS("Unreachable") ); + } +} + +#endif // wxUSE_BANNERWINDOW diff --git a/Externals/wxWidgets3/src/generic/buttonbar.cpp b/Externals/wxWidgets3/src/generic/buttonbar.cpp index 1f7d2e03b3..65b7279583 100644 --- a/Externals/wxWidgets3/src/generic/buttonbar.cpp +++ b/Externals/wxWidgets3/src/generic/buttonbar.cpp @@ -4,7 +4,7 @@ // Author: Julian Smart, after Robert Roebling, Vadim Zeitlin, SciTech // Modified by: // Created: 2006-04-13 -// Id: $Id: buttonbar.cpp 61508 2009-07-23 20:30:22Z VZ $ +// Id: $Id: buttonbar.cpp 70450 2012-01-23 14:42:53Z VZ $ // Copyright: (c) Julian Smart, Robert Roebling, Vadim Zeitlin, // SciTech Software, Inc. // Licence: wxWindows licence @@ -140,7 +140,10 @@ bool wxButtonToolBar::Create(wxWindow *parent, // wxColour lightBackground(244, 244, 244); - wxFont font(wxSMALL_FONT->GetPointSize(), wxNORMAL_FONT->GetFamily(), wxNORMAL_FONT->GetStyle(), wxNORMAL); + wxFont font(wxSMALL_FONT->GetPointSize(), + wxNORMAL_FONT->GetFamily(), + wxNORMAL_FONT->GetStyle(), + wxFONTWEIGHT_NORMAL); SetFont(font); // Calculate the label height if necessary diff --git a/Externals/wxWidgets3/src/generic/calctrlg.cpp b/Externals/wxWidgets3/src/generic/calctrlg.cpp index f722bc201e..1317c799a8 100644 --- a/Externals/wxWidgets3/src/generic/calctrlg.cpp +++ b/Externals/wxWidgets3/src/generic/calctrlg.cpp @@ -4,7 +4,7 @@ // Author: Vadim Zeitlin // Modified by: // Created: 29.12.99 -// RCS-ID: $Id: calctrlg.cpp 66576 2011-01-04 15:08:25Z SC $ +// RCS-ID: $Id: calctrlg.cpp 67681 2011-05-03 16:29:04Z DS $ // Copyright: (c) 1999 Vadim Zeitlin // Licence: wxWindows licence /////////////////////////////////////////////////////////////////////////////// @@ -287,9 +287,6 @@ void wxGenericCalendarCtrl::CreateYearSpinCtrl() wxDefaultSize, wxSP_ARROW_KEYS | wxCLIP_SIBLINGS, -4300, 10000, GetDate().GetYear()); -#ifdef __WXMAC__ - m_spinYear->SetSize( 90, -1 ); -#endif m_spinYear->Connect(m_spinYear->GetId(), wxEVT_COMMAND_TEXT_UPDATED, wxCommandEventHandler(wxGenericCalendarCtrl::OnYearTextChange), @@ -700,12 +697,8 @@ wxSize wxGenericCalendarCtrl::DoGetBestSize() const height += wxMax(bestSizeCombo.y, m_spinYear->GetBestSize().y) + VERT_MARGIN; -#ifdef __WXMAC__ - // the spin control get clipped otherwise - width += 25; -#endif - wxCoord w2 = bestSizeCombo.x + HORZ_MARGIN + GetCharWidth()*6; + wxCoord w2 = bestSizeCombo.x + HORZ_MARGIN + GetCharWidth()*8; if ( width < w2 ) width = w2; } @@ -733,12 +726,8 @@ void wxGenericCalendarCtrl::DoMoveWindow(int x, int y, int width, int height) int maxHeight = wxMax(sizeSpin.y, sizeCombo.y); int dy = (maxHeight - sizeStatic.y) / 2; -#ifdef __WXMAC__ - m_comboMonth->Move(x, y + (maxHeight - sizeCombo.y)/2 + 2); // FIXME, something is reporting the wrong size.. -#else m_comboMonth->Move(x, y + (maxHeight - sizeCombo.y)/2); -#endif - m_staticMonth->SetSize(x, y + dy, sizeCombo.x, -1, sizeStatic.y); + m_staticMonth->SetSize(x, y + dy, sizeCombo.x, -1); int xDiff = sizeCombo.x + HORZ_MARGIN; @@ -757,20 +746,7 @@ void wxGenericCalendarCtrl::DoMoveWindow(int x, int y, int width, int height) void wxGenericCalendarCtrl::DoGetSize(int *width, int *height) const { -#ifdef __WXMAC__ wxControl::DoGetSize( width, height ); - - if ( !HasFlag(wxCAL_SEQUENTIAL_MONTH_SELECTION) && m_staticMonth && height ) - { - wxSize sizeCombo = m_comboMonth->GetEffectiveMinSize(); - wxSize sizeSpin = m_spinYear->GetSize(); - - int maxHeight = wxMax(sizeSpin.y, sizeCombo.y); - *height += maxHeight + VERT_MARGIN; - } -#else - wxControl::DoGetSize( width, height ); -#endif } void wxGenericCalendarCtrl::RecalcGeometry() @@ -1026,13 +1002,13 @@ void wxGenericCalendarCtrl::OnPaint(wxPaintEvent& WXUNUSED(event)) colBg = attr->GetBackgroundColour(); } - if ( colFg.Ok() ) + if ( colFg.IsOk() ) { dc.SetTextForeground(colFg); changedColours = true; } - if ( colBg.Ok() ) + if ( colBg.IsOk() ) { dc.SetTextBackground(colBg); changedColours = true; diff --git a/Externals/wxWidgets3/src/generic/choicdgg.cpp b/Externals/wxWidgets3/src/generic/choicdgg.cpp index d29635eab2..0efc15262c 100644 --- a/Externals/wxWidgets3/src/generic/choicdgg.cpp +++ b/Externals/wxWidgets3/src/generic/choicdgg.cpp @@ -4,7 +4,7 @@ // Author: Julian Smart // Modified by: 03.11.00: VZ to add wxArrayString and multiple sel functions // Created: 04/01/98 -// RCS-ID: $Id: choicdgg.cpp 63734 2010-03-22 11:40:19Z VZ $ +// RCS-ID: $Id: choicdgg.cpp 70514 2012-02-05 14:18:33Z VZ $ // Copyright: (c) wxWidgets team // Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// @@ -222,13 +222,13 @@ void *wxGetSingleChoiceData( const wxString& message, int initialSelection) { wxSingleChoiceDialog dialog(parent, message, caption, n, choices, - (char **)client_data); + client_data); dialog.SetSelection(initialSelection); void *data; if ( dialog.ShowModal() == wxID_OK ) - data = dialog.GetSelectionClientData(); + data = dialog.GetSelectionData(); else data = NULL; @@ -467,35 +467,12 @@ END_EVENT_TABLE() IMPLEMENT_DYNAMIC_CLASS(wxSingleChoiceDialog, wxDialog) -wxSingleChoiceDialog::wxSingleChoiceDialog(wxWindow *parent, - const wxString& message, - const wxString& caption, - int n, - const wxString *choices, - char **clientData, - long style, - const wxPoint& WXUNUSED(pos)) -{ - Create(parent, message, caption, n, choices, clientData, style); -} - -wxSingleChoiceDialog::wxSingleChoiceDialog(wxWindow *parent, - const wxString& message, - const wxString& caption, - const wxArrayString& choices, - char **clientData, - long style, - const wxPoint& WXUNUSED(pos)) -{ - Create(parent, message, caption, choices, clientData, style); -} - bool wxSingleChoiceDialog::Create( wxWindow *parent, const wxString& message, const wxString& caption, int n, const wxString *choices, - char **clientData, + void **clientData, long style, const wxPoint& pos ) { @@ -519,7 +496,7 @@ bool wxSingleChoiceDialog::Create( wxWindow *parent, const wxString& message, const wxString& caption, const wxArrayString& choices, - char **clientData, + void **clientData, long style, const wxPoint& pos ) { diff --git a/Externals/wxWidgets3/src/generic/collpaneg.cpp b/Externals/wxWidgets3/src/generic/collpaneg.cpp index f3ea4135f5..26b7525dfd 100644 --- a/Externals/wxWidgets3/src/generic/collpaneg.cpp +++ b/Externals/wxWidgets3/src/generic/collpaneg.cpp @@ -4,7 +4,7 @@ // Author: Francesco Montorsi // Modified By: // Created: 8/10/2006 -// Id: $Id: collpaneg.cpp 67280 2011-03-22 14:17:38Z DS $ +// Id: $Id: collpaneg.cpp 68366 2011-07-24 22:19:33Z VZ $ // Copyright: (c) Francesco Montorsi // Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// @@ -57,16 +57,10 @@ IMPLEMENT_DYNAMIC_CLASS(wxCollapsiblePaneEvent, wxCommandEvent) BEGIN_EVENT_TABLE(wxGenericCollapsiblePane, wxControl) EVT_BUTTON(wxID_ANY, wxGenericCollapsiblePane::OnButton) EVT_SIZE(wxGenericCollapsiblePane::OnSize) - - WX_EVENT_TABLE_CONTROL_CONTAINER(wxGenericCollapsiblePane) END_EVENT_TABLE() -WX_DELEGATE_TO_CONTROL_CONTAINER(wxGenericCollapsiblePane, wxControl) - void wxGenericCollapsiblePane::Init() { - WX_INIT_CONTROL_CONTAINER(); - m_pButton = NULL; m_pPane = NULL; m_pStaticLine = NULL; diff --git a/Externals/wxWidgets3/src/generic/colrdlgg.cpp b/Externals/wxWidgets3/src/generic/colrdlgg.cpp index 30fd78ef6c..4ca1da61b1 100644 --- a/Externals/wxWidgets3/src/generic/colrdlgg.cpp +++ b/Externals/wxWidgets3/src/generic/colrdlgg.cpp @@ -4,7 +4,7 @@ // Author: Julian Smart // Modified by: // Created: 04/01/98 -// RCS-ID: $Id: colrdlgg.cpp 66615 2011-01-07 05:26:57Z PC $ +// RCS-ID: $Id: colrdlgg.cpp 67681 2011-05-03 16:29:04Z DS $ // Copyright: (c) Julian Smart // Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// @@ -315,7 +315,7 @@ void wxGenericColourDialog::InitializeColours(void) for (i = 0; i < WXSIZEOF(wxColourDialogNames); i++) { wxColour col = wxTheColourDatabase->Find(wxColourDialogNames[i]); - if (col.Ok()) + if (col.IsOk()) m_standardColours[i].Set(col.Red(), col.Green(), col.Blue()); else m_standardColours[i].Set(0, 0, 0); @@ -324,14 +324,14 @@ void wxGenericColourDialog::InitializeColours(void) for (i = 0; i < WXSIZEOF(m_customColours); i++) { wxColour c = m_colourData.GetCustomColour(i); - if (c.Ok()) + if (c.IsOk()) m_customColours[i] = m_colourData.GetCustomColour(i); else m_customColours[i] = wxColour(255, 255, 255); } wxColour curr = m_colourData.GetColour(); - if ( curr.Ok() ) + if ( curr.IsOk() ) { bool m_initColourFound = false; diff --git a/Externals/wxWidgets3/src/generic/combog.cpp b/Externals/wxWidgets3/src/generic/combog.cpp index 39ef0ddd78..3fbbdae486 100644 --- a/Externals/wxWidgets3/src/generic/combog.cpp +++ b/Externals/wxWidgets3/src/generic/combog.cpp @@ -4,7 +4,7 @@ // Author: Jaakko Salli // Modified by: // Created: Apr-30-2006 -// RCS-ID: $Id: combog.cpp 67255 2011-03-20 10:59:22Z JMS $ +// RCS-ID: $Id: combog.cpp 70773 2012-03-02 12:43:39Z JS $ // Copyright: (c) 2005 Jaakko Salli // Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// @@ -46,7 +46,6 @@ // meaningless if LEFT_MARGIN_CAN_BE_SET set to 1 in combocmn.cpp #define TEXTCTRLXADJUST 0 -#define TEXTCTRLYADJUST 0 #define TEXTXADJUST 0 // how much is read-only text's x adjusted #define DEFAULT_DROPBUTTON_WIDTH 19 @@ -56,7 +55,6 @@ // meaningless if LEFT_MARGIN_CAN_BE_SET set to 1 in combocmn.cpp #define TEXTCTRLXADJUST 2 -#define TEXTCTRLYADJUST 3 #define TEXTXADJUST 0 // how much is read-only text's x adjusted #define DEFAULT_DROPBUTTON_WIDTH 17 @@ -66,7 +64,6 @@ // meaningless if LEFT_MARGIN_CAN_BE_SET set to 1 in combocmn.cpp #define TEXTCTRLXADJUST -1 -#define TEXTCTRLYADJUST 0 #define TEXTXADJUST 1 // how much is read-only text's x adjusted #define DEFAULT_DROPBUTTON_WIDTH 23 @@ -76,7 +73,6 @@ // meaningless if LEFT_MARGIN_CAN_BE_SET set to 1 in combocmn.cpp #define TEXTCTRLXADJUST 0 -#define TEXTCTRLYADJUST 0 #define TEXTXADJUST 0 // how much is read-only text's x adjusted #define DEFAULT_DROPBUTTON_WIDTH 22 @@ -86,7 +82,6 @@ // meaningless if LEFT_MARGIN_CAN_BE_SET set to 1 in combocmn.cpp #define TEXTCTRLXADJUST 0 -#define TEXTCTRLYADJUST 0 #define TEXTXADJUST 0 // how much is read-only text's x adjusted #define DEFAULT_DROPBUTTON_WIDTH 19 @@ -235,7 +230,7 @@ void wxGenericComboCtrl::OnResize() #endif // Move textctrl, if any, accordingly - PositionTextCtrl( TEXTCTRLXADJUST, TEXTCTRLYADJUST ); + PositionTextCtrl( TEXTCTRLXADJUST ); } void wxGenericComboCtrl::OnPaintEvent( wxPaintEvent& WXUNUSED(event) ) @@ -260,9 +255,15 @@ void wxGenericComboCtrl::OnPaintEvent( wxPaintEvent& WXUNUSED(event) ) int customBorder = m_widthCustomBorder; // Set border colour +#ifdef __WXMAC__ + wxPen pen1( wxColour(133,133,133), + customBorder, + wxSOLID ); +#else wxPen pen1( wxSystemSettings::GetColour(wxSYS_COLOUR_GRAYTEXT), customBorder, wxPENSTYLE_SOLID); +#endif dc.SetPen( pen1 ); // area around both controls diff --git a/Externals/wxWidgets3/src/generic/datavgen.cpp b/Externals/wxWidgets3/src/generic/datavgen.cpp index d27d2445b2..b88b1c952b 100644 --- a/Externals/wxWidgets3/src/generic/datavgen.cpp +++ b/Externals/wxWidgets3/src/generic/datavgen.cpp @@ -3,7 +3,7 @@ // Purpose: wxDataViewCtrl generic implementation // Author: Robert Roebling // Modified by: Francesco Montorsi, Guru Kathiresan, Bo Yang -// Id: $Id: datavgen.cpp 67158 2011-03-09 09:44:03Z VZ $ +// Id: $Id: datavgen.cpp 70717 2012-02-27 18:54:02Z VZ $ // Copyright: (c) 1998 Robert Roebling // Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// @@ -38,7 +38,6 @@ #endif #include "wx/stockitem.h" -#include "wx/calctrl.h" #include "wx/popupwin.h" #include "wx/renderer.h" #include "wx/dcbuffer.h" @@ -49,6 +48,7 @@ #include "wx/headerctrl.h" #include "wx/dnd.h" #include "wx/stopwatch.h" +#include "wx/weakref.h" //----------------------------------------------------------------------------- // classes @@ -83,6 +83,30 @@ static wxDataViewModel* g_model; static int g_column = -2; static bool g_asending = true; +// ---------------------------------------------------------------------------- +// helper functions +// ---------------------------------------------------------------------------- + +namespace +{ + +// Return the expander column or, if it is not set, the first column and also +// set it as the expander one for the future. +wxDataViewColumn* GetExpanderColumnOrFirstOne(wxDataViewCtrl* dataview) +{ + wxDataViewColumn* expander = dataview->GetExpanderColumn(); + if (!expander) + { + // TODO-RTL: last column for RTL support + expander = dataview->GetColumnAt( 0 ); + dataview->SetExpanderColumn(expander); + } + + return expander; +} + +} // anonymous namespace + //----------------------------------------------------------------------------- // wxDataViewColumn //----------------------------------------------------------------------------- @@ -122,6 +146,30 @@ void wxDataViewColumn::UpdateDisplay() } } +void wxDataViewColumn::SetSortOrder(bool ascending) +{ + if ( !m_owner ) + return; + + // First unset the old sort column if any. + int oldSortKey = m_owner->GetSortingColumnIndex(); + if ( oldSortKey != wxNOT_FOUND ) + { + m_owner->GetColumn(oldSortKey)->UnsetAsSortKey(); + } + + // Now set this one as the new sort column. + const int idx = m_owner->GetColumnIndex(this); + m_owner->SetSortingColumnIndex(idx); + + m_sort = true; + m_sortAscending = ascending; + + // Call this directly instead of using UpdateDisplay() as we already have + // the column index, no need to look it up again. + m_owner->OnColumnChange(idx); +} + //----------------------------------------------------------------------------- // wxDataViewHeaderWindow //----------------------------------------------------------------------------- @@ -169,7 +217,7 @@ private: // for events created by wxDataViewHeaderWindow the // row / value fields are not valid - return owner->GetEventHandler()->ProcessEvent(event); + return owner->ProcessWindowEvent(event); } void OnClick(wxHeaderCtrlEvent& event) @@ -197,16 +245,7 @@ private: } else // not using this column for sorting yet { - // first unset the old sort column if any - int oldSortKey = owner->GetSortingColumnIndex(); - if ( oldSortKey != wxNOT_FOUND ) - { - owner->GetColumn(oldSortKey)->UnsetAsSortKey(); - owner->OnColumnChange(oldSortKey); - } - - owner->SetSortingColumnIndex(idx); - col->SetAsSortKey(); + col->SetSortOrder(true); } wxDataViewModel * const model = owner->GetModel(); @@ -214,6 +253,8 @@ private: model->Resort(); owner->OnColumnChange(idx); + + SendEvent(wxEVT_COMMAND_DATAVIEW_COLUMN_SORTED, idx); } void OnRClick(wxHeaderCtrlEvent& event) @@ -273,57 +314,89 @@ public: class wxDataViewTreeNode; WX_DEFINE_ARRAY( wxDataViewTreeNode *, wxDataViewTreeNodes ); -WX_DEFINE_ARRAY( void* , wxDataViewTreeLeaves); int LINKAGEMODE wxGenericTreeModelNodeCmp( wxDataViewTreeNode ** node1, wxDataViewTreeNode ** node2); -int LINKAGEMODE wxGenericTreeModelItemCmp( void ** id1, void ** id2); class wxDataViewTreeNode { public: - wxDataViewTreeNode( wxDataViewTreeNode * parent = NULL ) + wxDataViewTreeNode(wxDataViewTreeNode *parent, const wxDataViewItem& item) + : m_parent(parent), + m_item(item), + m_branchData(NULL) { - m_parent = parent; - if (!parent) - m_open = true; - else - m_open = false; - m_hasChildren = false; - m_subTreeCount = 0; } ~wxDataViewTreeNode() { + if ( m_branchData ) + { + wxDataViewTreeNodes& nodes = m_branchData->children; + for ( wxDataViewTreeNodes::iterator i = nodes.begin(); + i != nodes.end(); + ++i ) + { + delete *i; + } + + delete m_branchData; + } + } + + static wxDataViewTreeNode* CreateRootNode() + { + wxDataViewTreeNode *n = new wxDataViewTreeNode(NULL, wxDataViewItem()); + n->SetHasChildren(true); + n->m_branchData->open = true; + return n; } wxDataViewTreeNode * GetParent() const { return m_parent; } - void SetParent( wxDataViewTreeNode * parent ) { m_parent = parent; } - wxDataViewTreeNodes & GetNodes() { return m_nodes; } - wxDataViewTreeLeaves & GetChildren() { return m_leaves; } - void AddNode( wxDataViewTreeNode * node ) + const wxDataViewTreeNodes& GetChildNodes() const { - m_leaves.Add( node->GetItem().GetID() ); - if (g_column >= -1) - m_leaves.Sort( &wxGenericTreeModelItemCmp ); - m_nodes.Add( node ); - if (g_column >= -1) - m_nodes.Sort( &wxGenericTreeModelNodeCmp ); - } - void AddLeaf( void * leaf ) - { - m_leaves.Add( leaf ); - if (g_column >= -1) - m_leaves.Sort( &wxGenericTreeModelItemCmp ); + wxASSERT( m_branchData != NULL ); + return m_branchData->children; + } + + void InsertChild(wxDataViewTreeNode *node, unsigned index) + { + if ( !m_branchData ) + m_branchData = new BranchNodeData; + + m_branchData->children.Insert(node, index); + + // TODO: insert into sorted array directly in O(log n) instead of resorting in O(n log n) + if (g_column >= -1) + m_branchData->children.Sort( &wxGenericTreeModelNodeCmp ); + } + + void RemoveChild(wxDataViewTreeNode *node) + { + wxCHECK_RET( m_branchData != NULL, "leaf node doesn't have children" ); + m_branchData->children.Remove(node); + } + + // returns position of child node for given item in children list or wxNOT_FOUND + int FindChildByItem(const wxDataViewItem& item) const + { + if ( !m_branchData ) + return wxNOT_FOUND; + + const wxDataViewTreeNodes& nodes = m_branchData->children; + const int len = nodes.size(); + for ( int i = 0; i < len; i++ ) + { + if ( nodes[i]->m_item == item ) + return i; + } + return wxNOT_FOUND; } - wxDataViewItem & GetItem() { return m_item; } const wxDataViewItem & GetItem() const { return m_item; } void SetItem( const wxDataViewItem & item ) { m_item = item; } - unsigned int GetChildrenNumber() const { return m_leaves.GetCount(); } - unsigned int GetNodeNumber() const { return m_nodes.GetCount(); } int GetIndentLevel() const { int ret = 0; @@ -338,84 +411,136 @@ public: bool IsOpen() const { - return m_open; + return m_branchData && m_branchData->open; } void ToggleOpen() { - int len = m_nodes.GetCount(); - int sum = 0; - for ( int i = 0;i < len; i ++) - sum += m_nodes[i]->GetSubTreeCount(); + wxCHECK_RET( m_branchData != NULL, "can't open leaf node" ); - sum += m_leaves.GetCount(); - if (m_open) + int sum = 0; + + const wxDataViewTreeNodes& nodes = m_branchData->children; + const int len = nodes.GetCount(); + for ( int i = 0;i < len; i ++) + sum += 1 + nodes[i]->GetSubTreeCount(); + + if (m_branchData->open) { ChangeSubTreeCount(-sum); - m_open = !m_open; + m_branchData->open = !m_branchData->open; } else { - m_open = !m_open; - ChangeSubTreeCount(sum); + m_branchData->open = !m_branchData->open; + ChangeSubTreeCount(+sum); } } - bool HasChildren() const { return m_hasChildren; } - void SetHasChildren( bool has ){ m_hasChildren = has; } - void SetSubTreeCount( int num ) { m_subTreeCount = num; } - int GetSubTreeCount() const { return m_subTreeCount; } + // "HasChildren" property corresponds to model's IsContainer(). Note that it may be true + // even if GetChildNodes() is empty; see below. + bool HasChildren() const + { + return m_branchData != NULL; + } + + void SetHasChildren(bool has) + { + if ( !has ) + { + wxDELETE(m_branchData); + } + else if ( m_branchData == NULL ) + { + m_branchData = new BranchNodeData; + } + } + + int GetSubTreeCount() const + { + return m_branchData ? m_branchData->subTreeCount : 0; + } + void ChangeSubTreeCount( int num ) { - if( !m_open ) + wxASSERT( m_branchData != NULL ); + + if( !m_branchData->open ) return; - m_subTreeCount += num; + + m_branchData->subTreeCount += num; + wxASSERT( m_branchData->subTreeCount >= 0 ); + if( m_parent ) m_parent->ChangeSubTreeCount(num); } void Resort() { + if ( !m_branchData ) + return; + if (g_column >= -1) { - m_nodes.Sort( &wxGenericTreeModelNodeCmp ); - int len = m_nodes.GetCount(); + wxDataViewTreeNodes& nodes = m_branchData->children; + + nodes.Sort( &wxGenericTreeModelNodeCmp ); + int len = nodes.GetCount(); for (int i = 0; i < len; i ++) - m_nodes[i]->Resort(); - m_leaves.Sort( &wxGenericTreeModelItemCmp ); + { + if ( nodes[i]->HasChildren() ) + nodes[i]->Resort(); + } } } + private: wxDataViewTreeNode *m_parent; - wxDataViewTreeNodes m_nodes; - wxDataViewTreeLeaves m_leaves; + + // Corresponding model item. wxDataViewItem m_item; - bool m_open; - bool m_hasChildren; - int m_subTreeCount; + + // Data specific to non-leaf (branch, inner) nodes. They are kept in a + // separate struct in order to conserve memory. + struct BranchNodeData + { + BranchNodeData() + : open(false), + subTreeCount(0) + { + } + + // Child nodes. Note that this may be empty even if m_hasChildren in + // case this branch of the tree wasn't expanded and realized yet. + wxDataViewTreeNodes children; + + // Is the branch node currently open (expanded)? + bool open; + + // Total count of expanded (i.e. visible with the help of some + // scrolling) items in the subtree, but excluding this node. I.e. it is + // 0 for leaves and is the number of rows the subtree occupies for + // branch nodes. + int subTreeCount; + }; + + BranchNodeData *m_branchData; }; + int LINKAGEMODE wxGenericTreeModelNodeCmp( wxDataViewTreeNode ** node1, wxDataViewTreeNode ** node2) { return g_model->Compare( (*node1)->GetItem(), (*node2)->GetItem(), g_column, g_asending ); } -int LINKAGEMODE wxGenericTreeModelItemCmp( void ** id1, void ** id2) -{ - return g_model->Compare( *id1, *id2, g_column, g_asending ); -} - //----------------------------------------------------------------------------- // wxDataViewMainWindow //----------------------------------------------------------------------------- -WX_DEFINE_SORTED_USER_EXPORTED_ARRAY_SIZE_T(unsigned int, wxDataViewSelection, - WXDLLIMPEXP_ADV); -WX_DECLARE_LIST(wxDataViewItem, ItemList); -WX_DEFINE_LIST(ItemList) +WX_DEFINE_SORTED_ARRAY_SIZE_T(unsigned int, wxDataViewSelection); class wxDataViewMainWindow: public wxWindow { @@ -427,7 +552,7 @@ public: const wxString &name = wxT("wxdataviewctrlmainwindow") ); virtual ~wxDataViewMainWindow(); - bool IsList() const { return GetOwner()->GetModel()->IsListModel(); } + bool IsList() const { return GetModel()->IsListModel(); } bool IsVirtualList() const { return m_root == NULL; } // notifications from wxDataViewModel @@ -448,7 +573,7 @@ public: void SortPrepare() { - g_model = GetOwner()->GetModel(); + g_model = GetModel(); wxDataViewColumn* col = GetOwner()->GetSortingColumn(); if( !col ) { @@ -468,12 +593,18 @@ public: wxDataViewCtrl *GetOwner() { return m_owner; } const wxDataViewCtrl *GetOwner() const { return m_owner; } + wxDataViewModel* GetModel() { return GetOwner()->GetModel(); } + const wxDataViewModel* GetModel() const { return GetOwner()->GetModel(); } + #if wxUSE_DRAG_AND_DROP wxBitmap CreateItemBitmap( unsigned int row, int &indent ); #endif // wxUSE_DRAG_AND_DROP void OnPaint( wxPaintEvent &event ); - void OnArrowChar(unsigned int newCurrent, const wxKeyEvent& event); + void OnCharHook( wxKeyEvent &event ); void OnChar( wxKeyEvent &event ); + void OnVerticalNavigation(unsigned int newCurrent, const wxKeyEvent& event); + void OnLeftKey(); + void OnRightKey(); void OnMouse( wxMouseEvent &event ); void OnSetFocus( wxFocusEvent &event ); void OnKillFocus( wxFocusEvent &event ); @@ -490,6 +621,10 @@ public: unsigned GetCurrentRow() const { return m_currentRow; } bool HasCurrentRow() { return m_currentRow != (unsigned int)-1; } void ChangeCurrentRow( unsigned int row ); + bool TryAdvanceCurrentColumn(wxDataViewTreeNode *node, bool forward); + + wxDataViewColumn *GetCurrentColumn() const { return m_currentCol; } + void ClearCurrentColumn() { m_currentCol = NULL; } bool IsSingleSel() const { return !GetParent()->HasFlag(wxDV_MULTIPLE); } bool IsEmpty() { return GetRowCount() == 0; } @@ -502,10 +637,9 @@ public: // the displaying number of the tree are changing along with the // expanding/collapsing of the tree nodes unsigned int GetLastVisibleRow(); - unsigned int GetRowCount(); + unsigned int GetRowCount() const; - wxDataViewItem GetSelection() const; - wxDataViewSelection GetSelections(){ return m_selection; } + const wxDataViewSelection& GetSelections() const { return m_selection; } void SetSelections( const wxDataViewSelection & sel ) { m_selection = sel; UpdateDisplay(); } void Select( const wxArrayInt& aSelections ); @@ -532,10 +666,17 @@ public: int GetLineHeight( unsigned int row ) const; // m_lineHeight in fixed mode int GetLineAt( unsigned int y ) const; // y / m_lineHeight in fixed mode + void SetRowHeight( int lineHeight ) { m_lineHeight = lineHeight; } + int GetRowHeight() const { return m_lineHeight; } + // Some useful functions for row and item mapping wxDataViewItem GetItemByRow( unsigned int row ) const; int GetRowByItem( const wxDataViewItem & item ) const; + wxDataViewTreeNode * GetTreeNodeByRow( unsigned int row ) const; + // We did not need this temporarily + // wxDataViewTreeNode * GetTreeNodeByItem( const wxDataViewItem & item ); + // Methods for building the mapping tree void BuildTree( wxDataViewModel * model ); void DestroyTree(); @@ -558,17 +699,26 @@ public: void OnLeave(); #endif // wxUSE_DRAG_AND_DROP + void OnColumnsCountChanged(); + + // Called by wxDataViewCtrl and our own OnRenameTimer() to start edit the + // specified item in the given column. + void StartEditing(const wxDataViewItem& item, const wxDataViewColumn* col); + private: - wxDataViewTreeNode * GetTreeNodeByRow( unsigned int row ) const; - // We did not need this temporarily - // wxDataViewTreeNode * GetTreeNodeByItem( const wxDataViewItem & item ); + int RecalculateCount() const; - int RecalculateCount(); - - wxDataViewEvent SendExpanderEvent( wxEventType type, const wxDataViewItem & item ); + // Return false only if the event was vetoed by its handler. + bool SendExpanderEvent(wxEventType type, const wxDataViewItem& item); wxDataViewTreeNode * FindNode( const wxDataViewItem & item ); + wxDataViewColumn *FindColumnForEditing(const wxDataViewItem& item, wxDataViewCellMode mode); + + bool IsCellEditableInMode(const wxDataViewItem& item, const wxDataViewColumn *col, wxDataViewCellMode mode) const; + + void DrawCellBackground( wxDataViewRenderer* cell, wxDC& dc, const wxRect& rect ); + private: wxDataViewCtrl *m_owner; int m_lineHeight; @@ -582,6 +732,8 @@ private: bool m_lastOnSame; bool m_hasFocus; + bool m_useCellFocus; + bool m_currentColSetByKeyboard; #if wxUSE_DRAG_AND_DROP int m_dragCount; @@ -614,6 +766,12 @@ private: // This is the tree node under the cursor wxDataViewTreeNode * m_underMouse; + // The control used for editing or NULL. + wxWeakRef m_editorCtrl; + + // Id m_editorCtrl is non-NULL, pointer to the associated renderer. + wxDataViewRenderer* m_editorRenderer; + private: DECLARE_DYNAMIC_CLASS(wxDataViewMainWindow) DECLARE_EVENT_TABLE() @@ -732,12 +890,13 @@ bool wxDataViewTextRenderer::HasEditorCtrl() const return true; } -wxControl* wxDataViewTextRenderer::CreateEditorCtrl( wxWindow *parent, +wxWindow* wxDataViewTextRenderer::CreateEditorCtrl( wxWindow *parent, wxRect labelRect, const wxVariant &value ) { wxTextCtrl* ctrl = new wxTextCtrl( parent, wxID_ANY, value, wxPoint(labelRect.x,labelRect.y), - wxSize(labelRect.width,labelRect.height) ); + wxSize(labelRect.width,labelRect.height), + wxTE_PROCESS_ENTER ); // select the text in the control an place the cursor at the end ctrl->SetInsertionPointEnd(); @@ -746,7 +905,7 @@ wxControl* wxDataViewTextRenderer::CreateEditorCtrl( wxWindow *parent, return ctrl; } -bool wxDataViewTextRenderer::GetValueFromEditorCtrl( wxControl *editor, wxVariant &value ) +bool wxDataViewTextRenderer::GetValueFromEditorCtrl( wxWindow *editor, wxVariant &value ) { wxTextCtrl *text = (wxTextCtrl*) editor; value = text->GetValue(); @@ -796,9 +955,9 @@ bool wxDataViewBitmapRenderer::GetValue( wxVariant& WXUNUSED(value) ) const bool wxDataViewBitmapRenderer::Render( wxRect cell, wxDC *dc, int WXUNUSED(state) ) { - if (m_bitmap.Ok()) + if (m_bitmap.IsOk()) dc->DrawBitmap( m_bitmap, cell.x, cell.y ); - else if (m_icon.Ok()) + else if (m_icon.IsOk()) dc->DrawIcon( m_icon, cell.x, cell.y ); return true; @@ -806,9 +965,9 @@ bool wxDataViewBitmapRenderer::Render( wxRect cell, wxDC *dc, int WXUNUSED(state wxSize wxDataViewBitmapRenderer::GetSize() const { - if (m_bitmap.Ok()) + if (m_bitmap.IsOk()) return wxSize( m_bitmap.GetWidth(), m_bitmap.GetHeight() ); - else if (m_icon.Ok()) + else if (m_icon.IsOk()) return wxSize( m_icon.GetWidth(), m_icon.GetHeight() ); return wxSize(wxDVC_DEFAULT_RENDERER_SIZE,wxDVC_DEFAULT_RENDERER_SIZE); @@ -863,19 +1022,21 @@ bool wxDataViewToggleRenderer::Render( wxRect cell, wxDC *dc, int WXUNUSED(state return true; } -bool wxDataViewToggleRenderer::WXOnLeftClick(const wxPoint& WXUNUSED(cursor), - const wxRect& WXUNUSED(cell), - wxDataViewModel *model, - const wxDataViewItem& item, - unsigned int col) +bool wxDataViewToggleRenderer::WXActivateCell(const wxRect& WXUNUSED(cell), + wxDataViewModel *model, + const wxDataViewItem& item, + unsigned int col, + const wxMouseEvent *mouseEvent) { - if (model->IsEnabled(item, col)) + if ( mouseEvent ) { - model->ChangeValue(!m_toggle, item, col); - return true; + // only react to clicks directly on the checkbox, not elsewhere in the same cell: + if ( !wxRect(GetSize()).Contains(mouseEvent->GetPosition()) ) + return false; } - return false; + model->ChangeValue(!m_toggle, item, col); + return true; } wxSize wxDataViewToggleRenderer::GetSize() const @@ -941,113 +1102,6 @@ wxSize wxDataViewProgressRenderer::GetSize() const return wxSize(40,12); } -// --------------------------------------------------------- -// wxDataViewDateRenderer -// --------------------------------------------------------- - -#define wxUSE_DATE_RENDERER_POPUP (wxUSE_CALENDARCTRL && wxUSE_POPUPWIN) - -#if wxUSE_DATE_RENDERER_POPUP - -class wxDataViewDateRendererPopupTransient: public wxPopupTransientWindow -{ -public: - wxDataViewDateRendererPopupTransient( wxWindow* parent, wxDateTime *value, - wxDataViewModel *model, const wxDataViewItem & item, unsigned int col) : - wxPopupTransientWindow( parent, wxBORDER_SIMPLE ), - m_item( item ) - { - m_model = model; - m_col = col; - m_cal = new wxCalendarCtrl( this, wxID_ANY, *value ); - wxBoxSizer *sizer = new wxBoxSizer( wxHORIZONTAL ); - sizer->Add( m_cal, 1, wxGROW ); - SetSizer( sizer ); - sizer->Fit( this ); - } - - void OnCalendar( wxCalendarEvent &event ); - - wxCalendarCtrl *m_cal; - wxDataViewModel *m_model; - unsigned int m_col; - const wxDataViewItem & m_item; - -protected: - virtual void OnDismiss() - { - } - -private: - DECLARE_EVENT_TABLE() -}; - -BEGIN_EVENT_TABLE(wxDataViewDateRendererPopupTransient,wxPopupTransientWindow) - EVT_CALENDAR( wxID_ANY, wxDataViewDateRendererPopupTransient::OnCalendar ) -END_EVENT_TABLE() - -void wxDataViewDateRendererPopupTransient::OnCalendar( wxCalendarEvent &event ) -{ - m_model->ChangeValue( event.GetDate(), m_item, m_col ); - DismissAndNotify(); -} - -#endif // wxUSE_DATE_RENDERER_POPUP - -IMPLEMENT_ABSTRACT_CLASS(wxDataViewDateRenderer, wxDataViewRenderer) - -wxDataViewDateRenderer::wxDataViewDateRenderer( const wxString &varianttype, - wxDataViewCellMode mode, int align ) : - wxDataViewRenderer( varianttype, mode, align ) -{ -} - -bool wxDataViewDateRenderer::SetValue( const wxVariant &value ) -{ - m_date = value.GetDateTime(); - - return true; -} - -bool wxDataViewDateRenderer::GetValue( wxVariant &value ) const -{ - value = m_date; - return true; -} - -bool wxDataViewDateRenderer::Render( wxRect cell, wxDC *dc, int state ) -{ - wxString tmp = m_date.FormatDate(); - RenderText( tmp, 0, cell, dc, state ); - return true; -} - -wxSize wxDataViewDateRenderer::GetSize() const -{ - return GetTextExtent(m_date.FormatDate()); -} - -bool wxDataViewDateRenderer::WXOnActivate(const wxRect& WXUNUSED(cell), - wxDataViewModel *model, - const wxDataViewItem& item, - unsigned int col) -{ - wxDateTime dtOld = m_date; - -#if wxUSE_DATE_RENDERER_POPUP - wxDataViewDateRendererPopupTransient *popup = new wxDataViewDateRendererPopupTransient( - GetOwner()->GetOwner()->GetParent(), &dtOld, model, item, col); - wxPoint pos = wxGetMousePosition(); - popup->Move( pos ); - popup->Layout(); - popup->Popup( popup->m_cal ); -#else // !wxUSE_DATE_RENDERER_POPUP - wxMessageBox(dtOld.Format()); -#endif // wxUSE_DATE_RENDERER_POPUP/!wxUSE_DATE_RENDERER_POPUP - - return true; -} - // --------------------------------------------------------- // wxDataViewIconTextRenderer // --------------------------------------------------------- @@ -1102,7 +1156,7 @@ wxSize wxDataViewIconTextRenderer::GetSize() const return wxSize(80,20); } -wxControl* wxDataViewIconTextRenderer::CreateEditorCtrl(wxWindow *parent, wxRect labelRect, const wxVariant& value) +wxWindow* wxDataViewIconTextRenderer::CreateEditorCtrl(wxWindow *parent, wxRect labelRect, const wxVariant& value) { wxDataViewIconText iconText; iconText << value; @@ -1119,7 +1173,8 @@ wxControl* wxDataViewIconTextRenderer::CreateEditorCtrl(wxWindow *parent, wxRect wxTextCtrl* ctrl = new wxTextCtrl( parent, wxID_ANY, text, wxPoint(labelRect.x,labelRect.y), - wxSize(labelRect.width,labelRect.height) ); + wxSize(labelRect.width,labelRect.height), + wxTE_PROCESS_ENTER ); // select the text in the control an place the cursor at the end ctrl->SetInsertionPointEnd(); @@ -1128,7 +1183,7 @@ wxControl* wxDataViewIconTextRenderer::CreateEditorCtrl(wxWindow *parent, wxRect return ctrl; } -bool wxDataViewIconTextRenderer::GetValueFromEditorCtrl( wxControl *editor, wxVariant& value ) +bool wxDataViewIconTextRenderer::GetValueFromEditorCtrl( wxWindow *editor, wxVariant& value ) { wxTextCtrl *text = (wxTextCtrl*) editor; @@ -1299,6 +1354,7 @@ BEGIN_EVENT_TABLE(wxDataViewMainWindow,wxWindow) EVT_MOUSE_EVENTS (wxDataViewMainWindow::OnMouse) EVT_SET_FOCUS (wxDataViewMainWindow::OnSetFocus) EVT_KILL_FOCUS (wxDataViewMainWindow::OnKillFocus) + EVT_CHAR_HOOK (wxDataViewMainWindow::OnCharHook) EVT_CHAR (wxDataViewMainWindow::OnChar) END_EVENT_TABLE() @@ -1310,14 +1366,25 @@ wxDataViewMainWindow::wxDataViewMainWindow( wxDataViewCtrl *parent, wxWindowID i { SetOwner( parent ); + m_editorRenderer = NULL; + m_lastOnSame = false; m_renameTimer = new wxDataViewRenameTimer( this ); // TODO: user better initial values/nothing selected m_currentCol = NULL; + m_currentColSetByKeyboard = false; + m_useCellFocus = false; m_currentRow = 0; - m_lineHeight = wxMax( 17, GetCharHeight() + 2 ); // 17 = mini icon height + 1 +#ifdef __WXMSW__ + // We would like to use the same line height that Explorer uses. This is + // different from standard ListView control since Vista. + if ( wxGetWinVersion() >= wxWinVersion_Vista ) + m_lineHeight = wxMax(16, GetCharHeight()) + 6; // 16 = mini icon height + else +#endif // __WXMSW__ + m_lineHeight = wxMax(16, GetCharHeight()) + 1; // 16 = mini icon height #if wxUSE_DRAG_AND_DROP m_dragCount = 0; @@ -1345,8 +1412,7 @@ wxDataViewMainWindow::wxDataViewMainWindow( wxDataViewCtrl *parent, wxWindowID i // TODO: maybe there is something system colour to use m_penExpander = wxPen(wxColour(0,0,0)); - m_root = new wxDataViewTreeNode( NULL ); - m_root->SetHasChildren(true); + m_root = wxDataViewTreeNode::CreateRootNode(); // Make m_count = -1 will cause the class recaculate the real displaying number of rows. m_count = -1; @@ -1407,7 +1473,7 @@ wxDragResult wxDataViewMainWindow::OnDragOver( wxDataFormat format, wxCoord x, wxDataViewItem item = GetItemByRow( row ); - wxDataViewModel *model = GetOwner()->GetModel(); + wxDataViewModel *model = GetModel(); wxDataViewEvent event( wxEVT_COMMAND_DATAVIEW_ITEM_DROP_POSSIBLE, m_owner->GetId() ); event.SetEventObject( m_owner ); @@ -1450,7 +1516,7 @@ bool wxDataViewMainWindow::OnDrop( wxDataFormat format, wxCoord x, wxCoord y ) wxDataViewItem item = GetItemByRow( row ); - wxDataViewModel *model = GetOwner()->GetModel(); + wxDataViewModel *model = GetModel(); wxDataViewEvent event( wxEVT_COMMAND_DATAVIEW_ITEM_DROP_POSSIBLE, m_owner->GetId() ); event.SetEventObject( m_owner ); @@ -1479,7 +1545,7 @@ wxDragResult wxDataViewMainWindow::OnData( wxDataFormat format, wxCoord x, wxCoo wxDataViewItem item = GetItemByRow( row ); - wxDataViewModel *model = GetOwner()->GetModel(); + wxDataViewModel *model = GetModel(); wxCustomDataObject *obj = (wxCustomDataObject *) GetDropTarget()->GetDataObject(); @@ -1525,9 +1591,6 @@ wxBitmap wxDataViewMainWindow::CreateItemBitmap( unsigned int row, int &indent ) indent = GetOwner()->GetIndent() * node->GetIndentLevel(); indent = indent + m_lineHeight; // try to use the m_lineHeight as the expander space - - if(!node->HasChildren()) - delete node; } width -= indent; @@ -1540,14 +1603,8 @@ wxBitmap wxDataViewMainWindow::CreateItemBitmap( unsigned int row, int &indent ) wxDataViewModel *model = m_owner->GetModel(); - wxDataViewColumn *expander = GetOwner()->GetExpanderColumn(); - if (!expander) - { - // TODO-RTL: last column for RTL support - expander = GetOwner()->GetColumnAt( 0 ); - GetOwner()->SetExpanderColumn(expander); - } - + wxDataViewColumn * const + expander = GetExpanderColumnOrFirstOne(GetOwner()); int x = 0; for (col = 0; col < cols; col++) @@ -1582,9 +1639,46 @@ wxBitmap wxDataViewMainWindow::CreateItemBitmap( unsigned int row, int &indent ) #endif // wxUSE_DRAG_AND_DROP +// Draw focus rect for individual cell. Unlike native focus rect, we render +// this in foreground text color (typically white) to enhance contrast and +// make it visible. +static void DrawSelectedCellFocusRect(wxDC& dc, const wxRect& rect) +{ + // (This code is based on wxRendererGeneric::DrawFocusRect and modified.) + + // draw the pixels manually because the "dots" in wxPen with wxDOT style + // may be short traits and not really dots + // + // note that to behave in the same manner as DrawRect(), we must exclude + // the bottom and right borders from the rectangle + wxCoord x1 = rect.GetLeft(), + y1 = rect.GetTop(), + x2 = rect.GetRight(), + y2 = rect.GetBottom(); + + wxDCPenChanger pen(dc, wxSystemSettings::GetColour(wxSYS_COLOUR_HIGHLIGHTTEXT)); + + wxCoord z; + for ( z = x1 + 1; z < x2; z += 2 ) + dc.DrawPoint(z, rect.GetTop()); + + wxCoord shift = z == x2 ? 0 : 1; + for ( z = y1 + shift; z < y2; z += 2 ) + dc.DrawPoint(x2, z); + + shift = z == y2 ? 0 : 1; + for ( z = x2 - shift; z > x1; z -= 2 ) + dc.DrawPoint(z, y2); + + shift = z == x1 ? 0 : 1; + for ( z = y2 - shift; z > y1; z -= 2 ) + dc.DrawPoint(x1, z); +} + + void wxDataViewMainWindow::OnPaint( wxPaintEvent &WXUNUSED(event) ) { - wxDataViewModel *model = GetOwner()->GetModel(); + wxDataViewModel *model = GetModel(); wxAutoBufferedPaintDC dc( this ); #ifdef __WXMSW__ @@ -1593,6 +1687,12 @@ void wxDataViewMainWindow::OnPaint( wxPaintEvent &WXUNUSED(event) ) dc.DrawRectangle(GetClientSize()); #endif + if ( IsEmpty() ) + { + // No items to draw. + return; + } + // prepare the DC GetOwner()->PrepareDC( dc ); dc.SetFont( GetFont() ); @@ -1652,6 +1752,37 @@ void wxDataViewMainWindow::OnPaint( wxPaintEvent &WXUNUSED(event) ) x_last += col->GetWidth(); } + // Draw background of alternate rows specially if required + if ( m_owner->HasFlag(wxDV_ROW_LINES) ) + { + wxColour altRowColour = m_owner->m_alternateRowColour; + if ( !altRowColour.IsOk() ) + { + // Determine the alternate rows colour automatically from the + // background colour. + const wxColour bgColour = m_owner->GetBackgroundColour(); + + // Depending on the background, alternate row color + // will be 3% more dark or 50% brighter. + int alpha = bgColour.GetRGB() > 0x808080 ? 97 : 150; + altRowColour = bgColour.ChangeLightness(alpha); + } + + dc.SetPen(*wxTRANSPARENT_PEN); + dc.SetBrush(wxBrush(altRowColour)); + + for (unsigned int item = item_start; item < item_last; item++) + { + if ( item % 2 ) + { + dc.DrawRectangle(x_start, + GetLineStart(item), + GetClientSize().GetWidth(), + GetLineHeight(item)); + } + } + } + // Draw horizontal rules if required if ( m_owner->HasFlag(wxDV_HORIZ_RULES) ) { @@ -1694,23 +1825,97 @@ void wxDataViewMainWindow::OnPaint( wxPaintEvent &WXUNUSED(event) ) for (unsigned int item = item_start; item < item_last; item++) { bool selected = m_selection.Index( item ) != wxNOT_FOUND; + if (selected || item == m_currentRow) { - int flags = selected ? (int)wxCONTROL_SELECTED : 0; - if (item == m_currentRow) - flags |= wxCONTROL_CURRENT; - if (m_hasFocus) - flags |= wxCONTROL_FOCUSED; - wxRect rect( x_start, GetLineStart( item ), x_last - x_start, GetLineHeight( item ) ); - wxRendererNative::Get().DrawItemSelectionRect - ( - this, - dc, - rect, - flags - ); + + // draw selection and whole-item focus: + if ( selected ) + { + int flags = wxCONTROL_SELECTED; + if (m_hasFocus) + flags |= wxCONTROL_FOCUSED; + + wxRendererNative::Get().DrawItemSelectionRect + ( + this, + dc, + rect, + flags + ); + } + + // draw keyboard focus rect if applicable + if ( item == m_currentRow && m_hasFocus ) + { + bool renderColumnFocus = false; + + if ( m_useCellFocus && m_currentCol && m_currentColSetByKeyboard ) + { + renderColumnFocus = true; + + // If this is container node without columns, render full-row focus: + if ( !IsList() ) + { + wxDataViewTreeNode *node = GetTreeNodeByRow(item); + if ( node->HasChildren() && !model->HasContainerColumns(node->GetItem()) ) + renderColumnFocus = false; + } + } + + if ( renderColumnFocus ) + { + for ( unsigned int i = col_start; i < col_last; i++ ) + { + wxDataViewColumn *col = GetOwner()->GetColumnAt(i); + if ( col->IsHidden() ) + continue; + + rect.width = col->GetWidth(); + + if ( col == m_currentCol ) + { + // make the rect more visible by adding a small + // margin around it: + rect.Deflate(1, 1); + + if ( selected ) + { + // DrawFocusRect() uses XOR and is all but + // invisible against dark-blue background. Use + // the same color used for selected text. + DrawSelectedCellFocusRect(dc, rect); + } + else + { + wxRendererNative::Get().DrawFocusRect + ( + this, + dc, + rect, + 0 + ); + } + break; + } + + rect.x += rect.width; + } + } + else + { + // render focus rectangle for the whole row + wxRendererNative::Get().DrawFocusRect + ( + this, + dc, + rect, + selected ? (int)wxCONTROL_SELECTED : 0 + ); + } + } } } @@ -1725,13 +1930,8 @@ void wxDataViewMainWindow::OnPaint( wxPaintEvent &WXUNUSED(event) ) } #endif // wxUSE_DRAG_AND_DROP - wxDataViewColumn *expander = GetOwner()->GetExpanderColumn(); - if (!expander) - { - // TODO-RTL: last column for RTL support - expander = GetOwner()->GetColumnAt( 0 ); - GetOwner()->SetExpanderColumn(expander); - } + wxDataViewColumn * const + expander = GetExpanderColumnOrFirstOne(GetOwner()); // redraw all cells for all rows which must be repainted and all columns wxRect cell_rect; @@ -1759,8 +1959,11 @@ void wxDataViewMainWindow::OnPaint( wxPaintEvent &WXUNUSED(event) ) dataitem = node->GetItem(); - if ((i > 0) && model->IsContainer(dataitem) && - !model->HasContainerColumns(dataitem)) + // Skip all columns of "container" rows except the expander + // column itself unless HasContainerColumns() overrides this. + if ( col != expander && + model->IsContainer(dataitem) && + !model->HasContainerColumns(dataitem) ) continue; } else @@ -1774,6 +1977,11 @@ void wxDataViewMainWindow::OnPaint( wxPaintEvent &WXUNUSED(event) ) cell_rect.y = GetLineStart( item ); cell_rect.height = GetLineHeight( item ); + // draw the background + bool selected = m_selection.Index( item ) != wxNOT_FOUND; + if ( !selected ) + DrawCellBackground( cell, dc, cell_rect ); + // deal with the expander int indent = 0; if ((!IsList()) && (col == expander)) @@ -1815,12 +2023,6 @@ void wxDataViewMainWindow::OnPaint( wxPaintEvent &WXUNUSED(event) ) // force the expander column to left-center align cell->SetAlignment( wxALIGN_CENTER_VERTICAL ); } - if (node && !node->HasChildren()) - { - // Yes, if the node does not have any child, it must be a leaf which - // mean that it is a temporarily created by GetTreeNodeByRow - wxDELETE(node); - } wxRect item_rect = cell_rect; item_rect.Deflate(PADDING_RIGHTLEFT, 0); @@ -1833,7 +2035,7 @@ void wxDataViewMainWindow::OnPaint( wxPaintEvent &WXUNUSED(event) ) continue; int state = 0; - if (m_hasFocus && (m_selection.Index(item) != wxNOT_FOUND)) + if (m_hasFocus && selected) state |= wxDATAVIEW_CELL_SELECTED; // TODO: it would be much more efficient to create a clipping @@ -1852,6 +2054,28 @@ void wxDataViewMainWindow::OnPaint( wxPaintEvent &WXUNUSED(event) ) } } + +void wxDataViewMainWindow::DrawCellBackground( wxDataViewRenderer* cell, wxDC& dc, const wxRect& rect ) +{ + wxRect rectBg( rect ); + + // don't overlap the horizontal rules + if ( m_owner->HasFlag(wxDV_HORIZ_RULES) ) + { + rectBg.x++; + rectBg.width--; + } + + // don't overlap the vertical rules + if ( m_owner->HasFlag(wxDV_VERT_RULES) ) + { + rectBg.y++; + rectBg.height--; + } + + cell->RenderBackground(&dc, rectBg); +} + void wxDataViewMainWindow::OnRenameTimer() { // We have to call this here because changes may just have @@ -1865,9 +2089,25 @@ void wxDataViewMainWindow::OnRenameTimer() wxDataViewItem item = GetItemByRow( m_currentRow ); - wxRect labelRect = GetItemRect(item, m_currentCol); + StartEditing( item, m_currentCol ); +} - m_currentCol->GetRenderer()->StartEditing( item, labelRect ); +void +wxDataViewMainWindow::StartEditing(const wxDataViewItem& item, + const wxDataViewColumn* col) +{ + wxDataViewRenderer* renderer = col->GetRenderer(); + if ( !IsCellEditableInMode(item, col, wxDATAVIEW_CELL_EDITABLE) ) + return; + + const wxRect itemRect = GetItemRect(item, col); + if ( renderer->StartEditing(item, itemRect) ) + { + // Save the renderer to be able to finish/cancel editing it later and + // save the control to be able to detect if we're still editing it. + m_editorRenderer = renderer; + m_editorCtrl = renderer->GetEditorCtrl(); + } } //----------------------------------------------------------------------------- @@ -1880,183 +2120,256 @@ public: virtual ~DoJob() { } // The return value control how the tree-walker tranverse the tree - // 0: Job done, stop tranverse and return - // 1: Ignore the current node's subtree and continue - // 2: Job not done, continue - enum { OK = 0 , IGR = 1, CONT = 2 }; + enum + { + DONE, // Job done, stop traversing and return + SKIP_SUBTREE, // Ignore the current node's subtree and continue + CONTINUE // Job not done, continue + }; + virtual int operator() ( wxDataViewTreeNode * node ) = 0; - virtual int operator() ( void * n ) = 0; }; bool Walker( wxDataViewTreeNode * node, DoJob & func ) { - if( node==NULL ) - return false; + wxCHECK_MSG( node, false, "can't walk NULL node" ); switch( func( node ) ) { - case DoJob::OK : + case DoJob::DONE: return true; - case DoJob::IGR: + case DoJob::SKIP_SUBTREE: return false; - case DoJob::CONT: - default: - ; + case DoJob::CONTINUE: + break; } - const wxDataViewTreeNodes& nodes = node->GetNodes(); - const wxDataViewTreeLeaves& leaves = node->GetChildren(); - - int len_nodes = nodes.GetCount(); - int len = leaves.GetCount(); - int i = 0, nodes_i = 0; - - for(; i < len; i ++ ) + if ( node->HasChildren() ) { - void * n = leaves[i]; - if( nodes_i < len_nodes && n == nodes[nodes_i]->GetItem().GetID() ) + const wxDataViewTreeNodes& nodes = node->GetChildNodes(); + + for ( wxDataViewTreeNodes::const_iterator i = nodes.begin(); + i != nodes.end(); + ++i ) { - wxDataViewTreeNode * nd = nodes[nodes_i]; - nodes_i++; - - if( Walker( nd , func ) ) + if ( Walker(*i, func) ) return true; - } - else - switch( func( n ) ) - { - case DoJob::OK : - return true; - case DoJob::IGR: - continue; - case DoJob::CONT: - default: - ; - } } + return false; } bool wxDataViewMainWindow::ItemAdded(const wxDataViewItem & parent, const wxDataViewItem & item) { - GetOwner()->InvalidateColBestWidths(); - if (IsVirtualList()) { wxDataViewVirtualListModel *list_model = - (wxDataViewVirtualListModel*) GetOwner()->GetModel(); + (wxDataViewVirtualListModel*) GetModel(); m_count = list_model->GetCount(); - UpdateDisplay(); - return true; - } - - SortPrepare(); - - wxDataViewTreeNode * node; - node = FindNode(parent); - - if( node == NULL ) - return false; - - node->SetHasChildren( true ); - - if( g_model->IsContainer( item ) ) - { - wxDataViewTreeNode * newnode = new wxDataViewTreeNode( node ); - newnode->SetItem(item); - newnode->SetHasChildren( true ); - node->AddNode( newnode); } else - node->AddLeaf( item.GetID() ); + { + SortPrepare(); - node->ChangeSubTreeCount(1); + wxDataViewTreeNode *parentNode = FindNode(parent); - m_count = -1; + if ( !parentNode ) + return false; + + wxDataViewItemArray modelSiblings; + GetModel()->GetChildren(parent, modelSiblings); + const int modelSiblingsSize = modelSiblings.size(); + + int posInModel = modelSiblings.Index(item, /*fromEnd=*/true); + wxCHECK_MSG( posInModel != wxNOT_FOUND, false, "adding non-existent item?" ); + + wxDataViewTreeNode *itemNode = new wxDataViewTreeNode(parentNode, item); + itemNode->SetHasChildren(GetModel()->IsContainer(item)); + + parentNode->SetHasChildren(true); + + const wxDataViewTreeNodes& nodeSiblings = parentNode->GetChildNodes(); + const int nodeSiblingsSize = nodeSiblings.size(); + + int nodePos = 0; + + if ( posInModel == modelSiblingsSize - 1 ) + { + nodePos = nodeSiblingsSize; + } + else if ( modelSiblingsSize == nodeSiblingsSize + 1 ) + { + // This is the simple case when our node tree already matches the + // model and only this one item is missing. + nodePos = posInModel; + } + else + { + // It's possible that a larger discrepancy between the model and + // our realization exists. This can happen e.g. when adding a bunch + // of items to the model and then calling ItemsAdded() just once + // afterwards. In this case, we must find the right position by + // looking at sibling items. + + // append to the end if we won't find a better position: + nodePos = nodeSiblingsSize; + + for ( int nextItemPos = posInModel + 1; + nextItemPos < modelSiblingsSize; + nextItemPos++ ) + { + int nextNodePos = parentNode->FindChildByItem(modelSiblings[nextItemPos]); + if ( nextNodePos != wxNOT_FOUND ) + { + nodePos = nextNodePos; + break; + } + } + } + + parentNode->ChangeSubTreeCount(+1); + parentNode->InsertChild(itemNode, nodePos); + + m_count = -1; + } + + GetOwner()->InvalidateColBestWidths(); UpdateDisplay(); return true; } -static void DestroyTreeHelper( wxDataViewTreeNode * node); - bool wxDataViewMainWindow::ItemDeleted(const wxDataViewItem& parent, const wxDataViewItem& item) { - GetOwner()->InvalidateColBestWidths(); - if (IsVirtualList()) { wxDataViewVirtualListModel *list_model = - (wxDataViewVirtualListModel*) GetOwner()->GetModel(); + (wxDataViewVirtualListModel*) GetModel(); m_count = list_model->GetCount(); - if( m_currentRow > GetRowCount() ) - m_currentRow = m_count - 1; - - // TODO: why empty the entire selection? - m_selection.Empty(); - - UpdateDisplay(); - - return true; - } - - wxDataViewTreeNode * node = FindNode(parent); - - // Notice that it is possible that the item being deleted is not in the - // tree at all, for example we could be deleting a never shown (because - // collapsed) item in a tree model. So it's not an error if we don't know - // about this item, just return without doing anything then. - if ( !node || node->GetChildren().Index(item.GetID()) == wxNOT_FOUND ) - return false; - - int sub = -1; - node->GetChildren().Remove( item.GetID() ); - // Manipolate selection - if( m_selection.GetCount() > 1 ) - { - m_selection.Empty(); - } - bool isContainer = false; - wxDataViewTreeNodes nds = node->GetNodes(); - for (size_t i = 0; i < nds.GetCount(); i ++) - { - if (nds[i]->GetItem() == item) + if ( !m_selection.empty() ) { - isContainer = true; - break; - } - } - if( isContainer ) - { - wxDataViewTreeNode * n = NULL; - wxDataViewTreeNodes nodes = node->GetNodes(); - int len = nodes.GetCount(); - for( int i = 0; i < len; i ++) - { - if( nodes[i]->GetItem() == item ) + const int row = GetRowByItem(item); + + int rowIndexInSelection = wxNOT_FOUND; + + const size_t selCount = m_selection.size(); + for ( size_t i = 0; i < selCount; i++ ) { - n = nodes[i]; + if ( m_selection[i] == (unsigned)row ) + rowIndexInSelection = i; + else if ( m_selection[i] > (unsigned)row ) + m_selection[i]--; + } + + if ( rowIndexInSelection != wxNOT_FOUND ) + m_selection.RemoveAt(rowIndexInSelection); + } + + } + else // general case + { + wxDataViewTreeNode *parentNode = FindNode(parent); + + // Notice that it is possible that the item being deleted is not in the + // tree at all, for example we could be deleting a never shown (because + // collapsed) item in a tree model. So it's not an error if we don't know + // about this item, just return without doing anything then. + if ( !parentNode ) + return true; + + wxCHECK_MSG( parentNode->HasChildren(), false, "parent node doesn't have children?" ); + const wxDataViewTreeNodes& parentsChildren = parentNode->GetChildNodes(); + + // We can't use FindNode() to find 'item', because it was already + // removed from the model by the time ItemDeleted() is called, so we + // have to do it manually. We keep track of its position as well for + // later use. + int itemPosInNode = 0; + wxDataViewTreeNode *itemNode = NULL; + for ( wxDataViewTreeNodes::const_iterator i = parentsChildren.begin(); + i != parentsChildren.end(); + ++i, ++itemPosInNode ) + { + if( (*i)->GetItem() == item ) + { + itemNode = *i; break; } } - wxCHECK_MSG( n != NULL, false, "item not found" ); + // If the parent wasn't expanded, it's possible that we didn't have a + // node corresponding to 'item' and so there's nothing left to do. + if ( !itemNode ) + { + // If this was the last child to be removed, it's possible the parent + // node became a leaf. Let's ask the model about it. + if ( parentNode->GetChildNodes().empty() ) + parentNode->SetHasChildren(GetModel()->IsContainer(parent)); - node->GetNodes().Remove( n ); - sub -= n->GetSubTreeCount(); - ::DestroyTreeHelper(n); + return true; + } + + // Delete the item from wxDataViewTreeNode representation: + const int itemsDeleted = 1 + itemNode->GetSubTreeCount(); + + parentNode->RemoveChild(itemNode); + delete itemNode; + parentNode->ChangeSubTreeCount(-itemsDeleted); + + // Make the row number invalid and get a new valid one when user call GetRowCount + m_count = -1; + + // If this was the last child to be removed, it's possible the parent + // node became a leaf. Let's ask the model about it. + if ( parentNode->GetChildNodes().empty() ) + parentNode->SetHasChildren(GetModel()->IsContainer(parent)); + + // Update selection by removing 'item' and its entire children tree from the selection. + if ( !m_selection.empty() ) + { + // we can't call GetRowByItem() on 'item', as it's already deleted, so compute it from + // the parent ('parentNode') and position in its list of children + int itemRow; + if ( itemPosInNode == 0 ) + { + // 1st child, row number is that of the parent parentNode + 1 + itemRow = GetRowByItem(parentNode->GetItem()) + 1; + } + else + { + // row number is that of the sibling above 'item' + its subtree if any + 1 + const wxDataViewTreeNode *siblingNode = parentNode->GetChildNodes()[itemPosInNode - 1]; + + itemRow = GetRowByItem(siblingNode->GetItem()) + + siblingNode->GetSubTreeCount() + + 1; + } + + wxDataViewSelection newsel(wxDataViewSelectionCmp); + + const size_t numSelections = m_selection.size(); + for ( size_t i = 0; i < numSelections; ++i ) + { + const int s = m_selection[i]; + if ( s < itemRow ) + newsel.push_back(s); + else if ( s >= itemRow + itemsDeleted ) + newsel.push_back(s - itemsDeleted); + // else: deleted item, remove from selection + } + + m_selection = newsel; + } } - // Make the row number invalid and get a new valid one when user call GetRowCount - m_count = -1; - node->ChangeSubTreeCount(sub); // Change the current row to the last row if the current exceed the max row number if( m_currentRow > GetRowCount() ) - m_currentRow = m_count - 1; + ChangeCurrentRow(m_count - 1); + GetOwner()->InvalidateColBestWidths(); UpdateDisplay(); return true; @@ -2064,18 +2377,18 @@ bool wxDataViewMainWindow::ItemDeleted(const wxDataViewItem& parent, bool wxDataViewMainWindow::ItemChanged(const wxDataViewItem & item) { - GetOwner()->InvalidateColBestWidths(); - SortPrepare(); g_model->Resort(); + GetOwner()->InvalidateColBestWidths(); + // Send event wxWindow *parent = GetParent(); wxDataViewEvent le(wxEVT_COMMAND_DATAVIEW_ITEM_VALUE_CHANGED, parent->GetId()); le.SetEventObject(parent); - le.SetModel(GetOwner()->GetModel()); + le.SetModel(GetModel()); le.SetItem(item); - parent->GetEventHandler()->ProcessEvent(le); + parent->ProcessWindowEvent(le); return true; } @@ -2096,8 +2409,6 @@ bool wxDataViewMainWindow::ValueChanged( const wxDataViewItem & item, unsigned i if (view_column == -1) return false; - GetOwner()->InvalidateColBestWidth(view_column); - // NOTE: to be valid, we cannot use e.g. INT_MAX - 1 /*#define MAX_VIRTUAL_WIDTH 100000 @@ -2110,29 +2421,30 @@ bool wxDataViewMainWindow::ValueChanged( const wxDataViewItem & item, unsigned i SortPrepare(); g_model->Resort(); + GetOwner()->InvalidateColBestWidth(view_column); + // Send event wxWindow *parent = GetParent(); wxDataViewEvent le(wxEVT_COMMAND_DATAVIEW_ITEM_VALUE_CHANGED, parent->GetId()); le.SetEventObject(parent); - le.SetModel(GetOwner()->GetModel()); + le.SetModel(GetModel()); le.SetItem(item); le.SetColumn(view_column); le.SetDataViewColumn(GetOwner()->GetColumn(view_column)); - parent->GetEventHandler()->ProcessEvent(le); + parent->ProcessWindowEvent(le); return true; } bool wxDataViewMainWindow::Cleared() { - GetOwner()->InvalidateColBestWidths(); - DestroyTree(); m_selection.Clear(); SortPrepare(); - BuildTree( GetOwner()->GetModel() ); + BuildTree( GetModel() ); + GetOwner()->InvalidateColBestWidths(); UpdateDisplay(); return true; @@ -2157,7 +2469,7 @@ void wxDataViewMainWindow::OnInternalIdle() void wxDataViewMainWindow::RecalculateDisplay() { - wxDataViewModel *model = GetOwner()->GetModel(); + wxDataViewModel *model = GetModel(); if (!model) { Refresh(); @@ -2190,7 +2502,7 @@ void wxDataViewMainWindow::ScrollTo( int rows, int column ) int x, y; m_owner->GetScrollPixelsPerUnit( &x, &y ); int sy = GetLineStart( rows )/y; - int sx = 0; + int sx = -1; if( column != -1 ) { wxRect rect = GetClientRect(); @@ -2264,12 +2576,14 @@ unsigned int wxDataViewMainWindow::GetLastVisibleRow() return wxMin( GetRowCount()-1, row ); } -unsigned int wxDataViewMainWindow::GetRowCount() +unsigned int wxDataViewMainWindow::GetRowCount() const { if ( m_count == -1 ) { - m_count = RecalculateCount(); - UpdateDisplay(); + wxDataViewMainWindow* const + self = const_cast(this); + self->m_count = RecalculateCount(); + self->UpdateDisplay(); } return m_count; } @@ -2385,10 +2699,10 @@ void wxDataViewMainWindow::SendSelectionChangedEvent( const wxDataViewItem& item wxDataViewEvent le(wxEVT_COMMAND_DATAVIEW_SELECTION_CHANGED, parent->GetId()); le.SetEventObject(parent); - le.SetModel(GetOwner()->GetModel()); + le.SetModel(GetModel()); le.SetItem( item ); - parent->GetEventHandler()->ProcessEvent(le); + parent->ProcessWindowEvent(le); } void wxDataViewMainWindow::RefreshRow( unsigned int row ) @@ -2434,58 +2748,6 @@ void wxDataViewMainWindow::RefreshRowsAfter( unsigned int firstRow ) Refresh( true, &rect ); } -void wxDataViewMainWindow::OnArrowChar(unsigned int newCurrent, const wxKeyEvent& event) -{ - wxCHECK_RET( newCurrent < GetRowCount(), - wxT("invalid item index in OnArrowChar()") ); - - // if there is no selection, we cannot move it anywhere - if (!HasCurrentRow()) - return; - - unsigned int oldCurrent = m_currentRow; - - // in single selection we just ignore Shift as we can't select several - // items anyhow - if ( event.ShiftDown() && !IsSingleSel() ) - { - RefreshRow( oldCurrent ); - - ChangeCurrentRow( newCurrent ); - - // select all the items between the old and the new one - if ( oldCurrent > newCurrent ) - { - newCurrent = oldCurrent; - oldCurrent = m_currentRow; - } - - SelectRows( oldCurrent, newCurrent, true ); - if (oldCurrent!=newCurrent) - SendSelectionChangedEvent(GetItemByRow(m_selection[0])); - } - else // !shift - { - RefreshRow( oldCurrent ); - - // all previously selected items are unselected unless ctrl is held - if ( !event.ControlDown() ) - SelectAllRows(false); - - ChangeCurrentRow( newCurrent ); - - if ( !event.ControlDown() ) - { - SelectRow( m_currentRow, true ); - SendSelectionChangedEvent(GetItemByRow(m_currentRow)); - } - else - RefreshRow( m_currentRow ); - } - - GetOwner()->EnsureVisible( m_currentRow, -1 ); -} - wxRect wxDataViewMainWindow::GetLineRect( unsigned int row ) const { wxRect rect; @@ -2499,7 +2761,7 @@ wxRect wxDataViewMainWindow::GetLineRect( unsigned int row ) const int wxDataViewMainWindow::GetLineStart( unsigned int row ) const { - const wxDataViewModel *model = GetOwner()->GetModel(); + const wxDataViewModel *model = GetModel(); if (GetOwner()->GetWindowStyle() & wxDV_VARIABLE_LINE_HEIGHT) { @@ -2515,13 +2777,6 @@ int wxDataViewMainWindow::GetLineStart( unsigned int row ) const wxDataViewItem item = node->GetItem(); - if (node && !node->HasChildren()) - { - // Yes, if the node does not have any child, it must be a leaf which - // mean that it is a temporarily created by GetTreeNodeByRow - wxDELETE(node); - } - unsigned int cols = GetOwner()->GetColumnCount(); unsigned int col; int height = m_lineHeight; @@ -2556,7 +2811,7 @@ int wxDataViewMainWindow::GetLineStart( unsigned int row ) const int wxDataViewMainWindow::GetLineAt( unsigned int y ) const { - const wxDataViewModel *model = GetOwner()->GetModel(); + const wxDataViewModel *model = GetModel(); // check for the easy case first if ( !GetOwner()->HasFlag(wxDV_VARIABLE_LINE_HEIGHT) ) @@ -2576,13 +2831,6 @@ int wxDataViewMainWindow::GetLineAt( unsigned int y ) const wxDataViewItem item = node->GetItem(); - if (node && !node->HasChildren()) - { - // Yes, if the node does not have any child, it must be a leaf which - // mean that it is a temporarily created by GetTreeNodeByRow - wxDELETE(node); - } - unsigned int cols = GetOwner()->GetColumnCount(); unsigned int col; int height = m_lineHeight; @@ -2614,7 +2862,7 @@ int wxDataViewMainWindow::GetLineAt( unsigned int y ) const int wxDataViewMainWindow::GetLineHeight( unsigned int row ) const { - const wxDataViewModel *model = GetOwner()->GetModel(); + const wxDataViewModel *model = GetModel(); if (GetOwner()->GetWindowStyle() & wxDV_VARIABLE_LINE_HEIGHT) { @@ -2626,13 +2874,6 @@ int wxDataViewMainWindow::GetLineHeight( unsigned int row ) const wxDataViewItem item = node->GetItem(); - if (node && !node->HasChildren()) - { - // Yes, if the node does not have any child, it must be a leaf which - // mean that it is a temporarily created by GetTreeNodeByRow - wxDELETE(node); - } - int height = m_lineHeight; unsigned int cols = GetOwner()->GetColumnCount(); @@ -2663,76 +2904,6 @@ int wxDataViewMainWindow::GetLineHeight( unsigned int row ) const } } -class RowToItemJob: public DoJob -{ -public: - RowToItemJob( unsigned int row , int current ) - { this->row = row; this->current = current; } - virtual ~RowToItemJob() {} - - virtual int operator() ( wxDataViewTreeNode * node ) - { - current ++; - if( current == static_cast(row)) - { - ret = node->GetItem(); - return DoJob::OK; - } - - if( node->GetSubTreeCount() + current < static_cast(row) ) - { - current += node->GetSubTreeCount(); - return DoJob::IGR; - } - else - { - // If the current has no child node, we can find the desired item of the row - // number directly. - // This if can speed up finding in some case, and will has a very good effect - // when it comes to list view - if( node->GetNodes().GetCount() == 0) - { - int index = static_cast(row) - current - 1; - ret = node->GetChildren().Item( index ); - return DoJob::OK; - } - return DoJob::CONT; - } - } - - virtual int operator() ( void * n ) - { - current ++; - if( current == static_cast(row)) - { - ret = wxDataViewItem( n ); - return DoJob::OK; - } - return DoJob::CONT; - } - - wxDataViewItem GetResult() const - { return ret; } - -private: - unsigned int row; - int current; - wxDataViewItem ret; -}; - -wxDataViewItem wxDataViewMainWindow::GetItemByRow(unsigned int row) const -{ - if (IsVirtualList()) - { - return wxDataViewItem( wxUIntToPtr(row+1) ); - } - else - { - RowToItemJob job( row, -2 ); - Walker( m_root , job ); - return job.GetResult(); - } -} class RowToTreeNodeJob: public DoJob { @@ -2744,7 +2915,6 @@ public: ret = NULL; parent = node; } - virtual ~RowToTreeNodeJob(){ } virtual int operator() ( wxDataViewTreeNode * node ) { @@ -2752,47 +2922,31 @@ public: if( current == static_cast(row)) { ret = node; - return DoJob::OK; + return DoJob::DONE; } if( node->GetSubTreeCount() + current < static_cast(row) ) { current += node->GetSubTreeCount(); - return DoJob::IGR; + return DoJob::SKIP_SUBTREE; } else { parent = node; - // If the current node has no children, we can find the desired item of the - // row number directly. - // This if can speed up finding in some case, and will have a very good - // effect for list views. - if( node->GetNodes().GetCount() == 0) + // If the current node has only leaf children, we can find the + // desired node directly. This can speed up finding the node + // in some cases, and will have a very good effect for list views. + if ( node->HasChildren() && + (int)node->GetChildNodes().size() == node->GetSubTreeCount() ) { - int index = static_cast(row) - current - 1; - void * n = node->GetChildren().Item( index ); - ret = new wxDataViewTreeNode( parent ); - ret->SetItem( wxDataViewItem( n )); - ret->SetHasChildren(false); - return DoJob::OK; + const int index = static_cast(row) - current - 1; + ret = node->GetChildNodes()[index]; + return DoJob::DONE; } - return DoJob::CONT; - } - } - virtual int operator() ( void * n ) - { - current ++; - if( current == static_cast(row)) - { - ret = new wxDataViewTreeNode( parent ); - ret->SetItem( wxDataViewItem( n )); - ret->SetHasChildren(false); - return DoJob::OK; + return DoJob::CONTINUE; } - - return DoJob::CONT; } wxDataViewTreeNode * GetResult() const @@ -2814,18 +2968,36 @@ wxDataViewTreeNode * wxDataViewMainWindow::GetTreeNodeByRow(unsigned int row) co return job.GetResult(); } -wxDataViewEvent wxDataViewMainWindow::SendExpanderEvent( wxEventType type, - const wxDataViewItem & item ) +wxDataViewItem wxDataViewMainWindow::GetItemByRow(unsigned int row) const +{ + wxDataViewItem item; + if (IsVirtualList()) + { + if ( row < GetRowCount() ) + item = wxDataViewItem(wxUIntToPtr(row+1)); + } + else + { + wxDataViewTreeNode *node = GetTreeNodeByRow(row); + if ( node ) + item = node->GetItem(); + } + + return item; +} + +bool +wxDataViewMainWindow::SendExpanderEvent(wxEventType type, + const wxDataViewItem& item) { wxWindow *parent = GetParent(); wxDataViewEvent le(type, parent->GetId()); le.SetEventObject(parent); - le.SetModel(GetOwner()->GetModel()); + le.SetModel(GetModel()); le.SetItem( item ); - parent->GetEventHandler()->ProcessEvent(le); - return le; + return !parent->ProcessWindowEvent(le) || le.IsAllowed(); } bool wxDataViewMainWindow::IsExpanded( unsigned int row ) const @@ -2838,10 +3010,7 @@ bool wxDataViewMainWindow::IsExpanded( unsigned int row ) const return false; if (!node->HasChildren()) - { - delete node; return false; - } return node->IsOpen(); } @@ -2856,10 +3025,7 @@ bool wxDataViewMainWindow::HasChildren( unsigned int row ) const return false; if (!node->HasChildren()) - { - delete node; return false; - } return true; } @@ -2874,27 +3040,23 @@ void wxDataViewMainWindow::Expand( unsigned int row ) return; if (!node->HasChildren()) - { - delete node; return; - } if (!node->IsOpen()) { - wxDataViewEvent e = - SendExpanderEvent(wxEVT_COMMAND_DATAVIEW_ITEM_EXPANDING, node->GetItem()); - - // Check if the user prevent expanding - if( e.GetSkipped() ) + if ( !SendExpanderEvent(wxEVT_COMMAND_DATAVIEW_ITEM_EXPANDING, node->GetItem()) ) + { + // Vetoed by the event handler. return; + } node->ToggleOpen(); // build the children of current node - if( node->GetChildrenNumber() == 0 ) + if( node->GetChildNodes().empty() ) { SortPrepare(); - ::BuildTreeHelper(GetOwner()->GetModel(), node->GetItem(), node); + ::BuildTreeHelper(GetModel(), node->GetItem(), node); } // By expanding the node all row indices that are currently in the selection list @@ -2930,17 +3092,15 @@ void wxDataViewMainWindow::Collapse(unsigned int row) return; if (!node->HasChildren()) - { - delete node; return; - } if (node->IsOpen()) { - wxDataViewEvent e = - SendExpanderEvent(wxEVT_COMMAND_DATAVIEW_ITEM_COLLAPSING,node->GetItem()); - if( e.GetSkipped() ) + if ( !SendExpanderEvent(wxEVT_COMMAND_DATAVIEW_ITEM_COLLAPSING,node->GetItem()) ) + { + // Vetoed by the event handler. return; + } // Find out if there are selected items below the current node. bool selectCollapsingRow = false; @@ -2998,7 +3158,7 @@ void wxDataViewMainWindow::Collapse(unsigned int row) wxDataViewTreeNode * wxDataViewMainWindow::FindNode( const wxDataViewItem & item ) { - const wxDataViewModel * model = GetOwner()->GetModel(); + const wxDataViewModel * model = GetModel(); if( model == NULL ) return NULL; @@ -3017,17 +3177,20 @@ wxDataViewTreeNode * wxDataViewMainWindow::FindNode( const wxDataViewItem & item // Find the item along the parent-chain. // This algorithm is designed to speed up the node-finding method wxDataViewTreeNode* node = m_root; - for( unsigned iter = parentChain.size()-1; iter>=0; --iter ) + for( unsigned iter = parentChain.size()-1; ; --iter ) { if( node->HasChildren() ) { - if( node->GetChildrenNumber() == 0 ) + if( node->GetChildNodes().empty() ) { + // Even though the item is a container, it doesn't have any + // child nodes in the control's representation yet. We have + // to realize its subtree now. SortPrepare(); ::BuildTreeHelper(model, node->GetItem(), node); } - const wxDataViewTreeNodes& nodes = node->GetNodes(); + const wxDataViewTreeNodes& nodes = node->GetChildNodes(); bool found = false; for (unsigned i = 0; i < nodes.GetCount(); ++i) @@ -3048,6 +3211,9 @@ wxDataViewTreeNode * wxDataViewMainWindow::FindNode( const wxDataViewItem & item } else return NULL; + + if ( !iter ) + break; } return NULL; } @@ -3119,14 +3285,12 @@ wxRect wxDataViewMainWindow::GetItemRect( const wxDataViewItem & item, // to get the correct x position where the actual text is int indent = 0; int row = GetRowByItem(item); - if (!IsList() && (column == 0 || GetOwner()->GetExpanderColumn() == column) ) + if (!IsList() && + (column == 0 || GetExpanderColumnOrFirstOne(GetOwner()) == column) ) { wxDataViewTreeNode* node = GetTreeNodeByRow(row); indent = GetOwner()->GetIndent() * node->GetIndentLevel(); indent = indent + m_lineHeight; // use m_lineHeight as the width of the expander - - if(!node->HasChildren()) - delete node; } wxRect itemRect( xpos + indent, @@ -3140,12 +3304,12 @@ wxRect wxDataViewMainWindow::GetItemRect( const wxDataViewItem & item, return itemRect; } -int wxDataViewMainWindow::RecalculateCount() +int wxDataViewMainWindow::RecalculateCount() const { if (IsVirtualList()) { wxDataViewVirtualListModel *list_model = - (wxDataViewVirtualListModel*) GetOwner()->GetModel(); + (wxDataViewVirtualListModel*) GetModel(); return list_model->GetCount(); } @@ -3171,30 +3335,22 @@ public: ret ++; if( node->GetItem() == item ) { - return DoJob::OK; + return DoJob::DONE; } if( node->GetItem() == *m_iter ) { m_iter++; - return DoJob::CONT; + return DoJob::CONTINUE; } else { ret += node->GetSubTreeCount(); - return DoJob::IGR; + return DoJob::SKIP_SUBTREE; } } - virtual int operator() ( void * n ) - { - ret ++; - if( n == item.GetID() ) - return DoJob::OK; - return DoJob::CONT; - } - // the row number is begin from zero int GetResult() const { return ret -1; } @@ -3208,7 +3364,7 @@ private: int wxDataViewMainWindow::GetRowByItem(const wxDataViewItem & item) const { - const wxDataViewModel * model = GetOwner()->GetModel(); + const wxDataViewModel * model = GetModel(); if( model == NULL ) return -1; @@ -3250,41 +3406,31 @@ static void BuildTreeHelper( const wxDataViewModel * model, const wxDataViewIte wxDataViewItemArray children; unsigned int num = model->GetChildren( item, children); - unsigned int index = 0; - while( index < num ) + for ( unsigned int index = 0; index < num; index++ ) { - if( model->IsContainer( children[index] ) ) - { - wxDataViewTreeNode * n = new wxDataViewTreeNode( node ); - n->SetItem(children[index]); - n->SetHasChildren( true ); - node->AddNode( n ); - } - else - { - node->AddLeaf( children[index].GetID() ); - } - index ++; - } - node->SetSubTreeCount( num ); - wxDataViewTreeNode * n = node->GetParent(); - if( n != NULL) - n->ChangeSubTreeCount(num); + wxDataViewTreeNode *n = new wxDataViewTreeNode(node, children[index]); + if( model->IsContainer(children[index]) ) + n->SetHasChildren( true ); + + node->InsertChild(n, index); + } + + wxASSERT( node->IsOpen() ); + node->ChangeSubTreeCount(+num); } void wxDataViewMainWindow::BuildTree(wxDataViewModel * model) { DestroyTree(); - if (GetOwner()->GetModel()->IsVirtualListModel()) + if (GetModel()->IsVirtualListModel()) { m_count = -1; return; } - m_root = new wxDataViewTreeNode( NULL ); - m_root->SetHasChildren(true); + m_root = wxDataViewTreeNode::CreateRootNode(); // First we define a invalid item to fetch the top-level elements wxDataViewItem item; @@ -3293,28 +3439,112 @@ void wxDataViewMainWindow::BuildTree(wxDataViewModel * model) m_count = -1; } -static void DestroyTreeHelper( wxDataViewTreeNode * node ) -{ - if( node->GetNodeNumber() != 0 ) - { - int len = node->GetNodeNumber(); - wxDataViewTreeNodes& nodes = node->GetNodes(); - for (int i = 0; i < len; i++) - DestroyTreeHelper(nodes[i]); - } - delete node; -} - void wxDataViewMainWindow::DestroyTree() { if (!IsVirtualList()) { - ::DestroyTreeHelper(m_root); - m_count = 0; - m_root = NULL; + wxDELETE(m_root); + m_count = 0; } } +wxDataViewColumn* +wxDataViewMainWindow::FindColumnForEditing(const wxDataViewItem& item, wxDataViewCellMode mode) +{ + // Edit the current column editable in 'mode'. If no column is focused + // (typically because the user has full row selected), try to find the + // first editable column (this would typically be a checkbox for + // wxDATAVIEW_CELL_ACTIVATABLE and we don't want to force the user to set + // focus on the checkbox column; or on the only editable text column). + + wxDataViewColumn *candidate = m_currentCol; + + if ( candidate && + !IsCellEditableInMode(item, candidate, mode) && + !m_currentColSetByKeyboard ) + { + // If current column was set by mouse to something not editable (in + // 'mode') and the user pressed Space/F2 to edit it, treat the + // situation as if there was whole-row focus, because that's what is + // visually indicated and the mouse click could very well be targeted + // on the row rather than on an individual cell. + // + // But if it was done by keyboard, respect that even if the column + // isn't editable, because focus is visually on that column and editing + // something else would be surprising. + candidate = NULL; + } + + if ( !candidate ) + { + const unsigned cols = GetOwner()->GetColumnCount(); + for ( unsigned i = 0; i < cols; i++ ) + { + wxDataViewColumn *c = GetOwner()->GetColumnAt(i); + if ( c->IsHidden() ) + continue; + + if ( IsCellEditableInMode(item, c, mode) ) + { + candidate = c; + break; + } + } + } + + // If on container item without columns, only the expander column + // may be directly editable: + if ( candidate && + GetOwner()->GetExpanderColumn() != candidate && + GetModel()->IsContainer(item) && + !GetModel()->HasContainerColumns(item) ) + { + candidate = GetOwner()->GetExpanderColumn(); + } + + if ( !candidate ) + return NULL; + + if ( !IsCellEditableInMode(item, candidate, mode) ) + return NULL; + + return candidate; +} + +bool wxDataViewMainWindow::IsCellEditableInMode(const wxDataViewItem& item, + const wxDataViewColumn *col, + wxDataViewCellMode mode) const +{ + if ( col->GetRenderer()->GetMode() != mode ) + return false; + + if ( !GetModel()->IsEnabled(item, col->GetModelColumn()) ) + return false; + + return true; +} + +void wxDataViewMainWindow::OnCharHook(wxKeyEvent& event) +{ + if ( m_editorCtrl ) + { + // Handle any keys special for the in-place editor and return without + // calling Skip() below. + switch ( event.GetKeyCode() ) + { + case WXK_ESCAPE: + m_editorRenderer->CancelEditing(); + return; + + case WXK_RETURN: + m_editorRenderer->FinishEditing(); + return; + } + } + + event.Skip(); +} + void wxDataViewMainWindow::OnChar( wxKeyEvent &event ) { wxWindow * const parent = GetParent(); @@ -3342,87 +3572,125 @@ void wxDataViewMainWindow::OnChar( wxKeyEvent &event ) switch ( event.GetKeyCode() ) { case WXK_RETURN: + if ( event.HasModifiers() ) { + event.Skip(); + break; + } + else + { + // Enter activates the item, i.e. sends wxEVT_COMMAND_DATAVIEW_ITEM_ACTIVATED to + // it. Only if that event is not handled do we activate column renderer (which + // is normally done by Space) or even inline editing. + + const wxDataViewItem item = GetItemByRow(m_currentRow); + wxDataViewEvent le(wxEVT_COMMAND_DATAVIEW_ITEM_ACTIVATED, parent->GetId()); - le.SetItem( GetItemByRow(m_currentRow) ); + le.SetItem(item); le.SetEventObject(parent); - le.SetModel(GetOwner()->GetModel()); + le.SetModel(GetModel()); - parent->GetEventHandler()->ProcessEvent(le); + if ( parent->ProcessWindowEvent(le) ) + break; + // else: fall through to WXK_SPACE handling + } + + case WXK_SPACE: + if ( event.HasModifiers() ) + { + event.Skip(); + break; + } + else + { + // Space toggles activatable items or -- if not activatable -- + // starts inline editing (this is normally done using F2 on + // Windows, but Space is common everywhere else, so use it too + // for greater cross-platform compatibility). + + const wxDataViewItem item = GetItemByRow(m_currentRow); + + // Activate the current activatable column. If not column is focused (typically + // because the user has full row selected), try to find the first activatable + // column (this would typically be a checkbox and we don't want to force the user + // to set focus on the checkbox column). + wxDataViewColumn *activatableCol = FindColumnForEditing(item, wxDATAVIEW_CELL_ACTIVATABLE); + + if ( activatableCol ) + { + const unsigned colIdx = activatableCol->GetModelColumn(); + const wxRect cell_rect = GetOwner()->GetItemRect(item, activatableCol); + + wxDataViewRenderer *cell = activatableCol->GetRenderer(); + cell->PrepareForItem(GetModel(), item, colIdx); + cell->WXActivateCell(cell_rect, GetModel(), item, colIdx, NULL); + + break; + } + // else: fall through to WXK_F2 handling + } + + case WXK_F2: + if ( event.HasModifiers() ) + { + event.Skip(); + break; + } + else + { + if( !m_selection.empty() ) + { + // Mimic Windows 7 behavior: edit the item that has focus + // if it is selected and the first selected item if focus + // is out of selection. + int sel; + if ( m_selection.Index(m_currentRow) != wxNOT_FOUND ) + sel = m_currentRow; + else + sel = m_selection[0]; + + + const wxDataViewItem item = GetItemByRow(sel); + + // Edit the current column. If no column is focused + // (typically because the user has full row selected), try + // to find the first editable column. + wxDataViewColumn *editableCol = FindColumnForEditing(item, wxDATAVIEW_CELL_EDITABLE); + + if ( editableCol ) + GetOwner()->EditItem(item, editableCol); + } } break; case WXK_UP: if ( m_currentRow > 0 ) - OnArrowChar( m_currentRow - 1, event ); + OnVerticalNavigation( m_currentRow - 1, event ); break; case WXK_DOWN: - if ( m_currentRow < GetRowCount() - 1 ) - OnArrowChar( m_currentRow + 1, event ); + if ( m_currentRow + 1 < GetRowCount() ) + OnVerticalNavigation( m_currentRow + 1, event ); break; // Add the process for tree expanding/collapsing case WXK_LEFT: - { - if (IsList()) - break; - - wxDataViewTreeNode* node = GetTreeNodeByRow(m_currentRow); - if (!node) - break; - - if (node->HasChildren() && node->IsOpen()) - { - Collapse(m_currentRow); - } - else // if the node is already closed we move the selection to its parent - { - wxDataViewTreeNode *parent_node = node->GetParent(); - - if(!node->HasChildren()) - delete node; - - if (parent_node) - { - int parent = GetRowByItem( parent_node->GetItem() ); - if ( parent >= 0 ) - { - unsigned int row = m_currentRow; - SelectRow( row, false); - SelectRow( parent, true ); - ChangeCurrentRow( parent ); - GetOwner()->EnsureVisible( parent, -1 ); - SendSelectionChangedEvent( parent_node->GetItem() ); - } - } - } + OnLeftKey(); break; - } + case WXK_RIGHT: - { - if (!IsExpanded( m_currentRow )) - Expand( m_currentRow ); - else - { - unsigned int row = m_currentRow; - SelectRow( row, false ); - SelectRow( row + 1, true ); - ChangeCurrentRow( row + 1 ); - GetOwner()->EnsureVisible( row + 1, -1 ); - SendSelectionChangedEvent( GetItemByRow(row+1) ); - } + OnRightKey(); break; - } + case WXK_END: { if (!IsEmpty()) - OnArrowChar( GetRowCount() - 1, event ); + OnVerticalNavigation( GetRowCount() - 1, event ); break; } case WXK_HOME: if (!IsEmpty()) - OnArrowChar( 0, event ); + OnVerticalNavigation( 0, event ); break; case WXK_PAGEUP: @@ -3432,7 +3700,7 @@ void wxDataViewMainWindow::OnChar( wxKeyEvent &event ) if (index < 0) index = 0; - OnArrowChar( index, event ); + OnVerticalNavigation( index, event ); } break; @@ -3444,17 +3712,7 @@ void wxDataViewMainWindow::OnChar( wxKeyEvent &event ) if ( index >= count ) index = count - 1; - OnArrowChar( index, event ); - } - break; - - case WXK_F2: - { - if(m_selection.size() == 1) - { - // TODO: we need to revise that when we have a concept for a 'current column' - GetOwner()->StartEditor(GetItemByRow(m_selection[0]), 0); - } + OnVerticalNavigation( index, event ); } break; @@ -3463,6 +3721,184 @@ void wxDataViewMainWindow::OnChar( wxKeyEvent &event ) } } +void wxDataViewMainWindow::OnVerticalNavigation(unsigned int newCurrent, const wxKeyEvent& event) +{ + wxCHECK_RET( newCurrent < GetRowCount(), + wxT("invalid item index in OnVerticalNavigation()") ); + + // if there is no selection, we cannot move it anywhere + if (!HasCurrentRow()) + return; + + unsigned int oldCurrent = m_currentRow; + + // in single selection we just ignore Shift as we can't select several + // items anyhow + if ( event.ShiftDown() && !IsSingleSel() ) + { + RefreshRow( oldCurrent ); + + ChangeCurrentRow( newCurrent ); + + // select all the items between the old and the new one + if ( oldCurrent > newCurrent ) + { + newCurrent = oldCurrent; + oldCurrent = m_currentRow; + } + + SelectRows( oldCurrent, newCurrent, true ); + if (oldCurrent!=newCurrent) + SendSelectionChangedEvent(GetItemByRow(m_selection[0])); + } + else // !shift + { + RefreshRow( oldCurrent ); + + // all previously selected items are unselected unless ctrl is held + if ( !event.ControlDown() ) + SelectAllRows(false); + + ChangeCurrentRow( newCurrent ); + + if ( !event.ControlDown() ) + { + SelectRow( m_currentRow, true ); + SendSelectionChangedEvent(GetItemByRow(m_currentRow)); + } + else + RefreshRow( m_currentRow ); + } + + GetOwner()->EnsureVisible( m_currentRow, -1 ); +} + +void wxDataViewMainWindow::OnLeftKey() +{ + if ( IsList() ) + { + TryAdvanceCurrentColumn(NULL, /*forward=*/false); + } + else + { + wxDataViewTreeNode* node = GetTreeNodeByRow(m_currentRow); + + if ( TryAdvanceCurrentColumn(node, /*forward=*/false) ) + return; + + // Because TryAdvanceCurrentColumn() return false, we are at the first + // column or using whole-row selection. In this situation, we can use + // the standard TreeView handling of the left key. + if (node->HasChildren() && node->IsOpen()) + { + Collapse(m_currentRow); + } + else + { + // if the node is already closed, we move the selection to its parent + wxDataViewTreeNode *parent_node = node->GetParent(); + + if (parent_node) + { + int parent = GetRowByItem( parent_node->GetItem() ); + if ( parent >= 0 ) + { + unsigned int row = m_currentRow; + SelectRow( row, false); + SelectRow( parent, true ); + ChangeCurrentRow( parent ); + GetOwner()->EnsureVisible( parent, -1 ); + SendSelectionChangedEvent( parent_node->GetItem() ); + } + } + } + } +} + +void wxDataViewMainWindow::OnRightKey() +{ + if ( IsList() ) + { + TryAdvanceCurrentColumn(NULL, /*forward=*/true); + } + else + { + wxDataViewTreeNode* node = GetTreeNodeByRow(m_currentRow); + + if ( node->HasChildren() ) + { + if ( !node->IsOpen() ) + { + Expand( m_currentRow ); + } + else + { + // if the node is already open, we move the selection to the first child + unsigned int row = m_currentRow; + SelectRow( row, false ); + SelectRow( row + 1, true ); + ChangeCurrentRow( row + 1 ); + GetOwner()->EnsureVisible( row + 1, -1 ); + SendSelectionChangedEvent( GetItemByRow(row+1) ); + } + } + else + { + TryAdvanceCurrentColumn(node, /*forward=*/true); + } + } +} + +bool wxDataViewMainWindow::TryAdvanceCurrentColumn(wxDataViewTreeNode *node, bool forward) +{ + if ( GetOwner()->GetColumnCount() == 0 ) + return false; + + if ( !m_useCellFocus ) + return false; + + if ( node ) + { + // navigation shouldn't work in branch nodes without other columns: + if ( node->HasChildren() && !GetModel()->HasContainerColumns(node->GetItem()) ) + return false; + } + + if ( m_currentCol == NULL || !m_currentColSetByKeyboard ) + { + if ( forward ) + { + m_currentCol = GetOwner()->GetColumnAt(1); + m_currentColSetByKeyboard = true; + RefreshRow(m_currentRow); + return true; + } + else + return false; + } + + int idx = GetOwner()->GetColumnIndex(m_currentCol) + (forward ? +1 : -1); + + if ( idx >= (int)GetOwner()->GetColumnCount() ) + return false; + + GetOwner()->EnsureVisible(m_currentRow, idx); + + if ( idx < 1 ) + { + // We are going to the left of the second column. Reset to whole-row + // focus (which means first column would be edited). + m_currentCol = NULL; + RefreshRow(m_currentRow); + return true; + } + + m_currentCol = GetOwner()->GetColumnAt(idx); + m_currentColSetByKeyboard = true; + RefreshRow(m_currentRow); + return true; +} + void wxDataViewMainWindow::OnMouse( wxMouseEvent &event ) { if (event.GetEventType() == wxEVT_MOUSEWHEEL) @@ -3497,6 +3933,37 @@ void wxDataViewMainWindow::OnMouse( wxMouseEvent &event ) } xpos += c->GetWidth(); } + + wxDataViewModel* const model = GetModel(); + + const unsigned int current = GetLineAt( y ); + const wxDataViewItem item = GetItemByRow(current); + + // Handle right clicking here, before everything else as context menu + // events should be sent even when we click outside of any item, unlike all + // the other ones. + if (event.RightUp()) + { + wxWindow *parent = GetParent(); + wxDataViewEvent le(wxEVT_COMMAND_DATAVIEW_ITEM_CONTEXT_MENU, parent->GetId()); + le.SetEventObject(parent); + le.SetModel(model); + + if ( item.IsOk() && col ) + { + le.SetItem( item ); + le.SetColumn( col->GetModelColumn() ); + le.SetDataViewColumn( col ); + + wxVariant value; + model->GetValue( value, item, col->GetModelColumn() ); + le.SetValue(value); + } + + parent->ProcessWindowEvent(le); + return; + } + if (!col) { event.Skip(); @@ -3504,7 +3971,6 @@ void wxDataViewMainWindow::OnMouse( wxMouseEvent &event ) } wxDataViewRenderer *cell = col->GetRenderer(); - unsigned int current = GetLineAt( y ); if ((current >= GetRowCount()) || (x > GetEndOfLastCol())) { // Unselect all if below the last row ? @@ -3512,21 +3978,29 @@ void wxDataViewMainWindow::OnMouse( wxMouseEvent &event ) return; } - // Test whether the mouse is hovered on the tree item button + wxDataViewColumn* const + expander = GetExpanderColumnOrFirstOne(GetOwner()); + + // Test whether the mouse is hovering over the expander (a.k.a tree "+" + // button) and also determine the offset of the real cell start, skipping + // the indentation and the expander itself. bool hoverOverExpander = false; - if ((!IsList()) && (GetOwner()->GetExpanderColumn() == col)) + int itemOffset = 0; + if ((!IsList()) && (expander == col)) { wxDataViewTreeNode * node = GetTreeNodeByRow(current); - if( node!=NULL && node->HasChildren() ) - { - int indent = node->GetIndentLevel(); - indent = GetOwner()->GetIndent()*indent; + int indent = node->GetIndentLevel(); + itemOffset = GetOwner()->GetIndent()*indent; + + if ( node->HasChildren() ) + { // we make the rectangle we are looking in a bit bigger than the actual // visual expander so the user can hit that little thing reliably - wxRect rect( xpos + indent, + wxRect rect(itemOffset, GetLineStart( current ) + (GetLineHeight(current) - m_lineHeight)/2, m_lineHeight, m_lineHeight); + if( rect.Contains(x, y) ) { // So the mouse is over the expander @@ -3544,8 +4018,10 @@ void wxDataViewMainWindow::OnMouse( wxMouseEvent &event ) m_underMouse = node; } } - if (node!=NULL && !node->HasChildren()) - delete node; + + // Account for the expander as well, even if this item doesn't have it, + // its parent does so it still counts for the offset. + itemOffset += m_lineHeight; } if (!hoverOverExpander) { @@ -3557,8 +4033,6 @@ void wxDataViewMainWindow::OnMouse( wxMouseEvent &event ) } } - wxDataViewModel *model = GetOwner()->GetModel(); - #if wxUSE_DRAG_AND_DROP if (event.Dragging()) { @@ -3580,12 +4054,12 @@ void wxDataViewMainWindow::OnMouse( wxMouseEvent &event ) m_owner->CalcUnscrolledPosition( m_dragStart.x, m_dragStart.y, &m_dragStart.x, &m_dragStart.y ); unsigned int drag_item_row = GetLineAt( m_dragStart.y ); - wxDataViewItem item = GetItemByRow( drag_item_row ); + wxDataViewItem itemDragged = GetItemByRow( drag_item_row ); // Notify cell about drag wxDataViewEvent event( wxEVT_COMMAND_DATAVIEW_ITEM_BEGIN_DRAG, m_owner->GetId() ); event.SetEventObject( m_owner ); - event.SetItem( item ); + event.SetItem( itemDragged ); event.SetModel( model ); if (!m_owner->HandleWindowEvent( event )) return; @@ -3618,9 +4092,8 @@ void wxDataViewMainWindow::OnMouse( wxMouseEvent &event ) m_lastOnSame = false; } - wxDataViewItem item = GetItemByRow(current); bool ignore_other_columns = - ((GetOwner()->GetExpanderColumn() != col) && + ((expander != col) && (model->IsContainer(item)) && (!model->HasContainerColumns(item))); @@ -3633,28 +4106,15 @@ void wxDataViewMainWindow::OnMouse( wxMouseEvent &event ) } else if ( current == m_lineLastClicked ) { - if ((!ignore_other_columns) && (cell->GetMode() == wxDATAVIEW_CELL_ACTIVATABLE)) - { - const unsigned colIdx = col->GetModelColumn(); + wxWindow *parent = GetParent(); + wxDataViewEvent le(wxEVT_COMMAND_DATAVIEW_ITEM_ACTIVATED, parent->GetId()); + le.SetItem( item ); + le.SetColumn( col->GetModelColumn() ); + le.SetDataViewColumn( col ); + le.SetEventObject(parent); + le.SetModel(GetModel()); - cell->PrepareForItem(model, item, colIdx); - - wxRect cell_rect( xpos, GetLineStart( current ), - col->GetWidth(), GetLineHeight( current ) ); - cell->WXOnActivate( cell_rect, model, item, colIdx ); - } - else - { - wxWindow *parent = GetParent(); - wxDataViewEvent le(wxEVT_COMMAND_DATAVIEW_ITEM_ACTIVATED, parent->GetId()); - le.SetItem( item ); - le.SetColumn( col->GetModelColumn() ); - le.SetDataViewColumn( col ); - le.SetEventObject(parent); - le.SetModel(GetOwner()->GetModel()); - - parent->GetEventHandler()->ProcessEvent(le); - } + parent->ProcessWindowEvent(le); return; } else @@ -3680,7 +4140,7 @@ void wxDataViewMainWindow::OnMouse( wxMouseEvent &event ) if (m_lastOnSame && !ignore_other_columns) { if ((col == m_currentCol) && (current == m_currentRow) && - (cell->GetMode() & wxDATAVIEW_CELL_EDITABLE) ) + IsCellEditableInMode(item, col, wxDATAVIEW_CELL_EDITABLE) ) { m_renameTimer->Start( 100, true ); } @@ -3708,25 +4168,13 @@ void wxDataViewMainWindow::OnMouse( wxMouseEvent &event ) if (!IsRowSelected(current)) { SelectAllRows(false); + const unsigned oldCurrent = m_currentRow; ChangeCurrentRow(current); SelectRow(m_currentRow,true); + RefreshRow(oldCurrent); SendSelectionChangedEvent(GetItemByRow( m_currentRow ) ); } } - else if (event.RightUp()) - { - wxVariant value; - model->GetValue( value, item, col->GetModelColumn() ); - wxWindow *parent = GetParent(); - wxDataViewEvent le(wxEVT_COMMAND_DATAVIEW_ITEM_CONTEXT_MENU, parent->GetId()); - le.SetItem( item ); - le.SetColumn( col->GetModelColumn() ); - le.SetDataViewColumn( col ); - le.SetEventObject(parent); - le.SetModel(GetOwner()->GetModel()); - le.SetValue(value); - parent->GetEventHandler()->ProcessEvent(le); - } else if (event.MiddleDown()) { } @@ -3805,18 +4253,21 @@ void wxDataViewMainWindow::OnMouse( wxMouseEvent &event ) // Update selection here... m_currentCol = col; + m_currentColSetByKeyboard = false; m_lastOnSame = !simulateClick && ((col == oldCurrentCol) && (current == oldCurrentRow)) && oldWasSelected; - // Call LeftClick after everything else as under GTK+ - if (cell->GetMode() & wxDATAVIEW_CELL_ACTIVATABLE) + // Call ActivateCell() after everything else as under GTK+ + if ( IsCellEditableInMode(item, col, wxDATAVIEW_CELL_ACTIVATABLE) ) { // notify cell about click cell->PrepareForItem(model, item, col->GetModelColumn()); - wxRect cell_rect( xpos, GetLineStart( current ), - col->GetWidth(), GetLineHeight( current ) ); + wxRect cell_rect( xpos + itemOffset, + GetLineStart( current ), + col->GetWidth() - itemOffset, + GetLineHeight( current ) ); // Report position relative to the cell's custom area, i.e. // no the entire space as given by the control but the one @@ -3848,14 +4299,19 @@ void wxDataViewMainWindow::OnMouse( wxMouseEvent &event ) } } - wxPoint pos( event.GetPosition() ); - pos.x -= rectItem.x; - pos.y -= rectItem.y; + wxMouseEvent event2(event); + event2.m_x -= rectItem.x; + event2.m_y -= rectItem.y; + m_owner->CalcUnscrolledPosition(event2.m_x, event2.m_y, &event2.m_x, &event2.m_y); - m_owner->CalcUnscrolledPosition( pos.x, pos.y, &pos.x, &pos.y ); - - /* ignore ret */ cell->WXOnLeftClick( pos, cell_rect, - model, item, col->GetModelColumn()); + /* ignore ret */ cell->WXActivateCell + ( + cell_rect, + model, + item, + col->GetModelColumn(), + &event2 + ); } } } @@ -3880,12 +4336,23 @@ void wxDataViewMainWindow::OnKillFocus( wxFocusEvent &event ) event.Skip(); } -wxDataViewItem wxDataViewMainWindow::GetSelection() const +void wxDataViewMainWindow::OnColumnsCountChanged() { - if( m_selection.GetCount() != 1 ) - return wxDataViewItem(); + int editableCount = 0; - return GetItemByRow( m_selection.Item(0)); + const unsigned cols = GetOwner()->GetColumnCount(); + for ( unsigned i = 0; i < cols; i++ ) + { + wxDataViewColumn *c = GetOwner()->GetColumnAt(i); + if ( c->IsHidden() ) + continue; + if ( c->GetRenderer()->GetMode() != wxDATAVIEW_CELL_INERT ) + editableCount++; + } + + m_useCellFocus = (editableCount > 1); + + UpdateDisplay(); } //----------------------------------------------------------------------------- @@ -3917,6 +4384,8 @@ void wxDataViewCtrl::Init() m_sortingColumnIdx = wxNOT_FOUND; m_headerArea = NULL; + + m_colsDirty = false; } bool wxDataViewCtrl::Create(wxWindow *parent, @@ -4010,6 +4479,16 @@ void wxDataViewCtrl::OnSize( wxSizeEvent &WXUNUSED(event) ) Layout(); AdjustScrollbars(); + + // We must redraw the headers if their height changed. Normally this + // shouldn't happen as the control shouldn't let itself be resized beneath + // its minimal height but avoid the display artefacts that appear if it + // does happen, e.g. because there is really not enough vertical space. + if ( !HasFlag(wxDV_NO_HEADER) && m_headerArea && + m_headerArea->GetSize().y <= m_headerArea->GetBestSize(). y ) + { + m_headerArea->Refresh(); + } } void wxDataViewCtrl::SetFocus() @@ -4096,7 +4575,7 @@ void wxDataViewCtrl::OnColumnsCountChanged() if (m_headerArea) m_headerArea->SetColumnCount(GetColumnCount()); - m_clientArea->UpdateDisplay(); + m_clientArea->OnColumnsCountChanged(); } void wxDataViewCtrl::DoSetExpanderColumn() @@ -4114,6 +4593,16 @@ unsigned int wxDataViewCtrl::GetColumnCount() const return m_cols.GetCount(); } +bool wxDataViewCtrl::SetRowHeight( int lineHeight ) +{ + if ( !m_clientArea ) + return false; + + m_clientArea->SetRowHeight(lineHeight); + + return true; +} + wxDataViewColumn* wxDataViewCtrl::GetColumn( unsigned int idx ) const { return m_cols[idx]; @@ -4154,16 +4643,25 @@ unsigned int wxDataViewCtrl::GetBestColumnWidth(int idx) const class MaxWidthCalculator { public: - MaxWidthCalculator(wxDataViewMainWindow *clientArea, + MaxWidthCalculator(const wxDataViewCtrl *dvc, + wxDataViewMainWindow *clientArea, wxDataViewRenderer *renderer, const wxDataViewModel *model, - unsigned column) + unsigned column, + int expanderSize) : m_width(0), + m_dvc(dvc), m_clientArea(clientArea), m_renderer(renderer), m_model(model), - m_column(column) + m_column(column), + m_expanderSize(expanderSize) + { + m_isExpanderCol = + !clientArea->IsList() && + (column == 0 || + GetExpanderColumnOrFirstOne(const_cast(dvc)) == dvc->GetColumnAt(column)); } void UpdateWithWidth(int width) @@ -4173,32 +4671,43 @@ unsigned int wxDataViewCtrl::GetBestColumnWidth(int idx) const void UpdateWithRow(int row) { - wxDataViewItem item = m_clientArea->GetItemByRow(row); + int indent = 0; + wxDataViewItem item; + + if ( m_isExpanderCol ) + { + wxDataViewTreeNode *node = m_clientArea->GetTreeNodeByRow(row); + item = node->GetItem(); + indent = m_dvc->GetIndent() * node->GetIndentLevel() + m_expanderSize; + } + else + { + item = m_clientArea->GetItemByRow(row); + } + m_renderer->PrepareForItem(m_model, item, m_column); - m_width = wxMax(m_width, m_renderer->GetSize().x); + m_width = wxMax(m_width, m_renderer->GetSize().x + indent); } int GetMaxWidth() const { return m_width; } private: int m_width; + const wxDataViewCtrl *m_dvc; wxDataViewMainWindow *m_clientArea; wxDataViewRenderer *m_renderer; const wxDataViewModel *m_model; unsigned m_column; + bool m_isExpanderCol; + int m_expanderSize; }; - MaxWidthCalculator calculator(m_clientArea, renderer, - GetModel(), column->GetModelColumn()); + MaxWidthCalculator calculator(this, m_clientArea, renderer, + GetModel(), column->GetModelColumn(), + m_clientArea->GetRowHeight()); if ( m_headerArea ) - { - int header_width = m_headerArea->GetTextExtent(column->GetTitle()).x; - // Labels on native MSW header are indented on both sides - header_width += - wxRendererNative::Get().GetHeaderButtonMargin(m_headerArea); - calculator.UpdateWithWidth(header_width); - } + calculator.UpdateWithWidth(m_headerArea->GetColumnTitleWidth(*column)); // The code below deserves some explanation. For very large controls, we // simply can't afford to calculate sizes for all items, it takes too @@ -4293,6 +4802,10 @@ bool wxDataViewCtrl::DeleteColumn( wxDataViewColumn *column ) m_colsBestWidths.erase(m_colsBestWidths.begin() + GetColumnIndex(column)); m_cols.Erase(ret); + + if ( m_clientArea->GetCurrentColumn() == column ) + m_clientArea->ClearCurrentColumn(); + OnColumnsCountChanged(); return true; @@ -4300,36 +4813,56 @@ bool wxDataViewCtrl::DeleteColumn( wxDataViewColumn *column ) bool wxDataViewCtrl::ClearColumns() { + SetExpanderColumn(NULL); m_cols.Clear(); m_colsBestWidths.clear(); + + m_clientArea->ClearCurrentColumn(); + OnColumnsCountChanged(); + return true; } void wxDataViewCtrl::InvalidateColBestWidth(int idx) { m_colsBestWidths[idx] = 0; - - if ( m_headerArea ) - m_headerArea->UpdateColumn(idx); + m_colsDirty = true; } void wxDataViewCtrl::InvalidateColBestWidths() { m_colsBestWidths.clear(); m_colsBestWidths.resize(m_cols.size()); + m_colsDirty = true; +} - if ( m_headerArea ) +void wxDataViewCtrl::UpdateColWidths() +{ + if ( !m_headerArea ) + return; + + const unsigned len = m_colsBestWidths.size(); + for ( unsigned i = 0; i < len; i++ ) { - const unsigned cols = m_headerArea->GetColumnCount(); - for ( unsigned i = 0; i < cols; i++ ) + if ( m_colsBestWidths[i] == 0 ) m_headerArea->UpdateColumn(i); } } +void wxDataViewCtrl::OnInternalIdle() +{ + wxDataViewCtrlBase::OnInternalIdle(); + + if ( m_colsDirty ) + { + m_colsDirty = false; + UpdateColWidths(); + } +} + int wxDataViewCtrl::GetColumnPosition( const wxDataViewColumn *column ) const { -#if 1 unsigned int len = GetColumnCount(); for ( unsigned int i = 0; i < len; i++ ) { @@ -4339,25 +4872,6 @@ int wxDataViewCtrl::GetColumnPosition( const wxDataViewColumn *column ) const } return wxNOT_FOUND; -#else - // This returns the position in pixels which is not what we want. - int ret = 0, - dummy = 0; - unsigned int len = GetColumnCount(); - for ( unsigned int i = 0; i < len; i++ ) - { - wxDataViewColumn * col = GetColumnAt(i); - if (col->IsHidden()) - continue; - ret += col->GetWidth(); - if (column==col) - { - CalcScrolledPosition( ret, dummy, &ret, &dummy ); - break; - } - } - return ret; -#endif } wxDataViewColumn *wxDataViewCtrl::GetSortingColumn() const @@ -4384,23 +4898,36 @@ void wxDataViewCtrl::DoSetCurrentItem(const wxDataViewItem& item) } } -// Selection code with wxDataViewItem as parameters -wxDataViewItem wxDataViewCtrl::GetSelection() const +wxDataViewColumn *wxDataViewCtrl::GetCurrentColumn() const { - return m_clientArea->GetSelection(); + return m_clientArea->GetCurrentColumn(); +} + +int wxDataViewCtrl::GetSelectedItemsCount() const +{ + return m_clientArea->GetSelections().size(); } int wxDataViewCtrl::GetSelections( wxDataViewItemArray & sel ) const { sel.Empty(); - wxDataViewSelection selection = m_clientArea->GetSelections(); - int len = selection.GetCount(); - for( int i = 0; i < len; i ++) + const wxDataViewSelection& selections = m_clientArea->GetSelections(); + + const size_t len = selections.size(); + for ( size_t i = 0; i < len; i++ ) { - unsigned int row = selection[i]; - sel.Add( m_clientArea->GetItemByRow( row ) ); + wxDataViewItem item = m_clientArea->GetItemByRow(selections[i]); + if ( item.IsOk() ) + { + sel.Add(item); + } + else + { + wxFAIL_MSG( "invalid item in selection - bad internal state" ); + } } - return len; + + return sel.size(); } void wxDataViewCtrl::SetSelections( const wxDataViewItemArray & sel ) @@ -4464,71 +4991,9 @@ bool wxDataViewCtrl::IsSelected( const wxDataViewItem & item ) const return false; } -// Selection code with row number as parameter -int wxDataViewCtrl::GetSelections( wxArrayInt & sel ) const +void wxDataViewCtrl::SetAlternateRowColour(const wxColour& colour) { - sel.Empty(); - wxDataViewSelection selection = m_clientArea->GetSelections(); - int len = selection.GetCount(); - for( int i = 0; i < len; i ++) - { - unsigned int row = selection[i]; - sel.Add( row ); - } - return len; -} - -void wxDataViewCtrl::SetSelections( const wxArrayInt & sel ) -{ - wxDataViewSelection selection(wxDataViewSelectionCmp); - int len = sel.GetCount(); - for( int i = 0; i < len; i ++ ) - { - int row = sel[i]; - if( row >= 0 ) - selection.Add( static_cast(row) ); - } - m_clientArea->SetSelections( selection ); -} - -void wxDataViewCtrl::Select( int row ) -{ - if( row >= 0 ) - { - if (m_clientArea->IsSingleSel()) - m_clientArea->SelectAllRows(false); - m_clientArea->SelectRow( row, true ); - } -} - -void wxDataViewCtrl::Unselect( int row ) -{ - if( row >= 0 ) - m_clientArea->SelectRow(row, false); -} - -bool wxDataViewCtrl::IsSelected( int row ) const -{ - if( row >= 0 ) - return m_clientArea->IsRowSelected(row); - return false; -} - -void wxDataViewCtrl::SelectRange( int from, int to ) -{ - wxArrayInt sel; - for( int i = from; i < to; i ++ ) - sel.Add( i ); - m_clientArea->Select(sel); -} - -void wxDataViewCtrl::UnselectRange( int from, int to ) -{ - wxDataViewSelection sel = m_clientArea->GetSelections(); - for( int i = from; i < to; i ++ ) - if( sel.Index( i ) != wxNOT_FOUND ) - sel.Remove( i ); - m_clientArea->SetSelections(sel); + m_alternateRowColour = colour; } void wxDataViewCtrl::SelectAll() @@ -4621,16 +5086,12 @@ bool wxDataViewCtrl::IsExpanded( const wxDataViewItem & item ) const return false; } -void wxDataViewCtrl::StartEditor( const wxDataViewItem & item, unsigned int column ) +void wxDataViewCtrl::EditItem(const wxDataViewItem& item, const wxDataViewColumn *column) { - wxDataViewColumn* col = GetColumn( column ); - if (!col) - return; + wxCHECK_RET( item.IsOk(), "invalid item" ); + wxCHECK_RET( column, "no column provided" ); - wxRect itemRect = GetItemRect(item, col); - wxDataViewRenderer* renderer = col->GetRenderer(); - if (renderer->GetMode() == wxDATAVIEW_CELL_EDITABLE) - renderer->StartEditing(item, itemRect); + m_clientArea->StartEditing(item, column); } #endif // !wxUSE_GENERICDATAVIEWCTRL diff --git a/Externals/wxWidgets3/src/generic/datectlg.cpp b/Externals/wxWidgets3/src/generic/datectlg.cpp index 7e3a760573..a1b3e0a13d 100644 --- a/Externals/wxWidgets3/src/generic/datectlg.cpp +++ b/Externals/wxWidgets3/src/generic/datectlg.cpp @@ -4,7 +4,7 @@ // Author: Andreas Pflug // Modified by: // Created: 2005-01-19 -// RCS-ID: $Id: datectlg.cpp 66771 2011-01-26 15:52:41Z SC $ +// RCS-ID: $Id: datectlg.cpp 68910 2011-08-27 12:13:18Z VZ $ // Copyright: (c) 2005 Andreas Pflug // Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// @@ -209,11 +209,15 @@ private: // functions honours wxDP_SHOWCENTURY flag. wxString GetLocaleDateFormat() const { +#if wxUSE_INTL wxString fmt = wxLocale::GetInfo(wxLOCALE_SHORT_DATE_FMT); if ( HasDPFlag(wxDP_SHOWCENTURY) ) fmt.Replace("%y", "%Y"); return fmt; +#else // !wxUSE_INTL + return wxT("x"); +#endif // wxUSE_INTL/!wxUSE_INTL } bool SetFormat(const wxString& fmt) @@ -381,10 +385,8 @@ wxSize wxDatePickerCtrlGeneric::DoGetBestSize() const wxWindowList wxDatePickerCtrlGeneric::GetCompositeWindowParts() const { wxWindowList parts; - if (m_combo) - parts.push_back(m_combo); - if (m_popup) - parts.push_back(m_popup); + parts.push_back(m_combo); + parts.push_back(m_popup); return parts; } diff --git a/Externals/wxWidgets3/src/generic/dbgrptg.cpp b/Externals/wxWidgets3/src/generic/dbgrptg.cpp index efbe4d8b6a..6cc1f4bc35 100644 --- a/Externals/wxWidgets3/src/generic/dbgrptg.cpp +++ b/Externals/wxWidgets3/src/generic/dbgrptg.cpp @@ -4,7 +4,7 @@ // Author: Vadim Zeitlin, Andrej Putrin // Modified by: // Created: 2005-01-21 -// RCS-ID: $Id: dbgrptg.cpp 64940 2010-07-13 13:29:13Z VZ $ +// RCS-ID: $Id: dbgrptg.cpp 69828 2011-11-27 19:49:43Z VZ $ // Copyright: (c) 2005 Vadim Zeitlin // Licence: wxWindows licence /////////////////////////////////////////////////////////////////////////////// @@ -228,7 +228,7 @@ void wxDumpOpenExternalDlg::OnBrowse(wxCommandEvent& ) fname.GetPathWithSep(), fname.GetFullName() #ifdef __WXMSW__ - , _("Executable files (*.exe)|*.exe|All files (*.*)|*.*||") + , _("Executable files (*.exe)|*.exe|") + wxALL_FILES #endif // __WXMSW__ ); if ( dlg.ShowModal() == wxID_OK ) diff --git a/Externals/wxWidgets3/src/generic/dcpsg.cpp b/Externals/wxWidgets3/src/generic/dcpsg.cpp index 5eabe59d83..09980ebf5f 100644 --- a/Externals/wxWidgets3/src/generic/dcpsg.cpp +++ b/Externals/wxWidgets3/src/generic/dcpsg.cpp @@ -4,7 +4,7 @@ // Author: Julian Smart, Robert Roebling, Markus Holzhem // Modified by: // Created: 04/01/98 -// RCS-ID: $Id: dcpsg.cpp 65820 2010-10-15 23:46:46Z VZ $ +// RCS-ID: $Id: dcpsg.cpp 69243 2011-09-30 15:26:36Z VZ $ // Copyright: (c) Julian Smart // Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// @@ -509,13 +509,10 @@ void wxPostScriptDCImpl::DoDrawArc (wxCoord x1, wxCoord y1, wxCoord x2, wxCoord wxString buffer; buffer.Printf( "newpath\n" "%f %f %f %f %f %f ellipse\n" - "%f %f lineto\n" - "closepath\n" "stroke\n", XLOG2DEV(xc), YLOG2DEV(yc), XLOG2DEVREL(i_radius), YLOG2DEVREL(i_radius), - alpha1, alpha2, - XLOG2DEV(xc), YLOG2DEV(yc) ); + alpha1, alpha2 ); buffer.Replace( ",", "." ); PsPrint( buffer ); @@ -971,11 +968,11 @@ void wxPostScriptDCImpl::DoDrawBitmap( const wxBitmap& bitmap, wxCoord x, wxCoor { wxCHECK_RET( m_ok, wxT("invalid postscript dc") ); - if (!bitmap.Ok()) return; + if (!bitmap.IsOk()) return; wxImage image = bitmap.ConvertToImage(); - if (!image.Ok()) return; + if (!image.IsOk()) return; wxCoord w = image.GetWidth(); wxCoord h = image.GetHeight(); @@ -1041,7 +1038,7 @@ void wxPostScriptDCImpl::SetFont( const wxFont& font ) { wxCHECK_RET( m_ok, wxT("invalid postscript dc") ); - if (!font.Ok()) return; + if (!font.IsOk()) return; m_font = font; @@ -1136,9 +1133,9 @@ void wxPostScriptDCImpl::SetPen( const wxPen& pen ) { wxCHECK_RET( m_ok, wxT("invalid postscript dc") ); - if (!pen.Ok()) return; + if (!pen.IsOk()) return; - int oldStyle = m_pen.GetStyle(); + int oldStyle = m_pen.IsOk() ? m_pen.GetStyle() : wxPENSTYLE_INVALID; m_pen = pen; @@ -1243,7 +1240,7 @@ void wxPostScriptDCImpl::SetBrush( const wxBrush& brush ) { wxCHECK_RET( m_ok, wxT("invalid postscript dc") ); - if (!brush.Ok()) return; + if (!brush.IsOk()) return; m_brush = brush; @@ -1291,7 +1288,7 @@ void wxPostScriptDCImpl::DoDrawText( const wxString& text, wxCoord x, wxCoord y if ( !textbuf ) return; - if (m_textForegroundColour.Ok()) + if (m_textForegroundColour.IsOk()) { unsigned char red = m_textForegroundColour.Red(); unsigned char blue = m_textForegroundColour.Blue(); @@ -1401,7 +1398,7 @@ void wxPostScriptDCImpl::DoDrawRotatedText( const wxString& text, wxCoord x, wxC SetFont( m_font ); - if (m_textForegroundColour.Ok()) + if (m_textForegroundColour.IsOk()) { unsigned char red = m_textForegroundColour.Red(); unsigned char blue = m_textForegroundColour.Blue(); @@ -1960,7 +1957,7 @@ bool wxPostScriptDCImpl::DoBlit( wxCoord xdest, wxCoord ydest, wxCoord wxPostScriptDCImpl::GetCharHeight() const { - if (m_font.Ok()) + if (m_font.IsOk()) return m_font.GetPointSize(); else return 12; @@ -2058,7 +2055,7 @@ void wxPostScriptDCImpl::DoGetTextExtent(const wxString& string, / example: / / wxPostScriptDC dc(NULL, true); - / if (dc.Ok()){ + / if (dc.IsOk()){ / wxSetAFMPath("d:\\wxw161\\afm\\"); / dc.StartDoc("Test"); / dc.StartPage(); diff --git a/Externals/wxWidgets3/src/generic/descrip.mms b/Externals/wxWidgets3/src/generic/descrip.mms index b8365be853..558e6636dd 100644 --- a/Externals/wxWidgets3/src/generic/descrip.mms +++ b/Externals/wxWidgets3/src/generic/descrip.mms @@ -2,7 +2,7 @@ # * # Make file for VMS * # Author : J.Jansen (joukj@hrem.nano.tudelft.nl) * -# Date : 21 March 2011 * +# Date : 3 January 2012 * # * #***************************************************************************** .first @@ -70,7 +70,6 @@ OBJECTS = \ msgdlgg.obj,\ numdlgg.obj,\ odcombo.obj,\ - panelg.obj,\ printps.obj,\ prntdlgg.obj,\ propdlg.obj,\ @@ -95,7 +94,8 @@ OBJECTS = \ grideditors.obj,vlbox.obj,vscroll.obj,stattextg.obj,\ editlbox.obj,datavgen.obj,dbgrptg.obj,dragimgg.obj,\ richmsgdlgg.obj,commandlinkbuttong.obj,spinctlg.obj,\ - markuptext.obj + markuptext.obj,bannerwindow.obj,timectrlg.obj,richtooltipg.obj\ + ,statbmpg.obj SOURCES = \ aboutdlgg.cpp,\ @@ -132,7 +132,6 @@ SOURCES = \ numdlgg.cpp,\ odcombo.cpp,\ paletteg.cpp,\ - panelg.cpp,\ printps.cpp,\ prntdlgg.cpp,\ propdlg.cpp,\ @@ -167,7 +166,8 @@ SOURCES = \ icon.cpp,bmpcboxg.cpp,filectrlg.cpp,srchctlg.cpp,notifmsgg.cpp\ ,headerctrlg.cpp,grideditors.cpp,stattextg.cpp,editlbox.cpp,\ datavgen.cpp,dbgrptg.cpp,dragimgg.cpp,richmsgdlgg.cpp,\ - commandlinkbuttong.cpp,spinctlg.cpp markuptext.cpp + commandlinkbuttong.cpp,spinctlg.cpp markuptext.cpp \ + bannerwindow.cpp timectrlg.cpp richtooltipg.cpp statbmpg.cpp .ifdef __WXMOTIF__ OBJECTS0=statusbr.obj,statline.obj,notebook.obj,spinctlg.obj,collpaneg.obj,\ @@ -243,13 +243,13 @@ icon.obj : icon.cpp imaglist.obj : imaglist.cpp laywin.obj : laywin.cpp listctrl.obj : listctrl.cpp + cxx $(CXXFLAGS)$(CXX_DEFINE)/warn=disable=(INTTRUNCATED) listctrl.cpp logg.obj : logg.cpp msgdlgg.obj : msgdlgg.cpp notebook.obj : notebook.cpp numdlgg.obj : numdlgg.cpp odcombo.obj : odcombo.cpp paletteg.obj : paletteg.cpp -panelg.obj : panelg.cpp printps.obj : printps.cpp prntdlgg.obj : prntdlgg.cpp progdlgg.obj : progdlgg.cpp @@ -304,3 +304,7 @@ richmsgdlgg.obj : richmsgdlgg.cpp commandlinkbuttong.obj : commandlinkbuttong.cpp spinctlg.obj : spinctlg.cpp markuptext.obj : markuptext.cpp +bannerwindow.obj : bannerwindow.cpp +timectrlg.obj : timectrlg.cpp +richtooltipg.obj : richtooltipg.cpp +statbmpg.obj : statbmpg.cpp diff --git a/Externals/wxWidgets3/src/generic/dirctrlg.cpp b/Externals/wxWidgets3/src/generic/dirctrlg.cpp index 77ef878caf..358e0cea3c 100644 --- a/Externals/wxWidgets3/src/generic/dirctrlg.cpp +++ b/Externals/wxWidgets3/src/generic/dirctrlg.cpp @@ -4,7 +4,7 @@ // Author: Harm van der Heijden, Robert Roebling, Julian Smart // Modified by: // Created: 12/12/98 -// RCS-ID: $Id: dirctrlg.cpp 67206 2011-03-16 06:36:43Z SC $ +// RCS-ID: $Id: dirctrlg.cpp 70808 2012-03-04 20:31:42Z VZ $ // Copyright: (c) Harm van der Heijden, Robert Roebling and Julian Smart // Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// @@ -55,7 +55,7 @@ #include "wx/osx/private.h" // includes mac headers #endif -#ifdef __WXMSW__ +#ifdef __WINDOWS__ #include #include "wx/msw/winundef.h" #include "wx/volume.h" @@ -71,7 +71,7 @@ #include #endif -#endif +#endif // __WINDOWS__ #if defined(__OS2__) || defined(__DOS__) #ifdef __OS2__ @@ -250,7 +250,7 @@ size_t wxGetAvailableDrives(wxArrayString &paths, wxArrayString &names, wxArrayI } } -#elif defined(__UNIX__) || defined(__WXPALMOS__) +#elif defined(__UNIX__) paths.Add(wxT("/")); names.Add(wxT("/")); icon_ids.Add(wxFileIconsTable::computer); @@ -270,7 +270,7 @@ size_t wxGetAvailableDrives(wxArrayString &paths, wxArrayString &names, wxArrayI bool wxIsDriveAvailable(const wxString& dirName) { - // FIXME_MGL - this method leads to hang up under Watcom for some reason + // FIXME: this method leads to hang up under Watcom for some reason #ifdef __WATCOMC__ wxUnusedVar(dirName); #else @@ -310,7 +310,7 @@ int setdrive(int WXUNUSED_IN_WINCE(drive)) #else newdrive[2] = wxT('\0'); #endif -#if defined(__WXMSW__) +#if defined(__WINDOWS__) if (::SetCurrentDirectory(newdrive)) #else // VA doesn't know what LPSTR is and has its own set @@ -1170,7 +1170,7 @@ void wxGenericDirCtrl::FindChildFiles(wxTreeItemId treeid, int dirFlags, wxArray wxString dirName(data->m_path); -#if defined(__WXMSW__) || defined(__OS2__) +#if defined(__WINDOWS__) || defined(__OS2__) if (dirName.Last() == ':') dirName += wxString(wxFILE_SEP_PATH); #endif @@ -1572,7 +1572,7 @@ wxImageList *wxFileIconsTable::GetSmallImageList() return m_smallImageList; } -#if wxUSE_MIMETYPE && wxUSE_IMAGE && (!defined(__WXMSW__) || wxUSE_WXDIB) +#if wxUSE_MIMETYPE && wxUSE_IMAGE && (!defined(__WINDOWS__) || wxUSE_WXDIB) // VS: we don't need this function w/o wxMimeTypesManager because we'll only have // one icon and we won't resize it @@ -1708,7 +1708,7 @@ int wxFileIconsTable::GetIconID(const wxString& extension, const wxString& mime) delete ft; - if ( !ic.Ok() ) + if ( !ic.IsOk() ) { int newid = file; m_HashTable->Put(extension, new wxFileIconEntry(newid)); @@ -1718,7 +1718,7 @@ int wxFileIconsTable::GetIconID(const wxString& extension, const wxString& mime) wxBitmap bmp; bmp.CopyFromIcon(ic); - if ( !bmp.Ok() ) + if ( !bmp.IsOk() ) { int newid = file; m_HashTable->Put(extension, new wxFileIconEntry(newid)); @@ -1732,7 +1732,7 @@ int wxFileIconsTable::GetIconID(const wxString& extension, const wxString& mime) { m_smallImageList->Add(bmp); } -#if wxUSE_IMAGE && (!defined(__WXMSW__) || wxUSE_WXDIB) +#if wxUSE_IMAGE && (!defined(__WINDOWS__) || wxUSE_WXDIB) else { wxImage img = bmp.ConvertToImage(); diff --git a/Externals/wxWidgets3/src/generic/dirdlgg.cpp b/Externals/wxWidgets3/src/generic/dirdlgg.cpp index 21f85928ef..8d25c0f04c 100644 --- a/Externals/wxWidgets3/src/generic/dirdlgg.cpp +++ b/Externals/wxWidgets3/src/generic/dirdlgg.cpp @@ -4,7 +4,7 @@ // Author: Harm van der Heijden, Robert Roebling & Julian Smart // Modified by: // Created: 12/12/98 -// RCS-ID: $Id: dirdlgg.cpp 67254 2011-03-20 00:14:35Z DS $ +// RCS-ID: $Id: dirdlgg.cpp 67384 2011-04-03 20:31:32Z DS $ // Copyright: (c) Harm van der Heijden, Robert Roebling, Julian Smart // Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// @@ -166,7 +166,7 @@ bool wxGenericDirDialog::Create(wxWindow* parent, topsizer->Add(m_dirCtrl, wxSizerFlags(flagsBorder2).Proportion(1).Expand()); #ifndef __SMARTPHONE__ - // Make the an option depending on a flag? + // TODO: Make this an option depending on a flag? wxCheckBox * check = new wxCheckBox(this, ID_SHOW_HIDDEN, _("Show &hidden directories")); topsizer->Add(check, wxSizerFlags(flagsBorder2).Right()); diff --git a/Externals/wxWidgets3/src/generic/dragimgg.cpp b/Externals/wxWidgets3/src/generic/dragimgg.cpp index 1e84178dce..421926207c 100644 --- a/Externals/wxWidgets3/src/generic/dragimgg.cpp +++ b/Externals/wxWidgets3/src/generic/dragimgg.cpp @@ -4,7 +4,7 @@ // Author: Julian Smart // Modified by: // Created: 29/2/2000 -// RCS-ID: $Id: dragimgg.cpp 64656 2010-06-20 18:18:23Z VZ $ +// RCS-ID: $Id: dragimgg.cpp 70749 2012-02-29 13:58:55Z VZ $ // Copyright: (c) Julian Smart // Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// @@ -247,9 +247,9 @@ bool wxGenericDragImage::BeginDrag(const wxPoint& hotspot, m_boundingRect = * rect; m_isDirty = false; - m_isDirty = false; + m_isShown = false; - if (m_cursor.Ok()) + if (m_cursor.IsOk()) { m_oldCursor = window->GetCursor(); window->SetCursor(m_cursor); @@ -288,7 +288,7 @@ bool wxGenericDragImage::BeginDrag(const wxPoint& hotspot, #ifndef wxHAS_NATIVE_OVERLAY wxBitmap* backing = (m_pBackingBitmap ? m_pBackingBitmap : (wxBitmap*) & m_backingBitmap); - if (!backing->Ok() || (backing->GetWidth() < clientSize.x || backing->GetHeight() < clientSize.y)) + if (!backing->IsOk() || (backing->GetWidth() < clientSize.x || backing->GetHeight() < clientSize.y)) (*backing) = wxBitmap(clientSize.x, clientSize.y); #endif // !wxHAS_NATIVE_OVERLAY @@ -345,7 +345,7 @@ bool wxGenericDragImage::EndDrag() #endif m_window->ReleaseMouse(); - if (m_cursor.Ok() && m_oldCursor.Ok()) + if (m_cursor.IsOk() && m_oldCursor.IsOk()) { m_window->SetCursor(m_oldCursor); } @@ -467,7 +467,7 @@ bool wxGenericDragImage::RedrawImage(const wxPoint& oldPos, DoDrawImage(*m_windowDC, newPos); #else // !wxHAS_NATIVE_OVERLAY wxBitmap* backing = (m_pBackingBitmap ? m_pBackingBitmap : (wxBitmap*) & m_backingBitmap); - if (!backing->Ok()) + if (!backing->IsOk()) return false; wxRect oldRect(GetImageRect(oldPos)); @@ -499,7 +499,7 @@ bool wxGenericDragImage::RedrawImage(const wxPoint& oldPos, // keep reallocating all the time. int excess = 50; - if (!m_repairBitmap.Ok() || (m_repairBitmap.GetWidth() < fullRect.GetWidth() || m_repairBitmap.GetHeight() < fullRect.GetHeight())) + if (!m_repairBitmap.IsOk() || (m_repairBitmap.GetWidth() < fullRect.GetWidth() || m_repairBitmap.GetHeight() < fullRect.GetHeight())) { m_repairBitmap = wxBitmap(fullRect.GetWidth() + excess, fullRect.GetHeight() + excess); } @@ -539,12 +539,12 @@ bool wxGenericDragImage::RedrawImage(const wxPoint& oldPos, // Override this if you are using a virtual image (drawing your own image) bool wxGenericDragImage::DoDrawImage(wxDC& dc, const wxPoint& pos) const { - if (m_bitmap.Ok()) + if (m_bitmap.IsOk()) { dc.DrawBitmap(m_bitmap, pos.x, pos.y, (m_bitmap.GetMask() != 0)); return true; } - else if (m_icon.Ok()) + else if (m_icon.IsOk()) { dc.DrawIcon(m_icon, pos.x, pos.y); return true; @@ -556,11 +556,11 @@ bool wxGenericDragImage::DoDrawImage(wxDC& dc, const wxPoint& pos) const // Override this if you are using a virtual image (drawing your own image) wxRect wxGenericDragImage::GetImageRect(const wxPoint& pos) const { - if (m_bitmap.Ok()) + if (m_bitmap.IsOk()) { return wxRect(pos.x, pos.y, m_bitmap.GetWidth(), m_bitmap.GetHeight()); } - else if (m_icon.Ok()) + else if (m_icon.IsOk()) { return wxRect(pos.x, pos.y, m_icon.GetWidth(), m_icon.GetHeight()); } diff --git a/Externals/wxWidgets3/src/generic/filectrlg.cpp b/Externals/wxWidgets3/src/generic/filectrlg.cpp index e33397496b..67f713baf8 100644 --- a/Externals/wxWidgets3/src/generic/filectrlg.cpp +++ b/Externals/wxWidgets3/src/generic/filectrlg.cpp @@ -3,7 +3,7 @@ // Purpose: wxGenericFileCtrl Implementation // Author: Diaa M. Sami // Created: 2007-07-07 -// RCS-ID: $Id: filectrlg.cpp 67214 2011-03-16 07:22:56Z SC $ +// RCS-ID: $Id: filectrlg.cpp 70808 2012-03-04 20:31:42Z VZ $ // Copyright: (c) Diaa M. Sami // Licence: wxWindows licence /////////////////////////////////////////////////////////////////////////////// @@ -35,7 +35,7 @@ #include "wx/tokenzr.h" #include "wx/imaglist.h" -#ifdef __WXMSW__ +#ifdef __WINDOWS__ #include "wx/msw/wrapwin.h" #endif @@ -53,7 +53,7 @@ // ---------------------------------------------------------------------------- static -int wxCALLBACK wxFileDataNameCompare( long data1, long data2, wxIntPtr sortOrder) +int wxCALLBACK wxFileDataNameCompare( wxIntPtr data1, wxIntPtr data2, wxIntPtr sortOrder) { wxFileData *fd1 = (wxFileData *)wxUIntToPtr(data1); wxFileData *fd2 = (wxFileData *)wxUIntToPtr(data2); @@ -71,7 +71,7 @@ int wxCALLBACK wxFileDataNameCompare( long data1, long data2, wxIntPtr sortOrder } static -int wxCALLBACK wxFileDataSizeCompare(long data1, long data2, wxIntPtr sortOrder) +int wxCALLBACK wxFileDataSizeCompare(wxIntPtr data1, wxIntPtr data2, wxIntPtr sortOrder) { wxFileData *fd1 = (wxFileData *)wxUIntToPtr(data1); wxFileData *fd2 = (wxFileData *)wxUIntToPtr(data2); @@ -93,7 +93,7 @@ int wxCALLBACK wxFileDataSizeCompare(long data1, long data2, wxIntPtr sortOrder) } static -int wxCALLBACK wxFileDataTypeCompare(long data1, long data2, wxIntPtr sortOrder) +int wxCALLBACK wxFileDataTypeCompare(wxIntPtr data1, wxIntPtr data2, wxIntPtr sortOrder) { wxFileData *fd1 = (wxFileData *)wxUIntToPtr(data1); wxFileData *fd2 = (wxFileData *)wxUIntToPtr(data2); @@ -115,7 +115,7 @@ int wxCALLBACK wxFileDataTypeCompare(long data1, long data2, wxIntPtr sortOrder) } static -int wxCALLBACK wxFileDataTimeCompare(long data1, long data2, wxIntPtr sortOrder) +int wxCALLBACK wxFileDataTimeCompare(wxIntPtr data1, wxIntPtr data2, wxIntPtr sortOrder) { wxFileData *fd1 = (wxFileData *)wxUIntToPtr(data1); wxFileData *fd2 = (wxFileData *)wxUIntToPtr(data2); @@ -377,7 +377,7 @@ void wxFileData::MakeItem( wxListItem &item ) if (IsLink()) { wxColour dg = wxTheColourDatabase->Find( wxT("MEDIUM GREY") ); - if ( dg.Ok() ) + if ( dg.IsOk() ) item.SetTextColour(dg); } item.m_data = wxPtrToUInt(this); diff --git a/Externals/wxWidgets3/src/generic/filedlgg.cpp b/Externals/wxWidgets3/src/generic/filedlgg.cpp index c4d34a9c5f..390abba9a7 100644 --- a/Externals/wxWidgets3/src/generic/filedlgg.cpp +++ b/Externals/wxWidgets3/src/generic/filedlgg.cpp @@ -4,7 +4,7 @@ // Author: Robert Roebling // Modified by: // Created: 12/12/98 -// RCS-ID: $Id: filedlgg.cpp 64019 2010-04-18 00:05:37Z VZ $ +// RCS-ID: $Id: filedlgg.cpp 70345 2012-01-15 01:05:28Z VZ $ // Copyright: (c) Robert Roebling // Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// @@ -19,7 +19,7 @@ #if wxUSE_FILEDLG // NOTE : it probably also supports MAC, untested -#if !defined(__UNIX__) && !defined(__DOS__) && !defined(__WIN32__) && !defined(__OS2__) && !defined(__PALMOS__) +#if !defined(__UNIX__) && !defined(__DOS__) && !defined(__WIN32__) && !defined(__OS2__) #error wxGenericFileDialog currently only supports Unix, win32 and DOS #endif @@ -57,7 +57,6 @@ #include "wx/config.h" #endif -#ifndef __WXPALMOS5__ #ifndef __WXWINCE__ #include #include @@ -86,7 +85,6 @@ #if defined(__UNIX__) || defined(__DOS__) #include #endif -#endif // ! __WXPALMOS5__ #if defined(__WXWINCE__) #define IsTopMostDir(dir) (dir == wxT("\\") || dir == wxT("/")) diff --git a/Externals/wxWidgets3/src/generic/filepickerg.cpp b/Externals/wxWidgets3/src/generic/filepickerg.cpp index 52e1c56b67..98c7935a7a 100644 --- a/Externals/wxWidgets3/src/generic/filepickerg.cpp +++ b/Externals/wxWidgets3/src/generic/filepickerg.cpp @@ -4,7 +4,7 @@ // Author: Francesco Montorsi // Modified by: // Created: 15/04/2006 -// RCS-ID: $Id: filepickerg.cpp 63654 2010-03-08 19:37:08Z VZ $ +// RCS-ID: $Id: filepickerg.cpp 70732 2012-02-28 02:05:01Z VZ $ // Copyright: (c) Francesco Montorsi // Licence: wxWindows licence /////////////////////////////////////////////////////////////////////////////// @@ -26,8 +26,11 @@ #if wxUSE_FILEPICKERCTRL || wxUSE_DIRPICKERCTRL +#include "wx/filename.h" #include "wx/filepicker.h" +#include "wx/scopedptr.h" + // ============================================================================ // implementation @@ -54,8 +57,24 @@ bool wxGenericFileDirButton::Create(wxWindow *parent, { m_pickerStyle = style; + // If the special wxPB_SMALL flag is used, ignore the provided label and + // use the shortest possible label and the smallest possible button fitting + // it. + long styleButton = 0; + wxString labelButton; + if ( m_pickerStyle & wxPB_SMALL ) + { + labelButton = _("..."); + styleButton = wxBU_EXACTFIT; + } + else + { + labelButton = label; + } + // create this button - if ( !wxButton::Create(parent, id, label, pos, size, 0, validator, name) ) + if ( !wxButton::Create(parent, id, labelButton, + pos, size, styleButton, validator, name) ) { wxFAIL_MSG( wxT("wxGenericFileButton creation failed") ); return false; @@ -76,18 +95,80 @@ bool wxGenericFileDirButton::Create(wxWindow *parent, void wxGenericFileDirButton::OnButtonClick(wxCommandEvent& WXUNUSED(ev)) { - wxDialog *p = CreateDialog(); + wxScopedPtr p(CreateDialog()); if (p->ShowModal() == wxID_OK) { // save updated path in m_path - UpdatePathFromDialog(p); + UpdatePathFromDialog(p.get()); // fire an event wxFileDirPickerEvent event(GetEventType(), this, GetId(), m_path); GetEventHandler()->ProcessEvent(event); } +} - wxDELETE(p); +void wxGenericFileDirButton::SetInitialDirectory(const wxString& dir) +{ + m_initialDir = dir; +} + +// ---------------------------------------------------------------------------- +// wxGenericFileutton +// ---------------------------------------------------------------------------- + +void +wxGenericFileButton::DoSetInitialDirectory(wxFileDialog* dialog, + const wxString& dir) +{ + if ( m_path.find_first_of(wxFileName::GetPathSeparators()) == + wxString::npos ) + { + dialog->SetDirectory(dir); + } +} + +wxDialog *wxGenericFileButton::CreateDialog() +{ + wxFileDialog* const dialog = new wxFileDialog + ( + GetDialogParent(), + m_message, + wxEmptyString, + wxEmptyString, + m_wildcard, + GetDialogStyle() + ); + + // If there is no default file or if it doesn't have any path, use the + // explicitly set initial directory. + // + // Notice that it is important to call this before SetPath() below as if we + // do have m_initialDir and no directory in m_path, we need to interpret + // the path as being relative with respect to m_initialDir. + if ( !m_initialDir.empty() ) + DoSetInitialDirectory(dialog, m_initialDir); + + // This sets both the default file name and the default directory of the + // dialog if m_path contains directory part. + dialog->SetPath(m_path); + + return dialog; +} + +// ---------------------------------------------------------------------------- +// wxGenericDirButton +// ---------------------------------------------------------------------------- + +wxDialog *wxGenericDirButton::CreateDialog() +{ + wxDirDialog* const dialog = new wxDirDialog + ( + GetDialogParent(), + m_message, + m_path.empty() ? m_initialDir : m_path, + GetDialogStyle() + ); + return dialog; } #endif // wxUSE_FILEPICKERCTRL || wxUSE_DIRPICKERCTRL diff --git a/Externals/wxWidgets3/src/generic/fontdlgg.cpp b/Externals/wxWidgets3/src/generic/fontdlgg.cpp index 77f2b66217..391f5d57b9 100644 --- a/Externals/wxWidgets3/src/generic/fontdlgg.cpp +++ b/Externals/wxWidgets3/src/generic/fontdlgg.cpp @@ -4,7 +4,7 @@ // Author: Julian Smart // Modified by: // Created: 04/01/98 -// RCS-ID: $Id: fontdlgg.cpp 66728 2011-01-22 14:38:36Z DS $ +// RCS-ID: $Id: fontdlgg.cpp 67681 2011-05-03 16:29:04Z DS $ // Copyright: (c) Julian Smart // Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// @@ -76,7 +76,7 @@ void wxFontPreviewer::OnPaint(wxPaintEvent& WXUNUSED(event)) dc.SetBrush(*wxWHITE_BRUSH); dc.DrawRectangle(0, 0, size.x, size.y); - if ( font.Ok() ) + if ( font.IsOk() ) { dc.SetFont(font); dc.SetTextForeground(GetForegroundColour()); @@ -550,7 +550,7 @@ void wxGenericFontDialog::InitializeFont() int fontSize = 12; bool fontUnderline = false; - if (m_fontData.m_initialFont.Ok()) + if (m_fontData.m_initialFont.IsOk()) { fontFamily = m_fontData.m_initialFont.GetFamily(); fontWeight = m_fontData.m_initialFont.GetWeight(); @@ -602,7 +602,7 @@ void wxGenericFontDialog::DoChangeFont() if ( !m_colourChoice->GetStringSelection().empty() ) { wxColour col = wxTheColourDatabase->Find(m_colourChoice->GetStringSelection()); - if (col.Ok()) + if (col.IsOk()) { m_fontData.m_fontColour = col; } @@ -610,7 +610,7 @@ void wxGenericFontDialog::DoChangeFont() } // Update color here so that we can also use the color originally passed in // (EnableEffects may be false) - if (m_fontData.m_fontColour.Ok()) + if (m_fontData.m_fontColour.IsOk()) m_previewer->SetForegroundColour(m_fontData.m_fontColour); m_previewer->Refresh(); diff --git a/Externals/wxWidgets3/src/generic/fontpickerg.cpp b/Externals/wxWidgets3/src/generic/fontpickerg.cpp index a1a61c0062..3d3b13ed6a 100644 --- a/Externals/wxWidgets3/src/generic/fontpickerg.cpp +++ b/Externals/wxWidgets3/src/generic/fontpickerg.cpp @@ -4,7 +4,7 @@ // Author: Francesco Montorsi // Modified by: // Created: 15/04/2006 -// RCS-ID: $Id: fontpickerg.cpp 67280 2011-03-22 14:17:38Z DS $ +// RCS-ID: $Id: fontpickerg.cpp 67681 2011-05-03 16:29:04Z DS $ // Copyright: (c) Francesco Montorsi // Licence: wxWindows licence /////////////////////////////////////////////////////////////////////////////// @@ -97,7 +97,7 @@ void wxGenericFontButton::OnButtonClick(wxCommandEvent& WXUNUSED(ev)) void wxGenericFontButton::UpdateFont() { - if ( !m_selectedFont.Ok() ) + if ( !m_selectedFont.IsOk() ) return; SetForegroundColour(m_data.GetColour()); diff --git a/Externals/wxWidgets3/src/generic/graphicc.cpp b/Externals/wxWidgets3/src/generic/graphicc.cpp index 44e8ac6abf..68588879ae 100644 --- a/Externals/wxWidgets3/src/generic/graphicc.cpp +++ b/Externals/wxWidgets3/src/generic/graphicc.cpp @@ -4,7 +4,7 @@ // Author: Stefan Csomor // Modified by: // Created: 2006-10-03 -// RCS-ID: $Id: graphicc.cpp 66615 2011-01-07 05:26:57Z PC $ +// RCS-ID: $Id: graphicc.cpp 70477 2012-01-29 08:35:45Z PC $ // Copyright: (c) 2006 Stefan Csomor // Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// @@ -21,6 +21,10 @@ #if wxUSE_CAIRO +// keep cairo.h from defining dllimport as we're defining the symbols inside +// the wx dll in order to load them dynamically. +#define cairo_public + #include "wx/cairo.h" #ifndef WX_PRECOMP @@ -278,16 +282,24 @@ class wxCairoFontData : public wxGraphicsObjectRefData { public: wxCairoFontData( wxGraphicsRenderer* renderer, const wxFont &font, const wxColour& col ); + wxCairoFontData(wxGraphicsRenderer* renderer, + double sizeInPixels, + const wxString& facename, + int flags, + const wxColour& col); ~wxCairoFontData(); - virtual void Apply( wxGraphicsContext* context ); + virtual bool Apply( wxGraphicsContext* context ); #ifdef __WXGTK__ - const PangoFontDescription* GetFont() const { return m_font; } - bool GetUnderlined() const { return m_underlined; } + const wxFont& GetFont() const { return m_wxfont; } #endif private : + void InitColour(const wxColour& col); + void InitFontComponents(const wxString& facename, + cairo_font_slant_t slant, + cairo_font_weight_t weight); + double m_size; - bool m_underlined; double m_red; double m_green; double m_blue; @@ -295,28 +307,53 @@ private : #ifdef __WXMAC__ cairo_font_face_t *m_font; #elif defined(__WXGTK__) - PangoFontDescription* m_font; -#else + wxFont m_wxfont; +#endif + + // These members are used when the font is created from its face name and + // flags (and not from wxFont) and also even when creating it from wxFont + // on the platforms not covered above. + // + // Notice that we can't use cairo_font_face_t instead of storing those, + // even though it would be simpler and need less #ifdefs, because + // cairo_toy_font_face_create() that we'd need to create it is only + // available in Cairo 1.8 and we require just 1.2 currently. If we do drop + // support for < 1.8 versions in the future it would be definitely better + // to use cairo_toy_font_face_create() instead. wxCharBuffer m_fontName; cairo_font_slant_t m_slant; cairo_font_weight_t m_weight; -#endif -#ifdef __WXMSW__ - wxCairoContext( wxGraphicsRenderer* renderer, HDC context ); -#endif }; class wxCairoBitmapData : public wxGraphicsObjectRefData { public: wxCairoBitmapData( wxGraphicsRenderer* renderer, const wxBitmap& bmp ); +#if wxUSE_IMAGE + wxCairoBitmapData(wxGraphicsRenderer* renderer, const wxImage& image); +#endif // wxUSE_IMAGE wxCairoBitmapData( wxGraphicsRenderer* renderer, cairo_surface_t* bitmap ); ~wxCairoBitmapData(); virtual cairo_surface_t* GetCairoSurface() { return m_surface; } virtual cairo_pattern_t* GetCairoPattern() { return m_pattern; } virtual wxSize GetSize() { return wxSize(m_width, m_height); } + +#if wxUSE_IMAGE + wxImage ConvertToImage() const; +#endif // wxUSE_IMAGE + private : + // Allocate m_buffer for the bitmap of the given size in the given format. + // + // Returns the stride used for the buffer. + int InitBuffer(int width, int height, cairo_format_t format); + + // Really create the surface using the buffer (which was supposed to be + // filled since InitBuffer() call). + void InitSurface(cairo_format_t format, int stride); + + cairo_surface_t* m_surface; cairo_pattern_t* m_pattern; int m_width; @@ -332,14 +369,23 @@ public: wxCairoContext( wxGraphicsRenderer* renderer, const wxPrinterDC& dc ); #ifdef __WXGTK__ wxCairoContext( wxGraphicsRenderer* renderer, GdkDrawable *drawable ); +#endif +#ifdef __WXMSW__ + wxCairoContext( wxGraphicsRenderer* renderer, HDC context ); #endif wxCairoContext( wxGraphicsRenderer* renderer, cairo_t *context ); wxCairoContext( wxGraphicsRenderer* renderer, wxWindow *window); - wxCairoContext(); + + // If this ctor is used, Init() must be called by the derived class later. + wxCairoContext( wxGraphicsRenderer* renderer ); + virtual ~wxCairoContext(); virtual bool ShouldOffset() const { + if ( !m_enableOffset ) + return false; + int penwidth = 0 ; if ( !m_pen.IsNull() ) { @@ -365,6 +411,8 @@ public: virtual bool SetAntialiasMode(wxAntialiasMode antialias); + virtual bool SetInterpolationQuality(wxInterpolationQuality interpolation); + virtual bool SetCompositionMode(wxCompositionMode op); virtual void BeginLayer(wxDouble opacity); @@ -400,9 +448,9 @@ public: protected: virtual void DoDrawText( const wxString &str, wxDouble x, wxDouble y ); -private: void Init(cairo_t *context); +private: cairo_t* m_context; wxVector m_layerOpacities; @@ -410,6 +458,35 @@ private: wxDECLARE_NO_COPY_CLASS(wxCairoContext); }; +#if wxUSE_IMAGE +// ---------------------------------------------------------------------------- +// wxCairoImageContext: context associated with a wxImage. +// ---------------------------------------------------------------------------- + +class wxCairoImageContext : public wxCairoContext +{ +public: + wxCairoImageContext(wxGraphicsRenderer* renderer, wxImage& image) : + wxCairoContext(renderer), + m_image(image), + m_data(renderer, image) + { + Init(cairo_create(m_data.GetCairoSurface())); + } + + virtual ~wxCairoImageContext() + { + m_image = m_data.ConvertToImage(); + } + +private: + wxImage& m_image; + wxCairoBitmapData m_data; + + wxDECLARE_NO_COPY_CLASS(wxCairoImageContext); +}; +#endif // wxUSE_IMAGE + //----------------------------------------------------------------------------- // wxCairoPenData implementation //----------------------------------------------------------------------------- @@ -548,7 +625,7 @@ wxCairoPenData::wxCairoPenData( wxGraphicsRenderer* renderer, const wxPen &pen ) { /* wxBitmap* bmp = pen.GetStipple(); - if ( bmp && bmp->Ok() ) + if ( bmp && bmp->IsOk() ) { wxDELETE( m_penImage ); wxDELETE( m_penBrush ); @@ -663,7 +740,7 @@ wxCairoBrushData::wxCairoBrushData( wxGraphicsRenderer* renderer, const wxBrush else { wxBitmap* bmp = brush.GetStipple(); - if ( bmp && bmp->Ok() ) + if ( bmp && bmp->IsOk() ) { wxDELETE( m_brushImage ); m_brushImage = Bitmap::FromHBITMAP((HBITMAP)bmp->GetHBITMAP(),(HPALETTE)bmp->GetPalette()->GetHPALETTE()); @@ -747,50 +824,117 @@ void wxCairoBrushData::Init() // wxCairoFontData implementation //----------------------------------------------------------------------------- -wxCairoFontData::wxCairoFontData( wxGraphicsRenderer* renderer, const wxFont &font, - const wxColour& col ) : wxGraphicsObjectRefData(renderer) +void wxCairoFontData::InitColour(const wxColour& col) { m_red = col.Red()/255.0; m_green = col.Green()/255.0; m_blue = col.Blue()/255.0; m_alpha = col.Alpha()/255.0; +} + +void +wxCairoFontData::InitFontComponents(const wxString& facename, + cairo_font_slant_t slant, + cairo_font_weight_t weight) +{ + m_fontName = facename.mb_str(wxConvUTF8); + m_slant = slant; + m_weight = weight; +} + +wxCairoFontData::wxCairoFontData( wxGraphicsRenderer* renderer, const wxFont &font, + const wxColour& col ) + : wxGraphicsObjectRefData(renderer) +#ifdef __WXGTK__ + , m_wxfont(font) +#endif +{ + InitColour(col); + m_size = font.GetPointSize(); - m_underlined = font.GetUnderlined(); #ifdef __WXMAC__ m_font = cairo_quartz_font_face_create_for_cgfont( font.OSXGetCGFont() ); #elif defined(__WXGTK__) - m_font = pango_font_description_copy( font.GetNativeFontInfo()->description ); #else - m_fontName = font.GetFaceName().mb_str(wxConvUTF8); - m_slant = font.GetStyle() == wxFONTSTYLE_ITALIC ? CAIRO_FONT_SLANT_ITALIC:CAIRO_FONT_SLANT_NORMAL; - m_weight = font.GetWeight() == wxFONTWEIGHT_BOLD ? CAIRO_FONT_WEIGHT_BOLD:CAIRO_FONT_WEIGHT_NORMAL; + InitFontComponents + ( + font.GetFaceName(), + font.GetStyle() == wxFONTSTYLE_ITALIC ? CAIRO_FONT_SLANT_ITALIC + : CAIRO_FONT_SLANT_NORMAL, + font.GetWeight() == wxFONTWEIGHT_BOLD ? CAIRO_FONT_WEIGHT_BOLD + : CAIRO_FONT_WEIGHT_NORMAL + ); #endif } +wxCairoFontData::wxCairoFontData(wxGraphicsRenderer* renderer, + double sizeInPixels, + const wxString& facename, + int flags, + const wxColour& col) : + wxGraphicsObjectRefData(renderer) +{ + InitColour(col); + + // Resolution for Cairo image surfaces is 72 DPI meaning that the sizes in + // points and pixels are identical, so we can just pass the size in pixels + // directly to cairo_set_font_size(). + m_size = sizeInPixels; + +#if defined(__WXMAC__) + m_font = NULL; +#endif + + // There is no need to set m_underlined under wxGTK in this case, it can + // only be used if m_font != NULL. + + InitFontComponents + ( + facename, + flags & wxFONTFLAG_ITALIC ? CAIRO_FONT_SLANT_ITALIC + : CAIRO_FONT_SLANT_NORMAL, + flags & wxFONTFLAG_BOLD ? CAIRO_FONT_WEIGHT_BOLD + : CAIRO_FONT_WEIGHT_NORMAL + ); +} + wxCairoFontData::~wxCairoFontData() { #ifdef __WXMAC__ - cairo_font_face_destroy( m_font ); -#elif defined(__WXGTK__) - pango_font_description_free( m_font ); -#else + if ( m_font ) + cairo_font_face_destroy( m_font ); #endif } -void wxCairoFontData::Apply( wxGraphicsContext* context ) +bool wxCairoFontData::Apply( wxGraphicsContext* context ) { cairo_t * ctext = (cairo_t*) context->GetNativeContext(); cairo_set_source_rgba(ctext,m_red,m_green, m_blue,m_alpha); #ifdef __WXGTK__ - // the rest is done using Pango layouts + if (m_wxfont.IsOk()) + { + // Nothing to do, the caller uses Pango layout functions to do + // everything. + return true; + } #elif defined(__WXMAC__) - cairo_set_font_face(ctext, m_font); - cairo_set_font_size(ctext, m_size ); -#else + if ( m_font ) + { + cairo_set_font_face(ctext, m_font); + cairo_set_font_size(ctext, m_size ); + return true; + } +#endif + + // If we get here, we must be on a platform without native font support or + // we're using toy Cairo API even under wxGTK/wxMac. cairo_select_font_face(ctext, m_fontName, m_slant, m_weight ); cairo_set_font_size(ctext, m_size ); -#endif + + // Indicate that we don't use native fonts for the platforms which care + // about this (currently only wxGTK). + return false; } //----------------------------------------------------------------------------- @@ -1060,8 +1204,49 @@ void * wxCairoMatrixData::GetNativeMatrix() const return (void*) &m_matrix; } +// ---------------------------------------------------------------------------- // wxCairoBitmap implementation -//----------------------------------------------------------------------------- +// ---------------------------------------------------------------------------- + +int wxCairoBitmapData::InitBuffer(int width, int height, cairo_format_t format) +{ + wxUnusedVar(format); // Only really unused with Cairo < 1.6. + + // Determine the stride: use cairo_format_stride_for_width() if available + // but fall back to 4*width for the earlier versions as this is what that + // function always returns, even in latest Cairo, anyhow. + int stride; +#if CAIRO_VERSION >= CAIRO_VERSION_ENCODE(1, 6, 0) + if ( cairo_version() >= CAIRO_VERSION_ENCODE(1, 6, 0) ) + { + stride = cairo_format_stride_for_width(format, width); + + // All our code would totally break if stride were not a multiple of 4 + // so ensure this is the case. + if ( stride % 4 ) + { + wxFAIL_MSG("Unexpected Cairo image surface stride."); + + stride += 4 - stride % 4; + } + } + else +#endif + stride = 4*width; + + m_width = width; + m_height = height; + m_buffer = new unsigned char[height*stride]; + + return stride; +} + +void wxCairoBitmapData::InitSurface(cairo_format_t format, int stride) +{ + m_surface = cairo_image_surface_create_for_data( + m_buffer, format, m_width, m_height, stride); + m_pattern = cairo_pattern_create_for_surface(m_surface); +} wxCairoBitmapData::wxCairoBitmapData( wxGraphicsRenderer* renderer, cairo_surface_t* bitmap ) : wxGraphicsObjectRefData( renderer ) @@ -1075,27 +1260,34 @@ wxCairoBitmapData::wxCairoBitmapData( wxGraphicsRenderer* renderer, const wxBitm wxCHECK_RET( bmp.IsOk(), wxT("Invalid bitmap in wxCairoContext::DrawBitmap")); #ifdef wxHAS_RAW_BITMAP - int bw = m_width = bmp.GetWidth(); - int bh = m_height = bmp.GetHeight(); - wxBitmap bmpSource = bmp; // we need a non-const instance - m_buffer = new unsigned char[bw*bh*4]; - wxUint32* data = (wxUint32*)m_buffer; - // Create a surface object and copy the bitmap pixel data to it. if the // image has alpha (or a mask represented as alpha) then we'll use a // different format and iterator than if it doesn't... - if (bmpSource.HasAlpha() || bmpSource.GetMask()) + cairo_format_t bufferFormat = bmp.GetDepth() == 32 +#ifdef __WXGTK__ + || bmp.GetMask() +#endif + ? CAIRO_FORMAT_ARGB32 + : CAIRO_FORMAT_RGB24; + + int stride = InitBuffer(bmp.GetWidth(), bmp.GetHeight(), bufferFormat); + + wxBitmap bmpSource = bmp; // we need a non-const instance + wxUint32* data = (wxUint32*)m_buffer; + + if ( bufferFormat == CAIRO_FORMAT_ARGB32 ) { - m_surface = cairo_image_surface_create_for_data( - m_buffer, CAIRO_FORMAT_ARGB32, bw, bh, bw*4); - wxAlphaPixelData pixData(bmpSource, wxPoint(0,0), wxSize(bw, bh)); + // use the bitmap's alpha + wxAlphaPixelData + pixData(bmpSource, wxPoint(0, 0), wxSize(m_width, m_height)); wxCHECK_RET( pixData, wxT("Failed to gain raw access to bitmap data.")); wxAlphaPixelData::Iterator p(pixData); - for (int y=0; y(m_buffer); + const unsigned char* src = image.GetData(); + + if ( bufferFormat == CAIRO_FORMAT_ARGB32 ) + { + const unsigned char* alpha = image.GetAlpha(); + + for ( int y = 0; y < m_height; y++ ) + { + wxUint32* const rowStartDst = dst; + + for ( int x = 0; x < m_width; x++ ) + { + const unsigned char a = *alpha++; + + *dst++ = a << 24 | + Premultiply(a, src[0]) << 16 | + Premultiply(a, src[1]) << 8 | + Premultiply(a, src[2]); + src += 3; + } + + dst = rowStartDst + stride / 4; + } + } + else // RGB + { + for ( int y = 0; y < m_height; y++ ) + { + wxUint32* const rowStartDst = dst; + + for ( int x = 0; x < m_width; x++ ) + { + *dst++ = src[0] << 16 | + src[1] << 8 | + src[2]; + src += 3; + } + + dst = rowStartDst + stride / 4; + } + } + + InitSurface(bufferFormat, stride); +} + +wxImage wxCairoBitmapData::ConvertToImage() const +{ + wxImage image(m_width, m_height, false /* don't clear */); + + // Get the surface type and format. + wxCHECK_MSG( cairo_surface_get_type(m_surface) == CAIRO_SURFACE_TYPE_IMAGE, + wxNullImage, + wxS("Can't convert non-image surface to image.") ); + + switch ( cairo_image_surface_get_format(m_surface) ) + { + case CAIRO_FORMAT_ARGB32: + image.SetAlpha(); + break; + + case CAIRO_FORMAT_RGB24: + // Nothing to do, we don't use alpha by default. + break; + + case CAIRO_FORMAT_A8: + case CAIRO_FORMAT_A1: + wxFAIL_MSG(wxS("Unsupported Cairo image surface type.")); + return wxNullImage; + + default: + wxFAIL_MSG(wxS("Unknown Cairo image surface type.")); + return wxNullImage; + } + + // Prepare for copying data. + const wxUint32* src = (wxUint32*)cairo_image_surface_get_data(m_surface); + wxCHECK_MSG( src, wxNullImage, wxS("Failed to get Cairo surface data.") ); + + int stride = cairo_image_surface_get_stride(m_surface); + wxCHECK_MSG( stride > 0, wxNullImage, + wxS("Failed to get Cairo surface stride.") ); + + // As we work with wxUint32 pointers and not char ones, we need to adjust + // the stride accordingly. This should be lossless as the stride must be a + // multiple of pixel size. + wxASSERT_MSG( !(stride % sizeof(wxUint32)), wxS("Unexpected stride.") ); + stride /= sizeof(wxUint32); + + unsigned char* dst = image.GetData(); + unsigned char *alpha = image.GetAlpha(); + if ( alpha ) + { + // We need to also copy alpha and undo the pre-multiplication as Cairo + // stores pre-multiplied values in this format while wxImage does not. + for ( int y = 0; y < m_height; y++ ) + { + const wxUint32* const rowStart = src; + for ( int x = 0; x < m_width; x++ ) + { + const wxUint32 argb = *src++; + + *alpha++ = (argb & 0xff000000) >> 24; + + // Copy the RGB data undoing the pre-multiplication. + *dst++ = Unpremultiply(*alpha, (argb & 0x00ff0000) >> 16); + *dst++ = Unpremultiply(*alpha, (argb & 0x0000ff00) >> 8); + *dst++ = Unpremultiply(*alpha, (argb & 0x000000ff)); + } + + src = rowStart + stride; + } + } + else // RGB + { + // Things are pretty simple in this case, just copy RGB bytes. + for ( int y = 0; y < m_height; y++ ) + { + const wxUint32* const rowStart = src; + for ( int x = 0; x < m_width; x++ ) + { + const wxUint32 argb = *src++; + + *dst++ = (argb & 0x00ff0000) >> 16; + *dst++ = (argb & 0x0000ff00) >> 8; + *dst++ = (argb & 0x000000ff); + } + + src = rowStart + stride; + } + } + + return image; +} + +#endif // wxUSE_IMAGE + wxCairoBitmapData::~wxCairoBitmapData() { if (m_pattern) @@ -1156,8 +1554,6 @@ wxCairoBitmapData::~wxCairoBitmapData() delete [] m_buffer; } - - //----------------------------------------------------------------------------- // wxCairoContext implementation //----------------------------------------------------------------------------- @@ -1185,25 +1581,61 @@ public : wxCairoContext::wxCairoContext( wxGraphicsRenderer* renderer, const wxPrinterDC& dc ) : wxGraphicsContext(renderer) { +#ifdef __WXMSW__ + // wxMSW contexts always use MM_ANISOTROPIC, which messes up + // text rendering when printing using Cairo. Switch it to MM_TEXT + // map mode to avoid this problem. + HDC hdc = (HDC)dc.GetHDC(); + ::SetMapMode(hdc, MM_TEXT); + m_mswSurface = cairo_win32_printing_surface_create(hdc); + Init( cairo_create(m_mswSurface) ); +#endif + #ifdef __WXGTK20__ const wxDCImpl *impl = dc.GetImpl(); Init( (cairo_t*) impl->GetCairoContext() ); +#endif + wxSize sz = dc.GetSize(); + m_width = sz.x; + m_height = sz.y; wxPoint org = dc.GetDeviceOrigin(); cairo_translate( m_context, org.x, org.y ); double sx,sy; dc.GetUserScale( &sx, &sy ); + +// TODO: Determine if these fixes are needed on other platforms too. +// On MSW, without this the printer context will not respect wxDC SetMapMode calls. +// For example, using dc.SetMapMode(wxMM_POINTS) can let us share printer and screen +// drawing code +#ifdef __WXMSW__ + double lsx,lsy; + dc.GetLogicalScale( &lsx, &lsy ); + sx *= lsx; + sy *= lsy; +#endif cairo_scale( m_context, sx, sy ); org = dc.GetLogicalOrigin(); cairo_translate( m_context, -org.x, -org.y ); -#endif } wxCairoContext::wxCairoContext( wxGraphicsRenderer* renderer, const wxWindowDC& dc ) : wxGraphicsContext(renderer) { + int width, height; + dc.GetSize( &width, &height ); + m_width = width; + m_height = height; + + m_enableOffset = true; + +#ifdef __WXMSW__ + m_mswSurface = cairo_win32_surface_create((HDC)dc.GetHDC()); + Init( cairo_create(m_mswSurface) ); +#endif + #ifdef __WXGTK20__ wxGTKDCImpl *impldc = (wxGTKDCImpl*) dc.GetImpl(); Init( gdk_cairo_create( impldc->GetGDKWindow() ) ); @@ -1226,8 +1658,6 @@ wxCairoContext::wxCairoContext( wxGraphicsRenderer* renderer, const wxWindowDC& #endif #ifdef __WXMAC__ - int width, height; - dc.GetSize( &width, &height ); CGContextRef cgcontext = (CGContextRef)dc.GetWindow()->MacGetCGContextRef(); cairo_surface_t* surface = cairo_quartz_surface_create_for_cg_context(cgcontext, width, height); Init( cairo_create( surface ) ); @@ -1238,6 +1668,18 @@ wxCairoContext::wxCairoContext( wxGraphicsRenderer* renderer, const wxWindowDC& wxCairoContext::wxCairoContext( wxGraphicsRenderer* renderer, const wxMemoryDC& dc ) : wxGraphicsContext(renderer) { + int width, height; + dc.GetSize( &width, &height ); + m_width = width; + m_height = height; + + m_enableOffset = true; + +#ifdef __WXMSW__ + m_mswSurface = cairo_win32_surface_create((HDC)dc.GetHDC()); + Init( cairo_create(m_mswSurface) ); +#endif + #ifdef __WXGTK20__ wxGTKDCImpl *impldc = (wxGTKDCImpl*) dc.GetImpl(); Init( gdk_cairo_create( impldc->GetGDKWindow() ) ); @@ -1260,8 +1702,6 @@ wxCairoContext::wxCairoContext( wxGraphicsRenderer* renderer, const wxMemoryDC& #endif #ifdef __WXMAC__ - int width, height; - dc.GetSize( &width, &height ); CGContextRef cgcontext = (CGContextRef)dc.GetWindow()->MacGetCGContextRef(); cairo_surface_t* surface = cairo_quartz_surface_create_for_cg_context(cgcontext, width, height); Init( cairo_create( surface ) ); @@ -1274,6 +1714,11 @@ wxCairoContext::wxCairoContext( wxGraphicsRenderer* renderer, GdkDrawable *drawa : wxGraphicsContext(renderer) { Init( gdk_cairo_create( drawable ) ); + + int width, height; + gdk_drawable_get_size( drawable, &width, &height ); + m_width = width; + m_height = height; } #endif @@ -1282,9 +1727,9 @@ wxCairoContext::wxCairoContext( wxGraphicsRenderer* renderer, HDC handle ) : wxGraphicsContext(renderer) { m_mswSurface = cairo_win32_surface_create(handle); - m_context = cairo_create(m_mswSurface); - PushState(); - PushState(); + Init( cairo_create(m_mswSurface) ); + m_width = + m_height = 0; } #endif @@ -1293,11 +1738,14 @@ wxCairoContext::wxCairoContext( wxGraphicsRenderer* renderer, cairo_t *context ) : wxGraphicsContext(renderer) { Init( context ); + m_width = + m_height = 0; } wxCairoContext::wxCairoContext( wxGraphicsRenderer* renderer, wxWindow *window) : wxGraphicsContext(renderer) { + m_enableOffset = true; #ifdef __WXGTK__ // something along these lines (copied from dcclient) @@ -1312,7 +1760,23 @@ wxCairoContext::wxCairoContext( wxGraphicsRenderer* renderer, wxWindow *window) wxASSERT_MSG( window->m_wxwindow, wxT("wxCairoContext needs a widget") ); Init(gdk_cairo_create(window->GTKGetDrawingWindow())); + + wxSize sz = window->GetSize(); + m_width = sz.x; + m_height = sz.y; #endif + +#ifdef __WXMSW__ + m_mswSurface = cairo_win32_surface_create((HDC)window->GetHandle()); + Init(cairo_create(m_mswSurface)); +#endif + +} + +wxCairoContext::wxCairoContext(wxGraphicsRenderer* renderer) : + wxGraphicsContext(renderer) +{ + m_context = NULL; } wxCairoContext::~wxCairoContext() @@ -1320,10 +1784,6 @@ wxCairoContext::~wxCairoContext() if ( m_context ) { PopState(); -#ifdef __WXMSW__ - m_mswSurface = cairo_win32_surface_create((HDC)window->GetHandle()); - m_context = cairo_create(m_mswSurface); -#endif PopState(); cairo_destroy(m_context); } @@ -1510,30 +1970,25 @@ void wxCairoContext::DoDrawText(const wxString& str, wxDouble x, wxDouble y) if ( !data ) return; - ((wxCairoFontData*)m_font.GetRefData())->Apply(this); - -#ifdef __WXGTK__ - size_t datalen = strlen(data); - - PangoLayout *layout = pango_cairo_create_layout (m_context); - wxCairoFontData* font_data = (wxCairoFontData*) m_font.GetRefData(); - pango_layout_set_font_description( layout, font_data->GetFont()); - pango_layout_set_text(layout, data, datalen); - - if (font_data->GetUnderlined()) + if ( ((wxCairoFontData*)m_font.GetRefData())->Apply(this) ) { - PangoAttrList *attrs = pango_attr_list_new(); - PangoAttribute *attr = pango_attr_underline_new(PANGO_UNDERLINE_SINGLE); - pango_attr_list_insert(attrs, attr); - pango_layout_set_attributes(layout, attrs); - pango_attr_list_unref(attrs); +#ifdef __WXGTK__ + PangoLayout *layout = pango_cairo_create_layout (m_context); + const wxFont& font = static_cast(m_font.GetRefData())->GetFont(); + pango_layout_set_font_description(layout, font.GetNativeFontInfo()->description); + pango_layout_set_text(layout, data, data.length()); + font.GTKSetPangoAttrs(layout); + + cairo_move_to(m_context, x, y); + pango_cairo_show_layout (m_context, layout); + + g_object_unref (layout); + + // Don't use Cairo text API, we already did everything. + return; +#endif } - cairo_move_to(m_context, x, y); - pango_cairo_show_layout (m_context, layout); - - g_object_unref (layout); -#else // Cairo's x,y for drawing text is at the baseline, so we need to adjust // the position we move to by the ascent. cairo_font_extents_t fe; @@ -1541,7 +1996,6 @@ void wxCairoContext::DoDrawText(const wxString& str, wxDouble x, wxDouble y) cairo_move_to(m_context, x, y+fe.ascent); cairo_show_text(m_context, data); -#endif } void wxCairoContext::GetTextExtent( const wxString &str, wxDouble *width, wxDouble *height, @@ -1561,32 +2015,36 @@ void wxCairoContext::GetTextExtent( const wxString &str, wxDouble *width, wxDoub if ( str.empty()) return; + if ( ((wxCairoFontData*)m_font.GetRefData())->Apply((wxCairoContext*)this) ) + { #ifdef __WXGTK__ - int w, h; + int w, h; - PangoLayout *layout = pango_cairo_create_layout (m_context); - pango_layout_set_font_description( layout, ((wxCairoFontData*)m_font.GetRefData())->GetFont()); - const wxCharBuffer data = str.utf8_str(); - if ( !data ) - { + PangoLayout *layout = pango_cairo_create_layout (m_context); + const wxFont& font = static_cast(m_font.GetRefData())->GetFont(); + pango_layout_set_font_description(layout, font.GetNativeFontInfo()->description); + const wxCharBuffer data = str.utf8_str(); + if ( !data ) + { + return; + } + pango_layout_set_text(layout, data, data.length()); + pango_layout_get_pixel_size (layout, &w, &h); + if ( width ) + *width = w; + if ( height ) + *height = h; + if (descent) + { + PangoLayoutIter *iter = pango_layout_get_iter(layout); + int baseline = pango_layout_iter_get_baseline(iter); + pango_layout_iter_free(iter); + *descent = h - PANGO_PIXELS(baseline); + } + g_object_unref (layout); return; +#endif } - pango_layout_set_text( layout, data, strlen(data) ); - pango_layout_get_pixel_size (layout, &w, &h); - if ( width ) - *width = w; - if ( height ) - *height = h; - if (descent) - { - PangoLayoutIter *iter = pango_layout_get_iter(layout); - int baseline = pango_layout_iter_get_baseline(iter); - pango_layout_iter_free(iter); - *descent = h - PANGO_PIXELS(baseline); - } - g_object_unref (layout); -#else - ((wxCairoFontData*)m_font.GetRefData())->Apply((wxCairoContext*)this); if (width) { @@ -1619,7 +2077,6 @@ void wxCairoContext::GetTextExtent( const wxString &str, wxDouble *width, wxDoub if ( externalLeading ) *externalLeading = wxMax(0, fe.height - (fe.ascent + fe.descent)); } -#endif } void wxCairoContext::GetPartialTextExtents(const wxString& text, wxArrayDouble& widths) const @@ -1663,6 +2120,12 @@ bool wxCairoContext::SetAntialiasMode(wxAntialiasMode antialias) return true; } +bool wxCairoContext::SetInterpolationQuality(wxInterpolationQuality WXUNUSED(interpolation)) +{ + // placeholder + return false; +} + bool wxCairoContext::SetCompositionMode(wxCompositionMode op) { if ( m_composition == op ) @@ -1752,11 +2215,18 @@ public : virtual wxGraphicsContext * CreateContextFromNativeContext( void * context ); virtual wxGraphicsContext * CreateContextFromNativeWindow( void * window ); +#if wxUSE_IMAGE + virtual wxGraphicsContext * CreateContextFromImage(wxImage& image); +#endif // wxUSE_IMAGE virtual wxGraphicsContext * CreateContext( wxWindow* window ); virtual wxGraphicsContext * CreateMeasuringContext(); - +#ifdef __WXMSW__ +#if wxUSE_ENH_METAFILE + virtual wxGraphicsContext * CreateContext( const wxEnhMetaFileDC& dc); +#endif +#endif // Path virtual wxGraphicsPath CreatePath(); @@ -1784,9 +2254,17 @@ public : // sets the font virtual wxGraphicsFont CreateFont( const wxFont &font , const wxColour &col = *wxBLACK ) ; + virtual wxGraphicsFont CreateFont(double sizeInPixels, + const wxString& facename, + int flags = wxFONTFLAG_DEFAULT, + const wxColour& col = *wxBLACK); // create a native bitmap representation virtual wxGraphicsBitmap CreateBitmap( const wxBitmap &bitmap ); +#if wxUSE_IMAGE + virtual wxGraphicsBitmap CreateBitmapFromImage(const wxImage& image); + virtual wxImage CreateImageFromBitmap(const wxGraphicsBitmap& bmp); +#endif // wxUSE_IMAGE // create a graphics bitmap from a native bitmap virtual wxGraphicsBitmap CreateBitmapFromNativeBitmap( void* bitmap ); @@ -1794,7 +2272,13 @@ public : // create a subimage from a native image representation virtual wxGraphicsBitmap CreateSubBitmap( const wxGraphicsBitmap &bitmap, wxDouble x, wxDouble y, wxDouble w, wxDouble h ); +protected : + bool EnsureIsLoaded(); + void Load(); + void Unload(); + friend class wxCairoModule; private : + int m_loaded; DECLARE_DYNAMIC_CLASS_NO_COPY(wxCairoRenderer) } ; @@ -1809,30 +2293,62 @@ static wxCairoRenderer gs_cairoGraphicsRenderer; extern wxGraphicsRenderer* gCairoRenderer; wxGraphicsRenderer* gCairoRenderer = &gs_cairoGraphicsRenderer; +bool wxCairoRenderer::EnsureIsLoaded() +{ +#ifndef __WXGTK__ + Load(); + return wxCairoInit(); +#else + return true; +#endif +} + +void wxCairoRenderer::Load() +{ + wxCairoInit(); +} + +void wxCairoRenderer::Unload() +{ + wxCairoCleanUp(); +} + +// call EnsureIsLoaded() and return returnOnFail value if it fails +#define ENSURE_LOADED_OR_RETURN(returnOnFail) \ + if ( !EnsureIsLoaded() ) \ + return (returnOnFail) + wxGraphicsContext * wxCairoRenderer::CreateContext( const wxWindowDC& dc) { + ENSURE_LOADED_OR_RETURN(NULL); return new wxCairoContext(this,dc); } wxGraphicsContext * wxCairoRenderer::CreateContext( const wxMemoryDC& dc) { + ENSURE_LOADED_OR_RETURN(NULL); return new wxCairoContext(this,dc); } wxGraphicsContext * wxCairoRenderer::CreateContext( const wxPrinterDC& dc) { -#ifdef __WXGTK20__ - const wxDCImpl *impl = dc.GetImpl(); - cairo_t* context = (cairo_t*) impl->GetCairoContext(); - if (context) - return new wxCairoContext(this,dc); - else -#endif - return NULL; + ENSURE_LOADED_OR_RETURN(NULL); + return new wxCairoContext(this, dc); } +#ifdef __WXMSW__ +#if wxUSE_ENH_METAFILE +wxGraphicsContext * wxCairoRenderer::CreateContext( const wxEnhMetaFileDC& WXUNUSED(dc) ) +{ + ENSURE_LOADED_OR_RETURN(NULL); + return NULL; +} +#endif +#endif + wxGraphicsContext * wxCairoRenderer::CreateContextFromNativeContext( void * context ) { + ENSURE_LOADED_OR_RETURN(NULL); #ifdef __WXMSW__ return new wxCairoContext(this,(HDC)context); #else @@ -1843,15 +2359,25 @@ wxGraphicsContext * wxCairoRenderer::CreateContextFromNativeContext( void * cont wxGraphicsContext * wxCairoRenderer::CreateContextFromNativeWindow( void * window ) { + ENSURE_LOADED_OR_RETURN(NULL); #ifdef __WXGTK__ return new wxCairoContext(this,(GdkDrawable*)window); #else + wxUnusedVar(window); return NULL; #endif } +#if wxUSE_IMAGE +wxGraphicsContext * wxCairoRenderer::CreateContextFromImage(wxImage& image) +{ + return new wxCairoImageContext(this, image); +} +#endif // wxUSE_IMAGE + wxGraphicsContext * wxCairoRenderer::CreateMeasuringContext() { + ENSURE_LOADED_OR_RETURN(NULL); #ifdef __WXGTK__ return CreateContextFromNativeWindow(gdk_get_default_root_window()); #endif @@ -1861,6 +2387,7 @@ wxGraphicsContext * wxCairoRenderer::CreateMeasuringContext() wxGraphicsContext * wxCairoRenderer::CreateContext( wxWindow* window ) { + ENSURE_LOADED_OR_RETURN(NULL); return new wxCairoContext(this, window ); } @@ -1868,6 +2395,7 @@ wxGraphicsContext * wxCairoRenderer::CreateContext( wxWindow* window ) wxGraphicsPath wxCairoRenderer::CreatePath() { + ENSURE_LOADED_OR_RETURN(wxNullGraphicsPath); wxGraphicsPath path; path.SetRefData( new wxCairoPathData(this) ); return path; @@ -1880,6 +2408,7 @@ wxGraphicsMatrix wxCairoRenderer::CreateMatrix( wxDouble a, wxDouble b, wxDouble wxDouble tx, wxDouble ty) { + ENSURE_LOADED_OR_RETURN(wxNullGraphicsMatrix); wxGraphicsMatrix m; wxCairoMatrixData* data = new wxCairoMatrixData( this ); data->Set( a,b,c,d,tx,ty ) ; @@ -1889,7 +2418,8 @@ wxGraphicsMatrix wxCairoRenderer::CreateMatrix( wxDouble a, wxDouble b, wxDouble wxGraphicsPen wxCairoRenderer::CreatePen(const wxPen& pen) { - if ( !pen.Ok() || pen.GetStyle() == wxPENSTYLE_TRANSPARENT ) + ENSURE_LOADED_OR_RETURN(wxNullGraphicsPen); + if ( !pen.IsOk() || pen.GetStyle() == wxPENSTYLE_TRANSPARENT ) return wxNullGraphicsPen; else { @@ -1901,7 +2431,8 @@ wxGraphicsPen wxCairoRenderer::CreatePen(const wxPen& pen) wxGraphicsBrush wxCairoRenderer::CreateBrush(const wxBrush& brush ) { - if ( !brush.Ok() || brush.GetStyle() == wxBRUSHSTYLE_TRANSPARENT ) + ENSURE_LOADED_OR_RETURN(wxNullGraphicsBrush); + if ( !brush.IsOk() || brush.GetStyle() == wxBRUSHSTYLE_TRANSPARENT ) return wxNullGraphicsBrush; else { @@ -1916,6 +2447,7 @@ wxCairoRenderer::CreateLinearGradientBrush(wxDouble x1, wxDouble y1, wxDouble x2, wxDouble y2, const wxGraphicsGradientStops& stops) { + ENSURE_LOADED_OR_RETURN(wxNullGraphicsBrush); wxGraphicsBrush p; wxCairoBrushData* d = new wxCairoBrushData( this ); d->CreateLinearGradientBrush(x1, y1, x2, y2, stops); @@ -1928,6 +2460,7 @@ wxCairoRenderer::CreateRadialGradientBrush(wxDouble xo, wxDouble yo, wxDouble xc, wxDouble yc, wxDouble r, const wxGraphicsGradientStops& stops) { + ENSURE_LOADED_OR_RETURN(wxNullGraphicsBrush); wxGraphicsBrush p; wxCairoBrushData* d = new wxCairoBrushData( this ); d->CreateRadialGradientBrush(xo, yo, xc, yc, r, stops); @@ -1935,10 +2468,10 @@ wxCairoRenderer::CreateRadialGradientBrush(wxDouble xo, wxDouble yo, return p; } -// sets the font wxGraphicsFont wxCairoRenderer::CreateFont( const wxFont &font , const wxColour &col ) { - if ( font.Ok() ) + ENSURE_LOADED_OR_RETURN(wxNullGraphicsFont); + if ( font.IsOk() ) { wxGraphicsFont p; p.SetRefData(new wxCairoFontData( this , font, col )); @@ -1948,9 +2481,23 @@ wxGraphicsFont wxCairoRenderer::CreateFont( const wxFont &font , const wxColour return wxNullGraphicsFont; } +wxGraphicsFont +wxCairoRenderer::CreateFont(double sizeInPixels, + const wxString& facename, + int flags, + const wxColour& col) +{ + ENSURE_LOADED_OR_RETURN(wxNullGraphicsFont); + + wxGraphicsFont font; + font.SetRefData(new wxCairoFontData(this, sizeInPixels, facename, flags, col)); + return font; +} + wxGraphicsBitmap wxCairoRenderer::CreateBitmap( const wxBitmap& bmp ) { - if ( bmp.Ok() ) + ENSURE_LOADED_OR_RETURN(wxNullGraphicsBitmap); + if ( bmp.IsOk() ) { wxGraphicsBitmap p; p.SetRefData(new wxCairoBitmapData( this , bmp )); @@ -1960,8 +2507,38 @@ wxGraphicsBitmap wxCairoRenderer::CreateBitmap( const wxBitmap& bmp ) return wxNullGraphicsBitmap; } +#if wxUSE_IMAGE + +wxGraphicsBitmap wxCairoRenderer::CreateBitmapFromImage(const wxImage& image) +{ + wxGraphicsBitmap bmp; + + ENSURE_LOADED_OR_RETURN(bmp); + + if ( image.IsOk() ) + { + bmp.SetRefData(new wxCairoBitmapData(this, image)); + } + + return bmp; +} + +wxImage wxCairoRenderer::CreateImageFromBitmap(const wxGraphicsBitmap& bmp) +{ + ENSURE_LOADED_OR_RETURN(wxNullImage); + + const wxCairoBitmapData* const + data = static_cast(bmp.GetGraphicsData()); + + return data ? data->ConvertToImage() : wxNullImage; +} + +#endif // wxUSE_IMAGE + + wxGraphicsBitmap wxCairoRenderer::CreateBitmapFromNativeBitmap( void* bitmap ) { + ENSURE_LOADED_OR_RETURN(wxNullGraphicsBitmap); if ( bitmap != NULL ) { wxGraphicsBitmap p; @@ -1979,6 +2556,7 @@ wxCairoRenderer::CreateSubBitmap(const wxGraphicsBitmap& WXUNUSED(bitmap), wxDouble WXUNUSED(w), wxDouble WXUNUSED(h)) { + ENSURE_LOADED_OR_RETURN(wxNullGraphicsBitmap); wxFAIL_MSG("wxCairoRenderer::CreateSubBitmap is not implemented."); return wxNullGraphicsBitmap; } diff --git a/Externals/wxWidgets3/src/generic/grid.cpp b/Externals/wxWidgets3/src/generic/grid.cpp index b335b1f755..0fb00db063 100644 --- a/Externals/wxWidgets3/src/generic/grid.cpp +++ b/Externals/wxWidgets3/src/generic/grid.cpp @@ -4,7 +4,7 @@ // Author: Michael Bedward (based on code by Julian Smart, Robin Dunn) // Modified by: Robin Dunn, Vadim Zeitlin, Santiago Palacios // Created: 1/08/1999 -// RCS-ID: $Id: grid.cpp 67280 2011-03-22 14:17:38Z DS $ +// RCS-ID: $Id: grid.cpp 70826 2012-03-06 13:18:22Z SC $ // Copyright: (c) Michael Bedward (mbedward@ozemail.com.au) // Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// @@ -72,8 +72,8 @@ const char wxGridNameStr[] = "grid"; // Required for wxIs... functions #include -WX_DECLARE_HASH_SET_WITH_DECL(int, wxIntegerHash, wxIntegerEqual, - wxGridFixedIndicesSet, class WXDLLIMPEXP_ADV); +WX_DECLARE_HASH_SET_WITH_DECL_PTR(int, ::wxIntegerHash, ::wxIntegerEqual, + wxGridFixedIndicesSet, class WXDLLIMPEXP_ADV); // ---------------------------------------------------------------------------- @@ -419,7 +419,7 @@ void wxGridCellAttr::SetSize(int num_rows, int num_cols) wxASSERT_MSG( (!((num_rows > 0) && (num_cols <= 0)) || !((num_rows <= 0) && (num_cols > 0)) || !((num_rows == 0) && (num_cols == 0))), - wxT("wxGridCellAttr::SetSize only takes two postive values or negative/zero values")); + wxT("wxGridCellAttr::SetSize only takes two positive values or negative/zero values")); m_sizeRows = num_rows; m_sizeCols = num_cols; @@ -1534,9 +1534,8 @@ bool wxGridStringTable::DeleteCols( size_t pos, size_t numCols ) // m_colLabels stores just as many elements as it needs, e.g. if only // the label of the first column had been set it would have only one // element and not numCols, so account for it - int nToRm = m_colLabels.size() - colID; - if ( nToRm > 0 ) - m_colLabels.RemoveAt( colID, nToRm ); + int numRemaining = m_colLabels.size() - colID; + m_colLabels.RemoveAt( colID, wxMin(numCols, numRemaining) ); } if ( numCols >= curNumCols ) @@ -3069,7 +3068,7 @@ void wxGrid::ProcessRowLabelMouseEvent( wxMouseEvent& event ) ChangeCursorMode(WXGRID_CURSOR_SELECT_CELL, GetColLabelWindow()); m_dragLastPos = -1; } - else // not on row separator or it's not resizeable + else // not on row separator or it's not resizable { row = YToRow(y); if ( row >=0 && @@ -3648,13 +3647,15 @@ void wxGrid::ChangeCursorMode(CursorMode mode, // grid mouse event processing // ---------------------------------------------------------------------------- -void +bool wxGrid::DoGridCellDrag(wxMouseEvent& event, const wxGridCellCoords& coords, bool isFirstDrag) { + bool performDefault = true ; + if ( coords == wxGridNoCellCoords ) - return; // we're outside any valid cell + return performDefault; // we're outside any valid cell // Hide the edit control, so it won't interfere with drag-shrinking. if ( IsCellEditControlShown() ) @@ -3665,7 +3666,7 @@ wxGrid::DoGridCellDrag(wxMouseEvent& event, switch ( event.GetModifiers() ) { - case wxMOD_CMD: + case wxMOD_CONTROL: if ( m_selectedBlockCorner == wxGridNoCellCoords) m_selectedBlockCorner = coords; UpdateBlockBeingSelected(m_selectedBlockCorner, coords); @@ -3679,8 +3680,11 @@ wxGrid::DoGridCellDrag(wxMouseEvent& event, if ( m_selectedBlockCorner == wxGridNoCellCoords) m_selectedBlockCorner = coords; - SendEvent(wxEVT_GRID_CELL_BEGIN_DRAG, coords, event); - return; + // if event is handled by user code, no further processing + if ( SendEvent(wxEVT_GRID_CELL_BEGIN_DRAG, coords, event) != 0 ) + performDefault = false; + + return performDefault; } } @@ -3691,6 +3695,8 @@ wxGrid::DoGridCellDrag(wxMouseEvent& event, // we don't handle the other key modifiers event.Skip(); } + + return performDefault; } void wxGrid::DoGridLineDrag(wxMouseEvent& event, const wxGridOperations& oper) @@ -3743,7 +3749,9 @@ void wxGrid::DoGridDragEvent(wxMouseEvent& event, const wxGridCellCoords& coords switch ( m_cursorMode ) { case WXGRID_CURSOR_SELECT_CELL: - DoGridCellDrag(event, coords, isFirstDrag); + // no further handling if handled by user + if ( DoGridCellDrag(event, coords, isFirstDrag) == false ) + return; break; case WXGRID_CURSOR_RESIZE_ROW: @@ -4397,6 +4405,14 @@ wxGrid::SendEvent(const wxEventType type, mouseEv.GetY() + GetColLabelSize(), false, mouseEv); + + if ( type == wxEVT_GRID_CELL_BEGIN_DRAG ) + { + // by default the dragging is not supported, the user code must + // explicitly allow the event for it to take place + gridEvt.Veto(); + } + claimed = GetEventHandler()->ProcessEvent(gridEvt); vetoed = !gridEvt.IsAllowed(); } @@ -8152,10 +8168,12 @@ void wxGrid::Fit() AutoSize(); } +#if WXWIN_COMPATIBILITY_2_8 wxPen& wxGrid::GetDividerPen() const { return wxNullPen; } +#endif // WXWIN_COMPATIBILITY_2_8 // ---------------------------------------------------------------------------- // cell value accessor functions diff --git a/Externals/wxWidgets3/src/generic/gridctrl.cpp b/Externals/wxWidgets3/src/generic/gridctrl.cpp index d1da4409d4..2a9378afef 100644 --- a/Externals/wxWidgets3/src/generic/gridctrl.cpp +++ b/Externals/wxWidgets3/src/generic/gridctrl.cpp @@ -4,7 +4,7 @@ // Author: Paul Gammans, Roger Gammans // Modified by: // Created: 11/04/2001 -// RCS-ID: $Id: gridctrl.cpp 67254 2011-03-20 00:14:35Z DS $ +// RCS-ID: $Id: gridctrl.cpp 69856 2011-11-28 13:23:33Z VZ $ // Copyright: (c) The Computer Surgery (paul@compsurg.co.uk) // Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// @@ -311,7 +311,7 @@ wxGridCellAutoWrapStringRenderer::GetTextLines(wxGrid& grid, while ( tk.HasMoreTokens() ) { wxString tok = tk.GetNextToken(); - //FIXME: this causes us to print an extra unnecesary + //FIXME: this causes us to print an extra unnecessary // space at the end of the line. But it // is invisible , simplifies the size calculation // and ensures tokens are separated in the display @@ -598,10 +598,13 @@ wxSize wxGridCellNumberRenderer::GetBestSize(wxGrid& grid, // wxGridCellFloatRenderer // ---------------------------------------------------------------------------- -wxGridCellFloatRenderer::wxGridCellFloatRenderer(int width, int precision) +wxGridCellFloatRenderer::wxGridCellFloatRenderer(int width, + int precision, + int format) { SetWidth(width); SetPrecision(precision); + SetFormat(format); } wxGridCellRenderer *wxGridCellFloatRenderer::Clone() const @@ -609,6 +612,7 @@ wxGridCellRenderer *wxGridCellFloatRenderer::Clone() const wxGridCellFloatRenderer *renderer = new wxGridCellFloatRenderer; renderer->m_width = m_width; renderer->m_precision = m_precision; + renderer->m_style = m_style; renderer->m_format = m_format; return renderer; @@ -641,22 +645,30 @@ wxString wxGridCellFloatRenderer::GetString(const wxGrid& grid, int row, int col if ( m_precision == -1 ) { // default width/precision - m_format = wxT("%f"); + m_format = wxT("%"); } else { - m_format.Printf(wxT("%%.%df"), m_precision); + m_format.Printf(wxT("%%.%d"), m_precision); } } else if ( m_precision == -1 ) { // default precision - m_format.Printf(wxT("%%%d.f"), m_width); + m_format.Printf(wxT("%%%d."), m_width); } else { - m_format.Printf(wxT("%%%d.%df"), m_width, m_precision); + m_format.Printf(wxT("%%%d.%d"), m_width, m_precision); } + + bool isUpper = ( ( m_style & wxGRID_FLOAT_FORMAT_UPPER ) == wxGRID_FLOAT_FORMAT_UPPER); + if ( ( m_style & wxGRID_FLOAT_FORMAT_SCIENTIFIC ) == wxGRID_FLOAT_FORMAT_SCIENTIFIC) + m_format += isUpper ? wxT('E') : wxT('e'); + else if ( ( m_style & wxGRID_FLOAT_FORMAT_COMPACT ) == wxGRID_FLOAT_FORMAT_COMPACT) + m_format += isUpper ? wxT('G') : wxT('g'); + else + m_format += wxT('f'); } text.Printf(m_format, val); @@ -704,10 +716,12 @@ void wxGridCellFloatRenderer::SetParameters(const wxString& params) // reset to defaults SetWidth(-1); SetPrecision(-1); + SetFormat(wxGRID_FLOAT_FORMAT_DEFAULT); } else { - wxString tmp = params.BeforeFirst(wxT(',')); + wxString rest; + wxString tmp = params.BeforeFirst(wxT(','), &rest); if ( !tmp.empty() ) { long width; @@ -721,7 +735,7 @@ void wxGridCellFloatRenderer::SetParameters(const wxString& params) } } - tmp = params.AfterFirst(wxT(',')); + tmp = rest.BeforeFirst(wxT(',')); if ( !tmp.empty() ) { long precision; @@ -734,6 +748,43 @@ void wxGridCellFloatRenderer::SetParameters(const wxString& params) wxLogDebug(wxT("Invalid wxGridCellFloatRenderer precision parameter string '%s ignored"), params.c_str()); } } + + tmp = rest.AfterFirst(wxT(',')); + if ( !tmp.empty() ) + { + if ( tmp[0] == wxT('f') ) + { + SetFormat(wxGRID_FLOAT_FORMAT_FIXED); + } + else if ( tmp[0] == wxT('e') ) + { + SetFormat(wxGRID_FLOAT_FORMAT_SCIENTIFIC); + } + else if ( tmp[0] == wxT('g') ) + { + SetFormat(wxGRID_FLOAT_FORMAT_COMPACT); + } + else if ( tmp[0] == wxT('E') ) + { + SetFormat(wxGRID_FLOAT_FORMAT_SCIENTIFIC | + wxGRID_FLOAT_FORMAT_UPPER); + } + else if ( tmp[0] == wxT('F') ) + { + SetFormat(wxGRID_FLOAT_FORMAT_FIXED | + wxGRID_FLOAT_FORMAT_UPPER); + } + else if ( tmp[0] == wxT('G') ) + { + SetFormat(wxGRID_FLOAT_FORMAT_COMPACT | + wxGRID_FLOAT_FORMAT_UPPER); + } + else + { + wxLogDebug("Invalid wxGridCellFloatRenderer format " + "parameter string '%s ignored", params); + } + } } } diff --git a/Externals/wxWidgets3/src/generic/grideditors.cpp b/Externals/wxWidgets3/src/generic/grideditors.cpp index 1d77e8be57..c92f876811 100644 --- a/Externals/wxWidgets3/src/generic/grideditors.cpp +++ b/Externals/wxWidgets3/src/generic/grideditors.cpp @@ -4,7 +4,7 @@ // Author: Michael Bedward (based on code by Julian Smart, Robin Dunn) // Modified by: Robin Dunn, Vadim Zeitlin, Santiago Palacios // Created: 1/08/1999 -// RCS-ID: $Id: grideditors.cpp 66714 2011-01-19 10:48:28Z VZ $ +// RCS-ID: $Id: grideditors.cpp 70693 2012-02-25 23:49:55Z VZ $ // Copyright: (c) Michael Bedward (mbedward@ozemail.com.au) // Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// @@ -300,13 +300,13 @@ void wxGridCellEditor::Show(bool show, wxGridCellAttr *attr) else { // restore the standard colours fonts - if ( m_colFgOld.Ok() ) + if ( m_colFgOld.IsOk() ) { m_control->SetForegroundColour(m_colFgOld); m_colFgOld = wxNullColour; } - if ( m_colBgOld.Ok() ) + if ( m_colBgOld.IsOk() ) { m_control->SetBackgroundColour(m_colBgOld); m_colBgOld = wxNullColour; @@ -314,7 +314,7 @@ void wxGridCellEditor::Show(bool show, wxGridCellAttr *attr) // Workaround for GTK+1 font setting problem on some platforms #if !defined(__WXGTK__) || defined(__WXGTK20__) - if ( m_fontOld.Ok() ) + if ( m_fontOld.IsOk() ) { m_control->SetFont(m_fontOld); m_fontOld = wxNullFont; @@ -862,10 +862,13 @@ wxString wxGridCellNumberEditor::GetValue() const // wxGridCellFloatEditor // ---------------------------------------------------------------------------- -wxGridCellFloatEditor::wxGridCellFloatEditor(int width, int precision) +wxGridCellFloatEditor::wxGridCellFloatEditor(int width, + int precision, + int format) { m_width = width; m_precision = precision; + m_style = format; } void wxGridCellFloatEditor::Create(wxWindow* parent, @@ -988,51 +991,113 @@ void wxGridCellFloatEditor::SetParameters(const wxString& params) // reset to default m_width = m_precision = -1; + m_style = wxGRID_FLOAT_FORMAT_DEFAULT; + m_format.clear(); } else { - long tmp; - if ( params.BeforeFirst(wxT(',')).ToLong(&tmp) ) + wxString rest; + wxString tmp = params.BeforeFirst(wxT(','), &rest); + if ( !tmp.empty() ) { - m_width = (int)tmp; - - if ( params.AfterFirst(wxT(',')).ToLong(&tmp) ) + long width; + if ( tmp.ToLong(&width) ) { - m_precision = (int)tmp; - - // skip the error message below - return; + m_width = (int)width; + } + else + { + wxLogDebug(wxT("Invalid wxGridCellFloatRenderer width parameter string '%s ignored"), params.c_str()); } } - wxLogDebug(wxT("Invalid wxGridCellFloatEditor parameter string '%s' ignored"), params.c_str()); + tmp = rest.BeforeFirst(wxT(',')); + if ( !tmp.empty() ) + { + long precision; + if ( tmp.ToLong(&precision) ) + { + m_precision = (int)precision; + } + else + { + wxLogDebug(wxT("Invalid wxGridCellFloatRenderer precision parameter string '%s ignored"), params.c_str()); + } + } + + tmp = rest.AfterFirst(wxT(',')); + if ( !tmp.empty() ) + { + if ( tmp[0] == wxT('f') ) + { + m_style = wxGRID_FLOAT_FORMAT_FIXED; + } + else if ( tmp[0] == wxT('e') ) + { + m_style = wxGRID_FLOAT_FORMAT_SCIENTIFIC; + } + else if ( tmp[0] == wxT('g') ) + { + m_style = wxGRID_FLOAT_FORMAT_COMPACT; + } + else if ( tmp[0] == wxT('E') ) + { + m_style = wxGRID_FLOAT_FORMAT_SCIENTIFIC | + wxGRID_FLOAT_FORMAT_UPPER; + } + else if ( tmp[0] == wxT('F') ) + { + m_style = wxGRID_FLOAT_FORMAT_FIXED | + wxGRID_FLOAT_FORMAT_UPPER; + } + else if ( tmp[0] == wxT('G') ) + { + m_style = wxGRID_FLOAT_FORMAT_COMPACT | + wxGRID_FLOAT_FORMAT_UPPER; + } + else + { + wxLogDebug("Invalid wxGridCellFloatRenderer format " + "parameter string '%s ignored", params); + } + } } } -wxString wxGridCellFloatEditor::GetString() const +wxString wxGridCellFloatEditor::GetString() { - wxString fmt; - if ( m_precision == -1 && m_width != -1) + if ( !m_format ) { - // default precision - fmt.Printf(wxT("%%%d.f"), m_width); - } - else if ( m_precision != -1 && m_width == -1) - { - // default width - fmt.Printf(wxT("%%.%df"), m_precision); - } - else if ( m_precision != -1 && m_width != -1 ) - { - fmt.Printf(wxT("%%%d.%df"), m_width, m_precision); - } - else - { - // default width/precision - fmt = wxT("%f"); + if ( m_precision == -1 && m_width != -1) + { + // default precision + m_format.Printf(wxT("%%%d."), m_width); + } + else if ( m_precision != -1 && m_width == -1) + { + // default width + m_format.Printf(wxT("%%.%d"), m_precision); + } + else if ( m_precision != -1 && m_width != -1 ) + { + m_format.Printf(wxT("%%%d.%d"), m_width, m_precision); + } + else + { + // default width/precision + m_format = wxT("%"); + } + + bool isUpper = (m_style & wxGRID_FLOAT_FORMAT_UPPER) != 0; + if ( m_style & wxGRID_FLOAT_FORMAT_SCIENTIFIC ) + m_format += isUpper ? wxT('E') : wxT('e'); + else if ( m_style & wxGRID_FLOAT_FORMAT_COMPACT ) + m_format += isUpper ? wxT('G') : wxT('g'); + else + m_format += wxT('f'); } - return wxString::Format(fmt, m_value); + return wxString::Format(m_format, m_value); } bool wxGridCellFloatEditor::IsAcceptedKey(wxKeyEvent& event) @@ -1349,6 +1414,29 @@ void wxGridCellChoiceEditor::Create(wxWindow* parent, wxGridCellEditor::Create(parent, id, evtHandler); } +void wxGridCellChoiceEditor::SetSize(const wxRect& rect) +{ + wxASSERT_MSG(m_control, + wxT("The wxGridCellChoiceEditor must be created first!")); + + // Check that the height is not too small to fit the combobox. + wxRect rectTallEnough = rect; + const wxSize bestSize = m_control->GetBestSize(); + const wxCoord diffY = bestSize.GetHeight() - rectTallEnough.GetHeight(); + if ( diffY > 0 ) + { + // Do make it tall enough. + rectTallEnough.height += diffY; + + // Also centre the effective rectangle vertically with respect to the + // original one. + rectTallEnough.y -= diffY/2; + } + //else: The rectangle provided is already tall enough. + + wxGridCellEditor::SetSize(rectTallEnough); +} + void wxGridCellChoiceEditor::PaintBackground(const wxRect& rectCell, wxGridCellAttr * attr) { @@ -1380,6 +1468,14 @@ void wxGridCellChoiceEditor::BeginEdit(int row, int col, wxGrid* grid) Combo()->SetFocus(); +#ifdef __WXOSX_COCOA__ + // This is a work around for the combobox being simply dismissed when a + // choice is made in it under OS X. The bug is almost certainly due to a + // problem in focus events generation logic but it's not obvious to fix and + // for now this at least allows to use wxGrid. + Combo()->Popup(); +#endif + if (evtHandler) { // When dropping down the menu, a kill focus event diff --git a/Externals/wxWidgets3/src/generic/gridsel.cpp b/Externals/wxWidgets3/src/generic/gridsel.cpp index 7f77177307..0d84cd8e49 100644 --- a/Externals/wxWidgets3/src/generic/gridsel.cpp +++ b/Externals/wxWidgets3/src/generic/gridsel.cpp @@ -4,7 +4,7 @@ // Author: Stefan Neis // Modified by: // Created: 20/02/1999 -// RCS-ID: $Id: gridsel.cpp 60078 2009-04-09 09:01:02Z VZ $ +// RCS-ID: $Id: gridsel.cpp 70177 2011-12-29 22:05:23Z VZ $ // Copyright: (c) Stefan Neis (Stefan.Neis@t-online.de) // Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// @@ -428,55 +428,101 @@ void wxGridSelection::SelectBlock( int topRow, int leftCol, size_t count, n; - // Remove single cells contained in newly selected block. - if ( m_selectionMode == wxGrid::wxGridSelectCells ) + if ( m_selectionMode == wxGrid::wxGridSelectRows ) { - count = m_cellSelection.GetCount(); - for ( n = 0; n < count; n++ ) + // find out which rows are already selected: + wxArrayInt alreadyselected; + alreadyselected.Add(0,bottomRow-topRow+1); + for( n = 0; n < m_rowSelection.GetCount(); n++) { - wxGridCellCoords& coords = m_cellSelection[n]; - if ( BlockContainsCell( topRow, leftCol, bottomRow, rightCol, - coords.GetRow(), coords.GetCol() ) ) + int row = m_rowSelection[n]; + if( (row >= topRow) && (row <= bottomRow) ) { - m_cellSelection.RemoveAt(n); - n--; - count--; + alreadyselected[ row - topRow ]=1; + } + } + + // add the newly selected rows: + for ( int row = topRow; row <= bottomRow; row++ ) + { + if ( alreadyselected[ row - topRow ] == 0 ) + { + m_rowSelection.Add( row ); } } } - - // If a block containing the selection is already selected, return, - // if a block contained in the selection is found, remove it. - - count = m_blockSelectionTopLeft.GetCount(); - for ( n = 0; n < count; n++ ) + else if ( m_selectionMode == wxGrid::wxGridSelectColumns ) { - wxGridCellCoords& coords1 = m_blockSelectionTopLeft[n]; - wxGridCellCoords& coords2 = m_blockSelectionBottomRight[n]; - - switch ( BlockContain( coords1.GetRow(), coords1.GetCol(), - coords2.GetRow(), coords2.GetCol(), - topRow, leftCol, bottomRow, rightCol ) ) + // find out which columns are already selected: + wxArrayInt alreadyselected; + alreadyselected.Add(0,rightCol-leftCol+1); + for( n = 0; n < m_colSelection.GetCount(); n++) { - case 1: - return; + int col = m_colSelection[n]; + if( (col >= leftCol) && (col <= rightCol) ) + { + alreadyselected[ col - leftCol ]=1; + } + } - case -1: - m_blockSelectionTopLeft.RemoveAt(n); - m_blockSelectionBottomRight.RemoveAt(n); - n--; - count--; - break; - - default: - break; + // add the newly selected columns: + for ( int col = leftCol; col <= rightCol; col++ ) + { + if ( alreadyselected[ col - leftCol ] == 0 ) + { + m_colSelection.Add( col ); + } } } - - // If a row containing the selection is already selected, return, - // if a row contained in newly selected block is found, remove it. - if ( m_selectionMode != wxGrid::wxGridSelectColumns ) + else { + // Remove single cells contained in newly selected block. + if ( m_selectionMode == wxGrid::wxGridSelectCells ) + { + count = m_cellSelection.GetCount(); + for ( n = 0; n < count; n++ ) + { + wxGridCellCoords& coords = m_cellSelection[n]; + if ( BlockContainsCell( topRow, leftCol, bottomRow, rightCol, + coords.GetRow(), coords.GetCol() ) ) + { + m_cellSelection.RemoveAt(n); + n--; + count--; + } + } + } + + // If a block containing the selection is already selected, return, + // if a block contained in the selection is found, remove it. + + count = m_blockSelectionTopLeft.GetCount(); + for ( n = 0; n < count; n++ ) + { + wxGridCellCoords& coords1 = m_blockSelectionTopLeft[n]; + wxGridCellCoords& coords2 = m_blockSelectionBottomRight[n]; + + switch ( BlockContain( coords1.GetRow(), coords1.GetCol(), + coords2.GetRow(), coords2.GetCol(), + topRow, leftCol, bottomRow, rightCol ) ) + { + case 1: + return; + + case -1: + m_blockSelectionTopLeft.RemoveAt(n); + m_blockSelectionBottomRight.RemoveAt(n); + n--; + count--; + break; + + default: + break; + } + } + + // If a row containing the selection is already selected, return, + // if a row contained in newly selected block is found, remove it. count = m_rowSelection.GetCount(); for ( n = 0; n < count; n++ ) { @@ -497,10 +543,8 @@ void wxGridSelection::SelectBlock( int topRow, int leftCol, break; } } - } - if ( m_selectionMode != wxGrid::wxGridSelectRows ) - { + // Same for columns. count = m_colSelection.GetCount(); for ( n = 0; n < count; n++ ) { @@ -521,11 +565,10 @@ void wxGridSelection::SelectBlock( int topRow, int leftCol, break; } } + + m_blockSelectionTopLeft.Add( wxGridCellCoords( topRow, leftCol ) ); + m_blockSelectionBottomRight.Add( wxGridCellCoords( bottomRow, rightCol ) ); } - - m_blockSelectionTopLeft.Add( wxGridCellCoords( topRow, leftCol ) ); - m_blockSelectionBottomRight.Add( wxGridCellCoords( bottomRow, rightCol ) ); - // Update View: if ( !m_grid->GetBatchCount() ) { @@ -552,29 +595,35 @@ void wxGridSelection::SelectCell( int row, int col, const wxKeyboardState& kbd, bool sendEvent ) { + if ( IsInSelection ( row, col ) ) + return; + + wxGridCellCoords selectedTopLeft, selectedBottomRight; if ( m_selectionMode == wxGrid::wxGridSelectRows ) { - SelectBlock(row, 0, row, m_grid->GetNumberCols() - 1, kbd, sendEvent); - - return; + m_rowSelection.Add( row ); + selectedTopLeft = wxGridCellCoords( row, 0 ); + selectedBottomRight = wxGridCellCoords( row, m_grid->GetNumberCols() - 1 ); } else if ( m_selectionMode == wxGrid::wxGridSelectColumns ) { - SelectBlock(0, col, m_grid->GetNumberRows() - 1, col, kbd, sendEvent); - - return; + m_colSelection.Add( col ); + selectedTopLeft = wxGridCellCoords( 0, col ); + selectedBottomRight = wxGridCellCoords( m_grid->GetNumberRows() - 1, col ); + } + else + { + m_cellSelection.Add( wxGridCellCoords( row, col ) ); + selectedTopLeft = wxGridCellCoords( row, col ); + selectedBottomRight = wxGridCellCoords( row, col ); } - else if ( IsInSelection ( row, col ) ) - return; - - m_cellSelection.Add( wxGridCellCoords( row, col ) ); // Update View: if ( !m_grid->GetBatchCount() ) { wxRect r = m_grid->BlockToDeviceRect( - wxGridCellCoords( row, col ), - wxGridCellCoords( row, col ) ); + selectedTopLeft, + selectedBottomRight ); ((wxWindow *)m_grid->m_gridWin)->Refresh( false, &r ); } @@ -584,8 +633,8 @@ void wxGridSelection::SelectCell( int row, int col, wxGridRangeSelectEvent gridEvt( m_grid->GetId(), wxEVT_GRID_RANGE_SELECT, m_grid, - wxGridCellCoords( row, col ), - wxGridCellCoords( row, col ), + selectedTopLeft, + selectedBottomRight, true, kbd); m_grid->GetEventHandler()->ProcessEvent( gridEvt ); diff --git a/Externals/wxWidgets3/src/generic/headerctrlg.cpp b/Externals/wxWidgets3/src/generic/headerctrlg.cpp index 105f90f7ef..a4735d7f07 100644 --- a/Externals/wxWidgets3/src/generic/headerctrlg.cpp +++ b/Externals/wxWidgets3/src/generic/headerctrlg.cpp @@ -3,7 +3,7 @@ // Purpose: generic wxHeaderCtrl implementation // Author: Vadim Zeitlin // Created: 2008-12-03 -// RCS-ID: $Id: headerctrlg.cpp 63575 2010-02-28 11:08:42Z VZ $ +// RCS-ID: $Id: headerctrlg.cpp 67384 2011-04-03 20:31:32Z DS $ // Copyright: (c) 2008 Vadim Zeitlin // Licence: wxWindows licence /////////////////////////////////////////////////////////////////////////////// @@ -180,7 +180,7 @@ unsigned int wxHeaderCtrl::FindColumnAtPoint(int x, bool *onSeparator) const pos += col.GetWidth(); - // if the column is resizeable, check if we're approximatively over the + // if the column is resizable, check if we're approximatively over the // line separating it from the next column // // TODO: don't hardcode sensitivity diff --git a/Externals/wxWidgets3/src/generic/htmllbox.cpp b/Externals/wxWidgets3/src/generic/htmllbox.cpp index b76cddeb44..1779404086 100644 --- a/Externals/wxWidgets3/src/generic/htmllbox.cpp +++ b/Externals/wxWidgets3/src/generic/htmllbox.cpp @@ -4,7 +4,7 @@ // Author: Vadim Zeitlin // Modified by: // Created: 31.05.03 -// RCS-ID: $Id: htmllbox.cpp 67254 2011-03-20 00:14:35Z DS $ +// RCS-ID: $Id: htmllbox.cpp 67681 2011-05-03 16:29:04Z DS $ // Copyright: (c) 2003 Vadim Zeitlin // Licence: wxWindows licence /////////////////////////////////////////////////////////////////////////////// @@ -308,7 +308,7 @@ void wxHtmlListBox::CacheItem(size_t n) const m_htmlParser->SetDC(new wxClientDC(self)); m_htmlParser->SetFS(&self->m_filesystem); #if !wxUSE_UNICODE - if (GetFont().Ok()) + if (GetFont().IsOk()) m_htmlParser->SetInputEncoding(GetFont().GetEncoding()); #endif // use system's default GUI font by default: diff --git a/Externals/wxWidgets3/src/generic/hyperlinkg.cpp b/Externals/wxWidgets3/src/generic/hyperlinkg.cpp index 7248f8e1e9..5a302817e5 100644 --- a/Externals/wxWidgets3/src/generic/hyperlinkg.cpp +++ b/Externals/wxWidgets3/src/generic/hyperlinkg.cpp @@ -4,7 +4,7 @@ // Author: David Norris , Otto Wyss // Modified by: Ryan Norton, Francesco Montorsi // Created: 04/02/2005 -// RCS-ID: $Id: hyperlinkg.cpp 65334 2010-08-17 16:55:32Z VZ $ +// RCS-ID: $Id: hyperlinkg.cpp 67948 2011-06-15 21:56:23Z VZ $ // Copyright: (c) 2005 David Norris // Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// @@ -41,6 +41,7 @@ #endif #include "wx/clipbrd.h" +#include "wx/renderer.h" // ============================================================================ // implementation @@ -89,6 +90,9 @@ bool wxGenericHyperlinkCtrl::Create(wxWindow *parent, wxWindowID id, // with GTK+'s native handling): Connect( wxEVT_PAINT, wxPaintEventHandler(wxGenericHyperlinkCtrl::OnPaint) ); + Connect( wxEVT_SET_FOCUS, wxFocusEventHandler(wxGenericHyperlinkCtrl::OnFocus) ); + Connect( wxEVT_KILL_FOCUS, wxFocusEventHandler(wxGenericHyperlinkCtrl::OnFocus) ); + Connect( wxEVT_CHAR, wxKeyEventHandler(wxGenericHyperlinkCtrl::OnChar) ); Connect( wxEVT_LEAVE_WINDOW, wxMouseEventHandler(wxGenericHyperlinkCtrl::OnLeaveWindow) ); Connect( wxEVT_LEFT_DOWN, wxMouseEventHandler(wxGenericHyperlinkCtrl::OnLeftDown) ); @@ -187,6 +191,32 @@ void wxGenericHyperlinkCtrl::OnPaint(wxPaintEvent& WXUNUSED(event)) dc.SetTextBackground(GetBackgroundColour()); dc.DrawText(GetLabel(), GetLabelRect().GetTopLeft()); + if (HasFocus()) + { + wxRendererNative::Get().DrawFocusRect(this, dc, GetClientRect(), wxCONTROL_SELECTED); + } +} + +void wxGenericHyperlinkCtrl::OnFocus(wxFocusEvent& event) +{ + Refresh(); + event.Skip(); +} + +void wxGenericHyperlinkCtrl::OnChar(wxKeyEvent& event) +{ + switch (event.m_keyCode) + { + default: + event.Skip(); + break; + case WXK_SPACE: + case WXK_NUMPAD_SPACE: + SetForegroundColour(m_visitedColour); + m_visited = true; + SendEvent(); + break; + } } void wxGenericHyperlinkCtrl::OnLeftDown(wxMouseEvent& event) diff --git a/Externals/wxWidgets3/src/generic/imaglist.cpp b/Externals/wxWidgets3/src/generic/imaglist.cpp index 60fd71eae2..79c28ae14e 100644 --- a/Externals/wxWidgets3/src/generic/imaglist.cpp +++ b/Externals/wxWidgets3/src/generic/imaglist.cpp @@ -2,7 +2,7 @@ // Name: src/generic/imaglist.cpp // Purpose: // Author: Robert Roebling -// Id: $Id: imaglist.cpp 67280 2011-03-22 14:17:38Z DS $ +// Id: $Id: imaglist.cpp 70345 2012-01-15 01:05:28Z VZ $ // Copyright: (c) 1998 Robert Roebling // Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// @@ -16,8 +16,6 @@ #if wxUSE_IMAGLIST && !defined(wxHAS_NATIVE_IMAGELIST) -#ifndef __WXPALMOS__ - #include "wx/imaglist.h" #ifndef WX_PRECOMP @@ -106,7 +104,7 @@ int wxGenericImageList::Add( const wxBitmap &bitmap ) int wxGenericImageList::Add( const wxBitmap& bitmap, const wxBitmap& mask ) { wxBitmap bmp(bitmap); - if (mask.Ok()) + if (mask.IsOk()) bmp.SetMask(new wxMask(mask)); return Add(bmp); } @@ -214,7 +212,7 @@ bool wxGenericImageList::Replace( int index, const wxBitmap &bitmap, const wxBit m_images.Insert( next, newBitmap ); } - if (mask.Ok()) + if (mask.IsOk()) newBitmap->SetMask(new wxMask(mask)); return true; @@ -273,6 +271,4 @@ bool wxGenericImageList::Draw( int index, wxDC &dc, int x, int y, return true; } -#endif // __WXPALMOS__ - #endif // wxUSE_IMAGLIST diff --git a/Externals/wxWidgets3/src/generic/listctrl.cpp b/Externals/wxWidgets3/src/generic/listctrl.cpp index 97cb983eb9..4f7fe3c9ec 100644 --- a/Externals/wxWidgets3/src/generic/listctrl.cpp +++ b/Externals/wxWidgets3/src/generic/listctrl.cpp @@ -3,7 +3,7 @@ // Purpose: generic implementation of wxListCtrl // Author: Robert Roebling // Vadim Zeitlin (virtual list control support) -// Id: $Id: listctrl.cpp 67280 2011-03-22 14:17:38Z DS $ +// Id: $Id: listctrl.cpp 70368 2012-01-16 13:37:18Z VZ $ // Copyright: (c) 1998 Robert Roebling // Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// @@ -342,12 +342,23 @@ bool wxListHeaderData::IsHit( int x, int y ) const void wxListHeaderData::GetItem( wxListItem& item ) { - item.m_mask = m_mask; - item.m_text = m_text; - item.m_image = m_image; - item.m_format = m_format; - item.m_width = m_width; - item.m_state = m_state; + long mask = item.m_mask; + if ( !mask ) + { + // by default, get everything for backwards compatibility + mask = -1; + } + + if ( mask & wxLIST_MASK_STATE ) + item.m_state = m_state; + if ( mask & wxLIST_MASK_TEXT ) + item.m_text = m_text; + if ( mask & wxLIST_MASK_IMAGE ) + item.m_image = m_image; + if ( mask & wxLIST_MASK_WIDTH ) + item.m_width = m_width; + if ( mask & wxLIST_MASK_FORMAT ) + item.m_format = m_format; } int wxListHeaderData::GetImage() const @@ -1461,6 +1472,12 @@ bool wxListTextCtrlWrapper::AcceptChanges() } void wxListTextCtrlWrapper::OnChar( wxKeyEvent &event ) +{ + if ( !CheckForEndEditKey(event) ) + event.Skip(); +} + +bool wxListTextCtrlWrapper::CheckForEndEditKey(const wxKeyEvent& event) { switch ( event.m_keyCode ) { @@ -1473,8 +1490,10 @@ void wxListTextCtrlWrapper::OnChar( wxKeyEvent &event ) break; default: - event.Skip(); + return false; } + + return true; } void wxListTextCtrlWrapper::OnKeyUp( wxKeyEvent &event ) @@ -1518,6 +1537,7 @@ void wxListTextCtrlWrapper::OnKillFocus( wxFocusEvent &event ) BEGIN_EVENT_TABLE(wxListMainWindow, wxWindow) EVT_PAINT (wxListMainWindow::OnPaint) EVT_MOUSE_EVENTS (wxListMainWindow::OnMouse) + EVT_CHAR_HOOK (wxListMainWindow::OnCharHook) EVT_CHAR (wxListMainWindow::OnChar) EVT_KEY_DOWN (wxListMainWindow::OnKeyDown) EVT_KEY_UP (wxListMainWindow::OnKeyUp) @@ -2023,6 +2043,7 @@ void wxListMainWindow::OnPaint( wxPaintEvent &WXUNUSED(event) ) GetParent()->GetId()); evCache.SetEventObject( GetParent() ); evCache.m_oldItemIndex = visibleFrom; + evCache.m_item.m_itemId = evCache.m_itemIndex = visibleTo; GetParent()->GetEventHandler()->ProcessEvent( evCache ); } @@ -2153,6 +2174,7 @@ void wxListMainWindow::SendNotify( size_t line, wxListEvent le( command, GetParent()->GetId() ); le.SetEventObject( GetParent() ); + le.m_item.m_itemId = le.m_itemIndex = line; // set only for events which have position @@ -2200,6 +2222,7 @@ wxTextCtrl *wxListMainWindow::EditLabel(long item, wxClassInfo* textControlClass wxListEvent le( wxEVT_COMMAND_LIST_BEGIN_LABEL_EDIT, GetParent()->GetId() ); le.SetEventObject( GetParent() ); + le.m_item.m_itemId = le.m_itemIndex = item; wxListLineData *data = GetLine(itemEdit); wxCHECK_MSG( data, NULL, wxT("invalid index in EditLabel()") ); @@ -2242,6 +2265,7 @@ bool wxListMainWindow::OnRenameAccept(size_t itemEdit, const wxString& value) { wxListEvent le( wxEVT_COMMAND_LIST_END_LABEL_EDIT, GetParent()->GetId() ); le.SetEventObject( GetParent() ); + le.m_item.m_itemId = le.m_itemIndex = itemEdit; wxListLineData *data = GetLine(itemEdit); @@ -2262,6 +2286,7 @@ void wxListMainWindow::OnRenameCancelled(size_t itemEdit) le.SetEditCanceled(true); le.SetEventObject( GetParent() ); + le.m_item.m_itemId = le.m_itemIndex = itemEdit; wxListLineData *data = GetLine(itemEdit); @@ -2346,37 +2371,19 @@ void wxListMainWindow::OnMouse( wxMouseEvent &event ) } } + // Update drag events counter first as we must do it even if the mouse is + // not on any item right now as we must keep count in case we started + // dragging from the empty control area but continued to do it over a valid + // item -- in this situation we must not start dragging this item. if (event.Dragging()) - { - if (m_dragCount == 0) - { - // we have to report the raw, physical coords as we want to be - // able to call HitTest(event.m_pointDrag) from the user code to - // get the item being dragged - m_dragStart = event.GetPosition(); - } - m_dragCount++; - - if (m_dragCount != 3) - return; - - int command = event.RightIsDown() ? wxEVT_COMMAND_LIST_BEGIN_RDRAG - : wxEVT_COMMAND_LIST_BEGIN_DRAG; - - wxListEvent le( command, GetParent()->GetId() ); - le.SetEventObject( GetParent() ); - le.m_itemIndex = m_lineLastClicked; - le.m_pointDrag = m_dragStart; - GetParent()->GetEventHandler()->ProcessEvent( le ); - - return; - } else - { m_dragCount = 0; - } + // The only mouse event that can be generated without any valid item is + // wxEVT_COMMAND_LIST_ITEM_RIGHT_CLICK as it can be useful to have a global + // popup menu for the list control itself which should be shown even when + // the user clicks outside of any item. if ( !hitResult ) { // outside of any item @@ -2400,6 +2407,27 @@ void wxListMainWindow::OnMouse( wxMouseEvent &event ) return; } + if ( event.Dragging() ) + { + if (m_dragCount == 1) + { + // we have to report the raw, physical coords as we want to be + // able to call HitTest(event.m_pointDrag) from the user code to + // get the item being dragged + m_dragStart = event.GetPosition(); + } + + if (m_dragCount != 3) + return; + + int command = event.RightIsDown() ? wxEVT_COMMAND_LIST_BEGIN_RDRAG + : wxEVT_COMMAND_LIST_BEGIN_DRAG; + + SendNotify( m_lineLastClicked, command, m_dragStart ); + + return; + } + bool forceClick = false; if (event.ButtonDClick()) { @@ -2690,6 +2718,7 @@ void wxListMainWindow::OnKeyDown( wxKeyEvent &event ) // send a list event wxListEvent le( wxEVT_COMMAND_LIST_KEY_DOWN, parent->GetId() ); + le.m_item.m_itemId = le.m_itemIndex = m_current; if (HasCurrent()) GetLine(m_current)->GetItem( 0, le.m_item ); @@ -2713,6 +2742,22 @@ void wxListMainWindow::OnKeyUp( wxKeyEvent &event ) event.Skip(); } +void wxListMainWindow::OnCharHook( wxKeyEvent &event ) +{ + if ( m_textctrlWrapper ) + { + // When an in-place editor is active we should ensure that it always + // gets the key events that are special to it. + if ( m_textctrlWrapper->CheckForEndEditKey(event) ) + { + // Skip the call to wxEvent::Skip() below. + return; + } + } + + event.Skip(); +} + void wxListMainWindow::OnChar( wxKeyEvent &event ) { wxWindow *parent = GetParent(); @@ -2932,17 +2977,6 @@ void wxListMainWindow::GetImageSize( int index, int &width, int &height ) const } } -int wxListMainWindow::GetTextLength( const wxString &s ) const -{ - wxClientDC dc( wxConstCast(this, wxListMainWindow) ); - dc.SetFont( GetFont() ); - - wxCoord lw; - dc.GetTextExtent( s, &lw, NULL ); - - return lw + AUTOSIZE_COL_MARGIN; -} - void wxListMainWindow::SetImageList( wxImageList *imageList, int which ) { m_dirty = true; @@ -2985,18 +3019,42 @@ int wxListMainWindow::GetItemSpacing( bool isSmall ) // columns // ---------------------------------------------------------------------------- -void wxListMainWindow::SetColumn( int col, wxListItem &item ) +int +wxListMainWindow::ComputeMinHeaderWidth(const wxListHeaderData* column) const +{ + wxClientDC dc(const_cast(this)); + + int width = dc.GetTextExtent(column->GetText()).x + AUTOSIZE_COL_MARGIN; + + width += 2*EXTRA_WIDTH; + + // check for column header's image availability + const int image = column->GetImage(); + if ( image != -1 ) + { + if ( m_small_image_list ) + { + int ix = 0, iy = 0; + m_small_image_list->GetSize(image, ix, iy); + width += ix + HEADER_IMAGE_MARGIN_IN_REPORT_MODE; + } + } + + return width; +} + +void wxListMainWindow::SetColumn( int col, const wxListItem &item ) { wxListHeaderDataList::compatibility_iterator node = m_columns.Item( col ); wxCHECK_RET( node, wxT("invalid column index in SetColumn") ); - if ( item.m_width == wxLIST_AUTOSIZE_USEHEADER ) - item.m_width = GetTextLength( item.m_text ); - wxListHeaderData *column = node->GetData(); column->SetItem( item ); + if ( item.m_width == wxLIST_AUTOSIZE_USEHEADER ) + column->SetWidth(ComputeMinHeaderWidth(column)); + wxListHeaderWindow *headerWin = GetListCtrl()->m_headerWin; if ( headerWin ) headerWin->m_dirty = true; @@ -3030,29 +3088,13 @@ void wxListMainWindow::SetColumnWidth( int col, int width ) if (width == wxLIST_AUTOSIZE_USEHEADER) { - width = GetTextLength(column->GetText()); - width += 2*EXTRA_WIDTH; - - // check for column header's image availability - const int image = column->GetImage(); - if ( image != -1 ) - { - if ( m_small_image_list ) - { - int ix = 0, iy = 0; - m_small_image_list->GetSize(image, ix, iy); - width += ix + HEADER_IMAGE_MARGIN_IN_REPORT_MODE; - } - } + width = ComputeMinHeaderWidth(column); } else if ( width == wxLIST_AUTOSIZE ) { - if ( IsVirtual() ) - { - // TODO: determine the max width somehow... - width = WIDTH_COL_DEFAULT; - } - else // !virtual + width = ComputeMinHeaderWidth(column); + + if ( !IsVirtual() ) { wxClientDC dc(this); dc.SetFont( GetFont() ); @@ -3082,8 +3124,9 @@ void wxListMainWindow::SetColumnWidth( int col, int width ) m_aColWidths.Item(col)->nMaxWidth = max; } - max = m_aColWidths.Item(col)->nMaxWidth; - width = max + AUTOSIZE_COL_MARGIN; + max = m_aColWidths.Item(col)->nMaxWidth + AUTOSIZE_COL_MARGIN; + if ( width < max ) + width = max; } } @@ -3156,10 +3199,14 @@ void wxListMainWindow::SetItem( wxListItem &item ) } } - // update the item on screen - wxRect rectItem; - GetItemRect(id, rectItem); - RefreshRect(rectItem); + // update the item on screen unless we're going to update everything soon + // anyhow + if ( !m_dirty ) + { + wxRect rectItem; + GetItemRect(id, rectItem); + RefreshRect(rectItem); + } } void wxListMainWindow::SetItemStateAll(long state, long stateMask) @@ -3604,6 +3651,9 @@ void wxListMainWindow::RecalculatePositions(bool noRefresh) int x = EXTRA_BORDER_X; int y = EXTRA_BORDER_Y; + + // Note that "row" here is vertical, i.e. what is called + // "column" in many other places in wxWidgets. int maxWidthInThisRow = 0; m_linesPerPage = 0; @@ -3625,8 +3675,24 @@ void wxListMainWindow::RecalculatePositions(bool noRefresh) if (currentlyVisibleLines > m_linesPerPage) m_linesPerPage = currentlyVisibleLines; - if ( y + sizeLine.y >= clientHeight ) + // Have we reached the end of the row either because no + // more items would fit or because there are simply no more + // items? + if ( y + sizeLine.y >= clientHeight + || i == count - 1) { + // Adjust all items in this row to have the same + // width to ensure that they all align horizontally in + // icon view. + if ( HasFlag(wxLC_ICON) || HasFlag(wxLC_SMALL_ICON) ) + { + size_t firstRowLine = i - currentlyVisibleLines + 1; + for (size_t j = firstRowLine; j <= i; j++) + { + GetLine(j)->m_gi->ExtendWidth(maxWidthInThisRow); + } + } + currentlyVisibleLines = 0; y = EXTRA_BORDER_Y; maxWidthInThisRow += MARGIN_BETWEEN_ROWS; @@ -3635,10 +3701,6 @@ void wxListMainWindow::RecalculatePositions(bool noRefresh) maxWidthInThisRow = 0; } - // We have reached the last item. - if ( i == count - 1 ) - entireWidth += maxWidthInThisRow; - if ( (tries == 0) && (entireWidth + SCROLL_UNIT_X > clientWidth) ) { @@ -3811,6 +3873,21 @@ void wxListMainWindow::DeleteColumn( int col ) for ( size_t i = 0; i < m_lines.GetCount(); i++ ) { wxListLineData * const line = GetLine(i); + + // In the following atypical but possible scenario it can be + // legal to call DeleteColumn() but the items may not have any + // values for it: + // 1. In report view, insert a second column. + // 2. Still in report view, add an item with 2 values. + // 3. Switch to an icon (or list) view. + // 4. Add an item -- necessarily with 1 value only. + // 5. Switch back to report view. + // 6. Call DeleteColumn(). + // So we need to check for this as otherwise we would simply crash + // if this happens. + if ( line->m_items.GetCount() <= static_cast(col) ) + continue; + wxListItemDataList::compatibility_iterator n = line->m_items.Item( col ); delete n->GetData(); line->m_items.Erase(n); @@ -4027,6 +4104,19 @@ void wxListMainWindow::InsertItem( wxListItem &item ) wxListLineData *line = new wxListLineData(this); line->SetItem( item.m_col, item ); + if ( item.m_mask & wxLIST_MASK_IMAGE ) + { + // Reset the buffered height if it's not big enough for the new image. + int image = item.GetImage(); + if ( m_small_image_list && image != -1 && InReportView() ) + { + int imageWidth, imageHeight; + m_small_image_list->GetSize(image, imageWidth, imageHeight); + + if ( imageHeight > m_lineHeight ) + m_lineHeight = 0; + } + } m_lines.Insert( line, id ); @@ -4043,15 +4133,15 @@ void wxListMainWindow::InsertItem( wxListItem &item ) RefreshLines(id, GetItemCount() - 1); } -void wxListMainWindow::InsertColumn( long col, wxListItem &item ) +void wxListMainWindow::InsertColumn( long col, const wxListItem &item ) { m_dirty = true; if ( InReportView() ) { - if (item.m_width == wxLIST_AUTOSIZE_USEHEADER) - item.m_width = GetTextLength( item.m_text ); - wxListHeaderData *column = new wxListHeaderData( item ); + if (item.m_width == wxLIST_AUTOSIZE_USEHEADER) + column->SetWidth(ComputeMinHeaderWidth(column)); + wxColWidthInfo *colWidthInfo = new wxColWidthInfo(); bool insert = (col >= 0) && ((size_t)col < m_columns.GetCount()); @@ -4221,7 +4311,7 @@ void wxListMainWindow::GetVisibleLinesRange(size_t *from, size_t *to) IMPLEMENT_DYNAMIC_CLASS(wxGenericListCtrl, wxControl) -BEGIN_EVENT_TABLE(wxGenericListCtrl,wxControl) +BEGIN_EVENT_TABLE(wxGenericListCtrl,wxListCtrlBase) EVT_SIZE(wxGenericListCtrl::OnSize) EVT_SCROLLWIN(wxGenericListCtrl::OnScroll) END_EVENT_TABLE() @@ -4301,7 +4391,9 @@ bool wxGenericListCtrl::Create(wxWindow *parent, wxASSERT_MSG( (style & wxLC_MASK_TYPE), wxT("wxListCtrl style should have exactly one mode bit set") ); - if ( !wxControl::Create( parent, id, pos, size, style|wxVSCROLL|wxHSCROLL, validator, name ) ) + if ( !wxListCtrlBase::Create( parent, id, pos, size, + style | wxVSCROLL | wxHSCROLL, + validator, name ) ) return false; #ifdef __WXGTK__ @@ -4339,7 +4431,7 @@ WXLRESULT wxGenericListCtrl::MSWWindowProc(WXUINT nMsg, WXWPARAM wParam, WXLPARAM lParam) { - WXLRESULT rc = wxControl::MSWWindowProc(nMsg, wParam, lParam); + WXLRESULT rc = wxListCtrlBase::MSWWindowProc(nMsg, wParam, lParam); // we need to process arrows ourselves for scrolling if ( nMsg == WM_GETDLGCODE ) @@ -4447,7 +4539,7 @@ bool wxGenericListCtrl::GetColumn(int col, wxListItem &item) const return true; } -bool wxGenericListCtrl::SetColumn( int col, wxListItem& item ) +bool wxGenericListCtrl::SetColumn( int col, const wxListItem& item ) { m_mainWin->SetColumn( col, item ); return true; @@ -4782,6 +4874,10 @@ bool wxGenericListCtrl::DeleteColumn( int col ) // if we don't have the header any longer, we need to relayout the window // if ( !GetColumnCount() ) + + // Ensure that the non-existent columns are really removed from display. + Refresh(); + return true; } @@ -4853,12 +4949,14 @@ long wxGenericListCtrl::InsertItem( long index, const wxString &label, int image wxListItem info; info.m_text = label; info.m_image = imageIndex; - info.m_mask = wxLIST_MASK_TEXT | wxLIST_MASK_IMAGE; + info.m_mask = wxLIST_MASK_TEXT; + if (imageIndex > -1) + info.m_mask |= wxLIST_MASK_IMAGE; info.m_itemId = index; return InsertItem( info ); } -long wxGenericListCtrl::InsertColumn( long col, wxListItem &item ) +long wxGenericListCtrl::DoInsertColumn( long col, const wxListItem &item ) { wxCHECK_MSG( InReportView(), -1, wxT("can't add column in non report mode") ); @@ -4872,23 +4970,6 @@ long wxGenericListCtrl::InsertColumn( long col, wxListItem &item ) return 0; } -long wxGenericListCtrl::InsertColumn( long col, const wxString &heading, - int format, int width ) -{ - wxListItem item; - item.m_mask = wxLIST_MASK_TEXT | wxLIST_MASK_FORMAT; - item.m_text = heading; - if (width >= -2) - { - item.m_mask |= wxLIST_MASK_WIDTH; - item.m_width = width; - } - - item.m_format = format; - - return InsertColumn( col, item ); -} - bool wxGenericListCtrl::ScrollList( int dx, int dy ) { return m_mainWin->ScrollList(dx, dy); @@ -5060,7 +5141,7 @@ void wxGenericListCtrl::DoClientToScreen( int *x, int *y ) const if ( m_mainWin ) m_mainWin->DoClientToScreen(x, y); else - wxControl::DoClientToScreen(x, y); + wxListCtrlBase::DoClientToScreen(x, y); } void wxGenericListCtrl::DoScreenToClient( int *x, int *y ) const @@ -5070,7 +5151,7 @@ void wxGenericListCtrl::DoScreenToClient( int *x, int *y ) const if ( m_mainWin ) m_mainWin->DoScreenToClient(x, y); else - wxControl::DoScreenToClient(x, y); + wxListCtrlBase::DoScreenToClient(x, y); } void wxGenericListCtrl::SetFocus() diff --git a/Externals/wxWidgets3/src/generic/logg.cpp b/Externals/wxWidgets3/src/generic/logg.cpp index 06e7b0cb5d..e40376598f 100644 --- a/Externals/wxWidgets3/src/generic/logg.cpp +++ b/Externals/wxWidgets3/src/generic/logg.cpp @@ -5,7 +5,7 @@ // Author: Vadim Zeitlin // Modified by: // Created: 20.09.99 (extracted from src/common/log.cpp) -// RCS-ID: $Id: logg.cpp 66503 2010-12-31 17:38:51Z VZ $ +// RCS-ID: $Id: logg.cpp 70671 2012-02-22 17:35:21Z JS $ // Copyright: (c) 1998 Vadim Zeitlin // Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// @@ -73,7 +73,7 @@ #include #endif -#include "wx/datetime.h" +#include "wx/time.h" // the suffix we add to the button to show that the dialog can be expanded #define EXPAND_SUFFIX wxT(" >>") @@ -90,7 +90,6 @@ // allows to exclude the usage of wxDateTime static wxString TimeStamp(const wxString& format, time_t t) { -#if wxUSE_DATETIME wxChar buf[4096]; struct tm tm; if ( !wxStrftime(buf, WXSIZEOF(buf), format, wxLocaltime_r(&t, &tm)) ) @@ -99,9 +98,6 @@ static wxString TimeStamp(const wxString& format, time_t t) wxFAIL_MSG(wxT("strftime() failed")); } return wxString(buf); -#else // !wxUSE_DATETIME - return wxEmptyString; -#endif // wxUSE_DATETIME/!wxUSE_DATETIME } @@ -521,7 +517,7 @@ wxLogFrame::wxLogFrame(wxWindow *pParent, wxLogWindow *log, const wxString& szTi wxMenuBar *pMenuBar = new wxMenuBar; wxMenu *pMenu = new wxMenu; #if CAN_SAVE_FILES - pMenu->Append(Menu_Save, _("&Save..."), _("Save log contents to file")); + pMenu->Append(Menu_Save, _("Save &As..."), _("Save log contents to file")); #endif // CAN_SAVE_FILES pMenu->Append(Menu_Clear, _("C&lear"), _("Clear the log contents")); pMenu->AppendSeparator(); @@ -726,7 +722,7 @@ wxLogDialog::wxLogDialog(wxWindow *parent, bool isPda = (wxSystemSettings::GetScreenType() <= wxSYS_SCREEN_PDA); // create the controls which are always shown and layout them: we use - // sizers even though our window is not resizeable to calculate the size of + // sizers even though our window is not resizable to calculate the size of // the dialog properly wxBoxSizer *sizerTop = new wxBoxSizer(wxVERTICAL); wxBoxSizer *sizerAll = new wxBoxSizer(isPda ? wxVERTICAL : wxHORIZONTAL); @@ -757,11 +753,17 @@ wxLogDialog::wxLogDialog(wxWindow *parent, // add the details pane #ifndef __SMARTPHONE__ + +#if wxUSE_COLLPANE wxCollapsiblePane * const collpane = new wxCollapsiblePane(this, wxID_ANY, ms_details); sizerTop->Add(collpane, wxSizerFlags(1).Expand().Border()); wxWindow *win = collpane->GetPane(); +#else + wxPanel* win = new wxPanel(this, wxID_ANY, wxDefaultPosition, wxDefaultSize, + wxBORDER_NONE); +#endif wxSizer * const paneSz = new wxBoxSizer(wxVERTICAL); CreateDetailsControls(win); @@ -850,7 +852,7 @@ void wxLogDialog::CreateDetailsControls(wxWindow *parent) // This may very well fail if there are insufficient colours available. // Degrade gracefully. - if ( !bmp.Ok() ) + if ( !bmp.IsOk() ) { loadedIcons = false; diff --git a/Externals/wxWidgets3/src/generic/mask.cpp b/Externals/wxWidgets3/src/generic/mask.cpp index 69d6cfaf74..a7ea34ad2a 100644 --- a/Externals/wxWidgets3/src/generic/mask.cpp +++ b/Externals/wxWidgets3/src/generic/mask.cpp @@ -3,7 +3,7 @@ // Purpose: generic wxMask implementation // Author: Vadim Zeitlin // Created: 2006-09-28 -// RCS-ID: $Id: mask.cpp 41495 2006-09-28 23:02:39Z VZ $ +// RCS-ID: $Id: mask.cpp 67681 2011-05-03 16:29:04Z DS $ // Copyright: (c) 2006 Vadim Zeitlin // Licence: wxWindows licence /////////////////////////////////////////////////////////////////////////////// @@ -49,12 +49,12 @@ bool wxMask::InitFromColour(const wxBitmap& bitmap, const wxColour& colour) wxImage imgSrc(bitmap.ConvertToImage()); imgSrc.SetMask(false); wxImage image(imgSrc.ConvertToMono(clr.Red(), clr.Green(), clr.Blue())); - if ( !image.Ok() ) + if ( !image.IsOk() ) return false; m_bitmap = wxBitmap(image, 1); - return m_bitmap.Ok(); + return m_bitmap.IsOk(); #else // !wxUSE_IMAGE wxUnusedVar(bitmap); wxUnusedVar(colour); @@ -65,7 +65,7 @@ bool wxMask::InitFromColour(const wxBitmap& bitmap, const wxColour& colour) bool wxMask::InitFromMonoBitmap(const wxBitmap& bitmap) { - wxCHECK_MSG( bitmap.Ok(), false, wxT("Invalid bitmap") ); + wxCHECK_MSG( bitmap.IsOk(), false, wxT("Invalid bitmap") ); wxCHECK_MSG( bitmap.GetDepth() == 1, false, wxT("Cannot create mask from colour bitmap") ); m_bitmap = bitmap; diff --git a/Externals/wxWidgets3/src/generic/msgdlgg.cpp b/Externals/wxWidgets3/src/generic/msgdlgg.cpp index e5532d8cc5..fe1e70f82a 100644 --- a/Externals/wxWidgets3/src/generic/msgdlgg.cpp +++ b/Externals/wxWidgets3/src/generic/msgdlgg.cpp @@ -4,7 +4,7 @@ // Author: Julian Smart, Robert Roebling // Modified by: // Created: 04/01/98 -// RCS-ID: $Id: msgdlgg.cpp 65450 2010-08-30 21:48:25Z VZ $ +// RCS-ID: $Id: msgdlgg.cpp 68537 2011-08-04 22:53:42Z VZ $ // Copyright: (c) Julian Smart and Robert Roebling // Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// @@ -74,6 +74,7 @@ protected: BEGIN_EVENT_TABLE(wxGenericMessageDialog, wxDialog) EVT_BUTTON(wxID_YES, wxGenericMessageDialog::OnYes) EVT_BUTTON(wxID_NO, wxGenericMessageDialog::OnNo) + EVT_BUTTON(wxID_HELP, wxGenericMessageDialog::OnHelp) EVT_BUTTON(wxID_CANCEL, wxGenericMessageDialog::OnCancel) END_EVENT_TABLE() @@ -133,6 +134,13 @@ wxSizer *wxGenericMessageDialog::CreateMsgDlgButtonSizer() btnDef = yes; } + if ( m_dialogStyle & wxHELP ) + { + wxButton * const + help = new wxButton(this, wxID_HELP, GetCustomHelpLabel()); + sizerStd->AddButton(help); + } + if ( btnDef ) { btnDef->SetDefault(); @@ -148,7 +156,7 @@ wxSizer *wxGenericMessageDialog::CreateMsgDlgButtonSizer() // Use standard labels for all buttons return CreateSeparatedButtonSizer ( - m_dialogStyle & (wxOK | wxCANCEL | wxYES_NO | + m_dialogStyle & (wxOK | wxCANCEL | wxHELP | wxYES_NO | wxNO_DEFAULT | wxCANCEL_DEFAULT) ); } @@ -242,6 +250,11 @@ void wxGenericMessageDialog::OnNo(wxCommandEvent& WXUNUSED(event)) EndModal( wxID_NO ); } +void wxGenericMessageDialog::OnHelp(wxCommandEvent& WXUNUSED(event)) +{ + EndModal( wxID_HELP ); +} + void wxGenericMessageDialog::OnCancel(wxCommandEvent& WXUNUSED(event)) { // Allow cancellation via ESC/Close button except if diff --git a/Externals/wxWidgets3/src/generic/odcombo.cpp b/Externals/wxWidgets3/src/generic/odcombo.cpp index 635932107c..91d1c3ffa3 100644 --- a/Externals/wxWidgets3/src/generic/odcombo.cpp +++ b/Externals/wxWidgets3/src/generic/odcombo.cpp @@ -4,7 +4,7 @@ // Author: Jaakko Salli // Modified by: // Created: Apr-30-2006 -// RCS-ID: $Id: odcombo.cpp 66728 2011-01-22 14:38:36Z DS $ +// RCS-ID: $Id: odcombo.cpp 70625 2012-02-19 14:49:37Z SN $ // Copyright: (c) 2005 Jaakko Salli // Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// @@ -375,7 +375,7 @@ bool wxVListBoxComboPopup::HandleKey( int keycode, bool saturate, wxChar keychar // The m_combo->SetValue() call above sets m_value to the index of this // string. But if there are more identical string, the index is of the - // first occurence, which may be wrong, so set the index explicitly here, + // first occurrence, which may be wrong, so set the index explicitly here, // _after_ the SetValue() call. m_value = value; @@ -902,7 +902,6 @@ wxOwnerDrawnComboBox::wxOwnerDrawnComboBox(wxWindow *parent, long style, const wxValidator& validator, const wxString& name) - : wxComboCtrl() { Init(); diff --git a/Externals/wxWidgets3/src/generic/panelg.cpp b/Externals/wxWidgets3/src/generic/panelg.cpp deleted file mode 100644 index 75468ab942..0000000000 --- a/Externals/wxWidgets3/src/generic/panelg.cpp +++ /dev/null @@ -1,69 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// Name: src/generic/panelg.cpp -// Purpose: Generic wxPanel implementation. -// Author: Vadim Zeitlin -// Created: 2011-03-20 -// RCS-ID: $Id: panelg.cpp 67258 2011-03-20 11:50:47Z VZ $ -// Copyright: (c) 2011 Vadim Zeitlin -// Licence: wxWindows licence -/////////////////////////////////////////////////////////////////////////////// - -// ============================================================================ -// declarations -// ============================================================================ - -// ---------------------------------------------------------------------------- -// headers -// ---------------------------------------------------------------------------- - -// for compilers that support precompilation, includes "wx.h". -#include "wx/wxprec.h" - -#ifdef __BORLANDC__ - #pragma hdrstop -#endif - -#ifndef WX_PRECOMP - #include "wx/dc.h" - #include "wx/panel.h" -#endif // WX_PRECOMP - -#ifdef wxHAS_GENERIC_PANEL - -// ============================================================================ -// implementation -// ============================================================================ - -void wxPanel::DoSetBackgroundBitmap(const wxBitmap& bmp) -{ - m_bitmapBg = bmp; - - if ( m_bitmapBg.IsOk() ) - { - Connect(wxEVT_ERASE_BACKGROUND, - wxEraseEventHandler(wxPanel::OnEraseBackground)); - } - else - { - Disconnect(wxEVT_ERASE_BACKGROUND, - wxEraseEventHandler(wxPanel::OnEraseBackground)); - } -} - -void wxPanel::OnEraseBackground(wxEraseEvent& event) -{ - wxDC& dc = *event.GetDC(); - - const wxSize clientSize = GetClientSize(); - const wxSize bitmapSize = m_bitmapBg.GetSize(); - - for ( int x = 0; x < clientSize.x; x += bitmapSize.x ) - { - for ( int y = 0; y < clientSize.y; y += bitmapSize.y ) - { - dc.DrawBitmap(m_bitmapBg, x, y); - } - } -} - -#endif // wxHAS_GENERIC_PANEL diff --git a/Externals/wxWidgets3/src/generic/prntdlgg.cpp b/Externals/wxWidgets3/src/generic/prntdlgg.cpp index 244146f639..69141398ee 100644 --- a/Externals/wxWidgets3/src/generic/prntdlgg.cpp +++ b/Externals/wxWidgets3/src/generic/prntdlgg.cpp @@ -4,7 +4,7 @@ // Author: Julian Smart // Modified by: // Created: 04/01/98 -// RCS-ID: $Id: prntdlgg.cpp 64019 2010-04-18 00:05:37Z VZ $ +// RCS-ID: $Id: prntdlgg.cpp 69828 2011-11-27 19:49:43Z VZ $ // Copyright: (c) Julian Smart // Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// @@ -804,7 +804,7 @@ wxComboBox *wxGenericPrintSetupDialog::CreatePaperTypeChoice() wxComboBox *choice = new wxComboBox( this, wxPRINTID_PAPERSIZE, - _("Paper Size"), + _("Paper size"), wxDefaultPosition, wxSize(width, wxDefaultCoord), n, choices ); @@ -831,7 +831,7 @@ wxGenericPageSetupDialog::wxGenericPageSetupDialog( wxWindow *parent, wxPageSetupDialogData* data) : wxPageSetupDialogBase( parent, wxID_ANY, - _("Page Setup"), + _("Page setup"), wxPoint(0,0), wxSize(600, 600), wxDEFAULT_DIALOG_STYLE|wxTAB_TRAVERSAL ) @@ -858,7 +858,7 @@ wxGenericPageSetupDialog::wxGenericPageSetupDialog( wxWindow *parent, m_paperTypeChoice = new wxComboBox( this, wxPRINTID_PAPERSIZE, - _("Paper Size"), + _("Paper size"), wxDefaultPosition, wxSize(300, wxDefaultCoord), n, choices ); @@ -1060,7 +1060,7 @@ wxComboBox *wxGenericPageSetupDialog::CreatePaperTypeChoice(int *x, int *y) wxComboBox *choice = new wxComboBox( this, wxPRINTID_PAPERSIZE, - _("Paper Size"), + _("Paper size"), wxPoint(*x, *y), wxSize(300, wxDefaultCoord), n, choices ); diff --git a/Externals/wxWidgets3/src/generic/progdlgg.cpp b/Externals/wxWidgets3/src/generic/progdlgg.cpp index 5fd81e58d2..d8f04b6c1a 100644 --- a/Externals/wxWidgets3/src/generic/progdlgg.cpp +++ b/Externals/wxWidgets3/src/generic/progdlgg.cpp @@ -4,7 +4,7 @@ // Author: Karsten Ballueder // Modified by: // Created: 09.05.1999 -// RCS-ID: $Id: progdlgg.cpp 67134 2011-03-06 15:24:26Z SC $ +// RCS-ID: $Id: progdlgg.cpp 70512 2012-02-05 14:18:25Z VZ $ // Copyright: (c) Karsten Ballueder // Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// @@ -87,7 +87,7 @@ wxIMPLEMENT_CLASS(wxProgressDialog, wxDialog) // wxGenericProgressDialog creation // ---------------------------------------------------------------------------- -void wxGenericProgressDialog::Init(wxWindow *parent, int style) +void wxGenericProgressDialog::Init() { // we may disappear at any moment, let the others know about it SetExtraStyle(GetExtraStyle() | wxWS_EX_TRANSIENT); @@ -95,9 +95,8 @@ void wxGenericProgressDialog::Init(wxWindow *parent, int style) // Initialize all our members that we always use (even when we don't // create a valid window in this class). - m_pdStyle = style; - - m_parentTop = wxGetTopLevelParent(parent); + m_pdStyle = 0; + m_parentTop = NULL; m_gauge = NULL; m_msg = NULL; @@ -129,10 +128,10 @@ void wxGenericProgressDialog::Init(wxWindow *parent, int style) m_tempEventLoop = NULL; } -wxGenericProgressDialog::wxGenericProgressDialog(wxWindow *parent, int style) +wxGenericProgressDialog::wxGenericProgressDialog() : wxDialog() { - Init(parent, style); + Init(); } wxGenericProgressDialog::wxGenericProgressDialog(const wxString& title, @@ -142,21 +141,32 @@ wxGenericProgressDialog::wxGenericProgressDialog(const wxString& title, int style) : wxDialog() { - Init(parent, style); + Init(); Create( title, message, maximum, parent, style ); } -void wxGenericProgressDialog::Create( const wxString& title, +void wxGenericProgressDialog::SetTopParent(wxWindow* parent) +{ + m_parentTop = GetParentForModalDialog(parent, GetWindowStyle()); +} + +bool wxGenericProgressDialog::Create( const wxString& title, const wxString& message, int maximum, wxWindow *parent, int style ) { - wxDialog::Create(GetParentForModalDialog(parent, style), wxID_ANY, title); + SetTopParent(parent); - SetParent( GetParentForModalDialog(parent, style) ); - SetTitle( title ); + m_parentTop = wxGetTopLevelParent(parent); + m_pdStyle = style; + + wxWindow* const + realParent = GetParentForModalDialog(parent, GetWindowStyle()); + + if (!wxDialog::Create(realParent, wxID_ANY, title)) + return false; SetMaximum(maximum); @@ -306,6 +316,7 @@ void wxGenericProgressDialog::Create( const wxString& title, } Update(); + return true; } void wxGenericProgressDialog::UpdateTimeEstimates(int value, diff --git a/Externals/wxWidgets3/src/generic/regiong.cpp b/Externals/wxWidgets3/src/generic/regiong.cpp index 654cb4327d..a7af760553 100644 --- a/Externals/wxWidgets3/src/generic/regiong.cpp +++ b/Externals/wxWidgets3/src/generic/regiong.cpp @@ -4,7 +4,7 @@ // Author: David Elliott // Modified by: // Created: 2004/04/12 -// RCS-ID: $Id: regiong.cpp 67254 2011-03-20 00:14:35Z DS $ +// RCS-ID: $Id: regiong.cpp 70625 2012-02-19 14:49:37Z SN $ // Copyright: (c) 2004 David Elliott // Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// @@ -1645,7 +1645,7 @@ miSubtractO ( else if (r2->x1 <= x1) { /* - * Subtrahend preceeds minuend: nuke left edge of minuend. + * Subtrahend precedes minuend: nuke left edge of minuend. */ x1 = r2->x2; if (x1 >= r1->x2) diff --git a/Externals/wxWidgets3/src/generic/renderg.cpp b/Externals/wxWidgets3/src/generic/renderg.cpp index 53a50e75c6..5a3598e798 100644 --- a/Externals/wxWidgets3/src/generic/renderg.cpp +++ b/Externals/wxWidgets3/src/generic/renderg.cpp @@ -4,7 +4,7 @@ // Author: Vadim Zeitlin // Modified by: // Created: 20.07.2003 -// RCS-ID: $Id: renderg.cpp 66091 2010-11-10 13:52:22Z VZ $ +// RCS-ID: $Id: renderg.cpp 67681 2011-05-03 16:29:04Z DS $ // Copyright: (c) 2003 Vadim Zeitlin // Licence: wxWindows licence /////////////////////////////////////////////////////////////////////////////// @@ -281,7 +281,7 @@ wxRendererGeneric::DrawHeaderButtonContents(wxWindow *win, // native hot-tracking line (on XP) const int penwidth = 3; int y = rect.y + rect.height + 1 - penwidth; - wxColour c = (params && params->m_selectionColour.Ok()) ? + wxColour c = (params && params->m_selectionColour.IsOk()) ? params->m_selectionColour : wxColour(0x66, 0x66, 0x66); wxPen pen(c, penwidth); pen.SetCap(wxCAP_BUTT); @@ -322,7 +322,7 @@ wxRendererGeneric::DrawHeaderButtonContents(wxWindow *win, triPt[2].y = ar.height; } - wxColour c = (params && params->m_arrowColour.Ok()) ? + wxColour c = (params && params->m_arrowColour.IsOk()) ? params->m_arrowColour : wxSystemSettings::GetColour(wxSYS_COLOUR_3DSHADOW); wxDCPenChanger setPen(dc, c); @@ -336,7 +336,7 @@ wxRendererGeneric::DrawHeaderButtonContents(wxWindow *win, int bmpWidth = 0; // draw the bitmap if there is one - if ( params && params->m_labelBitmap.Ok() ) + if ( params && params->m_labelBitmap.IsOk() ) { int w = params->m_labelBitmap.GetWidth(); int h = params->m_labelBitmap.GetHeight(); @@ -379,9 +379,9 @@ wxRendererGeneric::DrawHeaderButtonContents(wxWindow *win, const int margin = 5; // number of pixels to reserve on either side of the label labelWidth += 2*margin; - wxFont font = params->m_labelFont.Ok() ? + wxFont font = params->m_labelFont.IsOk() ? params->m_labelFont : win->GetFont(); - wxColour clr = params->m_labelColour.Ok() ? + wxColour clr = params->m_labelColour.IsOk() ? params->m_labelColour : win->GetForegroundColour(); wxString label( params->m_labelText ); diff --git a/Externals/wxWidgets3/src/generic/richtooltipg.cpp b/Externals/wxWidgets3/src/generic/richtooltipg.cpp new file mode 100644 index 0000000000..68810dae92 --- /dev/null +++ b/Externals/wxWidgets3/src/generic/richtooltipg.cpp @@ -0,0 +1,673 @@ +/////////////////////////////////////////////////////////////////////////////// +// Name: src/generic/richtooltipg.cpp +// Purpose: Implementation of wxRichToolTip. +// Author: Vadim Zeitlin +// Created: 2011-10-07 +// RCS-ID: $Id: richtooltipg.cpp 69968 2011-12-09 15:58:40Z VZ $ +// Copyright: (c) 2011 Vadim Zeitlin +// Licence: wxWindows licence +/////////////////////////////////////////////////////////////////////////////// + +// ============================================================================ +// declarations +// ============================================================================ + +// ---------------------------------------------------------------------------- +// headers +// ---------------------------------------------------------------------------- + +// for compilers that support precompilation, includes "wx.h". +#include "wx/wxprec.h" + +#ifdef __BORLANDC__ + #pragma hdrstop +#endif + +#if wxUSE_RICHTOOLTIP + +#ifndef WX_PRECOMP + #include "wx/dcmemory.h" + #include "wx/icon.h" + #include "wx/region.h" + #include "wx/settings.h" + #include "wx/sizer.h" + #include "wx/statbmp.h" + #include "wx/stattext.h" + #include "wx/timer.h" + #include "wx/utils.h" +#endif // WX_PRECOMP + +#include "wx/private/richtooltip.h" +#include "wx/generic/private/richtooltip.h" + +#include "wx/artprov.h" +#include "wx/custombgwin.h" +#include "wx/display.h" +#include "wx/graphics.h" +#include "wx/popupwin.h" +#include "wx/textwrapper.h" + +#ifdef __WXMSW__ + #include "wx/msw/uxtheme.h" + + static const int TTP_BALLOONTITLE = 4; + + static const int TMT_TEXTCOLOR = 3803; + static const int TMT_GRADIENTCOLOR1 = 3810; + static const int TMT_GRADIENTCOLOR2 = 3811; +#endif + +// ---------------------------------------------------------------------------- +// wxRichToolTipPopup: the popup window used by wxRichToolTip. +// ---------------------------------------------------------------------------- + +class wxRichToolTipPopup : + public wxCustomBackgroundWindow +{ +public: + wxRichToolTipPopup(wxWindow* parent, + const wxString& title, + const wxString& message, + const wxIcon& icon, + wxTipKind tipKind, + const wxFont& titleFont_) : + m_timer(this) + { + Create(parent, wxFRAME_SHAPED); + + + wxBoxSizer* const sizerTitle = new wxBoxSizer(wxHORIZONTAL); + if ( icon.IsOk() ) + { + sizerTitle->Add(new wxStaticBitmap(this, wxID_ANY, icon), + wxSizerFlags().Centre().Border(wxRIGHT)); + } + //else: Simply don't show any icon. + + wxStaticText* const labelTitle = new wxStaticText(this, wxID_ANY, ""); + labelTitle->SetLabelText(title); + + wxFont titleFont(titleFont_); + if ( !titleFont.IsOk() ) + { + // Determine the appropriate title font for the current platform. + titleFont = labelTitle->GetFont(); + +#ifdef __WXMSW__ + // When using themes MSW tooltips use larger bluish version of the + // normal font. + wxUxThemeEngine* const theme = GetTooltipTheme(); + if ( theme ) + { + titleFont.MakeLarger(); + + COLORREF c; + if ( FAILED(theme->GetThemeColor + ( + wxUxThemeHandle(parent, L"TOOLTIP"), + TTP_BALLOONTITLE, + 0, + TMT_TEXTCOLOR, + &c + )) ) + { + // Use the standard value of this colour as fallback. + c = 0x993300; + } + + labelTitle->SetForegroundColour(wxRGBToColour(c)); + } + else +#endif // __WXMSW__ + { + // Everything else, including "classic" MSW look uses just the + // bold version of the base font. + titleFont.MakeBold(); + } + } + + labelTitle->SetFont(titleFont); + sizerTitle->Add(labelTitle, wxSizerFlags().Centre()); + + wxBoxSizer* const sizerTop = new wxBoxSizer(wxVERTICAL); + sizerTop->Add(sizerTitle, + wxSizerFlags().DoubleBorder(wxLEFT|wxRIGHT|wxTOP)); + + // Use a spacer as we don't want to have a double border between the + // elements, just a simple one will do. + sizerTop->AddSpacer(wxSizerFlags::GetDefaultBorder()); + + wxTextSizerWrapper wrapper(this); + wxSizer* sizerText = wrapper.CreateSizer(message, -1 /* No wrapping */); + +#ifdef __WXMSW__ + if ( icon.IsOk() && GetTooltipTheme() ) + { + // Themed tooltips under MSW align the text with the title, not + // with the icon, so use a helper horizontal sizer in this case. + wxBoxSizer* const sizerTextIndent = new wxBoxSizer(wxHORIZONTAL); + sizerTextIndent->AddSpacer(icon.GetWidth()); + sizerTextIndent->Add(sizerText, + wxSizerFlags().Border(wxLEFT).Centre()); + + sizerText = sizerTextIndent; + } +#endif // !__WXMSW__ + sizerTop->Add(sizerText, + wxSizerFlags().DoubleBorder(wxLEFT|wxRIGHT|wxBOTTOM) + .Centre()); + + SetSizer(sizerTop); + + const int offsetY = SetTipShapeAndSize(tipKind, GetBestSize()); + if ( offsetY > 0 ) + { + // Offset our contents by the tip height to make it appear in the + // main rectangle. + sizerTop->PrependSpacer(offsetY); + } + + Layout(); + } + + void SetBackgroundColours(wxColour colStart, wxColour colEnd) + { + if ( !colStart.IsOk() ) + { + // Determine the best colour(s) to use on our own. +#ifdef __WXMSW__ + wxUxThemeEngine* const theme = GetTooltipTheme(); + if ( theme ) + { + wxUxThemeHandle hTheme(GetParent(), L"TOOLTIP"); + + COLORREF c1, c2; + if ( FAILED(theme->GetThemeColor + ( + hTheme, + TTP_BALLOONTITLE, + 0, + TMT_GRADIENTCOLOR1, + &c1 + )) || + FAILED(theme->GetThemeColor + ( + hTheme, + TTP_BALLOONTITLE, + 0, + TMT_GRADIENTCOLOR2, + &c2 + )) ) + { + c1 = 0xffffff; + c2 = 0xf0e5e4; + } + + colStart = wxRGBToColour(c1); + colEnd = wxRGBToColour(c2); + } + else +#endif // __WXMSW__ + { + colStart = wxSystemSettings::GetColour(wxSYS_COLOUR_INFOBK); + } + } + + if ( colEnd.IsOk() ) + { + // Use gradient-filled background bitmap. + const wxSize size = GetClientSize(); + wxBitmap bmp(size); + { + wxMemoryDC dc(bmp); + dc.Clear(); + dc.GradientFillLinear(size, colStart, colEnd, wxDOWN); + } + + SetBackgroundBitmap(bmp); + } + else // Use solid colour. + { + SetBackgroundColour(colStart); + } + } + + void DoShow() + { + wxPoint pos = GetTipPoint(); + + // We want our anchor point to coincide with this position so offset + // the position of the top left corner passed to Move() accordingly. + pos -= m_anchorPos; + + Move(pos, wxSIZE_NO_ADJUSTMENTS); + + Popup(); + } + + void SetTimeout(unsigned timeout) + { + if ( !timeout ) + return; + + Connect(wxEVT_TIMER, wxTimerEventHandler(wxRichToolTipPopup::OnTimer)); + + m_timer.Start(timeout, true /* one shot */); + } + +protected: + virtual void OnDismiss() + { + Destroy(); + } + +private: +#ifdef __WXMSW__ + // Returns non-NULL theme only if we're using Win7-style tooltips. + static wxUxThemeEngine* GetTooltipTheme() + { + // Even themed applications under XP still use "classic" tooltips. + if ( wxGetWinVersion() <= wxWinVersion_XP ) + return NULL; + + return wxUxThemeEngine::GetIfActive(); + } +#endif // __WXMSW__ + + // For now we just hard code the tip height, would be nice to do something + // smarter in the future. + static int GetTipHeight() + { +#ifdef __WXMSW__ + if ( GetTooltipTheme() ) + return 20; +#endif // __WXMSW__ + + return 15; + } + + // Get the point to which our tip should point. + wxPoint GetTipPoint() const + { + // Currently we always use the middle of the window. It seems that MSW + // native tooltips use a different point but it's not really clear how + // do they determine it nor whether it's worth the trouble to emulate + // their behaviour. + const wxRect r = GetParent()->GetScreenRect(); + return wxPoint(r.x + r.width/2, r.y + r.height/2); + } + + // Choose the correct orientation depending on the window position. + // + // Also use the tip kind appropriate for the current environment. For MSW + // the right triangles are used and for Mac the equilateral ones as this is + // the prevailing kind under these systems. For everything else we go with + // right triangles as well but without any real rationale so this could be + // tweaked in the future. + wxTipKind GetBestTipKind() const + { + const wxPoint pos = GetTipPoint(); + + // Use GetFromWindow() and not GetFromPoint() here to try to get the + // correct display even if the tip point itself is not visible. + int dpy = wxDisplay::GetFromWindow(GetParent()); + if ( dpy == wxNOT_FOUND ) + dpy = 0; // What else can we do? + + const wxRect rectDpy = wxDisplay(dpy).GetClientArea(); + +#ifdef __WXMAC__ + return pos.y > rectDpy.height/2 ? wxTipKind_Bottom : wxTipKind_Top; +#else // !__WXMAC__ + return pos.y > rectDpy.height/2 + ? pos.x > rectDpy.width/2 + ? wxTipKind_BottomRight + : wxTipKind_BottomLeft + : pos.x > rectDpy.width/2 + ? wxTipKind_TopRight + : wxTipKind_TopLeft; +#endif // __WXMAC__/!__WXMAC__ + } + + // Set the size and shape of the tip window and returns the offset of its + // content area from the top (horizontal offset is always 0 currently). + int SetTipShapeAndSize(wxTipKind tipKind, const wxSize& contentSize) + { +#if wxUSE_GRAPHICS_CONTEXT + wxSize size = contentSize; + + // The size is the vertical size and the offset is the distance from + // edge for asymmetric tips, currently hard-coded to be the same as the + // size. + const int tipSize = GetTipHeight(); + const int tipOffset = tipSize; + + // The horizontal position of the tip. + int x = -1; + + // The vertical coordinates of the tip base and apex. + int yBase = -1, + yApex = -1; + + // The offset of the content part of the window. + int dy = -1; + + // Define symbolic names for the rectangle corners and mid-way points + // that we use below in an attempt to make the code more clear. Notice + // that these values must be consecutive as we iterate over them. + enum RectPoint + { + RectPoint_TopLeft, + RectPoint_Top, + RectPoint_TopRight, + RectPoint_Right, + RectPoint_BotRight, + RectPoint_Bot, + RectPoint_BotLeft, + RectPoint_Left, + RectPoint_Max + }; + + // The starting point for AddArcToPoint() calls below, we iterate over + // all RectPoints from it. + RectPoint pointStart = RectPoint_Max; + + + // Hard-coded radius of the round main rectangle corners. + const double RADIUS = 5; + + // Create a path defining the shape of the tooltip window. + wxGraphicsPath + path = wxGraphicsRenderer::GetDefaultRenderer()->CreatePath(); + + if ( tipKind == wxTipKind_Auto ) + tipKind = GetBestTipKind(); + + // Points defining the tip shape (in clockwise order as we must end at + // tipPoints[0] after drawing the rectangle outline in this order). + wxPoint2DDouble tipPoints[3]; + + switch ( tipKind ) + { + case wxTipKind_Auto: + wxFAIL_MSG( "Impossible kind value" ); + break; + + case wxTipKind_TopLeft: + x = tipOffset; + yApex = 0; + yBase = tipSize; + dy = tipSize; + + tipPoints[0] = wxPoint2DDouble(x, yBase); + tipPoints[1] = wxPoint2DDouble(x, yApex); + tipPoints[2] = wxPoint2DDouble(x + tipSize, yBase); + + pointStart = RectPoint_TopRight; + break; + + case wxTipKind_TopRight: + x = size.x - tipOffset; + yApex = 0; + yBase = tipSize; + dy = tipSize; + + tipPoints[0] = wxPoint2DDouble(x - tipSize, yBase); + tipPoints[1] = wxPoint2DDouble(x, yApex); + tipPoints[2] = wxPoint2DDouble(x, yBase); + + pointStart = RectPoint_TopRight; + break; + + case wxTipKind_BottomLeft: + x = tipOffset; + yApex = size.y + tipSize; + yBase = size.y; + dy = 0; + + tipPoints[0] = wxPoint2DDouble(x + tipSize, yBase); + tipPoints[1] = wxPoint2DDouble(x, yApex); + tipPoints[2] = wxPoint2DDouble(x, yBase); + + pointStart = RectPoint_BotLeft; + break; + + case wxTipKind_BottomRight: + x = size.x - tipOffset; + yApex = size.y + tipSize; + yBase = size.y; + dy = 0; + + tipPoints[0] = wxPoint2DDouble(x, yBase); + tipPoints[1] = wxPoint2DDouble(x, yApex); + tipPoints[2] = wxPoint2DDouble(x - tipSize, yBase); + + pointStart = RectPoint_BotLeft; + break; + + case wxTipKind_Top: + x = size.x/2; + yApex = 0; + yBase = tipSize; + dy = tipSize; + + { + // A half-side of an equilateral triangle is its altitude + // divided by sqrt(3) ~= 1.73. + const double halfside = tipSize/1.73; + + tipPoints[0] = wxPoint2DDouble(x - halfside, yBase); + tipPoints[1] = wxPoint2DDouble(x, yApex); + tipPoints[2] = wxPoint2DDouble(x + halfside, yBase); + } + + pointStart = RectPoint_TopRight; + break; + + case wxTipKind_Bottom: + x = size.x/2; + yApex = size.y + tipSize; + yBase = size.y; + dy = 0; + + { + const double halfside = tipSize/1.73; + + tipPoints[0] = wxPoint2DDouble(x + halfside, yBase); + tipPoints[1] = wxPoint2DDouble(x, yApex); + tipPoints[2] = wxPoint2DDouble(x - halfside, yBase); + } + + pointStart = RectPoint_BotLeft; + break; + + case wxTipKind_None: + x = size.x/2; + dy = 0; + + path.AddRoundedRectangle(0, 0, size.x, size.y, RADIUS); + break; + } + + wxASSERT_MSG( dy != -1, wxS("Unknown tip kind?") ); + + size.y += tipSize; + SetSize(size); + + if ( tipKind != wxTipKind_None ) + { + path.MoveToPoint(tipPoints[0]); + path.AddLineToPoint(tipPoints[1]); + path.AddLineToPoint(tipPoints[2]); + + const double xLeft = 0.; + const double xMid = size.x/2.; + const double xRight = size.x; + + const double yTop = dy; + const double yMid = (dy + size.y)/2.; + const double yBot = dy + contentSize.y; + + wxPoint2DDouble rectPoints[RectPoint_Max]; + rectPoints[RectPoint_TopLeft] = wxPoint2DDouble(xLeft, yTop); + rectPoints[RectPoint_Top] = wxPoint2DDouble(xMid, yTop); + rectPoints[RectPoint_TopRight] = wxPoint2DDouble(xRight, yTop); + rectPoints[RectPoint_Right] = wxPoint2DDouble(xRight, yMid); + rectPoints[RectPoint_BotRight] = wxPoint2DDouble(xRight, yBot); + rectPoints[RectPoint_Bot] = wxPoint2DDouble(xMid, yBot); + rectPoints[RectPoint_BotLeft] = wxPoint2DDouble(xLeft, yBot); + rectPoints[RectPoint_Left] = wxPoint2DDouble(xLeft, yMid); + + // Iterate over all rectangle rectPoints for the first 3 corners. + unsigned n = pointStart; + for ( unsigned corner = 0; corner < 3; corner++ ) + { + const wxPoint2DDouble& pt1 = rectPoints[n]; + + n = (n + 1) % RectPoint_Max; + + const wxPoint2DDouble& pt2 = rectPoints[n]; + + path.AddArcToPoint(pt1.m_x, pt1.m_y, pt2.m_x, pt2.m_y, RADIUS); + + n = (n + 1) % RectPoint_Max; + } + + // Last one wraps to the first point of the tip. + const wxPoint2DDouble& pt1 = rectPoints[n]; + const wxPoint2DDouble& pt2 = tipPoints[0]; + + path.AddArcToPoint(pt1.m_x, pt1.m_y, pt2.m_x, pt2.m_y, RADIUS); + + path.CloseSubpath(); + } + + SetShape(path); +#else // !wxUSE_GRAPHICS_CONTEXT + int x = contentSize.x/2, + yApex = 0, + dy = 0; + + SetSize(contentSize); +#endif // wxUSE_GRAPHICS_CONTEXT/!wxUSE_GRAPHICS_CONTEXT + + m_anchorPos.x = x; + m_anchorPos.y = yApex; + + return dy; + } + + // Timer event handler hides the tooltip when the timeout expires. + void OnTimer(wxTimerEvent& WXUNUSED(event)) + { + // Doing "Notify" here ensures that our OnDismiss() is called and so we + // also Destroy() ourselves. We could use Dismiss() and call Destroy() + // explicitly from here as well. + DismissAndNotify(); + } + + + // The anchor point offset if we show a tip or the middle of the top side + // otherwise. + wxPoint m_anchorPos; + + // The timer counting down the time until we're hidden. + wxTimer m_timer; + + wxDECLARE_NO_COPY_CLASS(wxRichToolTipPopup); +}; + +// ---------------------------------------------------------------------------- +// wxRichToolTipGenericImpl: generic implementation of wxRichToolTip. +// ---------------------------------------------------------------------------- + +void +wxRichToolTipGenericImpl::SetBackgroundColour(const wxColour& col, + const wxColour& colEnd) +{ + m_colStart = col; + m_colEnd = colEnd; +} + +void wxRichToolTipGenericImpl::SetCustomIcon(const wxIcon& icon) +{ + m_icon = icon; +} + +void wxRichToolTipGenericImpl::SetStandardIcon(int icon) +{ + switch ( icon & wxICON_MASK ) + { + case wxICON_WARNING: + case wxICON_ERROR: + case wxICON_INFORMATION: + // Although we don't use this icon in a list, we need a smallish + // icon here and not an icon of a typical message box size so use + // wxART_LIST to get it. + m_icon = wxArtProvider::GetIcon + ( + wxArtProvider::GetMessageBoxIconId(icon), + wxART_LIST + ); + break; + + case wxICON_QUESTION: + wxFAIL_MSG("Question icon doesn't make sense for a tooltip"); + break; + + case wxICON_NONE: + m_icon = wxNullIcon; + break; + } +} + +void wxRichToolTipGenericImpl::SetTimeout(unsigned milliseconds) +{ + m_timeout = milliseconds; +} + +void wxRichToolTipGenericImpl::SetTipKind(wxTipKind tipKind) +{ + m_tipKind = tipKind; +} + +void wxRichToolTipGenericImpl::SetTitleFont(const wxFont& font) +{ + m_titleFont = font; +} + +void wxRichToolTipGenericImpl::ShowFor(wxWindow* win) +{ + // Set the focus to the window the tooltip refers to to make it look active. + win->SetFocus(); + + wxRichToolTipPopup* const popup = new wxRichToolTipPopup + ( + win, + m_title, + m_message, + m_icon, + m_tipKind, + m_titleFont + ); + + popup->SetBackgroundColours(m_colStart, m_colEnd); + + popup->DoShow(); + + popup->SetTimeout(m_timeout); +} + +// Currently only wxMSW provides a native implementation. +#ifndef __WXMSW__ + +/* static */ +wxRichToolTipImpl* +wxRichToolTipImpl::Create(const wxString& title, const wxString& message) +{ + return new wxRichToolTipGenericImpl(title, message); +} + +#endif // !__WXMSW__ + +#endif // wxUSE_RICHTOOLTIP diff --git a/Externals/wxWidgets3/src/generic/scrlwing.cpp b/Externals/wxWidgets3/src/generic/scrlwing.cpp index 6210c21360..9ceda4929a 100644 --- a/Externals/wxWidgets3/src/generic/scrlwing.cpp +++ b/Externals/wxWidgets3/src/generic/scrlwing.cpp @@ -5,7 +5,7 @@ // Modified by: Vadim Zeitlin on 31.08.00: wxScrollHelper allows to implement. // Ron Lee on 10.4.02: virtual size / auto scrollbars et al. // Created: 01/02/97 -// RCS-ID: $Id: scrlwing.cpp 64877 2010-07-11 10:43:35Z VZ $ +// RCS-ID: $Id: scrlwing.cpp 70443 2012-01-23 11:28:12Z VZ $ // Copyright: (c) wxWidgets team // Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// @@ -385,16 +385,17 @@ void wxScrollHelperBase::SetScrollbars(int pixelsPerUnitX, int yPos, bool noRefresh) { - int xpos, ypos; + // Convert positions expressed in scroll units to positions in pixels. + int xPosInPixels = (xPos + m_xScrollPosition)*m_xScrollPixelsPerLine, + yPosInPixels = (yPos + m_yScrollPosition)*m_yScrollPixelsPerLine; - CalcUnscrolledPosition(xPos, yPos, &xpos, &ypos); bool do_refresh = ( (noUnitsX != 0 && m_xScrollLines == 0) || - (noUnitsX < m_xScrollLines && xpos > pixelsPerUnitX * noUnitsX) || + (noUnitsX < m_xScrollLines && xPosInPixels > pixelsPerUnitX * noUnitsX) || (noUnitsY != 0 && m_yScrollLines == 0) || - (noUnitsY < m_yScrollLines && ypos > pixelsPerUnitY * noUnitsY) || + (noUnitsY < m_yScrollLines && yPosInPixels > pixelsPerUnitY * noUnitsY) || (xPos != m_xScrollPosition) || (yPos != m_yScrollPosition) ); @@ -1111,7 +1112,7 @@ void wxScrollHelperBase::HandleOnChildFocus(wxChildFocusEvent& event) // part of a wxComboCtrl visible and the button would still be outside the // scrolled area. But do so only if the parent fits *entirely* inside the // scrolled window. In other situations, such as nested wxPanel or - // wxScrolledWindows, the parent might be way to big to fit inside the + // wxScrolledWindows, the parent might be way too big to fit inside the // scrolled window. If that is the case, then make only the focused window // visible if ( win->GetParent() != m_targetWindow) diff --git a/Externals/wxWidgets3/src/generic/spinctlg.cpp b/Externals/wxWidgets3/src/generic/spinctlg.cpp index 7887529b5a..f8edc709fb 100644 --- a/Externals/wxWidgets3/src/generic/spinctlg.cpp +++ b/Externals/wxWidgets3/src/generic/spinctlg.cpp @@ -4,7 +4,7 @@ // Author: Vadim Zeitlin // Modified by: // Created: 29.01.01 -// RCS-ID: $Id: spinctlg.cpp 67199 2011-03-15 11:10:38Z VZ $ +// RCS-ID: $Id: spinctlg.cpp 70432 2012-01-21 17:03:52Z VZ $ // Copyright: (c) 2001 Vadim Zeitlin // Licence: wxWindows licence /////////////////////////////////////////////////////////////////////////////// @@ -85,13 +85,13 @@ public: void OnChar( wxKeyEvent &event ) { if (m_spin) - m_spin->OnTextChar(event); + m_spin->ProcessWindowEvent(event); } void OnKillFocus(wxFocusEvent& event) { if (m_spin) - m_spin->OnTextLostFocus(); + m_spin->ProcessWindowEvent(event); event.Skip(); } @@ -283,16 +283,24 @@ void wxSpinCtrlGenericBase::SetFocus() m_textCtrl->SetFocus(); } +#ifdef __WXMSW__ + +void wxSpinCtrlGenericBase::DoEnable(bool enable) +{ + // We never enable this control itself, it must stay disabled to avoid + // interfering with the siblings event handling (see e.g. #12045 for the + // kind of problems which arise otherwise). + if ( !enable ) + wxSpinCtrlBase::DoEnable(enable); +} + +#endif // __WXMSW__ + bool wxSpinCtrlGenericBase::Enable(bool enable) { - // Notice that we never enable this control itself, it must stay disabled - // to avoid interfering with the siblings event handling (see e.g. #12045 - // for the kind of problems which arise otherwise). - if ( enable == m_isEnabled ) + if ( !wxSpinCtrlBase::Enable(enable) ) return false; - m_isEnabled = enable; - m_spinButton->Enable(enable); m_textCtrl->Enable(enable); @@ -315,17 +323,6 @@ bool wxSpinCtrlGenericBase::Show(bool show) return true; } -bool wxSpinCtrlGenericBase::Reparent(wxWindowBase *newParent) -{ - if ( m_spinButton ) - { - m_spinButton->Reparent(newParent); - m_textCtrl->Reparent(newParent); - } - - return true; -} - #if wxUSE_TOOLTIPS void wxSpinCtrlGenericBase::DoSetToolTip(wxToolTip *tip) { @@ -357,6 +354,11 @@ void wxSpinCtrlGenericBase::DoSetToolTip(wxToolTip *tip) // Handle sub controls events // ---------------------------------------------------------------------------- +BEGIN_EVENT_TABLE(wxSpinCtrlGenericBase, wxSpinCtrlBase) + EVT_CHAR(wxSpinCtrlGenericBase::OnTextChar) + EVT_KILL_FOCUS(wxSpinCtrlGenericBase::OnTextLostFocus) +END_EVENT_TABLE() + void wxSpinCtrlGenericBase::OnSpinButton(wxSpinEvent& event) { event.Skip(); @@ -388,10 +390,12 @@ void wxSpinCtrlGenericBase::OnSpinButton(wxSpinEvent& event) DoSendEvent(); } -void wxSpinCtrlGenericBase::OnTextLostFocus() +void wxSpinCtrlGenericBase::OnTextLostFocus(wxFocusEvent& event) { SyncSpinToText(); DoSendEvent(); + + event.Skip(); } void wxSpinCtrlGenericBase::OnTextChar(wxKeyEvent& event) diff --git a/Externals/wxWidgets3/src/generic/splash.cpp b/Externals/wxWidgets3/src/generic/splash.cpp index 2798ae4451..2fad3c6014 100644 --- a/Externals/wxWidgets3/src/generic/splash.cpp +++ b/Externals/wxWidgets3/src/generic/splash.cpp @@ -4,7 +4,7 @@ // Author: Julian Smart // Modified by: // Created: 28/6/2000 -// RCS-ID: $Id: splash.cpp 60558 2009-05-09 12:22:45Z VZ $ +// RCS-ID: $Id: splash.cpp 69796 2011-11-22 13:18:55Z VZ $ // Copyright: (c) Julian Smart // Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// @@ -42,6 +42,13 @@ BEGIN_EVENT_TABLE(wxSplashScreen, wxFrame) EVT_CLOSE(wxSplashScreen::OnCloseWindow) END_EVENT_TABLE() +void wxSplashScreen::Init() +{ + m_window = NULL; + + wxEvtHandler::AddFilter(this); +} + /* Note that unless we pass a non-default size to the frame, SetClientSize * won't work properly under Windows, and the splash screen frame is sized * slightly too small. @@ -50,8 +57,11 @@ END_EVENT_TABLE() wxSplashScreen::wxSplashScreen(const wxBitmap& bitmap, long splashStyle, int milliseconds, wxWindow* parent, wxWindowID id, const wxPoint& pos, const wxSize& size, long style) - : wxFrame(parent, id, wxEmptyString, wxPoint(0,0), wxSize(100, 100), style) + : wxFrame(parent, id, wxEmptyString, wxPoint(0,0), wxSize(100, 100), + style | wxFRAME_TOOL_WINDOW | wxFRAME_NO_TASKBAR) { + Init(); + // splash screen must not be used as parent by the other windows because it // is going to disappear soon, indicate it by giving it this special style SetExtraStyle(GetExtraStyle() | wxWS_EX_TRANSIENT); @@ -61,7 +71,6 @@ wxSplashScreen::wxSplashScreen(const wxBitmap& bitmap, long splashStyle, int mil GDK_WINDOW_TYPE_HINT_SPLASHSCREEN); #endif - m_window = NULL; m_splashStyle = splashStyle; m_milliseconds = milliseconds; @@ -94,6 +103,20 @@ wxSplashScreen::wxSplashScreen(const wxBitmap& bitmap, long splashStyle, int mil wxSplashScreen::~wxSplashScreen() { m_timer.Stop(); + + wxEvtHandler::RemoveFilter(this); +} + +int wxSplashScreen::FilterEvent(wxEvent& event) +{ + const wxEventType t = event.GetEventType(); + if ( t == wxEVT_KEY_DOWN || + t == wxEVT_LEFT_DOWN || + t == wxEVT_RIGHT_DOWN || + t == wxEVT_MIDDLE_DOWN ) + Close(true); + + return -1; } void wxSplashScreen::OnNotify(wxTimerEvent& WXUNUSED(event)) @@ -116,8 +139,6 @@ BEGIN_EVENT_TABLE(wxSplashScreenWindow, wxWindow) EVT_PAINT(wxSplashScreenWindow::OnPaint) #endif EVT_ERASE_BACKGROUND(wxSplashScreenWindow::OnEraseBackground) - EVT_CHAR(wxSplashScreenWindow::OnChar) - EVT_MOUSE_EVENTS(wxSplashScreenWindow::OnMouseEvent) END_EVENT_TABLE() wxSplashScreenWindow::wxSplashScreenWindow(const wxBitmap& bitmap, wxWindow* parent, @@ -171,35 +192,22 @@ static void wxDrawSplashBitmap(wxDC& dc, const wxBitmap& bitmap, int WXUNUSED(x) void wxSplashScreenWindow::OnPaint(wxPaintEvent& WXUNUSED(event)) { wxPaintDC dc(this); - if (m_bitmap.Ok()) + if (m_bitmap.IsOk()) wxDrawSplashBitmap(dc, m_bitmap, 0, 0); } void wxSplashScreenWindow::OnEraseBackground(wxEraseEvent& event) { - if (event.GetDC() && m_bitmap.Ok()) + if (event.GetDC() && m_bitmap.IsOk()) { wxDrawSplashBitmap(* event.GetDC(), m_bitmap, 0, 0); } else { wxClientDC dc(this); - if (m_bitmap.Ok()) + if (m_bitmap.IsOk()) wxDrawSplashBitmap(dc, m_bitmap, 0, 0); } } -void wxSplashScreenWindow::OnMouseEvent(wxMouseEvent& event) -{ - if (event.LeftDown() || event.RightDown()) - GetParent()->Close(true); - else - event.Skip(); -} - -void wxSplashScreenWindow::OnChar(wxKeyEvent& WXUNUSED(event)) -{ - GetParent()->Close(true); -} - #endif // wxUSE_SPLASH diff --git a/Externals/wxWidgets3/src/generic/splitter.cpp b/Externals/wxWidgets3/src/generic/splitter.cpp index 9af2f66b4e..10a97054ed 100644 --- a/Externals/wxWidgets3/src/generic/splitter.cpp +++ b/Externals/wxWidgets3/src/generic/splitter.cpp @@ -4,7 +4,7 @@ // Author: Julian Smart // Modified by: // Created: 01/02/97 -// RCS-ID: $Id: splitter.cpp 67280 2011-03-22 14:17:38Z DS $ +// RCS-ID: $Id: splitter.cpp 70840 2012-03-08 13:23:39Z VZ $ // Copyright: (c) Julian Smart // Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// @@ -66,12 +66,8 @@ BEGIN_EVENT_TABLE(wxSplitterWindow, wxWindow) #if defined( __WXMSW__ ) || defined( __WXMAC__) EVT_SET_CURSOR(wxSplitterWindow::OnSetCursor) #endif // wxMSW - - WX_EVENT_TABLE_CONTROL_CONTAINER(wxSplitterWindow) END_EVENT_TABLE() -WX_DELEGATE_TO_CONTROL_CONTAINER(wxSplitterWindow, wxWindow) - static bool IsLive(wxSplitterWindow* wnd) { // with wxSP_LIVE_UPDATE style the splitter windows are always resized @@ -97,10 +93,7 @@ bool wxSplitterWindow::Create(wxWindow *parent, wxWindowID id, if ( !wxWindow::Create(parent, id, pos, size, style, name) ) return false; - if (size.x >= 0) - m_lastSize.x = size.x; - if (size.y >= 0) - m_lastSize.y = size.y; + m_lastSize = GetClientSize(); m_permitUnsplitAlways = (style & wxSP_PERMIT_UNSPLIT) != 0; @@ -117,8 +110,6 @@ bool wxSplitterWindow::Create(wxWindow *parent, wxWindowID id, void wxSplitterWindow::Init() { - WX_INIT_CONTROL_CONTAINER(); - m_splitMode = wxSPLIT_VERTICAL; m_permitUnsplitAlways = true; m_windowOne = NULL; @@ -127,10 +118,10 @@ void wxSplitterWindow::Init() m_oldX = 0; m_oldY = 0; m_sashStart = 0; - m_sashPosition = m_requestedSashPosition = 0; + m_sashPosition = 0; + m_requestedSashPosition = INT_MAX; m_sashGravity = 0.0; m_lastSize = wxSize(0,0); - m_checkRequestedSashPosition = false; m_minimumPaneSize = 0; m_sashCursorWE = wxCursor(wxCURSOR_SIZEWE); m_sashCursorNS = wxCursor(wxCURSOR_SIZENS); @@ -202,17 +193,21 @@ void wxSplitterWindow::OnInternalIdle() { wxWindow::OnInternalIdle(); - // if this is the first idle time after a sash position has potentially - // been set, allow SizeWindows to check for a requested size. - if (!m_checkRequestedSashPosition) + // We may need to update the children sizes in two cases: either because + // we're in the middle of a live update as indicated by m_needUpdating or + // because we have a requested but not yet set sash position as indicated + // by m_requestedSashPosition having a valid value. + if ( m_needUpdating ) { - m_checkRequestedSashPosition = true; - SizeWindows(); - return; // it won't needUpdating in this case + m_needUpdating = false; + } + else if ( m_requestedSashPosition == INT_MAX ) + { + // We don't need to resize the children. + return; } - if (m_needUpdating) - SizeWindows(); + SizeWindows(); } void wxSplitterWindow::OnMouseEvent(wxMouseEvent& event) @@ -440,31 +435,44 @@ void wxSplitterWindow::OnSize(wxSizeEvent& event) return; } - if ( m_windowTwo ) - { - int w, h; - GetClientSize(&w, &h); + const wxSize curSize = event.GetSize(); - int size = m_splitMode == wxSPLIT_VERTICAL ? w : h; + // Update the sash position if needed. + // + // Notice that we shouldn't do this if the sash position requested by user + // couldn't be set yet as it would never be taken into account at all if we + // modified it before this happens. + if ( m_windowTwo && m_requestedSashPosition == INT_MAX ) + { + int size = m_splitMode == wxSPLIT_VERTICAL ? curSize.x : curSize.y; int old_size = m_splitMode == wxSPLIT_VERTICAL ? m_lastSize.x : m_lastSize.y; - if ( old_size != 0 ) + + // Don't do anything if the size didn't really change. + if ( size != old_size ) { + int newPosition = -1; + + // Apply gravity if we use it. int delta = (int) ( (size - old_size)*m_sashGravity ); if ( delta != 0 ) { - int newPosition = m_sashPosition + delta; + newPosition = m_sashPosition + delta; if( newPosition < m_minimumPaneSize ) newPosition = m_minimumPaneSize; - SetSashPositionAndNotify(newPosition); } - } - if ( m_sashPosition >= size - 5 ) - SetSashPositionAndNotify(wxMax(10, size - 40)); - m_lastSize = wxSize(w,h); + // Also check if the second window became too small. + newPosition = AdjustSashPosition(newPosition == -1 + ? m_sashPosition + : newPosition); + if ( newPosition != m_sashPosition ) + SetSashPositionAndNotify(newPosition); + } } + m_lastSize = curSize; + SizeWindows(); } @@ -488,7 +496,18 @@ bool wxSplitterWindow::SashHitTest(int x, int y, int tolerance) return z >= hitMin && z <= hitMax; } +void wxSplitterWindow::SetSashInvisible(bool invisible) +{ + if ( IsSashInvisible() != invisible ) + ToggleWindowStyle(wxSP_NOSASH); +} + int wxSplitterWindow::GetSashSize() const +{ + return IsSashInvisible() ? 0 : GetDefaultSashSize(); +} + +int wxSplitterWindow::GetDefaultSashSize() const { return wxRendererNative::Get().GetSplitterParams(this).widthSash; } @@ -514,7 +533,7 @@ void wxSplitterWindow::DrawSash(wxDC& dc) return; // nor if we're configured to not show it - if ( HasFlag(wxSP_NOSASH) ) + if ( IsSashInvisible() ) return; wxRendererNative::Get().DrawSplitterSash @@ -646,7 +665,7 @@ void wxSplitterWindow::SetSashPositionAndNotify(int sashPos) void wxSplitterWindow::SizeWindows() { // check if we have delayed setting the real sash position - if ( m_checkRequestedSashPosition && m_requestedSashPosition != INT_MAX ) + if ( m_requestedSashPosition != INT_MAX ) { int newSashPosition = ConvertSashPosition(m_requestedSashPosition); if ( newSashPosition != m_sashPosition ) @@ -712,8 +731,6 @@ void wxSplitterWindow::SizeWindows() wxClientDC dc(this); DrawSash(dc); - - SetNeedUpdating(false); } // Set pane for unsplit window @@ -849,7 +866,6 @@ void wxSplitterWindow::SetSashPosition(int position, bool redraw) // remember the sash position we want to set for later if we can't set it // right now (e.g. because the window is too small) m_requestedSashPosition = position; - m_checkRequestedSashPosition = false; DoSetSashPosition(ConvertSashPosition(position)); @@ -864,9 +880,7 @@ void wxSplitterWindow::SetSashPosition(int position, bool redraw) // window is shown, if you know the overall size is correct. void wxSplitterWindow::UpdateSize() { - m_checkRequestedSashPosition = true; SizeWindows(); - m_checkRequestedSashPosition = false; } bool wxSplitterWindow::DoSendEvent(wxSplitterEvent& event) diff --git a/Externals/wxWidgets3/src/generic/srchctlg.cpp b/Externals/wxWidgets3/src/generic/srchctlg.cpp index 2de709df0d..1965d6e0b7 100644 --- a/Externals/wxWidgets3/src/generic/srchctlg.cpp +++ b/Externals/wxWidgets3/src/generic/srchctlg.cpp @@ -3,7 +3,7 @@ // Purpose: implements wxSearchCtrl as a composite control // Author: Vince Harron // Created: 2006-02-19 -// RCS-ID: $Id: srchctlg.cpp 66310 2010-12-03 12:40:08Z VZ $ +// RCS-ID: $Id: srchctlg.cpp 69284 2011-10-02 11:28:40Z VZ $ // Copyright: Vince Harron // Licence: wxWindows licence /////////////////////////////////////////////////////////////////////////////// @@ -61,30 +61,16 @@ class wxSearchTextCtrl : public wxTextCtrl public: wxSearchTextCtrl(wxSearchCtrl *search, const wxString& value, int style) : wxTextCtrl(search, wxID_ANY, value, wxDefaultPosition, wxDefaultSize, - style | wxNO_BORDER) + (style & ~wxBORDER_MASK) | wxNO_BORDER) { m_search = search; - m_defaultFG = GetForegroundColour(); + + SetHint(_("Search")); // remove the default minsize, the searchctrl will have one instead SetSizeHints(wxDefaultCoord,wxDefaultCoord); } - void SetDescriptiveText(const wxString& text) - { - if ( GetValue() == m_descriptiveText ) - { - ChangeValue(wxEmptyString); - } - - m_descriptiveText = text; - } - - wxString GetDescriptiveText() const - { - return m_descriptiveText; - } - // provide access to the base class protected methods to wxSearchCtrl which // needs to forward to them @@ -128,30 +114,34 @@ protected: m_search->GetEventHandler()->ProcessEvent(event); } - void OnIdle(wxIdleEvent& WXUNUSED(event)) +#ifdef __WXMSW__ + // We increase the text control height to be the same as for the controls + // with border as this is what we actually need here because even though + // this control itself is borderless, it's inside wxSearchCtrl which does + // have the border and so should have the same height as the normal text + // entries with border. + // + // This is a bit ugly and it would arguably be better to use whatever size + // the base class version returns and just centre the text vertically in + // the search control but I failed to modify the code in LayoutControls() + // to do this easily and as there is much in that code I don't understand + // (notably what is the logic for buttons sizing?) I prefer to not touch it + // at all. + virtual wxSize DoGetBestSize() const { - if ( IsEmpty() && !(wxWindow::FindFocus() == this) ) - { - ChangeValue(m_descriptiveText); - SetInsertionPoint(0); - SetForegroundColour(m_defaultFG.ChangeLightness (LIGHT_STEP)); - } - } + const long flags = GetWindowStyleFlag(); + wxSearchTextCtrl* const self = const_cast(this); - void OnFocus(wxFocusEvent& event) - { - event.Skip(); - if ( GetValue() == m_descriptiveText ) - { - ChangeValue(wxEmptyString); - SetForegroundColour(m_defaultFG); - } + self->SetWindowStyleFlag((flags & ~wxBORDER_MASK) | wxBORDER_DEFAULT); + const wxSize size = wxTextCtrl::DoGetBestSize(); + self->SetWindowStyleFlag(flags); + + return size; } +#endif // __WXMSW__ private: wxSearchCtrl* m_search; - wxString m_descriptiveText; - wxColour m_defaultFG; DECLARE_EVENT_TABLE() }; @@ -161,8 +151,6 @@ BEGIN_EVENT_TABLE(wxSearchTextCtrl, wxTextCtrl) EVT_TEXT_ENTER(wxID_ANY, wxSearchTextCtrl::OnText) EVT_TEXT_URL(wxID_ANY, wxSearchTextCtrl::OnTextUrl) EVT_TEXT_MAXLEN(wxID_ANY, wxSearchTextCtrl::OnText) - EVT_IDLE(wxSearchTextCtrl::OnIdle) - EVT_SET_FOCUS(wxSearchTextCtrl::OnFocus) END_EVENT_TABLE() // ---------------------------------------------------------------------------- @@ -181,6 +169,13 @@ public: void SetBitmapLabel(const wxBitmap& label) { m_bmp = label; } + // The buttons in wxSearchCtrl shouldn't accept focus from keyboard because + // this would interfere with the usual TAB processing: the user expects + // that pressing TAB in the search control should switch focus to the next + // control and not give it to the button inside the same control. Besides, + // the search button can be already activated by pressing "Enter" so there + // is really no reason for it to be able to get focus from keyboard. + virtual bool AcceptsFocusFromKeyboard() const { return false; } protected: wxSize DoGetBestSize() const @@ -317,8 +312,7 @@ bool wxSearchCtrl::Create(wxWindow *parent, wxWindowID id, return false; } - m_text = new wxSearchTextCtrl(this, value, style & ~wxBORDER_MASK); - m_text->SetDescriptiveText(_("Search")); + m_text = new wxSearchTextCtrl(this, value, style); m_searchButton = new wxSearchButton(this, wxEVT_COMMAND_SEARCHCTRL_SEARCH_BTN, @@ -328,12 +322,7 @@ bool wxSearchCtrl::Create(wxWindow *parent, wxWindowID id, m_cancelBitmap); SetForegroundColour( m_text->GetForegroundColour() ); - m_searchButton->SetForegroundColour( m_text->GetForegroundColour() ); - m_cancelButton->SetForegroundColour( m_text->GetForegroundColour() ); - SetBackgroundColour( m_text->GetBackgroundColour() ); - m_searchButton->SetBackgroundColour( m_text->GetBackgroundColour() ); - m_cancelButton->SetBackgroundColour( m_text->GetBackgroundColour() ); RecalcBitmaps(); @@ -434,12 +423,12 @@ bool wxSearchCtrl::IsCancelButtonVisible() const void wxSearchCtrl::SetDescriptiveText(const wxString& text) { - m_text->SetDescriptiveText(text); + m_text->SetHint(text); } wxString wxSearchCtrl::GetDescriptiveText() const { - return m_text->GetDescriptiveText(); + return m_text->GetHint(); } // ---------------------------------------------------------------------------- @@ -532,17 +521,21 @@ void wxSearchCtrl::LayoutControls(int x, int y, int width, int height) y + ICON_OFFSET - 1, sizeCancel.x, height); } +wxWindowList wxSearchCtrl::GetCompositeWindowParts() const +{ + wxWindowList parts; + parts.push_back(m_text); + parts.push_back(m_searchButton); + parts.push_back(m_cancelButton); + return parts; +} // accessors // --------- wxString wxSearchCtrl::DoGetValue() const { - wxString value = m_text->GetValue(); - if (value == m_text->GetDescriptiveText()) - return wxEmptyString; - else - return value; + return m_text->GetValue(); } wxString wxSearchCtrl::GetRange(long from, long to) const { @@ -786,20 +779,32 @@ void wxSearchCtrl::SetEditable(bool editable) bool wxSearchCtrl::SetFont(const wxFont& font) { - bool result = wxSearchCtrlBase::SetFont(font); - if ( result && m_text ) - { - result = m_text->SetFont(font); - } + if ( !wxSearchCtrlBase::SetFont(font) ) + return false; + + // Recreate the bitmaps as their size may have changed. RecalcBitmaps(); - return result; + + return true; +} + +bool wxSearchCtrl::SetBackgroundColour(const wxColour& colour) +{ + if ( !wxSearchCtrlBase::SetBackgroundColour(colour) ) + return false; + + // When the background changes, re-render the bitmaps so that the correct + // colour shows in their "transparent" area. + RecalcBitmaps(); + + return true; } // search control generic only void wxSearchCtrl::SetSearchBitmap( const wxBitmap& bitmap ) { m_searchBitmap = bitmap; - m_searchBitmapUser = bitmap.Ok(); + m_searchBitmapUser = bitmap.IsOk(); if ( m_searchBitmapUser ) { if ( m_searchButton && !HasMenu() ) @@ -819,7 +824,7 @@ void wxSearchCtrl::SetSearchBitmap( const wxBitmap& bitmap ) void wxSearchCtrl::SetSearchMenuBitmap( const wxBitmap& bitmap ) { m_searchMenuBitmap = bitmap; - m_searchMenuBitmapUser = bitmap.Ok(); + m_searchMenuBitmapUser = bitmap.IsOk(); if ( m_searchMenuBitmapUser ) { if ( m_searchButton && m_menu ) @@ -839,7 +844,7 @@ void wxSearchCtrl::SetSearchMenuBitmap( const wxBitmap& bitmap ) void wxSearchCtrl::SetCancelBitmap( const wxBitmap& bitmap ) { m_cancelBitmap = bitmap; - m_cancelBitmapUser = bitmap.Ok(); + m_cancelBitmapUser = bitmap.IsOk(); if ( m_cancelBitmapUser ) { if ( m_cancelButton ) @@ -1119,7 +1124,7 @@ void wxSearchCtrl::RecalcBitmaps() if ( !m_searchBitmapUser ) { if ( - !m_searchBitmap.Ok() || + !m_searchBitmap.IsOk() || m_searchBitmap.GetHeight() != bitmapHeight || m_searchBitmap.GetWidth() != bitmapWidth ) @@ -1137,7 +1142,7 @@ void wxSearchCtrl::RecalcBitmaps() if ( !m_searchMenuBitmapUser ) { if ( - !m_searchMenuBitmap.Ok() || + !m_searchMenuBitmap.IsOk() || m_searchMenuBitmap.GetHeight() != bitmapHeight || m_searchMenuBitmap.GetWidth() != bitmapWidth ) @@ -1155,7 +1160,7 @@ void wxSearchCtrl::RecalcBitmaps() if ( !m_cancelBitmapUser ) { if ( - !m_cancelBitmap.Ok() || + !m_cancelBitmap.IsOk() || m_cancelBitmap.GetHeight() != bitmapHeight || m_cancelBitmap.GetWidth() != bitmapHeight ) diff --git a/Externals/wxWidgets3/src/generic/statusbr.cpp b/Externals/wxWidgets3/src/generic/statusbr.cpp index 7031967e24..df0391e226 100644 --- a/Externals/wxWidgets3/src/generic/statusbr.cpp +++ b/Externals/wxWidgets3/src/generic/statusbr.cpp @@ -4,7 +4,7 @@ // Author: Julian Smart // Modified by: Francesco Montorsi // Created: 01/02/97 -// RCS-ID: $Id: statusbr.cpp 67280 2011-03-22 14:17:38Z DS $ +// RCS-ID: $Id: statusbr.cpp 70625 2012-02-19 14:49:37Z SN $ // Copyright: (c) Julian Smart // Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// @@ -275,7 +275,7 @@ void wxStatusBarGeneric::DrawField(wxDC& dc, int i, int textHeight) GetFieldRect(i, rect); if (rect.GetWidth() <= 0) - return; // happens when the status bar is shrinked in a very small area! + return; // happens when the status bar is shrunk in a very small area! int style = m_panes[i].GetStyle(); if (style != wxSB_FLAT) @@ -414,9 +414,9 @@ void wxStatusBarGeneric::OnPaint(wxPaintEvent& WXUNUSED(event) ) GdkWindowEdge edge = GetLayoutDirection() == wxLayout_RightToLeft ? GDK_WINDOW_EDGE_SOUTH_WEST : GDK_WINDOW_EDGE_SOUTH_EAST; - gtk_paint_resize_grip( m_widget->style, + gtk_paint_resize_grip(gtk_widget_get_style(m_widget), GTKGetDrawingWindow(), - (GtkStateType) GTK_WIDGET_STATE (m_widget), + gtk_widget_get_state(m_widget), NULL, m_widget, "statusbar", diff --git a/Externals/wxWidgets3/src/generic/timectrlg.cpp b/Externals/wxWidgets3/src/generic/timectrlg.cpp new file mode 100644 index 0000000000..a54b002918 --- /dev/null +++ b/Externals/wxWidgets3/src/generic/timectrlg.cpp @@ -0,0 +1,668 @@ +/////////////////////////////////////////////////////////////////////////////// +// Name: src/generic/timectrl.cpp +// Purpose: Generic implementation of wxTimePickerCtrl. +// Author: Paul Breen, Vadim Zeitlin +// Created: 2011-09-22 +// RCS-ID: $Id: timectrlg.cpp 69991 2011-12-12 14:01:23Z VZ $ +// Copyright: (c) 2011 Vadim Zeitlin +// Licence: wxWindows licence +/////////////////////////////////////////////////////////////////////////////// + +// ============================================================================ +// declarations +// ============================================================================ + +// ---------------------------------------------------------------------------- +// headers +// ---------------------------------------------------------------------------- + +// for compilers that support precompilation, includes "wx.h". +#include "wx/wxprec.h" + +#ifdef __BORLANDC__ + #pragma hdrstop +#endif + +#if wxUSE_TIMEPICKCTRL + +#ifndef WX_PRECOMP + #include "wx/textctrl.h" +#endif // WX_PRECOMP + +#include "wx/timectrl.h" + +// This class is only compiled if there is no native version or if we +// explicitly want to use both the native and generic one (this is useful for +// testing but not much otherwise and so by default we don't use the generic +// implementation if a native one is available). +#if !defined(wxHAS_NATIVE_TIMEPICKERCTRL) || wxUSE_TIMEPICKCTRL_GENERIC + +#include "wx/generic/timectrl.h" + +#include "wx/dateevt.h" +#include "wx/spinbutt.h" + +#ifndef wxHAS_NATIVE_TIMEPICKERCTRL + IMPLEMENT_DYNAMIC_CLASS(wxTimePickerCtrl, wxControl) +#endif + +// ---------------------------------------------------------------------------- +// Constants +// ---------------------------------------------------------------------------- + +enum +{ + // Horizontal margin between the text and spin control. + HMARGIN_TEXT_SPIN = 2 +}; + +// ---------------------------------------------------------------------------- +// wxTimePickerGenericImpl: used to implement wxTimePickerCtrlGeneric +// ---------------------------------------------------------------------------- + +class wxTimePickerGenericImpl : public wxEvtHandler +{ +public: + wxTimePickerGenericImpl(wxTimePickerCtrlGeneric* ctrl) + { + m_text = new wxTextCtrl(ctrl, wxID_ANY, wxString()); + + // As this text can't be edited, don't use the standard cursor for it + // to avoid misleading the user. Ideally we'd also hide the caret but + // this is not currently supported by wxTextCtrl. + m_text->SetCursor(wxCURSOR_ARROW); + + m_btn = new wxSpinButton(ctrl, wxID_ANY, + wxDefaultPosition, wxDefaultSize, + wxSP_VERTICAL | wxSP_WRAP); + + m_currentField = Field_Hour; + m_isFirstDigit = true; + + // We don't support arbitrary formats currently as this requires + // significantly more work both here and also in wxLocale::GetInfo(). + // + // For now just use either "%H:%M:%S" or "%I:%M:%S %p". It would be + // nice to add support to "%k" and "%l" (hours with leading blanks + // instead of zeros) too as this is the most common unsupported case in + // practice. + m_useAMPM = wxLocale::GetInfo(wxLOCALE_TIME_FMT).Contains("%p"); + + m_text->Connect + ( + wxEVT_SET_FOCUS, + wxFocusEventHandler(wxTimePickerGenericImpl::OnTextSetFocus), + NULL, + this + ); + m_text->Connect + ( + wxEVT_KEY_DOWN, + wxKeyEventHandler(wxTimePickerGenericImpl::OnTextKeyDown), + NULL, + this + ); + m_text->Connect + ( + wxEVT_LEFT_DOWN, + wxMouseEventHandler(wxTimePickerGenericImpl::OnTextClick), + NULL, + this + ); + + m_btn->Connect + ( + wxEVT_SPIN_UP, + wxSpinEventHandler(wxTimePickerGenericImpl::OnArrowUp), + NULL, + this + ); + m_btn->Connect + ( + wxEVT_SPIN_DOWN, + wxSpinEventHandler(wxTimePickerGenericImpl::OnArrowDown), + NULL, + this + ); + } + + // Set the new value. + void SetValue(const wxDateTime& time) + { + m_time = time.IsValid() ? time : wxDateTime::Now(); + + UpdateTextWithoutEvent(); + } + + + // The text part of the control. + wxTextCtrl* m_text; + + // The spin button used to change the text fields. + wxSpinButton* m_btn; + + // The current time (date part is ignored). + wxDateTime m_time; + +private: + // The logical fields of the text control (AM/PM one may not be present). + enum Field + { + Field_Hour, + Field_Min, + Field_Sec, + Field_AMPM, + Field_Max + }; + + // Direction of change of time fields. + enum Direction + { + // Notice that the enum elements values matter. + Dir_Down = -1, + Dir_Up = +1 + }; + + // A range of character positions ("from" is inclusive, "to" -- exclusive). + struct CharRange + { + int from, + to; + }; + + // Event handlers for various events in our controls. + void OnTextSetFocus(wxFocusEvent& event) + { + HighlightCurrentField(); + + event.Skip(); + } + + // Keyboard interface here is modelled over MSW native control and may need + // adjustments for other platforms. + void OnTextKeyDown(wxKeyEvent& event) + { + const int key = event.GetKeyCode(); + + switch ( key ) + { + case WXK_DOWN: + ChangeCurrentFieldBy1(Dir_Down); + break; + + case WXK_UP: + ChangeCurrentFieldBy1(Dir_Up); + break; + + case WXK_LEFT: + CycleCurrentField(Dir_Down); + break; + + case WXK_RIGHT: + CycleCurrentField(Dir_Up); + break; + + case WXK_HOME: + ResetCurrentField(Dir_Down); + break; + + case WXK_END: + ResetCurrentField(Dir_Up); + break; + + case '0': + case '1': + case '2': + case '3': + case '4': + case '5': + case '6': + case '7': + case '8': + case '9': + // The digits work in all keys except AM/PM. + if ( m_currentField != Field_AMPM ) + { + AppendDigitToCurrentField(key - '0'); + } + break; + + case 'A': + case 'P': + // These keys only work to toggle AM/PM field. + if ( m_currentField == Field_AMPM ) + { + unsigned hour = m_time.GetHour(); + if ( key == 'A' ) + { + if ( hour >= 12 ) + hour -= 12; + } + else // PM + { + if ( hour < 12 ) + hour += 12; + } + + if ( hour != m_time.GetHour() ) + { + m_time.SetHour(hour); + UpdateText(); + } + } + break; + + // Do not skip the other events, just consume them to prevent the + // user from editing the text directly. + } + } + + void OnTextClick(wxMouseEvent& event) + { + Field field wxDUMMY_INITIALIZE(Field_Max); + long pos; + switch ( m_text->HitTest(event.GetPosition(), &pos) ) + { + case wxTE_HT_UNKNOWN: + // Don't do anything, it's better than doing something wrong. + return; + + case wxTE_HT_BEFORE: + // Select the first field. + field = Field_Hour; + break; + + case wxTE_HT_ON_TEXT: + // Find the field containing this position. + for ( field = Field_Hour; field <= GetLastField(); ) + { + const CharRange range = GetFieldRange(field); + + // Normally the "to" end is exclusive but we want to give + // focus to some field when the user clicks between them so + // count it as part of the preceding field here. + if ( range.from <= pos && pos <= range.to ) + break; + + field = static_cast(field + 1); + } + break; + + case wxTE_HT_BELOW: + // This shouldn't happen for single line control. + wxFAIL_MSG( "Unreachable" ); + // fall through + + case wxTE_HT_BEYOND: + // Select the last field. + field = GetLastField(); + break; + } + + ChangeCurrentField(field); + } + + void OnArrowUp(wxSpinEvent& WXUNUSED(event)) + { + ChangeCurrentFieldBy1(Dir_Up); + } + + void OnArrowDown(wxSpinEvent& WXUNUSED(event)) + { + ChangeCurrentFieldBy1(Dir_Down); + } + + + // Get the range of the given field in character positions ("from" is + // inclusive, "to" exclusive). + static CharRange GetFieldRange(Field field) + { + // Currently we can just hard code the ranges as they are the same for + // both supported formats, if we want to support arbitrary formats in + // the future, we'd need to determine them dynamically by examining the + // format here. + static const CharRange ranges[] = + { + { 0, 2 }, + { 3, 5 }, + { 6, 8 }, + { 9, 11}, + }; + + wxCOMPILE_TIME_ASSERT( WXSIZEOF(ranges) == Field_Max, + FieldRangesMismatch ); + + return ranges[field]; + } + + // Get the last field used depending on m_useAMPM. + Field GetLastField() const + { + return m_useAMPM ? Field_AMPM : Field_Sec; + } + + // Change the current field. For convenience, accept int field here as this + // allows us to use arithmetic operations in the caller. + void ChangeCurrentField(int field) + { + if ( field == m_currentField ) + return; + + wxCHECK_RET( field <= GetLastField(), "Invalid field" ); + + m_currentField = static_cast(field); + m_isFirstDigit = true; + + HighlightCurrentField(); + } + + // Go to the next (Dir_Up) or previous (Dir_Down) field, wrapping if + // necessary. + void CycleCurrentField(Direction dir) + { + const unsigned numFields = GetLastField() + 1; + + ChangeCurrentField((m_currentField + numFields + dir) % numFields); + } + + // Select the currently actively field. + void HighlightCurrentField() + { + m_text->SetFocus(); + + const CharRange range = GetFieldRange(m_currentField); + + m_text->SetSelection(range.from, range.to); + } + + // Decrement or increment the value of the current field (wrapping if + // necessary). + void ChangeCurrentFieldBy1(Direction dir) + { + switch ( m_currentField ) + { + case Field_Hour: + m_time.SetHour((m_time.GetHour() + 24 + dir) % 24); + break; + + case Field_Min: + m_time.SetMinute((m_time.GetMinute() + 60 + dir) % 60); + break; + + case Field_Sec: + m_time.SetSecond((m_time.GetSecond() + 60 + dir) % 60); + break; + + case Field_AMPM: + m_time.SetHour((m_time.GetHour() + 12) % 24); + break; + + case Field_Max: + wxFAIL_MSG( "Invalid field" ); + } + + UpdateText(); + } + + // Set the current field to its minimal or maximal value. + void ResetCurrentField(Direction dir) + { + switch ( m_currentField ) + { + case Field_Hour: + case Field_AMPM: + // In 12-hour mode setting the hour to the minimal value + // also changes the suffix to AM and, correspondingly, + // setting it to the maximal one changes the suffix to PM. + // And, for consistency with the native MSW behaviour, we + // also do the same thing when changing AM/PM field itself, + // so change hours in any case. + m_time.SetHour(dir == Dir_Down ? 0 : 23); + break; + + case Field_Min: + m_time.SetMinute(dir == Dir_Down ? 0 : 59); + break; + + case Field_Sec: + m_time.SetSecond(dir == Dir_Down ? 0 : 59); + break; + + case Field_Max: + wxFAIL_MSG( "Invalid field" ); + } + + UpdateText(); + } + + // Append the given digit (from 0 to 9) to the current value of the current + // field. + void AppendDigitToCurrentField(int n) + { + bool moveToNextField = false; + + if ( !m_isFirstDigit ) + { + // The first digit simply replaces the existing field contents, + // but the second one should be combined with the previous one, + // otherwise entering 2-digit numbers would be impossible. + int currentValue wxDUMMY_INITIALIZE(0), + maxValue wxDUMMY_INITIALIZE(0); + + switch ( m_currentField ) + { + case Field_Hour: + currentValue = m_time.GetHour(); + maxValue = 23; + break; + + case Field_Min: + currentValue = m_time.GetMinute(); + maxValue = 59; + break; + + case Field_Sec: + currentValue = m_time.GetSecond(); + maxValue = 59; + break; + + case Field_AMPM: + case Field_Max: + wxFAIL_MSG( "Invalid field" ); + } + + // Check if the new value is acceptable. If not, we just handle + // this digit as if it were the first one. + int newValue = currentValue*10 + n; + if ( newValue < maxValue ) + { + n = newValue; + + // If we're not on the seconds field, advance to the next one. + // This makes it more convenient to enter times as you can just + // press all digits one after one without touching the cursor + // arrow keys at all. + // + // Notice that MSW native control doesn't do this but it seems + // so useful that we intentionally diverge from it here. + moveToNextField = true; + + // We entered both digits so the next one will be "first" again. + m_isFirstDigit = true; + } + } + else // First digit entered. + { + // The next one won't be first any more. + m_isFirstDigit = false; + } + + switch ( m_currentField ) + { + case Field_Hour: + m_time.SetHour(n); + break; + + case Field_Min: + m_time.SetMinute(n); + break; + + case Field_Sec: + m_time.SetSecond(n); + break; + + case Field_AMPM: + case Field_Max: + wxFAIL_MSG( "Invalid field" ); + } + + if ( moveToNextField && m_currentField < Field_Sec ) + CycleCurrentField(Dir_Up); + + UpdateText(); + } + + // Update the text value to correspond to the current time. By default also + // generate an event but this can be avoided by calling the "WithoutEvent" + // variant. + void UpdateText() + { + UpdateTextWithoutEvent(); + + wxWindow* const ctrl = m_text->GetParent(); + + wxDateEvent event(ctrl, m_time, wxEVT_TIME_CHANGED); + ctrl->HandleWindowEvent(event); + } + + void UpdateTextWithoutEvent() + { + m_text->SetValue(m_time.Format(m_useAMPM ? "%I:%M:%S %p" : "%H:%M:%S")); + + HighlightCurrentField(); + } + + + // The current field of the text control: this is the one affected by + // pressing arrow keys or spin button. + Field m_currentField; + + // Flag indicating whether we use AM/PM indicator or not. + bool m_useAMPM; + + // Flag indicating whether the next digit pressed by user will be the first + // digit of the current field or the second one. This is necessary because + // the first digit replaces the current field contents while the second one + // is appended to it (if possible, e.g. pressing '7' in a field already + // containing '8' will still replace it as "78" would be invalid). + bool m_isFirstDigit; + + wxDECLARE_NO_COPY_CLASS(wxTimePickerGenericImpl); +}; + +// ============================================================================ +// wxTimePickerCtrlGeneric implementation +// ============================================================================ + +// ---------------------------------------------------------------------------- +// wxTimePickerCtrlGeneric creation +// ---------------------------------------------------------------------------- + +void wxTimePickerCtrlGeneric::Init() +{ + m_impl = NULL; +} + +bool +wxTimePickerCtrlGeneric::Create(wxWindow *parent, + wxWindowID id, + const wxDateTime& date, + const wxPoint& pos, + const wxSize& size, + long style, + const wxValidator& validator, + const wxString& name) +{ + // The text control we use already has a border, so we don't need one + // ourselves. + style &= ~wxBORDER_MASK; + style |= wxBORDER_NONE; + + if ( !Base::Create(parent, id, pos, size, style, validator, name) ) + return false; + + m_impl = new wxTimePickerGenericImpl(this); + m_impl->SetValue(date); + + InvalidateBestSize(); + SetInitialSize(size); + + return true; +} + +wxTimePickerCtrlGeneric::~wxTimePickerCtrlGeneric() +{ + delete m_impl; +} + +wxWindowList wxTimePickerCtrlGeneric::GetCompositeWindowParts() const +{ + wxWindowList parts; + if ( m_impl ) + { + parts.push_back(m_impl->m_text); + parts.push_back(m_impl->m_btn); + } + return parts; +} + +// ---------------------------------------------------------------------------- +// wxTimePickerCtrlGeneric value +// ---------------------------------------------------------------------------- + +void wxTimePickerCtrlGeneric::SetValue(const wxDateTime& date) +{ + wxCHECK_RET( m_impl, "Must create first" ); + + m_impl->SetValue(date); +} + +wxDateTime wxTimePickerCtrlGeneric::GetValue() const +{ + wxCHECK_MSG( m_impl, wxDateTime(), "Must create first" ); + + return m_impl->m_time; +} + +// ---------------------------------------------------------------------------- +// wxTimePickerCtrlGeneric geometry +// ---------------------------------------------------------------------------- + +void wxTimePickerCtrlGeneric::DoMoveWindow(int x, int y, int width, int height) +{ + Base::DoMoveWindow(x, y, width, height); + + if ( !m_impl ) + return; + + const int widthBtn = m_impl->m_btn->GetSize().x; + const int widthText = width - widthBtn - HMARGIN_TEXT_SPIN; + + m_impl->m_text->SetSize(0, 0, widthText, height); + m_impl->m_btn->SetSize(widthText + HMARGIN_TEXT_SPIN, 0, widthBtn, height); +} + +wxSize wxTimePickerCtrlGeneric::DoGetBestSize() const +{ + if ( !m_impl ) + return Base::DoGetBestSize(); + + wxSize size = m_impl->m_text->GetBestSize(); + size.x += m_impl->m_btn->GetBestSize().x + HMARGIN_TEXT_SPIN; + + return size; +} + +#endif // !wxHAS_NATIVE_TIMEPICKERCTRL || wxUSE_TIMEPICKCTRL_GENERIC + +#endif // wxUSE_TIMEPICKCTRL diff --git a/Externals/wxWidgets3/src/generic/timer.cpp b/Externals/wxWidgets3/src/generic/timer.cpp index e7d67f9942..2b45a5d092 100644 --- a/Externals/wxWidgets3/src/generic/timer.cpp +++ b/Externals/wxWidgets3/src/generic/timer.cpp @@ -2,7 +2,7 @@ // Name: src/generic/timer.cpp // Purpose: wxTimer implementation // Author: Vaclav Slavik -// Id: $Id: timer.cpp 67280 2011-03-22 14:17:38Z DS $ +// Id: $Id: timer.cpp 70353 2012-01-15 14:46:41Z VZ $ // Copyright: (c) Vaclav Slavik // Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// @@ -34,58 +34,22 @@ // Time input function // ---------------------------------------------------------------------------- -#ifdef __WXMGL__ - // We take advantage of wxMGL's _EVT_getTicks because it is faster - // (especially under MS-DOS!) and more precise than wxGetLocalTimeMillis - // if we are unlucky and the latter combines information from two sources. - #include "wx/mgl/private.h" - extern "C" ulong _EVT_getTicks(); - #define GetMillisecondsTime _EVT_getTicks +#define GetMillisecondsTime wxGetLocalTimeMillis - typedef ulong wxTimerTick_t; +typedef wxLongLong wxTimerTick_t; - #define wxTimerTickFmtSpec wxT("lu") - #define wxTimerTickPrintfArg(tt) (tt) +#if wxUSE_LONGLONG_WX + #define wxTimerTickFmtSpec wxLongLongFmtSpec "d" + #define wxTimerTickPrintfArg(tt) (tt.GetValue()) +#else // using native wxLongLong + #define wxTimerTickFmtSpec wxT("s") + #define wxTimerTickPrintfArg(tt) (tt.ToString().c_str()) +#endif // wx/native long long - #ifdef __DOS__ - // Under DOS the MGL timer has a 24hr period, so consider the 12 hours - // before y to be 'less' and the 12 hours after 'greater' modulo - // 24 hours. - inline bool wxTickGreaterEqual(wxTimerTick_t x, wxTimerTick_t y) - { - // _EVT_getTicks wraps at 1573040 * 55 - const wxTimerTick_t modulus = 1573040 * 55; - return (2 * modulus + x - y) % modulus < modulus / 2; - } - #else - // If wxTimerTick_t is 32-bits then it'll wrap in around 50 days. So - // let the 25 days before y be 'less' and 25 days after be 'greater'. - inline bool wxTickGreaterEqual(wxTimerTick_t x, wxTimerTick_t y) - { - // This code assumes wxTimerTick_t is an unsigned type. - // Set half_modulus with top bit set and the rest zeros. - const wxTimerTick_t half_modulus = ~((~(wxTimerTick_t)0) >> 1); - return x - y < half_modulus; - } - #endif -#else // !__WXMGL__ - #define GetMillisecondsTime wxGetLocalTimeMillis - - typedef wxLongLong wxTimerTick_t; - - #if wxUSE_LONGLONG_WX - #define wxTimerTickFmtSpec wxLongLongFmtSpec "d" - #define wxTimerTickPrintfArg(tt) (tt.GetValue()) - #else // using native wxLongLong - #define wxTimerTickFmtSpec wxT("s") - #define wxTimerTickPrintfArg(tt) (tt.ToString().c_str()) - #endif // wx/native long long - - inline bool wxTickGreaterEqual(wxTimerTick_t x, wxTimerTick_t y) - { - return x >= y; - } -#endif // __WXMGL__/!__WXMGL__ +inline bool wxTickGreaterEqual(wxTimerTick_t x, wxTimerTick_t y) +{ + return x >= y; +} // ---------------------------------------------------------------------------- // helper structures and wxTimerScheduler diff --git a/Externals/wxWidgets3/src/generic/tipwin.cpp b/Externals/wxWidgets3/src/generic/tipwin.cpp index 42bd966eeb..6164e216c0 100644 --- a/Externals/wxWidgets3/src/generic/tipwin.cpp +++ b/Externals/wxWidgets3/src/generic/tipwin.cpp @@ -4,7 +4,7 @@ // Author: Vadim Zeitlin // Modified by: // Created: 10.09.00 -// RCS-ID: $Id: tipwin.cpp 61508 2009-07-23 20:30:22Z VZ $ +// RCS-ID: $Id: tipwin.cpp 70843 2012-03-08 16:45:17Z PC $ // Copyright: (c) 2000 Vadim Zeitlin // Licence: wxWindows licence /////////////////////////////////////////////////////////////////////////////// @@ -167,7 +167,7 @@ wxTipWindow::~wxTipWindow() { *m_windowPtr = NULL; } - #ifdef wxUSE_POPUPWIN + #if wxUSE_POPUPWIN #ifdef __WXGTK__ if ( m_view->HasCapture() ) m_view->ReleaseMouse(); diff --git a/Externals/wxWidgets3/src/generic/treectlg.cpp b/Externals/wxWidgets3/src/generic/treectlg.cpp index 72a6b5b8d0..b17ec147a5 100644 --- a/Externals/wxWidgets3/src/generic/treectlg.cpp +++ b/Externals/wxWidgets3/src/generic/treectlg.cpp @@ -4,7 +4,7 @@ // Author: Robert Roebling // Created: 01/02/97 // Modified: 22/10/98 - almost total rewrite, simpler interface (VZ) -// Id: $Id: treectlg.cpp 67280 2011-03-22 14:17:38Z DS $ +// Id: $Id: treectlg.cpp 70625 2012-02-19 14:49:37Z SN $ // Copyright: (c) 1998 Robert Roebling and Julian Smart // Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// @@ -441,7 +441,7 @@ wxTreeTextCtrl::wxTreeTextCtrl(wxGenericTreeCtrl *owner, rect.y -= 2; rect.width += 8; rect.height += 4; -#elif defined(__WXMAC__) +#elif defined(wxOSX_USE_CARBON) && wxOSX_USE_CARBON int bestHeight = GetBestSize().y - 8; if ( rect.height > bestHeight ) { @@ -997,7 +997,7 @@ bool wxGenericTreeCtrl::Create(wxWindow *parent, #endif if ( !wxControl::Create( parent, id, pos, size, - style|wxHSCROLL|wxVSCROLL, + style|wxHSCROLL|wxVSCROLL|wxWANTS_CHARS, validator, name ) ) return false; @@ -2054,7 +2054,8 @@ wxGenericTreeCtrl::TagAllChildrenUntilLast(wxGenericTreeItem *crt_item, if (crt_item==last_item) return true; - if (crt_item->HasChildren()) + // We should leave the not shown children of collapsed items alone. + if (crt_item->HasChildren() && crt_item->IsExpanded()) { wxArrayGenericTreeItems& children = crt_item->GetChildren(); size_t count = children.GetCount(); @@ -2878,7 +2879,7 @@ wxGenericTreeCtrl::PaintLevel(wxGenericTreeItem *item, yOrigin = abs(yOrigin); GetClientSize(&width, &height); - // Move end points to the begining/end of the view? + // Move end points to the beginning/end of the view? if (y_mid < yOrigin) y_mid = yOrigin; if (oldY > yOrigin + height) diff --git a/Externals/wxWidgets3/src/generic/treelist.cpp b/Externals/wxWidgets3/src/generic/treelist.cpp new file mode 100644 index 0000000000..deedad6351 --- /dev/null +++ b/Externals/wxWidgets3/src/generic/treelist.cpp @@ -0,0 +1,1677 @@ +/////////////////////////////////////////////////////////////////////////////// +// Name: src/generic/treelist.cpp +// Purpose: Generic wxTreeListCtrl implementation. +// Author: Vadim Zeitlin +// Created: 2011-08-19 +// RCS-ID: $Id: treelist.cpp 69805 2011-11-23 23:58:54Z VZ $ +// Copyright: (c) 2011 Vadim Zeitlin +// Licence: wxWindows licence +/////////////////////////////////////////////////////////////////////////////// + +// ============================================================================ +// Declarations +// ============================================================================ + +// ---------------------------------------------------------------------------- +// Headers +// ---------------------------------------------------------------------------- + +// for compilers that support precompilation, includes "wx.h". +#include "wx/wxprec.h" + +#ifdef __BORLANDC__ + #pragma hdrstop +#endif + +#if wxUSE_TREELISTCTRL + +#ifndef WX_PRECOMP + #include "wx/dc.h" +#endif // WX_PRECOMP + +#include "wx/treelist.h" + +#include "wx/dataview.h" +#include "wx/renderer.h" +#include "wx/scopedarray.h" +#include "wx/scopedptr.h" + +// ---------------------------------------------------------------------------- +// Constants +// ---------------------------------------------------------------------------- + +const char wxTreeListCtrlNameStr[] = "wxTreeListCtrl"; + +const wxTreeListItem wxTLI_FIRST(reinterpret_cast(-1)); +const wxTreeListItem wxTLI_LAST(reinterpret_cast(-2)); + +// ---------------------------------------------------------------------------- +// wxTreeListModelNode: a node in the internal tree representation. +// ---------------------------------------------------------------------------- + +class wxTreeListModelNode +{ +public: + wxTreeListModelNode(wxTreeListModelNode* parent, + const wxString& text = wxString(), + int imageClosed = wxWithImages::NO_IMAGE, + int imageOpened = wxWithImages::NO_IMAGE, + wxClientData* data = NULL) + : m_text(text), + m_parent(parent) + { + m_child = + m_next = NULL; + + m_imageClosed = imageClosed; + m_imageOpened = imageOpened; + + m_checkedState = wxCHK_UNCHECKED; + + m_data = data; + + m_columnsTexts = NULL; + } + + // Destroying the node also (recursively) destroys its children. + ~wxTreeListModelNode() + { + for ( wxTreeListModelNode* node = m_child; node; ) + { + wxTreeListModelNode* child = node; + node = node->m_next; + delete child; + } + + delete m_data; + + delete [] m_columnsTexts; + } + + + // Public fields for the first column text and other simple attributes: + // there is no need to have accessors/mutators for those as there is no + // encapsulation anyhow, all of those are exposed in our public API. + wxString m_text; + + int m_imageClosed, + m_imageOpened; + + wxCheckBoxState m_checkedState; + + + // Accessors for the fields that are not directly exposed. + + // Client data is owned by us so delete the old value when setting the new + // one. + wxClientData* GetClientData() const { return m_data; } + void SetClientData(wxClientData* data) { delete m_data; m_data = data; } + + // Setting or getting the non-first column text. Getting is simple but you + // need to call HasColumnsTexts() first as the column data is only + // allocated on demand. And when setting the text we require to be given + // the total number of columns as we allocate the entire array at once, + // this is more efficient than using dynamically-expandable wxVector that + // we know won't be needed as the number of columns is usually fixed. But + // if it does change, our OnInsertColumn() must be called. + // + // Notice the presence of -1 everywhere in these methods: this is because + // the text for the first column is always stored in m_text and so we don't + // store it in m_columnsTexts. + + bool HasColumnsTexts() const { return m_columnsTexts != NULL; } + const wxString& GetColumnText(unsigned col) const + { + return m_columnsTexts[col - 1]; + } + + void SetColumnText(const wxString& text, unsigned col, unsigned numColumns) + { + if ( !m_columnsTexts ) + m_columnsTexts = new wxString[numColumns - 1]; + + m_columnsTexts[col - 1] = text; + } + + void OnInsertColumn(unsigned col, unsigned numColumns) + { + wxASSERT_MSG( col, "Shouldn't be called for the first column" ); + + // Nothing to do if we don't have any text. + if ( !m_columnsTexts ) + return; + + wxScopedArray oldTexts(m_columnsTexts); + m_columnsTexts = new wxString[numColumns - 1]; + + // In the loop below n is the index in the new column texts array and m + // is the index in the old one. + for ( unsigned n = 1, m = 1; n < numColumns - 1; n++, m++ ) + { + if ( n == col ) + { + // Leave the new array text initially empty and just adjust the + // index (to compensate for "m++" done by the loop anyhow). + m--; + } + else // Not the newly inserted column. + { + // Copy the old text value. + m_columnsTexts[n - 1] = oldTexts[m - 1]; + } + } + } + + void OnDeleteColumn(unsigned col, unsigned numColumns) + { + wxASSERT_MSG( col, "Shouldn't be called for the first column" ); + + if ( !m_columnsTexts ) + return; + + wxScopedArray oldTexts(m_columnsTexts); + m_columnsTexts = new wxString[numColumns - 2]; + for ( unsigned n = 1, m = 1; n < numColumns - 1; n++, m++ ) + { + if ( n == col ) + { + n--; + } + else // Not the deleted column. + { + m_columnsTexts[n - 1] = oldTexts[m - 1]; + } + } + } + + void OnClearColumns() + { + if ( m_columnsTexts ) + { + delete [] m_columnsTexts; + m_columnsTexts = NULL; + } + } + + + // Functions for modifying the tree. + + // Insert the given item as the first child of this one. The parent pointer + // must have been already set correctly at creation and we take ownership + // of the pointer and will delete it later. + void InsertChild(wxTreeListModelNode* child) + { + wxASSERT( child->m_parent == this ); + + // Our previous first child becomes the next sibling of the new child. + child->m_next = m_child; + m_child = child; + } + + // Insert the given item as our next sibling. As above, the item must have + // the correct parent pointer and we take ownership of it. + void InsertNext(wxTreeListModelNode* next) + { + wxASSERT( next->m_parent == m_parent ); + + next->m_next = m_next; + m_next = next; + } + + // Remove the first child of this item from the tree and delete it. + void DeleteChild() + { + wxTreeListModelNode* const oldChild = m_child; + m_child = m_child->m_next; + delete oldChild; + } + + // Remove the next sibling of this item from the tree and deletes it. + void DeleteNext() + { + wxTreeListModelNode* const oldNext = m_next; + m_next = m_next->m_next; + delete oldNext; + } + + + // Functions for tree traversal. All of them can return NULL. + + // Only returns NULL when called on the root item. + wxTreeListModelNode* GetParent() const { return m_parent; } + + // Returns the first child of this item. + wxTreeListModelNode* GetChild() const { return m_child; } + + // Returns the next sibling of this item. + wxTreeListModelNode* GetNext() const { return m_next; } + + // Unlike the previous two functions, this one is not a simple accessor + // (hence it's not called "GetSomething") but computes the next node after + // this one in tree order. + wxTreeListModelNode* NextInTree() const + { + if ( m_child ) + return m_child; + + if ( m_next ) + return m_next; + + // Recurse upwards until we find the next sibling. + for ( wxTreeListModelNode* node = m_parent; node; node = node->m_parent ) + { + if ( node->m_next ) + return node->m_next; + } + + return NULL; + } + + +private: + // The (never changing after creation) parent of this node and the possibly + // NULL pointers to its first child and next sibling. + wxTreeListModelNode* const m_parent; + wxTreeListModelNode* m_child; + wxTreeListModelNode* m_next; + + // Client data pointer owned by the control. May be NULL. + wxClientData* m_data; + + // Array of column values for all the columns except the first one. May be + // NULL if no values had been set for them. + wxString* m_columnsTexts; +}; + +// ---------------------------------------------------------------------------- +// wxTreeListModel: wxDataViewModel implementation used by wxTreeListCtrl. +// ---------------------------------------------------------------------------- + +class wxTreeListModel : public wxDataViewModel +{ +public: + typedef wxTreeListModelNode Node; + + // Unlike a general wxDataViewModel, this model can only be used with a + // single control at once. The main reason for this is that we need to + // support different icons for opened and closed items and the item state + // is associated with the control, not the model, so our GetValue() is also + // bound to it (otherwise, what would it return for an item expanded in one + // associated control and collapsed in another one?). + wxTreeListModel(wxTreeListCtrl* treelist); + virtual ~wxTreeListModel(); + + + // Helpers for converting between wxDataViewItem and wxTreeListItem. These + // methods simply cast the pointer to/from wxDataViewItem except for the + // root node that we handle specially unless explicitly disabled. + // + // The advantage of using them is that they're greppable and stand out + // better, hopefully making the code more clear. + Node* FromNonRootDVI(wxDataViewItem dvi) const + { + return static_cast(dvi.GetID()); + } + + Node* FromDVI(wxDataViewItem dvi) const + { + if ( !dvi.IsOk() ) + return m_root; + + return FromNonRootDVI(dvi); + } + + wxDataViewItem ToNonRootDVI(Node* node) const + { + return wxDataViewItem(node); + } + + wxDataViewItem ToDVI(Node* node) const + { + // Our root item must be represented as NULL at wxDVC level to map to + // its own invisible root. + if ( !node->GetParent() ) + return wxDataViewItem(); + + return ToNonRootDVI(node); + } + + + // Methods called by wxTreeListCtrl. + void InsertColumn(unsigned col); + void DeleteColumn(unsigned col); + void ClearColumns(); + + Node* InsertItem(Node* parent, + Node* previous, + const wxString& text, + int imageClosed, + int imageOpened, + wxClientData* data); + void DeleteItem(Node* item); + void DeleteAllItems(); + + Node* GetRootItem() const { return m_root; } + + const wxString& GetItemText(Node* item, unsigned col) const; + void SetItemText(Node* item, unsigned col, const wxString& text); + void SetItemImage(Node* item, int closed, int opened); + wxClientData* GetItemData(Node* item) const; + void SetItemData(Node* item, wxClientData* data); + + void CheckItem(Node* item, wxCheckBoxState checkedState); + void ToggleItem(wxDataViewItem item); + + + // Implement the base class pure virtual methods. + virtual unsigned GetColumnCount() const; + virtual wxString GetColumnType(unsigned col) const; + virtual void GetValue(wxVariant& variant, + const wxDataViewItem& item, + unsigned col) const; + virtual bool SetValue(const wxVariant& variant, + const wxDataViewItem& item, + unsigned col); + virtual wxDataViewItem GetParent(const wxDataViewItem& item) const; + virtual bool IsContainer(const wxDataViewItem& item) const; + virtual bool HasContainerColumns(const wxDataViewItem& item) const; + virtual unsigned GetChildren(const wxDataViewItem& item, + wxDataViewItemArray& children) const; + virtual bool IsListModel() const { return m_isFlat; } + virtual int Compare(const wxDataViewItem& item1, + const wxDataViewItem& item2, + unsigned col, + bool ascending) const; + +private: + // The control we're associated with. + wxTreeListCtrl* const m_treelist; + + // The unique invisible root element. + Node* const m_root; + + // Number of columns we maintain. + unsigned m_numColumns; + + // Set to false as soon as we have more than one level, i.e. as soon as any + // items with non-root item as parent are added (and currently never reset + // after this). + bool m_isFlat; +}; + +// ============================================================================ +// wxDataViewCheckIconText[Renderer]: special renderer for our first column. +// ============================================================================ + +// Currently this class is private but it could be extracted and made part of +// public API later as could be used directly with wxDataViewCtrl as well. +namespace +{ + +const char* CHECK_ICON_TEXT_TYPE = "wxDataViewCheckIconText"; + +// The value used by wxDataViewCheckIconTextRenderer +class wxDataViewCheckIconText : public wxDataViewIconText +{ +public: + wxDataViewCheckIconText(const wxString& text = wxString(), + const wxIcon& icon = wxNullIcon, + wxCheckBoxState checkedState = wxCHK_UNDETERMINED) + : wxDataViewIconText(text, icon), + m_checkedState(checkedState) + { + } + + wxDataViewCheckIconText(const wxDataViewCheckIconText& other) + : wxDataViewIconText(other), + m_checkedState(other.m_checkedState) + { + } + + bool IsSameAs(const wxDataViewCheckIconText& other) const + { + return wxDataViewIconText::IsSameAs(other) && + m_checkedState == other.m_checkedState; + } + + // There is no encapsulation anyhow, so just expose this field directly. + wxCheckBoxState m_checkedState; + + +private: + wxDECLARE_DYNAMIC_CLASS(wxDataViewCheckIconText); +}; + +wxIMPLEMENT_DYNAMIC_CLASS(wxDataViewCheckIconText, wxDataViewIconText); + +DECLARE_VARIANT_OBJECT(wxDataViewCheckIconText) +IMPLEMENT_VARIANT_OBJECT(wxDataViewCheckIconText) + + +class wxDataViewCheckIconTextRenderer : public wxDataViewCustomRenderer +{ +public: + wxDataViewCheckIconTextRenderer() + : wxDataViewCustomRenderer(CHECK_ICON_TEXT_TYPE, + wxDATAVIEW_CELL_ACTIVATABLE) + { + } + + virtual bool SetValue(const wxVariant& value) + { + m_value << value; + return true; + } + + virtual bool GetValue(wxVariant& WXUNUSED(value)) const + { + return false; + } + + wxSize GetSize() const + { + wxSize size = GetCheckSize(); + size.x += MARGIN_CHECK_ICON; + + if ( m_value.GetIcon().IsOk() ) + { + const wxSize sizeIcon = m_value.GetIcon().GetSize(); + if ( sizeIcon.y > size.y ) + size.y = sizeIcon.y; + + size.x += sizeIcon.x + MARGIN_ICON_TEXT; + } + + wxString text = m_value.GetText(); + if ( text.empty() ) + text = "Dummy"; + + const wxSize sizeText = GetTextExtent(text); + if ( sizeText.y > size.y ) + size.y = sizeText.y; + + size.x += sizeText.x; + + return size; + } + + virtual bool Render(wxRect cell, wxDC* dc, int state) + { + // Draw the checkbox first. + int renderFlags = 0; + switch ( m_value.m_checkedState ) + { + case wxCHK_UNCHECKED: + break; + + case wxCHK_CHECKED: + renderFlags |= wxCONTROL_CHECKED; + break; + + case wxCHK_UNDETERMINED: + renderFlags |= wxCONTROL_UNDETERMINED; + break; + } + + if ( state & wxDATAVIEW_CELL_PRELIT ) + renderFlags |= wxCONTROL_CURRENT; + + const wxSize sizeCheck = GetCheckSize(); + + wxRect rectCheck(cell.GetPosition(), sizeCheck); + rectCheck = rectCheck.CentreIn(cell, wxVERTICAL); + + wxRendererNative::Get().DrawCheckBox + ( + GetView(), *dc, rectCheck, renderFlags + ); + + // Then the icon, if any. + int xoffset = sizeCheck.x + MARGIN_CHECK_ICON; + + const wxIcon& icon = m_value.GetIcon(); + if ( icon.IsOk() ) + { + const wxSize sizeIcon = icon.GetSize(); + wxRect rectIcon(cell.GetPosition(), sizeIcon); + rectIcon.x += xoffset; + rectIcon = rectIcon.CentreIn(cell, wxVERTICAL); + + dc->DrawIcon(icon, rectIcon.GetPosition()); + + xoffset += sizeIcon.x + MARGIN_ICON_TEXT; + } + + // Finally the text. + RenderText(m_value.GetText(), xoffset, cell, dc, state); + + return true; + } + + // Event handlers toggling the items checkbox if it was clicked. + virtual bool ActivateCell(const wxRect& WXUNUSED(cell), + wxDataViewModel *model, + const wxDataViewItem & item, + unsigned int WXUNUSED(col), + const wxMouseEvent *mouseEvent) + { + if ( mouseEvent ) + { + if ( !wxRect(GetCheckSize()).Contains(mouseEvent->GetPosition()) ) + return false; + } + + static_cast(model)->ToggleItem(item); + return true; + } + +protected: + wxSize GetCheckSize() const + { + return wxRendererNative::Get().GetCheckBoxSize(GetView()); + } + +private: + // Just some arbitrary constants defining margins, in pixels. + enum + { + MARGIN_CHECK_ICON = 3, + MARGIN_ICON_TEXT = 4 + }; + + wxDataViewCheckIconText m_value; +}; + +} // anonymous namespace + +// ============================================================================ +// wxTreeListModel implementation +// ============================================================================ + +wxTreeListModel::wxTreeListModel(wxTreeListCtrl* treelist) + : m_treelist(treelist), + m_root(new Node(NULL)) +{ + m_numColumns = 0; + m_isFlat = true; +} + +wxTreeListModel::~wxTreeListModel() +{ + delete m_root; +} + +void wxTreeListModel::InsertColumn(unsigned col) +{ + m_numColumns++; + + // There is no need to update anything when inserting the first column. + if ( m_numColumns == 1 ) + return; + + // Update all the items as they may have texts for the old columns. + for ( Node* node = m_root->GetChild(); node; node = node->NextInTree() ) + { + node->OnInsertColumn(col, m_numColumns); + } +} + +void wxTreeListModel::DeleteColumn(unsigned col) +{ + wxCHECK_RET( col < m_numColumns, "Invalid column index" ); + + // Update all the items to remove the text for the non first columns. + if ( col > 0 ) + { + for ( Node* node = m_root->GetChild(); node; node = node->NextInTree() ) + { + node->OnDeleteColumn(col, m_numColumns); + } + } + + m_numColumns--; +} + +void wxTreeListModel::ClearColumns() +{ + m_numColumns = 0; + + for ( Node* node = m_root->GetChild(); node; node = node->NextInTree() ) + { + node->OnClearColumns(); + } +} + +wxTreeListModelNode* +wxTreeListModel::InsertItem(Node* parent, + Node* previous, + const wxString& text, + int imageClosed, + int imageOpened, + wxClientData* data) +{ + wxCHECK_MSG( parent, NULL, + "Must have a valid parent (maybe GetRootItem()?)" ); + + wxCHECK_MSG( previous, NULL, + "Must have a valid previous item (maybe wxTLI_FIRST/LAST?)" ); + + if ( m_isFlat && parent != m_root ) + { + // Not flat any more, this is a second level child. + m_isFlat = false; + } + + wxScopedPtr + newItem(new Node(parent, text, imageClosed, imageOpened, data)); + + // FIXME-VC6: This compiler refuses to compare "Node* previous" with + // wxTLI_XXX without some help. + const wxTreeListItem previousItem(previous); + + // If we have no children at all, then inserting as last child is the same + // as inserting as the first one so check for it here too. + if ( previousItem == wxTLI_FIRST || + (previousItem == wxTLI_LAST && !parent->GetChild()) ) + { + parent->InsertChild(newItem.get()); + } + else // Not the first item, find the previous one. + { + if ( previousItem == wxTLI_LAST ) + { + previous = parent->GetChild(); + + // Find the last child. + for ( ;; ) + { + Node* const next = previous->GetNext(); + if ( !next ) + break; + + previous = next; + } + } + else // We already have the previous item. + { + // Just check it's under the correct parent. + wxCHECK_MSG( previous->GetParent() == parent, NULL, + "Previous item is not under the right parent" ); + } + + previous->InsertNext(newItem.get()); + } + + ItemAdded(ToDVI(parent), ToDVI(newItem.get())); + + // The item was successfully inserted in the tree and so will be deleted by + // it, we can detach it now. + return newItem.release(); +} + +void wxTreeListModel::DeleteItem(Node* item) +{ + wxCHECK_RET( item, "Invalid item" ); + + wxCHECK_RET( item != m_root, "Can't delete the root item" ); + + Node* const parent = item->GetParent(); + + ItemDeleted(ToDVI(parent), ToDVI(item)); + + Node* previous = parent->GetChild(); + if ( previous == item ) + { + parent->DeleteChild(); + } + else // Not the first child of its parent. + { + // Find the sibling just before it. + for ( ;; ) + { + Node* const next = previous->GetNext(); + if ( next == item ) + break; + + wxCHECK_RET( next, "Item not a child of its parent?" ); + + previous = next; + } + + previous->DeleteNext(); + } +} + +void wxTreeListModel::DeleteAllItems() +{ + while ( m_root->GetChild() ) + { + m_root->DeleteChild(); + } + + Cleared(); +} + +const wxString& wxTreeListModel::GetItemText(Node* item, unsigned col) const +{ + // Returning root item text here is bogus, it just happens to be an always + // empty string we can return reference to. + wxCHECK_MSG( item, m_root->m_text, "Invalid item" ); + + // Notice that asking for the text of a column of an item that doesn't have + // any column texts is not an error so we simply return an empty string in + // this case. + return col == 0 ? item->m_text + : item->HasColumnsTexts() ? item->GetColumnText(col) + : m_root->m_text; +} + +void wxTreeListModel::SetItemText(Node* item, unsigned col, const wxString& text) +{ + wxCHECK_RET( item, "Invalid item" ); + + if ( col == 0 ) + item->m_text = text; + else + item->SetColumnText(text, col, m_numColumns); + + ValueChanged(ToDVI(item), col); +} + +void wxTreeListModel::SetItemImage(Node* item, int closed, int opened) +{ + wxCHECK_RET( item, "Invalid item" ); + + item->m_imageClosed = closed; + item->m_imageOpened = opened; + + ValueChanged(ToDVI(item), 0); +} + +wxClientData* wxTreeListModel::GetItemData(Node* item) const +{ + wxCHECK_MSG( item, NULL, "Invalid item" ); + + return item->GetClientData(); +} + +void wxTreeListModel::SetItemData(Node* item, wxClientData* data) +{ + wxCHECK_RET( item, "Invalid item" ); + + item->SetClientData(data); +} + +void wxTreeListModel::CheckItem(Node* item, wxCheckBoxState checkedState) +{ + wxCHECK_RET( item, "Invalid item" ); + + item->m_checkedState = checkedState; + + ItemChanged(ToDVI(item)); +} + +void wxTreeListModel::ToggleItem(wxDataViewItem dvi) +{ + Node* const item = FromDVI(dvi); + + wxCHECK_RET( item, "Invalid item" ); + + const wxCheckBoxState stateOld = item->m_checkedState; + + // If the 3rd state is user-settable then the cycle is + // unchecked->checked->undetermined. + switch ( stateOld ) + { + case wxCHK_CHECKED: + item->m_checkedState = m_treelist->HasFlag(wxTL_USER_3STATE) + ? wxCHK_UNDETERMINED + : wxCHK_UNCHECKED; + break; + + case wxCHK_UNDETERMINED: + // Whether 3rd state is user-settable or not, the next state is + // unchecked. + item->m_checkedState = wxCHK_UNCHECKED; + break; + + case wxCHK_UNCHECKED: + item->m_checkedState = wxCHK_CHECKED; + break; + } + + ItemChanged(ToDVI(item)); + + m_treelist->OnItemToggled(item, stateOld); +} + +unsigned wxTreeListModel::GetColumnCount() const +{ + return m_numColumns; +} + +wxString wxTreeListModel::GetColumnType(unsigned col) const +{ + if ( col == 0 ) + { + return m_treelist->HasFlag(wxTL_CHECKBOX) + ? wxS("wxDataViewCheckIconText") + : wxS("wxDataViewIconText"); + } + else // All the other columns contain just text. + { + return wxS("string"); + } +} + +void +wxTreeListModel::GetValue(wxVariant& variant, + const wxDataViewItem& item, + unsigned col) const +{ + Node* const node = FromDVI(item); + + if ( col == 0 ) + { + // Determine the correct image to use depending on the item state. + int image = wxWithImages::NO_IMAGE; + if ( m_treelist->IsExpanded(node) ) + image = node->m_imageOpened; + + if ( image == wxWithImages::NO_IMAGE ) + image = node->m_imageClosed; + + wxIcon icon = m_treelist->GetImage(image); + + if ( m_treelist->HasFlag(wxTL_CHECKBOX) ) + variant << wxDataViewCheckIconText(node->m_text, icon, + node->m_checkedState); + else + variant << wxDataViewIconText(node->m_text, icon); + } + else + { + // Notice that we must still assign wxString to wxVariant to ensure + // that it at least has the correct type. + wxString text; + if ( node->HasColumnsTexts() ) + text = node->GetColumnText(col); + + variant = text; + } +} + +bool +wxTreeListModel::SetValue(const wxVariant& WXUNUSED(variant), + const wxDataViewItem& WXUNUSED(item), + unsigned WXUNUSED(col)) +{ + // We are not editable currently. + return false; +} + +wxDataViewItem wxTreeListModel::GetParent(const wxDataViewItem& item) const +{ + Node* const node = FromDVI(item); + + return ToDVI(node->GetParent()); +} + +bool wxTreeListModel::IsContainer(const wxDataViewItem& item) const +{ + // FIXME: In the generic (and native OS X) versions we implement this + // method normally, i.e. only items with children are containers. + // But for the native GTK version we must pretend that all items are + // containers because otherwise adding children to them later would + // fail because wxGTK code calls IsContainer() too early (when + // adding the item itself) and we can't know whether we're container + // or not by then. Luckily, always returning true doesn't have any + // serious drawbacks for us. +#ifdef __WXGTK__ + wxUnusedVar(item); + + return true; +#else + Node* const node = FromDVI(item); + + return node->GetChild() != NULL; +#endif +} + +bool +wxTreeListModel::HasContainerColumns(const wxDataViewItem& WXUNUSED(item)) const +{ + return true; +} + +unsigned +wxTreeListModel::GetChildren(const wxDataViewItem& item, + wxDataViewItemArray& children) const +{ + Node* const node = FromDVI(item); + + unsigned numChildren = 0; + for ( Node* child = node->GetChild(); child; child = child->GetNext() ) + { + children.push_back(ToDVI(child)); + numChildren++; + } + + return numChildren; +} + +int +wxTreeListModel::Compare(const wxDataViewItem& item1, + const wxDataViewItem& item2, + unsigned col, + bool ascending) const +{ + // Compare using default alphabetical order if no custom comparator. + wxTreeListItemComparator* const comp = m_treelist->m_comparator; + if ( !comp ) + return wxDataViewModel::Compare(item1, item2, col, ascending); + + // Forward comparison to the comparator: + int result = comp->Compare(m_treelist, col, FromDVI(item1), FromDVI(item2)); + + // And adjust by the sort order if necessary. + if ( !ascending ) + result = -result; + + return result; +} + +// ============================================================================ +// wxTreeListCtrl implementation +// ============================================================================ + +BEGIN_EVENT_TABLE(wxTreeListCtrl, wxWindow) + EVT_DATAVIEW_SELECTION_CHANGED(wxID_ANY, wxTreeListCtrl::OnSelectionChanged) + EVT_DATAVIEW_ITEM_EXPANDING(wxID_ANY, wxTreeListCtrl::OnItemExpanding) + EVT_DATAVIEW_ITEM_EXPANDED(wxID_ANY, wxTreeListCtrl::OnItemExpanded) + EVT_DATAVIEW_ITEM_ACTIVATED(wxID_ANY, wxTreeListCtrl::OnItemActivated) + EVT_DATAVIEW_ITEM_CONTEXT_MENU(wxID_ANY, wxTreeListCtrl::OnItemContextMenu) + EVT_DATAVIEW_COLUMN_SORTED(wxID_ANY, wxTreeListCtrl::OnColumnSorted) + + EVT_SIZE(wxTreeListCtrl::OnSize) +END_EVENT_TABLE() + +// ---------------------------------------------------------------------------- +// Creation +// ---------------------------------------------------------------------------- + +void wxTreeListCtrl::Init() +{ + m_view = NULL; + m_model = NULL; + m_comparator = NULL; +} + +bool wxTreeListCtrl::Create(wxWindow* parent, + wxWindowID id, + const wxPoint& pos, + const wxSize& size, + long style, + const wxString& name) +{ + if ( style & wxTL_USER_3STATE ) + style |= wxTL_3STATE; + + if ( style & wxTL_3STATE ) + style |= wxTL_CHECKBOX; + + // Create the window itself and wxDataViewCtrl used by it. + if ( !wxWindow::Create(parent, id, + pos, size, + style, name) ) + { + return false; + } + + m_view = new wxDataViewCtrl; + if ( !m_view->Create(this, wxID_ANY, + wxPoint(0, 0), GetClientSize(), + HasFlag(wxTL_MULTIPLE) ? wxDV_MULTIPLE + : wxDV_SINGLE) ) + { + delete m_view; + m_view = NULL; + + return false; + } + + + // Set up the model for wxDataViewCtrl. + m_model = new wxTreeListModel(this); + m_view->AssociateModel(m_model); + + return true; +} + +wxTreeListCtrl::~wxTreeListCtrl() +{ + if ( m_model ) + m_model->DecRef(); +} + +wxWindowList wxTreeListCtrl::GetCompositeWindowParts() const +{ + wxWindowList parts; + parts.push_back(m_view); + return parts; +} + +// ---------------------------------------------------------------------------- +// Columns +// ---------------------------------------------------------------------------- + +int +wxTreeListCtrl::DoInsertColumn(const wxString& title, + int pos, + int width, + wxAlignment align, + int flags) +{ + wxCHECK_MSG( m_view, wxNOT_FOUND, "Must Create() first" ); + + const unsigned oldNumColumns = m_view->GetColumnCount(); + + if ( pos == wxNOT_FOUND ) + pos = oldNumColumns; + + wxDataViewRenderer* renderer; + if ( pos == 0 ) + { + // Inserting the first column which is special as it uses a different + // renderer. + + // Also, currently it can be done only once. + wxCHECK_MSG( !oldNumColumns, wxNOT_FOUND, + "Inserting column at position 0 currently not supported" ); + + if ( HasFlag(wxTL_CHECKBOX) ) + { + // Use our custom renderer to show the checkbox. + renderer = new wxDataViewCheckIconTextRenderer; + } + else // We still need a special renderer to show the icons. + { + renderer = new wxDataViewIconTextRenderer; + } + } + else // Not the first column. + { + // All the other ones use a simple text renderer. + renderer = new wxDataViewTextRenderer; + } + + wxDataViewColumn* + column = new wxDataViewColumn(title, renderer, pos, width, align, flags); + + m_model->InsertColumn(pos); + + m_view->InsertColumn(pos, column); + + return pos; +} + +unsigned wxTreeListCtrl::GetColumnCount() const +{ + return m_view ? m_view->GetColumnCount() : 0u; +} + +bool wxTreeListCtrl::DeleteColumn(unsigned col) +{ + wxCHECK_MSG( col < GetColumnCount(), false, "Invalid column index" ); + + if ( !m_view->DeleteColumn(m_view->GetColumn(col)) ) + return false; + + m_model->DeleteColumn(col); + + return true; +} + +void wxTreeListCtrl::ClearColumns() +{ + // Don't assert here, clearing columns of the control before it's created + // can be considered valid (just useless). + if ( !m_model ) + return; + + m_view->ClearColumns(); + + m_model->ClearColumns(); +} + +void wxTreeListCtrl::SetColumnWidth(unsigned col, int width) +{ + wxCHECK_RET( col < GetColumnCount(), "Invalid column index" ); + + wxDataViewColumn* const column = m_view->GetColumn(col); + wxCHECK_RET( column, "No such column?" ); + + column->SetWidth(width); +} + +int wxTreeListCtrl::GetColumnWidth(unsigned col) const +{ + wxCHECK_MSG( col < GetColumnCount(), -1, "Invalid column index" ); + + wxDataViewColumn* column = m_view->GetColumn(col); + wxCHECK_MSG( column, -1, "No such column?" ); + + return column->GetWidth(); +} + +int wxTreeListCtrl::WidthFor(const wxString& text) const +{ + return GetTextExtent(text).x; +} + +// ---------------------------------------------------------------------------- +// Items +// ---------------------------------------------------------------------------- + +wxTreeListItem +wxTreeListCtrl::DoInsertItem(wxTreeListItem parent, + wxTreeListItem previous, + const wxString& text, + int imageClosed, + int imageOpened, + wxClientData* data) +{ + wxCHECK_MSG( m_model, wxTreeListItem(), "Must create first" ); + + return wxTreeListItem(m_model->InsertItem(parent, previous, text, + imageClosed, imageOpened, data)); +} + +void wxTreeListCtrl::DeleteItem(wxTreeListItem item) +{ + wxCHECK_RET( m_model, "Must create first" ); + + m_model->DeleteItem(item); +} + +void wxTreeListCtrl::DeleteAllItems() +{ + if ( m_model ) + m_model->DeleteAllItems(); +} + +// ---------------------------------------------------------------------------- +// Tree navigation +// ---------------------------------------------------------------------------- + +// The simple accessors in this section are implemented directly using +// wxTreeListModelNode methods, without passing by the model. This is just a +// shortcut and avoids us the trouble of defining more trivial methods in +// wxTreeListModel. + +wxTreeListItem wxTreeListCtrl::GetRootItem() const +{ + wxCHECK_MSG( m_model, wxTreeListItem(), "Must create first" ); + + return m_model->GetRootItem(); +} + +wxTreeListItem wxTreeListCtrl::GetItemParent(wxTreeListItem item) const +{ + wxCHECK_MSG( item.IsOk(), wxTreeListItem(), "Invalid item" ); + + return item->GetParent(); +} + +wxTreeListItem wxTreeListCtrl::GetFirstChild(wxTreeListItem item) const +{ + wxCHECK_MSG( item.IsOk(), wxTreeListItem(), "Invalid item" ); + + return item->GetChild(); +} + +wxTreeListItem +wxTreeListCtrl::GetNextSibling(wxTreeListItem item) const +{ + wxCHECK_MSG( item.IsOk(), wxTreeListItem(), "Invalid item" ); + + return item->GetNext(); +} + +wxTreeListItem wxTreeListCtrl::GetNextItem(wxTreeListItem item) const +{ + wxCHECK_MSG( item.IsOk(), wxTreeListItem(), "Invalid item" ); + + return item->NextInTree(); +} + +// ---------------------------------------------------------------------------- +// Item attributes +// ---------------------------------------------------------------------------- + +const wxString& +wxTreeListCtrl::GetItemText(wxTreeListItem item, unsigned col) const +{ + // We can't use wxCHECK_MSG() here because we don't have any empty string + // reference to return so we use a static variable that exists just for the + // purpose of this check -- and so we put it in its own scope so that it's + // never even created during normal program execution. + if ( !m_model || col >= m_model->GetColumnCount() ) + { + static wxString s_empty; + + if ( !m_model ) + { + wxFAIL_MSG( "Must create first" ); + } + else if ( col >= m_model->GetColumnCount() ) + { + wxFAIL_MSG( "Invalid column index" ); + } + + return s_empty; + } + + return m_model->GetItemText(item, col); +} + +void +wxTreeListCtrl::SetItemText(wxTreeListItem item, + unsigned col, + const wxString& text) +{ + wxCHECK_RET( m_model, "Must create first" ); + wxCHECK_RET( col < m_model->GetColumnCount(), "Invalid column index" ); + + m_model->SetItemText(item, col, text); +} + +void wxTreeListCtrl::SetItemImage(wxTreeListItem item, int closed, int opened) +{ + wxCHECK_RET( m_model, "Must create first" ); + + if ( closed != NO_IMAGE || opened != NO_IMAGE ) + { + wxImageList* const imageList = GetImageList(); + wxCHECK_RET( imageList, "Can't set images without image list" ); + + const int imageCount = imageList->GetImageCount(); + + wxCHECK_RET( closed < imageCount, "Invalid image index" ); + wxCHECK_RET( opened < imageCount, "Invalid opened image index" ); + } + + m_model->SetItemImage(item, closed, opened); +} + +wxClientData* wxTreeListCtrl::GetItemData(wxTreeListItem item) const +{ + wxCHECK_MSG( m_model, NULL, "Must create first" ); + + return m_model->GetItemData(item); +} + +void wxTreeListCtrl::SetItemData(wxTreeListItem item, wxClientData* data) +{ + wxCHECK_RET( m_model, "Must create first" ); + + m_model->SetItemData(item, data); +} + +// ---------------------------------------------------------------------------- +// Expanding and collapsing +// ---------------------------------------------------------------------------- + +void wxTreeListCtrl::Expand(wxTreeListItem item) +{ + wxCHECK_RET( m_view, "Must create first" ); + + m_view->Expand(m_model->ToDVI(item)); +} + +void wxTreeListCtrl::Collapse(wxTreeListItem item) +{ + wxCHECK_RET( m_view, "Must create first" ); + + m_view->Collapse(m_model->ToDVI(item)); +} + +bool wxTreeListCtrl::IsExpanded(wxTreeListItem item) const +{ + wxCHECK_MSG( m_view, false, "Must create first" ); + + return m_view->IsExpanded(m_model->ToDVI(item)); +} + +// ---------------------------------------------------------------------------- +// Selection +// ---------------------------------------------------------------------------- + +wxTreeListItem wxTreeListCtrl::GetSelection() const +{ + wxCHECK_MSG( m_view, wxTreeListItem(), "Must create first" ); + + wxCHECK_MSG( !HasFlag(wxTL_MULTIPLE), wxTreeListItem(), + "Must use GetSelections() with multi-selection controls!" ); + + const wxDataViewItem dvi = m_view->GetSelection(); + + return m_model->FromNonRootDVI(dvi); +} + +unsigned wxTreeListCtrl::GetSelections(wxTreeListItems& selections) const +{ + wxCHECK_MSG( m_view, 0, "Must create first" ); + + wxDataViewItemArray selectionsDV; + const unsigned numSelected = m_view->GetSelections(selectionsDV); + selections.resize(numSelected); + for ( unsigned n = 0; n < numSelected; n++ ) + selections[n] = m_model->FromNonRootDVI(selectionsDV[n]); + + return numSelected; +} + +void wxTreeListCtrl::Select(wxTreeListItem item) +{ + wxCHECK_RET( m_view, "Must create first" ); + + m_view->Select(m_model->ToNonRootDVI(item)); +} + +void wxTreeListCtrl::Unselect(wxTreeListItem item) +{ + wxCHECK_RET( m_view, "Must create first" ); + + m_view->Unselect(m_model->ToNonRootDVI(item)); +} + +bool wxTreeListCtrl::IsSelected(wxTreeListItem item) const +{ + wxCHECK_MSG( m_view, false, "Must create first" ); + + return m_view->IsSelected(m_model->ToNonRootDVI(item)); +} + +void wxTreeListCtrl::SelectAll() +{ + wxCHECK_RET( m_view, "Must create first" ); + + m_view->SelectAll(); +} + +void wxTreeListCtrl::UnselectAll() +{ + wxCHECK_RET( m_view, "Must create first" ); + + m_view->UnselectAll(); +} + +// ---------------------------------------------------------------------------- +// Checkbox handling +// ---------------------------------------------------------------------------- + +void wxTreeListCtrl::CheckItem(wxTreeListItem item, wxCheckBoxState state) +{ + wxCHECK_RET( m_model, "Must create first" ); + + m_model->CheckItem(item, state); +} + +void +wxTreeListCtrl::CheckItemRecursively(wxTreeListItem item, wxCheckBoxState state) +{ + wxCHECK_RET( m_model, "Must create first" ); + + m_model->CheckItem(item, state); + + for ( wxTreeListItem child = GetFirstChild(item); + child.IsOk(); + child = GetNextSibling(child) ) + { + CheckItemRecursively(child, state); + } +} + +void wxTreeListCtrl::UpdateItemParentStateRecursively(wxTreeListItem item) +{ + wxCHECK_RET( item.IsOk(), "Invalid item" ); + + wxASSERT_MSG( HasFlag(wxTL_3STATE), "Can only be used with wxTL_3STATE" ); + + for ( ;; ) + { + wxTreeListItem parent = GetItemParent(item); + if ( parent == GetRootItem() ) + { + // There is no checked state associated with the root item. + return; + } + + // Set parent state to the state of this item if all the other children + // have the same state too. Otherwise make it indeterminate. + const wxCheckBoxState stateItem = GetCheckedState(item); + CheckItem(parent, AreAllChildrenInState(parent, stateItem) + ? stateItem + : wxCHK_UNDETERMINED); + + // And do the same thing with the parent's parent too. + item = parent; + } +} + +wxCheckBoxState wxTreeListCtrl::GetCheckedState(wxTreeListItem item) const +{ + wxCHECK_MSG( item.IsOk(), wxCHK_UNDETERMINED, "Invalid item" ); + + return item->m_checkedState; +} + +bool +wxTreeListCtrl::AreAllChildrenInState(wxTreeListItem item, + wxCheckBoxState state) const +{ + wxCHECK_MSG( item.IsOk(), false, "Invalid item" ); + + for ( wxTreeListItem child = GetFirstChild(item); + child.IsOk(); + child = GetNextSibling(child) ) + { + if ( GetCheckedState(child) != state ) + return false; + } + + return true; +} + +// ---------------------------------------------------------------------------- +// Sorting +// ---------------------------------------------------------------------------- + +void wxTreeListCtrl::SetSortColumn(unsigned col, bool ascendingOrder) +{ + wxCHECK_RET( col < m_view->GetColumnCount(), "Invalid column index" ); + + m_view->GetColumn(col)->SetSortOrder(ascendingOrder); +} + +bool wxTreeListCtrl::GetSortColumn(unsigned* col, bool* ascendingOrder) +{ + const unsigned numColumns = m_view->GetColumnCount(); + for ( unsigned n = 0; n < numColumns; n++ ) + { + wxDataViewColumn* const column = m_view->GetColumn(n); + if ( column->IsSortKey() ) + { + if ( col ) + *col = n; + + if ( ascendingOrder ) + *ascendingOrder = column->IsSortOrderAscending(); + + return true; + } + } + + return false; +} + +void wxTreeListCtrl::SetItemComparator(wxTreeListItemComparator* comparator) +{ + m_comparator = comparator; +} + +// ---------------------------------------------------------------------------- +// Events +// ---------------------------------------------------------------------------- + +void wxTreeListCtrl::SendItemEvent(wxEventType evt, wxDataViewEvent& eventDV) +{ + wxTreeListEvent eventTL(evt, this, m_model->FromDVI(eventDV.GetItem())); + + if ( !ProcessWindowEvent(eventTL) ) + { + eventDV.Skip(); + return; + } + + if ( !eventTL.IsAllowed() ) + { + eventDV.Veto(); + } +} + +void wxTreeListCtrl::SendColumnEvent(wxEventType evt, wxDataViewEvent& eventDV) +{ + wxTreeListEvent eventTL(evt, this, wxTreeListItem()); + eventTL.SetColumn(eventDV.GetColumn()); + + if ( !ProcessWindowEvent(eventTL) ) + { + eventDV.Skip(); + return; + } + + if ( !eventTL.IsAllowed() ) + { + eventDV.Veto(); + } +} + +void +wxTreeListCtrl::OnItemToggled(wxTreeListItem item, wxCheckBoxState stateOld) +{ + wxTreeListEvent event(wxEVT_COMMAND_TREELIST_ITEM_CHECKED, this, item); + event.SetOldCheckedState(stateOld); + + ProcessWindowEvent(event); +} + +void wxTreeListCtrl::OnSelectionChanged(wxDataViewEvent& event) +{ + SendItemEvent(wxEVT_COMMAND_TREELIST_SELECTION_CHANGED, event); +} + +void wxTreeListCtrl::OnItemExpanding(wxDataViewEvent& event) +{ + SendItemEvent(wxEVT_COMMAND_TREELIST_ITEM_EXPANDING, event); +} + +void wxTreeListCtrl::OnItemExpanded(wxDataViewEvent& event) +{ + SendItemEvent(wxEVT_COMMAND_TREELIST_ITEM_EXPANDED, event); +} + +void wxTreeListCtrl::OnItemActivated(wxDataViewEvent& event) +{ + SendItemEvent(wxEVT_COMMAND_TREELIST_ITEM_ACTIVATED, event); +} + +void wxTreeListCtrl::OnItemContextMenu(wxDataViewEvent& event) +{ + SendItemEvent(wxEVT_COMMAND_TREELIST_ITEM_CONTEXT_MENU, event); +} + +void wxTreeListCtrl::OnColumnSorted(wxDataViewEvent& event) +{ + SendColumnEvent(wxEVT_COMMAND_TREELIST_COLUMN_SORTED, event); +} + +// ---------------------------------------------------------------------------- +// Geometry +// ---------------------------------------------------------------------------- + +void wxTreeListCtrl::OnSize(wxSizeEvent& event) +{ + event.Skip(); + + if ( m_view ) + { + // Resize the real control to cover our entire client area. + const wxRect rect = GetClientRect(); + m_view->SetSize(rect); + +#ifdef wxHAS_GENERIC_DATAVIEWCTRL + // The generic implementation doesn't refresh itself immediately which + // is annoying during "live resizing", so do it forcefully here to + // ensure that the items are re-laid out and the focus rectangle is + // redrawn correctly (instead of leaving traces) while our size is + // being changed. + wxWindow* const view = GetView(); + view->Refresh(); + view->Update(); +#endif // wxHAS_GENERIC_DATAVIEWCTRL + + // Resize the first column to take the remaining available space. + const unsigned numColumns = GetColumnCount(); + if ( !numColumns ) + return; + + // There is a bug in generic wxDataViewCtrl: if the column width sums + // up to the total size, horizontal scrollbar (unnecessarily) appears, + // so subtract a bit to ensure this doesn't happen. + int remainingWidth = rect.width - 5; + for ( unsigned n = 1; n < GetColumnCount(); n++ ) + { + remainingWidth -= GetColumnWidth(n); + if ( remainingWidth <= 0 ) + { + // There is not enough space, as we're not going to give the + // first column negative width anyhow, just don't do anything. + return; + } + } + + SetColumnWidth(0, remainingWidth); + } +} + +wxWindow* wxTreeListCtrl::GetView() const +{ +#ifdef wxHAS_GENERIC_DATAVIEWCTRL + return m_view->GetMainWindow(); +#else + return m_view; +#endif +} + +// ============================================================================ +// wxTreeListEvent implementation +// ============================================================================ + +wxIMPLEMENT_DYNAMIC_CLASS(wxTreeListEvent, wxNotifyEvent) + +#define wxDEFINE_TREELIST_EVENT(name) \ + wxDEFINE_EVENT(wxEVT_COMMAND_TREELIST_##name, wxTreeListEvent) + +wxDEFINE_TREELIST_EVENT(SELECTION_CHANGED); +wxDEFINE_TREELIST_EVENT(ITEM_EXPANDING); +wxDEFINE_TREELIST_EVENT(ITEM_EXPANDED); +wxDEFINE_TREELIST_EVENT(ITEM_CHECKED); +wxDEFINE_TREELIST_EVENT(ITEM_ACTIVATED); +wxDEFINE_TREELIST_EVENT(ITEM_CONTEXT_MENU); +wxDEFINE_TREELIST_EVENT(COLUMN_SORTED); + +#undef wxDEFINE_TREELIST_EVENT + +#endif // wxUSE_TREELISTCTRL diff --git a/Externals/wxWidgets3/src/generic/vlbox.cpp b/Externals/wxWidgets3/src/generic/vlbox.cpp index 02ccffc367..b0adc14cfa 100644 --- a/Externals/wxWidgets3/src/generic/vlbox.cpp +++ b/Externals/wxWidgets3/src/generic/vlbox.cpp @@ -4,7 +4,7 @@ // Author: Vadim Zeitlin // Modified by: // Created: 31.05.03 -// RCS-ID: $Id: vlbox.cpp 64940 2010-07-13 13:29:13Z VZ $ +// RCS-ID: $Id: vlbox.cpp 69180 2011-09-21 15:08:10Z VZ $ // Copyright: (c) 2003 Vadim Zeitlin // Licence: wxWindows licence /////////////////////////////////////////////////////////////////////////////// @@ -249,7 +249,10 @@ bool wxVListBox::DoSetCurrent(int current) { // it is, indeed, only partly visible, so scroll it into view to // make it entirely visible + // BUT scrolling down when m_current is first visible makes it + // completely hidden, so that is even worse while ( (size_t)m_current + 1 == GetVisibleRowsEnd() && + (size_t)m_current != GetVisibleRowsBegin() && ScrollToRow(GetVisibleBegin() + 1) ) ; // but in any case refresh it as even if it was only partly visible diff --git a/Externals/wxWidgets3/src/generic/vscroll.cpp b/Externals/wxWidgets3/src/generic/vscroll.cpp index 363e06b31c..53fbaebd66 100644 --- a/Externals/wxWidgets3/src/generic/vscroll.cpp +++ b/Externals/wxWidgets3/src/generic/vscroll.cpp @@ -4,7 +4,7 @@ // Author: Vadim Zeitlin // Modified by: Brad Anderson, David Warkentin // Created: 30.05.03 -// RCS-ID: $Id: vscroll.cpp 67280 2011-03-22 14:17:38Z DS $ +// RCS-ID: $Id: vscroll.cpp 69180 2011-09-21 15:08:10Z VZ $ // Copyright: (c) 2003 Vadim Zeitlin // Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// @@ -31,6 +31,8 @@ #include "wx/vscroll.h" +#include "wx/utils.h" // For wxMin/wxMax(). + // ============================================================================ // wxVarScrollHelperEvtHandler declaration // ============================================================================ @@ -308,14 +310,17 @@ size_t wxVarScrollHelperBase::GetNewScrollPosition(wxScrollWinEvent& event) cons } else if ( evtType == wxEVT_SCROLLWIN_PAGEUP ) { - return FindFirstVisibleFromLast(m_unitFirst); + // Page up should do at least as much as line up. + return wxMin(FindFirstVisibleFromLast(m_unitFirst), + m_unitFirst ? m_unitFirst - 1 : 0); } else if ( evtType == wxEVT_SCROLLWIN_PAGEDOWN ) { + // And page down should do at least as much as line down. if ( GetVisibleEnd() ) - return GetVisibleEnd() - 1; + return wxMax(GetVisibleEnd() - 1, m_unitFirst + 1); else - return GetVisibleEnd(); + return wxMax(GetVisibleEnd(), m_unitFirst + 1); } else if ( evtType == wxEVT_SCROLLWIN_THUMBRELEASE ) { diff --git a/Externals/wxWidgets3/src/generic/wizard.cpp b/Externals/wxWidgets3/src/generic/wizard.cpp index e4c8191d13..9256a9ef95 100644 --- a/Externals/wxWidgets3/src/generic/wizard.cpp +++ b/Externals/wxWidgets3/src/generic/wizard.cpp @@ -8,7 +8,7 @@ // 3) Fixed ShowPage() bug on displaying bitmaps // Robert Vazan (sizers) // Created: 15.08.99 -// RCS-ID: $Id: wizard.cpp 67280 2011-03-22 14:17:38Z DS $ +// RCS-ID: $Id: wizard.cpp 70630 2012-02-20 11:38:52Z JS $ // Copyright: (c) 1999 Vadim Zeitlin // Licence: wxWindows licence /////////////////////////////////////////////////////////////////////////////// @@ -83,6 +83,7 @@ private: wxDEFINE_EVENT( wxEVT_WIZARD_PAGE_CHANGED, wxWizardEvent ); wxDEFINE_EVENT( wxEVT_WIZARD_PAGE_CHANGING, wxWizardEvent ); +wxDEFINE_EVENT( wxEVT_WIZARD_BEFORE_PAGE_CHANGED, wxWizardEvent ); wxDEFINE_EVENT( wxEVT_WIZARD_CANCEL, wxWizardEvent ); wxDEFINE_EVENT( wxEVT_WIZARD_FINISHED, wxWizardEvent ); wxDEFINE_EVENT( wxEVT_WIZARD_HELP, wxWizardEvent ); @@ -324,7 +325,7 @@ void wxWizard::AddBitmapRow(wxBoxSizer *mainColumn) ); #if wxUSE_STATBMP - if ( m_bitmap.Ok() ) + if ( m_bitmap.IsOk() ) { wxSize bitmapSize(wxDefaultSize); if (GetBitmapPlacement()) @@ -396,7 +397,7 @@ void wxWizard::AddButtonRow(wxBoxSizer *mainColumn) // to activate the 'next' button first (create the next button before the back button). // The reason is: The user will repeatedly enter information in the wizard pages and then wants to // press 'next'. If a user uses mostly the keyboard, he would have to skip the 'back' button - // everytime. This is annoying. There is a second reason: RETURN acts as TAB. If the 'next' + // every time. This is annoying. There is a second reason: RETURN acts as TAB. If the 'next' // button comes first in the TAB order, the user can enter information very fast using the RETURN // key to TAB to the next entry field and page. This would not be possible, if the 'back' button // was created before the 'next' button. @@ -604,10 +605,10 @@ bool wxWizard::ShowPage(wxWizardPage *page, bool goingForward) if ( m_statbmp ) { bmp = m_page->GetBitmap(); - if ( !bmp.Ok() ) + if ( !bmp.IsOk() ) bmp = m_bitmap; - if ( !bmpPrev.Ok() ) + if ( !bmpPrev.IsOk() ) bmpPrev = m_bitmap; if (!GetBitmapPlacement()) @@ -782,7 +783,7 @@ void wxWizard::OnBackOrNext(wxCommandEvent& event) wxCHECK_RET( m_page, wxT("should have a valid current page") ); // ask the current page first: notice that we do it before calling - // GetNext/Prev() because the data transfered from the controls of the page + // GetNext/Prev() because the data transferred from the controls of the page // may change the value returned by these methods if ( !m_page->Validate() || !m_page->TransferDataFromWindow() ) { @@ -792,6 +793,13 @@ void wxWizard::OnBackOrNext(wxCommandEvent& event) bool forward = event.GetEventObject() == m_btnNext; + // Give the application a chance to set state which may influence GetNext()/GetPrev() + wxWizardEvent eventPreChanged(wxEVT_WIZARD_BEFORE_PAGE_CHANGED, GetId(), forward, m_page); + (void)m_page->GetEventHandler()->ProcessEvent(eventPreChanged); + + if (!eventPreChanged.IsAllowed()) + return; + wxWizardPage *page; if ( forward ) { @@ -928,7 +936,7 @@ bool wxWizard::ResizeBitmap(wxBitmap& bmp) if (!GetBitmapPlacement()) return false; - if (bmp.Ok()) + if (bmp.IsOk()) { wxSize pageSize = m_sizerPage->GetSize(); if (pageSize == wxSize(0,0)) @@ -936,7 +944,7 @@ bool wxWizard::ResizeBitmap(wxBitmap& bmp) int bitmapWidth = wxMax(bmp.GetWidth(), GetMinimumBitmapWidth()); int bitmapHeight = pageSize.y; - if (!m_statbmp->GetBitmap().Ok() || m_statbmp->GetBitmap().GetHeight() != bitmapHeight) + if (!m_statbmp->GetBitmap().IsOk() || m_statbmp->GetBitmap().GetHeight() != bitmapHeight) { wxBitmap bitmap(bitmapWidth, bitmapHeight); { diff --git a/Externals/wxWidgets3/src/gtk/aboutdlg.cpp b/Externals/wxWidgets3/src/gtk/aboutdlg.cpp index 155ecf7859..7340be7935 100644 --- a/Externals/wxWidgets3/src/gtk/aboutdlg.cpp +++ b/Externals/wxWidgets3/src/gtk/aboutdlg.cpp @@ -3,7 +3,7 @@ // Purpose: native GTK+ wxAboutBox() implementation // Author: Vadim Zeitlin // Created: 2006-10-08 -// RCS-ID: $Id: aboutdlg.cpp 67280 2011-03-22 14:17:38Z DS $ +// RCS-ID: $Id: aboutdlg.cpp 67681 2011-05-03 16:29:04Z DS $ // Copyright: (c) 2006 Vadim Zeitlin // Licence: wxWindows licence /////////////////////////////////////////////////////////////////////////////// @@ -126,7 +126,7 @@ void wxAboutBox(const wxAboutDialogInfo& info, wxWindow* WXUNUSED(parent)) gs_aboutDialog = GTK_ABOUT_DIALOG(gtk_about_dialog_new()); GtkAboutDialog * const dlg = gs_aboutDialog; - gtk_about_dialog_set_name(dlg, wxGTK_CONV_SYS(info.GetName())); + gtk_about_dialog_set_program_name(dlg, wxGTK_CONV_SYS(info.GetName())); if ( info.HasVersion() ) gtk_about_dialog_set_version(dlg, wxGTK_CONV_SYS(info.GetVersion())); else @@ -145,7 +145,7 @@ void wxAboutBox(const wxAboutDialogInfo& info, wxWindow* WXUNUSED(parent)) gtk_about_dialog_set_license(dlg, NULL); wxIcon icon = info.GetIcon(); - if ( icon.Ok() ) + if ( icon.IsOk() ) gtk_about_dialog_set_logo(dlg, info.GetIcon().GetPixbuf()); if ( info.HasWebSite() ) diff --git a/Externals/wxWidgets3/src/gtk/animate.cpp b/Externals/wxWidgets3/src/gtk/animate.cpp index 0f8956554e..833c36d9c4 100644 --- a/Externals/wxWidgets3/src/gtk/animate.cpp +++ b/Externals/wxWidgets3/src/gtk/animate.cpp @@ -4,7 +4,7 @@ // Author: Francesco Montorsi // Modified By: // Created: 24/09/2006 -// Id: $Id: animate.cpp 58954 2009-02-16 21:14:12Z FM $ +// Id: $Id: animate.cpp 70756 2012-02-29 18:29:31Z PC $ // Copyright: (c) Francesco Montorsi // Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// @@ -233,7 +233,6 @@ bool wxAnimationCtrl::Create( wxWindow *parent, wxWindowID id, m_widget = gtk_image_new(); g_object_ref(m_widget); - gtk_widget_show(m_widget); m_parent->DoAddChild( this ); diff --git a/Externals/wxWidgets3/src/gtk/anybutton.cpp b/Externals/wxWidgets3/src/gtk/anybutton.cpp new file mode 100644 index 0000000000..d58e6246ae --- /dev/null +++ b/Externals/wxWidgets3/src/gtk/anybutton.cpp @@ -0,0 +1,422 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: src/gtk/anybutton.cpp +// Purpose: +// Author: Robert Roebling +// Created: 1998-05-20 (extracted from button.cpp) +// Id: $Id: anybutton.cpp 67931 2011-06-14 13:00:42Z VZ $ +// Copyright: (c) 1998 Robert Roebling +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +// For compilers that support precompilation, includes "wx.h". +#include "wx/wxprec.h" + +#ifdef wxHAS_ANY_BUTTON + +#ifndef WX_PRECOMP + #include "wx/anybutton.h" +#endif + +#include "wx/stockitem.h" + +#include "wx/gtk/private.h" + +// ---------------------------------------------------------------------------- +// GTK callbacks +// ---------------------------------------------------------------------------- + +extern "C" +{ + +static void +wxgtk_button_enter_callback(GtkWidget *WXUNUSED(widget), wxAnyButton *button) +{ + if ( button->GTKShouldIgnoreEvent() ) + return; + + button->GTKMouseEnters(); +} + +static void +wxgtk_button_leave_callback(GtkWidget *WXUNUSED(widget), wxAnyButton *button) +{ + if ( button->GTKShouldIgnoreEvent() ) + return; + + button->GTKMouseLeaves(); +} + +static void +wxgtk_button_press_callback(GtkWidget *WXUNUSED(widget), wxAnyButton *button) +{ + if ( button->GTKShouldIgnoreEvent() ) + return; + + button->GTKPressed(); +} + +static void +wxgtk_button_released_callback(GtkWidget *WXUNUSED(widget), wxAnyButton *button) +{ + if ( button->GTKShouldIgnoreEvent() ) + return; + + button->GTKReleased(); +} + +} // extern "C" + +//----------------------------------------------------------------------------- +// wxAnyButton +//----------------------------------------------------------------------------- + +bool wxAnyButton::Enable( bool enable ) +{ + if (!base_type::Enable(enable)) + return false; + + gtk_widget_set_sensitive(gtk_bin_get_child(GTK_BIN(m_widget)), enable); + + if (enable) + GTKFixSensitivity(); + + GTKUpdateBitmap(); + + return true; +} + +GdkWindow *wxAnyButton::GTKGetWindow(wxArrayGdkWindows& WXUNUSED(windows)) const +{ + return GTK_BUTTON(m_widget)->event_window; +} + +// static +wxVisualAttributes +wxAnyButton::GetClassDefaultAttributes(wxWindowVariant WXUNUSED(variant)) +{ + return GetDefaultAttributesFromGTKWidget(gtk_button_new); +} + +// ---------------------------------------------------------------------------- +// bitmaps support +// ---------------------------------------------------------------------------- + +void wxAnyButton::GTKMouseEnters() +{ + m_isCurrent = true; + + GTKUpdateBitmap(); +} + +void wxAnyButton::GTKMouseLeaves() +{ + m_isCurrent = false; + + GTKUpdateBitmap(); +} + +void wxAnyButton::GTKPressed() +{ + m_isPressed = true; + + GTKUpdateBitmap(); +} + +void wxAnyButton::GTKReleased() +{ + m_isPressed = false; + + GTKUpdateBitmap(); +} + +void wxAnyButton::GTKOnFocus(wxFocusEvent& event) +{ + event.Skip(); + + GTKUpdateBitmap(); +} + +wxAnyButton::State wxAnyButton::GTKGetCurrentState() const +{ + if ( !IsThisEnabled() ) + return m_bitmaps[State_Disabled].IsOk() ? State_Disabled : State_Normal; + + if ( m_isPressed && m_bitmaps[State_Pressed].IsOk() ) + return State_Pressed; + + if ( m_isCurrent && m_bitmaps[State_Current].IsOk() ) + return State_Current; + + if ( HasFocus() && m_bitmaps[State_Focused].IsOk() ) + return State_Focused; + + return State_Normal; +} + +void wxAnyButton::GTKUpdateBitmap() +{ + // if we don't show bitmaps at all, there is nothing to update + if ( m_bitmaps[State_Normal].IsOk() ) + { + // if we do show them, this will return a state for which we do have a + // valid bitmap + State state = GTKGetCurrentState(); + + GTKDoShowBitmap(m_bitmaps[state]); + } +} + +void wxAnyButton::GTKDoShowBitmap(const wxBitmap& bitmap) +{ + wxASSERT_MSG( bitmap.IsOk(), "invalid bitmap" ); + + GtkWidget *image; + if ( DontShowLabel() ) + { + image = gtk_bin_get_child(GTK_BIN(m_widget)); + } + else // have both label and bitmap + { +#ifdef __WXGTK26__ + if ( !gtk_check_version(2,6,0) ) + { + image = gtk_button_get_image(GTK_BUTTON(m_widget)); + } + else +#endif // __WXGTK26__ + { + // buttons with both label and bitmap are only supported with GTK+ + // 2.6 so far + // + // it shouldn't be difficult to implement them ourselves for the + // previous GTK+ versions by stuffing a container with a label and + // an image inside GtkButton but there doesn't seem to be much + // point in doing this for ancient GTK+ versions + return; + } + } + + wxCHECK_RET( image && GTK_IS_IMAGE(image), "must have image widget" ); + + gtk_image_set_from_pixbuf(GTK_IMAGE(image), bitmap.GetPixbuf()); +} + +wxBitmap wxAnyButton::DoGetBitmap(State which) const +{ + return m_bitmaps[which]; +} + +void wxAnyButton::DoSetBitmap(const wxBitmap& bitmap, State which) +{ + switch ( which ) + { + case State_Normal: + if ( DontShowLabel() ) + { + // we only have the bitmap in this button, never remove it but + // do invalidate the best size when the bitmap (and presumably + // its size) changes + InvalidateBestSize(); + } +#ifdef __WXGTK26__ + // normal image is special: setting it enables images for the button and + // resetting it to nothing disables all of them + else if ( !gtk_check_version(2,6,0) ) + { + GtkWidget *image = gtk_button_get_image(GTK_BUTTON(m_widget)); + if ( image && !bitmap.IsOk() ) + { + gtk_container_remove(GTK_CONTAINER(m_widget), image); + } + else if ( !image && bitmap.IsOk() ) + { + image = gtk_image_new(); + gtk_button_set_image(GTK_BUTTON(m_widget), image); + } + else // image presence or absence didn't change + { + // don't invalidate best size below + break; + } + + InvalidateBestSize(); + } +#endif // GTK+ 2.6+ + break; + + case State_Pressed: + if ( bitmap.IsOk() ) + { + if ( !m_bitmaps[which].IsOk() ) + { + // we need to install the callbacks to be notified about + // the button pressed state change + g_signal_connect + ( + m_widget, + "pressed", + G_CALLBACK(wxgtk_button_press_callback), + this + ); + + g_signal_connect + ( + m_widget, + "released", + G_CALLBACK(wxgtk_button_released_callback), + this + ); + } + } + else // no valid bitmap + { + if ( m_bitmaps[which].IsOk() ) + { + // we don't need to be notified about the button pressed + // state changes any more + g_signal_handlers_disconnect_by_func + ( + m_widget, + (gpointer)wxgtk_button_press_callback, + this + ); + + g_signal_handlers_disconnect_by_func + ( + m_widget, + (gpointer)wxgtk_button_released_callback, + this + ); + + // also make sure we don't remain stuck in pressed state + if ( m_isPressed ) + { + m_isPressed = false; + GTKUpdateBitmap(); + } + } + } + break; + + case State_Current: + // the logic here is the same as above for State_Pressed: we need + // to connect the handlers if we must be notified about the changes + // in the button current state and we disconnect them when/if we + // don't need them any more + if ( bitmap.IsOk() ) + { + if ( !m_bitmaps[which].IsOk() ) + { + g_signal_connect + ( + m_widget, + "enter", + G_CALLBACK(wxgtk_button_enter_callback), + this + ); + + g_signal_connect + ( + m_widget, + "leave", + G_CALLBACK(wxgtk_button_leave_callback), + this + ); + } + } + else // no valid bitmap + { + if ( m_bitmaps[which].IsOk() ) + { + g_signal_handlers_disconnect_by_func + ( + m_widget, + (gpointer)wxgtk_button_enter_callback, + this + ); + + g_signal_handlers_disconnect_by_func + ( + m_widget, + (gpointer)wxgtk_button_leave_callback, + this + ); + + if ( m_isCurrent ) + { + m_isCurrent = false; + GTKUpdateBitmap(); + } + } + } + break; + + case State_Focused: + if ( bitmap.IsOk() ) + { + Connect(wxEVT_SET_FOCUS, + wxFocusEventHandler(wxAnyButton::GTKOnFocus)); + Connect(wxEVT_KILL_FOCUS, + wxFocusEventHandler(wxAnyButton::GTKOnFocus)); + } + else // no valid focused bitmap + { + Disconnect(wxEVT_SET_FOCUS, + wxFocusEventHandler(wxAnyButton::GTKOnFocus)); + Disconnect(wxEVT_KILL_FOCUS, + wxFocusEventHandler(wxAnyButton::GTKOnFocus)); + } + break; + + default: + // no callbacks to connect/disconnect + ; + } + + m_bitmaps[which] = bitmap; + + // update the bitmap immediately if necessary, otherwise it will be done + // when the bitmap for the corresponding state is needed the next time by + // GTKUpdateBitmap() + if ( bitmap.IsOk() && which == GTKGetCurrentState() ) + { + GTKDoShowBitmap(bitmap); + } +} + +void wxAnyButton::DoSetBitmapPosition(wxDirection dir) +{ +#ifdef __WXGTK210__ + if ( !gtk_check_version(2,10,0) ) + { + GtkPositionType gtkpos; + switch ( dir ) + { + default: + wxFAIL_MSG( "invalid position" ); + // fall through + + case wxLEFT: + gtkpos = GTK_POS_LEFT; + break; + + case wxRIGHT: + gtkpos = GTK_POS_RIGHT; + break; + + case wxTOP: + gtkpos = GTK_POS_TOP; + break; + + case wxBOTTOM: + gtkpos = GTK_POS_BOTTOM; + break; + } + + gtk_button_set_image_position(GTK_BUTTON(m_widget), gtkpos); + InvalidateBestSize(); + } +#endif // GTK+ 2.10+ +} + +#endif // wxHAS_ANY_BUTTON diff --git a/Externals/wxWidgets3/src/gtk/app.cpp b/Externals/wxWidgets3/src/gtk/app.cpp index 6601f01bdb..c7c020b558 100644 --- a/Externals/wxWidgets3/src/gtk/app.cpp +++ b/Externals/wxWidgets3/src/gtk/app.cpp @@ -2,7 +2,7 @@ // Name: src/gtk/app.cpp // Purpose: // Author: Robert Roebling -// Id: $Id: app.cpp 67280 2011-03-22 14:17:38Z DS $ +// Id: $Id: app.cpp 70701 2012-02-26 17:18:41Z VZ $ // Copyright: (c) 1998 Robert Roebling, Julian Smart // Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// @@ -38,7 +38,9 @@ #include #endif // wxUSE_LIBHILDON2 +#ifdef GDK_WINDOWING_X11 #include +#endif //----------------------------------------------------------------------------- // link GnomeVFS diff --git a/Externals/wxWidgets3/src/gtk/artgtk.cpp b/Externals/wxWidgets3/src/gtk/artgtk.cpp index c71ed7c567..8ddb480e04 100644 --- a/Externals/wxWidgets3/src/gtk/artgtk.cpp +++ b/Externals/wxWidgets3/src/gtk/artgtk.cpp @@ -4,7 +4,7 @@ // Author: Vaclav Slavik // Modified by: // Created: 2004-08-22 -// RCS-ID: $Id: artgtk.cpp 67254 2011-03-20 00:14:35Z DS $ +// RCS-ID: $Id: artgtk.cpp 70154 2011-12-28 13:51:29Z VZ $ // Copyright: (c) Vaclav Slavik, 2004 // Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// @@ -47,7 +47,7 @@ protected: /*static*/ void wxArtProvider::InitNativeProvider() { - Push(new wxGTK2ArtProvider); + PushBack(new wxGTK2ArtProvider); } // ---------------------------------------------------------------------------- @@ -203,7 +203,7 @@ GdkPixbuf *CreateStockIcon(const char *stockid, GtkIconSize size) // with "stock-id" representation (in addition to pixmap and pixbuf // ones) and would convert it to pixbuf when rendered. - GtkStyle* style = wxGTKPrivate::GetButtonWidget()->style; + GtkStyle* style = gtk_widget_get_style(wxGTKPrivate::GetButtonWidget()); GtkIconSet* iconset = gtk_style_lookup_icon_set(style, stockid); if (!iconset) @@ -310,7 +310,7 @@ wxGTK2ArtProvider::CreateIconBundle(const wxArtID& id, const wxString stockid = wxArtIDToStock(id); // try to load the bundle as stock icon first - GtkStyle* style = wxGTKPrivate::GetButtonWidget()->style; + GtkStyle* style = gtk_widget_get_style(wxGTKPrivate::GetButtonWidget()); GtkIconSet* iconset = gtk_style_lookup_icon_set(style, stockid.utf8_str()); if ( iconset ) { diff --git a/Externals/wxWidgets3/src/gtk/assertdlg_gtk.c b/Externals/wxWidgets3/src/gtk/assertdlg_gtk.cpp similarity index 90% rename from Externals/wxWidgets3/src/gtk/assertdlg_gtk.c rename to Externals/wxWidgets3/src/gtk/assertdlg_gtk.cpp index 28269c39e8..91cc8a5bf7 100644 --- a/Externals/wxWidgets3/src/gtk/assertdlg_gtk.c +++ b/Externals/wxWidgets3/src/gtk/assertdlg_gtk.cpp @@ -1,29 +1,19 @@ /* /////////////////////////////////////////////////////////////////////////// -// Name: src/gtk/assertdlg_gtk.c +// Name: src/gtk/assertdlg_gtk.cpp // Purpose: GtkAssertDialog // Author: Francesco Montorsi -// Id: $Id: assertdlg_gtk.c 67254 2011-03-20 00:14:35Z DS $ +// Id: $Id: assertdlg_gtk.cpp 69697 2011-11-08 11:02:02Z VZ $ // Copyright: (c) 2006 Francesco Montorsi // Licence: wxWindows licence /////////////////////////////////////////////////////////////////////////// */ -#ifdef VMS -#define XCheckIfEvent XCHECKIFEVENT -#endif - #include "wx/platform.h" -#include "wx/gtk/assertdlg_gtk.h" - -#ifdef __cplusplus -extern "C" { -#endif /* __cplusplus */ - #include +#include "wx/gtk/assertdlg_gtk.h" +#include "wx/gtk/private/gtk2-compat.h" -/* For FILE */ #include - /* ---------------------------------------------------------------------------- Constants ---------------------------------------------------------------------------- */ @@ -46,19 +36,16 @@ extern "C" { ---------------------------------------------------------------------------- */ GtkWidget *gtk_assert_dialog_add_button_to (GtkBox *box, const gchar *label, - const gchar *stock, gint response_id) + const gchar *stock) { /* create the button */ GtkWidget *button = gtk_button_new_with_mnemonic (label); - GTK_WIDGET_SET_FLAGS (button, GTK_CAN_DEFAULT); + gtk_widget_set_can_default(button, true); + /* add a stock icon inside it */ + GtkWidget *image = gtk_image_new_from_stock (stock, GTK_ICON_SIZE_BUTTON); #if GTK_CHECK_VERSION(2,6,0) - if (!gtk_check_version (2, 6, 0)) - { - /* add a stock icon inside it */ - GtkWidget *image = gtk_image_new_from_stock (stock, GTK_ICON_SIZE_BUTTON); - gtk_button_set_image (GTK_BUTTON (button), image); - } + gtk_button_set_image (GTK_BUTTON (button), image); #endif /* add to the given (container) widget */ @@ -72,7 +59,7 @@ GtkWidget *gtk_assert_dialog_add_button (GtkAssertDialog *dlg, const gchar *labe const gchar *stock, gint response_id) { /* create the button */ - GtkWidget *button = gtk_assert_dialog_add_button_to (NULL, label, stock, response_id); + GtkWidget* button = gtk_assert_dialog_add_button_to(NULL, label, stock); /* add the button to the dialog's action area */ gtk_dialog_add_action_widget (GTK_DIALOG (dlg), button, response_id); @@ -124,7 +111,7 @@ GtkWidget *gtk_assert_dialog_create_backtrace_list_model () void gtk_assert_dialog_process_backtrace (GtkAssertDialog *dlg) { /* set busy cursor */ - GdkWindow *parent = GTK_WIDGET(dlg)->window; + GdkWindow *parent = gtk_widget_get_window(GTK_WIDGET(dlg)); GdkCursor *cur = gdk_cursor_new (GDK_WATCH); gdk_window_set_cursor (parent, cur); gdk_flush (); @@ -138,11 +125,12 @@ void gtk_assert_dialog_process_backtrace (GtkAssertDialog *dlg) +extern "C" { /* ---------------------------------------------------------------------------- GtkAssertDialog signal handlers ---------------------------------------------------------------------------- */ -void gtk_assert_dialog_expander_callback (GtkWidget *widget, GtkAssertDialog *dlg) +static void gtk_assert_dialog_expander_callback(GtkWidget*, GtkAssertDialog* dlg) { /* status is not yet updated so we need to invert it to get the new one */ gboolean expanded = !gtk_expander_get_expanded (GTK_EXPANDER(dlg->expander)); @@ -157,7 +145,7 @@ void gtk_assert_dialog_expander_callback (GtkWidget *widget, GtkAssertDialog *dl dlg->callback = NULL; } -void gtk_assert_dialog_save_backtrace_callback (GtkWidget *widget, GtkAssertDialog *dlg) +static void gtk_assert_dialog_save_backtrace_callback(GtkWidget*, GtkAssertDialog* dlg) { GtkWidget *dialog; @@ -195,7 +183,7 @@ void gtk_assert_dialog_save_backtrace_callback (GtkWidget *widget, GtkAssertDial gtk_widget_destroy (dialog); } -void gtk_assert_dialog_copy_callback (GtkWidget *widget, GtkAssertDialog *dlg) +static void gtk_assert_dialog_copy_callback(GtkWidget*, GtkAssertDialog* dlg) { char *msg, *backtrace; GtkClipboard *clipboard; @@ -221,7 +209,7 @@ void gtk_assert_dialog_copy_callback (GtkWidget *widget, GtkAssertDialog *dlg) g_string_free (str, TRUE); } -void gtk_assert_dialog_continue_callback (GtkWidget *widget, GtkAssertDialog *dlg) +static void gtk_assert_dialog_continue_callback(GtkWidget*, GtkAssertDialog* dlg) { gint response = gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON(dlg->shownexttime)) ? @@ -229,7 +217,7 @@ void gtk_assert_dialog_continue_callback (GtkWidget *widget, GtkAssertDialog *dl gtk_dialog_response (GTK_DIALOG(dlg), response); } - +} // extern "C" /* ---------------------------------------------------------------------------- GtkAssertDialogClass implementation @@ -239,9 +227,9 @@ static void gtk_assert_dialog_init (GtkAssertDialog *sel static void gtk_assert_dialog_class_init (GtkAssertDialogClass *klass); -GtkType gtk_assert_dialog_get_type (void) +GType gtk_assert_dialog_get_type() { - static GtkType assert_dialog_type = 0; + static GType assert_dialog_type; if (!assert_dialog_type) { @@ -264,12 +252,12 @@ GtkType gtk_assert_dialog_get_type (void) return assert_dialog_type; } -void gtk_assert_dialog_class_init(GtkAssertDialogClass *klass) +static void gtk_assert_dialog_class_init(GtkAssertDialogClass*) { /* no special initializations required */ } -void gtk_assert_dialog_init(GtkAssertDialog *dlg) +static void gtk_assert_dialog_init(GtkAssertDialog* dlg) { GtkWidget *continuebtn; @@ -280,7 +268,7 @@ void gtk_assert_dialog_init(GtkAssertDialog *dlg) gtk_widget_push_composite_child (); vbox = gtk_vbox_new (FALSE, 8); gtk_container_set_border_width (GTK_CONTAINER(vbox), 8); - gtk_box_pack_start (GTK_BOX (GTK_DIALOG (dlg)->vbox), vbox, TRUE, TRUE, 5); + gtk_box_pack_start(GTK_BOX(gtk_dialog_get_content_area(GTK_DIALOG(dlg))), vbox, true, true, 5); /* add the icon+message hbox */ @@ -343,19 +331,19 @@ void gtk_assert_dialog_init(GtkAssertDialog *dlg) /* add the buttons */ button = gtk_assert_dialog_add_button_to (GTK_BOX(hbox), "Save to _file", - GTK_STOCK_SAVE, GTK_RESPONSE_NONE); + GTK_STOCK_SAVE); g_signal_connect (button, "clicked", G_CALLBACK(gtk_assert_dialog_save_backtrace_callback), dlg); button = gtk_assert_dialog_add_button_to (GTK_BOX(hbox), "Copy to clip_board", - GTK_STOCK_COPY, GTK_RESPONSE_NONE); + GTK_STOCK_COPY); g_signal_connect (button, "clicked", G_CALLBACK(gtk_assert_dialog_copy_callback), dlg); } /* add the checkbutton */ dlg->shownexttime = gtk_check_button_new_with_mnemonic("Show this _dialog the next time"); gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON(dlg->shownexttime), TRUE); - gtk_box_pack_end (GTK_BOX(GTK_DIALOG(dlg)->action_area), dlg->shownexttime, FALSE, TRUE, 8); + gtk_box_pack_end(GTK_BOX(gtk_dialog_get_action_area(GTK_DIALOG(dlg))), dlg->shownexttime, false, true, 8); /* add the stop button */ gtk_assert_dialog_add_button (dlg, "_Stop", GTK_STOCK_QUIT, GTK_ASSERT_DIALOG_STOP); @@ -369,8 +357,8 @@ void gtk_assert_dialog_init(GtkAssertDialog *dlg) dlg->callback = NULL; dlg->userdata = NULL; - /* the resizeable property of this window is modified by the expander: - when it's collapsed, the window must be non-resizeable! */ + /* the resizable property of this window is modified by the expander: + when it's collapsed, the window must be non-resizable! */ gtk_window_set_resizable (GTK_WINDOW (dlg), FALSE); gtk_widget_pop_composite_child (); gtk_widget_show_all (GTK_WIDGET(dlg)); @@ -497,11 +485,7 @@ void gtk_assert_dialog_append_stack_frame(GtkAssertDialog *dlg, GtkWidget *gtk_assert_dialog_new(void) { - GtkAssertDialog *dialog = g_object_new (GTK_TYPE_ASSERT_DIALOG, NULL); + void* dialog = g_object_new(GTK_TYPE_ASSERT_DIALOG, NULL); return GTK_WIDGET (dialog); } - -#ifdef __cplusplus -} -#endif /* __cplusplus */ diff --git a/Externals/wxWidgets3/src/gtk/bitmap.cpp b/Externals/wxWidgets3/src/gtk/bitmap.cpp index c5ce2a8b94..aabfa24346 100644 --- a/Externals/wxWidgets3/src/gtk/bitmap.cpp +++ b/Externals/wxWidgets3/src/gtk/bitmap.cpp @@ -2,7 +2,7 @@ // Name: src/gtk/bitmap.cpp // Purpose: // Author: Robert Roebling -// RCS-ID: $Id: bitmap.cpp 66372 2010-12-14 18:43:32Z VZ $ +// RCS-ID: $Id: bitmap.cpp 69617 2011-10-31 16:09:47Z PC $ // Copyright: (c) 1998 Robert Roebling // Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// @@ -207,7 +207,7 @@ bool wxMask::InitFromMonoBitmap(const wxBitmap& bitmap) return true; } -GdkBitmap *wxMask::GetBitmap() const +GdkPixmap* wxMask::GetBitmap() const { return m_bitmap; } @@ -324,13 +324,11 @@ bool wxBitmap::CreateFromImage(const wxImage& image, int depth) UnRef(); wxCHECK_MSG( image.IsOk(), false, wxT("invalid image") ); - wxCHECK_MSG( depth == -1 || depth == 1, false, wxT("invalid bitmap depth") ); if (image.GetWidth() <= 0 || image.GetHeight() <= 0) return false; - // create pixbuf if image has alpha and requested depth is compatible - if (image.HasAlpha() && (depth == -1 || depth == 32)) + if (depth == 32 || (depth == -1 && image.HasAlpha())) return CreateFromImageAsPixbuf(image); // otherwise create pixmap, if alpha is present it will be converted to mask @@ -422,8 +420,6 @@ bool wxBitmap::CreateFromImageAsPixmap(const wxImage& image, int depth) bool wxBitmap::CreateFromImageAsPixbuf(const wxImage& image) { - wxASSERT(image.HasAlpha()); - int width = image.GetWidth(); int height = image.GetHeight(); @@ -441,12 +437,13 @@ bool wxBitmap::CreateFromImageAsPixbuf(const wxImage& image) for (int y = 0; y < height; y++, out += rowpad) { - for (int x = 0; x < width; x++, alpha++, out += 4, in += 3) + for (int x = 0; x < width; x++, out += 4, in += 3) { out[0] = in[0]; out[1] = in[1]; out[2] = in[2]; - out[3] = *alpha; + if (alpha) + out[3] = *alpha++; } } diff --git a/Externals/wxWidgets3/src/gtk/bmpcbox.cpp b/Externals/wxWidgets3/src/gtk/bmpcbox.cpp index f65bdd9cfa..3a29159b96 100644 --- a/Externals/wxWidgets3/src/gtk/bmpcbox.cpp +++ b/Externals/wxWidgets3/src/gtk/bmpcbox.cpp @@ -3,7 +3,7 @@ // Purpose: wxBitmapComboBox // Author: Jaakko Salli // Created: 2008-05-19 -// RCS-ID: $Id: bmpcbox.cpp 67254 2011-03-20 00:14:35Z DS $ +// RCS-ID: $Id: bmpcbox.cpp 67326 2011-03-28 06:27:49Z PC $ // Copyright: (c) 2008 Jaakko Salli // Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// @@ -122,8 +122,8 @@ void wxBitmapComboBox::GTKCreateComboBoxWidget() else { m_widget = gtk_combo_box_entry_new_with_model( GTK_TREE_MODEL(store), m_stringCellIndex ); - m_entry = GTK_ENTRY( GTK_BIN(m_widget)->child ); - gtk_entry_set_editable( m_entry, TRUE ); + m_entry = GTK_ENTRY(gtk_bin_get_child(GTK_BIN(m_widget))); + gtk_editable_set_editable(GTK_EDITABLE(m_entry), true); } g_object_ref(m_widget); diff --git a/Externals/wxWidgets3/src/gtk/brush.cpp b/Externals/wxWidgets3/src/gtk/brush.cpp index 06d4d21afe..182b466a03 100644 --- a/Externals/wxWidgets3/src/gtk/brush.cpp +++ b/Externals/wxWidgets3/src/gtk/brush.cpp @@ -2,7 +2,7 @@ // Name: src/gtk/brush.cpp // Purpose: // Author: Robert Roebling -// Id: $Id: brush.cpp 61508 2009-07-23 20:30:22Z VZ $ +// Id: $Id: brush.cpp 67681 2011-05-03 16:29:04Z DS $ // Copyright: (c) 1998 Robert Roebling // Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// @@ -104,21 +104,21 @@ bool wxBrush::operator==(const wxBrush& brush) const wxBrushStyle wxBrush::GetStyle() const { - wxCHECK_MSG( Ok(), wxBRUSHSTYLE_INVALID, wxT("invalid brush") ); + wxCHECK_MSG( IsOk(), wxBRUSHSTYLE_INVALID, wxT("invalid brush") ); return M_BRUSHDATA->m_style; } wxColour wxBrush::GetColour() const { - wxCHECK_MSG( Ok(), wxNullColour, wxT("invalid brush") ); + wxCHECK_MSG( IsOk(), wxNullColour, wxT("invalid brush") ); return M_BRUSHDATA->m_colour; } wxBitmap *wxBrush::GetStipple() const { - wxCHECK_MSG( Ok(), NULL, wxT("invalid brush") ); + wxCHECK_MSG( IsOk(), NULL, wxT("invalid brush") ); return &M_BRUSHDATA->m_stipple; } diff --git a/Externals/wxWidgets3/src/gtk/button.cpp b/Externals/wxWidgets3/src/gtk/button.cpp index 59de0fa435..cb5d90973a 100644 --- a/Externals/wxWidgets3/src/gtk/button.cpp +++ b/Externals/wxWidgets3/src/gtk/button.cpp @@ -2,7 +2,7 @@ // Name: src/gtk/button.cpp // Purpose: // Author: Robert Roebling -// Id: $Id: button.cpp 67151 2011-03-08 17:22:15Z VZ $ +// Id: $Id: button.cpp 68842 2011-08-22 12:41:00Z VZ $ // Copyright: (c) 1998 Robert Roebling // Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// @@ -19,6 +19,7 @@ #include "wx/stockitem.h" #include "wx/gtk/private.h" +#include "wx/gtk/private/list.h" // ---------------------------------------------------------------------------- // GTK callbacks @@ -38,42 +39,6 @@ wxgtk_button_clicked_callback(GtkWidget *WXUNUSED(widget), wxButton *button) button->HandleWindowEvent(event); } -static void -wxgtk_button_enter_callback(GtkWidget *WXUNUSED(widget), wxButton *button) -{ - if ( button->GTKShouldIgnoreEvent() ) - return; - - button->GTKMouseEnters(); -} - -static void -wxgtk_button_leave_callback(GtkWidget *WXUNUSED(widget), wxButton *button) -{ - if ( button->GTKShouldIgnoreEvent() ) - return; - - button->GTKMouseLeaves(); -} - -static void -wxgtk_button_press_callback(GtkWidget *WXUNUSED(widget), wxButton *button) -{ - if ( button->GTKShouldIgnoreEvent() ) - return; - - button->GTKPressed(); -} - -static void -wxgtk_button_released_callback(GtkWidget *WXUNUSED(widget), wxButton *button) -{ - if ( button->GTKShouldIgnoreEvent() ) - return; - - button->GTKReleased(); -} - //----------------------------------------------------------------------------- // "style_set" from m_widget //----------------------------------------------------------------------------- @@ -83,7 +48,7 @@ wxgtk_button_style_set_callback(GtkWidget* widget, GtkStyle*, wxButton* win) { /* the default button has a border around it */ wxWindow* parent = win->GetParent(); - if (parent && parent->m_wxwindow && GTK_WIDGET_CAN_DEFAULT(widget)) + if (parent && parent->m_wxwindow && gtk_widget_get_can_default(widget)) { GtkBorder* border = NULL; gtk_widget_style_get(widget, "default_border", &border, NULL); @@ -181,7 +146,7 @@ wxWindow *wxButton::SetDefault() { wxWindow *oldDefault = wxButtonBase::SetDefault(); - GTK_WIDGET_SET_FLAGS( m_widget, GTK_CAN_DEFAULT ); + gtk_widget_set_can_default(m_widget, TRUE); gtk_widget_grab_default( m_widget ); // resize for default border @@ -234,7 +199,7 @@ void wxButton::SetLabel( const wxString &lbl ) if (label.empty() && wxIsStockID(m_windowId)) label = wxGetStockLabel(m_windowId); - wxControl::SetLabel(label); + wxAnyButton::SetLabel(label); // don't use label if it was explicitly disabled if ( HasFlag(wxBU_NOTEXT) ) @@ -280,64 +245,45 @@ bool wxButton::DoSetLabelMarkup(const wxString& markup) return true; } -#endif // wxUSE_MARKUP - -bool wxButton::Enable( bool enable ) -{ - if (!base_type::Enable(enable)) - return false; - - gtk_widget_set_sensitive(GTK_BIN(m_widget)->child, enable); - - if (enable) - GTKFixSensitivity(); - - GTKUpdateBitmap(); - - return true; -} - -GdkWindow *wxButton::GTKGetWindow(wxArrayGdkWindows& WXUNUSED(windows)) const -{ - return GTK_BUTTON(m_widget)->event_window; -} GtkLabel *wxButton::GTKGetLabel() const { - GtkWidget *child = GTK_BIN(m_widget)->child; + GtkWidget* child = gtk_bin_get_child(GTK_BIN(m_widget)); if ( GTK_IS_ALIGNMENT(child) ) { - GtkWidget *box = GTK_BIN(child)->child; - for (GList* item = GTK_BOX(box)->children; item; item = item->next) + GtkWidget* box = gtk_bin_get_child(GTK_BIN(child)); + GtkLabel* label = NULL; + wxGtkList list(gtk_container_get_children(GTK_CONTAINER(box))); + for (GList* item = list; item; item = item->next) { - GtkBoxChild* boxChild = static_cast(item->data); - if ( GTK_IS_LABEL(boxChild->widget) ) - return GTK_LABEL(boxChild->widget); + if (GTK_IS_LABEL(item->data)) + label = GTK_LABEL(item->data); } - return NULL; + return label; } return GTK_LABEL(child); } +#endif // wxUSE_MARKUP void wxButton::DoApplyWidgetStyle(GtkRcStyle *style) { gtk_widget_modify_style(m_widget, style); - GtkWidget *child = GTK_BIN(m_widget)->child; + GtkWidget* child = gtk_bin_get_child(GTK_BIN(m_widget)); gtk_widget_modify_style(child, style); // for buttons with images, the path to the label is (at least in 2.12) // GtkButton -> GtkAlignment -> GtkHBox -> GtkLabel if ( GTK_IS_ALIGNMENT(child) ) { - GtkWidget *box = GTK_BIN(child)->child; + GtkWidget* box = gtk_bin_get_child(GTK_BIN(child)); if ( GTK_IS_BOX(box) ) { - for (GList* item = GTK_BOX(box)->children; item; item = item->next) + wxGtkList list(gtk_container_get_children(GTK_CONTAINER(box))); + for (GList* item = list; item; item = item->next) { - GtkBoxChild* boxChild = static_cast(item->data); - gtk_widget_modify_style(boxChild->widget, style); + gtk_widget_modify_style(GTK_WIDGET(item->data), style); } } } @@ -349,19 +295,19 @@ wxSize wxButton::DoGetBestSize() const // extra border around it, but we don't want to take it into account in // our size calculations (otherwise the result is visually ugly), so // always return the size of non default button from here - const bool isDefault = GTK_WIDGET_HAS_DEFAULT(m_widget); + const bool isDefault = gtk_widget_has_default(m_widget); if ( isDefault ) { // temporarily unset default flag - GTK_WIDGET_UNSET_FLAGS( m_widget, GTK_CAN_DEFAULT ); + gtk_widget_set_can_default(m_widget, FALSE); } - wxSize ret( wxControl::DoGetBestSize() ); + wxSize ret( wxAnyButton::DoGetBestSize() ); if ( isDefault ) { // set it back again - GTK_WIDGET_SET_FLAGS( m_widget, GTK_CAN_DEFAULT ); + gtk_widget_set_can_default(m_widget, TRUE); } if (!HasFlag(wxBU_EXACTFIT)) @@ -384,326 +330,4 @@ wxButton::GetClassDefaultAttributes(wxWindowVariant WXUNUSED(variant)) return GetDefaultAttributesFromGTKWidget(gtk_button_new); } -// ---------------------------------------------------------------------------- -// bitmaps support -// ---------------------------------------------------------------------------- - -void wxButton::GTKMouseEnters() -{ - m_isCurrent = true; - - GTKUpdateBitmap(); -} - -void wxButton::GTKMouseLeaves() -{ - m_isCurrent = false; - - GTKUpdateBitmap(); -} - -void wxButton::GTKPressed() -{ - m_isPressed = true; - - GTKUpdateBitmap(); -} - -void wxButton::GTKReleased() -{ - m_isPressed = false; - - GTKUpdateBitmap(); -} - -void wxButton::GTKOnFocus(wxFocusEvent& event) -{ - event.Skip(); - - GTKUpdateBitmap(); -} - -wxButton::State wxButton::GTKGetCurrentState() const -{ - if ( !IsThisEnabled() ) - return m_bitmaps[State_Disabled].IsOk() ? State_Disabled : State_Normal; - - if ( m_isPressed && m_bitmaps[State_Pressed].IsOk() ) - return State_Pressed; - - if ( m_isCurrent && m_bitmaps[State_Current].IsOk() ) - return State_Current; - - if ( HasFocus() && m_bitmaps[State_Focused].IsOk() ) - return State_Focused; - - return State_Normal; -} - -void wxButton::GTKUpdateBitmap() -{ - // if we don't show bitmaps at all, there is nothing to update - if ( m_bitmaps[State_Normal].IsOk() ) - { - // if we do show them, this will return a state for which we do have a - // valid bitmap - State state = GTKGetCurrentState(); - - GTKDoShowBitmap(m_bitmaps[state]); - } -} - -void wxButton::GTKDoShowBitmap(const wxBitmap& bitmap) -{ - wxASSERT_MSG( bitmap.IsOk(), "invalid bitmap" ); - - GtkWidget *image; - if ( DontShowLabel() ) - { - image = GTK_BIN(m_widget)->child; - } - else // have both label and bitmap - { -#ifdef __WXGTK26__ - if ( !gtk_check_version(2,6,0) ) - { - image = gtk_button_get_image(GTK_BUTTON(m_widget)); - } - else -#endif // __WXGTK26__ - { - // buttons with both label and bitmap are only supported with GTK+ - // 2.6 so far - // - // it shouldn't be difficult to implement them ourselves for the - // previous GTK+ versions by stuffing a container with a label and - // an image inside GtkButton but there doesn't seem to be much - // point in doing this for ancient GTK+ versions - return; - } - } - - wxCHECK_RET( image && GTK_IS_IMAGE(image), "must have image widget" ); - - gtk_image_set_from_pixbuf(GTK_IMAGE(image), bitmap.GetPixbuf()); -} - -wxBitmap wxButton::DoGetBitmap(State which) const -{ - return m_bitmaps[which]; -} - -void wxButton::DoSetBitmap(const wxBitmap& bitmap, State which) -{ - switch ( which ) - { - case State_Normal: - if ( DontShowLabel() ) - { - // we only have the bitmap in this button, never remove it but - // do invalidate the best size when the bitmap (and presumably - // its size) changes - InvalidateBestSize(); - } -#ifdef __WXGTK26__ - // normal image is special: setting it enables images for the button and - // resetting it to nothing disables all of them - else if ( !gtk_check_version(2,6,0) ) - { - GtkWidget *image = gtk_button_get_image(GTK_BUTTON(m_widget)); - if ( image && !bitmap.IsOk() ) - { - gtk_container_remove(GTK_CONTAINER(m_widget), image); - } - else if ( !image && bitmap.IsOk() ) - { - image = gtk_image_new(); - gtk_button_set_image(GTK_BUTTON(m_widget), image); - } - else // image presence or absence didn't change - { - // don't invalidate best size below - break; - } - - InvalidateBestSize(); - } -#endif // GTK+ 2.6+ - break; - - case State_Pressed: - if ( bitmap.IsOk() ) - { - if ( !m_bitmaps[which].IsOk() ) - { - // we need to install the callbacks to be notified about - // the button pressed state change - g_signal_connect - ( - m_widget, - "pressed", - G_CALLBACK(wxgtk_button_press_callback), - this - ); - - g_signal_connect - ( - m_widget, - "released", - G_CALLBACK(wxgtk_button_released_callback), - this - ); - } - } - else // no valid bitmap - { - if ( m_bitmaps[which].IsOk() ) - { - // we don't need to be notified about the button pressed - // state changes any more - g_signal_handlers_disconnect_by_func - ( - m_widget, - (gpointer)wxgtk_button_press_callback, - this - ); - - g_signal_handlers_disconnect_by_func - ( - m_widget, - (gpointer)wxgtk_button_released_callback, - this - ); - - // also make sure we don't remain stuck in pressed state - if ( m_isPressed ) - { - m_isPressed = false; - GTKUpdateBitmap(); - } - } - } - break; - - case State_Current: - // the logic here is the same as above for State_Pressed: we need - // to connect the handlers if we must be notified about the changes - // in the button current state and we disconnect them when/if we - // don't need them any more - if ( bitmap.IsOk() ) - { - if ( !m_bitmaps[which].IsOk() ) - { - g_signal_connect - ( - m_widget, - "enter", - G_CALLBACK(wxgtk_button_enter_callback), - this - ); - - g_signal_connect - ( - m_widget, - "leave", - G_CALLBACK(wxgtk_button_leave_callback), - this - ); - } - } - else // no valid bitmap - { - if ( m_bitmaps[which].IsOk() ) - { - g_signal_handlers_disconnect_by_func - ( - m_widget, - (gpointer)wxgtk_button_enter_callback, - this - ); - - g_signal_handlers_disconnect_by_func - ( - m_widget, - (gpointer)wxgtk_button_leave_callback, - this - ); - - if ( m_isCurrent ) - { - m_isCurrent = false; - GTKUpdateBitmap(); - } - } - } - break; - - case State_Focused: - if ( bitmap.IsOk() ) - { - Connect(wxEVT_SET_FOCUS, - wxFocusEventHandler(wxButton::GTKOnFocus)); - Connect(wxEVT_KILL_FOCUS, - wxFocusEventHandler(wxButton::GTKOnFocus)); - } - else // no valid focused bitmap - { - Disconnect(wxEVT_SET_FOCUS, - wxFocusEventHandler(wxButton::GTKOnFocus)); - Disconnect(wxEVT_KILL_FOCUS, - wxFocusEventHandler(wxButton::GTKOnFocus)); - } - break; - - default: - // no callbacks to connect/disconnect - ; - } - - m_bitmaps[which] = bitmap; - - // update the bitmap immediately if necessary, otherwise it will be done - // when the bitmap for the corresponding state is needed the next time by - // GTKUpdateBitmap() - if ( bitmap.IsOk() && which == GTKGetCurrentState() ) - { - GTKDoShowBitmap(bitmap); - } -} - -void wxButton::DoSetBitmapPosition(wxDirection dir) -{ -#ifdef __WXGTK210__ - if ( !gtk_check_version(2,10,0) ) - { - GtkPositionType gtkpos; - switch ( dir ) - { - default: - wxFAIL_MSG( "invalid position" ); - // fall through - - case wxLEFT: - gtkpos = GTK_POS_LEFT; - break; - - case wxRIGHT: - gtkpos = GTK_POS_RIGHT; - break; - - case wxTOP: - gtkpos = GTK_POS_TOP; - break; - - case wxBOTTOM: - gtkpos = GTK_POS_BOTTOM; - break; - } - - gtk_button_set_image_position(GTK_BUTTON(m_widget), gtkpos); - InvalidateBestSize(); - } -#endif // GTK+ 2.10+ -} - #endif // wxUSE_BUTTON diff --git a/Externals/wxWidgets3/src/gtk/calctrl.cpp b/Externals/wxWidgets3/src/gtk/calctrl.cpp index e0d9f9ebf0..e53190e2fb 100644 --- a/Externals/wxWidgets3/src/gtk/calctrl.cpp +++ b/Externals/wxWidgets3/src/gtk/calctrl.cpp @@ -2,7 +2,7 @@ // Name: src/gtk/calctrl.cpp // Purpose: implementation of the wxGtkCalendarCtrl // Author: Marcin Wojdyr -// RCS-ID: $Id: calctrl.cpp 66568 2011-01-04 11:48:14Z VZ $ +// RCS-ID: $Id: calctrl.cpp 70755 2012-02-29 18:13:06Z PC $ // Copyright: (c) 2008 Marcin Wojdyr // Licence: wxWindows licence /////////////////////////////////////////////////////////////////////////////// @@ -13,42 +13,33 @@ #pragma hdrstop #endif +#if wxUSE_CALENDARCTRL + #ifndef WX_PRECOMP #endif //WX_PRECOMP -#if wxUSE_CALENDARCTRL - -#include "wx/gtk/private.h" #include "wx/calctrl.h" -#include "wx/gtk/calctrl.h" +#include extern "C" { static void gtk_day_selected_callback(GtkWidget *WXUNUSED(widget), wxGtkCalendarCtrl *cal) { - wxDateTime date = cal->GetDate(); - if (cal->m_selectedDate == date) - return; - - cal->m_selectedDate = date; - - cal->GenerateEvent(wxEVT_CALENDAR_SEL_CHANGED); - // send deprecated event - cal->GenerateEvent(wxEVT_CALENDAR_DAY_CHANGED); + cal->GTKGenerateEvent(wxEVT_CALENDAR_SEL_CHANGED); } static void gtk_day_selected_double_click_callback(GtkWidget *WXUNUSED(widget), wxGtkCalendarCtrl *cal) { - cal->GenerateEvent(wxEVT_CALENDAR_DOUBLECLICKED); + cal->GTKGenerateEvent(wxEVT_CALENDAR_DOUBLECLICKED); } static void gtk_month_changed_callback(GtkWidget *WXUNUSED(widget), wxGtkCalendarCtrl *cal) { - cal->GenerateEvent(wxEVT_CALENDAR_PAGE_CHANGED); + cal->GTKGenerateEvent(wxEVT_CALENDAR_PAGE_CHANGED); } // callbacks that send deprecated events @@ -56,13 +47,13 @@ static void gtk_month_changed_callback(GtkWidget *WXUNUSED(widget), static void gtk_prev_month_callback(GtkWidget *WXUNUSED(widget), wxGtkCalendarCtrl *cal) { - cal->GenerateEvent(wxEVT_CALENDAR_MONTH_CHANGED); + cal->GTKGenerateEvent(wxEVT_CALENDAR_MONTH_CHANGED); } static void gtk_prev_year_callback(GtkWidget *WXUNUSED(widget), wxGtkCalendarCtrl *cal) { - cal->GenerateEvent(wxEVT_CALENDAR_YEAR_CHANGED); + cal->GTKGenerateEvent(wxEVT_CALENDAR_YEAR_CHANGED); } } @@ -127,6 +118,74 @@ bool wxGtkCalendarCtrl::Create(wxWindow *parent, return true; } +void wxGtkCalendarCtrl::GTKGenerateEvent(wxEventType type) +{ + // First check if the new date is in the specified range. + wxDateTime dt = GetDate(); + if ( !IsInValidRange(dt) ) + { + if ( m_validStart.IsValid() && dt < m_validStart ) + dt = m_validStart; + else + dt = m_validEnd; + + SetDate(dt); + + return; + } + + if ( type == wxEVT_CALENDAR_SEL_CHANGED ) + { + // Don't generate this event if the new date is the same as the old + // one. + if ( m_selectedDate == dt ) + return; + + m_selectedDate = dt; + + GenerateEvent(type); + + // Also send the deprecated event together with the new one. + GenerateEvent(wxEVT_CALENDAR_DAY_CHANGED); + } + else + { + GenerateEvent(type); + } +} + +bool wxGtkCalendarCtrl::IsInValidRange(const wxDateTime& dt) const +{ + return (!m_validStart.IsValid() || m_validStart <= dt) && + (!m_validEnd.IsValid() || dt <= m_validEnd); +} + +bool +wxGtkCalendarCtrl::SetDateRange(const wxDateTime& lowerdate, + const wxDateTime& upperdate) +{ + if ( lowerdate.IsValid() && upperdate.IsValid() && lowerdate >= upperdate ) + return false; + + m_validStart = lowerdate; + m_validEnd = upperdate; + + return true; +} + +bool +wxGtkCalendarCtrl::GetDateRange(wxDateTime *lowerdate, + wxDateTime *upperdate) const +{ + if ( lowerdate ) + *lowerdate = m_validStart; + if ( upperdate ) + *upperdate = m_validEnd; + + return m_validStart.IsValid() || m_validEnd.IsValid(); +} + + bool wxGtkCalendarCtrl::EnableMonthChange(bool enable) { if ( !wxCalendarCtrlBase::EnableMonthChange(enable) ) @@ -140,8 +199,13 @@ bool wxGtkCalendarCtrl::EnableMonthChange(bool enable) bool wxGtkCalendarCtrl::SetDate(const wxDateTime& date) { + if ( date.IsValid() && !IsInValidRange(date) ) + return false; + g_signal_handlers_block_by_func(m_widget, (gpointer) gtk_day_selected_callback, this); + g_signal_handlers_block_by_func(m_widget, + (gpointer) gtk_month_changed_callback, this); m_selectedDate = date; int year = date.GetYear(); @@ -150,6 +214,8 @@ bool wxGtkCalendarCtrl::SetDate(const wxDateTime& date) gtk_calendar_select_month(GTK_CALENDAR(m_widget), month, year); gtk_calendar_select_day(GTK_CALENDAR(m_widget), day); + g_signal_handlers_unblock_by_func( m_widget, + (gpointer) gtk_month_changed_callback, this); g_signal_handlers_unblock_by_func( m_widget, (gpointer) gtk_day_selected_callback, this); @@ -158,9 +224,22 @@ bool wxGtkCalendarCtrl::SetDate(const wxDateTime& date) wxDateTime wxGtkCalendarCtrl::GetDate() const { - guint year, month, day; - gtk_calendar_get_date(GTK_CALENDAR(m_widget), &year, &month, &day); - return wxDateTime(day, (wxDateTime::Month) month, year); + guint year, monthGTK, day; + gtk_calendar_get_date(GTK_CALENDAR(m_widget), &year, &monthGTK, &day); + + // GTK may return an invalid date, this happens at least when switching the + // month (or the year in case of February in a leap year) and the new month + // has fewer days than the currently selected one making the currently + // selected day invalid, e.g. just choosing May 31 and going back a month + // results in the date being (non existent) April 31 when we're called from + // gtk_prev_month_callback(). We need to manually work around this to avoid + // asserts from wxDateTime ctor. + const wxDateTime::Month month = static_cast(monthGTK); + const guint dayMax = wxDateTime::GetNumberOfDays(month, year); + if ( day > dayMax ) + day = dayMax; + + return wxDateTime(day, month, year); } void wxGtkCalendarCtrl::Mark(size_t day, bool mark) diff --git a/Externals/wxWidgets3/src/gtk/checkbox.cpp b/Externals/wxWidgets3/src/gtk/checkbox.cpp index 8681002c00..4d8c63e203 100644 --- a/Externals/wxWidgets3/src/gtk/checkbox.cpp +++ b/Externals/wxWidgets3/src/gtk/checkbox.cpp @@ -2,7 +2,7 @@ // Name: src/gtk/checkbox.cpp // Purpose: // Author: Robert Roebling -// Id: $Id: checkbox.cpp 66555 2011-01-04 08:31:53Z SC $ +// Id: $Id: checkbox.cpp 67326 2011-03-28 06:27:49Z PC $ // Copyright: (c) 1998 Robert Roebling // Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// @@ -131,7 +131,7 @@ bool wxCheckBox::Create(wxWindow *parent, else { m_widgetCheckbox = gtk_check_button_new_with_label(""); - m_widgetLabel = GTK_BIN(m_widgetCheckbox)->child; + m_widgetLabel = gtk_bin_get_child(GTK_BIN(m_widgetCheckbox)); m_widget = m_widgetCheckbox; } g_object_ref(m_widget); diff --git a/Externals/wxWidgets3/src/gtk/choice.cpp b/Externals/wxWidgets3/src/gtk/choice.cpp index d153260565..0c7f552a4a 100644 --- a/Externals/wxWidgets3/src/gtk/choice.cpp +++ b/Externals/wxWidgets3/src/gtk/choice.cpp @@ -2,7 +2,7 @@ // Name: src/gtk/choice.cpp // Purpose: // Author: Robert Roebling -// Id: $Id: choice.cpp 66555 2011-01-04 08:31:53Z SC $ +// Id: $Id: choice.cpp 67326 2011-03-28 06:27:49Z PC $ // Copyright: (c) 1998 Robert Roebling // Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// @@ -334,7 +334,7 @@ void wxChoice::GTKEnableEvents() GdkWindow *wxChoice::GTKGetWindow(wxArrayGdkWindows& WXUNUSED(windows)) const { - return m_widget->window; + return gtk_widget_get_window(m_widget); } // Notice that this method shouldn't be necessary, because GTK calculates @@ -371,7 +371,7 @@ wxSize wxChoice::DoGetBestSize() const void wxChoice::DoApplyWidgetStyle(GtkRcStyle *style) { gtk_widget_modify_style(m_widget, style); - gtk_widget_modify_style(GTK_BIN(m_widget)->child, style); + gtk_widget_modify_style(gtk_bin_get_child(GTK_BIN(m_widget)), style); } diff --git a/Externals/wxWidgets3/src/gtk/clipbrd.cpp b/Externals/wxWidgets3/src/gtk/clipbrd.cpp index 678c9d9466..f60a8cc836 100644 --- a/Externals/wxWidgets3/src/gtk/clipbrd.cpp +++ b/Externals/wxWidgets3/src/gtk/clipbrd.cpp @@ -2,7 +2,7 @@ // Name: src/gtk/clipbrd.cpp // Purpose: wxClipboard implementation for wxGTK // Author: Robert Roebling, Vadim Zeitlin -// Id: $Id: clipbrd.cpp 67229 2011-03-18 09:16:19Z VZ $ +// Id: $Id: clipbrd.cpp 69454 2011-10-18 21:54:53Z VZ $ // Copyright: (c) 1998 Robert Roebling // (c) 2007 Vadim Zeitlin // Licence: wxWindows licence @@ -133,11 +133,15 @@ targets_selection_received( GtkWidget *WXUNUSED(widget), wxON_BLOCK_EXIT1(wxClipboardSync::OnDone, clipboard); - if ( !selection_data || selection_data->length <= 0 ) + if (!selection_data) + return; + + const int selection_data_length = gtk_selection_data_get_length(selection_data); + if (selection_data_length <= 0) return; // make sure we got the data in the correct form - GdkAtom type = selection_data->type; + GdkAtom type = gtk_selection_data_get_data_type(selection_data); if ( type != GDK_SELECTION_TYPE_ATOM ) { if ( strcmp(wxGtkString(gdk_atom_name(type)), "TARGETS") != 0 ) @@ -151,14 +155,14 @@ targets_selection_received( GtkWidget *WXUNUSED(widget), // it's not really a format, of course, but we can reuse its GetId() method // to format this atom as string - wxDataFormat clip(selection_data->selection); + wxDataFormat clip(gtk_selection_data_get_selection(selection_data)); wxLogTrace( TRACE_CLIPBOARD, wxT("Received available formats for clipboard %s"), clip.GetId().c_str() ); // the atoms we received, holding a list of targets (= formats) - const GdkAtom * const atoms = (GdkAtom *)selection_data->data; - for ( size_t i = 0; i < selection_data->length/sizeof(GdkAtom); i++ ) + const GdkAtom* const atoms = (GdkAtom*)gtk_selection_data_get_data(selection_data); + for (size_t i = 0; i < selection_data_length / sizeof(GdkAtom); i++) { const wxDataFormat format(atoms[i]); @@ -195,7 +199,7 @@ selection_received( GtkWidget *WXUNUSED(widget), wxON_BLOCK_EXIT1(wxClipboardSync::OnDone, clipboard); - if ( !selection_data || selection_data->length <= 0 ) + if (!selection_data || gtk_selection_data_get_length(selection_data) <= 0) return; clipboard->GTKOnSelectionReceived(*selection_data); @@ -262,7 +266,8 @@ selection_handler( GtkWidget *WXUNUSED(widget), if ( !clipboard ) return; - wxDataObject * const data = clipboard->GTKGetDataObject(selection_data->selection); + wxDataObject * const data = clipboard->GTKGetDataObject( + gtk_selection_data_get_selection(selection_data)); if ( !data ) return; @@ -270,7 +275,7 @@ selection_handler( GtkWidget *WXUNUSED(widget), // In particular, it satisfies Klipper, which polls // TIMESTAMP to see if the clipboards content has changed. // It shall return the time which was used to set the data. - if (selection_data->target == g_timestampAtom) + if (gtk_selection_data_get_target(selection_data) == g_timestampAtom) { guint timestamp = GPOINTER_TO_UINT (signal_data); gtk_selection_data_set(selection_data, @@ -284,14 +289,14 @@ selection_handler( GtkWidget *WXUNUSED(widget), return; } - wxDataFormat format( selection_data->target ); + wxDataFormat format(gtk_selection_data_get_target(selection_data)); wxLogTrace(TRACE_CLIPBOARD, wxT("clipboard data in format %s, GtkSelectionData is target=%s type=%s selection=%s timestamp=%u"), format.GetId().c_str(), - wxString::FromAscii(wxGtkString(gdk_atom_name(selection_data->target))).c_str(), - wxString::FromAscii(wxGtkString(gdk_atom_name(selection_data->type))).c_str(), - wxString::FromAscii(wxGtkString(gdk_atom_name(selection_data->selection))).c_str(), + wxString::FromAscii(wxGtkString(gdk_atom_name(gtk_selection_data_get_target(selection_data)))).c_str(), + wxString::FromAscii(wxGtkString(gdk_atom_name(gtk_selection_data_get_data_type(selection_data)))).c_str(), + wxString::FromAscii(wxGtkString(gdk_atom_name(gtk_selection_data_get_selection(selection_data)))).c_str(), GPOINTER_TO_UINT( signal_data ) ); @@ -335,14 +340,16 @@ void wxClipboard::GTKOnSelectionReceived(const GtkSelectionData& sel) { wxCHECK_RET( m_receivedData, wxT("should be inside GetData()") ); - const wxDataFormat format(sel.target); + const wxDataFormat format(gtk_selection_data_get_target(const_cast(&sel))); wxLogTrace(TRACE_CLIPBOARD, wxT("Received selection %s"), format.GetId().c_str()); - if ( !m_receivedData->IsSupportedFormat(format) ) + if ( !m_receivedData->IsSupportedFormat(format, wxDataObject::Set) ) return; - m_receivedData->SetData(format, sel.length, sel.data); + m_receivedData->SetData(format, + gtk_selection_data_get_length(const_cast(&sel)), + gtk_selection_data_get_data(const_cast(&sel))); m_formatSupported = true; } @@ -366,7 +373,11 @@ async_targets_selection_received( GtkWidget *WXUNUSED(widget), wxClipboardEvent *event = new wxClipboardEvent(wxEVT_CLIPBOARD_CHANGED); event->SetEventObject( clipboard ); - if ( !selection_data || selection_data->length <= 0 ) + int selection_data_length = 0; + if (selection_data) + selection_data_length = gtk_selection_data_get_length(selection_data); + + if (selection_data_length <= 0) { clipboard->m_sink->QueueEvent( event ); clipboard->m_sink.Release(); @@ -374,7 +385,7 @@ async_targets_selection_received( GtkWidget *WXUNUSED(widget), } // make sure we got the data in the correct form - GdkAtom type = selection_data->type; + GdkAtom type = gtk_selection_data_get_data_type(selection_data); if ( type != GDK_SELECTION_TYPE_ATOM ) { if ( strcmp(wxGtkString(gdk_atom_name(type)), "TARGETS") != 0 ) @@ -390,14 +401,14 @@ async_targets_selection_received( GtkWidget *WXUNUSED(widget), // it's not really a format, of course, but we can reuse its GetId() method // to format this atom as string - wxDataFormat clip(selection_data->selection); + wxDataFormat clip(gtk_selection_data_get_selection(selection_data)); wxLogTrace( TRACE_CLIPBOARD, wxT("Received available formats for clipboard %s"), clip.GetId().c_str() ); // the atoms we received, holding a list of targets (= formats) - const GdkAtom * const atoms = (GdkAtom *)selection_data->data; - for ( size_t i = 0; i < selection_data->length/sizeof(GdkAtom); i++ ) + const GdkAtom* const atoms = (GdkAtom*)gtk_selection_data_get_data(selection_data); + for (size_t i = 0; i < selection_data_length / sizeof(GdkAtom); i++) { const wxDataFormat format(atoms[i]); @@ -568,7 +579,7 @@ void wxClipboard::Clear() gtk_selection_clear_targets( m_clipboardWidget, GTKGetClipboardAtom() ); if ( gdk_selection_owner_get(GTKGetClipboardAtom()) == - m_clipboardWidget->window ) + gtk_widget_get_window(m_clipboardWidget) ) { wxClipboardSync sync(*this); diff --git a/Externals/wxWidgets3/src/gtk/clrpicker.cpp b/Externals/wxWidgets3/src/gtk/clrpicker.cpp index 1461f76b94..a70c98c24b 100644 --- a/Externals/wxWidgets3/src/gtk/clrpicker.cpp +++ b/Externals/wxWidgets3/src/gtk/clrpicker.cpp @@ -4,7 +4,7 @@ // Author: Francesco Montorsi // Modified By: // Created: 15/04/2006 -// Id: $Id: clrpicker.cpp 55288 2008-08-26 16:19:23Z PC $ +// Id: $Id: clrpicker.cpp 70756 2012-02-29 18:29:31Z PC $ // Copyright: (c) Francesco Montorsi // Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// @@ -69,7 +69,6 @@ bool wxColourButton::Create( wxWindow *parent, wxWindowID id, m_colour = col; m_widget = gtk_color_button_new_with_color( m_colour.GetColor() ); g_object_ref(m_widget); - gtk_widget_show(m_widget); // GtkColourButton signals g_signal_connect(m_widget, "color-set", diff --git a/Externals/wxWidgets3/src/gtk/collpane.cpp b/Externals/wxWidgets3/src/gtk/collpane.cpp index d3b31dc144..e943a4c7f0 100644 --- a/Externals/wxWidgets3/src/gtk/collpane.cpp +++ b/Externals/wxWidgets3/src/gtk/collpane.cpp @@ -4,7 +4,7 @@ // Author: Francesco Montorsi // Modified By: // Created: 8/10/2006 -// Id: $Id: collpane.cpp 67280 2011-03-22 14:17:38Z DS $ +// Id: $Id: collpane.cpp 70756 2012-02-29 18:29:31Z PC $ // Copyright: (c) Francesco Montorsi // Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// @@ -95,7 +95,7 @@ gtk_collapsiblepane_expanded_callback(GObject * WXUNUSED(object), // 1) need to update our size hints // NB: this function call won't actually do any long operation - // (redraw/relayouting/resizing) so that it's flicker-free + // (redraw/relayout/resize) so that it's flicker-free p->SetMinSize(sz); if (p->HasFlag(wxCP_NO_TLW_RESIZE)) @@ -123,7 +123,7 @@ gtk_collapsiblepane_expanded_callback(GObject * WXUNUSED(object), // transition. This may be sometimes undesired but *is* // necessary and if you look carefully, all GTK+ programs using // GtkExpander perform this trick (e.g. the standard "open file" - // dialog of GTK+>=2.4 is not resizeable when the expander is + // dialog of GTK+>=2.4 is not resizable when the expander is // collapsed!) gtk_window_set_resizable (GTK_WINDOW (top->m_widget), p->IsExpanded()); @@ -200,7 +200,6 @@ bool wxCollapsiblePane::Create(wxWindow *parent, m_pPane = new wxPanel(this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL|wxNO_BORDER, wxS("wxCollapsiblePanePane")); - gtk_widget_show(m_widget); m_parent->DoAddChild( this ); PostCreation(size); @@ -281,8 +280,8 @@ void wxCollapsiblePane::OnSize(wxSizeEvent &ev) GdkWindow *wxCollapsiblePane::GTKGetWindow(wxArrayGdkWindows& windows) const { GtkWidget *label = gtk_expander_get_label_widget( GTK_EXPANDER(m_widget) ); - windows.Add( label->window ); - windows.Add( m_widget->window ); + windows.Add(gtk_widget_get_window(label)); + windows.Add(gtk_widget_get_window(m_widget)); return NULL; } diff --git a/Externals/wxWidgets3/src/gtk/colordlg.cpp b/Externals/wxWidgets3/src/gtk/colordlg.cpp index 3ecc1bb70f..cb01eca93b 100644 --- a/Externals/wxWidgets3/src/gtk/colordlg.cpp +++ b/Externals/wxWidgets3/src/gtk/colordlg.cpp @@ -4,7 +4,7 @@ // Author: Vaclav Slavik // Modified by: // Created: 2004/06/04 -// RCS-ID: $Id: colordlg.cpp 67254 2011-03-20 00:14:35Z DS $ +// RCS-ID: $Id: colordlg.cpp 67681 2011-05-03 16:29:04Z DS $ // Copyright: (c) Vaclav Slavik, 2004 // Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// @@ -69,8 +69,9 @@ bool wxColourDialog::Create(wxWindow *parent, wxColourData *data) } #if !wxUSE_LIBHILDON && !wxUSE_LIBHILDON2 - GtkColorSelection *sel = - GTK_COLOR_SELECTION(GTK_COLOR_SELECTION_DIALOG(m_widget)->colorsel); + GtkColorSelection* sel = GTK_COLOR_SELECTION( + gtk_color_selection_dialog_get_color_selection( + GTK_COLOR_SELECTION_DIALOG(m_widget))); gtk_color_selection_set_has_palette(sel, true); #endif // !wxUSE_LIBHILDON && !wxUSE_LIBHILDON2 @@ -104,7 +105,7 @@ int wxColourDialog::ShowModal() void wxColourDialog::ColourDataToDialog() { const GdkColor * const - col = m_data.GetColour().Ok() ? m_data.GetColour().GetColor() + col = m_data.GetColour().IsOk() ? m_data.GetColour().GetColor() : NULL; #if wxUSE_LIBHILDON @@ -123,8 +124,9 @@ void wxColourDialog::ColourDataToDialog() hildon_color_chooser_dialog_set_color((HildonColorChooserDialog *)m_widget, &clr); #else // !wxUSE_LIBHILDON2/!wxUSE_LIBHILDON && !wxUSE_LIBHILDON2 - GtkColorSelection *sel = - GTK_COLOR_SELECTION(GTK_COLOR_SELECTION_DIALOG(m_widget)->colorsel); + GtkColorSelection* sel = GTK_COLOR_SELECTION( + gtk_color_selection_dialog_get_color_selection( + GTK_COLOR_SELECTION_DIALOG(m_widget))); if ( col ) gtk_color_selection_set_current_color(sel, col); @@ -136,7 +138,7 @@ void wxColourDialog::ColourDataToDialog() for (unsigned i = 0; i < 16; i++) { wxColour c = m_data.GetCustomColour(i); - if (c.Ok()) + if (c.IsOk()) { colors[n_colors] = *c.GetColor(); n_colors++; @@ -159,7 +161,7 @@ void wxColourDialog::DialogToColourData() m_data.SetColour(*clr); #elif wxUSE_LIBHILDON2 // !wxUSE_LIBHILDON const GdkColor * const - col = m_data.GetColour().Ok() ? m_data.GetColour().GetColor() : NULL; + col = m_data.GetColour().IsOk() ? m_data.GetColour().GetColor() : NULL; GdkColor clr; if (col) @@ -176,8 +178,9 @@ void wxColourDialog::DialogToColourData() m_data.SetColour(new_color); #else // !wxUSE_LIBHILDON2 - GtkColorSelection *sel = - GTK_COLOR_SELECTION(GTK_COLOR_SELECTION_DIALOG(m_widget)->colorsel); + GtkColorSelection* sel = GTK_COLOR_SELECTION( + gtk_color_selection_dialog_get_color_selection( + GTK_COLOR_SELECTION_DIALOG(m_widget))); GdkColor clr; gtk_color_selection_get_current_color(sel, &clr); diff --git a/Externals/wxWidgets3/src/gtk/colour.cpp b/Externals/wxWidgets3/src/gtk/colour.cpp index cf39ae149f..71be846325 100644 --- a/Externals/wxWidgets3/src/gtk/colour.cpp +++ b/Externals/wxWidgets3/src/gtk/colour.cpp @@ -2,7 +2,7 @@ // Name: src/gtk/colour.cpp // Purpose: // Author: Robert Roebling -// Id: $Id: colour.cpp 66555 2011-01-04 08:31:53Z SC $ +// Id: $Id: colour.cpp 67681 2011-05-03 16:29:04Z DS $ // Copyright: (c) 1998 Robert Roebling // Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// @@ -127,49 +127,49 @@ void wxColour::InitRGBA(unsigned char red, unsigned char green, unsigned char bl unsigned char wxColour::Red() const { - wxCHECK_MSG( Ok(), 0, wxT("invalid colour") ); + wxCHECK_MSG( IsOk(), 0, wxT("invalid colour") ); return wxByte(M_COLDATA->m_red >> SHIFT); } unsigned char wxColour::Green() const { - wxCHECK_MSG( Ok(), 0, wxT("invalid colour") ); + wxCHECK_MSG( IsOk(), 0, wxT("invalid colour") ); return wxByte(M_COLDATA->m_green >> SHIFT); } unsigned char wxColour::Blue() const { - wxCHECK_MSG( Ok(), 0, wxT("invalid colour") ); + wxCHECK_MSG( IsOk(), 0, wxT("invalid colour") ); return wxByte(M_COLDATA->m_blue >> SHIFT); } unsigned char wxColour::Alpha() const { - wxCHECK_MSG( Ok(), 0, wxT("invalid colour") ); + wxCHECK_MSG( IsOk(), 0, wxT("invalid colour") ); return M_COLDATA->m_alpha; } void wxColour::CalcPixel( GdkColormap *cmap ) { - if (!Ok()) return; + if (!IsOk()) return; M_COLDATA->AllocColour( cmap ); } int wxColour::GetPixel() const { - wxCHECK_MSG( Ok(), 0, wxT("invalid colour") ); + wxCHECK_MSG( IsOk(), 0, wxT("invalid colour") ); return M_COLDATA->m_color.pixel; } const GdkColor *wxColour::GetColor() const { - wxCHECK_MSG( Ok(), NULL, wxT("invalid colour") ); + wxCHECK_MSG( IsOk(), NULL, wxT("invalid colour") ); return &M_COLDATA->m_color; } diff --git a/Externals/wxWidgets3/src/gtk/combobox.cpp b/Externals/wxWidgets3/src/gtk/combobox.cpp index 2ff7dd9e1f..de031ff72d 100644 --- a/Externals/wxWidgets3/src/gtk/combobox.cpp +++ b/Externals/wxWidgets3/src/gtk/combobox.cpp @@ -2,7 +2,7 @@ // Name: src/gtk/combobox.cpp // Purpose: // Author: Robert Roebling -// Id: $Id: combobox.cpp 66555 2011-01-04 08:31:53Z SC $ +// Id: $Id: combobox.cpp 70880 2012-03-11 23:55:19Z VZ $ // Copyright: (c) 1998 Robert Roebling // Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// @@ -134,7 +134,7 @@ bool wxComboBox::Create( wxWindow *parent, wxWindowID id, const wxString& value, gtk_entry_set_activates_default( entry, !HasFlag(wxTE_PROCESS_ENTER) ); - gtk_entry_set_editable( entry, TRUE ); + gtk_editable_set_editable(GTK_EDITABLE(entry), true); } Append(n, choices); @@ -155,7 +155,7 @@ bool wxComboBox::Create( wxWindow *parent, wxWindowID id, const wxString& value, // wxMSW and also because it doesn't make sense to have a string // which is not a possible choice in a read-only combobox) SetStringSelection(value); - gtk_entry_set_editable( entry, FALSE ); + gtk_editable_set_editable(GTK_EDITABLE(entry), false); } else // editable combobox { @@ -186,12 +186,12 @@ void wxComboBox::GTKCreateComboBoxWidget() m_widget = gtk_combo_box_entry_new_text(); g_object_ref(m_widget); - m_entry = GTK_ENTRY(GTK_BIN(m_widget)->child); + m_entry = GTK_ENTRY(gtk_bin_get_child(GTK_BIN(m_widget))); } GtkEditable *wxComboBox::GetEditable() const { - return GTK_EDITABLE( GTK_BIN(m_widget)->child ); + return GTK_EDITABLE(gtk_bin_get_child(GTK_BIN(m_widget))); } void wxComboBox::OnChar( wxKeyEvent &event ) @@ -227,12 +227,12 @@ void wxComboBox::EnableTextChangedEvents(bool enable) if ( enable ) { - g_signal_handlers_unblock_by_func(GTK_BIN(m_widget)->child, + g_signal_handlers_unblock_by_func(gtk_bin_get_child(GTK_BIN(m_widget)), (gpointer)gtkcombobox_text_changed_callback, this); } else // disable { - g_signal_handlers_block_by_func(GTK_BIN(m_widget)->child, + g_signal_handlers_block_by_func(gtk_bin_get_child(GTK_BIN(m_widget)), (gpointer)gtkcombobox_text_changed_callback, this); } } @@ -264,7 +264,7 @@ GtkWidget* wxComboBox::GetConnectWidget() GdkWindow* wxComboBox::GTKGetWindow(wxArrayGdkWindows& /* windows */) const { - return GetEntry()->text_area; + return gtk_entry_get_text_window(GetEntry()); } // static @@ -282,6 +282,19 @@ void wxComboBox::SetValue(const wxString& value) wxTextEntry::SetValue(value); } +void wxComboBox::SetString(unsigned int n, const wxString& text) +{ + wxChoice::SetString(n, text); + + if ( static_cast(n) == GetSelection() ) + { + // We also need to update the currently shown text, for consistency + // with wxMSW and also because it makes sense as leaving the old string + // in the text but not in the list would be confusing to the user. + SetValue(text); + } +} + // ---------------------------------------------------------------------------- // standard event handling // ---------------------------------------------------------------------------- diff --git a/Externals/wxWidgets3/src/gtk/control.cpp b/Externals/wxWidgets3/src/gtk/control.cpp index 1b1100e15e..22bda642ac 100644 --- a/Externals/wxWidgets3/src/gtk/control.cpp +++ b/Externals/wxWidgets3/src/gtk/control.cpp @@ -2,7 +2,7 @@ // Name: src/gtk/control.cpp // Purpose: wxControl implementation for wxGTK // Author: Robert Roebling -// Id: $Id: control.cpp 67062 2011-02-27 12:48:07Z VZ $ +// Id: $Id: control.cpp 70714 2012-02-27 17:49:33Z PC $ // Copyright: (c) 1998 Robert Roebling, Julian Smart and Vadim Zeitlin // Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// @@ -229,9 +229,6 @@ wxControl::GetDefaultAttributesFromGTKWidget(GtkWidget* widget, return wxWindow::GetClassDefaultAttributes(wxWINDOW_VARIANT_NORMAL); } - if (state == -1) - state = GTK_STATE_NORMAL; - // get the style's colours attr.colFg = wxColour(style->fg[state]); if (useBase) @@ -245,8 +242,9 @@ wxControl::GetDefaultAttributesFromGTKWidget(GtkWidget* widget, if ( style && style->font_desc ) { wxNativeFontInfo info; - info.description = pango_font_description_copy(style->font_desc); + info.description = style->font_desc; attr.font = wxFont(info); + info.description = NULL; } else { diff --git a/Externals/wxWidgets3/src/gtk/cursor.cpp b/Externals/wxWidgets3/src/gtk/cursor.cpp index 23600d0bed..8f4b5f6ea2 100644 --- a/Externals/wxWidgets3/src/gtk/cursor.cpp +++ b/Externals/wxWidgets3/src/gtk/cursor.cpp @@ -2,7 +2,7 @@ // Name: src/gtk/cursor.cpp // Purpose: wxCursor implementation // Author: Robert Roebling -// Id: $Id: cursor.cpp 66371 2010-12-14 18:43:25Z VZ $ +// Id: $Id: cursor.cpp 68685 2011-08-13 16:17:59Z PC $ // Copyright: (c) 1998 Robert Roebling // Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// @@ -22,6 +22,7 @@ #include #include "wx/gtk/private/object.h" +#include "wx/gtk/private/gtk2-compat.h" //----------------------------------------------------------------------------- // wxCursorRefData @@ -109,8 +110,10 @@ wxCursor::wxCursor(const char bits[], int width, int height, if (hotSpotY < 0 || hotSpotY >= height) hotSpotY = 0; - GdkBitmap *data = gdk_bitmap_create_from_data( wxGetRootWindow()->window, (gchar *) bits, width, height ); - GdkBitmap *mask = gdk_bitmap_create_from_data( wxGetRootWindow()->window, (gchar *) maskBits, width, height); + GdkBitmap* data = gdk_bitmap_create_from_data( + gtk_widget_get_window(wxGetRootWindow()), const_cast(bits), width, height); + GdkBitmap* mask = gdk_bitmap_create_from_data( + gtk_widget_get_window(wxGetRootWindow()), const_cast(maskBits), width, height); m_refData = new wxCursorRefData; M_CURSORDATA->m_cursor = gdk_cursor_new_from_pixmap( @@ -221,7 +224,7 @@ void wxCursor::InitFromImage( const wxImage & image ) m_refData = new wxCursorRefData; wxImage image_copy(image); - GdkDisplay* display = gdk_drawable_get_display(wxGetRootWindow()->window); + GdkDisplay* display = gdk_drawable_get_display(gtk_widget_get_window(wxGetRootWindow())); if (gdk_display_supports_cursor_color(display)) { if (!image.HasAlpha()) @@ -257,7 +260,7 @@ void wxCursor::InitFromImage( const wxImage & image ) char* bits = new char[size]; memset(bits, 0xff, size); maskRaw = gdk_bitmap_create_from_data( - wxGetRootWindow()->window, bits, w, h); + gtk_widget_get_window(wxGetRootWindow()), bits, w, h); delete[] bits; } @@ -387,16 +390,15 @@ const wxCursor wxBusyCursor::GetBusyCursor() return wxCursor(wxCURSOR_WATCH); } -static void UpdateCursors(const wxWindowList& list, GdkDisplay*& display) +static void UpdateCursors(GdkDisplay** display) { - wxWindowList::const_iterator i = list.begin(); - for (size_t n = list.size(); n--; ++i) + wxWindowList::const_iterator i = wxTopLevelWindows.begin(); + for (size_t n = wxTopLevelWindows.size(); n--; ++i) { wxWindow* win = *i; - if (display == NULL && win->m_widget && win->m_widget->window) - display = gdk_drawable_get_display(win->m_widget->window); - win->GTKUpdateCursor(true, false); - UpdateCursors(win->GetChildren(), display); + win->GTKUpdateCursor(); + if (display && *display == NULL && win->m_widget) + *display = gtk_widget_get_display(win->m_widget); } } @@ -407,8 +409,7 @@ void wxEndBusyCursor() g_globalCursor = gs_savedCursor; gs_savedCursor = wxNullCursor; - GdkDisplay* unused = NULL; - UpdateCursors(wxTopLevelWindows, unused); + UpdateCursors(NULL); } void wxBeginBusyCursor(const wxCursor* cursor) @@ -416,13 +417,13 @@ void wxBeginBusyCursor(const wxCursor* cursor) if (gs_busyCount++ > 0) return; - wxASSERT_MSG( !gs_savedCursor.Ok(), + wxASSERT_MSG( !gs_savedCursor.IsOk(), wxT("forgot to call wxEndBusyCursor, will leak memory") ); gs_savedCursor = g_globalCursor; g_globalCursor = *cursor; GdkDisplay* display = NULL; - UpdateCursors(wxTopLevelWindows, display); + UpdateCursors(&display); if (display) gdk_display_flush(display); } @@ -435,6 +436,5 @@ bool wxIsBusy() void wxSetCursor( const wxCursor& cursor ) { g_globalCursor = cursor; - GdkDisplay* unused = NULL; - UpdateCursors(wxTopLevelWindows, unused); + UpdateCursors(NULL); } diff --git a/Externals/wxWidgets3/src/gtk/dataobj.cpp b/Externals/wxWidgets3/src/gtk/dataobj.cpp index 5637c53213..2003320cbc 100644 --- a/Externals/wxWidgets3/src/gtk/dataobj.cpp +++ b/Externals/wxWidgets3/src/gtk/dataobj.cpp @@ -2,7 +2,7 @@ // Name: src/gtk/dataobj.cpp // Purpose: wxDataObject class // Author: Robert Roebling -// Id: $Id: dataobj.cpp 54741 2008-07-21 03:35:15Z VZ $ +// Id: $Id: dataobj.cpp 67681 2011-05-03 16:29:04Z DS $ // Copyright: (c) 1998 Robert Roebling // Licence: wxWindows licence /////////////////////////////////////////////////////////////////////////////// @@ -384,12 +384,12 @@ bool wxBitmapDataObject::SetData(size_t size, const void *buf) m_bitmap = wxBitmap(image); - return m_bitmap.Ok(); + return m_bitmap.IsOk(); } void wxBitmapDataObject::DoConvertToPng() { - if ( !m_bitmap.Ok() ) + if ( !m_bitmap.IsOk() ) return; wxCHECK_RET( wxImage::FindHandler(wxBITMAP_TYPE_PNG) != NULL, diff --git a/Externals/wxWidgets3/src/gtk/dataview.cpp b/Externals/wxWidgets3/src/gtk/dataview.cpp index 8f63d624fc..138856c567 100644 --- a/Externals/wxWidgets3/src/gtk/dataview.cpp +++ b/Externals/wxWidgets3/src/gtk/dataview.cpp @@ -2,7 +2,7 @@ // Name: src/gtk/dataview.cpp // Purpose: wxDataViewCtrl GTK+2 implementation // Author: Robert Roebling -// Id: $Id: dataview.cpp 67120 2011-03-03 17:51:52Z PC $ +// Id: $Id: dataview.cpp 70457 2012-01-25 00:05:03Z VZ $ // Copyright: (c) 1998 Robert Roebling // Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// @@ -25,7 +25,6 @@ #endif #include "wx/stockitem.h" -#include "wx/calctrl.h" #include "wx/popupwin.h" #include "wx/listimpl.cpp" @@ -34,6 +33,8 @@ #include "wx/gtk/dcclient.h" #include "wx/gtk/private/gdkconv.h" +#include "wx/gtk/private/list.h" +#include "wx/gtk/private/event.h" using namespace wxGTKImpl; class wxGtkDataViewModelNotifier; @@ -98,6 +99,26 @@ private: wxDECLARE_NO_COPY_CLASS(wxGtkTreePath); }; +// ---------------------------------------------------------------------------- +// wxGtkTreePathList: self-destroying list of GtkTreePath objects. +// ---------------------------------------------------------------------------- + +class wxGtkTreePathList : public wxGtkList +{ +public: + // Ctor takes ownership of the list. + explicit wxGtkTreePathList(GList* list) + : wxGtkList(list) + { + } + + ~wxGtkTreePathList() + { + // Delete the list contents, wxGtkList will delete the list itself. + g_list_foreach(m_list, (GFunc)gtk_tree_path_free, NULL); + } +}; + // ---------------------------------------------------------------------------- // wxGtkTreeSelectionLock: prevent selection from changing during the // lifetime of this object @@ -258,7 +279,7 @@ public: // item can be deleted already in the model int GetIndexOf( const wxDataViewItem &parent, const wxDataViewItem &item ); - virtual void OnInternalIdle(); + void OnInternalIdle(); protected: void InitTree(); @@ -300,7 +321,7 @@ private: static int LINKAGEMODE wxGtkTreeModelChildCmp( void** id1, void** id2 ) { - int ret = gs_internal->GetDataViewModel()->Compare( *id1, *id2, + int ret = gs_internal->GetDataViewModel()->Compare( wxDataViewItem(*id1), wxDataViewItem(*id2), gs_internal->GetSortColumn(), (gs_internal->GetSortOrder() == GTK_SORT_ASCENDING) ); return ret; @@ -331,7 +352,7 @@ public: } } - unsigned int AddNode( wxGtkTreeModelNode* child ) + void AddNode( wxGtkTreeModelNode* child ) { m_nodes.Add( child ); @@ -343,24 +364,54 @@ public: { gs_internal = m_internal; m_children.Sort( &wxGtkTreeModelChildCmp ); - return m_children.Index( id ); } - - return m_children.GetCount()-1; } - unsigned int AddLeave( void* id ) + void InsertNode( wxGtkTreeModelNode* child, unsigned pos ) { - m_children.Add( id ); + if (m_internal->IsSorted() || m_internal->GetDataViewModel()->HasDefaultCompare()) + { + AddNode(child); + return; + } + + void *id = child->GetItem().GetID(); + + // Insert into m_nodes so that the order of nodes in m_nodes is the + // same as the order of their corresponding IDs in m_children: + const unsigned int count = m_nodes.GetCount(); + bool inserted = false; + for (unsigned i = 0; i < count; i++) + { + wxGtkTreeModelNode *node = m_nodes[i]; + int posInChildren = m_children.Index(node->GetItem().GetID()); + if ( (unsigned)posInChildren >= pos ) + { + m_nodes.Insert(child, i); + inserted = true; + break; + } + } + if ( !inserted ) + m_nodes.Add(child); + + m_children.Insert( id, pos ); + } + + void AddLeaf( void* id ) + { + InsertLeaf(id, m_children.size()); + } + + void InsertLeaf( void* id, unsigned pos ) + { + m_children.Insert( id, pos ); if (m_internal->IsSorted() || m_internal->GetDataViewModel()->HasDefaultCompare()) { gs_internal = m_internal; m_children.Sort( &wxGtkTreeModelChildCmp ); - return m_children.Index( id ); } - - return m_children.GetCount()-1; } void DeleteChild( void* id ) @@ -381,6 +432,20 @@ public: } } + // returns position of child node for given item in children list or wxNOT_FOUND + int FindChildByItem(const wxDataViewItem& item) const + { + const void* itemId = item.GetID(); + const wxGtkTreeModelChildren& nodes = m_children; + const int len = nodes.size(); + for ( int i = 0; i < len; i++ ) + { + if ( nodes[i] == itemId ) + return i; + } + return wxNOT_FOUND; + } + wxGtkTreeModelNode* GetParent() { return m_parent; } wxGtkTreeModelNodes &GetNodes() @@ -419,15 +484,11 @@ extern "C" { #define GTK_TYPE_WX_TREE_MODEL (gtk_wx_tree_model_get_type ()) #define GTK_WX_TREE_MODEL(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GTK_TYPE_WX_TREE_MODEL, GtkWxTreeModel)) -#define GTK_WX_TREE_MODEL_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GTK_TYPE_WX_TREE_MODEL, GtkWxTreeModelClass)) #define GTK_IS_WX_TREE_MODEL(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GTK_TYPE_WX_TREE_MODEL)) #define GTK_IS_WX_TREE_MODEL_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GTK_TYPE_WX_TREE_MODEL)) -#define GTK_WX_TREE_MODEL_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GTK_TYPE_WX_TREE_MODEL, GtkWxTreeModelClass)) GType gtk_wx_tree_model_get_type (void); -typedef struct _GtkWxTreeModelClass GtkWxTreeModelClass; - struct _GtkWxTreeModel { GObject parent; @@ -437,21 +498,14 @@ struct _GtkWxTreeModel wxDataViewCtrlInternal *internal; }; -struct _GtkWxTreeModelClass -{ - GObjectClass list_parent_class; -}; - static GtkWxTreeModel *wxgtk_tree_model_new (void); -static void wxgtk_tree_model_init (GtkWxTreeModel *tree_model); -static void wxgtk_tree_model_class_init (GtkWxTreeModelClass *klass); +static void wxgtk_tree_model_init (GTypeInstance* instance, void*); -static void wxgtk_tree_model_tree_model_init (GtkTreeModelIface *iface); -static void wxgtk_tree_model_sortable_init (GtkTreeSortableIface *iface); -static void wxgtk_tree_model_drag_source_init(GtkTreeDragSourceIface *iface); -static void wxgtk_tree_model_drag_dest_init (GtkTreeDragDestIface *iface); +static void wxgtk_tree_model_tree_model_init (void* g_iface, void*); +static void wxgtk_tree_model_sortable_init (void* g_iface, void*); +static void wxgtk_tree_model_drag_source_init(void* g_iface, void*); +static void wxgtk_tree_model_drag_dest_init (void* g_iface, void*); -static void wxgtk_tree_model_finalize (GObject *object); static GtkTreeModelFlags wxgtk_tree_model_get_flags (GtkTreeModel *tree_model); static gint wxgtk_tree_model_get_n_columns (GtkTreeModel *tree_model); static GType wxgtk_tree_model_get_column_type (GtkTreeModel *tree_model, @@ -493,11 +547,11 @@ static void wxgtk_tree_model_set_sort_func (GtkTreeSortable *s gint sort_column_id, GtkTreeIterCompareFunc func, gpointer data, - GtkDestroyNotify destroy); + GDestroyNotify destroy); static void wxgtk_tree_model_set_default_sort_func (GtkTreeSortable *sortable, GtkTreeIterCompareFunc func, gpointer data, - GtkDestroyNotify destroy); + GDestroyNotify destroy); static gboolean wxgtk_tree_model_has_default_sort_func (GtkTreeSortable *sortable); /* drag'n'drop */ @@ -515,9 +569,6 @@ static gboolean wxgtk_tree_model_row_drop_possible (GtkTreeDragDest *d GtkTreePath *dest_path, GtkSelectionData *selection_data); - -static GObjectClass *list_parent_class = NULL; - GType gtk_wx_tree_model_get_type (void) { @@ -527,41 +578,41 @@ gtk_wx_tree_model_get_type (void) { const GTypeInfo tree_model_info = { - sizeof (GtkWxTreeModelClass), + sizeof (GObjectClass), NULL, /* base_init */ NULL, /* base_finalize */ - (GClassInitFunc) wxgtk_tree_model_class_init, + NULL, NULL, /* class_finalize */ NULL, /* class_data */ sizeof (GtkWxTreeModel), 0, - (GInstanceInitFunc) wxgtk_tree_model_init, + wxgtk_tree_model_init, }; static const GInterfaceInfo tree_model_iface_info = { - (GInterfaceInitFunc) wxgtk_tree_model_tree_model_init, + wxgtk_tree_model_tree_model_init, NULL, NULL }; static const GInterfaceInfo sortable_iface_info = { - (GInterfaceInitFunc) wxgtk_tree_model_sortable_init, + wxgtk_tree_model_sortable_init, NULL, NULL }; static const GInterfaceInfo drag_source_iface_info = { - (GInterfaceInitFunc) wxgtk_tree_model_drag_source_init, + wxgtk_tree_model_drag_source_init, NULL, NULL }; static const GInterfaceInfo drag_dest_iface_info = { - (GInterfaceInitFunc) wxgtk_tree_model_drag_dest_init, + wxgtk_tree_model_drag_dest_init, NULL, NULL }; @@ -594,16 +645,9 @@ wxgtk_tree_model_new(void) } static void -wxgtk_tree_model_class_init (GtkWxTreeModelClass *klass) -{ - list_parent_class = (GObjectClass*) g_type_class_peek_parent (klass); - GObjectClass *object_class = (GObjectClass*) klass; - object_class->finalize = wxgtk_tree_model_finalize; -} - -static void -wxgtk_tree_model_tree_model_init (GtkTreeModelIface *iface) +wxgtk_tree_model_tree_model_init(void* g_iface, void*) { + GtkTreeModelIface* iface = static_cast(g_iface); iface->get_flags = wxgtk_tree_model_get_flags; iface->get_n_columns = wxgtk_tree_model_get_n_columns; iface->get_column_type = wxgtk_tree_model_get_column_type; @@ -619,8 +663,9 @@ wxgtk_tree_model_tree_model_init (GtkTreeModelIface *iface) } static void -wxgtk_tree_model_sortable_init (GtkTreeSortableIface *iface) +wxgtk_tree_model_sortable_init(void* g_iface, void*) { + GtkTreeSortableIface* iface = static_cast(g_iface); iface->get_sort_column_id = wxgtk_tree_model_get_sort_column_id; iface->set_sort_column_id = wxgtk_tree_model_set_sort_column_id; iface->set_sort_func = wxgtk_tree_model_set_sort_func; @@ -629,34 +674,30 @@ wxgtk_tree_model_sortable_init (GtkTreeSortableIface *iface) } static void -wxgtk_tree_model_drag_source_init(GtkTreeDragSourceIface *iface) +wxgtk_tree_model_drag_source_init(void* g_iface, void*) { + GtkTreeDragSourceIface* iface = static_cast(g_iface); iface->row_draggable = wxgtk_tree_model_row_draggable; iface->drag_data_delete = wxgtk_tree_model_drag_data_delete; iface->drag_data_get = wxgtk_tree_model_drag_data_get; } static void -wxgtk_tree_model_drag_dest_init (GtkTreeDragDestIface *iface) +wxgtk_tree_model_drag_dest_init(void* g_iface, void*) { + GtkTreeDragDestIface* iface = static_cast(g_iface); iface->drag_data_received = wxgtk_tree_model_drag_data_received; iface->row_drop_possible = wxgtk_tree_model_row_drop_possible; } static void -wxgtk_tree_model_init (GtkWxTreeModel *tree_model) +wxgtk_tree_model_init(GTypeInstance* instance, void*) { + GtkWxTreeModel* tree_model = GTK_WX_TREE_MODEL(instance); tree_model->internal = NULL; tree_model->stamp = g_random_int(); } -static void -wxgtk_tree_model_finalize (GObject *object) -{ - /* must chain up */ - (* list_parent_class->finalize) (object); -} - } // extern "C" //----------------------------------------------------------------------------- @@ -966,7 +1007,7 @@ wxgtk_tree_model_set_sort_func (GtkTreeSortable *sortable, gint WXUNUSED(sort_column_id), GtkTreeIterCompareFunc func, gpointer WXUNUSED(data), - GtkDestroyNotify WXUNUSED(destroy)) + GDestroyNotify WXUNUSED(destroy)) { g_return_if_fail (GTK_IS_WX_TREE_MODEL (sortable) ); g_return_if_fail (func != NULL); @@ -976,7 +1017,7 @@ static void wxgtk_tree_model_set_default_sort_func (GtkTreeSortable *sortable, GtkTreeIterCompareFunc func, gpointer WXUNUSED(data), - GtkDestroyNotify WXUNUSED(destroy)) + GDestroyNotify WXUNUSED(destroy)) { g_return_if_fail (GTK_IS_WX_TREE_MODEL (sortable) ); g_return_if_fail (func != NULL); @@ -1001,15 +1042,12 @@ extern "C" { #define GTK_TYPE_WX_CELL_RENDERER_TEXT (gtk_wx_cell_renderer_text_get_type ()) #define GTK_WX_CELL_RENDERER_TEXT(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GTK_TYPE_WX_CELL_RENDERER_TEXT, GtkWxCellRendererText)) -#define GTK_WX_CELL_RENDERER_TEXT_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GTK_TYPE_WX_CELL_RENDERER_TEXT, GtkWxCellRendererTextClass)) #define GTK_IS_WX_CELL_RENDERER_TEXT(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GTK_TYPE_WX_CELL_RENDERER_TEXT)) #define GTK_IS_WX_CELL_RENDERER_TEXT_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GTK_TYPE_WX_CELL_RENDERER_TEXT)) -#define GTK_WX_CELL_RENDERER_TEXT_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GTK_TYPE_WX_CELL_RENDERER_TEXT, GtkWxCellRendererTextClass)) GType gtk_wx_cell_renderer_text_get_type (void); typedef struct _GtkWxCellRendererText GtkWxCellRendererText; -typedef struct _GtkWxCellRendererTextClass GtkWxCellRendererTextClass; struct _GtkWxCellRendererText { @@ -1018,19 +1056,11 @@ struct _GtkWxCellRendererText wxDataViewRenderer *wx_renderer; }; -struct _GtkWxCellRendererTextClass -{ - GtkCellRendererTextClass cell_parent_class; -}; - - static GtkWxCellRendererText *gtk_wx_cell_renderer_text_new (void); static void gtk_wx_cell_renderer_text_init ( - GtkWxCellRendererText *cell ); + GTypeInstance* instance, void*); static void gtk_wx_cell_renderer_text_class_init( - GtkWxCellRendererTextClass *klass ); -static void gtk_wx_cell_renderer_text_finalize ( - GObject *object ); + void* klass, void*); static GtkCellEditable *gtk_wx_cell_renderer_text_start_editing( GtkCellRenderer *cell, GdkEvent *event, @@ -1054,15 +1084,15 @@ gtk_wx_cell_renderer_text_get_type (void) { const GTypeInfo cell_wx_info = { - sizeof (GtkWxCellRendererTextClass), + sizeof (GtkCellRendererTextClass), NULL, /* base_init */ NULL, /* base_finalize */ - (GClassInitFunc) gtk_wx_cell_renderer_text_class_init, + gtk_wx_cell_renderer_text_class_init, NULL, /* class_finalize */ NULL, /* class_data */ sizeof (GtkWxCellRendererText), 0, /* n_preallocs */ - (GInstanceInitFunc) gtk_wx_cell_renderer_text_init, + gtk_wx_cell_renderer_text_init, }; cell_wx_type = g_type_register_static( GTK_TYPE_CELL_RENDERER_TEXT, @@ -1073,31 +1103,22 @@ gtk_wx_cell_renderer_text_get_type (void) } static void -gtk_wx_cell_renderer_text_init (GtkWxCellRendererText *cell) +gtk_wx_cell_renderer_text_init(GTypeInstance* instance, void*) { + GtkWxCellRendererText* cell = GTK_WX_CELL_RENDERER_TEXT(instance); cell->wx_renderer = NULL; } static void -gtk_wx_cell_renderer_text_class_init (GtkWxCellRendererTextClass *klass) +gtk_wx_cell_renderer_text_class_init(void* klass, void*) { - GObjectClass *object_class = G_OBJECT_CLASS (klass); GtkCellRendererClass *cell_class = GTK_CELL_RENDERER_CLASS (klass); text_cell_parent_class = (GObjectClass*) g_type_class_peek_parent (klass); - object_class->finalize = gtk_wx_cell_renderer_text_finalize; - cell_class->start_editing = gtk_wx_cell_renderer_text_start_editing; } -static void -gtk_wx_cell_renderer_text_finalize (GObject *object) -{ - /* must chain up */ - (* G_OBJECT_CLASS (text_cell_parent_class)->finalize) (object); -} - GtkWxCellRendererText* gtk_wx_cell_renderer_text_new (void) { @@ -1143,15 +1164,12 @@ extern "C" { #define GTK_TYPE_WX_CELL_RENDERER (gtk_wx_cell_renderer_get_type ()) #define GTK_WX_CELL_RENDERER(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GTK_TYPE_WX_CELL_RENDERER, GtkWxCellRenderer)) -#define GTK_WX_CELL_RENDERER_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GTK_TYPE_WX_CELL_RENDERER, GtkWxCellRendererClass)) #define GTK_IS_WX_CELL_RENDERER(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GTK_TYPE_WX_CELL_RENDERER)) #define GTK_IS_WX_CELL_RENDERER_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GTK_TYPE_WX_CELL_RENDERER)) -#define GTK_WX_CELL_RENDERER_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GTK_TYPE_WX_CELL_RENDERER, GtkWxCellRendererClass)) GType gtk_wx_cell_renderer_get_type (void); typedef struct _GtkWxCellRenderer GtkWxCellRenderer; -typedef struct _GtkWxCellRendererClass GtkWxCellRendererClass; struct _GtkWxCellRenderer { @@ -1159,22 +1177,13 @@ struct _GtkWxCellRenderer /*< private >*/ wxDataViewCustomRenderer *cell; - guint32 last_click; }; -struct _GtkWxCellRendererClass -{ - GtkCellRendererClass cell_parent_class; -}; - - static GtkCellRenderer *gtk_wx_cell_renderer_new (void); static void gtk_wx_cell_renderer_init ( - GtkWxCellRenderer *cell ); + GTypeInstance* instance, void*); static void gtk_wx_cell_renderer_class_init( - GtkWxCellRendererClass *klass ); -static void gtk_wx_cell_renderer_finalize ( - GObject *object ); + void* klass, void*); static void gtk_wx_cell_renderer_get_size ( GtkCellRenderer *cell, GtkWidget *widget, @@ -1208,9 +1217,6 @@ static GtkCellEditable *gtk_wx_cell_renderer_start_editing( GdkRectangle *cell_area, GtkCellRendererState flags ); - -static GObjectClass *cell_parent_class = NULL; - } // extern "C" GType @@ -1222,15 +1228,15 @@ gtk_wx_cell_renderer_get_type (void) { const GTypeInfo cell_wx_info = { - sizeof (GtkWxCellRendererClass), + sizeof (GtkCellRendererClass), NULL, /* base_init */ NULL, /* base_finalize */ - (GClassInitFunc) gtk_wx_cell_renderer_class_init, + gtk_wx_cell_renderer_class_init, NULL, /* class_finalize */ NULL, /* class_data */ sizeof (GtkWxCellRenderer), 0, /* n_preallocs */ - (GInstanceInitFunc) gtk_wx_cell_renderer_init, + gtk_wx_cell_renderer_init, }; cell_wx_type = g_type_register_static( GTK_TYPE_CELL_RENDERER, @@ -1241,35 +1247,23 @@ gtk_wx_cell_renderer_get_type (void) } static void -gtk_wx_cell_renderer_init (GtkWxCellRenderer *cell) +gtk_wx_cell_renderer_init(GTypeInstance* instance, void*) { + GtkWxCellRenderer* cell = GTK_WX_CELL_RENDERER(instance); cell->cell = NULL; - cell->last_click = 0; } static void -gtk_wx_cell_renderer_class_init (GtkWxCellRendererClass *klass) +gtk_wx_cell_renderer_class_init(void* klass, void*) { - GObjectClass *object_class = G_OBJECT_CLASS (klass); GtkCellRendererClass *cell_class = GTK_CELL_RENDERER_CLASS (klass); - cell_parent_class = (GObjectClass*) g_type_class_peek_parent (klass); - - object_class->finalize = gtk_wx_cell_renderer_finalize; - cell_class->get_size = gtk_wx_cell_renderer_get_size; cell_class->render = gtk_wx_cell_renderer_render; cell_class->activate = gtk_wx_cell_renderer_activate; cell_class->start_editing = gtk_wx_cell_renderer_start_editing; } -static void -gtk_wx_cell_renderer_finalize (GObject *object) -{ - /* must chain up */ - (* G_OBJECT_CLASS (cell_parent_class)->finalize) (object); -} - GtkCellRenderer* gtk_wx_cell_renderer_new (void) { @@ -1333,8 +1327,21 @@ gtk_wx_cell_renderer_get_size (GtkCellRenderer *renderer, wxSize size = cell->GetSize(); - gint calc_width = (gint) renderer->xpad * 2 + size.x; - gint calc_height = (gint) renderer->ypad * 2 + size.y; + wxDataViewCtrl * const ctrl = cell->GetOwner()->GetOwner(); + + // Uniform row height, if specified, overrides the value returned by the + // renderer. + if ( !ctrl->HasFlag(wxDV_VARIABLE_LINE_HEIGHT) ) + { + const int uniformHeight = ctrl->GTKGetUniformRowHeight(); + if ( uniformHeight > 0 ) + size.y = uniformHeight; + } + + int xpad, ypad; + gtk_cell_renderer_get_padding(renderer, &xpad, &ypad); + int calc_width = xpad * 2 + size.x; + int calc_height = ypad * 2 + size.y; if (x_offset) *x_offset = 0; @@ -1343,17 +1350,17 @@ gtk_wx_cell_renderer_get_size (GtkCellRenderer *renderer, if (cell_area && size.x > 0 && size.y > 0) { + float xalign, yalign; + gtk_cell_renderer_get_alignment(renderer, &xalign, &yalign); if (x_offset) { - *x_offset = (gint)((renderer->xalign * - (cell_area->width - calc_width - 2 * renderer->xpad))); - *x_offset = MAX (*x_offset, 0) + renderer->xpad; + *x_offset = int(xalign * (cell_area->width - calc_width - 2 * xpad)); + *x_offset = MAX(*x_offset, 0) + xpad; } if (y_offset) { - *y_offset = (gint)((renderer->yalign * - (cell_area->height - calc_height - 2 * renderer->ypad))); - *y_offset = MAX (*y_offset, 0) + renderer->ypad; + *y_offset = int(yalign * (cell_area->height - calc_height - 2 * ypad)); + *y_offset = MAX(*y_offset, 0) + ypad; } } @@ -1364,6 +1371,15 @@ gtk_wx_cell_renderer_get_size (GtkCellRenderer *renderer, *height = calc_height; } +struct wxDataViewCustomRenderer::GTKRenderParams +{ + GdkWindow* window; + GdkRectangle* expose_area; + GtkWidget* widget; + GdkRectangle* background_area; + int flags; +}; + static void gtk_wx_cell_renderer_render (GtkCellRenderer *renderer, GdkWindow *window, @@ -1377,11 +1393,18 @@ gtk_wx_cell_renderer_render (GtkCellRenderer *renderer, GtkWxCellRenderer *wxrenderer = (GtkWxCellRenderer *) renderer; wxDataViewCustomRenderer *cell = wxrenderer->cell; - cell->GTKStashRenderParams(window, widget, - background_area, expose_area, flags); + wxDataViewCustomRenderer::GTKRenderParams renderParams; + renderParams.window = window; + renderParams.expose_area = expose_area; + renderParams.widget = widget; + renderParams.background_area = background_area; + renderParams.flags = flags; + cell->GTKSetRenderParams(&renderParams); wxRect rect(wxRectFromGDKRect(cell_area)); - rect = rect.Deflate(renderer->xpad, renderer->ypad); + int xpad, ypad; + gtk_cell_renderer_get_padding(renderer, &xpad, &ypad); + rect = rect.Deflate(xpad, ypad); wxWindowDC* dc = (wxWindowDC*) cell->GetDC(); wxWindowDCImpl *impl = (wxWindowDCImpl *) dc->GetImpl(); @@ -1407,6 +1430,8 @@ gtk_wx_cell_renderer_render (GtkCellRenderer *renderer, if (flags & GTK_CELL_RENDERER_FOCUSED) state |= wxDATAVIEW_CELL_FOCUSED; cell->WXCallRender( rect, dc, state ); + + cell->GTKSetRenderParams(NULL); } static gboolean @@ -1431,8 +1456,10 @@ gtk_wx_cell_renderer_activate( rect.x += cell_area->x; rect.y += cell_area->y; - rect.width -= renderer->xpad * 2; - rect.height -= renderer->ypad * 2; + int xpad, ypad; + gtk_cell_renderer_get_padding(renderer, &xpad, &ypad); + rect.width -= xpad * 2; + rect.height -= ypad * 2; wxRect renderrect(wxRectFromGDKRect(&rect)); @@ -1443,37 +1470,27 @@ gtk_wx_cell_renderer_activate( unsigned int model_col = cell->GetOwner()->GetModelColumn(); - if (!event) + if ( !event ) { - bool ret = false; - // activated by - if (cell->Activate( renderrect, model, item, model_col )) - ret = true; - - return ret; + return cell->ActivateCell(renderrect, model, item, model_col, NULL); } - else if (event->type == GDK_BUTTON_PRESS) + else if ( event->type == GDK_BUTTON_PRESS ) { - GdkEventButton *button_event = (GdkEventButton*) event; - wxPoint pt( ((int) button_event->x) - renderrect.x, - ((int) button_event->y) - renderrect.y ); - - bool ret = false; - if (button_event->button == 1) + GdkEventButton *button_event = (GdkEventButton*)event; + if ( button_event->button == 1 ) { - if (cell->LeftClick( pt, renderrect, model, item, model_col )) - ret = true; - // TODO: query system double-click time - if (button_event->time - wxrenderer->last_click < 400) - if (cell->Activate( renderrect, model, item, model_col )) - ret = true; - } - wxrenderer->last_click = button_event->time; + wxMouseEvent mouse_event(wxEVT_LEFT_DOWN); + InitMouseEvent(ctrl, mouse_event, button_event); - return ret; + mouse_event.m_x -= renderrect.x; + mouse_event.m_y -= renderrect.y; + + return cell->ActivateCell(renderrect, model, item, model_col, &mouse_event); + } } + wxLogDebug("unexpected event type in gtk_wx_cell_renderer_activate()"); return false; } @@ -1550,12 +1567,14 @@ bool wxGtkDataViewModelNotifier::ItemDeleted( const wxDataViewItem &parent, cons GTK_TREE_MODEL(wxgtk_model), &iter )); #else // so get the path from the parent - GtkTreeIter iter; - iter.stamp = wxgtk_model->stamp; - iter.user_data = (gpointer) parent.GetID(); - wxGtkTreePath path(wxgtk_tree_model_get_path( - GTK_TREE_MODEL(wxgtk_model), &iter )); + GtkTreeIter parentIter; + parentIter.stamp = wxgtk_model->stamp; + parentIter.user_data = (gpointer) parent.GetID(); + wxGtkTreePath parentPath(wxgtk_tree_model_get_path( + GTK_TREE_MODEL(wxgtk_model), &parentIter )); + // and add the final index ourselves + wxGtkTreePath path(gtk_tree_path_copy(parentPath)); int index = m_internal->GetIndexOf( parent, item ); gtk_tree_path_append_index( path, index ); #endif @@ -1565,6 +1584,17 @@ bool wxGtkDataViewModelNotifier::ItemDeleted( const wxDataViewItem &parent, cons m_internal->ItemDeleted( parent, item ); + // Did we remove the last child, causing 'parent' to become a leaf? + if ( !m_wx_model->IsContainer(parent) ) + { + gtk_tree_model_row_has_child_toggled + ( + GTK_TREE_MODEL(wxgtk_model), + parentPath, + &parentIter + ); + } + return true; } @@ -1606,23 +1636,28 @@ bool wxGtkDataViewModelNotifier::ValueChanged( const wxDataViewItem &item, unsig GtkTreeView *widget = GTK_TREE_VIEW(ctrl->GtkGetTreeView()); GtkTreeViewColumn *gcolumn = GTK_TREE_VIEW_COLUMN(column->GetGtkHandle()); - // Get cell area - GtkTreeIter iter; - iter.stamp = wxgtk_model->stamp; - iter.user_data = (gpointer) item.GetID(); - wxGtkTreePath path(wxgtk_tree_model_get_path( - GTK_TREE_MODEL(wxgtk_model), &iter )); - GdkRectangle cell_area; - gtk_tree_view_get_cell_area( widget, path, gcolumn, &cell_area ); + // Don't attempt to refresh not yet realized tree, it is useless + // and results in GTK errors. + if ( gtk_widget_get_realized(ctrl->GtkGetTreeView()) ) + { + // Get cell area + GtkTreeIter iter; + iter.stamp = wxgtk_model->stamp; + iter.user_data = (gpointer) item.GetID(); + wxGtkTreePath path(wxgtk_tree_model_get_path( + GTK_TREE_MODEL(wxgtk_model), &iter )); + GdkRectangle cell_area; + gtk_tree_view_get_cell_area( widget, path, gcolumn, &cell_area ); - GtkAdjustment* hadjust = gtk_tree_view_get_hadjustment( widget ); - double d = gtk_adjustment_get_value( hadjust ); - int xdiff = (int) d; + GtkAdjustment* hadjust = gtk_tree_view_get_hadjustment( widget ); + double d = gtk_adjustment_get_value( hadjust ); + int xdiff = (int) d; - int ydiff = gcolumn->button->allocation.height; - // Redraw - gtk_widget_queue_draw_area( GTK_WIDGET(widget), - cell_area.x - xdiff, ydiff + cell_area.y, cell_area.width, cell_area.height ); + int ydiff = gcolumn->button->allocation.height; + // Redraw + gtk_widget_queue_draw_area( GTK_WIDGET(widget), + cell_area.x - xdiff, ydiff + cell_area.y, cell_area.width, cell_area.height ); + } m_internal->ValueChanged( item, model_column ); @@ -1818,7 +1853,7 @@ wxDataViewCellMode wxDataViewRenderer::GetMode() const return ret; } -void wxDataViewRenderer::GtkUpdateAlignment() +void wxDataViewRenderer::GtkApplyAlignment(GtkCellRenderer *renderer) { int align = m_alignment; @@ -1844,7 +1879,7 @@ void wxDataViewRenderer::GtkUpdateAlignment() GValue gvalue = { 0, }; g_value_init( &gvalue, G_TYPE_FLOAT ); g_value_set_float( &gvalue, xalign ); - g_object_set_property( G_OBJECT(m_renderer), "xalign", &gvalue ); + g_object_set_property( G_OBJECT(renderer), "xalign", &gvalue ); g_value_unset( &gvalue ); // vertical alignment: @@ -1858,7 +1893,7 @@ void wxDataViewRenderer::GtkUpdateAlignment() GValue gvalue2 = { 0, }; g_value_init( &gvalue2, G_TYPE_FLOAT ); g_value_set_float( &gvalue2, yalign ); - g_object_set_property( G_OBJECT(m_renderer), "yalign", &gvalue2 ); + g_object_set_property( G_OBJECT(renderer), "yalign", &gvalue2 ); g_value_unset( &gvalue2 ); } @@ -1919,7 +1954,7 @@ wxEllipsizeMode wxDataViewRenderer::GetEllipsizeMode() const } void -wxDataViewRenderer::GtkOnTextEdited(const gchar *itempath, const wxString& str) +wxDataViewRenderer::GtkOnTextEdited(const char *itempath, const wxString& str) { wxVariant value(str); if (!Validate( value )) @@ -2303,7 +2338,7 @@ public: m_context = window->GTKGetPangoDefaultContext(); m_layout = pango_layout_new( m_context ); - m_fontdesc = pango_font_description_copy( widget->style->font_desc ); + m_fontdesc = pango_font_description_copy(gtk_widget_get_style(widget)->font_desc); m_cmap = gtk_widget_get_colormap( widget ? widget : window->m_widget ); @@ -2335,6 +2370,7 @@ wxDataViewCustomRenderer::wxDataViewCustomRenderer( const wxString &varianttype, { m_dc = NULL; m_text_renderer = NULL; + m_renderParams = NULL; if (no_init) m_renderer = NULL; @@ -2342,13 +2378,20 @@ wxDataViewCustomRenderer::wxDataViewCustomRenderer( const wxString &varianttype, Init(mode, align); } +void wxDataViewCustomRenderer::GtkInitTextRenderer() +{ + m_text_renderer = GTK_CELL_RENDERER_TEXT(gtk_cell_renderer_text_new()); + g_object_ref_sink(m_text_renderer); + + GtkApplyAlignment(GTK_CELL_RENDERER(m_text_renderer)); +} + GtkCellRendererText *wxDataViewCustomRenderer::GtkGetTextRenderer() const { if ( !m_text_renderer ) { // we create it on demand so need to do it even from a const function - const_cast(this)-> - m_text_renderer = GTK_CELL_RENDERER_TEXT(gtk_cell_renderer_text_new()); + const_cast(this)->GtkInitTextRenderer(); } return m_text_renderer; @@ -2377,12 +2420,12 @@ void wxDataViewCustomRenderer::RenderText( const wxString &text, cell_area.width -= xoffset; gtk_cell_renderer_render( GTK_CELL_RENDERER(textRenderer), - m_renderParams.window, - m_renderParams.widget, - m_renderParams.background_area, + m_renderParams->window, + m_renderParams->widget, + m_renderParams->background_area, &cell_area, - m_renderParams.expose_area, - (GtkCellRendererState) m_renderParams.flags ); + m_renderParams->expose_area, + GtkCellRendererState(m_renderParams->flags)); } bool wxDataViewCustomRenderer::Init(wxDataViewCellMode mode, int align) @@ -2406,7 +2449,7 @@ wxDataViewCustomRenderer::~wxDataViewCustomRenderer() delete m_dc; if (m_text_renderer) - gtk_object_sink( GTK_OBJECT(m_text_renderer) ); + g_object_unref(m_text_renderer); } wxDC *wxDataViewCustomRenderer::GetDC() @@ -2441,15 +2484,20 @@ wxDataViewProgressRenderer::wxDataViewProgressRenderer( const wxString &label, { m_renderer = (GtkCellRenderer*) gtk_cell_renderer_progress_new(); - GValue gvalue = { 0, }; - g_value_init( &gvalue, G_TYPE_STRING ); - - g_value_set_string( &gvalue, wxGTK_CONV_FONT( m_label, GetOwner()->GetOwner()->GetFont() ) ); - g_object_set_property( G_OBJECT(m_renderer), "text", &gvalue ); - g_value_unset( &gvalue ); - SetMode(mode); SetAlignment(align); + +#if !wxUSE_UNICODE + // We can't initialize the renderer just yet because we don't have the + // pointer to the column that uses this renderer yet and so attempt to + // dereference GetOwner() to get the font that is used as a source of + // encoding in multibyte-to-Unicode conversion in GTKSetLabel() in + // non-Unicode builds would crash. So simply remember to do it later. + if ( !m_label.empty() ) + m_needsToSetLabel = true; + else +#endif // !wxUSE_UNICODE + GTKSetLabel(); } else #endif @@ -2463,11 +2511,38 @@ wxDataViewProgressRenderer::~wxDataViewProgressRenderer() { } +void wxDataViewProgressRenderer::GTKSetLabel() +{ + GValue gvalue = { 0, }; + g_value_init( &gvalue, G_TYPE_STRING ); + + // Take care to not use GetOwner() here if the label is empty, we can be + // called from ctor when GetOwner() is still NULL in this case. + wxScopedCharBuffer buf; + if ( m_label.empty() ) + buf = wxScopedCharBuffer::CreateNonOwned(""); + else + buf = wxGTK_CONV_FONT(m_label, GetOwner()->GetOwner()->GetFont()); + + g_value_set_string( &gvalue, buf); + g_object_set_property( G_OBJECT(m_renderer), "text", &gvalue ); + g_value_unset( &gvalue ); + +#if !wxUSE_UNICODE + m_needsToSetLabel = false; +#endif // !wxUSE_UNICODE +} + bool wxDataViewProgressRenderer::SetValue( const wxVariant &value ) { #ifdef __WXGTK26__ if (!gtk_check_version(2,6,0)) { +#if !wxUSE_UNICODE + if ( m_needsToSetLabel ) + GTKSetLabel(); +#endif // !wxUSE_UNICODE + gint tmp = (long) value; GValue gvalue = { 0, }; g_value_init( &gvalue, G_TYPE_INT ); @@ -2645,7 +2720,7 @@ wxDataViewChoiceByIndexRenderer::wxDataViewChoiceByIndexRenderer( const wxArrayS { } -void wxDataViewChoiceByIndexRenderer::GtkOnTextEdited(const gchar *itempath, const wxString& str) +void wxDataViewChoiceByIndexRenderer::GtkOnTextEdited(const char *itempath, const wxString& str) { wxVariant value( (long) GetChoices().Index( str ) ); @@ -2674,108 +2749,6 @@ bool wxDataViewChoiceByIndexRenderer::GetValue( wxVariant &value ) const return true; } -// --------------------------------------------------------- -// wxDataViewDateRenderer -// --------------------------------------------------------- - -class wxDataViewDateRendererPopupTransient: public wxPopupTransientWindow -{ -public: - wxDataViewDateRendererPopupTransient( wxWindow* parent, wxDateTime *value, - wxDataViewModel *model, const wxDataViewItem &item, unsigned int col ) : - wxPopupTransientWindow( parent, wxBORDER_SIMPLE ) - { - m_model = model; - m_item = item; - m_col = col; - m_cal = new wxCalendarCtrl( this, -1, *value ); - wxBoxSizer *sizer = new wxBoxSizer( wxHORIZONTAL ); - sizer->Add( m_cal, 1, wxGROW ); - SetSizer( sizer ); - sizer->Fit( this ); - } - - virtual void OnDismiss() - { - } - - void OnCalendar( wxCalendarEvent &event ); - - wxCalendarCtrl *m_cal; - wxDataViewModel *m_model; - wxDataViewItem m_item; - unsigned int m_col; - -private: - DECLARE_EVENT_TABLE() -}; - -BEGIN_EVENT_TABLE(wxDataViewDateRendererPopupTransient,wxPopupTransientWindow) - EVT_CALENDAR( -1, wxDataViewDateRendererPopupTransient::OnCalendar ) -END_EVENT_TABLE() - -void wxDataViewDateRendererPopupTransient::OnCalendar( wxCalendarEvent &event ) -{ - m_model->ChangeValue( event.GetDate(), m_item, m_col ); - DismissAndNotify(); -} - -IMPLEMENT_CLASS(wxDataViewDateRenderer, wxDataViewCustomRenderer) - -wxDataViewDateRenderer::wxDataViewDateRenderer( const wxString &varianttype, - wxDataViewCellMode mode, int align ) : - wxDataViewCustomRenderer( varianttype, mode, align ) -{ - SetMode(mode); - SetAlignment(align); -} - -bool wxDataViewDateRenderer::SetValue( const wxVariant &value ) -{ - m_date = value.GetDateTime(); - - return true; -} - -bool wxDataViewDateRenderer::GetValue( wxVariant &WXUNUSED(value) ) const -{ - return false; -} - -bool wxDataViewDateRenderer::Render( wxRect cell, wxDC *dc, int state ) -{ - dc->SetFont( GetOwner()->GetOwner()->GetFont() ); - wxString tmp = m_date.FormatDate(); - RenderText( tmp, 0, cell, dc, state ); - return true; -} - -wxSize wxDataViewDateRenderer::GetSize() const -{ - wxString tmp = m_date.FormatDate(); - wxCoord x,y,d; - GetView()->GetTextExtent( tmp, &x, &y, &d ); - return wxSize(x,y+d); -} - -bool wxDataViewDateRenderer::Activate( const wxRect& WXUNUSED(cell), wxDataViewModel *model, - const wxDataViewItem &item, unsigned int col ) -{ - wxVariant variant; - model->GetValue( variant, item, col ); - wxDateTime value = variant.GetDateTime(); - - wxDataViewDateRendererPopupTransient *popup = new wxDataViewDateRendererPopupTransient( - GetOwner()->GetOwner()->GetParent(), &value, model, item, col ); - wxPoint pos = wxGetMousePosition(); - popup->Move( pos ); - popup->Layout(); - popup->Popup( popup->m_cal ); - - return true; -} - - // --------------------------------------------------------- // wxDataViewIconTextRenderer // --------------------------------------------------------- @@ -3028,7 +3001,7 @@ void wxDataViewColumn::OnInternalIdle() if (m_isConnected) return; - if (GTK_WIDGET_REALIZED(GetOwner()->m_treeview)) + if (gtk_widget_get_realized(GetOwner()->m_treeview)) { GtkTreeViewColumn *column = GTK_TREE_VIEW_COLUMN(m_column); if (column->button) @@ -3076,7 +3049,7 @@ void wxDataViewColumn::SetBitmap( const wxBitmap &bitmap ) { wxDataViewColumnBase::SetBitmap( bitmap ); - if (bitmap.Ok()) + if (bitmap.IsOk()) { GtkImage *gtk_image = GTK_IMAGE(m_image); @@ -3107,9 +3080,9 @@ void wxDataViewColumn::SetHidden( bool hidden ) gtk_tree_view_column_set_visible( GTK_TREE_VIEW_COLUMN(m_column), !hidden ); } -void wxDataViewColumn::SetResizeable( bool resizeable ) +void wxDataViewColumn::SetResizeable( bool resizable ) { - gtk_tree_view_column_set_resizable( GTK_TREE_VIEW_COLUMN(m_column), resizeable ); + gtk_tree_view_column_set_resizable( GTK_TREE_VIEW_COLUMN(m_column), resizable ); } void wxDataViewColumn::SetAlignment( wxAlignment align ) @@ -3163,14 +3136,6 @@ bool wxDataViewColumn::IsSortable() const return gtk_tree_view_column_get_clickable( column ); } -void wxDataViewColumn::SetAsSortKey( bool WXUNUSED(sort) ) -{ - // it might not make sense to have this function in wxHeaderColumn at - // all in fact, changing of the sort order should only be done using the - // associated control API - wxFAIL_MSG( "not implemented" ); -} - bool wxDataViewColumn::IsSortKey() const { GtkTreeViewColumn *column = GTK_TREE_VIEW_COLUMN(m_column); @@ -3280,7 +3245,7 @@ int wxGtkTreeModelChildWithPosCmp( const void* data1, const void* data2, const v static int LINKAGEMODE wxGtkTreeModelChildPtrCmp( void*** data1, void*** data2 ) { - return gs_internal->GetDataViewModel()->Compare( **data1, **data2, + return gs_internal->GetDataViewModel()->Compare( wxDataViewItem(**data1), wxDataViewItem(**data2), gs_internal->GetSortColumn(), (gs_internal->GetSortOrder() == GTK_SORT_ASCENDING) ); } @@ -3481,7 +3446,7 @@ void wxDataViewCtrlInternal::BuildBranch( wxGtkTreeModelNode *node ) if (m_wx_model->IsContainer( child )) node->AddNode( new wxGtkTreeModelNode( node, child, this ) ); else - node->AddLeave( child.GetID() ); + node->AddLeaf( child.GetID() ); // Don't send any events here } @@ -3524,6 +3489,7 @@ gboolean wxDataViewCtrlInternal::row_draggable( GtkTreeDragSource *WXUNUSED(drag GtkTreePath *path ) { delete m_dragDataObject; + m_dragDataObject = NULL; wxDataViewItem item(GetOwner()->GTKPathToItem(path)); if ( !item ) @@ -3565,21 +3531,22 @@ gboolean wxDataViewCtrlInternal::drag_data_get( GtkTreeDragSource *WXUNUSED(drag if ( !item ) return FALSE; - if (!m_dragDataObject->IsSupported( selection_data->target )) + GdkAtom target = gtk_selection_data_get_target(selection_data); + if (!m_dragDataObject->IsSupported(target)) return FALSE; - size_t size = m_dragDataObject->GetDataSize( selection_data->target ); + size_t size = m_dragDataObject->GetDataSize(target); if (size == 0) return FALSE; void *buf = malloc( size ); gboolean res = FALSE; - if (m_dragDataObject->GetDataHere( selection_data->target, buf )) + if (m_dragDataObject->GetDataHere(target, buf)) { res = TRUE; - gtk_selection_data_set( selection_data, selection_data->target, + gtk_selection_data_set(selection_data, target, 8, (const guchar*) buf, size ); } @@ -3601,9 +3568,9 @@ wxDataViewCtrlInternal::drag_data_received(GtkTreeDragDest *WXUNUSED(drag_dest), event.SetEventObject( m_owner ); event.SetItem( item ); event.SetModel( m_wx_model ); - event.SetDataFormat( selection_data->target ); - event.SetDataSize( selection_data->length ); - event.SetDataBuffer( selection_data->data ); + event.SetDataFormat(gtk_selection_data_get_target(selection_data)); + event.SetDataSize(gtk_selection_data_get_length(selection_data)); + event.SetDataBuffer(const_cast(gtk_selection_data_get_data(selection_data))); if (!m_owner->HandleWindowEvent( event )) return FALSE; @@ -3626,7 +3593,7 @@ wxDataViewCtrlInternal::row_drop_possible(GtkTreeDragDest *WXUNUSED(drag_dest), event.SetEventObject( m_owner ); event.SetItem( item ); event.SetModel( m_wx_model ); - event.SetDataFormat( selection_data->target ); + event.SetDataFormat(gtk_selection_data_get_target(selection_data)); if (!m_owner->HandleWindowEvent( event )) return FALSE; @@ -3666,13 +3633,59 @@ bool wxDataViewCtrlInternal::ItemAdded( const wxDataViewItem &parent, const wxDa if (!m_wx_model->IsVirtualListModel()) { wxGtkTreeModelNode *parent_node = FindNode( parent ); - wxASSERT_MSG(parent_node, + wxCHECK_MSG(parent_node, false, "Did you forget a call to ItemAdded()? The parent node is unknown to the wxGtkTreeModel"); - if (m_wx_model->IsContainer( item )) - parent_node->AddNode( new wxGtkTreeModelNode( parent_node, item, this ) ); + wxDataViewItemArray modelSiblings; + m_wx_model->GetChildren(parent, modelSiblings); + const int modelSiblingsSize = modelSiblings.size(); + + int posInModel = modelSiblings.Index(item, /*fromEnd=*/true); + wxCHECK_MSG( posInModel != wxNOT_FOUND, false, "adding non-existent item?" ); + + const wxGtkTreeModelChildren& nodeSiblings = parent_node->GetChildren(); + const int nodeSiblingsSize = nodeSiblings.size(); + + int nodePos = 0; + + if ( posInModel == modelSiblingsSize - 1 ) + { + nodePos = nodeSiblingsSize; + } + else if ( modelSiblingsSize == nodeSiblingsSize + 1 ) + { + // This is the simple case when our node tree already matches the + // model and only this one item is missing. + nodePos = posInModel; + } else - parent_node->AddLeave( item.GetID() ); + { + // It's possible that a larger discrepancy between the model and + // our realization exists. This can happen e.g. when adding a bunch + // of items to the model and then calling ItemsAdded() just once + // afterwards. In this case, we must find the right position by + // looking at sibling items. + + // append to the end if we won't find a better position: + nodePos = nodeSiblingsSize; + + for ( int nextItemPos = posInModel + 1; + nextItemPos < modelSiblingsSize; + nextItemPos++ ) + { + int nextNodePos = parent_node->FindChildByItem(modelSiblings[nextItemPos]); + if ( nextNodePos != wxNOT_FOUND ) + { + nodePos = nextNodePos; + break; + } + } + } + + if (m_wx_model->IsContainer( item )) + parent_node->InsertNode( new wxGtkTreeModelNode( parent_node, item, this ), nodePos ); + else + parent_node->InsertLeaf( item.GetID(), nodePos ); } ScheduleRefresh(); @@ -3749,7 +3762,7 @@ gboolean wxDataViewCtrlInternal::get_iter( GtkTreeIter *iter, GtkTreePath *path iter->stamp = m_gtk_model->stamp; // user_data is just the index +1 - iter->user_data = (gpointer) (i+1); + iter->user_data = wxUIntToPtr(i+1); return TRUE; } @@ -3852,7 +3865,7 @@ gboolean wxDataViewCtrlInternal::iter_next( GtkTreeIter *iter ) } // user_data is just the index +1 (+2 because we need the next) - iter->user_data = (gpointer) (n+2); + iter->user_data = wxUIntToPtr(n+2); } else { @@ -4006,7 +4019,7 @@ gboolean wxDataViewCtrlInternal::iter_nth_child( GtkTreeIter *iter, GtkTreeIter iter->stamp = m_gtk_model->stamp; // user_data is just the index +1 - iter->user_data = (gpointer) (n+1); + iter->user_data = wxUIntToPtr(n+1); return TRUE; } @@ -4244,7 +4257,7 @@ wxGtkTreeModelNode *wxDataViewCtrlInternal::FindParentNode( const wxDataViewItem static void wxdataview_selection_changed_callback( GtkTreeSelection* WXUNUSED(selection), wxDataViewCtrl *dv ) { - if (!GTK_WIDGET_REALIZED(dv->m_widget)) + if (!gtk_widget_get_realized(dv->m_widget)) return; wxDataViewEvent event( wxEVT_COMMAND_DATAVIEW_SELECTION_CHANGED, dv->GetId() ); @@ -4326,7 +4339,7 @@ void wxDataViewCtrl::AddChildGTK(wxWindowGTK* child) GtkWidget* treeview = GtkGetTreeView(); // Insert widget in GtkTreeView - if (GTK_WIDGET_REALIZED(treeview)) + if (gtk_widget_get_realized(treeview)) gtk_widget_set_parent_window( child->m_widget, gtk_tree_view_get_bin_window( GTK_TREE_VIEW(treeview) ) ); gtk_widget_set_parent( child->m_widget, treeview ); @@ -4414,22 +4427,21 @@ gtk_dataview_button_press_callback( GtkWidget *WXUNUSED(widget), GtkTreeViewColumn *column = NULL; gint cell_x = 0; gint cell_y = 0; - if (gtk_tree_view_get_path_at_pos( + gtk_tree_view_get_path_at_pos + ( GTK_TREE_VIEW(dv->GtkGetTreeView()), (int) gdk_event->x, (int) gdk_event->y, path.ByRef(), &column, &cell_x, - &cell_y)) - { - if (path) - { - wxDataViewEvent event( wxEVT_COMMAND_DATAVIEW_ITEM_CONTEXT_MENU, dv->GetId() ); - event.SetItem(dv->GTKPathToItem(path)); - event.SetModel( dv->GetModel() ); - return dv->HandleWindowEvent( event ); - } - } + &cell_y + ); + + wxDataViewEvent event( wxEVT_COMMAND_DATAVIEW_ITEM_CONTEXT_MENU, dv->GetId() ); + if (path) + event.SetItem(dv->GTKPathToItem(path)); + event.SetModel( dv->GetModel() ); + return dv->HandleWindowEvent( event ); } return FALSE; @@ -4439,6 +4451,22 @@ IMPLEMENT_DYNAMIC_CLASS(wxDataViewCtrl, wxDataViewCtrlBase) wxDataViewCtrl::~wxDataViewCtrl() { + // Stop editing before destroying the control to remove any event handlers + // which are added when editing started: if we didn't do this, the base + // class dtor would assert as it checks for any leftover handlers. + if ( m_treeview ) + { + GtkTreeViewColumn *col; + gtk_tree_view_get_cursor(GTK_TREE_VIEW(m_treeview), NULL, &col); + + wxDataViewColumn * const wxcol = FromGTKColumn(col); + if ( wxcol ) + { + // This won't do anything if we're not editing it + wxcol->GetRenderer()->CancelEditing(); + } + } + m_cols.Clear(); delete m_internal; @@ -4449,6 +4477,8 @@ void wxDataViewCtrl::Init() m_internal = NULL; m_cols.DeleteContents( true ); + + m_uniformRowHeight = -1; } bool wxDataViewCtrl::Create(wxWindow *parent, @@ -4474,6 +4504,8 @@ bool wxDataViewCtrl::Create(wxWindow *parent, m_treeview = gtk_tree_view_new(); gtk_container_add (GTK_CONTAINER (m_widget), m_treeview); + m_focusWidget = GTK_WIDGET(m_treeview); + g_signal_connect (m_treeview, "size_allocate", G_CALLBACK (gtk_dataviewctrl_size_callback), this); @@ -4681,10 +4713,9 @@ unsigned int wxDataViewCtrl::GetColumnCount() const return m_cols.GetCount(); } -wxDataViewColumn* wxDataViewCtrl::GetColumn( unsigned int pos ) const +wxDataViewColumn* wxDataViewCtrl::FromGTKColumn(GtkTreeViewColumn *gtk_col) const { - GtkTreeViewColumn *gtk_col = gtk_tree_view_get_column( GTK_TREE_VIEW(m_treeview), pos ); - if (!gtk_col) + if ( !gtk_col ) return NULL; wxDataViewColumnList::const_iterator iter; @@ -4697,9 +4728,18 @@ wxDataViewColumn* wxDataViewCtrl::GetColumn( unsigned int pos ) const } } + wxFAIL_MSG( "No matching column?" ); + return NULL; } +wxDataViewColumn* wxDataViewCtrl::GetColumn( unsigned int pos ) const +{ + GtkTreeViewColumn *gtk_col = gtk_tree_view_get_column( GTK_TREE_VIEW(m_treeview), pos ); + + return FromGTKColumn(gtk_col); +} + bool wxDataViewCtrl::DeleteColumn( wxDataViewColumn *column ) { gtk_tree_view_remove_column( GTK_TREE_VIEW(m_treeview), @@ -4727,15 +4767,11 @@ bool wxDataViewCtrl::ClearColumns() int wxDataViewCtrl::GetColumnPosition( const wxDataViewColumn *column ) const { - GtkTreeViewColumn *gtk_column = GTK_TREE_VIEW_COLUMN(column->GetConstGtkHandle()); + GtkTreeViewColumn *gtk_column = GTK_TREE_VIEW_COLUMN(column->GetGtkHandle()); - GList *list = gtk_tree_view_get_columns( GTK_TREE_VIEW(m_treeview) ); + wxGtkList list(gtk_tree_view_get_columns(GTK_TREE_VIEW(m_treeview))); - gint pos = g_list_index( list, (gconstpointer) gtk_column ); - - g_list_free( list ); - - return pos; + return g_list_index( list, (gconstpointer) gtk_column ); } wxDataViewColumn *wxDataViewCtrl::GetSortingColumn() const @@ -4804,39 +4840,51 @@ void wxDataViewCtrl::DoSetCurrentItem(const wxDataViewItem& item) gtk_tree_view_set_cursor(GTK_TREE_VIEW(m_treeview), path, NULL, FALSE); } -wxDataViewItem wxDataViewCtrl::GetSelection() const +wxDataViewColumn *wxDataViewCtrl::GetCurrentColumn() const +{ + // The tree doesn't have any current item if it hadn't been created yet but + // it's arguably not an error to call this function in this case so just + // return NULL without asserting. + if ( !m_treeview ) + return NULL; + + GtkTreeViewColumn *col; + gtk_tree_view_get_cursor(GTK_TREE_VIEW(m_treeview), NULL, &col); + return FromGTKColumn(col); +} + +void wxDataViewCtrl::EditItem(const wxDataViewItem& item, const wxDataViewColumn *column) +{ + wxCHECK_RET( m_treeview, + "Current item can't be set before creating the control." ); + wxCHECK_RET( item.IsOk(), "invalid item" ); + wxCHECK_RET( column, "no column provided" ); + + // We need to make sure the model knows about this item or the path would + // be invalid and gtk_tree_view_set_cursor() would silently do nothing. + ExpandAncestors(item); + + GtkTreeViewColumn *gcolumn = GTK_TREE_VIEW_COLUMN(column->GetGtkHandle()); + + // We also need to preserve the existing selection from changing. + // Unfortunately the only way to do it seems to use our own selection + // function and forbid any selection changes during set cursor call. + wxGtkTreeSelectionLock + lock(gtk_tree_view_get_selection(GTK_TREE_VIEW(m_treeview))); + + // Do move the cursor now. + GtkTreeIter iter; + iter.user_data = item.GetID(); + wxGtkTreePath path(m_internal->get_path( &iter )); + + gtk_tree_view_set_cursor(GTK_TREE_VIEW(m_treeview), path, gcolumn, TRUE); +} + +int wxDataViewCtrl::GetSelectedItemsCount() const { GtkTreeSelection *selection = gtk_tree_view_get_selection( GTK_TREE_VIEW(m_treeview) ); - if (m_windowStyle & wxDV_MULTIPLE) - { - // Report the first one - GtkTreeModel *model; - GList *list = gtk_tree_selection_get_selected_rows( selection, &model ); - - if (list) - { - GtkTreePath *path = (GtkTreePath*) list->data; - wxDataViewItem item(GTKPathToItem(path)); - - // delete list - g_list_foreach( list, (GFunc) gtk_tree_path_free, NULL ); - g_list_free( list ); - - return item; - } - } - else - { - GtkTreeIter iter; - if (gtk_tree_selection_get_selected( selection, NULL, &iter )) - { - wxDataViewItem item( iter.user_data ); - return item; - } - } - - return wxDataViewItem(0); + return gtk_tree_selection_count_selected_rows(selection); } int wxDataViewCtrl::GetSelections( wxDataViewItemArray & sel ) const @@ -4847,38 +4895,25 @@ int wxDataViewCtrl::GetSelections( wxDataViewItemArray & sel ) const if (HasFlag(wxDV_MULTIPLE)) { GtkTreeModel *model; - GList *list = gtk_tree_selection_get_selected_rows( selection, &model ); + wxGtkTreePathList list(gtk_tree_selection_get_selected_rows(selection, &model)); - int count = 0; - while (list) + for ( GList* current = list; current; current = g_list_next(current) ) { - GtkTreePath *path = (GtkTreePath*) list->data; + GtkTreePath *path = (GtkTreePath*) current->data; sel.Add(GTKPathToItem(path)); - - list = g_list_next( list ); - count++; } - - // delete list - g_list_foreach( list, (GFunc) gtk_tree_path_free, NULL ); - g_list_free( list ); - - return count; } else { - GtkTreeModel *model; GtkTreeIter iter; - gboolean has_selection = gtk_tree_selection_get_selected( selection, &model, &iter ); - if (has_selection) + if (gtk_tree_selection_get_selected( selection, NULL, &iter )) { - sel.Add( wxDataViewItem( (void*) iter.user_data) ); - return 1; + sel.Add( wxDataViewItem(iter.user_data) ); } } - return 0; + return sel.size(); } void wxDataViewCtrl::SetSelections( const wxDataViewItemArray & sel ) @@ -4995,7 +5030,8 @@ void wxDataViewCtrl::HitTest(const wxPoint& point, // gtk_tree_view_get_path_at_pos() is the wrong function. It doesn't mind the header but returns column. // See http://mail.gnome.org/archives/gtkmm-list/2005-January/msg00080.html // So we have to use both of them. - // Friedrich Haase 2010-9-20 + item = wxDataViewItem(0); + column = NULL; wxGtkTreePath path, pathScratch; GtkTreeViewColumn* GtkColumn = NULL; GtkTreeViewDropPosition pos = GTK_TREE_VIEW_DROP_INTO_OR_AFTER; @@ -5003,8 +5039,8 @@ void wxDataViewCtrl::HitTest(const wxPoint& point, gint cell_y = 0; // cannot directly call GtkGetTreeView(), HitTest is const and so is this pointer - wxDataViewCtrl* ctrl = (wxDataViewCtrl*)this; // ugly workaround, ctrl is NOT const - GtkTreeView* treeView = GTK_TREE_VIEW(ctrl->GtkGetTreeView()); + wxDataViewCtrl* self = const_cast(this); // ugly workaround, self is NOT const + GtkTreeView* treeView = GTK_TREE_VIEW(self->GtkGetTreeView()); // is there possibly a better suited function to get the column? gtk_tree_view_get_path_at_pos( // and this is the wrong call but it delivers the column @@ -5044,6 +5080,12 @@ wxDataViewCtrl::GetItemRect(const wxDataViewItem& WXUNUSED(item), return wxRect(); } +bool wxDataViewCtrl::SetRowHeight(int rowHeight) +{ + m_uniformRowHeight = rowHeight; + return true; +} + void wxDataViewCtrl::DoSetExpanderColumn() { gtk_tree_view_set_expander_column( GTK_TREE_VIEW(m_treeview), diff --git a/Externals/wxWidgets3/src/gtk/dcclient.cpp b/Externals/wxWidgets3/src/gtk/dcclient.cpp index 8d08b11504..3d392b9ed0 100644 --- a/Externals/wxWidgets3/src/gtk/dcclient.cpp +++ b/Externals/wxWidgets3/src/gtk/dcclient.cpp @@ -2,7 +2,7 @@ // Name: src/gtk/dcclient.cpp // Purpose: wxWindowDCImpl implementation // Author: Robert Roebling -// RCS-ID: $Id: dcclient.cpp 65846 2010-10-18 23:43:20Z VZ $ +// RCS-ID: $Id: dcclient.cpp 70824 2012-03-06 04:51:40Z PC $ // Copyright: (c) 1998 Robert Roebling, Chris Breeze // Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// @@ -129,7 +129,11 @@ enum wxPoolGCType wxTEXT_SCREEN, wxBG_SCREEN, wxPEN_SCREEN, - wxBRUSH_SCREEN + wxBRUSH_SCREEN, + wxTEXT_COLOUR_ALPHA, + wxBG_COLOUR_ALPHA, + wxPEN_COLOUR_ALPHA, + wxBRUSH_COLOUR_ALPHA }; struct wxGC @@ -295,7 +299,7 @@ wxWindowDCImpl::wxWindowDCImpl( wxDC *owner, wxWindow *window ) : wxCHECK_RET(widget, "DC needs a widget"); m_gdkwindow = widget->window; - if (GTK_WIDGET_NO_WINDOW(widget)) + if (!gtk_widget_get_has_window(widget)) SetDeviceLocalOrigin(widget->allocation.x, widget->allocation.y); } @@ -375,6 +379,13 @@ void wxWindowDCImpl::SetUpDC( bool isMemDC ) m_textGC = wxGetPoolGC( m_gdkwindow, wxTEXT_SCREEN ); m_bgGC = wxGetPoolGC( m_gdkwindow, wxBG_SCREEN ); } + else if (m_cmap == gdk_screen_get_rgba_colormap(gdk_colormap_get_screen(m_cmap))) + { + m_penGC = wxGetPoolGC( m_gdkwindow, wxPEN_COLOUR_ALPHA ); + m_brushGC = wxGetPoolGC( m_gdkwindow, wxBRUSH_COLOUR_ALPHA ); + m_textGC = wxGetPoolGC( m_gdkwindow, wxTEXT_COLOUR_ALPHA ); + m_bgGC = wxGetPoolGC( m_gdkwindow, wxBG_COLOUR_ALPHA ); + } else { m_penGC = wxGetPoolGC( m_gdkwindow, wxPEN_COLOUR ); @@ -947,7 +958,7 @@ void wxWindowDCImpl::DoDrawEllipse( wxCoord x, wxCoord y, wxCoord width, wxCoord // If the pen is transparent pen we increase the size // for better compatibility with other platforms. - if ( m_pen.IsNonTransparent() ) + if (m_pen.IsTransparent()) { ++ww; ++hh; @@ -1372,69 +1383,12 @@ void wxWindowDCImpl::DoDrawText(const wxString& text, gdk_pango_context_set_colormap( m_context, m_cmap ); // not needed in gtk+ >= 2.6 - bool underlined = m_font.IsOk() && m_font.GetUnderlined(); - wxCharBuffer data = wxGTK_CONV(text); if ( !data ) return; - size_t datalen = strlen(data); - // in Pango >= 1.16 the "underline of leading/trailing spaces" bug - // has been fixed and thus the hack implemented below should never be used - static bool pangoOk = !wx_pango_version_check(1, 16, 0); - - bool needshack = underlined && !pangoOk; - - if (needshack) - { - // a PangoLayout which has leading/trailing spaces with underlined font - // is not correctly drawn by this pango version: Pango won't underline the spaces. - // This can be a problem; e.g. wxHTML rendering of underlined text relies on - // this behaviour. To workaround this problem, we use a special hack here - // suggested by pango maintainer Behdad Esfahbod: we prepend and append two - // empty space characters and give them a dummy colour attribute. - // This will force Pango to underline the leading/trailing spaces, too. - - wxCharBuffer data_tmp(datalen + 6); - // copy the leading U+200C ZERO WIDTH NON-JOINER encoded in UTF8 format - memcpy(data_tmp.data(), "\342\200\214", 3); - // copy the user string - memcpy(data_tmp.data() + 3, data, datalen); - // copy the trailing U+200C ZERO WIDTH NON-JOINER encoded in UTF8 format - memcpy(data_tmp.data() + 3 + datalen, "\342\200\214", 3); - - data = data_tmp; - datalen += 6; - } - - pango_layout_set_text(m_layout, data, datalen); - - if (underlined) - { - PangoAttrList *attrs = pango_attr_list_new(); - PangoAttribute *a = pango_attr_underline_new(PANGO_UNDERLINE_SINGLE); - a->start_index = 0; - a->end_index = datalen; - pango_attr_list_insert(attrs, a); - - if (needshack) - { - // dummy colour for the leading space - a = pango_attr_foreground_new (0x0057, 0x52A9, 0xD614); - a->start_index = 0; - a->end_index = 1; - pango_attr_list_insert(attrs, a); - - // dummy colour for the trailing space - a = pango_attr_foreground_new (0x0057, 0x52A9, 0xD614); - a->start_index = datalen - 1; - a->end_index = datalen; - pango_attr_list_insert(attrs, a); - } - - pango_layout_set_attributes(m_layout, attrs); - pango_attr_list_unref(attrs); - } + pango_layout_set_text(m_layout, data, data.length()); + const bool setAttrs = m_font.GTKSetPangoAttrs(m_layout); int oldSize = 0; const bool isScaled = fabs(m_scaleY - 1.0) > 0.00001; @@ -1473,7 +1427,7 @@ void wxWindowDCImpl::DoDrawText(const wxString& text, // actually apply unscaled font pango_layout_set_font_description( m_layout, m_fontdesc ); } - if (underlined) + if (setAttrs) { // undo underline attributes setting: pango_layout_set_attributes(m_layout, NULL); @@ -1492,23 +1446,14 @@ void wxWindowDCImpl::DoDrawRotatedText( const wxString &text, wxCoord x, wxCoord wxCHECK_RET( IsOk(), wxT("invalid window dc") ); -#if __WXGTK26__ +#ifdef __WXGTK26__ if (!gtk_check_version(2,6,0)) { x = XLOG2DEV(x); y = YLOG2DEV(y); pango_layout_set_text(m_layout, wxGTK_CONV(text), -1); - - if (m_font.GetUnderlined()) - { - PangoAttrList *attrs = pango_attr_list_new(); - PangoAttribute *a = pango_attr_underline_new(PANGO_UNDERLINE_SINGLE); - pango_attr_list_insert(attrs, a); - pango_layout_set_attributes(m_layout, attrs); - pango_attr_list_unref(attrs); - } - + const bool setAttrs = m_font.GTKSetPangoAttrs(m_layout); int oldSize = 0; const bool isScaled = fabs(m_scaleY - 1.0) > 0.00001; if (isScaled) @@ -1561,7 +1506,7 @@ void wxWindowDCImpl::DoDrawRotatedText( const wxString &text, wxCoord x, wxCoord gdk_draw_layout_with_colors(m_gdkwindow, m_textGC, x+minX, y+minY, m_layout, NULL, bg_col); - if (m_font.GetUnderlined()) + if (setAttrs) pango_layout_set_attributes(m_layout, NULL); // clean up the transformation matrix @@ -2304,7 +2249,6 @@ int wxWindowDCImpl::GetDepth() const return gdk_drawable_get_depth(m_gdkwindow); } - //----------------------------------------------------------------------------- // wxClientDCImpl //----------------------------------------------------------------------------- diff --git a/Externals/wxWidgets3/src/gtk/dcmemory.cpp b/Externals/wxWidgets3/src/gtk/dcmemory.cpp index 81d4524429..08071cafbd 100644 --- a/Externals/wxWidgets3/src/gtk/dcmemory.cpp +++ b/Externals/wxWidgets3/src/gtk/dcmemory.cpp @@ -2,7 +2,7 @@ // Name: src/gtk/dcmemory.cpp // Purpose: // Author: Robert Roebling -// RCS-ID: $Id: dcmemory.cpp 61724 2009-08-21 10:41:26Z VZ $ +// RCS-ID: $Id: dcmemory.cpp 70809 2012-03-04 23:50:35Z PC $ // Copyright: (c) 1998 Robert Roebling // Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// @@ -10,10 +10,8 @@ // For compilers that support precompilation, includes "wx.h". #include "wx/wxprec.h" -#include "wx/dcmemory.h" #include "wx/gtk/dcmemory.h" -#include #include //----------------------------------------------------------------------------- @@ -65,7 +63,7 @@ void wxMemoryDCImpl::DoSelect( const wxBitmap& bitmap ) Destroy(); m_selected = bitmap; - if (m_selected.Ok()) + if (m_selected.IsOk()) { m_gdkwindow = m_selected.GetPixmap(); @@ -83,7 +81,7 @@ void wxMemoryDCImpl::DoSelect( const wxBitmap& bitmap ) void wxMemoryDCImpl::SetPen( const wxPen& penOrig ) { wxPen pen( penOrig ); - if ( m_selected.Ok() && + if ( m_selected.IsOk() && m_selected.GetDepth() == 1 && (pen != *wxTRANSPARENT_PEN) ) { @@ -96,7 +94,7 @@ void wxMemoryDCImpl::SetPen( const wxPen& penOrig ) void wxMemoryDCImpl::SetBrush( const wxBrush& brushOrig ) { wxBrush brush( brushOrig ); - if ( m_selected.Ok() && + if ( m_selected.IsOk() && m_selected.GetDepth() == 1 && (brush != *wxTRANSPARENT_BRUSH) ) { @@ -110,7 +108,7 @@ void wxMemoryDCImpl::SetBackground( const wxBrush& brushOrig ) { wxBrush brush(brushOrig); - if ( m_selected.Ok() && + if ( m_selected.IsOk() && m_selected.GetDepth() == 1 && (brush != *wxTRANSPARENT_BRUSH) ) { @@ -122,7 +120,7 @@ void wxMemoryDCImpl::SetBackground( const wxBrush& brushOrig ) void wxMemoryDCImpl::SetTextForeground( const wxColour& col ) { - if ( m_selected.Ok() && m_selected.GetDepth() == 1 ) + if ( m_selected.IsOk() && m_selected.GetDepth() == 1 ) wxWindowDCImpl::SetTextForeground( col == *wxWHITE ? *wxBLACK : *wxWHITE); else wxWindowDCImpl::SetTextForeground( col ); @@ -130,7 +128,7 @@ void wxMemoryDCImpl::SetTextForeground( const wxColour& col ) void wxMemoryDCImpl::SetTextBackground( const wxColour &col ) { - if (m_selected.Ok() && m_selected.GetDepth() == 1) + if (m_selected.IsOk() && m_selected.GetDepth() == 1) wxWindowDCImpl::SetTextBackground( col == *wxWHITE ? *wxBLACK : *wxWHITE ); else wxWindowDCImpl::SetTextBackground( col ); @@ -138,7 +136,7 @@ void wxMemoryDCImpl::SetTextBackground( const wxColour &col ) void wxMemoryDCImpl::DoGetSize( int *width, int *height ) const { - if (m_selected.Ok()) + if (m_selected.IsOk()) { if (width) (*width) = m_selected.GetWidth(); if (height) (*height) = m_selected.GetHeight(); diff --git a/Externals/wxWidgets3/src/gtk/dcscreen.cpp b/Externals/wxWidgets3/src/gtk/dcscreen.cpp index 93699c6010..c4b015deb0 100644 --- a/Externals/wxWidgets3/src/gtk/dcscreen.cpp +++ b/Externals/wxWidgets3/src/gtk/dcscreen.cpp @@ -2,7 +2,7 @@ // Name: src/gtk/dcscreen.cpp // Purpose: // Author: Robert Roebling -// Id: $Id: dcscreen.cpp 61724 2009-08-21 10:41:26Z VZ $ +// Id: $Id: dcscreen.cpp 70809 2012-03-04 23:50:35Z PC $ // Copyright: (c) 1998 Robert Roebling // Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// @@ -10,15 +10,8 @@ // For compilers that support precompilation, includes "wx.h". #include "wx/wxprec.h" -#include "wx/dcscreen.h" #include "wx/gtk/dcscreen.h" -#ifndef WX_PRECOMP - #include "wx/window.h" -#endif - -#include -#include #include //----------------------------------------------------------------------------- @@ -58,6 +51,8 @@ void wxScreenDCImpl::Init() wxScreenDCImpl::~wxScreenDCImpl() { + g_object_unref(m_context); + gdk_gc_set_subwindow( m_penGC, GDK_CLIP_BY_CHILDREN ); gdk_gc_set_subwindow( m_brushGC, GDK_CLIP_BY_CHILDREN ); gdk_gc_set_subwindow( m_textGC, GDK_CLIP_BY_CHILDREN ); diff --git a/Externals/wxWidgets3/src/gtk/descrip.mms b/Externals/wxWidgets3/src/gtk/descrip.mms index cf4536a347..207ed4f17d 100644 --- a/Externals/wxWidgets3/src/gtk/descrip.mms +++ b/Externals/wxWidgets3/src/gtk/descrip.mms @@ -2,7 +2,7 @@ # * # Make file for VMS * # Author : J.Jansen (joukj@hrem.nano.tudelft.nl) * -# Date : 22 September 2009 * +# Date : 13 January 2012 * # * #***************************************************************************** .first @@ -99,7 +99,8 @@ OBJECTS0= \ tglbtn.obj,\ msgdlg.obj,\ treeentry_gtk.obj,textentry.obj,filectrl.obj,print.obj,win_gtk.obj,\ - mnemonics.obj,private.obj,assertdlg_gtk.obj,infobar.obj + mnemonics.obj,private.obj,assertdlg_gtk.obj,infobar.obj,anybutton.obj,\ + nonownedwnd.obj SOURCES =\ animate.cpp,\ @@ -165,22 +166,23 @@ SOURCES =\ utilsgtk.cpp,\ window.cpp,\ treeentry_gtk.c,textentry.cpp,filectrl.cpp,print.cpp,win_gtk.cpp,\ - mnemonics.cpp,private.cpp,assertdlg_gtk.c,infobar.cpp + mnemonics.cpp,private.cpp,assertdlg_gtk.cpp,infobar.cpp,anybutton.cpp,\ + nonownedwnd.cpp all : $(SOURCES) $(MMS)$(MMSQUALIFIERS) $(OBJECTS) .ifdef __WXUNIVERSAL__ library [--.lib]libwx_gtk_univ.olb $(OBJECTS) - library [--.lib]libwx_gtk_univ.olb [.CXX_REPOSITORY]*.obj + If f$getsyi("HW_MODEL") .le. 2048 then library [--.lib]libwx_gtk_univ.olb [.CXX_REPOSITORY]*.obj .else .ifdef __WXGTK2__ library [--.lib]libwx_gtk2.olb $(OBJECTS) - library [--.lib]libwx_gtk2.olb [.CXX_REPOSITORY]*.obj + If f$getsyi("HW_MODEL") .le. 2048 then library [--.lib]libwx_gtk2.olb [.CXX_REPOSITORY]*.obj $(MMS)$(MMSQUALIFIERS) $(OBJECTS0) library [--.lib]libwx_gtk2.olb $(OBJECTS0) .else library [--.lib]libwx_gtk.olb $(OBJECTS) - library [--.lib]libwx_gtk.olb [.CXX_REPOSITORY]*.obj + If f$getsyi("HW_MODEL") .le. 2048 then library [--.lib]libwx_gtk.olb [.CXX_REPOSITORY]*.obj $(MMS)$(MMSQUALIFIERS) $(OBJECTS0) library [--.lib]libwx_gtk.olb $(OBJECTS0) .endif @@ -252,11 +254,14 @@ toplevel.obj : toplevel.cpp utilsgtk.obj : utilsgtk.cpp window.obj : window.cpp treeentry_gtk.obj : treeentry_gtk.c + cc $(CFLAGS)$(CC_DEFINE)/warn=disab=CHAROVERFL $(MMS$TARGET_NAME).c textentry.obj : textentry.cpp filectrl.obj : filectrl.cpp print.obj : print.cpp win_gtk.obj : win_gtk.cpp mnemonics.obj : mnemonics.cpp private.obj : private.cpp -assertdlg_gtk.obj : assertdlg_gtk.c +assertdlg_gtk.obj : assertdlg_gtk.cpp infobar.obj : infobar.cpp +anybutton.obj : anybutton.cpp +nonownedwnd.obj : nonownedwnd.cpp diff --git a/Externals/wxWidgets3/src/gtk/dirdlg.cpp b/Externals/wxWidgets3/src/gtk/dirdlg.cpp index 333a8ccedc..26d793be6d 100644 --- a/Externals/wxWidgets3/src/gtk/dirdlg.cpp +++ b/Externals/wxWidgets3/src/gtk/dirdlg.cpp @@ -2,7 +2,7 @@ // Name: src/gtk/dirdlg.cpp // Purpose: native implementation of wxDirDialog // Author: Robert Roebling, Zbigniew Zagorski, Mart Raudsepp, Francesco Montorsi -// Id: $Id: dirdlg.cpp 64019 2010-04-18 00:05:37Z VZ $ +// Id: $Id: dirdlg.cpp 70898 2012-03-14 12:32:27Z VZ $ // Copyright: (c) 1998 Robert Roebling, 2004 Zbigniew Zagorski, 2005 Mart Raudsepp // Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// @@ -31,7 +31,9 @@ #include "wx/gtk/private.h" +#ifdef __UNIX__ #include // chdir +#endif //----------------------------------------------------------------------------- // "clicked" for OK-button @@ -96,6 +98,17 @@ wxDirDialog::wxDirDialog(wxWindow* parent, const wxPoint& pos, const wxSize& WXUNUSED(sz), const wxString& WXUNUSED(name)) +{ + Create(parent, title, defaultPath, style, pos); +} + +bool wxDirDialog::Create(wxWindow* parent, + const wxString& title, + const wxString& defaultPath, + long style, + const wxPoint& pos, + const wxSize& WXUNUSED(sz), + const wxString& WXUNUSED(name)) { m_message = title; @@ -106,7 +119,7 @@ wxDirDialog::wxDirDialog(wxWindow* parent, wxDefaultValidator, wxT("dirdialog"))) { wxFAIL_MSG( wxT("wxDirDialog creation failed") ); - return; + return false; } GtkWindow* gtk_parent = NULL; @@ -135,7 +148,7 @@ wxDirDialog::wxDirDialog(wxWindow* parent, // local-only property could be set to false to allow non-local files to be loaded. // In that case get/set_uri(s) should be used instead of get/set_filename(s) everywhere // and the GtkFileChooserDialog should probably also be created with a backend, - // e.g "gnome-vfs", "default", ... (gtk_file_chooser_dialog_new_with_backend). + // e.g. "gnome-vfs", "default", ... (gtk_file_chooser_dialog_new_with_backend). // Currently local-only is kept as the default - true: // gtk_file_chooser_set_local_only(GTK_FILE_CHOOSER(m_widget), true); @@ -145,6 +158,7 @@ wxDirDialog::wxDirDialog(wxWindow* parent, if ( !defaultPath.empty() ) gtk_file_chooser_set_current_folder( GTK_FILE_CHOOSER(m_widget), defaultPath.fn_str() ); + return true; } void wxDirDialog::OnFakeOk(wxCommandEvent& WXUNUSED(event)) diff --git a/Externals/wxWidgets3/src/gtk/dnd.cpp b/Externals/wxWidgets3/src/gtk/dnd.cpp index eb4534f847..40373313b2 100644 --- a/Externals/wxWidgets3/src/gtk/dnd.cpp +++ b/Externals/wxWidgets3/src/gtk/dnd.cpp @@ -2,7 +2,7 @@ // Name: src/gtk/dnd.cpp // Purpose: wxDropTarget class // Author: Robert Roebling -// Id: $Id: dnd.cpp 65680 2010-09-30 11:44:45Z VZ $ +// Id: $Id: dnd.cpp 67681 2011-05-03 16:29:04Z DS $ // Copyright: (c) 1998 Robert Roebling // Licence: wxWindows licence /////////////////////////////////////////////////////////////////////////////// @@ -26,6 +26,7 @@ #include "wx/scopeguard.h" #include +#include "wx/gtk/private/gtk2-compat.h" //---------------------------------------------------------------------------- // global data @@ -363,7 +364,7 @@ static void target_drag_data_received( GtkWidget *WXUNUSED(widget), /* Owen Taylor: "call gtk_drag_finish() with success == TRUE" */ - if ((data->length <= 0) || (data->format != 8)) + if (gtk_selection_data_get_length(data) <= 0 || gtk_selection_data_get_format(data) != 8) { /* negative data length and non 8-bit data format qualifies for junk */ @@ -533,12 +534,14 @@ bool wxDropTarget::GetData() if (!m_dataObject) return false; - wxDataFormat dragFormat( m_dragData->target ); + wxDataFormat dragFormat(gtk_selection_data_get_target(m_dragData)); if (!m_dataObject->IsSupportedFormat( dragFormat )) return false; - m_dataObject->SetData( dragFormat, (size_t)m_dragData->length, (const void*)m_dragData->data ); + m_dataObject->SetData(dragFormat, + (size_t)gtk_selection_data_get_length(m_dragData), + (const void*)gtk_selection_data_get_data(m_dragData)); return true; } @@ -605,7 +608,7 @@ source_drag_data_get (GtkWidget *WXUNUSED(widget), guint WXUNUSED(time), wxDropSource *drop_source ) { - wxDataFormat format( selection_data->target ); + wxDataFormat format(gtk_selection_data_get_target(selection_data)); wxLogTrace(TRACE_DND, wxT("Drop source: format requested: %s"), format.GetId().c_str()); @@ -647,7 +650,7 @@ source_drag_data_get (GtkWidget *WXUNUSED(widget), drop_source->m_retValue = ConvertFromGTK( context->action ); gtk_selection_data_set( selection_data, - selection_data->target, + gtk_selection_data_get_target(selection_data), 8, // 8-bit d, size ); @@ -734,11 +737,11 @@ void wxDropSource::SetIcons(const wxIcon &iconCopy, m_iconMove = iconMove; m_iconNone = iconNone; - if ( !m_iconCopy.Ok() ) + if ( !m_iconCopy.IsOk() ) m_iconCopy = wxIcon(page_xpm); - if ( !m_iconMove.Ok() ) + if ( !m_iconMove.IsOk() ) m_iconMove = m_iconCopy; - if ( !m_iconNone.Ok() ) + if ( !m_iconNone.IsOk() ) m_iconNone = m_iconCopy; } @@ -783,7 +786,7 @@ void wxDropSource::PrepareIcon( int action, GdkDragContext *context ) g_signal_connect (m_iconWindow, "configure_event", G_CALLBACK (gtk_dnd_window_configure_callback), this); - gdk_window_set_back_pixmap (m_iconWindow->window, pixmap, FALSE); + gdk_window_set_back_pixmap(gtk_widget_get_window(m_iconWindow), pixmap, false); if (mask) gtk_widget_shape_combine_mask (m_iconWindow, mask, 0, 0); diff --git a/Externals/wxWidgets3/src/gtk/filedlg.cpp b/Externals/wxWidgets3/src/gtk/filedlg.cpp index 1c6dd3ef29..b28d54bf98 100644 --- a/Externals/wxWidgets3/src/gtk/filedlg.cpp +++ b/Externals/wxWidgets3/src/gtk/filedlg.cpp @@ -2,7 +2,7 @@ // Name: src/gtk/filedlg.cpp // Purpose: native implementation of wxFileDialog // Author: Robert Roebling, Zbigniew Zagorski, Mart Raudsepp -// Id: $Id: filedlg.cpp 64381 2010-05-22 12:07:54Z VZ $ +// Id: $Id: filedlg.cpp 70898 2012-03-14 12:32:27Z VZ $ // Copyright: (c) 1998 Robert Roebling, 2004 Zbigniew Zagorski, 2005 Mart Raudsepp // Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// @@ -22,7 +22,9 @@ #include #include "wx/gtk/private.h" +#ifdef __UNIX__ #include // chdir +#endif #include "wx/filename.h" // wxFilename #include "wx/tokenzr.h" // wxStringTokenizer @@ -172,13 +174,24 @@ wxFileDialog::wxFileDialog(wxWindow *parent, const wxString& message, const wxSize& sz, const wxString& name) : wxFileDialogBase() +{ + Create(parent, message, defaultDir, defaultFileName, wildCard, style, pos, sz, name); +} + +bool wxFileDialog::Create(wxWindow *parent, const wxString& message, + const wxString& defaultDir, + const wxString& defaultFileName, + const wxString& wildCard, + long style, const wxPoint& pos, + const wxSize& sz, + const wxString& name) { parent = GetParentForModalDialog(parent, style); if (!wxFileDialogBase::Create(parent, message, defaultDir, defaultFileName, wildCard, style, pos, sz, name)) { - return; + return false; } if (!PreCreation(parent, pos, wxDefaultSize) || @@ -186,7 +199,7 @@ wxFileDialog::wxFileDialog(wxWindow *parent, const wxString& message, wxDefaultValidator, wxT("filedialog"))) { wxFAIL_MSG( wxT("wxFileDialog creation failed") ); - return; + return false; } GtkFileChooserAction gtk_action; @@ -235,7 +248,7 @@ wxFileDialog::wxFileDialog(wxWindow *parent, const wxString& message, // local-only property could be set to false to allow non-local files to be // loaded. In that case get/set_uri(s) should be used instead of // get/set_filename(s) everywhere and the GtkFileChooserDialog should - // probably also be created with a backend, e.g "gnome-vfs", "default", ... + // probably also be created with a backend, e.g. "gnome-vfs", "default", ... // (gtk_file_chooser_dialog_new_with_backend). Currently local-only is kept // as the default - true: // gtk_file_chooser_set_local_only(GTK_FILE_CHOOSER(m_widget), true); @@ -309,6 +322,8 @@ wxFileDialog::wxFileDialog(wxWindow *parent, const wxString& message, G_CALLBACK(gtk_filedialog_update_preview_callback), previewImage); } + + return true; } wxFileDialog::~wxFileDialog() @@ -369,10 +384,17 @@ void wxFileDialog::SetMessage(const wxString& message) void wxFileDialog::SetPath(const wxString& path) { + // Don't do anything if no path is specified, in particular don't set the + // path to m_dir below as this would result in opening the dialog in the + // parent directory of this one instead of m_dir itself. + if ( path.empty() ) + return; + // we need an absolute path for GTK native chooser so ensure that we have - // it + // it: use the initial directory if it was set or just CWD otherwise (this + // is the default behaviour if m_dir is empty) wxFileName fn(path); - fn.MakeAbsolute(); + fn.MakeAbsolute(m_dir); m_fc.SetPath(fn.GetFullPath()); } diff --git a/Externals/wxWidgets3/src/gtk/filepicker.cpp b/Externals/wxWidgets3/src/gtk/filepicker.cpp index 3ae914446a..276bc63eea 100644 --- a/Externals/wxWidgets3/src/gtk/filepicker.cpp +++ b/Externals/wxWidgets3/src/gtk/filepicker.cpp @@ -4,7 +4,7 @@ // Author: Francesco Montorsi // Modified By: // Created: 15/04/2006 -// Id: $Id: filepicker.cpp 61724 2009-08-21 10:41:26Z VZ $ +// Id: $Id: filepicker.cpp 70754 2012-02-29 18:05:03Z PC $ // Copyright: (c) Francesco Montorsi // Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// @@ -80,9 +80,7 @@ bool wxFileButton::Create( wxWindow *parent, wxWindowID id, // use as label the currently selected file m_widget = gtk_file_chooser_button_new_with_dialog( m_dialog->m_widget ); - g_object_ref(m_widget); - gtk_widget_show(m_widget); // we need to know when the dialog has been dismissed clicking OK... // NOTE: the "clicked" signal is not available for a GtkFileChooserButton @@ -129,6 +127,14 @@ void wxFileButton::SetPath(const wxString &str) UpdateDialogPath(m_dialog); } +void wxFileButton::SetInitialDirectory(const wxString& dir) +{ + if (m_dialog) + DoSetInitialDirectory(static_cast(m_dialog), dir); + else + wxGenericFileButton::SetInitialDirectory(dir); +} + #endif // wxUSE_FILEPICKERCTRL && defined(__WXGTK26__) @@ -136,7 +142,9 @@ void wxFileButton::SetPath(const wxString &str) #if wxUSE_DIRPICKERCTRL && defined(__WXGTK26__) +#ifdef __UNIX__ #include // chdir +#endif //----------------------------------------------------------------------------- // "current-folder-changed" @@ -227,9 +235,6 @@ bool wxDirButton::Create( wxWindow *parent, wxWindowID id, m_widget = gtk_file_chooser_button_new_with_dialog( m_dialog->m_widget ); g_object_ref(m_widget); - - gtk_widget_show(m_widget); - // GtkFileChooserButton signals g_signal_connect(m_widget, "current-folder-changed", G_CALLBACK(gtk_dirbutton_currentfolderchanged_callback), this); @@ -274,4 +279,15 @@ void wxDirButton::SetPath(const wxString& str) UpdateDialogPath(m_dialog); } +void wxDirButton::SetInitialDirectory(const wxString& dir) +{ + if (m_dialog) + { + if (m_path.empty()) + static_cast(m_dialog)->SetPath(dir); + } + else + wxGenericDirButton::SetInitialDirectory(dir); +} + #endif // wxUSE_DIRPICKERCTRL && defined(__WXGTK26__) diff --git a/Externals/wxWidgets3/src/gtk/font.cpp b/Externals/wxWidgets3/src/gtk/font.cpp index 822773b38a..b09793a989 100644 --- a/Externals/wxWidgets3/src/gtk/font.cpp +++ b/Externals/wxWidgets3/src/gtk/font.cpp @@ -2,7 +2,7 @@ // Name: src/gtk/font.cpp // Purpose: wxFont for wxGTK // Author: Robert Roebling -// Id: $Id: font.cpp 66641 2011-01-07 22:01:22Z SC $ +// Id: $Id: font.cpp 70476 2012-01-29 08:14:34Z PC $ // Copyright: (c) 1998 Robert Roebling and Julian Smart // Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// @@ -52,6 +52,7 @@ public: wxFontStyle style = wxFONTSTYLE_NORMAL, wxFontWeight weight = wxFONTWEIGHT_NORMAL, bool underlined = false, + bool strikethrough = false, const wxString& faceName = wxEmptyString, wxFontEncoding encoding = wxFONTENCODING_DEFAULT); @@ -69,6 +70,7 @@ public: void SetStyle(wxFontStyle style); void SetWeight(wxFontWeight weight); void SetUnderlined(bool underlined); + void SetStrikethrough(bool strikethrough); bool SetFaceName(const wxString& facename); void SetEncoding(wxFontEncoding encoding); @@ -82,6 +84,7 @@ protected: wxFontStyle style, wxFontWeight weight, bool underlined, + bool strikethrough, const wxString& faceName, wxFontEncoding encoding); @@ -90,7 +93,7 @@ protected: private: bool m_underlined; - + bool m_strikethrough; // The native font info: basically a PangoFontDescription wxNativeFontInfo m_nativeFontInfo; @@ -108,6 +111,7 @@ void wxFontRefData::Init(int pointSize, wxFontStyle style, wxFontWeight weight, bool underlined, + bool strikethrough, const wxString& faceName, wxFontEncoding WXUNUSED(encoding)) { @@ -115,6 +119,7 @@ void wxFontRefData::Init(int pointSize, family = wxFONTFAMILY_SWISS; m_underlined = underlined; + m_strikethrough = strikethrough; // Create native font info m_nativeFontInfo.description = pango_font_description_new(); @@ -149,12 +154,14 @@ void wxFontRefData::InitFromNative() // Pango description are never underlined m_underlined = false; + m_strikethrough = false; } wxFontRefData::wxFontRefData( const wxFontRefData& data ) : wxGDIRefData() { m_underlined = data.m_underlined; + m_strikethrough = data.m_strikethrough; // Forces a copy of the internal data. wxNativeFontInfo should probably // have a copy ctor and assignment operator to fix this properly but that @@ -163,11 +170,11 @@ wxFontRefData::wxFontRefData( const wxFontRefData& data ) } wxFontRefData::wxFontRefData(int size, wxFontFamily family, wxFontStyle style, - wxFontWeight weight, bool underlined, + wxFontWeight weight, bool underlined, bool strikethrough, const wxString& faceName, wxFontEncoding encoding) { - Init(size, family, style, weight, underlined, faceName, encoding); + Init(size, family, style, weight, underlined, strikethrough, faceName, encoding); } wxFontRefData::wxFontRefData(const wxString& nativeFontInfoString) @@ -244,6 +251,11 @@ void wxFontRefData::SetUnderlined(bool underlined) // here we just need to save the underlined attribute } +void wxFontRefData::SetStrikethrough(bool strikethrough) +{ + m_strikethrough = strikethrough; +} + bool wxFontRefData::SetFaceName(const wxString& facename) { return m_nativeFontInfo.SetFaceName(facename); @@ -277,6 +289,19 @@ wxFont::wxFont(const wxNativeFontInfo& info) info.GetEncoding() ); } +wxFont::wxFont(int pointSize, + wxFontFamily family, + int flags, + const wxString& face, + wxFontEncoding encoding) +{ + m_refData = new wxFontRefData(pointSize, family, + GetStyleFromFlags(flags), + GetWeightFromFlags(flags), + GetUnderlinedFromFlags(flags), + false, face, encoding); +} + bool wxFont::Create( int pointSize, wxFontFamily family, wxFontStyle style, @@ -288,7 +313,7 @@ bool wxFont::Create( int pointSize, UnRef(); m_refData = new wxFontRefData(pointSize, family, style, weight, - underlined, face, encoding); + underlined, false, face, encoding); return true; } @@ -356,6 +381,13 @@ bool wxFont::GetUnderlined() const return M_FONTDATA->m_underlined; } +bool wxFont::GetStrikethrough() const +{ + wxCHECK_MSG( IsOk(), false, wxT("invalid font") ); + + return M_FONTDATA->m_strikethrough; +} + wxFontEncoding wxFont::GetEncoding() const { wxCHECK_MSG( IsOk(), wxFONTENCODING_SYSTEM, wxT("invalid font") ); @@ -425,6 +457,13 @@ void wxFont::SetUnderlined(bool underlined) M_FONTDATA->SetUnderlined(underlined); } +void wxFont::SetStrikethrough(bool strikethrough) +{ + AllocExclusive(); + + M_FONTDATA->SetStrikethrough(strikethrough); +} + void wxFont::SetEncoding(wxFontEncoding encoding) { AllocExclusive(); @@ -448,3 +487,66 @@ wxGDIRefData* wxFont::CloneGDIRefData(const wxGDIRefData* data) const { return new wxFontRefData(*static_cast(data)); } + +bool wxFont::GTKSetPangoAttrs(PangoLayout* layout) const +{ + if (!IsOk() || !(GetUnderlined() || GetStrikethrough())) + return false; + + PangoAttrList* attrs = pango_attr_list_new(); + PangoAttribute* a; + + if (wx_pango_version_check(1,16,0)) + { + // a PangoLayout which has leading/trailing spaces with underlined font + // is not correctly drawn by this pango version: Pango won't underline the spaces. + // This can be a problem; e.g. wxHTML rendering of underlined text relies on + // this behaviour. To workaround this problem, we use a special hack here + // suggested by pango maintainer Behdad Esfahbod: we prepend and append two + // empty space characters and give them a dummy colour attribute. + // This will force Pango to underline the leading/trailing spaces, too. + + const char* text = pango_layout_get_text(layout); + const size_t n = strlen(text); + if ((n > 0 && text[0] == ' ') || (n > 1 && text[n - 1] == ' ')) + { + wxCharBuffer buf(n + 6); + // copy the leading U+200C ZERO WIDTH NON-JOINER encoded in UTF8 format + memcpy(buf.data(), "\342\200\214", 3); + // copy the user string + memcpy(buf.data() + 3, text, n); + // copy the trailing U+200C ZERO WIDTH NON-JOINER encoded in UTF8 format + memcpy(buf.data() + 3 + n, "\342\200\214", 3); + + pango_layout_set_text(layout, buf, n + 6); + + // Add dummy attributes (use colour as it's invisible anyhow for 0 + // width spaces) to ensure that the spaces in the beginning/end of the + // string are underlined too. + a = pango_attr_foreground_new(0x0057, 0x52A9, 0xD614); + a->start_index = 0; + a->end_index = 3; + pango_attr_list_insert(attrs, a); + + a = pango_attr_foreground_new(0x0057, 0x52A9, 0xD614); + a->start_index = n + 3; + a->end_index = n + 6; + pango_attr_list_insert(attrs, a); + } + } + if (GetUnderlined()) + { + a = pango_attr_underline_new(PANGO_UNDERLINE_SINGLE); + pango_attr_list_insert(attrs, a); + } + if (GetStrikethrough()) + { + a = pango_attr_strikethrough_new(true); + pango_attr_list_insert(attrs, a); + } + + pango_layout_set_attributes(layout, attrs); + pango_attr_list_unref(attrs); + + return true; +} diff --git a/Externals/wxWidgets3/src/gtk/fontdlg.cpp b/Externals/wxWidgets3/src/gtk/fontdlg.cpp index 716ee14615..0b58429526 100644 --- a/Externals/wxWidgets3/src/gtk/fontdlg.cpp +++ b/Externals/wxWidgets3/src/gtk/fontdlg.cpp @@ -2,7 +2,7 @@ // Name: src/gtk/fontdlg.cpp // Purpose: wxFontDialog // Author: Robert Roebling -// Id: $Id: fontdlg.cpp 64019 2010-04-18 00:05:37Z VZ $ +// Id: $Id: fontdlg.cpp 67681 2011-05-03 16:29:04Z DS $ // Copyright: (c) 1998 Robert Roebling // Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// @@ -106,17 +106,17 @@ bool wxFontDialog::DoCreate(wxWindow *parent) GtkFontSelectionDialog *sel = GTK_FONT_SELECTION_DIALOG(m_widget); - g_signal_connect (sel->ok_button, "clicked", + g_signal_connect (gtk_font_selection_dialog_get_ok_button(sel), "clicked", G_CALLBACK (gtk_fontdialog_ok_callback), this); - g_signal_connect (sel->cancel_button, "clicked", + g_signal_connect (gtk_font_selection_dialog_get_cancel_button(sel), "clicked", G_CALLBACK (gtk_fontdialog_cancel_callback), this); g_signal_connect (m_widget, "delete_event", G_CALLBACK (gtk_fontdialog_delete_callback), this); wxFont font = m_fontData.GetInitialFont(); - if( font.Ok() ) + if( font.IsOk() ) { const wxNativeFontInfo *info = font.GetNativeFontInfo(); diff --git a/Externals/wxWidgets3/src/gtk/fontpicker.cpp b/Externals/wxWidgets3/src/gtk/fontpicker.cpp index fb4fa24047..11b34cddea 100644 --- a/Externals/wxWidgets3/src/gtk/fontpicker.cpp +++ b/Externals/wxWidgets3/src/gtk/fontpicker.cpp @@ -4,7 +4,7 @@ // Author: Francesco Montorsi // Modified By: // Created: 15/04/2006 -// Id: $Id: fontpicker.cpp 61724 2009-08-21 10:41:26Z VZ $ +// Id: $Id: fontpicker.cpp 70756 2012-02-29 18:29:31Z PC $ // Copyright: (c) Francesco Montorsi // Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// @@ -81,8 +81,6 @@ bool wxFontButton::Create( wxWindow *parent, wxWindowID id, gtk_font_button_set_use_size(GTK_FONT_BUTTON(m_widget), usefont); gtk_font_button_set_use_font(GTK_FONT_BUTTON(m_widget), usefont); - gtk_widget_show(m_widget); - // GtkFontButton signals g_signal_connect(m_widget, "font-set", G_CALLBACK(gtk_fontbutton_setfont_callback), this); diff --git a/Externals/wxWidgets3/src/gtk/frame.cpp b/Externals/wxWidgets3/src/gtk/frame.cpp index 96893aa87d..40b32c37d2 100644 --- a/Externals/wxWidgets3/src/gtk/frame.cpp +++ b/Externals/wxWidgets3/src/gtk/frame.cpp @@ -2,7 +2,7 @@ // Name: src/gtk/frame.cpp // Purpose: // Author: Robert Roebling -// Id: $Id: frame.cpp 66648 2011-01-08 06:42:41Z PC $ +// Id: $Id: frame.cpp 67326 2011-03-28 06:27:49Z PC $ // Copyright: (c) 1998 Robert Roebling // Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// @@ -271,7 +271,7 @@ void wxFrame::DetachMenuBar() #if wxUSE_LIBHILDON || wxUSE_LIBHILDON2 hildon_window_set_menu(HILDON_WINDOW(m_widget), NULL); #else // !wxUSE_LIBHILDON && !wxUSE_LIBHILDON2 - gtk_widget_ref( m_frameMenuBar->m_widget ); + g_object_ref( m_frameMenuBar->m_widget ); gtk_container_remove( GTK_CONTAINER(m_mainWidget), m_frameMenuBar->m_widget ); #endif // wxUSE_LIBHILDON || wxUSE_LIBHILDON2 /!wxUSE_LIBHILDON && !wxUSE_LIBHILDON2 @@ -332,7 +332,7 @@ void wxFrame::SetToolBar(wxToolBar *toolbar) { // Vertical toolbar and m_wxwindow go into an hbox, inside the // vbox (m_mainWidget). hbox is created on demand. - GtkWidget* hbox = m_wxwindow->parent; + GtkWidget* hbox = gtk_widget_get_parent(m_wxwindow); if (!GTK_IS_HBOX(hbox)) { hbox = gtk_hbox_new(false, 0); diff --git a/Externals/wxWidgets3/src/gtk/glcanvas.cpp b/Externals/wxWidgets3/src/gtk/glcanvas.cpp index 2dcab7e1dc..8e892ad967 100644 --- a/Externals/wxWidgets3/src/gtk/glcanvas.cpp +++ b/Externals/wxWidgets3/src/gtk/glcanvas.cpp @@ -4,7 +4,7 @@ // Author: Robert Roebling // Modified by: // Created: 17/08/98 -// RCS-ID: $Id: glcanvas.cpp 66657 2011-01-08 18:05:33Z PC $ +// RCS-ID: $Id: glcanvas.cpp 67333 2011-03-29 05:17:00Z PC $ // Copyright: (c) Robert Roebling // Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// @@ -18,6 +18,7 @@ #include #include +#include "wx/gtk/private/gtk2-compat.h" #if WXWIN_COMPATIBILITY_2_8 @@ -231,11 +232,11 @@ bool wxGLCanvas::Create(wxWindow *parent, // if our parent window is already visible, we had been realized before we // connected to the "realize" signal and hence our m_glContext hasn't been // initialized yet and we have to do it now - if (GTK_WIDGET_REALIZED(m_wxwindow)) + if (gtk_widget_get_realized(m_wxwindow)) gtk_glwindow_realized_callback( m_wxwindow, this ); #endif // WXWIN_COMPATIBILITY_2_8 - if (GTK_WIDGET_MAPPED(m_wxwindow)) + if (gtk_widget_get_mapped(m_wxwindow)) gtk_glwindow_map_callback( m_wxwindow, this ); return true; diff --git a/Externals/wxWidgets3/src/gtk/gnome/gprint.cpp b/Externals/wxWidgets3/src/gtk/gnome/gprint.cpp index 439aef3de6..01900ebf31 100644 --- a/Externals/wxWidgets3/src/gtk/gnome/gprint.cpp +++ b/Externals/wxWidgets3/src/gtk/gnome/gprint.cpp @@ -3,7 +3,7 @@ // Author: Robert Roebling // Purpose: Implement GNOME printing support // Created: 09/20/04 -// RCS-ID: $Id: gprint.cpp 65820 2010-10-15 23:46:46Z VZ $ +// RCS-ID: $Id: gprint.cpp 70478 2012-01-29 08:49:01Z PC $ // Copyright: Robert Roebling // Licence: wxWindows Licence ///////////////////////////////////////////////////////////////////////////// @@ -1534,7 +1534,7 @@ wxGnomePrinterDCImpl::DoDrawBitmap(const wxBitmap& bitmap, wxCoord x, wxCoord y, bool WXUNUSED(useMask)) { - if (!bitmap.Ok()) return; + if (!bitmap.IsOk()) return; if (bitmap.HasPixbuf()) { @@ -1565,7 +1565,7 @@ wxGnomePrinterDCImpl::DoDrawBitmap(const wxBitmap& bitmap, { wxImage image = bitmap.ConvertToImage(); - if (!image.Ok()) return; + if (!image.IsOk()) return; gs_libGnomePrint->gnome_print_gsave( m_gpc ); double matrix[6]; @@ -1592,25 +1592,12 @@ void wxGnomePrinterDCImpl::DoDrawRotatedText(const wxString& text, wxCoord x, wx double xx = XLOG2DEV(x); double yy = YLOG2DEV(y); - bool underlined = m_font.Ok() && m_font.GetUnderlined(); - const wxScopedCharBuffer data(text.utf8_str()); - size_t datalen = strlen(data); - pango_layout_set_text( m_layout, data, datalen); + pango_layout_set_text(m_layout, data, data.length()); + const bool setAttrs = m_font.GTKSetPangoAttrs(m_layout); - if (underlined) - { - PangoAttrList *attrs = pango_attr_list_new(); - PangoAttribute *a = pango_attr_underline_new(PANGO_UNDERLINE_SINGLE); - a->start_index = 0; - a->end_index = datalen; - pango_attr_list_insert(attrs, a); - pango_layout_set_attributes(m_layout, attrs); - pango_attr_list_unref(attrs); - } - - if (m_textForegroundColour.Ok()) + if (m_textForegroundColour.IsOk()) { unsigned char red = m_textForegroundColour.Red(); unsigned char blue = m_textForegroundColour.Blue(); @@ -1656,7 +1643,7 @@ void wxGnomePrinterDCImpl::DoDrawRotatedText(const wxString& text, wxCoord x, wx gs_libGnomePrint->gnome_print_grestore( m_gpc ); - if (underlined) + if (setAttrs) { // undo underline attributes setting: pango_layout_set_attributes(m_layout, NULL); @@ -1674,7 +1661,7 @@ void wxGnomePrinterDCImpl::SetFont( const wxFont& font ) { m_font = font; - if (m_font.Ok()) + if (m_font.IsOk()) { if (m_fontdesc) pango_font_description_free( m_fontdesc ); @@ -1691,7 +1678,7 @@ void wxGnomePrinterDCImpl::SetFont( const wxFont& font ) void wxGnomePrinterDCImpl::SetPen( const wxPen& pen ) { - if (!pen.Ok()) return; + if (!pen.IsOk()) return; m_pen = pen; @@ -1757,7 +1744,7 @@ void wxGnomePrinterDCImpl::SetPen( const wxPen& pen ) void wxGnomePrinterDCImpl::SetBrush( const wxBrush& brush ) { - if (!brush.Ok()) return; + if (!brush.IsOk()) return; m_brush = brush; diff --git a/Externals/wxWidgets3/src/gtk/hyperlink.cpp b/Externals/wxWidgets3/src/gtk/hyperlink.cpp index 93ee1bf705..2ea8b35ef8 100644 --- a/Externals/wxWidgets3/src/gtk/hyperlink.cpp +++ b/Externals/wxWidgets3/src/gtk/hyperlink.cpp @@ -3,7 +3,7 @@ // Purpose: Hyperlink control // Author: Francesco Montorsi // Created: 14/2/2007 -// RCS-ID: $Id: hyperlink.cpp 65334 2010-08-17 16:55:32Z VZ $ +// RCS-ID: $Id: hyperlink.cpp 70756 2012-02-29 18:29:31Z PC $ // Copyright: (c) 2007 Francesco Montorsi // Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// @@ -82,7 +82,6 @@ bool wxHyperlinkCtrl::Create(wxWindow *parent, wxWindowID id, m_widget = gtk_link_button_new("asdfsaf asdfdsaf asdfdsa"); g_object_ref(m_widget); - gtk_widget_show(m_widget); // alignment float x_alignment = 0.5; @@ -123,6 +122,13 @@ wxSize wxHyperlinkCtrl::DoGetBestSize() const return wxGenericHyperlinkCtrl::DoGetBestSize(); } +wxSize wxHyperlinkCtrl::DoGetBestClientSize() const +{ + if ( UseNative() ) + return wxControl::DoGetBestClientSize(); + return wxGenericHyperlinkCtrl::DoGetBestClientSize(); +} + void wxHyperlinkCtrl::SetLabel(const wxString &label) { if ( UseNative() ) diff --git a/Externals/wxWidgets3/src/gtk/listbox.cpp b/Externals/wxWidgets3/src/gtk/listbox.cpp index 8fa3e1d46d..5b4f36e76e 100644 --- a/Externals/wxWidgets3/src/gtk/listbox.cpp +++ b/Externals/wxWidgets3/src/gtk/listbox.cpp @@ -3,7 +3,7 @@ // Purpose: // Author: Robert Roebling // Modified By: Ryan Norton (GtkTreeView implementation) -// Id: $Id: listbox.cpp 67136 2011-03-06 18:22:23Z VS $ +// Id: $Id: listbox.cpp 67681 2011-05-03 16:29:04Z DS $ // Copyright: (c) 1998 Robert Roebling // Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// @@ -433,7 +433,7 @@ void wxListBox::Update() wxWindow::Update(); if (m_treeview) - gdk_window_process_updates(GTK_WIDGET(m_treeview)->window, TRUE); + gdk_window_process_updates(gtk_widget_get_window(GTK_WIDGET(m_treeview)), true); } // ---------------------------------------------------------------------------- @@ -773,7 +773,7 @@ void wxListBox::DoScrollToCell(int n, float alignY, float alignX) wxCHECK_RET( IsValid(n), wxT("invalid index")); //RN: I have no idea why this line is needed... - if (gdk_pointer_is_grabbed () && GTK_WIDGET_HAS_GRAB (m_treeview)) + if (gdk_pointer_is_grabbed () && gtk_widget_has_grab(GTK_WIDGET(m_treeview))) return; GtkTreeIter iter; @@ -841,23 +841,6 @@ int wxListBox::DoListHitTest(const wxPoint& point) const // helpers // ---------------------------------------------------------------------------- -#if wxUSE_TOOLTIPS -void wxListBox::GTKApplyToolTip( GtkTooltips *tips, const gchar *tip ) -{ -#if GTK_CHECK_VERSION(2, 12, 0) - if (!gtk_check_version(2, 12, 0)) - { - gtk_widget_set_tooltip_text(GTK_WIDGET( m_treeview ), tip); - } - else -#endif - { - // RN: Is this needed anymore? - gtk_tooltips_set_tip( tips, GTK_WIDGET( m_treeview ), tip, NULL ); - } -} -#endif // wxUSE_TOOLTIPS - GtkWidget *wxListBox::GetConnectWidget() { // the correct widget for listbox events (such as mouse clicks for example) @@ -872,7 +855,7 @@ GdkWindow *wxListBox::GTKGetWindow(wxArrayGdkWindows& WXUNUSED(windows)) const void wxListBox::DoApplyWidgetStyle(GtkRcStyle *style) { - if (m_hasBgCol && m_backgroundColour.Ok()) + if (m_hasBgCol && m_backgroundColour.IsOk()) { GdkWindow *window = gtk_tree_view_get_bin_window(m_treeview); if (window) diff --git a/Externals/wxWidgets3/src/gtk/mdi.cpp b/Externals/wxWidgets3/src/gtk/mdi.cpp index 6b3a4db2fc..2f665e0312 100644 --- a/Externals/wxWidgets3/src/gtk/mdi.cpp +++ b/Externals/wxWidgets3/src/gtk/mdi.cpp @@ -2,7 +2,7 @@ // Name: src/gtk/mdi.cpp // Purpose: // Author: Robert Roebling -// Id: $Id: mdi.cpp 64127 2010-04-24 15:08:00Z VZ $ +// Id: $Id: mdi.cpp 69528 2011-10-25 16:56:57Z PC $ // Copyright: (c) 1998 Robert Roebling // Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// @@ -27,10 +27,7 @@ extern "C" { static void -gtk_mdi_page_change_callback( GtkNotebook *WXUNUSED(widget), - GtkNotebookPage *page, - gint WXUNUSED(page_num), - wxMDIParentFrame *parent ) +switch_page(GtkNotebook* widget, GtkNotebookPage*, guint page_num, wxMDIParentFrame* parent) { // send deactivate event to old child @@ -49,6 +46,7 @@ gtk_mdi_page_change_callback( GtkNotebook *WXUNUSED(widget), return; child = NULL; + GtkWidget* page = gtk_notebook_get_nth_page(widget, page_num); wxWindowList::compatibility_iterator node = client_window->GetChildren().GetFirst(); while ( node ) @@ -58,7 +56,7 @@ gtk_mdi_page_change_callback( GtkNotebook *WXUNUSED(widget), // child_frame can be NULL when this is called from dtor, probably // because g_signal_connect (m_widget, "switch_page", (see below) // isn't deleted early enough - if ( child_frame && child_frame->m_page == page ) + if (child_frame && child_frame->m_widget == page) { child = child_frame; break; @@ -114,7 +112,7 @@ void wxMDIParentFrame::OnInternalIdle() if (m_justInserted) { GtkNotebook *notebook = GTK_NOTEBOOK(m_clientWindow->m_widget); - gtk_notebook_set_current_page( notebook, g_list_length( notebook->children ) - 1 ); + gtk_notebook_set_current_page(notebook, -1); /* need to set the menubar of the child */ wxMDIChildFrame *active_child_frame = GetActiveChild(); @@ -220,7 +218,7 @@ wxMDIChildFrame *wxMDIParentFrame::GetActiveChild() const gint i = gtk_notebook_get_current_page( notebook ); if (i < 0) return NULL; - GtkNotebookPage* page = (GtkNotebookPage*) (g_list_nth(notebook->children,i)->data); + GtkWidget* page = gtk_notebook_get_nth_page(notebook, i); if (!page) return NULL; wxWindowList::compatibility_iterator node = m_clientWindow->GetChildren().GetFirst(); @@ -234,7 +232,7 @@ wxMDIChildFrame *wxMDIParentFrame::GetActiveChild() const if (!child_frame) return NULL; - if (child_frame->m_page == page) + if (child_frame->m_widget == page) return child_frame; node = node->GetNext(); @@ -269,7 +267,6 @@ END_EVENT_TABLE() void wxMDIChildFrame::Init() { m_menuBar = NULL; - m_page = NULL; } bool wxMDIChildFrame::Create(wxMDIParentFrame *parent, @@ -297,6 +294,12 @@ wxMDIChildFrame::~wxMDIChildFrame() gtk_widget_queue_draw(m_parent->m_widget); } +void wxMDIChildFrame::GTKHandleRealized() +{ + // since m_widget is not a GtkWindow, must bypass wxTopLevelWindowGTK + wxTopLevelWindowBase::GTKHandleRealized(); +} + void wxMDIChildFrame::SetMenuBar( wxMenuBar *menu_bar ) { wxASSERT_MSG( m_menuBar == NULL, "Only one menubar allowed" ); @@ -391,9 +394,7 @@ wxMDIClientWindow::~wxMDIClientWindow() // a call to gtk_mdi_page_change_callback with an invalid parent // (because gtk_mdi_page_change_callback expects a wxMDIClientWindow but // at that point of the dtor chain we are a simple wxWindow!) - g_signal_handlers_disconnect_by_func(m_widget, - (gpointer)gtk_mdi_page_change_callback, - GetParent()); + g_signal_handlers_disconnect_by_func(m_widget, (void*)switch_page, GetParent()); } bool wxMDIClientWindow::CreateClient(wxMDIParentFrame *parent, long style) @@ -409,8 +410,7 @@ bool wxMDIClientWindow::CreateClient(wxMDIParentFrame *parent, long style) m_widget = gtk_notebook_new(); g_object_ref(m_widget); - g_signal_connect (m_widget, "switch_page", - G_CALLBACK (gtk_mdi_page_change_callback), parent); + g_signal_connect(m_widget, "switch_page", G_CALLBACK(switch_page), parent); gtk_notebook_set_scrollable( GTK_NOTEBOOK(m_widget), 1 ); @@ -437,8 +437,6 @@ void wxMDIClientWindow::AddChildGTK(wxWindowGTK* child) gtk_notebook_append_page( notebook, child->m_widget, label_widget ); - child_frame->m_page = (GtkNotebookPage*) (g_list_last(notebook->children)->data); - wxMDIParentFrame* parent_frame = static_cast(GetParent()); parent_frame->m_justInserted = true; } diff --git a/Externals/wxWidgets3/src/gtk/menu.cpp b/Externals/wxWidgets3/src/gtk/menu.cpp index 659d2dc498..3e4f6425f6 100644 --- a/Externals/wxWidgets3/src/gtk/menu.cpp +++ b/Externals/wxWidgets3/src/gtk/menu.cpp @@ -2,7 +2,7 @@ // Name: src/gtk/menu.cpp // Purpose: implementation of wxMenuBar and wxMenu classes for wxGTK // Author: Robert Roebling -// Id: $Id: menu.cpp 66637 2011-01-07 21:36:17Z SC $ +// Id: $Id: menu.cpp 70350 2012-01-15 13:41:17Z VZ $ // Copyright: (c) 1998 Robert Roebling // Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// @@ -230,13 +230,15 @@ void wxMenuBar::Detach() bool wxMenuBar::Append( wxMenu *menu, const wxString &title ) { - if ( !wxMenuBarBase::Append( menu, title ) ) - return false; - - return GtkAppend(menu, title); + if (wxMenuBarBase::Append(menu, title)) + { + GtkAppend(menu, title); + return true; + } + return false; } -bool wxMenuBar::GtkAppend(wxMenu *menu, const wxString& title, int pos) +void wxMenuBar::GtkAppend(wxMenu* menu, const wxString& title, int pos) { menu->SetLayoutDirection(GetLayoutDirection()); @@ -251,7 +253,10 @@ bool wxMenuBar::GtkAppend(wxMenu *menu, const wxString& title, int pos) const wxString str(wxStripMenuCodes(item->GetItemLabel())); if ( item->IsSubMenu() ) - return GtkAppend(item->GetSubMenu(), str, pos); + { + GtkAppend(item->GetSubMenu(), str, pos); + return; + } menu->m_owner = gtk_menu_item_new_with_mnemonic( wxGTK_CONV( str ) ); @@ -282,21 +287,16 @@ bool wxMenuBar::GtkAppend(wxMenu *menu, const wxString& title, int pos) if ( m_menuBarFrame ) AttachToFrame( menu, m_menuBarFrame ); - - return true; } bool wxMenuBar::Insert(size_t pos, wxMenu *menu, const wxString& title) { - if ( !wxMenuBarBase::Insert(pos, menu, title) ) - return false; - - // TODO - - if ( !GtkAppend(menu, title, (int)pos) ) - return false; - - return true; + if (wxMenuBarBase::Insert(pos, menu, title)) + { + GtkAppend(menu, title, int(pos)); + return true; + } + return false; } wxMenu *wxMenuBar::Replace(size_t pos, wxMenu *menu, const wxString& title) @@ -416,6 +416,15 @@ void wxMenuBar::EnableTop( size_t pos, bool flag ) gtk_widget_set_sensitive( menu->m_owner, flag ); } +bool wxMenuBar::IsEnabledTop(size_t pos) const +{ + wxMenuList::compatibility_iterator node = m_menus.Item( pos ); + wxCHECK_MSG( node, false, wxS("invalid index in IsEnabledTop") ); + wxMenu* const menu = node->GetData(); + wxCHECK_MSG( menu->m_owner, true, wxS("no menu owner?") ); + return gtk_widget_get_sensitive( menu->m_owner ); +} + wxString wxMenuBar::GetMenuLabel( size_t pos ) const { wxMenuList::compatibility_iterator node = m_menus.Item( pos ); @@ -440,7 +449,7 @@ void wxMenuBar::SetMenuLabel( size_t pos, const wxString& label ) menu->SetTitle( str ); if (menu->m_owner) - gtk_label_set_text_with_mnemonic( GTK_LABEL( GTK_BIN(menu->m_owner)->child), wxGTK_CONV(str) ); + gtk_label_set_text_with_mnemonic(GTK_LABEL(gtk_bin_get_child(GTK_BIN(menu->m_owner))), wxGTK_CONV(str)); } //----------------------------------------------------------------------------- @@ -581,7 +590,7 @@ void wxMenuItem::SetItemLabel( const wxString& str ) void wxMenuItem::SetGtkLabel() { const wxString text = wxConvertMnemonicsToGTK(m_text.BeforeFirst('\t')); - GtkLabel* label = GTK_LABEL(GTK_BIN(m_menuItem)->child); + GtkLabel* label = GTK_LABEL(gtk_bin_get_child(GTK_BIN(m_menuItem))); gtk_label_set_text_with_mnemonic(label, wxGTK_CONV_SYS(text)); #if wxUSE_ACCEL guint accel_key; @@ -601,7 +610,9 @@ void wxMenuItem::SetBitmap(const wxBitmap& bitmap) if (m_kind == wxITEM_NORMAL) m_bitmap = bitmap; else + { wxFAIL_MSG("only normal menu items can have bitmaps"); + } } void wxMenuItem::Check( bool check ) @@ -640,7 +651,7 @@ bool wxMenuItem::IsChecked() const wxCHECK_MSG( IsCheckable(), false, wxT("can't get state of uncheckable item!") ); - return ((GtkCheckMenuItem*)m_menuItem)->active != 0; + return gtk_check_menu_item_get_active(GTK_CHECK_MENU_ITEM(m_menuItem)) != 0; } //----------------------------------------------------------------------------- @@ -682,8 +693,7 @@ void wxMenu::Init() m_menu = gtk_menu_new(); // NB: keep reference to the menu so that it is not destroyed behind // our back by GTK+ e.g. when it is removed from menubar: - g_object_ref(m_menu); - gtk_object_sink(GTK_OBJECT(m_menu)); + g_object_ref_sink(m_menu); m_owner = NULL; @@ -697,8 +707,6 @@ void wxMenu::Init() gtk_menu_shell_append(GTK_MENU_SHELL(m_menu), tearoff); } - m_prevRadio = NULL; - // append the title as the very first entry if we have it if ( !m_title.empty() ) { @@ -746,11 +754,9 @@ wxString wxMenu::GetTitle() const return wxConvertMnemonicsFromGTK(wxMenuBase::GetTitle()); } -bool wxMenu::GtkAppend(wxMenuItem *mitem, int pos) +void wxMenu::GtkAppend(wxMenuItem* mitem, int pos) { GtkWidget *menuItem; - GtkWidget* prevRadio = m_prevRadio; - m_prevRadio = NULL; switch (mitem->GetKind()) { case wxITEM_SEPARATOR: @@ -761,11 +767,44 @@ bool wxMenu::GtkAppend(wxMenuItem *mitem, int pos) break; case wxITEM_RADIO: { + // See if we need to create a new radio group for this item or + // add it to an existing one. + wxMenuItem* radioGroupItem = NULL; + + const size_t numItems = GetMenuItemCount(); + const size_t n = pos == -1 ? numItems - 1 : size_t(pos); + + if (n != 0) + { + wxMenuItem* const itemPrev = FindItemByPosition(n - 1); + if ( itemPrev->GetKind() == wxITEM_RADIO ) + { + // Appending an item after an existing radio item puts + // it into the same radio group. + radioGroupItem = itemPrev; + } + } + + if (radioGroupItem == NULL && n != numItems - 1) + { + wxMenuItem* const itemNext = FindItemByPosition(n + 1); + if ( itemNext->GetKind() == wxITEM_RADIO ) + { + // Inserting an item before an existing radio item + // also puts it into the existing radio group. + radioGroupItem = itemNext; + } + } + GSList* group = NULL; - if (prevRadio) - group = gtk_radio_menu_item_get_group(GTK_RADIO_MENU_ITEM(prevRadio)); + if ( radioGroupItem ) + { + group = gtk_radio_menu_item_get_group( + GTK_RADIO_MENU_ITEM(radioGroupItem->GetMenuItem()) + ); + } + menuItem = gtk_radio_menu_item_new_with_label(group, ""); - m_prevRadio = menuItem; } break; default: @@ -820,28 +859,26 @@ bool wxMenu::GtkAppend(wxMenuItem *mitem, int pos) mitem); } } - - return true; } wxMenuItem* wxMenu::DoAppend(wxMenuItem *mitem) { - if (!GtkAppend(mitem)) - return NULL; - - return wxMenuBase::DoAppend(mitem); + if (wxMenuBase::DoAppend(mitem)) + { + GtkAppend(mitem); + return mitem; + } + return NULL; } wxMenuItem* wxMenu::DoInsert(size_t pos, wxMenuItem *item) { - if ( !wxMenuBase::DoInsert(pos, item) ) - return NULL; - - // TODO - if ( !GtkAppend(item, (int)pos) ) - return NULL; - - return item; + if (wxMenuBase::DoInsert(pos, item)) + { + GtkAppend(item, int(pos)); + return item; + } + return NULL; } wxMenuItem *wxMenu::DoRemove(wxMenuItem *item) @@ -850,14 +887,21 @@ wxMenuItem *wxMenu::DoRemove(wxMenuItem *item) return NULL; GtkWidget * const mitem = item->GetMenuItem(); - if ( m_prevRadio == mitem ) + if (!gtk_check_version(2,12,0)) { - // deleting an item starts a new radio group (has to as we shouldn't - // keep a deleted pointer anyhow) - m_prevRadio = NULL; + // gtk_menu_item_remove_submenu() is deprecated since 2.12, but + // gtk_menu_item_set_submenu() can now be used with NULL submenu now so + // just do use it. + gtk_menu_item_set_submenu(GTK_MENU_ITEM(mitem), NULL); + } + else // GTK+ < 2.12 + { + // In 2.10 calling gtk_menu_item_set_submenu() with NULL submenu + // results in critical GTK+ error messages so use the old function + // instead. + gtk_menu_item_remove_submenu(GTK_MENU_ITEM(mitem)); } - gtk_menu_item_set_submenu(GTK_MENU_ITEM(mitem), NULL); gtk_widget_destroy(mitem); item->SetMenuItem(NULL); diff --git a/Externals/wxWidgets3/src/gtk/minifram.cpp b/Externals/wxWidgets3/src/gtk/minifram.cpp index f01a2f986f..92bdfe77ff 100644 --- a/Externals/wxWidgets3/src/gtk/minifram.cpp +++ b/Externals/wxWidgets3/src/gtk/minifram.cpp @@ -2,7 +2,7 @@ // Name: src/gtk/minifram.cpp // Purpose: // Author: Robert Roebling -// Id: $Id: minifram.cpp 64404 2010-05-26 17:37:55Z RR $ +// Id: $Id: minifram.cpp 67326 2011-03-28 06:27:49Z PC $ // Copyright: (c) 1998 Robert Roebling // Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// @@ -23,6 +23,7 @@ #include "wx/gtk/dcclient.h" #include +#include "wx/gtk/private/gtk2-compat.h" //----------------------------------------------------------------------------- // data @@ -61,13 +62,13 @@ extern "C" { static gboolean gtk_window_own_expose_callback(GtkWidget* widget, GdkEventExpose* gdk_event, wxMiniFrame* win) { if (!win->m_hasVMT || gdk_event->count > 0 || - gdk_event->window != widget->window) + gdk_event->window != gtk_widget_get_window(widget)) { return false; } - gtk_paint_shadow (widget->style, - widget->window, + gtk_paint_shadow (gtk_widget_get_style(widget), + gtk_widget_get_window(widget), GTK_STATE_NORMAL, GTK_SHADOW_OUT, NULL, NULL, NULL, // FIXME: No clipping? @@ -80,7 +81,7 @@ static gboolean gtk_window_own_expose_callback(GtkWidget* widget, GdkEventExpose wxDCImpl *impl = dc.GetImpl(); wxClientDCImpl *gtk_impl = wxDynamicCast( impl, wxClientDCImpl ); - gtk_impl->m_gdkwindow = widget->window; // Hack alert + gtk_impl->m_gdkwindow = gtk_widget_get_window(widget); // Hack alert if (style & wxRESIZE_BORDER) { @@ -120,7 +121,7 @@ extern "C" { static gboolean gtk_window_button_press_callback(GtkWidget* widget, GdkEventButton* gdk_event, wxMiniFrame* win) { - if (!win->m_hasVMT || gdk_event->window != widget->window) + if (!win->m_hasVMT || gdk_event->window != gtk_widget_get_window(widget)) return false; if (g_blockEventsOnDrag) return TRUE; if (g_blockEventsOnScroll) return TRUE; @@ -137,7 +138,7 @@ gtk_window_button_press_callback(GtkWidget* widget, GdkEventButton* gdk_event, w { GtkWidget *ancestor = gtk_widget_get_toplevel( widget ); - GdkWindow *source = widget->window; + GdkWindow *source = gtk_widget_get_window(widget); int org_x = 0; int org_y = 0; @@ -165,9 +166,9 @@ gtk_window_button_press_callback(GtkWidget* widget, GdkEventButton* gdk_event, w if (y >= win->m_miniEdge + win->m_miniTitle) return true; - gdk_window_raise( win->m_widget->window ); + gdk_window_raise(gtk_widget_get_window(win->m_widget)); - gdk_pointer_grab( widget->window, FALSE, + gdk_pointer_grab( gtk_widget_get_window(widget), false, (GdkEventMask) (GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK | @@ -198,7 +199,7 @@ extern "C" { static gboolean gtk_window_button_release_callback(GtkWidget* widget, GdkEventButton* gdk_event, wxMiniFrame* win) { - if (!win->m_hasVMT || gdk_event->window != widget->window) + if (!win->m_hasVMT || gdk_event->window != gtk_widget_get_window(widget)) return false; if (g_blockEventsOnDrag) return TRUE; if (g_blockEventsOnScroll) return TRUE; @@ -212,7 +213,7 @@ gtk_window_button_release_callback(GtkWidget* widget, GdkEventButton* gdk_event, gdk_pointer_ungrab ( (guint32)GDK_CURRENT_TIME ); int org_x = 0; int org_y = 0; - gdk_window_get_origin( widget->window, &org_x, &org_y ); + gdk_window_get_origin(gtk_widget_get_window(widget), &org_x, &org_y); x += org_x - win->m_diffX; y += org_y - win->m_diffY; win->m_x = x; @@ -235,10 +236,10 @@ gtk_window_leave_callback(GtkWidget *widget, { if (!win->m_hasVMT) return FALSE; if (g_blockEventsOnDrag) return FALSE; - if (gdk_event->window != widget->window) + if (gdk_event->window != gtk_widget_get_window(widget)) return false; - gdk_window_set_cursor( widget->window, NULL ); + gdk_window_set_cursor(gtk_widget_get_window(widget), NULL); return FALSE; } @@ -252,7 +253,7 @@ extern "C" { static gboolean gtk_window_motion_notify_callback( GtkWidget *widget, GdkEventMotion *gdk_event, wxMiniFrame *win ) { - if (!win->m_hasVMT || gdk_event->window != widget->window) + if (!win->m_hasVMT || gdk_event->window != gtk_widget_get_window(widget)) return false; if (g_blockEventsOnDrag) return TRUE; if (g_blockEventsOnScroll) return TRUE; @@ -278,9 +279,9 @@ gtk_window_motion_notify_callback( GtkWidget *widget, GdkEventMotion *gdk_event, if (style & wxRESIZE_BORDER) { if ((x > win->m_width-14) && (y > win->m_height-14)) - gdk_window_set_cursor( widget->window, gdk_cursor_new( GDK_BOTTOM_RIGHT_CORNER ) ); + gdk_window_set_cursor(gtk_widget_get_window(widget), gdk_cursor_new(GDK_BOTTOM_RIGHT_CORNER)); else - gdk_window_set_cursor( widget->window, NULL ); + gdk_window_set_cursor(gtk_widget_get_window(widget), NULL); win->GTKUpdateCursor(false); } return TRUE; @@ -291,7 +292,7 @@ gtk_window_motion_notify_callback( GtkWidget *widget, GdkEventMotion *gdk_event, int org_x = 0; int org_y = 0; - gdk_window_get_origin( widget->window, &org_x, &org_y ); + gdk_window_get_origin(gtk_widget_get_window(widget), &org_x, &org_y); x += org_x - win->m_diffX; y += org_y - win->m_diffY; win->m_x = x; @@ -423,9 +424,9 @@ void wxMiniFrame::SetTitle( const wxString &title ) { wxFrame::SetTitle( title ); - GtkWidget* widget = GTK_BIN(m_widget)->child; - if (widget->window) - gdk_window_invalidate_rect(widget->window, NULL, false); + GdkWindow* window = gtk_widget_get_window(gtk_bin_get_child(GTK_BIN(m_widget))); + if (window) + gdk_window_invalidate_rect(window, NULL, false); } #endif // wxUSE_MINIFRAME diff --git a/Externals/wxWidgets3/src/gtk/msgdlg.cpp b/Externals/wxWidgets3/src/gtk/msgdlg.cpp index a8606ef32a..b09210711e 100644 --- a/Externals/wxWidgets3/src/gtk/msgdlg.cpp +++ b/Externals/wxWidgets3/src/gtk/msgdlg.cpp @@ -4,7 +4,7 @@ // Author: Vaclav Slavik // Modified by: // Created: 2003/02/28 -// RCS-ID: $Id: msgdlg.cpp 65812 2010-10-15 23:45:58Z VZ $ +// RCS-ID: $Id: msgdlg.cpp 68537 2011-08-04 22:53:42Z VZ $ // Copyright: (c) Vaclav Slavik, 2003 // Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// @@ -74,6 +74,11 @@ wxString wxMessageDialog::GetDefaultCancelLabel() const return GTK_STOCK_CANCEL; } +wxString wxMessageDialog::GetDefaultHelpLabel() const +{ + return GTK_STOCK_HELP; +} + void wxMessageDialog::DoSetCustomLabel(wxString& var, const ButtonLabel& label) { int stockId = label.GetStockId(); @@ -135,16 +140,21 @@ void wxMessageDialog::GTKCreateMsgDialog() // when using custom labels, we have to add all the buttons ourselves if ( !HasCustomLabels() ) { - if ( m_dialogStyle & wxYES_NO ) + // "Help" button is not supported by predefined combinations so we + // always need to create the buttons manually when it's used. + if ( !(m_dialogStyle & wxHELP) ) { - if ( !(m_dialogStyle & wxCANCEL) ) - buttons = GTK_BUTTONS_YES_NO; - //else: no standard GTK_BUTTONS_YES_NO_CANCEL so leave as NONE - } - else if ( m_dialogStyle & wxOK ) - { - buttons = m_dialogStyle & wxCANCEL ? GTK_BUTTONS_OK_CANCEL - : GTK_BUTTONS_OK; + if ( m_dialogStyle & wxYES_NO ) + { + if ( !(m_dialogStyle & wxCANCEL) ) + buttons = GTK_BUTTONS_YES_NO; + //else: no standard GTK_BUTTONS_YES_NO_CANCEL so leave as NONE + } + else if ( m_dialogStyle & wxOK ) + { + buttons = m_dialogStyle & wxCANCEL ? GTK_BUTTONS_OK_CANCEL + : GTK_BUTTONS_OK; + } } } @@ -211,9 +221,16 @@ void wxMessageDialog::GTKCreateMsgDialog() const bool addButtons = buttons == GTK_BUTTONS_NONE; #endif // wxUSE_LIBHILDON/!wxUSE_LIBHILDON - if ( m_dialogStyle & wxYES_NO ) // Yes/No or Yes/No/Cancel dialog + + if ( addButtons ) { - if ( addButtons ) + if ( m_dialogStyle & wxHELP ) + { + gtk_dialog_add_button(dlg, wxGTK_CONV(GetHelpLabel()), + GTK_RESPONSE_HELP); + } + + if ( m_dialogStyle & wxYES_NO ) // Yes/No or Yes/No/Cancel dialog { // Add the buttons in the correct order which is, according to // http://library.gnome.org/devel/hig-book/stable/windows-alert.html.en @@ -233,32 +250,29 @@ void wxMessageDialog::GTKCreateMsgDialog() gtk_dialog_add_button(dlg, wxGTK_CONV(GetYesLabel()), GTK_RESPONSE_YES); } - - // it'd probably be harmless to call gtk_dialog_set_default_response() - // twice but why do it if we're going to change the default below - // anyhow - if ( !(m_dialogStyle & wxCANCEL_DEFAULT) ) + else // Ok or Ok/Cancel dialog { - gtk_dialog_set_default_response(dlg, - m_dialogStyle & wxNO_DEFAULT - ? GTK_RESPONSE_NO - : GTK_RESPONSE_YES); - } - } - else if ( addButtons ) // Ok or Ok/Cancel dialog - { - gtk_dialog_add_button(dlg, wxGTK_CONV(GetOKLabel()), GTK_RESPONSE_OK); - if ( m_dialogStyle & wxCANCEL ) - { - gtk_dialog_add_button(dlg, wxGTK_CONV(GetCancelLabel()), - GTK_RESPONSE_CANCEL); + gtk_dialog_add_button(dlg, wxGTK_CONV(GetOKLabel()), GTK_RESPONSE_OK); + if ( m_dialogStyle & wxCANCEL ) + { + gtk_dialog_add_button(dlg, wxGTK_CONV(GetCancelLabel()), + GTK_RESPONSE_CANCEL); + } } } + gint defaultButton; if ( m_dialogStyle & wxCANCEL_DEFAULT ) - { - gtk_dialog_set_default_response(dlg, GTK_RESPONSE_CANCEL); - } + defaultButton = GTK_RESPONSE_CANCEL; + else if ( m_dialogStyle & wxNO_DEFAULT ) + defaultButton = GTK_RESPONSE_NO; + else if ( m_dialogStyle & wxYES_NO ) + defaultButton = GTK_RESPONSE_YES; + else // No need to change the default value, whatever it is. + defaultButton = GTK_RESPONSE_NONE; + + if ( defaultButton != GTK_RESPONSE_NONE ) + gtk_dialog_set_default_response(dlg, defaultButton); } int wxMessageDialog::ShowModal() @@ -302,6 +316,8 @@ int wxMessageDialog::ShowModal() return wxID_YES; case GTK_RESPONSE_NO: return wxID_NO; + case GTK_RESPONSE_HELP: + return wxID_HELP; } } diff --git a/Externals/wxWidgets3/src/gtk/nativewin.cpp b/Externals/wxWidgets3/src/gtk/nativewin.cpp index a0c585e82c..f14e137ced 100644 --- a/Externals/wxWidgets3/src/gtk/nativewin.cpp +++ b/Externals/wxWidgets3/src/gtk/nativewin.cpp @@ -3,7 +3,7 @@ // Purpose: wxNativeWindow implementation // Author: Vadim Zeitlin // Created: 2008-03-05 -// RCS-ID: $Id: nativewin.cpp 52437 2008-03-11 00:03:46Z VZ $ +// RCS-ID: $Id: nativewin.cpp 67326 2011-03-28 06:27:49Z PC $ // Copyright: (c) 2008 Vadim Zeitlin // Licence: wxWindows licence /////////////////////////////////////////////////////////////////////////////// @@ -29,6 +29,7 @@ #include "wx/nativewin.h" #include +#include "wx/gtk/private/gtk2-compat.h" #ifdef GDK_WINDOWING_X11 #include @@ -71,7 +72,7 @@ bool wxNativeContainerWindow::Create(wxNativeContainerWindowHandle win) // we need to realize the window first before reparenting it gtk_widget_realize(m_widget); - gdk_window_reparent(m_widget->window, win, 0, 0); + gdk_window_reparent(gtk_widget_get_window(m_widget), win, 0, 0); #ifdef GDK_WINDOWING_X11 // if the native window is destroyed, our own window will be destroyed too @@ -79,7 +80,7 @@ bool wxNativeContainerWindow::Create(wxNativeContainerWindowHandle win) // destroyed" GdkWindow, so intercept to DestroyNotify ourselves to fix // this and also destroy the associated C++ object when its window is // destroyed - gdk_window_add_filter(m_widget->window, wxNativeContainerWindowFilter, this); + gdk_window_add_filter(gtk_widget_get_window(m_widget), wxNativeContainerWindowFilter, this); #endif // GDK_WINDOWING_X11 // we should be initially visible as we suppose that the native window we diff --git a/Externals/wxWidgets3/src/gtk/nonownedwnd.cpp b/Externals/wxWidgets3/src/gtk/nonownedwnd.cpp new file mode 100644 index 0000000000..efba8cf874 --- /dev/null +++ b/Externals/wxWidgets3/src/gtk/nonownedwnd.cpp @@ -0,0 +1,308 @@ +/////////////////////////////////////////////////////////////////////////////// +// Name: src/gtk/nonownedwnd.cpp +// Purpose: wxGTK implementation of wxNonOwnedWindow. +// Author: Vadim Zeitlin +// Created: 2011-10-12 +// RCS-ID: $Id: nonownedwnd.cpp 69465 2011-10-18 22:59:16Z VZ $ +// Copyright: (c) 2011 Vadim Zeitlin +// Licence: wxWindows licence +/////////////////////////////////////////////////////////////////////////////// + +// ============================================================================ +// declarations +// ============================================================================ + +// ---------------------------------------------------------------------------- +// headers +// ---------------------------------------------------------------------------- + +// for compilers that support precompilation, includes "wx.h". +#include "wx/wxprec.h" + +#ifdef __BORLANDC__ + #pragma hdrstop +#endif + +#ifndef WX_PRECOMP + #include "wx/dcclient.h" + #include "wx/dcmemory.h" + #include "wx/nonownedwnd.h" + #include "wx/region.h" +#endif // WX_PRECOMP + +#include "wx/gtk/private.h" + +#include + +#include "wx/graphics.h" + +// ---------------------------------------------------------------------------- +// wxNonOwnedWindowShapeImpl: base class for region and path-based classes. +// ---------------------------------------------------------------------------- + +// This class provides behaviour common to both region and path-based +// implementations and defines SetShape() method and virtual dtor that can be +// called by wxNonOwnedWindow when it's realized leaving just the +// implementation of DoSetShape() to the derived classes. +class wxNonOwnedWindowShapeImpl : public wxEvtHandler +{ +public: + wxNonOwnedWindowShapeImpl(wxWindow* win) : m_win(win) + { + } + + virtual ~wxNonOwnedWindowShapeImpl() { } + + bool SetShape() + { + if ( m_win->m_wxwindow ) + SetShapeIfNonNull(gtk_widget_get_window(m_win->m_wxwindow)); + + return SetShapeIfNonNull(gtk_widget_get_window(m_win->m_widget)); + } + + // Must be overridden to indicate if the data object must stay around or if + // it can be deleted once SetShape() was called. + virtual bool CanBeDeleted() const = 0; + +protected: + wxWindow* const m_win; + +private: + // SetShape to the given GDK window by calling DoSetShape() if it's non-NULL. + bool SetShapeIfNonNull(GdkWindow* window) + { + return window && DoSetShape(window); + } + + // SetShape the shape to the given GDK window which can be either the window + // of m_widget or m_wxwindow of the wxWindow we're used with. + virtual bool DoSetShape(GdkWindow* window) = 0; + + wxDECLARE_NO_COPY_CLASS(wxNonOwnedWindowShapeImpl); +}; + +// Version not using any custom shape. +class wxNonOwnedWindowShapeImplNone : public wxNonOwnedWindowShapeImpl +{ +public: + wxNonOwnedWindowShapeImplNone(wxWindow* win) : + wxNonOwnedWindowShapeImpl(win) + { + } + + virtual bool CanBeDeleted() const { return true; } + +private: + virtual bool DoSetShape(GdkWindow* window) + { + gdk_window_shape_combine_mask(window, NULL, 0, 0); + + return true; + } +}; + +// Version using simple wxRegion. +class wxNonOwnedWindowShapeImplRegion : public wxNonOwnedWindowShapeImpl +{ +public: + wxNonOwnedWindowShapeImplRegion(wxWindow* win, const wxRegion& region) : + wxNonOwnedWindowShapeImpl(win), + m_region(region) + { + } + + virtual bool CanBeDeleted() const { return true; } + +private: + virtual bool DoSetShape(GdkWindow* window) + { + gdk_window_shape_combine_region(window, m_region.GetRegion(), 0, 0); + + return true; + } + + wxRegion m_region; +}; + +#if wxUSE_GRAPHICS_CONTEXT + +// Version using more complex wxGraphicsPath. +class wxNonOwnedWindowShapeImplPath : public wxNonOwnedWindowShapeImpl +{ +public: + wxNonOwnedWindowShapeImplPath(wxWindow* win, const wxGraphicsPath& path) : + wxNonOwnedWindowShapeImpl(win), + m_path(path), + m_mask(CreateShapeBitmap(path), *wxBLACK) + { + + m_win->Connect + ( + wxEVT_PAINT, + wxPaintEventHandler(wxNonOwnedWindowShapeImplPath::OnPaint), + NULL, + this + ); + } + + virtual ~wxNonOwnedWindowShapeImplPath() + { + m_win->Disconnect + ( + wxEVT_PAINT, + wxPaintEventHandler(wxNonOwnedWindowShapeImplPath::OnPaint), + NULL, + this + ); + } + + // Currently we always return false from here, if drawing the border + // becomes optional, we could return true if we don't need to draw it. + virtual bool CanBeDeleted() const { return false; } + +private: + wxBitmap CreateShapeBitmap(const wxGraphicsPath& path) + { + // Draw the path on a bitmap to get the mask we need. + // + // Notice that using monochrome bitmap here doesn't work because of an + // apparent wxGraphicsContext bug in wxGTK, so use a bitmap of screen + // depth even if this is wasteful. + wxBitmap bmp(m_win->GetSize()); + + wxMemoryDC dc(bmp); + + dc.SetBackground(*wxBLACK); + dc.Clear(); + + wxScopedPtr context(wxGraphicsContext::Create(dc)); + context->SetBrush(*wxWHITE); + context->FillPath(path); + + return bmp; + } + + virtual bool DoSetShape(GdkWindow *window) + { + GdkBitmap* bitmap = m_mask.GetBitmap(); + if ( !bitmap ) + return false; + + gdk_window_shape_combine_mask(window, bitmap, 0, 0); + + return true; + } + + // Draw a shaped window border. + void OnPaint(wxPaintEvent& event) + { + event.Skip(); + + wxPaintDC dc(m_win); + wxScopedPtr context(wxGraphicsContext::Create(dc)); + context->SetPen(wxPen(*wxLIGHT_GREY, 2)); + context->StrokePath(m_path); + } + + wxGraphicsPath m_path; + wxMask m_mask; +}; + +#endif // wxUSE_GRAPHICS_CONTEXT + +// ============================================================================ +// wxNonOwnedWindow implementation +// ============================================================================ + +wxNonOwnedWindow::~wxNonOwnedWindow() +{ + delete m_shapeImpl; +} + +void wxNonOwnedWindow::GTKHandleRealized() +{ + wxNonOwnedWindowBase::GTKHandleRealized(); + + if ( m_shapeImpl ) + { + m_shapeImpl->SetShape(); + + // We can destroy wxNonOwnedWindowShapeImplRegion immediately but need + // to keep wxNonOwnedWindowShapeImplPath around as it draws the border + // on every repaint. + if ( m_shapeImpl->CanBeDeleted() ) + { + delete m_shapeImpl; + m_shapeImpl = NULL; + } + } +} + +bool wxNonOwnedWindow::DoClearShape() +{ + if ( !m_shapeImpl ) + { + // Nothing to do, we don't have any custom shape. + return true; + } + + if ( gtk_widget_get_realized(m_widget) ) + { + // Reset the existing shape immediately. + wxNonOwnedWindowShapeImplNone data(this); + data.SetShape(); + } + //else: just do nothing, deleting m_shapeImpl is enough to ensure that we + // don't set the custom shape later when we're realized. + + delete m_shapeImpl; + m_shapeImpl = NULL; + + return true; +} + +bool wxNonOwnedWindow::DoSetRegionShape(const wxRegion& region) +{ + // In any case get rid of the old data. + delete m_shapeImpl; + m_shapeImpl = NULL; + + if ( gtk_widget_get_realized(m_widget) ) + { + // We can avoid an unnecessary heap allocation and just set the shape + // immediately. + wxNonOwnedWindowShapeImplRegion data(this, region); + return data.SetShape(); + } + else // Create an object that will set shape when we're realized. + { + m_shapeImpl = new wxNonOwnedWindowShapeImplRegion(this, region); + + // In general we don't know whether we are going to succeed or not, so + // be optimistic. + return true; + } +} + +#if wxUSE_GRAPHICS_CONTEXT + +bool wxNonOwnedWindow::DoSetPathShape(const wxGraphicsPath& path) +{ + // The logic here is simpler than above because we always create + // wxNonOwnedWindowShapeImplPath on the heap as we must keep it around, + // even if we're already realized + + delete m_shapeImpl; + m_shapeImpl = new wxNonOwnedWindowShapeImplPath(this, path); + + if ( gtk_widget_get_realized(m_widget) ) + { + return m_shapeImpl->SetShape(); + } + //else: will be done later from GTKHandleRealized(). + + return true; +} + +#endif // wxUSE_GRAPHICS_CONTEXT diff --git a/Externals/wxWidgets3/src/gtk/notebook.cpp b/Externals/wxWidgets3/src/gtk/notebook.cpp index 8ebb6fed28..a12ca0f1b5 100644 --- a/Externals/wxWidgets3/src/gtk/notebook.cpp +++ b/Externals/wxWidgets3/src/gtk/notebook.cpp @@ -2,7 +2,7 @@ // Name: src/gtk/notebook.cpp // Purpose: // Author: Robert Roebling -// Id: $Id: notebook.cpp 66643 2011-01-07 22:31:26Z SC $ +// Id: $Id: notebook.cpp 70112 2011-12-24 18:19:26Z VZ $ // Copyright: (c) 1998 Robert Roebling, Vadim Zeitlin // Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// @@ -277,8 +277,8 @@ bool wxNotebook::SetPageImage( size_t page, int image ) wxGtkNotebookPage* pageData = GetNotebookPage(page); if (image >= 0) { - wxCHECK_MSG(m_imageList, false, "invalid notebook imagelist"); - const wxBitmap* bitmap = m_imageList->GetBitmapPtr(image); + wxCHECK_MSG(HasImageList(), false, "invalid notebook imagelist"); + const wxBitmap* bitmap = GetImageList()->GetBitmapPtr(image); if (bitmap == NULL) return false; if (pageData->m_image) @@ -304,9 +304,34 @@ bool wxNotebook::SetPageImage( size_t page, int image ) return true; } -void wxNotebook::SetPageSize( const wxSize &WXUNUSED(size) ) +wxSize wxNotebook::CalcSizeFromPage(const wxSize& sizePage) const { - wxFAIL_MSG( wxT("wxNotebook::SetPageSize not implemented") ); + // Compute the max size of the tab labels. + wxSize sizeTabMax; + const size_t pageCount = GetPageCount(); + for ( size_t n = 0; n < pageCount; n++ ) + { + GtkRequisition req; + gtk_widget_size_request(GetNotebookPage(n)->m_box, &req); + sizeTabMax.IncTo(wxSize(req.width, req.height)); + } + + // Unfortunately this doesn't account for the real tab size and I don't + // know how to find it, e.g. where do the margins below come from. + const int PAGE_MARGIN = 3; + const int TAB_MARGIN = 4; + + sizeTabMax.IncBy(3*TAB_MARGIN); + + wxSize sizeFull(sizePage); + if ( IsVertical() ) + sizeFull.y += sizeTabMax.y; + else + sizeFull.x += sizeTabMax.x; + + sizeFull.IncBy(2*PAGE_MARGIN); + + return sizeFull; } void wxNotebook::SetPadding( const wxSize &padding ) @@ -352,8 +377,6 @@ wxNotebookPage *wxNotebook::DoRemovePage( size_t page ) if ( !client ) return NULL; - gtk_widget_unrealize( client->m_widget ); - // we don't need to unparent the client->m_widget; GTK+ will do // that for us (and will throw a warning if we do it!) gtk_notebook_remove_page( GTK_NOTEBOOK(m_widget), page ); @@ -410,15 +433,17 @@ bool wxNotebook::InsertPage( size_t position, pageData->m_image = NULL; if (imageId != -1) { - if (m_imageList) + if (HasImageList()) { - const wxBitmap* bitmap = m_imageList->GetBitmapPtr(imageId); + const wxBitmap* bitmap = GetImageList()->GetBitmapPtr(imageId); pageData->m_image = gtk_image_new_from_pixbuf(bitmap->GetPixbuf()); gtk_box_pack_start(GTK_BOX(pageData->m_box), pageData->m_image, false, false, m_padding); } else + { wxFAIL_MSG("invalid notebook imagelist"); + } } /* set the label text */ @@ -434,7 +459,7 @@ bool wxNotebook::InsertPage( size_t position, if ( style ) { gtk_widget_modify_style(pageData->m_label, style); - gtk_rc_style_unref(style); + g_object_unref(style); } if (select && GetPageCount() > 1) @@ -453,24 +478,30 @@ static bool IsPointInsideWidget(const wxPoint& pt, GtkWidget *w, gint x, gint y, gint border = 0) { + GtkAllocation a; + gtk_widget_get_allocation(w, &a); return - (pt.x >= w->allocation.x - x - border) && - (pt.x <= w->allocation.x - x + border + w->allocation.width) && - (pt.y >= w->allocation.y - y - border) && - (pt.y <= w->allocation.y - y + border + w->allocation.height); + (pt.x >= a.x - x - border) && + (pt.x <= a.x - x + border + a.width) && + (pt.y >= a.y - y - border) && + (pt.y <= a.y - y + border + a.height); } int wxNotebook::HitTest(const wxPoint& pt, long *flags) const { - const gint x = m_widget->allocation.x; - const gint y = m_widget->allocation.y; + GtkAllocation a; + gtk_widget_get_allocation(m_widget, &a); + const int x = a.x; + const int y = a.y; const size_t count = GetPageCount(); size_t i = 0; +#if !GTK_CHECK_VERSION(3,0,0) && !defined(GSEAL_ENABLE) GtkNotebook * notebook = GTK_NOTEBOOK(m_widget); if (gtk_notebook_get_scrollable(notebook)) i = g_list_position( notebook->children, notebook->first_tab ); +#endif for ( ; i < count; i++ ) { @@ -556,7 +587,7 @@ void wxNotebook::DoApplyWidgetStyle(GtkRcStyle *style) GdkWindow *wxNotebook::GTKGetWindow(wxArrayGdkWindows& windows) const { - windows.push_back(m_widget->window); + windows.push_back(gtk_widget_get_window(m_widget)); windows.push_back(GTK_NOTEBOOK(m_widget)->event_window); return NULL; diff --git a/Externals/wxWidgets3/src/gtk/pen.cpp b/Externals/wxWidgets3/src/gtk/pen.cpp index fce20a1ea3..2748925065 100644 --- a/Externals/wxWidgets3/src/gtk/pen.cpp +++ b/Externals/wxWidgets3/src/gtk/pen.cpp @@ -2,7 +2,7 @@ // Name: src/gtk/pen.cpp // Purpose: // Author: Robert Roebling -// Id: $Id: pen.cpp 58227 2009-01-19 13:55:27Z VZ $ +// Id: $Id: pen.cpp 67681 2011-05-03 16:29:04Z DS $ // Copyright: (c) 1998 Robert Roebling // Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// @@ -182,7 +182,7 @@ void wxPen::SetWidth( int width ) int wxPen::GetDashes( wxDash **ptr ) const { - wxCHECK_MSG( Ok(), -1, wxT("invalid pen") ); + wxCHECK_MSG( IsOk(), -1, wxT("invalid pen") ); *ptr = (wxDash*)M_PENDATA->m_dash; return M_PENDATA->m_countDashes; @@ -190,49 +190,49 @@ int wxPen::GetDashes( wxDash **ptr ) const int wxPen::GetDashCount() const { - wxCHECK_MSG( Ok(), -1, wxT("invalid pen") ); + wxCHECK_MSG( IsOk(), -1, wxT("invalid pen") ); return (M_PENDATA->m_countDashes); } wxDash* wxPen::GetDash() const { - wxCHECK_MSG( Ok(), NULL, wxT("invalid pen") ); + wxCHECK_MSG( IsOk(), NULL, wxT("invalid pen") ); return (wxDash*)M_PENDATA->m_dash; } wxPenCap wxPen::GetCap() const { - wxCHECK_MSG( Ok(), wxCAP_INVALID, wxT("invalid pen") ); + wxCHECK_MSG( IsOk(), wxCAP_INVALID, wxT("invalid pen") ); return M_PENDATA->m_capStyle; } wxPenJoin wxPen::GetJoin() const { - wxCHECK_MSG( Ok(), wxJOIN_INVALID, wxT("invalid pen") ); + wxCHECK_MSG( IsOk(), wxJOIN_INVALID, wxT("invalid pen") ); return M_PENDATA->m_joinStyle; } wxPenStyle wxPen::GetStyle() const { - wxCHECK_MSG( Ok(), wxPENSTYLE_INVALID, wxT("invalid pen") ); + wxCHECK_MSG( IsOk(), wxPENSTYLE_INVALID, wxT("invalid pen") ); return M_PENDATA->m_style; } int wxPen::GetWidth() const { - wxCHECK_MSG( Ok(), -1, wxT("invalid pen") ); + wxCHECK_MSG( IsOk(), -1, wxT("invalid pen") ); return M_PENDATA->m_width; } wxColour wxPen::GetColour() const { - wxCHECK_MSG( Ok(), wxNullColour, wxT("invalid pen") ); + wxCHECK_MSG( IsOk(), wxNullColour, wxT("invalid pen") ); return M_PENDATA->m_colour; } diff --git a/Externals/wxWidgets3/src/gtk/popupwin.cpp b/Externals/wxWidgets3/src/gtk/popupwin.cpp index 68d71d985e..26b11badc0 100644 --- a/Externals/wxWidgets3/src/gtk/popupwin.cpp +++ b/Externals/wxWidgets3/src/gtk/popupwin.cpp @@ -2,7 +2,7 @@ // Name: src/gtk/popupwin.cpp // Purpose: // Author: Robert Roebling -// Id: $Id: popupwin.cpp 62754 2009-12-01 16:23:48Z PC $ +// Id: $Id: popupwin.cpp 70739 2012-02-28 17:25:59Z PC $ // Copyright: (c) 1998 Robert Roebling // Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// @@ -46,7 +46,7 @@ static gint gtk_popup_button_press (GtkWidget *widget, GdkEvent *gdk_event, wxPo { if (child == widget) return FALSE; - child = child->parent; + child = gtk_widget_get_parent(child); } } @@ -73,14 +73,6 @@ bool gtk_dialog_delete_callback( GtkWidget *WXUNUSED(widget), GdkEvent *WXUNUSED } } -void wxPopupWindow::AddChildGTK(wxWindowGTK* child) -{ - gtk_widget_set_size_request( - child->m_widget, child->m_width, child->m_height); - gtk_fixed_put( - GTK_FIXED(m_wxwindow), child->m_widget, child->m_x, child->m_y); -} - //----------------------------------------------------------------------------- // wxPopupWindow //----------------------------------------------------------------------------- diff --git a/Externals/wxWidgets3/src/gtk/print.cpp b/Externals/wxWidgets3/src/gtk/print.cpp index 7fada93d7f..a1f51a3f1f 100644 --- a/Externals/wxWidgets3/src/gtk/print.cpp +++ b/Externals/wxWidgets3/src/gtk/print.cpp @@ -3,7 +3,7 @@ // Author: Anthony Bretaudeau // Purpose: GTK printing support // Created: 2007-08-25 -// RCS-ID: $Id: print.cpp 67280 2011-03-22 14:17:38Z DS $ +// RCS-ID: $Id: print.cpp 70669 2012-02-22 13:41:11Z VZ $ // Copyright: (c) 2007 wxWidgets development team // Licence: wxWindows Licence ///////////////////////////////////////////////////////////////////////////// @@ -31,7 +31,6 @@ #endif #include "wx/fontutil.h" -#include "wx/gtk/private.h" #include "wx/dynlib.h" #include "wx/paper.h" @@ -57,7 +56,7 @@ wxFORCE_LINK_THIS_MODULE(gtk_print) #include "wx/gtk/private/object.h" -// Usefull to convert angles from/to Rad to/from Deg. +// Useful to convert angles from/to Rad to/from Deg. static const double RAD2DEG = 180.0 / M_PI; static const double DEG2RAD = M_PI / 180.0; @@ -620,8 +619,6 @@ wxGtkPrintDialog::~wxGtkPrintDialog() // This is called even if we actually don't want the dialog to appear. int wxGtkPrintDialog::ShowModal() { - GtkPrintOperationResult response; - // We need to restore the settings given in the constructor. wxPrintData data = m_printDialogData.GetPrintData(); wxGtkPrintNativeData *native = @@ -655,10 +652,17 @@ int wxGtkPrintDialog::ShowModal() // Show the dialog if needed. GError* gError = NULL; - if (GetShowDialog()) - response = gtk_print_operation_run (printOp, GTK_PRINT_OPERATION_ACTION_PRINT_DIALOG, GTK_WINDOW(gtk_widget_get_toplevel(m_parent->m_widget) ), &gError); - else - response = gtk_print_operation_run (printOp, GTK_PRINT_OPERATION_ACTION_PRINT, GTK_WINDOW(gtk_widget_get_toplevel(m_parent->m_widget)), &gError); + GtkPrintOperationResult response = gtk_print_operation_run + ( + printOp, + GetShowDialog() + ? GTK_PRINT_OPERATION_ACTION_PRINT_DIALOG + : GTK_PRINT_OPERATION_ACTION_PRINT, + m_parent + ? GTK_WINDOW(gtk_widget_get_toplevel(m_parent->m_widget)) + : NULL, + &gError + ); // Does everything went well? if (response == GTK_PRINT_OPERATION_RESULT_CANCEL) @@ -667,8 +671,8 @@ int wxGtkPrintDialog::ShowModal() } else if (response == GTK_PRINT_OPERATION_RESULT_ERROR) { + wxLogError(_("Error while printing: ") + wxString(gError ? gError->message : "???")); g_error_free (gError); - wxLogError(_("Error while printing: ") + wxString::Format(_("%s"), gError->message)); return wxID_NO; // We use wxID_NO because there is no wxID_ERROR available } @@ -771,7 +775,9 @@ int wxGtkPageSetupDialog::ShowModal() title = _("Page Setup"); GtkWidget * dlg = gtk_page_setup_unix_dialog_new(title.utf8_str(), - GTK_WINDOW(m_parent->m_widget)); + m_parent + ? GTK_WINDOW(m_parent->m_widget) + : NULL); gtk_page_setup_unix_dialog_set_print_settings( GTK_PAGE_SETUP_UNIX_DIALOG(dlg), nativeData); @@ -1738,25 +1744,12 @@ void wxGtkPrinterDCImpl::DoDrawRotatedText(const wxString& text, wxCoord x, wxCo angle = -angle; - bool underlined = m_font.Ok() && m_font.GetUnderlined(); - const wxScopedCharBuffer data = text.utf8_str(); - size_t datalen = strlen(data); - pango_layout_set_text( m_layout, data, datalen); + pango_layout_set_text(m_layout, data, data.length()); - if (underlined) - { - PangoAttrList *attrs = pango_attr_list_new(); - PangoAttribute *a = pango_attr_underline_new(PANGO_UNDERLINE_SINGLE); - a->start_index = 0; - a->end_index = datalen; - pango_attr_list_insert(attrs, a); - pango_layout_set_attributes(m_layout, attrs); - pango_attr_list_unref(attrs); - } - - if (m_textForegroundColour.Ok()) + const bool setAttrs = m_font.GTKSetPangoAttrs(m_layout); + if (m_textForegroundColour.IsOk()) { unsigned char red = m_textForegroundColour.Red(); unsigned char blue = m_textForegroundColour.Blue(); @@ -1816,7 +1809,7 @@ void wxGtkPrinterDCImpl::DoDrawRotatedText(const wxString& text, wxCoord x, wxCo cairo_restore( m_cairo ); - if (underlined) + if (setAttrs) { // Undo underline attributes setting pango_layout_set_attributes(m_layout, NULL); @@ -1844,7 +1837,7 @@ void wxGtkPrinterDCImpl::SetFont( const wxFont& font ) { m_font = font; - if (m_font.Ok()) + if (m_font.IsOk()) { if (m_fontdesc) pango_font_description_free( m_fontdesc ); @@ -1861,7 +1854,7 @@ void wxGtkPrinterDCImpl::SetFont( const wxFont& font ) void wxGtkPrinterDCImpl::SetPen( const wxPen& pen ) { - if (!pen.Ok()) return; + if (!pen.IsOk()) return; m_pen = pen; @@ -1940,7 +1933,7 @@ void wxGtkPrinterDCImpl::SetPen( const wxPen& pen ) void wxGtkPrinterDCImpl::SetBrush( const wxBrush& brush ) { - if (!brush.Ok()) return; + if (!brush.IsOk()) return; m_brush = brush; @@ -2149,8 +2142,8 @@ void wxGtkPrinterDCImpl::DoGetTextExtent(const wxString& string, wxCoord *width, { // scale the font and apply it PangoFontDescription *desc = theFont->GetNativeFontInfo()->description; - float size = pango_font_description_get_size(desc); - size = size * GetFontPointSizeAdjustment(72.0); + oldSize = pango_font_description_get_size(desc); + const float size = oldSize * GetFontPointSizeAdjustment(72.0); pango_font_description_set_size(desc, (gint)size); pango_layout_set_font_description(m_layout, desc); diff --git a/Externals/wxWidgets3/src/gtk/radiobox.cpp b/Externals/wxWidgets3/src/gtk/radiobox.cpp index 715c2fdb08..267c7c9f4c 100644 --- a/Externals/wxWidgets3/src/gtk/radiobox.cpp +++ b/Externals/wxWidgets3/src/gtk/radiobox.cpp @@ -2,7 +2,7 @@ // Name: src/gtk/radiobox.cpp // Purpose: // Author: Robert Roebling -// Id: $Id: radiobox.cpp 67136 2011-03-06 18:22:23Z VS $ +// Id: $Id: radiobox.cpp 67331 2011-03-29 05:15:54Z PC $ // Copyright: (c) 1998 Robert Roebling // Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// @@ -59,7 +59,7 @@ static void gtk_radiobutton_clicked_callback( GtkToggleButton *button, wxRadioBo if (!rb->m_hasVMT) return; if (g_blockEventsOnDrag) return; - if (!button->active) return; + if (!gtk_toggle_button_get_active(button)) return; wxCommandEvent event( wxEVT_COMMAND_RADIOBOX_SELECTED, rb->GetId() ); event.SetInt( rb->GetSelection() ); @@ -379,7 +379,7 @@ int wxRadioBox::GetSelection(void) const while (node) { GtkToggleButton *button = GTK_TOGGLE_BUTTON( node->GetData()->button ); - if (button->active) return count; + if (gtk_toggle_button_get_active(button)) return count; count++; node = node->GetNext(); } @@ -397,7 +397,7 @@ wxString wxRadioBox::GetString(unsigned int n) const wxCHECK_MSG( node, wxEmptyString, wxT("radiobox wrong index") ); - GtkLabel *label = GTK_LABEL(GTK_BIN(node->GetData()->button)->child); + GtkLabel* label = GTK_LABEL(gtk_bin_get_child(GTK_BIN(node->GetData()->button))); wxString str( wxGTK_CONV_BACK( gtk_label_get_text(label) ) ); @@ -419,7 +419,7 @@ void wxRadioBox::SetString(unsigned int item, const wxString& label) wxCHECK_RET( node, wxT("radiobox wrong index") ); - GtkLabel *g_label = GTK_LABEL(GTK_BIN(node->GetData()->button)->child); + GtkLabel* g_label = GTK_LABEL(gtk_bin_get_child(GTK_BIN(node->GetData()->button))); gtk_label_set_text( g_label, wxGTK_CONV( label ) ); } @@ -433,7 +433,7 @@ bool wxRadioBox::Enable( bool enable ) while (node) { GtkButton *button = GTK_BUTTON( node->GetData()->button ); - GtkLabel *label = GTK_LABEL(GTK_BIN(button)->child); + GtkLabel *label = GTK_LABEL(gtk_bin_get_child(GTK_BIN(button))); gtk_widget_set_sensitive( GTK_WIDGET(button), enable ); gtk_widget_set_sensitive( GTK_WIDGET(label), enable ); @@ -455,7 +455,7 @@ bool wxRadioBox::Enable(unsigned int item, bool enable) wxCHECK_MSG( node, false, wxT("radiobox wrong index") ); GtkButton *button = GTK_BUTTON( node->GetData()->button ); - GtkLabel *label = GTK_LABEL(GTK_BIN(button)->child); + GtkLabel *label = GTK_LABEL(gtk_bin_get_child(GTK_BIN(button))); gtk_widget_set_sensitive( GTK_WIDGET(button), enable ); gtk_widget_set_sensitive( GTK_WIDGET(label), enable ); @@ -475,7 +475,7 @@ bool wxRadioBox::IsItemEnabled(unsigned int item) const // don't use GTK_WIDGET_IS_SENSITIVE() here, we want to return true even if // the parent radiobox is disabled - return GTK_WIDGET_SENSITIVE(GTK_WIDGET(button)); + return gtk_widget_get_sensitive(GTK_WIDGET(button)); } bool wxRadioBox::Show(unsigned int item, bool show) @@ -506,7 +506,7 @@ bool wxRadioBox::IsItemShown(unsigned int item) const GtkButton *button = GTK_BUTTON( node->GetData()->button ); - return GTK_WIDGET_VISIBLE(GTK_WIDGET(button)); + return gtk_widget_get_visible(GTK_WIDGET(button)); } unsigned int wxRadioBox::GetCount() const @@ -548,7 +548,7 @@ void wxRadioBox::DoApplyWidgetStyle(GtkRcStyle *style) GtkWidget *widget = GTK_WIDGET( node->GetData()->button ); gtk_widget_modify_style( widget, style ); - gtk_widget_modify_style(GTK_BIN(widget)->child, style); + gtk_widget_modify_style(gtk_bin_get_child(GTK_BIN(widget)), style); node = node->GetNext(); } @@ -565,7 +565,7 @@ void wxRadioBox::GTKWidgetDoSetMnemonic(GtkWidget* w) } #if wxUSE_TOOLTIPS -void wxRadioBox::GTKApplyToolTip(GtkTooltips * WXUNUSED(tips), const gchar *tip) +void wxRadioBox::GTKApplyToolTip(const char* tip) { // set this tooltip for all radiobuttons which don't have their own tips unsigned n = 0; @@ -595,7 +595,7 @@ void wxRadioBox::DoSetItemToolTip(unsigned int n, wxToolTip *tooltip) GdkWindow *wxRadioBox::GTKGetWindow(wxArrayGdkWindows& windows) const { - windows.push_back(m_widget->window); + windows.push_back(gtk_widget_get_window(m_widget)); wxRadioBoxButtonsInfoList::compatibility_iterator node = m_buttonsInfo.GetFirst(); while (node) @@ -603,8 +603,8 @@ GdkWindow *wxRadioBox::GTKGetWindow(wxArrayGdkWindows& windows) const GtkWidget *button = GTK_WIDGET( node->GetData()->button ); // don't put NULL pointers in the 'windows' array! - if (button->window) - windows.push_back(button->window); + if (gtk_widget_get_window(button)) + windows.push_back(gtk_widget_get_window(button)); node = node->GetNext(); } diff --git a/Externals/wxWidgets3/src/gtk/radiobut.cpp b/Externals/wxWidgets3/src/gtk/radiobut.cpp index eedf1d2204..78a6f2e736 100644 --- a/Externals/wxWidgets3/src/gtk/radiobut.cpp +++ b/Externals/wxWidgets3/src/gtk/radiobut.cpp @@ -2,7 +2,7 @@ // Name: src/gtk/radiobut.cpp // Purpose: // Author: Robert Roebling -// Id: $Id: radiobut.cpp 67254 2011-03-20 00:14:35Z DS $ +// Id: $Id: radiobut.cpp 67326 2011-03-28 06:27:49Z PC $ // Copyright: (c) 1998 Robert Roebling // Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// @@ -34,7 +34,7 @@ void gtk_radiobutton_clicked_callback( GtkToggleButton *button, wxRadioButton *r if (g_blockEventsOnDrag) return; - if (!button->active) return; + if (!gtk_toggle_button_get_active(button)) return; wxCommandEvent event( wxEVT_COMMAND_RADIOBUTTON_SELECTED, rb->GetId()); event.SetInt( rb->GetValue() ); @@ -102,7 +102,7 @@ void wxRadioButton::SetLabel( const wxString& label ) // save the original label wxControlBase::SetLabel(label); - GTKSetLabelForLabel(GTK_LABEL(GTK_BIN(m_widget)->child), label); + GTKSetLabelForLabel(GTK_LABEL(gtk_bin_get_child(GTK_BIN(m_widget))), label); } void wxRadioButton::SetValue( bool val ) @@ -134,7 +134,7 @@ bool wxRadioButton::GetValue() const { wxCHECK_MSG( m_widget != NULL, false, wxT("invalid radiobutton") ); - return GTK_TOGGLE_BUTTON(m_widget)->active; + return gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(m_widget)) != 0; } bool wxRadioButton::Enable( bool enable ) @@ -142,7 +142,7 @@ bool wxRadioButton::Enable( bool enable ) if (!base_type::Enable(enable)) return false; - gtk_widget_set_sensitive(GTK_BIN(m_widget)->child, enable); + gtk_widget_set_sensitive(gtk_bin_get_child(GTK_BIN(m_widget)), enable); if (enable) GTKFixSensitivity(); @@ -153,7 +153,7 @@ bool wxRadioButton::Enable( bool enable ) void wxRadioButton::DoApplyWidgetStyle(GtkRcStyle *style) { gtk_widget_modify_style(m_widget, style); - gtk_widget_modify_style(GTK_BIN(m_widget)->child, style); + gtk_widget_modify_style(gtk_bin_get_child(GTK_BIN(m_widget)), style); } GdkWindow * diff --git a/Externals/wxWidgets3/src/gtk/region.cpp b/Externals/wxWidgets3/src/gtk/region.cpp index 0ddde4ec8d..6832d60d7b 100644 --- a/Externals/wxWidgets3/src/gtk/region.cpp +++ b/Externals/wxWidgets3/src/gtk/region.cpp @@ -3,7 +3,7 @@ // Purpose: // Author: Robert Roebling // Modified: VZ at 05.10.00: use AllocExclusive(), comparison fixed -// Id: $Id: region.cpp 61724 2009-08-21 10:41:26Z VZ $ +// Id: $Id: region.cpp 69817 2011-11-25 01:01:26Z PC $ // Copyright: (c) 1998 Robert Roebling // Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// @@ -179,26 +179,24 @@ bool wxRegion::DoUnionWithRect(const wxRect& r) bool wxRegion::DoUnionWithRegion( const wxRegion& region ) { - wxCHECK_MSG( region.Ok(), false, wxT("invalid region") ); + wxCHECK_MSG( region.IsOk(), false, wxT("invalid region") ); if (!m_refData) { - m_refData = new wxRegionRefData(); - M_REGIONDATA->m_region = gdk_region_new(); + m_refData = new wxRegionRefData(*M_REGIONDATA_OF(region)); } else { AllocExclusive(); + gdk_region_union( M_REGIONDATA->m_region, region.GetRegion() ); } - gdk_region_union( M_REGIONDATA->m_region, region.GetRegion() ); - return true; } bool wxRegion::DoIntersect( const wxRegion& region ) { - wxCHECK_MSG( region.Ok(), false, wxT("invalid region") ); + wxCHECK_MSG( region.IsOk(), false, wxT("invalid region") ); if (!m_refData) { @@ -215,7 +213,7 @@ bool wxRegion::DoIntersect( const wxRegion& region ) bool wxRegion::DoSubtract( const wxRegion& region ) { - wxCHECK_MSG( region.Ok(), false, wxT("invalid region") ); + wxCHECK_MSG( region.IsOk(), false, wxT("invalid region") ); if (!m_refData) { @@ -232,24 +230,27 @@ bool wxRegion::DoSubtract( const wxRegion& region ) bool wxRegion::DoXor( const wxRegion& region ) { - wxCHECK_MSG( region.Ok(), false, wxT("invalid region") ); + wxCHECK_MSG( region.IsOk(), false, wxT("invalid region") ); if (!m_refData) { - return false; + // XOR-ing with an invalid region is the same as XOR-ing with an empty + // one, i.e. it is simply a copy. + m_refData = new wxRegionRefData(*M_REGIONDATA_OF(region)); } + else + { + AllocExclusive(); - AllocExclusive(); - - gdk_region_xor( M_REGIONDATA->m_region, region.GetRegion() ); + gdk_region_xor( M_REGIONDATA->m_region, region.GetRegion() ); + } return true; } bool wxRegion::DoOffset( wxCoord x, wxCoord y ) { - if (!m_refData) - return false; + wxCHECK_MSG( m_refData, false, wxS("invalid region") ); AllocExclusive(); @@ -369,15 +370,13 @@ void wxRegionIterator::CreateRects( const wxRegion& region ) if (!gdkregion) return; - GdkRectangle *gdkrects = NULL; - gint numRects = 0; - gdk_region_get_rectangles( gdkregion, &gdkrects, &numRects ); + GdkRectangle* gdkrects; + gdk_region_get_rectangles(gdkregion, &gdkrects, &m_numRects); - m_numRects = numRects; - if (numRects) + if (m_numRects) { m_rects = new wxRect[m_numRects]; - for (size_t i=0; i < m_numRects; ++i) + for (int i = 0; i < m_numRects; ++i) { GdkRectangle &gr = gdkrects[i]; wxRect &wr = m_rects[i]; @@ -459,20 +458,17 @@ wxRect wxRegionIterator::GetRect() const wxRegionIterator& wxRegionIterator::operator=(const wxRegionIterator& ri) { - wxDELETEA(m_rects); - - m_current = ri.m_current; - m_numRects = ri.m_numRects; - if ( m_numRects ) + if (this != &ri) { - m_rects = new wxRect[m_numRects]; - for ( unsigned int n = 0; n < m_numRects; n++ ) - m_rects[n] = ri.m_rects[n]; - } - else - { - m_rects = NULL; - } + wxDELETEA(m_rects); + m_current = ri.m_current; + m_numRects = ri.m_numRects; + if ( m_numRects ) + { + m_rects = new wxRect[m_numRects]; + memcpy(m_rects, ri.m_rects, m_numRects * sizeof m_rects[0]); + } + } return *this; } diff --git a/Externals/wxWidgets3/src/gtk/renderer.cpp b/Externals/wxWidgets3/src/gtk/renderer.cpp index a233bc14dc..f3bb23681a 100644 --- a/Externals/wxWidgets3/src/gtk/renderer.cpp +++ b/Externals/wxWidgets3/src/gtk/renderer.cpp @@ -4,7 +4,7 @@ // Author: Vadim Zeitlin // Modified by: // Created: 20.07.2003 -// RCS-ID: $Id: renderer.cpp 67280 2011-03-22 14:17:38Z DS $ +// RCS-ID: $Id: renderer.cpp 69741 2011-11-12 16:50:37Z PC $ // Copyright: (c) 2003 Vadim Zeitlin // Licence: wxWindows licence /////////////////////////////////////////////////////////////////////////////// @@ -205,7 +205,7 @@ wxRendererGTK::DrawHeaderButton(wxWindow *win, gtk_paint_box ( - button->style, + gtk_widget_get_style(button), gdk_window, state, GTK_SHADOW_OUT, @@ -256,18 +256,17 @@ wxRendererGTK::DrawTreeItemButton(wxWindow* win, if (win->GetLayoutDirection() == wxLayout_RightToLeft) x_diff = rect.width; - // VZ: I don't know how to get the size of the expander so as to centre it - // in the given rectangle, +2/3 below is just what looks good here... + // x and y parameters specify the center of the expander gtk_paint_expander ( - tree->style, + gtk_widget_get_style(tree), gdk_window, state, NULL, tree, "treeview", - dc.LogicalToDeviceX(rect.x) + 6 - x_diff, - dc.LogicalToDeviceY(rect.y) + 3, + dc.LogicalToDeviceX(rect.x) + rect.width / 2 - x_diff, + dc.LogicalToDeviceY(rect.y) + rect.height / 2, flags & wxCONTROL_EXPANDED ? GTK_EXPANDER_EXPANDED : GTK_EXPANDER_COLLAPSED ); @@ -315,7 +314,7 @@ wxRendererGTK::DrawSplitterSash(wxWindow* win, wxOrientation orient, int flags) { - if ( !win->m_wxwindow->window ) + if (gtk_widget_get_window(win->m_wxwindow) == NULL) { // window not realized yet return; @@ -353,7 +352,7 @@ wxRendererGTK::DrawSplitterSash(wxWindow* win, gtk_paint_handle ( - win->m_wxwindow->style, + gtk_widget_get_style(win->m_wxwindow), gdk_window, flags & wxCONTROL_CURRENT ? GTK_STATE_PRELIGHT : GTK_STATE_NORMAL, GTK_SHADOW_NONE, @@ -409,7 +408,7 @@ wxRendererGTK::DrawDropArrow(wxWindow* win, // draw arrow on button gtk_paint_arrow ( - button->style, + gtk_widget_get_style(button), gdk_window, state, flags & wxCONTROL_PRESSED ? GTK_SHADOW_IN : GTK_SHADOW_OUT, @@ -488,7 +487,7 @@ wxRendererGTK::DrawCheckBox(wxWindow* win, gtk_paint_check ( - button->style, + gtk_widget_get_style(button), gdk_window, state, shadow_type, @@ -527,7 +526,7 @@ wxRendererGTK::DrawPushButton(wxWindow* win, gtk_paint_box ( - button->style, + gtk_widget_get_style(button), gdk_window, state, flags & wxCONTROL_PRESSED ? GTK_SHADOW_IN : GTK_SHADOW_OUT, @@ -559,7 +558,7 @@ wxRendererGTK::DrawItemSelectionRect(wxWindow* win, // the wxCONTROL_FOCUSED state is deduced // directly from the m_wxwindow by GTK+ - gtk_paint_flat_box(wxGTKPrivate::GetTreeWidget()->style, + gtk_paint_flat_box(gtk_widget_get_style(wxGTKPrivate::GetTreeWidget()), gdk_window, GTK_STATE_SELECTED, GTK_SHADOW_NONE, @@ -588,7 +587,7 @@ void wxRendererGTK::DrawFocusRect(wxWindow* win, wxDC& dc, const wxRect& rect, i else state = GTK_STATE_NORMAL; - gtk_paint_focus( win->m_widget->style, + gtk_paint_focus( gtk_widget_get_style(win->m_widget), gdk_window, state, NULL, @@ -611,14 +610,11 @@ void wxRendererGTK::DrawTextCtrl(wxWindow* win, wxDC& dc, const wxRect& rect, in if ( flags & wxCONTROL_DISABLED ) state = GTK_STATE_INSENSITIVE; - if (flags & wxCONTROL_CURRENT ) - GTK_WIDGET_SET_FLAGS( entry, GTK_HAS_FOCUS ); - else - GTK_WIDGET_UNSET_FLAGS( entry, GTK_HAS_FOCUS ); + gtk_widget_set_can_focus(entry, (flags & wxCONTROL_CURRENT) != 0); gtk_paint_shadow ( - entry->style, + gtk_widget_get_style(entry), gdk_window, state, GTK_SHADOW_OUT, @@ -643,14 +639,11 @@ void wxRendererGTK::DrawComboBox(wxWindow* win, wxDC& dc, const wxRect& rect, in if ( flags & wxCONTROL_DISABLED ) state = GTK_STATE_INSENSITIVE; - if (flags & wxCONTROL_CURRENT ) - GTK_WIDGET_SET_FLAGS( combo, GTK_HAS_FOCUS ); - else - GTK_WIDGET_UNSET_FLAGS( combo, GTK_HAS_FOCUS ); + gtk_widget_set_can_focus(combo, (flags & wxCONTROL_CURRENT) != 0); gtk_paint_shadow ( - combo->style, + gtk_widget_get_style(combo), gdk_window, state, GTK_SHADOW_OUT, @@ -672,7 +665,7 @@ void wxRendererGTK::DrawComboBox(wxWindow* win, wxDC& dc, const wxRect& rect, in gtk_paint_arrow ( - combo->style, + gtk_widget_get_style(combo), gdk_window, state, GTK_SHADOW_OUT, @@ -693,7 +686,7 @@ void wxRendererGTK::DrawComboBox(wxWindow* win, wxDC& dc, const wxRect& rect, in gtk_paint_box ( - combo->style, + gtk_widget_get_style(combo), gdk_window, state, GTK_SHADOW_ETCHED_OUT, @@ -740,7 +733,7 @@ void wxRendererGTK::DrawRadioBitmap(wxWindow* win, wxDC& dc, const wxRect& rect, gtk_paint_option ( - button->style, + gtk_widget_get_style(button), gdk_window, state, shadow_type, diff --git a/Externals/wxWidgets3/src/gtk/scrolbar.cpp b/Externals/wxWidgets3/src/gtk/scrolbar.cpp index c5df1186b3..87e5615a33 100644 --- a/Externals/wxWidgets3/src/gtk/scrolbar.cpp +++ b/Externals/wxWidgets3/src/gtk/scrolbar.cpp @@ -2,7 +2,7 @@ // Name: src/gtk/scrolbar.cpp // Purpose: // Author: Robert Roebling -// Id: $Id: scrolbar.cpp 66555 2011-01-04 08:31:53Z SC $ +// Id: $Id: scrolbar.cpp 67326 2011-03-28 06:27:49Z PC $ // Copyright: (c) 1998 Robert Roebling // Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// @@ -167,26 +167,25 @@ bool wxScrollBar::Create(wxWindow *parent, wxWindowID id, int wxScrollBar::GetThumbPosition() const { - GtkAdjustment* adj = ((GtkRange*)m_widget)->adjustment; - return int(adj->value + 0.5); + return wxRound(gtk_range_get_value(GTK_RANGE(m_widget))); } int wxScrollBar::GetThumbSize() const { - GtkAdjustment* adj = ((GtkRange*)m_widget)->adjustment; - return int(adj->page_size); + GtkAdjustment* adj = gtk_range_get_adjustment(GTK_RANGE(m_widget)); + return int(gtk_adjustment_get_page_size(adj)); } int wxScrollBar::GetPageSize() const { - GtkAdjustment* adj = ((GtkRange*)m_widget)->adjustment; - return int(adj->page_increment); + GtkAdjustment* adj = gtk_range_get_adjustment(GTK_RANGE(m_widget)); + return int(gtk_adjustment_get_page_increment(adj)); } int wxScrollBar::GetRange() const { - GtkAdjustment* adj = ((GtkRange*)m_widget)->adjustment; - return int(adj->upper); + GtkAdjustment* adj = gtk_range_get_adjustment(GTK_RANGE(m_widget)); + return int(gtk_adjustment_get_upper(adj)); } void wxScrollBar::SetThumbPosition( int viewStart ) @@ -212,14 +211,13 @@ void wxScrollBar::SetScrollbar(int position, int thumbSize, int range, int pageS range = thumbSize = 1; } - GtkAdjustment* adj = ((GtkRange*)m_widget)->adjustment; - adj->step_increment = 1; - adj->page_increment = pageSize; - adj->page_size = thumbSize; - adj->value = position; g_signal_handlers_block_by_func(m_widget, (void*)gtk_value_changed, this); - gtk_range_set_range((GtkRange*)m_widget, 0, range); - m_scrollPos[0] = adj->value; + GtkRange* widget = GTK_RANGE(m_widget); + gtk_adjustment_set_page_size(gtk_range_get_adjustment(widget), thumbSize); + gtk_range_set_increments(widget, 1, pageSize); + gtk_range_set_range(widget, 0, range); + gtk_range_set_value(widget, position); + m_scrollPos[0] = gtk_range_get_value(widget); g_signal_handlers_unblock_by_func(m_widget, (void*)gtk_value_changed, this); } @@ -233,11 +231,6 @@ void wxScrollBar::SetRange(int range) SetScrollbar(GetThumbPosition(), GetThumbSize(), range, GetPageSize()); } -GdkWindow *wxScrollBar::GTKGetWindow(wxArrayGdkWindows& WXUNUSED(windows)) const -{ - return m_widget->window; -} - // static wxVisualAttributes wxScrollBar::GetClassDefaultAttributes(wxWindowVariant WXUNUSED(variant)) diff --git a/Externals/wxWidgets3/src/gtk/scrolwin.cpp b/Externals/wxWidgets3/src/gtk/scrolwin.cpp index 363cb56312..9a50e5dc12 100644 --- a/Externals/wxWidgets3/src/gtk/scrolwin.cpp +++ b/Externals/wxWidgets3/src/gtk/scrolwin.cpp @@ -5,7 +5,7 @@ // Modified by: Ron Lee // Vadim Zeitlin: removed 90% of duplicated common code // Created: 01/02/97 -// RCS-ID: $Id: scrolwin.cpp 67254 2011-03-20 00:14:35Z DS $ +// RCS-ID: $Id: scrolwin.cpp 68121 2011-07-01 17:44:49Z PC $ // Copyright: (c) Robert Roebling // Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// @@ -20,6 +20,7 @@ #include "wx/scrolwin.h" #include +#include "wx/gtk/private/gtk2-compat.h" // ---------------------------------------------------------------------------- // wxScrollHelper implementation @@ -30,10 +31,10 @@ void wxScrollHelper::SetScrollbars(int pixelsPerUnitX, int pixelsPerUnitY, int xPos, int yPos, bool noRefresh) { - m_win->m_scrollPos[wxWindow::ScrollDir_Horz] = - m_win->m_scrollBar[wxWindow::ScrollDir_Horz]->adjustment->value = xPos; - m_win->m_scrollPos[wxWindow::ScrollDir_Vert] = - m_win->m_scrollBar[wxWindow::ScrollDir_Vert]->adjustment->value = yPos; + // prevent programmatic position changes from causing scroll events + m_win->SetScrollPos(wxHORIZONTAL, xPos); + m_win->SetScrollPos(wxVERTICAL, yPos); + base_type::SetScrollbars( pixelsPerUnitX, pixelsPerUnitY, noUnitsX, noUnitsY, xPos, yPos, noRefresh); } @@ -68,10 +69,8 @@ void wxScrollHelper::DoAdjustScrollbar(GtkRange* range, *linesPerPage = 0; } - GtkAdjustment* adj = range->adjustment; - adj->step_increment = 1; - adj->page_increment = - adj->page_size = page_size; + gtk_range_set_increments(range, 1, page_size); + gtk_adjustment_set_page_size(gtk_range_get_adjustment(range), page_size); gtk_range_set_range(range, 0, upper); // ensure that the scroll position is always in valid range diff --git a/Externals/wxWidgets3/src/gtk/settings.cpp b/Externals/wxWidgets3/src/gtk/settings.cpp index e28d6ec8c9..9544fb9bc5 100644 --- a/Externals/wxWidgets3/src/gtk/settings.cpp +++ b/Externals/wxWidgets3/src/gtk/settings.cpp @@ -3,7 +3,7 @@ // Purpose: // Author: Robert Roebling // Modified by: Mart Raudsepp (GetMetric) -// Id: $Id: settings.cpp 67018 2011-02-25 09:38:35Z JS $ +// Id: $Id: settings.cpp 67681 2011-05-03 16:29:04Z DS $ // Copyright: (c) 1998 Robert Roebling // Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// @@ -22,6 +22,7 @@ #include #include "wx/gtk/private/win_gtk.h" +#include "wx/gtk/private/gtk2-compat.h" bool wxGetFrameExtents(GdkWindow* window, int* left, int* right, int* top, int* bottom); @@ -60,7 +61,7 @@ static const GtkStyle* ButtonStyle() gtk_widget_ensure_style(s_widget); g_signal_connect(s_widget, "style_set", G_CALLBACK(style_set), NULL); } - return s_widget->style; + return gtk_widget_get_style(s_widget); } static const GtkStyle* ListStyle() @@ -73,7 +74,7 @@ static const GtkStyle* ListStyle() gtk_container_add(ContainerWidget(), s_widget); gtk_widget_ensure_style(s_widget); } - return s_widget->style; + return gtk_widget_get_style(s_widget); } static const GtkStyle* TextCtrlStyle() @@ -85,7 +86,7 @@ static const GtkStyle* TextCtrlStyle() gtk_container_add(ContainerWidget(), s_widget); gtk_widget_ensure_style(s_widget); } - return s_widget->style; + return gtk_widget_get_style(s_widget); } static const GtkStyle* MenuItemStyle() @@ -97,7 +98,7 @@ static const GtkStyle* MenuItemStyle() gtk_container_add(ContainerWidget(), s_widget); gtk_widget_ensure_style(s_widget); } - return s_widget->style; + return gtk_widget_get_style(s_widget); } static const GtkStyle* MenuBarStyle() @@ -109,7 +110,7 @@ static const GtkStyle* MenuBarStyle() gtk_container_add(ContainerWidget(), s_widget); gtk_widget_ensure_style(s_widget); } - return s_widget->style; + return gtk_widget_get_style(s_widget); } static const GtkStyle* ToolTipStyle() @@ -124,7 +125,7 @@ static const GtkStyle* ToolTipStyle() gtk_widget_set_name(s_widget, name); gtk_widget_ensure_style(s_widget); } - return s_widget->style; + return gtk_widget_get_style(s_widget); } wxColour wxSystemSettingsNative::GetColour( wxSystemColour index ) @@ -257,7 +258,7 @@ wxFont wxSystemSettingsNative::GetFont( wxSystemFont index ) case wxSYS_SYSTEM_FONT: case wxSYS_DEVICE_DEFAULT_FONT: case wxSYS_DEFAULT_GUI_FONT: - if (!gs_fontSystem.Ok()) + if (!gs_fontSystem.IsOk()) { wxNativeFontInfo info; info.description = ButtonStyle()->font_desc; @@ -316,8 +317,8 @@ static int GetBorderWidth(wxSystemMetric index, wxWindow* win) int wxSystemSettingsNative::GetMetric( wxSystemMetric index, wxWindow* win ) { GdkWindow *window = NULL; - if(win && GTK_WIDGET_REALIZED(win->GetHandle())) - window = win->GetHandle()->window; + if (win) + window = gtk_widget_get_window(win->GetHandle()); switch (index) { diff --git a/Externals/wxWidgets3/src/gtk/slider.cpp b/Externals/wxWidgets3/src/gtk/slider.cpp index 92b3a46990..694184cf3d 100644 --- a/Externals/wxWidgets3/src/gtk/slider.cpp +++ b/Externals/wxWidgets3/src/gtk/slider.cpp @@ -2,7 +2,7 @@ // Name: src/gtk/slider.cpp // Purpose: // Author: Robert Roebling -// Id: $Id: slider.cpp 66555 2011-01-04 08:31:53Z SC $ +// Id: $Id: slider.cpp 70756 2012-02-29 18:29:31Z PC $ // Copyright: (c) 1998 Robert Roebling // Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// @@ -20,6 +20,7 @@ #endif #include +#include "wx/gtk/private/gtk2-compat.h" //----------------------------------------------------------------------------- // data @@ -124,10 +125,9 @@ extern "C" { static void gtk_value_changed(GtkRange* range, wxSlider* win) { - GtkAdjustment* adj = gtk_range_get_adjustment (range); - const int pos = wxRound(adj->value); + const double value = gtk_range_get_value(range); const double oldPos = win->m_pos; - win->m_pos = adj->value; + win->m_pos = value; if (!win->m_hasVMT || g_blockEventsOnDrag) return; @@ -151,18 +151,19 @@ gtk_value_changed(GtkRange* range, wxSlider* win) else if (win->m_mouseButtonDown) { // Difference from last change event - const double diff = adj->value - oldPos; + const double diff = value - oldPos; const bool isDown = diff > 0; - if (IsScrollIncrement(adj->page_increment, diff)) + GtkAdjustment* adj = gtk_range_get_adjustment(range); + if (IsScrollIncrement(gtk_adjustment_get_page_increment(adj), diff)) { eventType = isDown ? wxEVT_SCROLL_PAGEDOWN : wxEVT_SCROLL_PAGEUP; } - else if (wxIsSameDouble(adj->value, 0)) + else if (wxIsSameDouble(value, 0)) { eventType = wxEVT_SCROLL_PAGEUP; } - else if (wxIsSameDouble(adj->value, adj->upper)) + else if (wxIsSameDouble(value, gtk_adjustment_get_upper(adj))) { eventType = wxEVT_SCROLL_PAGEDOWN; } @@ -178,7 +179,7 @@ gtk_value_changed(GtkRange* range, wxSlider* win) win->m_scrollEventType = GTK_SCROLL_NONE; // If integral position has changed - if (wxRound(oldPos) != pos) + if (wxRound(oldPos) != wxRound(value)) { ProcessScrollEvent(win, eventType); win->m_needThumbRelease = eventType == wxEVT_SCROLL_THUMBTRACK; @@ -317,7 +318,6 @@ bool wxSlider::Create(wxWindow *parent, else m_widget = gtk_vbox_new(false, 0); g_object_ref(m_widget); - gtk_widget_show( m_widget ); gtk_container_add( GTK_CONTAINER(m_widget), m_scale ); GtkWidget *box; @@ -438,6 +438,8 @@ void wxSlider::GTKSetValue(int value) { GTKDisableEvents(); gtk_range_set_value(GTK_RANGE (m_scale), value); + // GTK only updates value label if handle moves at least 1 pixel + gtk_widget_queue_draw(m_scale); GTKEnableEvents(); } @@ -471,12 +473,14 @@ void wxSlider::SetRange( int minValue, int maxValue ) int wxSlider::GetMin() const { - return int(gtk_range_get_adjustment (GTK_RANGE (m_scale))->lower); + GtkAdjustment* adj = gtk_range_get_adjustment(GTK_RANGE(m_scale)); + return int(gtk_adjustment_get_lower(adj)); } int wxSlider::GetMax() const { - return int(gtk_range_get_adjustment (GTK_RANGE (m_scale))->upper); + GtkAdjustment* adj = gtk_range_get_adjustment(GTK_RANGE(m_scale)); + return int(gtk_adjustment_get_upper(adj)); } void wxSlider::SetPageSize( int pageSize ) @@ -488,7 +492,8 @@ void wxSlider::SetPageSize( int pageSize ) int wxSlider::GetPageSize() const { - return int(gtk_range_get_adjustment (GTK_RANGE (m_scale))->page_increment); + GtkAdjustment* adj = gtk_range_get_adjustment(GTK_RANGE(m_scale)); + return int(gtk_adjustment_get_page_increment(adj)); } // GTK does not support changing the size of the slider @@ -510,7 +515,8 @@ void wxSlider::SetLineSize( int lineSize ) int wxSlider::GetLineSize() const { - return int(gtk_range_get_adjustment (GTK_RANGE (m_scale))->step_increment); + GtkAdjustment* adj = gtk_range_get_adjustment(GTK_RANGE(m_scale)); + return int(gtk_adjustment_get_step_increment(adj)); } GdkWindow *wxSlider::GTKGetWindow(wxArrayGdkWindows& WXUNUSED(windows)) const diff --git a/Externals/wxWidgets3/src/gtk/sockgtk.cpp b/Externals/wxWidgets3/src/gtk/sockgtk.cpp index 62ac793e29..5ba3ab13b9 100644 --- a/Externals/wxWidgets3/src/gtk/sockgtk.cpp +++ b/Externals/wxWidgets3/src/gtk/sockgtk.cpp @@ -3,7 +3,7 @@ // Purpose: implementation of wxGTK-specific socket event handling // Author: Guilhem Lavaux, Vadim Zeitlin // Created: 1999 -// RCS-ID: $Id: sockgtk.cpp 67254 2011-03-20 00:14:35Z DS $ +// RCS-ID: $Id: sockgtk.cpp 67326 2011-03-28 06:27:49Z PC $ // Copyright: (c) 1999, 2007 wxWidgets dev team // (c) 2009 Vadim Zeitlin // Licence: wxWindows licence @@ -17,17 +17,14 @@ #include "wx/apptrait.h" #include "wx/private/fdiomanager.h" -#include +#include extern "C" { -static -void wxSocket_GDK_Input(gpointer data, - gint WXUNUSED(source), - GdkInputCondition condition) +static gboolean wxSocket_Input(GIOChannel*, GIOCondition condition, gpointer data) { wxFDIOHandler * const handler = static_cast(data); - if ( condition & GDK_INPUT_READ ) + if (condition & G_IO_IN) { handler->OnReadWaiting(); @@ -35,11 +32,13 @@ void wxSocket_GDK_Input(gpointer data, // shouldn't call OnWriteWaiting() as the socket is now closed and it // would assert if ( !handler->IsOk() ) - return; + return true; } - if ( condition & GDK_INPUT_WRITE ) + if (condition & G_IO_OUT) handler->OnWriteWaiting(); + + return true; } } @@ -48,19 +47,17 @@ class GTKFDIOManager : public wxFDIOManager public: virtual int AddInput(wxFDIOHandler *handler, int fd, Direction d) { - return gdk_input_add - ( - fd, - d == OUTPUT ? GDK_INPUT_WRITE : GDK_INPUT_READ, - wxSocket_GDK_Input, - handler - ); + return g_io_add_watch( + g_io_channel_unix_new(fd), + d == OUTPUT ? G_IO_OUT : G_IO_IN, + wxSocket_Input, + handler); } virtual void RemoveInput(wxFDIOHandler* WXUNUSED(handler), int fd, Direction WXUNUSED(d)) { - gdk_input_remove(fd); + g_source_remove(fd); } }; diff --git a/Externals/wxWidgets3/src/gtk/spinctrl.cpp b/Externals/wxWidgets3/src/gtk/spinctrl.cpp index 48ff350c70..a1f3f0f9dd 100644 --- a/Externals/wxWidgets3/src/gtk/spinctrl.cpp +++ b/Externals/wxWidgets3/src/gtk/spinctrl.cpp @@ -3,7 +3,7 @@ // Purpose: wxSpinCtrl // Author: Robert // Modified by: -// RCS-ID: $Id: spinctrl.cpp 67254 2011-03-20 00:14:35Z DS $ +// RCS-ID: $Id: spinctrl.cpp 67326 2011-03-28 06:27:49Z PC $ // Copyright: (c) Robert Roebling // Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// @@ -152,12 +152,14 @@ double wxSpinCtrlGTKBase::DoGetValue() const g_signal_emit(m_widget, sig_id, 0, &value, &handled); if (!handled) value = g_strtod(gtk_entry_get_text(GTK_ENTRY(m_widget)), NULL); - const GtkAdjustment* adj = + GtkAdjustment* adj = gtk_spin_button_get_adjustment(GTK_SPIN_BUTTON(m_widget)); - if (value < adj->lower) - value = adj->lower; - else if (value > adj->upper) - value = adj->upper; + const double lower = gtk_adjustment_get_lower(adj); + const double upper = gtk_adjustment_get_upper(adj); + if (value < lower) + value = lower; + else if (value > upper) + value = upper; return value; } @@ -297,7 +299,7 @@ void wxSpinCtrlGTKBase::OnChar( wxKeyEvent &event ) GtkWindow *window = GTK_WINDOW(top_frame->m_widget); if ( window ) { - GtkWidget *widgetDef = window->default_widget; + GtkWidget* widgetDef = gtk_window_get_default_widget(window); if ( widgetDef ) { diff --git a/Externals/wxWidgets3/src/gtk/statbmp.cpp b/Externals/wxWidgets3/src/gtk/statbmp.cpp index 115f3627ee..6ef20ec877 100644 --- a/Externals/wxWidgets3/src/gtk/statbmp.cpp +++ b/Externals/wxWidgets3/src/gtk/statbmp.cpp @@ -2,7 +2,7 @@ // Name: src/gtk/statbmp.cpp // Purpose: // Author: Robert Roebling -// Id: $Id: statbmp.cpp 67254 2011-03-20 00:14:35Z DS $ +// Id: $Id: statbmp.cpp 67681 2011-05-03 16:29:04Z DS $ // Copyright: (c) 1998 Robert Roebling // Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// @@ -47,7 +47,7 @@ bool wxStaticBitmap::Create( wxWindow *parent, wxWindowID id, const wxBitmap &bi m_widget = gtk_image_new(); g_object_ref(m_widget); - if (bitmap.Ok()) + if (bitmap.IsOk()) SetBitmap(bitmap); PostCreation(size); @@ -60,7 +60,7 @@ void wxStaticBitmap::SetBitmap( const wxBitmap &bitmap ) { m_bitmap = bitmap; - if (m_bitmap.Ok()) + if (m_bitmap.IsOk()) { // always use pixbuf, because pixmap mask does not // work with disabled images in some themes diff --git a/Externals/wxWidgets3/src/gtk/statbox.cpp b/Externals/wxWidgets3/src/gtk/statbox.cpp index 4f2e9d88d6..da884716f9 100644 --- a/Externals/wxWidgets3/src/gtk/statbox.cpp +++ b/Externals/wxWidgets3/src/gtk/statbox.cpp @@ -2,7 +2,7 @@ // Name: src/gtk/statbox.cpp // Purpose: // Author: Robert Roebling -// Id: $Id: statbox.cpp 67254 2011-03-20 00:14:35Z DS $ +// Id: $Id: statbox.cpp 67326 2011-03-28 06:27:49Z PC $ // Copyright: (c) 1998 Robert Roebling // Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// @@ -16,6 +16,7 @@ #include "wx/gtk/private/win_gtk.h" // for wxPizza #include +#include "wx/gtk/private/gtk2-compat.h" // constants taken from GTK sources #define LABEL_PAD 1 @@ -31,15 +32,16 @@ static void size_allocate(GtkWidget* widget, GtkAllocation* alloc, void*) // clip label as GTK >= 2.12 does GtkWidget* label_widget = gtk_frame_get_label_widget(GTK_FRAME(widget)); int w = alloc->width - - 2 * widget->style->xthickness - 2 * LABEL_PAD - 2 * LABEL_SIDE_PAD; + 2 * gtk_widget_get_style(widget)->xthickness - 2 * LABEL_PAD - 2 * LABEL_SIDE_PAD; if (w < 0) w = 0; - if (label_widget->allocation.width > w) + GtkAllocation a; + gtk_widget_get_allocation(label_widget, &a); + if (a.width > w) { - GtkAllocation alloc2 = label_widget->allocation; - alloc2.width = w; - gtk_widget_size_allocate(label_widget, &alloc2); + a.width = w; + gtk_widget_size_allocate(label_widget, &a); } } } diff --git a/Externals/wxWidgets3/src/gtk/stattext.cpp b/Externals/wxWidgets3/src/gtk/stattext.cpp index d152499e2b..ff4bd25251 100644 --- a/Externals/wxWidgets3/src/gtk/stattext.cpp +++ b/Externals/wxWidgets3/src/gtk/stattext.cpp @@ -2,7 +2,7 @@ // Name: src/gtk/stattext.cpp // Purpose: // Author: Robert Roebling -// Id: $Id: stattext.cpp 67254 2011-03-20 00:14:35Z DS $ +// Id: $Id: stattext.cpp 70446 2012-01-23 11:28:28Z VZ $ // Copyright: (c) 1998 Robert Roebling // Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// @@ -153,31 +153,48 @@ bool wxStaticText::DoSetLabelMarkup(const wxString& markup) bool wxStaticText::SetFont( const wxFont &font ) { const bool wasUnderlined = GetFont().GetUnderlined(); + const bool wasStrickenThrough = GetFont().GetStrikethrough(); bool ret = wxControl::SetFont(font); - if ( font.GetUnderlined() != wasUnderlined ) - { - // the underlines for mnemonics are incompatible with using attributes - // so turn them off when setting underlined font and restore them when - // unsetting it - gtk_label_set_use_underline(GTK_LABEL(m_widget), wasUnderlined); + const bool isUnderlined = GetFont().GetUnderlined(); + const bool isStrickenThrough = GetFont().GetStrikethrough(); - if ( wasUnderlined ) + if ( (isUnderlined != wasUnderlined) || + (isStrickenThrough != wasStrickenThrough) ) + { + // We need to update the Pango attributes used for the text. + if ( isUnderlined || isStrickenThrough ) { - // it's not underlined any more, remove the attributes we set - gtk_label_set_attributes(GTK_LABEL(m_widget), NULL); - } - else // the text is underlined now - { - PangoAttrList *attrs = pango_attr_list_new(); - PangoAttribute *a = pango_attr_underline_new(PANGO_UNDERLINE_SINGLE); - a->start_index = 0; - a->end_index = (guint)-1; - pango_attr_list_insert(attrs, a); + PangoAttrList* const attrs = pango_attr_list_new(); + if ( isUnderlined ) + { + PangoAttribute *a = pango_attr_underline_new(PANGO_UNDERLINE_SINGLE); + a->start_index = 0; + a->end_index = (guint)-1; + pango_attr_list_insert(attrs, a); + } + + if ( isStrickenThrough ) + { + PangoAttribute *a = pango_attr_strikethrough_new( TRUE ); + a->start_index = 0; + a->end_index = (guint) -1; + pango_attr_list_insert(attrs, a); + } + gtk_label_set_attributes(GTK_LABEL(m_widget), attrs); pango_attr_list_unref(attrs); } + else // No special attributes any more. + { + // Just remove any attributes we had set. + gtk_label_set_attributes(GTK_LABEL(m_widget), NULL); + } + + // The underlines for mnemonics are incompatible with using attributes + // so turn them off when setting underlined font. + gtk_label_set_use_underline(GTK_LABEL(m_widget), !isUnderlined); } // adjust the label size to the new label unless disabled diff --git a/Externals/wxWidgets3/src/gtk/taskbar.cpp b/Externals/wxWidgets3/src/gtk/taskbar.cpp index 76b99b45bd..d92e0d0cae 100644 --- a/Externals/wxWidgets3/src/gtk/taskbar.cpp +++ b/Externals/wxWidgets3/src/gtk/taskbar.cpp @@ -4,7 +4,7 @@ // Author: Vaclav Slavik // Modified by: Paul Cornett // Created: 2004/05/29 -// RCS-ID: $Id: taskbar.cpp 58822 2009-02-10 03:43:30Z PC $ +// RCS-ID: $Id: taskbar.cpp 70701 2012-02-26 17:18:41Z VZ $ // Copyright: (c) Vaclav Slavik, 2004 // Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////// @@ -116,6 +116,7 @@ status_icon_popup_menu(GtkStatusIcon*, guint, guint, wxTaskBarIcon* taskBarIcon) bool wxTaskBarIconBase::IsAvailable() { +#ifdef GDK_WINDOWING_X11 char name[32]; g_snprintf(name, sizeof(name), "_NET_SYSTEM_TRAY_S%d", gdk_x11_get_default_screen()); @@ -124,6 +125,9 @@ bool wxTaskBarIconBase::IsAvailable() Window manager = XGetSelectionOwner(gdk_x11_get_default_xdisplay(), atom); return manager != None; +#else + return true; +#endif } //----------------------------------------------------------------------------- @@ -180,7 +184,7 @@ void wxTaskBarIcon::Private::SetIcon() m_size = 0; if (m_eggTrayIcon) { - GtkWidget* image = GTK_BIN(m_eggTrayIcon)->child; + GtkWidget* image = gtk_bin_get_child(GTK_BIN(m_eggTrayIcon)); gtk_image_set_from_pixbuf(GTK_IMAGE(image), m_bitmap.GetPixbuf()); } else @@ -207,10 +211,22 @@ void wxTaskBarIcon::Private::SetIcon() #if GTK_CHECK_VERSION(2,10,0) if (m_statusIcon) - gtk_status_icon_set_tooltip(m_statusIcon, tip_text); - else -#endif { +#if GTK_CHECK_VERSION(2,16,0) + if (GTK_CHECK_VERSION(3,0,0) || gtk_check_version(2,16,0) == NULL) + gtk_status_icon_set_tooltip_text(m_statusIcon, tip_text); + else +#endif + { +#if !GTK_CHECK_VERSION(3,0,0) && !defined(GTK_DISABLE_DEPRECATED) + gtk_status_icon_set_tooltip(m_statusIcon, tip_text); +#endif + } + } + else +#endif // GTK_CHECK_VERSION(2,10,0) + { +#if !GTK_CHECK_VERSION(3,0,0) && !defined(GTK_DISABLE_DEPRECATED) if (tip_text && m_tooltips == NULL) { m_tooltips = gtk_tooltips_new(); @@ -219,6 +235,7 @@ void wxTaskBarIcon::Private::SetIcon() } if (m_tooltips) gtk_tooltips_set_tip(m_tooltips, m_eggTrayIcon, tip_text, ""); +#endif } #endif // wxUSE_TOOLTIPS } @@ -240,7 +257,7 @@ void wxTaskBarIcon::Private::size_allocate(int width, int height) if (h > size) h = size; GdkPixbuf* pixbuf = gdk_pixbuf_scale_simple(m_bitmap.GetPixbuf(), w, h, GDK_INTERP_BILINEAR); - GtkImage* image = GTK_IMAGE(GTK_BIN(m_eggTrayIcon)->child); + GtkImage* image = GTK_IMAGE(gtk_bin_get_child(GTK_BIN(m_eggTrayIcon))); gtk_image_set_from_pixbuf(image, pixbuf); g_object_unref(pixbuf); } diff --git a/Externals/wxWidgets3/src/gtk/textctrl.cpp b/Externals/wxWidgets3/src/gtk/textctrl.cpp index ef032998c6..2a9dc26663 100644 --- a/Externals/wxWidgets3/src/gtk/textctrl.cpp +++ b/Externals/wxWidgets3/src/gtk/textctrl.cpp @@ -2,7 +2,7 @@ // Name: src/gtk/textctrl.cpp // Purpose: // Author: Robert Roebling -// Id: $Id: textctrl.cpp 66555 2011-01-04 08:31:53Z SC $ +// Id: $Id: textctrl.cpp 70674 2012-02-23 13:56:14Z VZ $ // Copyright: (c) 1998 Robert Roebling, Vadim Zeitlin, 2005 Mart Raudsepp // Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// @@ -110,6 +110,18 @@ static void wxGtkTextApplyTagsFromAttr(GtkWidget *text, NULL ); gtk_text_buffer_apply_tag (text_buffer, tag, start, end); } + if ( font.GetStrikethrough() ) + { + g_snprintf(buf, sizeof(buf), "WXFONTSTRIKETHROUGH"); + tag = gtk_text_tag_table_lookup( gtk_text_buffer_get_tag_table( text_buffer ), + buf ); + if (!tag) + tag = gtk_text_buffer_create_tag( text_buffer, buf, + "strikethrough-set", TRUE, + "strikethrough", TRUE, + NULL ); + gtk_text_buffer_apply_tag (text_buffer, tag, start, end); + } } if (attr.HasTextColour()) @@ -391,7 +403,7 @@ au_check_word( GtkTextIter *s, GtkTextIter *e ) for( n = 0; n < WXSIZEOF(URIPrefixes); ++n ) { prefix_len = strlen(URIPrefixes[n]); - if((len > prefix_len) && !strncasecmp(text, URIPrefixes[n], prefix_len)) + if((len > prefix_len) && !wxStrnicmp(text, URIPrefixes[n], prefix_len)) break; } @@ -579,6 +591,18 @@ gtk_paste_clipboard_callback( GtkWidget *widget, wxTextCtrl *win ) } } +//----------------------------------------------------------------------------- +// "mark_set" +//----------------------------------------------------------------------------- + +extern "C" { +static void mark_set(GtkTextBuffer*, GtkTextIter*, GtkTextMark* mark, GSList** markList) +{ + if (gtk_text_mark_get_name(mark) == NULL) + *markList = g_slist_prepend(*markList, mark); +} +} + //----------------------------------------------------------------------------- // wxTextCtrl //----------------------------------------------------------------------------- @@ -620,10 +644,13 @@ void wxTextCtrl::Init() m_text = NULL; m_showPositionOnThaw = NULL; + m_anonymousMarkList = NULL; } wxTextCtrl::~wxTextCtrl() { + if (m_anonymousMarkList) + g_slist_free(m_anonymousMarkList); } wxTextCtrl::wxTextCtrl( wxWindow *parent, @@ -660,10 +687,13 @@ bool wxTextCtrl::Create( wxWindow *parent, if (multi_line) { + m_buffer = gtk_text_buffer_new(NULL); + gulong sig_id = g_signal_connect(m_buffer, "mark_set", G_CALLBACK(mark_set), &m_anonymousMarkList); // Create view - m_text = gtk_text_view_new(); - - m_buffer = gtk_text_view_get_buffer( GTK_TEXT_VIEW(m_text) ); + m_text = gtk_text_view_new_with_buffer(m_buffer); + // gtk_text_view_set_buffer adds its own reference + g_object_unref(m_buffer); + g_signal_handler_disconnect(m_buffer, sig_id); // create "ShowPosition" marker GtkTextIter iter; @@ -678,7 +708,7 @@ bool wxTextCtrl::Create( wxWindow *parent, ? GTK_POLICY_NEVER : GTK_POLICY_AUTOMATIC ); // for ScrollLines/Pages - m_scrollBar[1] = (GtkRange*)((GtkScrolledWindow*)m_widget)->vscrollbar; + m_scrollBar[1] = GTK_RANGE(gtk_scrolled_window_get_vscrollbar(GTK_SCROLLED_WINDOW(m_widget))); // Insert view into scrolled window gtk_container_add( GTK_CONTAINER(m_widget), m_text ); @@ -689,7 +719,7 @@ bool wxTextCtrl::Create( wxWindow *parent, gtk_widget_add_events( GTK_WIDGET(m_text), GDK_ENTER_NOTIFY_MASK | GDK_LEAVE_NOTIFY_MASK ); - GTK_WIDGET_UNSET_FLAGS( m_widget, GTK_CAN_FOCUS ); + gtk_widget_set_can_focus(m_widget, FALSE); } else { @@ -1082,13 +1112,19 @@ void wxTextCtrl::WriteText( const wxString &text ) // Insert the text wxGtkTextInsert( m_text, m_buffer, m_defaultStyle, buffer ); - GtkAdjustment *adj = gtk_scrolled_window_get_vadjustment( GTK_SCROLLED_WINDOW(m_widget) ); // Scroll to cursor, but only if scrollbar thumb is at the very bottom // won't work when frozen, text view is not using m_buffer then - if (!IsFrozen() && wxIsSameDouble(adj->value, adj->upper - adj->page_size)) + if (!IsFrozen()) { - gtk_text_view_scroll_to_mark( GTK_TEXT_VIEW(m_text), - gtk_text_buffer_get_insert( m_buffer ), 0.0, FALSE, 0.0, 1.0 ); + GtkAdjustment* adj = gtk_scrolled_window_get_vadjustment(GTK_SCROLLED_WINDOW(m_widget)); + const double value = gtk_adjustment_get_value(adj); + const double upper = gtk_adjustment_get_upper(adj); + const double page_size = gtk_adjustment_get_page_size(adj); + if (wxIsSameDouble(value, upper - page_size)) + { + gtk_text_view_scroll_to_mark(GTK_TEXT_VIEW(m_text), + gtk_text_buffer_get_insert(m_buffer), 0, false, 0, 1); + } } } @@ -1141,7 +1177,7 @@ bool wxTextCtrl::PositionToXY(long pos, long *x, long *y ) const } else // single line control { - if ( pos <= GTK_ENTRY(m_text)->text_length ) + if (pos <= gtk_entry_get_text_length(GTK_ENTRY(m_text))) { if ( y ) *y = 0; @@ -1194,6 +1230,37 @@ int wxTextCtrl::GetLineLength(long lineNo) const } } +wxPoint wxTextCtrl::DoPositionToCoords(long pos) const +{ + if ( !IsMultiLine() ) + { + // Single line text entry (GtkTextEntry) doesn't have support for + // getting the coordinates for the given offset. Perhaps we could + // find them ourselves by using GetTextExtent() but for now just leave + // it unimplemented, this function is more useful for multiline + // controls anyhow. + return wxDefaultPosition; + } + + // Window coordinates for the given position is calculated by getting + // the buffer coordinates and converting them to window coordinates. + GtkTextView *textview = GTK_TEXT_VIEW(m_text); + + GtkTextIter iter; + gtk_text_buffer_get_iter_at_offset(m_buffer, &iter, pos); + + GdkRectangle bufferCoords; + gtk_text_view_get_iter_location(textview, &iter, &bufferCoords); + + gint winCoordX = 0, + winCoordY = 0; + gtk_text_view_buffer_to_window_coords(textview, GTK_TEXT_WINDOW_WIDGET, + bufferCoords.x, bufferCoords.y, + &winCoordX, &winCoordY); + + return wxPoint(winCoordX, winCoordY); +} + int wxTextCtrl::GetNumberOfLines() const { if ( IsMultiLine() ) @@ -1265,7 +1332,7 @@ void wxTextCtrl::OnEnabled(bool WXUNUSED(enable)) // disabled and enabled mode, or we end up with a different colour under the // text. wxColour oldColour = GetBackgroundColour(); - if (oldColour.Ok()) + if (oldColour.IsOk()) { // Need to set twice or it'll optimize the useful stuff out if (oldColour == * wxWHITE) @@ -1578,7 +1645,7 @@ GdkWindow *wxTextCtrl::GTKGetWindow(wxArrayGdkWindows& WXUNUSED(windows)) const } else { - return GTK_ENTRY(m_text)->text_area; + return gtk_entry_get_text_window(GTK_ENTRY(m_text)); } } @@ -1642,7 +1709,7 @@ bool wxTextCtrl::SetBackgroundColour( const wxColour &colour ) if ( !wxControl::SetBackgroundColour( colour ) ) return false; - if (!m_backgroundColour.Ok()) + if (!m_backgroundColour.IsOk()) return false; // change active background color too @@ -1698,7 +1765,7 @@ bool wxTextCtrl::GetStyle(long position, wxTextAttr& style) // Obtain a copy of the default attributes GtkTextAttributes * const pattr = gtk_text_view_get_default_attributes(GTK_TEXT_VIEW(m_text)); - wxON_BLOCK_EXIT1( g_free, pattr ); + wxON_BLOCK_EXIT1(gtk_text_attributes_unref, pattr); // And query GTK for the attributes at the given position using it as base if ( !gtk_text_iter_get_attributes(&positioni, pattr) ) @@ -1804,16 +1871,24 @@ void wxTextCtrl::DoFreeze() // removing buffer dramatically speeds up insertion: g_object_ref(m_buffer); GtkTextBuffer* buf_new = gtk_text_buffer_new(NULL); - GtkTextMark* mark = GTK_TEXT_VIEW(m_text)->first_para_mark; gtk_text_view_set_buffer(GTK_TEXT_VIEW(m_text), buf_new); // gtk_text_view_set_buffer adds its own reference g_object_unref(buf_new); - // This mark should be deleted when the buffer is changed, - // but it's not (in GTK+ up to at least 2.10.6). + // These marks should be deleted when the buffer is changed, + // but they are not (in GTK+ up to at least 3.0.1). // Otherwise these anonymous marks start to build up in the buffer, // and Freeze takes longer and longer each time it is called. - if (GTK_IS_TEXT_MARK(mark) && !gtk_text_mark_get_deleted(mark)) - gtk_text_buffer_delete_mark(m_buffer, mark); + if (m_anonymousMarkList) + { + for (GSList* item = m_anonymousMarkList; item; item = item->next) + { + GtkTextMark* mark = static_cast(item->data); + if (GTK_IS_TEXT_MARK(mark) && !gtk_text_mark_get_deleted(mark)) + gtk_text_buffer_delete_mark(m_buffer, mark); + } + g_slist_free(m_anonymousMarkList); + m_anonymousMarkList = NULL; + } } } @@ -1822,8 +1897,10 @@ void wxTextCtrl::DoThaw() if ( HasFlag(wxTE_MULTILINE) ) { // reattach buffer: + gulong sig_id = g_signal_connect(m_buffer, "mark_set", G_CALLBACK(mark_set), &m_anonymousMarkList); gtk_text_view_set_buffer(GTK_TEXT_VIEW(m_text), m_buffer); g_object_unref(m_buffer); + g_signal_handler_disconnect(m_buffer, sig_id); if (m_showPositionOnThaw != NULL) { diff --git a/Externals/wxWidgets3/src/gtk/textentry.cpp b/Externals/wxWidgets3/src/gtk/textentry.cpp index bf1042235b..234232a05c 100644 --- a/Externals/wxWidgets3/src/gtk/textentry.cpp +++ b/Externals/wxWidgets3/src/gtk/textentry.cpp @@ -3,7 +3,7 @@ // Purpose: wxTextEntry implementation for wxGTK // Author: Vadim Zeitlin // Created: 2007-09-24 -// RCS-ID: $Id: textentry.cpp 61836 2009-09-05 13:23:03Z JMS $ +// RCS-ID: $Id: textentry.cpp 67509 2011-04-16 17:27:04Z VZ $ // Copyright: (c) 2007 Vadim Zeitlin // Licence: wxWindows licence /////////////////////////////////////////////////////////////////////////////// @@ -52,13 +52,19 @@ wx_gtk_insert_text_callback(GtkEditable *editable, // we should only be called if we have a max len limit at all GtkEntry *entry = GTK_ENTRY (editable); - wxCHECK_RET( entry->text_max_length, wxT("shouldn't be called") ); + const int text_length = gtk_entry_get_text_length(entry); +#if GTK_CHECK_VERSION(3,0,0) || defined(GSEAL_ENABLE) + const int text_max_length = gtk_entry_buffer_get_max_length(gtk_entry_get_buffer(entry)); +#else + const int text_max_length = entry->text_max_length; +#endif + wxCHECK_RET(text_max_length, "shouldn't be called"); // check that we don't overflow the max length limit // // FIXME: this doesn't work when we paste a string which is going to be // truncated - if ( entry->text_length == entry->text_max_length ) + if (text_length == text_max_length) { // we don't need to run the base class version at all g_signal_stop_emission_by_name (editable, "insert_text"); @@ -179,7 +185,7 @@ long wxTextEntry::GetLastPosition() const // GtkEntries GtkEntry * const entry = GTK_ENTRY(GetEditable()); - return entry ? entry->text_length : - 1; + return entry ? gtk_entry_get_text_length(entry) : -1; } // ---------------------------------------------------------------------------- @@ -231,7 +237,7 @@ void wxTextEntry::GetSelection(long *from, long *to) const // auto completion // ---------------------------------------------------------------------------- -bool wxTextEntry::AutoComplete(const wxArrayString& choices) +bool wxTextEntry::DoAutoCompleteStrings(const wxArrayString& choices) { GtkEntry * const entry = GTK_ENTRY(GetEditable()); wxCHECK_MSG(entry, false, "auto completion doesn't work with this control"); diff --git a/Externals/wxWidgets3/src/gtk/tglbtn.cpp b/Externals/wxWidgets3/src/gtk/tglbtn.cpp index 83f349d7d5..7590fd23cb 100644 --- a/Externals/wxWidgets3/src/gtk/tglbtn.cpp +++ b/Externals/wxWidgets3/src/gtk/tglbtn.cpp @@ -5,7 +5,7 @@ // Author: John Norris, minor changes by Axel Schlueter // Modified by: // Created: 08.02.01 -// RCS-ID: $Id: tglbtn.cpp 64940 2010-07-13 13:29:13Z VZ $ +// RCS-ID: $Id: tglbtn.cpp 69830 2011-11-27 19:49:54Z VZ $ // Copyright: (c) 2000 Johnny C. Norris II // Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// @@ -45,157 +45,30 @@ wxDEFINE_EVENT( wxEVT_COMMAND_TOGGLEBUTTON_CLICKED, wxCommandEvent ); // wxBitmapToggleButton // ------------------------------------------------------------------------ -IMPLEMENT_DYNAMIC_CLASS(wxBitmapToggleButton, wxControl) +IMPLEMENT_DYNAMIC_CLASS(wxBitmapToggleButton, wxToggleButton) bool wxBitmapToggleButton::Create(wxWindow *parent, wxWindowID id, - const wxBitmap &label, const wxPoint &pos, + const wxBitmap &bitmap, const wxPoint &pos, const wxSize &size, long style, const wxValidator& validator, const wxString &name) { - if (!PreCreation(parent, pos, size) || - !CreateBase(parent, id, pos, size, style, validator, name )) - { - wxFAIL_MSG(wxT("wxBitmapToggleButton creation failed")); - return false; - } - - // Create the gtk widget. - m_widget = gtk_toggle_button_new(); - g_object_ref(m_widget); - - if (style & wxNO_BORDER) - gtk_button_set_relief( GTK_BUTTON(m_widget), GTK_RELIEF_NONE ); - - m_bitmap = label; - OnSetBitmap(); - - g_signal_connect (m_widget, "clicked", - G_CALLBACK (gtk_togglebutton_clicked_callback), - this); - - m_parent->DoAddChild(this); - - PostCreation(size); - - return true; -} - -void wxBitmapToggleButton::GTKDisableEvents() -{ - g_signal_handlers_block_by_func(m_widget, - (gpointer) gtk_togglebutton_clicked_callback, this); -} - -void wxBitmapToggleButton::GTKEnableEvents() -{ - g_signal_handlers_unblock_by_func(m_widget, - (gpointer) gtk_togglebutton_clicked_callback, this); -} - -// void SetValue(bool state) -// Set the value of the toggle button. -void wxBitmapToggleButton::SetValue(bool state) -{ - wxCHECK_RET(m_widget != NULL, wxT("invalid toggle button")); - - if (state == GetValue()) - return; - - GTKDisableEvents(); - - gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(m_widget), state); - - GTKEnableEvents(); -} - -// bool GetValue() const -// Get the value of the toggle button. -bool wxBitmapToggleButton::GetValue() const -{ - wxCHECK_MSG(m_widget != NULL, false, wxT("invalid toggle button")); - - return gtk_toggle_button_get_active((GtkToggleButton*)m_widget); -} - -void wxBitmapToggleButton::SetLabel(const wxBitmap& label) -{ - wxCHECK_RET(m_widget != NULL, wxT("invalid toggle button")); - - m_bitmap = label; - InvalidateBestSize(); - - OnSetBitmap(); -} - -void wxBitmapToggleButton::OnSetBitmap() -{ - if (!m_bitmap.Ok()) return; - - GtkWidget* image = ((GtkBin*)m_widget)->child; - if (image == NULL) - { - image = gtk_image_new(); - gtk_widget_show(image); - gtk_container_add((GtkContainer*)m_widget, image); - } - // always use pixbuf, because pixmap mask does not - // work with disabled images in some themes - gtk_image_set_from_pixbuf((GtkImage*)image, m_bitmap.GetPixbuf()); -} - -bool wxBitmapToggleButton::Enable(bool enable /*=true*/) -{ - bool isEnabled = IsEnabled(); - - if (!wxControl::Enable(enable)) + if ( !wxToggleButton::Create(parent, id, wxEmptyString, pos, size, style | wxBU_NOTEXT | wxBU_EXACTFIT, + validator, name) ) return false; - gtk_widget_set_sensitive(GTK_BIN(m_widget)->child, enable); - - if (!isEnabled && enable) + if ( bitmap.IsOk() ) { - GTKFixSensitivity(); + SetBitmapLabel(bitmap); + + // we need to adjust the size after setting the bitmap as it may be too + // big for the default button size + SetInitialSize(size); } return true; } -void wxBitmapToggleButton::DoApplyWidgetStyle(GtkRcStyle *style) -{ - gtk_widget_modify_style(m_widget, style); - gtk_widget_modify_style(GTK_BIN(m_widget)->child, style); -} - -GdkWindow * -wxBitmapToggleButton::GTKGetWindow(wxArrayGdkWindows& WXUNUSED(windows)) const -{ - return GTK_BUTTON(m_widget)->event_window; -} - -// Get the "best" size for this control. -wxSize wxBitmapToggleButton::DoGetBestSize() const -{ - wxSize best; - - if (m_bitmap.Ok()) - { - int border = HasFlag(wxNO_BORDER) ? 4 : 10; - best.x = m_bitmap.GetWidth()+border; - best.y = m_bitmap.GetHeight()+border; - } - CacheBestSize(best); - return best; -} - - -// static -wxVisualAttributes -wxBitmapToggleButton::GetClassDefaultAttributes(wxWindowVariant WXUNUSED(variant)) -{ - return GetDefaultAttributesFromGTKWidget(gtk_toggle_button_new); -} - // ------------------------------------------------------------------------ // wxToggleButton @@ -216,11 +89,28 @@ bool wxToggleButton::Create(wxWindow *parent, wxWindowID id, return false; } - // Create the gtk widget. - m_widget = gtk_toggle_button_new_with_mnemonic(""); + // create either a standard toggle button with text label (which may still contain + // an image under GTK+ 2.6+) or a bitmap-only toggle button if we don't have any + // label + const bool + useLabel = !(style & wxBU_NOTEXT) && !label.empty(); + if ( useLabel ) + { + m_widget = gtk_toggle_button_new_with_mnemonic(""); + } + else // no label, suppose we will have a bitmap + { + m_widget = gtk_toggle_button_new(); + + GtkWidget *image = gtk_image_new(); + gtk_widget_show(image); + gtk_container_add(GTK_CONTAINER(m_widget), image); + } + g_object_ref(m_widget); - SetLabel(label); + if ( useLabel ) + SetLabel(label); g_signal_connect (m_widget, "clicked", G_CALLBACK (gtk_togglebutton_clicked_callback), @@ -267,14 +157,22 @@ bool wxToggleButton::GetValue() const { wxCHECK_MSG(m_widget != NULL, false, wxT("invalid toggle button")); - return GTK_TOGGLE_BUTTON(m_widget)->active; + return gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(m_widget)) != 0; } void wxToggleButton::SetLabel(const wxString& label) { wxCHECK_RET(m_widget != NULL, wxT("invalid toggle button")); - wxControl::SetLabel(label); + wxAnyButton::SetLabel(label); + + if ( HasFlag(wxBU_NOTEXT) ) + { + // Don't try to update the label for a button not showing it, this is + // unnecessary and can also actually replace the image we show with the + // label entirely breaking the button code, see #13693. + return; + } const wxString labelGTK = GTKConvertMnemonics(label); @@ -283,35 +181,45 @@ void wxToggleButton::SetLabel(const wxString& label) GTKApplyWidgetStyle( false ); } -bool wxToggleButton::Enable(bool enable /*=true*/) +#if wxUSE_MARKUP +bool wxToggleButton::DoSetLabelMarkup(const wxString& markup) { - if (!base_type::Enable(enable)) + wxCHECK_MSG( m_widget != NULL, false, "invalid toggle button" ); + + const wxString stripped = RemoveMarkup(markup); + if ( stripped.empty() && !markup.empty() ) return false; - gtk_widget_set_sensitive(GTK_BIN(m_widget)->child, enable); + wxControl::SetLabel(stripped); - if (enable) - GTKFixSensitivity(); + if ( !HasFlag(wxBU_NOTEXT) ) + { + GtkLabel * const label = GTKGetLabel(); + wxCHECK_MSG( label, false, "no label in this toggle button?" ); + + GTKSetLabelWithMarkupForLabel(label, markup); + } return true; } +#endif // wxUSE_MARKUP + +GtkLabel *wxToggleButton::GTKGetLabel() const +{ + GtkWidget* child = gtk_bin_get_child(GTK_BIN(m_widget)); + return GTK_LABEL(child); +} void wxToggleButton::DoApplyWidgetStyle(GtkRcStyle *style) { gtk_widget_modify_style(m_widget, style); - gtk_widget_modify_style(GTK_BIN(m_widget)->child, style); -} - -GdkWindow * -wxToggleButton::GTKGetWindow(wxArrayGdkWindows& WXUNUSED(windows)) const -{ - return GTK_BUTTON(m_widget)->event_window; + gtk_widget_modify_style(gtk_bin_get_child(GTK_BIN(m_widget)), style); } // Get the "best" size for this control. wxSize wxToggleButton::DoGetBestSize() const { - wxSize ret(wxControl::DoGetBestSize()); + wxSize ret(wxAnyButton::DoGetBestSize()); if (!HasFlag(wxBU_EXACTFIT)) { diff --git a/Externals/wxWidgets3/src/gtk/toolbar.cpp b/Externals/wxWidgets3/src/gtk/toolbar.cpp index 5e6949d45c..464f45dd8a 100644 --- a/Externals/wxWidgets3/src/gtk/toolbar.cpp +++ b/Externals/wxWidgets3/src/gtk/toolbar.cpp @@ -3,7 +3,7 @@ // Purpose: GTK toolbar // Author: Robert Roebling // Modified: 13.12.99 by VZ to derive from wxToolBarBase -// RCS-ID: $Id: toolbar.cpp 66633 2011-01-07 18:15:21Z PC $ +// RCS-ID: $Id: toolbar.cpp 70510 2012-02-05 01:20:03Z VZ $ // Copyright: (c) Robert Roebling // Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// @@ -195,12 +195,15 @@ image_expose_event(GtkWidget* widget, GdkEventExpose*, wxToolBarTool* tool) return false; // draw disabled bitmap ourselves, GtkImage has no way to specify it - const GtkAllocation& alloc = widget->allocation; + GtkAllocation alloc; + gtk_widget_get_allocation(widget, &alloc); + GtkRequisition req; + gtk_widget_get_requisition(widget, &req); gdk_draw_pixbuf( - widget->window, widget->style->black_gc, bitmap.GetPixbuf(), + gtk_widget_get_window(widget), gtk_widget_get_style(widget)->black_gc, bitmap.GetPixbuf(), 0, 0, - alloc.x + (alloc.width - widget->requisition.width) / 2, - alloc.y + (alloc.height - widget->requisition.height) / 2, + alloc.x + (alloc.width - req.width) / 2, + alloc.y + (alloc.height - req.height) / 2, -1, -1, GDK_RGB_DITHER_NORMAL, 0, 0); return true; } @@ -250,7 +253,7 @@ void wxToolBar::AddChildGTK(wxWindowGTK* child) GtkToolItem* item = gtk_tool_item_new(); gtk_container_add(GTK_CONTAINER(item), align); // position will be corrected in DoInsertTool if necessary - gtk_toolbar_insert(GTK_TOOLBAR(GTK_BIN(m_widget)->child), item, -1); + gtk_toolbar_insert(GTK_TOOLBAR(gtk_bin_get_child(GTK_BIN(m_widget))), item, -1); } // ---------------------------------------------------------------------------- @@ -284,7 +287,7 @@ void wxToolBarTool::CreateDropDown() box = gtk_hbox_new(false, 0); arrow = gtk_arrow_new(GTK_ARROW_DOWN, GTK_SHADOW_NONE); } - GtkWidget* tool_button = GTK_BIN(m_item)->child; + GtkWidget* tool_button = gtk_bin_get_child(GTK_BIN(m_item)); gtk_widget_reparent(tool_button, box); GtkWidget* arrow_button = gtk_toggle_button_new(); gtk_button_set_relief(GTK_BUTTON(arrow_button), @@ -308,7 +311,8 @@ void wxToolBarTool::ShowDropdown(GtkToggleButton* button) wxMenu* menu = GetDropdownMenu(); if (menu) { - const GtkAllocation& alloc = GTK_WIDGET(button)->allocation; + GtkAllocation alloc; + gtk_widget_get_allocation(GTK_WIDGET(button), &alloc); int x = alloc.x; int y = alloc.y; if (toolbar->HasFlag(wxTB_LEFT | wxTB_RIGHT)) @@ -376,12 +380,14 @@ bool wxToolBar::Create( wxWindow *parent, FixupStyle(); m_toolbar = GTK_TOOLBAR( gtk_toolbar_new() ); +#if !GTK_CHECK_VERSION(3,0,0) && !defined(GTK_DISABLE_DEPRECATED) if (gtk_check_version(2, 12, 0)) { m_tooltips = gtk_tooltips_new(); g_object_ref(m_tooltips); gtk_object_sink(GTK_OBJECT(m_tooltips)); } +#endif GtkSetStyle(); if (style & wxTB_DOCKABLE) @@ -417,7 +423,7 @@ bool wxToolBar::Create( wxWindow *parent, GdkWindow *wxToolBar::GTKGetWindow(wxArrayGdkWindows& WXUNUSED(windows)) const { - return GTK_WIDGET(m_toolbar)->window; + return gtk_widget_get_window(GTK_WIDGET(m_toolbar)); } void wxToolBar::GtkSetStyle() @@ -436,7 +442,11 @@ void wxToolBar::GtkSetStyle() style = GTK_TOOLBAR_BOTH_HORIZ; } +#if GTK_CHECK_VERSION(3,0,0) || defined(GTK_DISABLE_DEPRECATED) + gtk_orientable_set_orientation(GTK_ORIENTABLE(m_toolbar), orient); +#else gtk_toolbar_set_orientation(m_toolbar, orient); +#endif gtk_toolbar_set_style(m_toolbar, style); } @@ -479,6 +489,7 @@ bool wxToolBar::DoInsertTool(size_t pos, wxToolBarToolBase *toolBase) wxToolBarTool* tool = static_cast(toolBase); GSList* radioGroup; + GtkWidget* bin_child; switch ( tool->GetStyle() ) { case wxTOOL_STYLE_BUTTON: @@ -491,7 +502,7 @@ bool wxToolBar::DoInsertTool(size_t pos, wxToolBarToolBase *toolBase) break; case wxITEM_RADIO: radioGroup = GetRadioGroup(pos); - if (radioGroup) + if (!radioGroup) { // this is the first button in the radio button group, // it will be toggled automatically by GTK so bring the @@ -532,7 +543,7 @@ bool wxToolBar::DoInsertTool(size_t pos, wxToolBarToolBase *toolBase) if (!HasFlag(wxTB_NO_TOOLTIPS) && !tool->GetShortHelp().empty()) { #if GTK_CHECK_VERSION(2, 12, 0) - if (!gtk_check_version(2, 12, 0)) + if (GTK_CHECK_VERSION(3,0,0) || gtk_check_version(2,12,0) == NULL) { gtk_tool_item_set_tooltip_text(tool->m_item, wxGTK_CONV(tool->GetShortHelp())); @@ -540,15 +551,18 @@ bool wxToolBar::DoInsertTool(size_t pos, wxToolBarToolBase *toolBase) else #endif { +#if !GTK_CHECK_VERSION(3,0,0) && !defined(GTK_DISABLE_DEPRECATED) gtk_tool_item_set_tooltip(tool->m_item, m_tooltips, wxGTK_CONV(tool->GetShortHelp()), ""); +#endif } } - g_signal_connect(GTK_BIN(tool->m_item)->child, "button_press_event", + bin_child = gtk_bin_get_child(GTK_BIN(tool->m_item)); + g_signal_connect(bin_child, "button_press_event", G_CALLBACK(button_press_event), tool); - g_signal_connect(tool->m_item, "enter_notify_event", + g_signal_connect(bin_child, "enter_notify_event", G_CALLBACK(enter_notify_event), tool); - g_signal_connect(tool->m_item, "leave_notify_event", + g_signal_connect(bin_child, "leave_notify_event", G_CALLBACK(enter_notify_event), tool); if (tool->GetKind() == wxITEM_DROPDOWN) @@ -572,9 +586,9 @@ bool wxToolBar::DoInsertTool(size_t pos, wxToolBarToolBase *toolBase) case wxTOOL_STYLE_CONTROL: wxWindow* control = tool->GetControl(); - if (control->m_widget->parent == NULL) + if (gtk_widget_get_parent(control->m_widget) == NULL) AddChildGTK(control); - tool->m_item = GTK_TOOL_ITEM(control->m_widget->parent->parent); + tool->m_item = GTK_TOOL_ITEM(gtk_widget_get_parent(gtk_widget_get_parent(control->m_widget))); if (gtk_toolbar_get_item_index(m_toolbar, tool->m_item) != int(pos)) { g_object_ref(tool->m_item); @@ -609,7 +623,7 @@ bool wxToolBar::DoDeleteTool(size_t /* pos */, wxToolBarToolBase* toolBase) // while if we're called from DeleteTool() the control will // be destroyed when wxToolBarToolBase itself is deleted GtkWidget* widget = tool->GetControl()->m_widget; - gtk_container_remove(GTK_CONTAINER(widget->parent), widget); + gtk_container_remove(GTK_CONTAINER(gtk_widget_get_parent(widget)), widget); } gtk_object_destroy(GTK_OBJECT(tool->m_item)); tool->m_item = NULL; @@ -709,7 +723,7 @@ void wxToolBar::SetToolShortHelp( int id, const wxString& helpString ) if (tool->m_item) { #if GTK_CHECK_VERSION(2, 12, 0) - if (!gtk_check_version(2, 12, 0)) + if (GTK_CHECK_VERSION(3,0,0) || gtk_check_version(2,12,0) == NULL) { gtk_tool_item_set_tooltip_text(tool->m_item, wxGTK_CONV(helpString)); @@ -717,8 +731,10 @@ void wxToolBar::SetToolShortHelp( int id, const wxString& helpString ) else #endif { +#if !GTK_CHECK_VERSION(3,0,0) && !defined(GTK_DISABLE_DEPRECATED) gtk_tool_item_set_tooltip(tool->m_item, m_tooltips, wxGTK_CONV(helpString), ""); +#endif } } } diff --git a/Externals/wxWidgets3/src/gtk/tooltip.cpp b/Externals/wxWidgets3/src/gtk/tooltip.cpp index d82bfc03f2..214d0e0784 100644 --- a/Externals/wxWidgets3/src/gtk/tooltip.cpp +++ b/Externals/wxWidgets3/src/gtk/tooltip.cpp @@ -2,7 +2,7 @@ // Name: src/gtk/tooltip.cpp // Purpose: wxToolTip implementation // Author: Robert Roebling -// Id: $Id: tooltip.cpp 66431 2010-12-22 13:57:28Z VZ $ +// Id: $Id: tooltip.cpp 67326 2011-03-28 06:27:49Z PC $ // Copyright: (c) 1998 Robert Roebling // Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// @@ -24,7 +24,9 @@ // global data //----------------------------------------------------------------------------- +#if !GTK_CHECK_VERSION(3,0,0) && !defined(GTK_DISABLE_DEPRECATED) static GtkTooltips *gs_tooltips = NULL; +#endif //----------------------------------------------------------------------------- // wxToolTip @@ -33,98 +35,85 @@ static GtkTooltips *gs_tooltips = NULL; IMPLEMENT_ABSTRACT_CLASS(wxToolTip, wxObject) wxToolTip::wxToolTip( const wxString &tip ) + : m_text(tip) { - m_text = tip; m_window = NULL; } void wxToolTip::SetTip( const wxString &tip ) { m_text = tip; - GTKApply( m_window ); + if (m_window) + m_window->GTKApplyToolTip(wxGTK_CONV_SYS(m_text)); } -void wxToolTip::GTKApply( wxWindow *win ) +void wxToolTip::GTKSetWindow(wxWindow* win) { - if (!win) - return; - - if ( !gs_tooltips ) - gs_tooltips = gtk_tooltips_new(); - + wxASSERT(win); m_window = win; - - if (m_text.empty()) - m_window->GTKApplyToolTip( gs_tooltips, NULL ); - else - m_window->GTKApplyToolTip( gs_tooltips, wxGTK_CONV_SYS(m_text) ); + m_window->GTKApplyToolTip(wxGTK_CONV_SYS(m_text)); } /* static */ -void wxToolTip::GTKApply(GtkWidget *w, const gchar *tip) +void wxToolTip::GTKApply(GtkWidget* widget, const char* tip) { #if GTK_CHECK_VERSION(2, 12, 0) - if (!gtk_check_version(2, 12, 0)) - { - gtk_widget_set_tooltip_text(w, tip); - } + if (GTK_CHECK_VERSION(3,0,0) || gtk_check_version(2,12,0) == NULL) + gtk_widget_set_tooltip_text(widget, tip); else #endif { +#if !GTK_CHECK_VERSION(3,0,0) && !defined(GTK_DISABLE_DEPRECATED) if ( !gs_tooltips ) gs_tooltips = gtk_tooltips_new(); - gtk_tooltips_set_tip(gs_tooltips, w, tip, NULL); + gtk_tooltips_set_tip(gs_tooltips, widget, tip, NULL); +#endif } } void wxToolTip::Enable( bool flag ) { #if GTK_CHECK_VERSION(2, 12, 0) - if (!gtk_check_version(2, 12, 0)) + if (GTK_CHECK_VERSION(3,0,0) || gtk_check_version(2,12,0) == NULL) { GtkSettings* settings = gtk_settings_get_default(); - if(!settings) - return; - gtk_settings_set_long_property(settings, "gtk-enable-tooltips", flag?TRUE:FALSE, NULL); + if (settings) + gtk_settings_set_long_property(settings, "gtk-enable-tooltips", flag, NULL); } else #endif { +#if !GTK_CHECK_VERSION(3,0,0) && !defined(GTK_DISABLE_DEPRECATED) if (!gs_tooltips) - return; + gs_tooltips = gtk_tooltips_new(); if (flag) gtk_tooltips_enable( gs_tooltips ); else gtk_tooltips_disable( gs_tooltips ); +#endif } } -G_BEGIN_DECLS -void gtk_tooltips_set_delay (GtkTooltips *tooltips, - guint delay); -G_END_DECLS - void wxToolTip::SetDelay( long msecs ) { #if GTK_CHECK_VERSION(2, 12, 0) - if (!gtk_check_version(2, 12, 0)) + if (GTK_CHECK_VERSION(3,0,0) || gtk_check_version(2,12,0) == NULL) { GtkSettings* settings = gtk_settings_get_default(); - if(!settings) - return; - gtk_settings_set_long_property(settings, "gtk-tooltip-timeout", msecs, NULL); + if (settings) + gtk_settings_set_long_property(settings, "gtk-tooltip-timeout", msecs, NULL); } else #endif { +#if !GTK_CHECK_VERSION(3,0,0) && !defined(GTK_DISABLE_DEPRECATED) if (!gs_tooltips) - return; + gs_tooltips = gtk_tooltips_new(); - // FIXME: This is a deprecated function and might not even have an effect. - // Try to not use it, after which remove the prototype above. gtk_tooltips_set_delay( gs_tooltips, (int)msecs ); +#endif } } diff --git a/Externals/wxWidgets3/src/gtk/toplevel.cpp b/Externals/wxWidgets3/src/gtk/toplevel.cpp index 7c3f467f53..cd796e4bed 100644 --- a/Externals/wxWidgets3/src/gtk/toplevel.cpp +++ b/Externals/wxWidgets3/src/gtk/toplevel.cpp @@ -2,7 +2,7 @@ // Name: src/gtk/toplevel.cpp // Purpose: // Author: Robert Roebling -// Id: $Id: toplevel.cpp 67164 2011-03-09 17:22:43Z PC $ +// Id: $Id: toplevel.cpp 70733 2012-02-28 04:40:15Z PC $ // Copyright: (c) 1998 Robert Roebling // Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// @@ -36,15 +36,21 @@ #include "wx/sysopt.h" #include +#ifdef GDK_WINDOWING_X11 #include +#endif #include "wx/gtk/private/win_gtk.h" +#ifdef GDK_WINDOWING_X11 + #include "wx/unix/utilsx11.h" // XA_CARDINAL #include +#endif // GDK_WINDOWING_X11 + #if wxUSE_LIBHILDON #include #include @@ -72,40 +78,52 @@ static wxTopLevelWindowGTK *g_lastActiveFrame = NULL; // send any activate events at all static int g_sendActivateEvent = -1; +// Whether _NET_REQUEST_FRAME_EXTENTS support is working +// 0 == not tested yet, 1 == working, 2 == broken +static int gs_requestFrameExtentsStatus; + //----------------------------------------------------------------------------- // RequestUserAttention related functions //----------------------------------------------------------------------------- -extern "C" { +#ifndef __WXGTK30__ static void wxgtk_window_set_urgency_hint (GtkWindow *win, gboolean setting) -{ - wxASSERT_MSG( GTK_WIDGET_REALIZED(win), wxT("wxgtk_window_set_urgency_hint: GdkWindow not realized") ); - GdkWindow *window = GTK_WIDGET(win)->window; - XWMHints *wm_hints; - - wm_hints = XGetWMHints(GDK_WINDOW_XDISPLAY(window), GDK_WINDOW_XWINDOW(window)); - - if (!wm_hints) - wm_hints = XAllocWMHints(); - - if (setting) - wm_hints->flags |= XUrgencyHint; - else - wm_hints->flags &= ~XUrgencyHint; - - XSetWMHints(GDK_WINDOW_XDISPLAY(window), GDK_WINDOW_XWINDOW(window), wm_hints); - XFree(wm_hints); -} - -static gboolean gtk_frame_urgency_timer_callback( wxTopLevelWindowGTK *win ) { #if GTK_CHECK_VERSION(2,7,0) - if(!gtk_check_version(2,7,0)) - gtk_window_set_urgency_hint(GTK_WINDOW( win->m_widget ), FALSE); + if (gtk_check_version(2,7,0) == NULL) + gtk_window_set_urgency_hint(win, setting); else #endif - wxgtk_window_set_urgency_hint(GTK_WINDOW( win->m_widget ), FALSE); + { +#ifdef GDK_WINDOWING_X11 + GdkWindow* window = gtk_widget_get_window(GTK_WIDGET(win)); + wxCHECK_RET(window, "wxgtk_window_set_urgency_hint: GdkWindow not realized"); + + Display* dpy = GDK_WINDOW_XDISPLAY(window); + Window xid = GDK_WINDOW_XID(window); + XWMHints* wm_hints = XGetWMHints(dpy, xid); + + if (!wm_hints) + wm_hints = XAllocWMHints(); + + if (setting) + wm_hints->flags |= XUrgencyHint; + else + wm_hints->flags &= ~XUrgencyHint; + + XSetWMHints(dpy, xid, wm_hints); + XFree(wm_hints); +#endif // GDK_WINDOWING_X11 + } +} +#define gtk_window_set_urgency_hint wxgtk_window_set_urgency_hint +#endif + +extern "C" { +static gboolean gtk_frame_urgency_timer_callback( wxTopLevelWindowGTK *win ) +{ + gtk_window_set_urgency_hint(GTK_WINDOW(win->m_widget), false); win->m_urgency_hint = -2; return FALSE; @@ -147,15 +165,7 @@ static gboolean gtk_frame_focus_in_callback( GtkWidget *widget, g_source_remove( win->m_urgency_hint ); // no break, fallthrough to remove hint too case -1: -#if GTK_CHECK_VERSION(2,7,0) - if(!gtk_check_version(2,7,0)) - gtk_window_set_urgency_hint(GTK_WINDOW( widget ), FALSE); - else -#endif - { - wxgtk_window_set_urgency_hint(GTK_WINDOW( widget ), FALSE); - } - + gtk_window_set_urgency_hint(GTK_WINDOW(widget), false); win->m_urgency_hint = -2; break; @@ -218,8 +228,9 @@ size_allocate(GtkWidget*, GtkAllocation* alloc, wxTopLevelWindowGTK* win) win->m_oldClientWidth = alloc->width; win->m_oldClientHeight = alloc->height; - wxSize size(win->m_widget->allocation.width, - win->m_widget->allocation.height); + GtkAllocation a; + gtk_widget_get_allocation(win->m_widget, &a); + wxSize size(a.width, a.height); size += win->m_decorSize; win->m_width = size.x; win->m_height = size.y; @@ -303,29 +314,26 @@ gtk_frame_configure_callback( GtkWidget* widget, // we cannot the WM hints and icons before the widget has been realized, // so we do this directly after realization -extern "C" { -static void -gtk_frame_realized_callback( GtkWidget * WXUNUSED(widget), - wxTopLevelWindowGTK *win ) +void wxTopLevelWindowGTK::GTKHandleRealized() { - gdk_window_set_decorations(win->m_widget->window, - (GdkWMDecoration)win->m_gdkDecor); - gdk_window_set_functions(win->m_widget->window, - (GdkWMFunction)win->m_gdkFunc); + wxNonOwnedWindow::GTKHandleRealized(); + + gdk_window_set_decorations(gtk_widget_get_window(m_widget), + (GdkWMDecoration)m_gdkDecor); + gdk_window_set_functions(gtk_widget_get_window(m_widget), + (GdkWMFunction)m_gdkFunc); // GTK's shrinking/growing policy - if ( !(win->m_gdkFunc & GDK_FUNC_RESIZE) ) - gtk_window_set_resizable(GTK_WINDOW(win->m_widget), FALSE); + if ( !(m_gdkFunc & GDK_FUNC_RESIZE) ) + gtk_window_set_resizable(GTK_WINDOW(m_widget), FALSE); +#if !GTK_CHECK_VERSION(3,0,0) && !defined(GTK_DISABLE_DEPRECATED) else - gtk_window_set_policy(GTK_WINDOW(win->m_widget), 1, 1, 1); + gtk_window_set_policy(GTK_WINDOW(m_widget), 1, 1, 1); +#endif - const wxIconBundle& icons = win->GetIcons(); + const wxIconBundle& icons = GetIcons(); if (icons.GetIconCount()) - win->SetIcons(icons); - - if (win->HasFlag(wxFRAME_SHAPED)) - win->SetShape(win->m_shape); // it will really set the window shape now -} + SetIcons(icons); } //----------------------------------------------------------------------------- @@ -399,6 +407,7 @@ gtk_frame_window_state_callback( GtkWidget* WXUNUSED(widget), bool wxGetFrameExtents(GdkWindow* window, int* left, int* right, int* top, int* bottom) { +#ifdef GDK_WINDOWING_X11 static GdkAtom property = gdk_atom_intern("_NET_FRAME_EXTENTS", false); Atom xproperty = gdk_x11_atom_to_xatom_for_display( gdk_drawable_get_display(window), property); @@ -424,6 +433,9 @@ bool wxGetFrameExtents(GdkWindow* window, int* left, int* right, int* top, int* if (data) XFree(data); return success; +#else + return false; +#endif } //----------------------------------------------------------------------------- @@ -438,6 +450,14 @@ static gboolean property_notify_event( static GdkAtom property = gdk_atom_intern("_NET_FRAME_EXTENTS", false); if (event->state == GDK_PROPERTY_NEW_VALUE && event->atom == property) { + if (win->m_netFrameExtentsTimerId) + { + // WM support for _NET_REQUEST_FRAME_EXTENTS is working + gs_requestFrameExtentsStatus = 1; + g_source_remove(win->m_netFrameExtentsTimerId); + win->m_netFrameExtentsTimerId = 0; + } + wxSize decorSize = win->m_decorSize; int left, right, top, bottom; if (wxGetFrameExtents(event->window, &left, &right, &top, &bottom)) @@ -449,6 +469,24 @@ static gboolean property_notify_event( } } +extern "C" { +static gboolean request_frame_extents_timeout(void* data) +{ + // WM support for _NET_REQUEST_FRAME_EXTENTS is broken + gs_requestFrameExtentsStatus = 2; + gdk_threads_enter(); + wxTopLevelWindowGTK* win = static_cast(data); + win->m_netFrameExtentsTimerId = 0; + wxSize decorSize = win->m_decorSize; + int left, right, top, bottom; + if (wxGetFrameExtents(gtk_widget_get_window(win->m_widget), &left, &right, &top, &bottom)) + decorSize.Set(left + right, top + bottom); + win->GTKUpdateDecorSize(decorSize); + gdk_threads_leave(); + return false; +} +} + // ---------------------------------------------------------------------------- // wxTopLevelWindowGTK creation // ---------------------------------------------------------------------------- @@ -465,6 +503,7 @@ void wxTopLevelWindowGTK::Init() m_deferShow = true; m_deferShowAllowed = true; m_updateDecorSize = true; + m_netFrameExtentsTimerId = 0; m_urgency_hint = -2; } @@ -564,7 +603,7 @@ bool wxTopLevelWindowGTK::Create( wxWindow *parent, #endif gtk_window_set_title( GTK_WINDOW(m_widget), wxGTK_CONV( title ) ); - GTK_WIDGET_UNSET_FLAGS( m_widget, GTK_CAN_FOCUS ); + gtk_widget_set_can_focus(m_widget, false); g_signal_connect (m_widget, "delete_event", G_CALLBACK (gtk_frame_delete_callback), this); @@ -572,7 +611,7 @@ bool wxTopLevelWindowGTK::Create( wxWindow *parent, // m_mainWidget is a GtkVBox, holding the bars and client area (m_wxwindow) m_mainWidget = gtk_vbox_new(false, 0); gtk_widget_show( m_mainWidget ); - GTK_WIDGET_UNSET_FLAGS( m_mainWidget, GTK_CAN_FOCUS ); + gtk_widget_set_can_focus(m_mainWidget, false); gtk_container_add( GTK_CONTAINER(m_widget), m_mainWidget ); // m_wxwindow is the client area @@ -582,7 +621,7 @@ bool wxTopLevelWindowGTK::Create( wxWindow *parent, // we donm't allow the frame to get the focus as otherwise // the frame will grab it at arbitrary focus changes - GTK_WIDGET_UNSET_FLAGS( m_wxwindow, GTK_CAN_FOCUS ); + gtk_widget_set_can_focus(m_wxwindow, false); if (m_parent) m_parent->AddChild( this ); @@ -593,13 +632,10 @@ bool wxTopLevelWindowGTK::Create( wxWindow *parent, G_CALLBACK (wxgtk_tlw_size_request_callback), this); PostCreation(); +#if !GTK_CHECK_VERSION(3,0,0) && !defined(GTK_DISABLE_DEPRECATED) if ((m_x != -1) || (m_y != -1)) gtk_widget_set_uposition( m_widget, m_x, m_y ); - - // we cannot set MWM hints and icons before the widget has - // been realized, so we do this directly after realization - g_signal_connect (m_widget, "realize", - G_CALLBACK (gtk_frame_realized_callback), this); +#endif // for some reported size corrections g_signal_connect (m_widget, "map_event", @@ -677,6 +713,13 @@ bool wxTopLevelWindowGTK::Create( wxWindow *parent, wxTopLevelWindowGTK::~wxTopLevelWindowGTK() { + if ( m_netFrameExtentsTimerId ) + { + // Don't let the timer callback fire as the window pointer passed to it + // will become invalid very soon. + g_source_remove(m_netFrameExtentsTimerId); + } + #if wxUSE_LIBHILDON || wxUSE_LIBHILDON2 // it can also be a (standard) dialog if ( HILDON_IS_WINDOW(m_widget) ) @@ -713,8 +756,9 @@ bool wxTopLevelWindowGTK::EnableCloseButton( bool enable ) else m_gdkFunc &= ~GDK_FUNC_CLOSE; - if (GTK_WIDGET_REALIZED(m_widget) && (m_widget->window)) - gdk_window_set_functions( m_widget->window, (GdkWMFunction)m_gdkFunc ); + GdkWindow* window = gtk_widget_get_window(m_widget); + if (window) + gdk_window_set_functions(window, (GdkWMFunction)m_gdkFunc); return true; } @@ -726,6 +770,7 @@ bool wxTopLevelWindowGTK::ShowFullScreen(bool show, long) m_fsIsShowing = show; +#ifdef GDK_WINDOWING_X11 wxX11FullScreenMethod method = wxGetFullScreenMethodX11((WXDisplay*)GDK_DISPLAY(), (WXWindow)GDK_ROOT_WINDOW()); @@ -735,15 +780,17 @@ bool wxTopLevelWindowGTK::ShowFullScreen(bool show, long) // check if WM supports the spec and use legacy methods if it // doesn't. if ( method == wxX11_FS_WMSPEC ) +#endif // GDK_WINDOWING_X11 { if (show) gtk_window_fullscreen( GTK_WINDOW( m_widget ) ); else gtk_window_unfullscreen( GTK_WINDOW( m_widget ) ); } +#ifdef GDK_WINDOWING_X11 else { - GdkWindow *window = m_widget->window; + GdkWindow* window = gtk_widget_get_window(m_widget); if (show) { @@ -762,12 +809,11 @@ bool wxTopLevelWindowGTK::ShowFullScreen(bool show, long) gdk_window_set_decorations(window, (GdkWMDecoration)0); gdk_window_set_functions(window, (GdkWMFunction)0); - gdk_window_get_origin (m_widget->window, &root_x, &root_y); - gdk_window_get_geometry (m_widget->window, &client_x, &client_y, - &width, &height, NULL); + gdk_window_get_origin(window, &root_x, &root_y); + gdk_window_get_geometry(window, &client_x, &client_y, &width, &height, NULL); - gdk_window_move_resize (m_widget->window, -client_x, -client_y, - screen_width + 1, screen_height + 1); + gdk_window_move_resize( + window, -client_x, -client_y, screen_width + 1, screen_height + 1); wxSetFullScreenStateX11((WXDisplay*)GDK_DISPLAY(), (WXWindow)GDK_ROOT_WINDOW(), @@ -790,6 +836,7 @@ bool wxTopLevelWindowGTK::ShowFullScreen(bool show, long) m_fsSaveFrame.width, m_fsSaveFrame.height); } } +#endif // GDK_WINDOWING_X11 // documented behaviour is to show the window if it's still hidden when // showing it full screen @@ -809,8 +856,11 @@ void wxTopLevelWindowGTK::Refresh( bool WXUNUSED(eraseBackground), const wxRect gtk_widget_queue_draw( m_widget ); - if (m_wxwindow && m_wxwindow->window) - gdk_window_invalidate_rect( m_wxwindow->window, NULL, TRUE ); + GdkWindow* window = NULL; + if (m_wxwindow) + window = gtk_widget_get_window(m_wxwindow); + if (window) + gdk_window_invalidate_rect(window, NULL, true); } bool wxTopLevelWindowGTK::Show( bool show ) @@ -820,7 +870,8 @@ bool wxTopLevelWindowGTK::Show( bool show ) bool deferShow = show && !m_isShown && m_deferShow; if (deferShow) { - deferShow = m_deferShowAllowed && !GTK_WIDGET_REALIZED(m_widget); + deferShow = gs_requestFrameExtentsStatus != 2 && + m_deferShowAllowed && !gtk_widget_get_realized(m_widget); if (deferShow) { deferShow = g_signal_handler_find(m_widget, @@ -831,22 +882,19 @@ bool wxTopLevelWindowGTK::Show( bool show ) GdkScreen* screen = NULL; if (deferShow) { +#ifdef GDK_WINDOWING_X11 screen = gtk_widget_get_screen(m_widget); GdkAtom atom = gdk_atom_intern("_NET_REQUEST_FRAME_EXTENTS", false); deferShow = gdk_x11_screen_supports_net_wm_hint(screen, atom) != 0; +#else + deferShow = false; +#endif // If _NET_REQUEST_FRAME_EXTENTS not supported, don't allow changes // to m_decorSize, it breaks saving/restoring window size with // GetSize()/SetSize() because it makes window bigger between each // restore and save. m_updateDecorSize = deferShow; } - if (deferShow) - { - // Fluxbox support for _NET_REQUEST_FRAME_EXTENTS is broken - const char* name = gdk_x11_screen_get_window_manager_name(screen); - deferShow = strcmp(name, "Fluxbox") != 0; - m_updateDecorSize = deferShow; - } m_deferShow = deferShow; } @@ -863,33 +911,52 @@ bool wxTopLevelWindowGTK::Show( bool show ) // causes the widget tree to be size_allocated, which generates size // events in the wrong order. However, the size_allocates will not be // done if the allocation is not the default (1,1). - const int alloc_width = m_widget->allocation.width; + GtkAllocation alloc; + gtk_widget_get_allocation(m_widget, &alloc); + const int alloc_width = alloc.width; if (alloc_width == 1) - m_widget->allocation.width = 2; + { + alloc.width = 2; + gtk_widget_set_allocation(m_widget, &alloc); + } gtk_widget_realize(m_widget); if (alloc_width == 1) - m_widget->allocation.width = 1; + { + alloc.width = 1; + gtk_widget_set_allocation(m_widget, &alloc); + } +#ifdef GDK_WINDOWING_X11 // send _NET_REQUEST_FRAME_EXTENTS XClientMessageEvent xevent; memset(&xevent, 0, sizeof(xevent)); xevent.type = ClientMessage; - xevent.window = gdk_x11_drawable_get_xid(m_widget->window); + GdkWindow* window = gtk_widget_get_window(m_widget); + xevent.window = gdk_x11_drawable_get_xid(window); xevent.message_type = gdk_x11_atom_to_xatom_for_display( - gdk_drawable_get_display(m_widget->window), + gdk_drawable_get_display(window), gdk_atom_intern("_NET_REQUEST_FRAME_EXTENTS", false)); xevent.format = 32; - Display* display = gdk_x11_drawable_get_xdisplay(m_widget->window); + Display* display = gdk_x11_drawable_get_xdisplay(window); XSendEvent(display, DefaultRootWindow(display), false, SubstructureNotifyMask | SubstructureRedirectMask, (XEvent*)&xevent); +#endif // GDK_WINDOWING_X11 + + if (gs_requestFrameExtentsStatus == 0) + { + // if WM does not respond to request within 1 second, + // we assume support for _NET_REQUEST_FRAME_EXTENTS is not working + m_netFrameExtentsTimerId = + g_timeout_add(1000, request_frame_extents_timeout, this); + } // defer calling gtk_widget_show() m_isShown = true; return true; } - if (show && !GTK_WIDGET_REALIZED(m_widget)) + if (show && !gtk_widget_get_realized(m_widget)) { // size_allocate signals occur in reverse order (bottom to top). // Things work better if the initial wxSizeEvents are sent (from the @@ -1194,7 +1261,7 @@ void wxTopLevelWindowGTK::SetIcons( const wxIconBundle &icons ) // Setting icons before window is realized can cause a GTK assertion if // another TLW is realized before this one, and it has this one as it's // transient parent. The life demo exibits this problem. - if (GTK_WIDGET_REALIZED(m_widget)) + if (gtk_widget_get_realized(m_widget)) { GList* list = NULL; for (size_t i = icons.GetIconCount(); i--;) @@ -1218,8 +1285,10 @@ void wxTopLevelWindowGTK::Maximize(bool maximize) bool wxTopLevelWindowGTK::IsMaximized() const { - return m_widget->window && - (gdk_window_get_state(m_widget->window) & GDK_WINDOW_STATE_MAXIMIZED); + GdkWindow* window = NULL; + if (m_widget) + window = gtk_widget_get_window(m_widget); + return window && (gdk_window_get_state(window) & GDK_WINDOW_STATE_MAXIMIZED); } void wxTopLevelWindowGTK::Restore() @@ -1270,49 +1339,6 @@ void wxTopLevelWindowGTK::RemoveGrab() } } - -// helper -static bool do_shape_combine_region(GdkWindow* window, const wxRegion& region) -{ - if (window) - { - if (region.IsEmpty()) - { - gdk_window_shape_combine_mask(window, NULL, 0, 0); - } - else - { - gdk_window_shape_combine_region(window, region.GetRegion(), 0, 0); - return true; - } - } - return false; -} - - -bool wxTopLevelWindowGTK::SetShape(const wxRegion& region) -{ - wxCHECK_MSG( HasFlag(wxFRAME_SHAPED), false, - wxT("Shaped windows must be created with the wxFRAME_SHAPED style.")); - - if ( GTK_WIDGET_REALIZED(m_widget) ) - { - if ( m_wxwindow ) - do_shape_combine_region(m_wxwindow->window, region); - - return do_shape_combine_region(m_widget->window, region); - } - else // not realized yet - { - // store the shape to set, it will be really set once we're realized - m_shape = region; - - // we don't know if we're going to succeed or fail, be optimistic by - // default - return true; - } -} - bool wxTopLevelWindowGTK::IsActive() { return (this == (wxTopLevelWindowGTK*)g_activeFrame); @@ -1334,7 +1360,7 @@ void wxTopLevelWindowGTK::RequestUserAttention(int flags) m_urgency_hint = -2; - if( GTK_WIDGET_REALIZED(m_widget) && !IsActive() ) + if( gtk_widget_get_realized(m_widget) && !IsActive() ) { new_hint_value = true; @@ -1346,12 +1372,7 @@ void wxTopLevelWindowGTK::RequestUserAttention(int flags) } } -#if GTK_CHECK_VERSION(2,7,0) - if(!gtk_check_version(2,7,0)) - gtk_window_set_urgency_hint(GTK_WINDOW( m_widget ), new_hint_value); - else -#endif - wxgtk_window_set_urgency_hint(GTK_WINDOW( m_widget ), new_hint_value); + gtk_window_set_urgency_hint(GTK_WINDOW(m_widget), new_hint_value); } void wxTopLevelWindowGTK::SetWindowStyleFlag( long style ) @@ -1380,6 +1401,7 @@ void wxTopLevelWindowGTK::SetWindowStyleFlag( long style ) } } +#ifdef GDK_WINDOWING_X11 /* Get the X Window between child and the root window. This should usually be the WM managed XID */ static Window wxGetTopmostWindowX11(Display *dpy, Window child) @@ -1399,17 +1421,22 @@ static Window wxGetTopmostWindowX11(Display *dpy, Window child) return child; } +#endif // GDK_WINDOWING_X11 bool wxTopLevelWindowGTK::SetTransparent(wxByte alpha) { - if (!m_widget || !m_widget->window) + GdkWindow* window = NULL; + if (m_widget) + window = gtk_widget_get_window(m_widget); + if (window == NULL) return false; - Display* dpy = GDK_WINDOW_XDISPLAY (m_widget->window); +#ifdef GDK_WINDOWING_X11 + Display* dpy = GDK_WINDOW_XDISPLAY(window); // We need to get the X Window that has the root window as the immediate parent // and m_widget->window as a child. This should be the X Window that the WM manages and // from which the opacity property is checked from. - Window win = wxGetTopmostWindowX11(dpy, GDK_WINDOW_XID (m_widget->window)); + Window win = wxGetTopmostWindowX11(dpy, GDK_WINDOW_XID(window)); // Using pure Xlib to not have a GTK version check mess due to gtk2.0 not having GdkDisplay @@ -1424,6 +1451,9 @@ bool wxTopLevelWindowGTK::SetTransparent(wxByte alpha) } XSync(dpy, False); return true; +#else // !GDK_WINDOWING_X11 + return false; +#endif // GDK_WINDOWING_X11 / !GDK_WINDOWING_X11 } bool wxTopLevelWindowGTK::CanSetTransparent() diff --git a/Externals/wxWidgets3/src/gtk/treeentry_gtk.c b/Externals/wxWidgets3/src/gtk/treeentry_gtk.c index 7a87b39b2f..63d8c234ac 100644 --- a/Externals/wxWidgets3/src/gtk/treeentry_gtk.c +++ b/Externals/wxWidgets3/src/gtk/treeentry_gtk.c @@ -2,7 +2,7 @@ // Name: src/gtk/treeentry_gtk.c // Purpose: GtkTreeEntry implementation // Author: Ryan Norton -// Id: $Id: treeentry_gtk.c 65341 2010-08-18 21:28:11Z RR $ +// Id: $Id: treeentry_gtk.c 67433 2011-04-11 09:36:56Z JJ $ // Copyright: (c) 2006 Ryan Norton // Licence: wxWindows licence /////////////////////////////////////////////////////////////////////////// */ @@ -46,10 +46,10 @@ gtk_tree_entry_new() return GTK_TREE_ENTRY(g_object_new(GTK_TYPE_TREE_ENTRY, NULL)); } -GtkType +GType gtk_tree_entry_get_type () { - static GtkType tree_entry_type = 0; + static GType tree_entry_type = 0; if (!tree_entry_type) { diff --git a/Externals/wxWidgets3/src/gtk/utilsgtk.cpp b/Externals/wxWidgets3/src/gtk/utilsgtk.cpp index 70a7c04f9f..bf5e770bb6 100644 --- a/Externals/wxWidgets3/src/gtk/utilsgtk.cpp +++ b/Externals/wxWidgets3/src/gtk/utilsgtk.cpp @@ -2,7 +2,7 @@ // Name: src/gtk/utilsgtk.cpp // Purpose: // Author: Robert Roebling -// Id: $Id: utilsgtk.cpp 66657 2011-01-08 18:05:33Z PC $ +// Id: $Id: utilsgtk.cpp 70704 2012-02-27 00:40:16Z VZ $ // Copyright: (c) 1998 Robert Roebling // Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// @@ -26,6 +26,14 @@ #include "wx/gtk/private/timer.h" #include "wx/evtloop.h" +#include +#ifdef GDK_WINDOWING_WIN32 +#include +#endif +#ifdef GDK_WINDOWING_X11 +#include +#endif + #if wxDEBUG_LEVEL #include "wx/gtk/assertdlg_gtk.h" #if wxUSE_STACKWALKER @@ -37,11 +45,9 @@ #include #include #include -#include // for WNOHANG +#ifdef __UNIX__ #include - -#include -#include +#endif #if wxUSE_DETECT_SM #include @@ -90,7 +96,7 @@ void wxDisplaySizeMM( int *width, int *height ) void wxGetMousePosition( int* x, int* y ) { - gdk_window_get_pointer( NULL, x, y, NULL ); + gdk_window_get_pointer(gtk_widget_get_root_window(wxGetRootWindow()), x, y, NULL); } bool wxColourDisplay() @@ -100,7 +106,7 @@ bool wxColourDisplay() int wxDisplayDepth() { - return gdk_drawable_get_visual( wxGetRootWindow()->window )->depth; + return gtk_widget_get_visual(wxGetRootWindow())->depth; } wxWindow* wxFindWindowAtPoint(const wxPoint& pt) @@ -186,31 +192,28 @@ const gchar *wx_pango_version_check (int major, int minor, int micro) // ---------------------------------------------------------------------------- extern "C" { -static -void GTK_EndProcessDetector(gpointer data, gint source, - GdkInputCondition WXUNUSED(condition)) +static gboolean EndProcessDetector(GIOChannel* source, GIOCondition, void* data) { wxEndProcessData * const proc_data = static_cast(data); // child exited, end waiting - close(source); - - // don't call us again! - gdk_input_remove(proc_data->tag); + close(g_io_channel_unix_get_fd(source)); wxHandleProcessTermination(proc_data); + + // don't call us again! + return false; } } int wxGUIAppTraits::AddProcessCallback(wxEndProcessData *proc_data, int fd) { - int tag = gdk_input_add(fd, - GDK_INPUT_READ, - GTK_EndProcessDetector, - (gpointer)proc_data); - - return tag; + GIOChannel* channel = g_io_channel_unix_new(fd); + GIOCondition cond = GIOCondition(G_IO_IN | G_IO_HUP | G_IO_ERR); + unsigned id = g_io_add_watch(channel, cond, EndProcessDetector, proc_data); + g_io_channel_unref(channel); + return int(id); } @@ -328,14 +331,11 @@ private: GtkAssertDialog *m_dlg; }; -// the callback functions must be extern "C" to comply with GTK+ declarations -extern "C" +static void get_stackframe_callback(void* p) { - void get_stackframe_callback(StackDump *dump) - { - // skip over frames up to including wxOnAssert() - dump->ProcessFrames(3); - } + StackDump* dump = static_cast(p); + // skip over frames up to including wxOnAssert() + dump->ProcessFrames(3); } #endif // wxDEBUG_LEVEL && wxUSE_STACKWALKER @@ -362,7 +362,7 @@ bool wxGUIAppTraits::ShowAssertDialog(const wxString& msg) gtk_assert_dialog_set_backtrace_callback ( GTK_ASSERT_DIALOG(dialog), - (GtkAssertDialogStackFrameCallback)get_stackframe_callback, + get_stackframe_callback, &dump ); #endif // wxUSE_STACKWALKER @@ -472,11 +472,11 @@ wxGUIAppTraits::GetStandardCmdLineOptions(wxArrayString& names, { // since GTK>=2.6, we can use the glib_check_version() symbol... - // check whether GLib version is greater than 2.6 but also lower than 2.19 + // check whether GLib version is greater than 2.6 but also lower than 2.31 // because, as we use the undocumented _GOptionGroup struct, we don't want - // to run this code with future versions which might change it (2.19 is the + // to run this code with future versions which might change it (2.30 is the // latest one at the time of this writing) - if (!glib_check_version(2,6,0) && glib_check_version(2,20,0)) + if (glib_check_version(2,6,0) == NULL && glib_check_version(2,31,0)) { usage << _("The following standard GTK+ options are also supported:\n"); diff --git a/Externals/wxWidgets3/src/gtk/webview_webkit.cpp b/Externals/wxWidgets3/src/gtk/webview_webkit.cpp new file mode 100644 index 0000000000..d4b9528193 --- /dev/null +++ b/Externals/wxWidgets3/src/gtk/webview_webkit.cpp @@ -0,0 +1,924 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: src/gtk/webview_webkit.cpp +// Purpose: GTK WebKit backend for web view component +// Author: Marianne Gagnon, Robert Roebling +// Id: $Id: webview_webkit.cpp 70768 2012-03-01 16:44:31Z PC $ +// Copyright: (c) 2010 Marianne Gagnon, 1998 Robert Roebling +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +// For compilers that support precompilation, includes "wx.h". +#include "wx/wxprec.h" + +#if wxUSE_WEBVIEW && wxUSE_WEBVIEW_WEBKIT + +#include "wx/stockitem.h" +#include "wx/gtk/webview_webkit.h" +#include "wx/gtk/control.h" +#include "wx/gtk/private.h" +#include "wx/filesys.h" +#include "wx/base64.h" +#include + +// ---------------------------------------------------------------------------- +// GTK callbacks +// ---------------------------------------------------------------------------- + +extern "C" +{ + +static void +wxgtk_webview_webkit_load_status(GtkWidget* widget, + GParamSpec*, + wxWebViewWebKit *webKitCtrl) +{ + wxString url = webKitCtrl->GetCurrentURL(); + + WebKitLoadStatus status; + g_object_get(G_OBJECT(widget), "load-status", &status, NULL); + + wxString target; // TODO: get target (if possible) + + if (status == WEBKIT_LOAD_FINISHED) + { + WebKitWebBackForwardList* hist = webkit_web_view_get_back_forward_list(WEBKIT_WEB_VIEW(widget)); + WebKitWebHistoryItem* item = webkit_web_back_forward_list_get_current_item(hist); + //We have to check if we are actually storing history + //If the item isn't added we add it ourselves, it isn't added otherwise + //with a custom scheme. + if(WEBKIT_IS_WEB_HISTORY_ITEM(item) && webkit_web_history_item_get_uri(item) != url) + { + WebKitWebHistoryItem* + newitem = webkit_web_history_item_new_with_data + ( + url.utf8_str(), + webKitCtrl->GetCurrentTitle().utf8_str() + ); + webkit_web_back_forward_list_add_item(hist, newitem); + } + + webKitCtrl->m_busy = false; + wxWebViewEvent event(wxEVT_COMMAND_WEB_VIEW_LOADED, + webKitCtrl->GetId(), + url, target); + + if (webKitCtrl && webKitCtrl->GetEventHandler()) + webKitCtrl->GetEventHandler()->ProcessEvent(event); + } + else if (status == WEBKIT_LOAD_COMMITTED) + { + webKitCtrl->m_busy = true; + wxWebViewEvent event(wxEVT_COMMAND_WEB_VIEW_NAVIGATED, + webKitCtrl->GetId(), + url, target); + + if (webKitCtrl && webKitCtrl->GetEventHandler()) + webKitCtrl->GetEventHandler()->ProcessEvent(event); + } +} + +static gboolean +wxgtk_webview_webkit_navigation(WebKitWebView *, + WebKitWebFrame *frame, + WebKitNetworkRequest *request, + WebKitWebNavigationAction *, + WebKitWebPolicyDecision *policy_decision, + wxWebViewWebKit *webKitCtrl) +{ + if(webKitCtrl->m_guard) + { + webKitCtrl->m_guard = false; + //We set this to make sure that we don't try to load the page again from + //the resource request callback + webKitCtrl->m_vfsurl = webkit_network_request_get_uri(request); + webkit_web_policy_decision_use(policy_decision); + return FALSE; + } + + webKitCtrl->m_busy = true; + + const gchar* uri = webkit_network_request_get_uri(request); + + wxString target = webkit_web_frame_get_name (frame); + wxWebViewEvent event(wxEVT_COMMAND_WEB_VIEW_NAVIGATING, + webKitCtrl->GetId(), + wxString( uri, wxConvUTF8 ), + target); + + if (webKitCtrl && webKitCtrl->GetEventHandler()) + webKitCtrl->GetEventHandler()->ProcessEvent(event); + + if (!event.IsAllowed()) + { + webKitCtrl->m_busy = false; + webkit_web_policy_decision_ignore(policy_decision); + return TRUE; + } + else + { + wxString wxuri = uri; + wxSharedPtr handler; + wxVector > hanlders = webKitCtrl->GetHandlers(); + //We are not vetoed so see if we match one of the additional handlers + for(wxVector >::iterator it = hanlders.begin(); + it != hanlders.end(); ++it) + { + if(wxuri.substr(0, (*it)->GetName().length()) == (*it)->GetName()) + { + handler = (*it); + } + } + //If we found a handler we can then use it to load the file directly + //ourselves + if(handler) + { + webKitCtrl->m_guard = true; + wxFSFile* file = handler->GetFile(wxuri); + if(file) + { + webKitCtrl->SetPage(*file->GetStream(), wxuri); + } + //We need to throw some sort of error here if file is NULL + webkit_web_policy_decision_ignore(policy_decision); + return TRUE; + } + return FALSE; + } +} + +static gboolean +wxgtk_webview_webkit_error(WebKitWebView*, + WebKitWebFrame*, + gchar *uri, + gpointer web_error, + wxWebViewWebKit* webKitWindow) +{ + webKitWindow->m_busy = false; + wxWebViewNavigationError type = wxWEB_NAV_ERR_OTHER; + + GError* error = (GError*)web_error; + wxString description(error->message, wxConvUTF8); + + if (strcmp(g_quark_to_string(error->domain), "soup_http_error_quark") == 0) + { + switch (error->code) + { + case SOUP_STATUS_CANCELLED: + type = wxWEB_NAV_ERR_USER_CANCELLED; + break; + + case SOUP_STATUS_CANT_RESOLVE: + case SOUP_STATUS_NOT_FOUND: + type = wxWEB_NAV_ERR_NOT_FOUND; + break; + + case SOUP_STATUS_CANT_RESOLVE_PROXY: + case SOUP_STATUS_CANT_CONNECT: + case SOUP_STATUS_CANT_CONNECT_PROXY: + case SOUP_STATUS_SSL_FAILED: + case SOUP_STATUS_IO_ERROR: + type = wxWEB_NAV_ERR_CONNECTION; + break; + + case SOUP_STATUS_MALFORMED: + //case SOUP_STATUS_TOO_MANY_REDIRECTS: + type = wxWEB_NAV_ERR_REQUEST; + break; + + //case SOUP_STATUS_NO_CONTENT: + //case SOUP_STATUS_RESET_CONTENT: + + case SOUP_STATUS_BAD_REQUEST: + type = wxWEB_NAV_ERR_REQUEST; + break; + + case SOUP_STATUS_UNAUTHORIZED: + case SOUP_STATUS_FORBIDDEN: + type = wxWEB_NAV_ERR_AUTH; + break; + + case SOUP_STATUS_METHOD_NOT_ALLOWED: + case SOUP_STATUS_NOT_ACCEPTABLE: + type = wxWEB_NAV_ERR_SECURITY; + break; + + case SOUP_STATUS_PROXY_AUTHENTICATION_REQUIRED: + type = wxWEB_NAV_ERR_AUTH; + break; + + case SOUP_STATUS_REQUEST_TIMEOUT: + type = wxWEB_NAV_ERR_CONNECTION; + break; + + //case SOUP_STATUS_PAYMENT_REQUIRED: + case SOUP_STATUS_REQUEST_ENTITY_TOO_LARGE: + case SOUP_STATUS_REQUEST_URI_TOO_LONG: + case SOUP_STATUS_UNSUPPORTED_MEDIA_TYPE: + type = wxWEB_NAV_ERR_REQUEST; + break; + + case SOUP_STATUS_BAD_GATEWAY: + case SOUP_STATUS_SERVICE_UNAVAILABLE: + case SOUP_STATUS_GATEWAY_TIMEOUT: + type = wxWEB_NAV_ERR_CONNECTION; + break; + + case SOUP_STATUS_HTTP_VERSION_NOT_SUPPORTED: + type = wxWEB_NAV_ERR_REQUEST; + break; + //case SOUP_STATUS_INSUFFICIENT_STORAGE: + //case SOUP_STATUS_NOT_EXTENDED: + } + } + else if (strcmp(g_quark_to_string(error->domain), + "webkit-network-error-quark") == 0) + { + switch (error->code) + { + //WEBKIT_NETWORK_ERROR_FAILED: + //WEBKIT_NETWORK_ERROR_TRANSPORT: + + case WEBKIT_NETWORK_ERROR_UNKNOWN_PROTOCOL: + type = wxWEB_NAV_ERR_REQUEST; + break; + + case WEBKIT_NETWORK_ERROR_CANCELLED: + type = wxWEB_NAV_ERR_USER_CANCELLED; + break; + + case WEBKIT_NETWORK_ERROR_FILE_DOES_NOT_EXIST: + type = wxWEB_NAV_ERR_NOT_FOUND; + break; + } + } + else if (strcmp(g_quark_to_string(error->domain), + "webkit-policy-error-quark") == 0) + { + switch (error->code) + { + //case WEBKIT_POLICY_ERROR_FAILED: + //case WEBKIT_POLICY_ERROR_CANNOT_SHOW_MIME_TYPE: + //case WEBKIT_POLICY_ERROR_CANNOT_SHOW_URL: + //case WEBKIT_POLICY_ERROR_FRAME_LOAD_INTERRUPTED_BY_POLICY_CHANGE: + case WEBKIT_POLICY_ERROR_CANNOT_USE_RESTRICTED_PORT: + type = wxWEB_NAV_ERR_SECURITY; + break; + } + } + /* + webkit_plugin_error_quark + else + { + printf("Error domain %s\n", g_quark_to_string(error->domain)); + } + */ + + wxWebViewEvent event(wxEVT_COMMAND_WEB_VIEW_ERROR, + webKitWindow->GetId(), + uri, ""); + event.SetString(description); + event.SetInt(type); + + if (webKitWindow && webKitWindow->GetEventHandler()) + { + webKitWindow->GetEventHandler()->ProcessEvent(event); + } + + return FALSE; +} + +static gboolean +wxgtk_webview_webkit_new_window(WebKitWebView*, + WebKitWebFrame *frame, + WebKitNetworkRequest *request, + WebKitWebNavigationAction*, + WebKitWebPolicyDecision *policy_decision, + wxWebViewWebKit *webKitCtrl) +{ + const gchar* uri = webkit_network_request_get_uri(request); + + wxString target = webkit_web_frame_get_name (frame); + wxWebViewEvent event(wxEVT_COMMAND_WEB_VIEW_NEWWINDOW, + webKitCtrl->GetId(), + wxString( uri, wxConvUTF8 ), + target); + + if (webKitCtrl && webKitCtrl->GetEventHandler()) + webKitCtrl->GetEventHandler()->ProcessEvent(event); + + //We always want the user to handle this themselves + webkit_web_policy_decision_ignore(policy_decision); + return TRUE; +} + +static void +wxgtk_webview_webkit_title_changed(WebKitWebView*, + WebKitWebFrame*, + gchar *title, + wxWebViewWebKit *webKitCtrl) +{ + wxWebViewEvent event(wxEVT_COMMAND_WEB_VIEW_TITLE_CHANGED, + webKitCtrl->GetId(), + webKitCtrl->GetCurrentURL(), + ""); + event.SetString(wxString(title, wxConvUTF8)); + + if (webKitCtrl && webKitCtrl->GetEventHandler()) + webKitCtrl->GetEventHandler()->ProcessEvent(event); + +} + +static void +wxgtk_webview_webkit_resource_req(WebKitWebView *, + WebKitWebFrame *, + WebKitWebResource *, + WebKitNetworkRequest *request, + WebKitNetworkResponse *, + wxWebViewWebKit *webKitCtrl) +{ + wxString uri = webkit_network_request_get_uri(request); + + wxSharedPtr handler; + wxVector > hanlders = webKitCtrl->GetHandlers(); + + //We are not vetoed so see if we match one of the additional handlers + for(wxVector >::iterator it = hanlders.begin(); + it != hanlders.end(); ++it) + { + if(uri.substr(0, (*it)->GetName().length()) == (*it)->GetName()) + { + handler = (*it); + } + } + //If we found a handler we can then use it to load the file directly + //ourselves + if(handler) + { + //If it is requsting the page itself then return as we have already + //loaded it from the archive + if(webKitCtrl->m_vfsurl == uri) + return; + + wxFSFile* file = handler->GetFile(uri); + if(file) + { + //We load the data into a data url to save it being written out again + size_t size = file->GetStream()->GetLength(); + char *buffer = new char[size]; + file->GetStream()->Read(buffer, size); + wxString data = wxBase64Encode(buffer, size); + delete[] buffer; + wxString mime = file->GetMimeType(); + wxString path = "data:" + mime + ";base64," + data; + //Then we can redirect the call + webkit_network_request_set_uri(request, path.utf8_str()); + } + + } +} + +} // extern "C" + +//----------------------------------------------------------------------------- +// wxWebViewWebKit +//----------------------------------------------------------------------------- + +wxIMPLEMENT_DYNAMIC_CLASS(wxWebViewWebKit, wxWebView); + +bool wxWebViewWebKit::Create(wxWindow *parent, + wxWindowID id, + const wxString &url, + const wxPoint& pos, + const wxSize& size, + long style, + const wxString& name) +{ + m_busy = false; + m_guard = false; + + if (!PreCreation( parent, pos, size ) || + !CreateBase( parent, id, pos, size, style, wxDefaultValidator, name )) + { + wxFAIL_MSG( wxT("wxWebViewWebKit creation failed") ); + return false; + } + + m_widget = gtk_scrolled_window_new(NULL, NULL); + g_object_ref(m_widget); + m_web_view = WEBKIT_WEB_VIEW(webkit_web_view_new()); + + /* Place the WebKitWebView in the GtkScrolledWindow */ + gtk_container_add(GTK_CONTAINER(m_widget), GTK_WIDGET(m_web_view)); + gtk_widget_show(GTK_WIDGET(m_web_view)); + + g_signal_connect_after(m_web_view, "navigation-policy-decision-requested", + G_CALLBACK(wxgtk_webview_webkit_navigation), + this); + g_signal_connect_after(m_web_view, "load-error", + G_CALLBACK(wxgtk_webview_webkit_error), + this); + + g_signal_connect_after(m_web_view, "new-window-policy-decision-requested", + G_CALLBACK(wxgtk_webview_webkit_new_window), this); + + g_signal_connect_after(m_web_view, "title-changed", + G_CALLBACK(wxgtk_webview_webkit_title_changed), this); + + g_signal_connect_after(m_web_view, "resource-request-starting", + G_CALLBACK(wxgtk_webview_webkit_resource_req), this); + + m_parent->DoAddChild( this ); + + PostCreation(size); + + /* Open a webpage */ + webkit_web_view_load_uri(m_web_view, url.utf8_str()); + + //Get the initial history limit so we can enable and disable it later + WebKitWebBackForwardList* history; + history = webkit_web_view_get_back_forward_list(m_web_view); + m_historyLimit = webkit_web_back_forward_list_get_limit(history); + + // last to avoid getting signal too early + g_signal_connect_after(m_web_view, "notify::load-status", + G_CALLBACK(wxgtk_webview_webkit_load_status), + this); + + return true; +} + +bool wxWebViewWebKit::Enable( bool enable ) +{ + if (!wxControl::Enable(enable)) + return false; + + gtk_widget_set_sensitive(GTK_BIN(m_widget)->child, enable); + + //if (enable) + // GTKFixSensitivity(); + + return true; +} + +GdkWindow* +wxWebViewWebKit::GTKGetWindow(wxArrayGdkWindows& WXUNUSED(windows)) const +{ + GdkWindow* window = gtk_widget_get_parent_window(m_widget); + return window; +} + +void wxWebViewWebKit::ZoomIn() +{ + webkit_web_view_zoom_in(m_web_view); +} + +void wxWebViewWebKit::ZoomOut() +{ + webkit_web_view_zoom_out(m_web_view); +} + +void wxWebViewWebKit::SetWebkitZoom(float level) +{ + webkit_web_view_set_zoom_level(m_web_view, level); +} + +float wxWebViewWebKit::GetWebkitZoom() const +{ + return webkit_web_view_get_zoom_level(m_web_view); +} + +void wxWebViewWebKit::Stop() +{ + webkit_web_view_stop_loading(m_web_view); +} + +void wxWebViewWebKit::Reload(wxWebViewReloadFlags flags) +{ + if (flags & wxWEB_VIEW_RELOAD_NO_CACHE) + { + webkit_web_view_reload_bypass_cache(m_web_view); + } + else + { + webkit_web_view_reload(m_web_view); + } +} + +void wxWebViewWebKit::LoadURL(const wxString& url) +{ + webkit_web_view_load_uri(m_web_view, wxGTK_CONV(url)); +} + + +void wxWebViewWebKit::GoBack() +{ + webkit_web_view_go_back(m_web_view); +} + +void wxWebViewWebKit::GoForward() +{ + webkit_web_view_go_forward(m_web_view); +} + + +bool wxWebViewWebKit::CanGoBack() const +{ + return webkit_web_view_can_go_back(m_web_view); +} + + +bool wxWebViewWebKit::CanGoForward() const +{ + return webkit_web_view_can_go_forward(m_web_view); +} + +void wxWebViewWebKit::ClearHistory() +{ + WebKitWebBackForwardList* history; + history = webkit_web_view_get_back_forward_list(m_web_view); + webkit_web_back_forward_list_clear(history); +} + +void wxWebViewWebKit::EnableHistory(bool enable) +{ + WebKitWebBackForwardList* history; + history = webkit_web_view_get_back_forward_list(m_web_view); + if(enable) + { + webkit_web_back_forward_list_set_limit(history, m_historyLimit); + } + else + { + webkit_web_back_forward_list_set_limit(history, 0); + } +} + +wxVector > wxWebViewWebKit::GetBackwardHistory() +{ + wxVector > backhist; + WebKitWebBackForwardList* history; + history = webkit_web_view_get_back_forward_list(m_web_view); + GList* list = webkit_web_back_forward_list_get_back_list_with_limit(history, + m_historyLimit); + //We need to iterate in reverse to get the order we desire + for(int i = g_list_length(list) - 1; i >= 0 ; i--) + { + WebKitWebHistoryItem* gtkitem = (WebKitWebHistoryItem*)g_list_nth_data(list, i); + wxWebViewHistoryItem* wxitem = new wxWebViewHistoryItem( + webkit_web_history_item_get_uri(gtkitem), + webkit_web_history_item_get_title(gtkitem)); + wxitem->m_histItem = gtkitem; + wxSharedPtr item(wxitem); + backhist.push_back(item); + } + return backhist; +} + +wxVector > wxWebViewWebKit::GetForwardHistory() +{ + wxVector > forwardhist; + WebKitWebBackForwardList* history; + history = webkit_web_view_get_back_forward_list(m_web_view); + GList* list = webkit_web_back_forward_list_get_forward_list_with_limit(history, + m_historyLimit); + for(guint i = 0; i < g_list_length(list); i++) + { + WebKitWebHistoryItem* gtkitem = (WebKitWebHistoryItem*)g_list_nth_data(list, i); + wxWebViewHistoryItem* wxitem = new wxWebViewHistoryItem( + webkit_web_history_item_get_uri(gtkitem), + webkit_web_history_item_get_title(gtkitem)); + wxitem->m_histItem = gtkitem; + wxSharedPtr item(wxitem); + forwardhist.push_back(item); + } + return forwardhist; +} + +void wxWebViewWebKit::LoadHistoryItem(wxSharedPtr item) +{ + WebKitWebHistoryItem* gtkitem = (WebKitWebHistoryItem*)item->m_histItem; + if(gtkitem) + { + webkit_web_view_go_to_back_forward_item(m_web_view, + WEBKIT_WEB_HISTORY_ITEM(gtkitem)); + } +} + +bool wxWebViewWebKit::CanCut() const +{ + return webkit_web_view_can_cut_clipboard(m_web_view); +} + +bool wxWebViewWebKit::CanCopy() const +{ + return webkit_web_view_can_copy_clipboard(m_web_view); +} + +bool wxWebViewWebKit::CanPaste() const +{ + return webkit_web_view_can_paste_clipboard(m_web_view); +} + +void wxWebViewWebKit::Cut() +{ + webkit_web_view_cut_clipboard(m_web_view); +} + +void wxWebViewWebKit::Copy() +{ + webkit_web_view_copy_clipboard(m_web_view); +} + +void wxWebViewWebKit::Paste() +{ + webkit_web_view_paste_clipboard(m_web_view); +} + +bool wxWebViewWebKit::CanUndo() const +{ + return webkit_web_view_can_undo(m_web_view); +} + +bool wxWebViewWebKit::CanRedo() const +{ + return webkit_web_view_can_redo(m_web_view); +} + +void wxWebViewWebKit::Undo() +{ + webkit_web_view_undo(m_web_view); +} + +void wxWebViewWebKit::Redo() +{ + webkit_web_view_redo(m_web_view); +} + +wxString wxWebViewWebKit::GetCurrentURL() const +{ + // FIXME: check which encoding the web kit control uses instead of + // assuming UTF8 (here and elsewhere too) + return wxString::FromUTF8(webkit_web_view_get_uri(m_web_view)); +} + + +wxString wxWebViewWebKit::GetCurrentTitle() const +{ + return wxString::FromUTF8(webkit_web_view_get_title(m_web_view)); +} + + +wxString wxWebViewWebKit::GetPageSource() const +{ + WebKitWebFrame* frame = webkit_web_view_get_main_frame(m_web_view); + WebKitWebDataSource* src = webkit_web_frame_get_data_source (frame); + + // TODO: check encoding with + // const gchar* + // webkit_web_data_source_get_encoding(WebKitWebDataSource *data_source); + return wxString(webkit_web_data_source_get_data (src)->str, wxConvUTF8); +} + + +wxWebViewZoom wxWebViewWebKit::GetZoom() const +{ + float zoom = GetWebkitZoom(); + + // arbitrary way to map float zoom to our common zoom enum + if (zoom <= 0.65) + { + return wxWEB_VIEW_ZOOM_TINY; + } + else if (zoom > 0.65 && zoom <= 0.90) + { + return wxWEB_VIEW_ZOOM_SMALL; + } + else if (zoom > 0.90 && zoom <= 1.15) + { + return wxWEB_VIEW_ZOOM_MEDIUM; + } + else if (zoom > 1.15 && zoom <= 1.45) + { + return wxWEB_VIEW_ZOOM_LARGE; + } + else if (zoom > 1.45) + { + return wxWEB_VIEW_ZOOM_LARGEST; + } + + // to shut up compilers, this can never be reached logically + wxASSERT(false); + return wxWEB_VIEW_ZOOM_MEDIUM; +} + + +void wxWebViewWebKit::SetZoom(wxWebViewZoom zoom) +{ + // arbitrary way to map our common zoom enum to float zoom + switch (zoom) + { + case wxWEB_VIEW_ZOOM_TINY: + SetWebkitZoom(0.6f); + break; + + case wxWEB_VIEW_ZOOM_SMALL: + SetWebkitZoom(0.8f); + break; + + case wxWEB_VIEW_ZOOM_MEDIUM: + SetWebkitZoom(1.0f); + break; + + case wxWEB_VIEW_ZOOM_LARGE: + SetWebkitZoom(1.3); + break; + + case wxWEB_VIEW_ZOOM_LARGEST: + SetWebkitZoom(1.6); + break; + + default: + wxASSERT(false); + } +} + +void wxWebViewWebKit::SetZoomType(wxWebViewZoomType type) +{ + webkit_web_view_set_full_content_zoom(m_web_view, + (type == wxWEB_VIEW_ZOOM_TYPE_LAYOUT ? + TRUE : FALSE)); +} + +wxWebViewZoomType wxWebViewWebKit::GetZoomType() const +{ + gboolean fczoom = webkit_web_view_get_full_content_zoom(m_web_view); + + if (fczoom) return wxWEB_VIEW_ZOOM_TYPE_LAYOUT; + else return wxWEB_VIEW_ZOOM_TYPE_TEXT; +} + +bool wxWebViewWebKit::CanSetZoomType(wxWebViewZoomType) const +{ + // this port supports all zoom types + return true; +} + +void wxWebViewWebKit::SetPage(const wxString& html, const wxString& baseUri) +{ + webkit_web_view_load_string (m_web_view, + html.mb_str(wxConvUTF8), + "text/html", + "UTF-8", + baseUri.mb_str(wxConvUTF8)); +} + +void wxWebViewWebKit::Print() +{ + WebKitWebFrame* frame = webkit_web_view_get_main_frame(m_web_view); + webkit_web_frame_print (frame); + + // GtkPrintOperationResult webkit_web_frame_print_full + // (WebKitWebFrame *frame, + // GtkPrintOperation *operation, + // GtkPrintOperationAction action, + // GError **error); + +} + + +bool wxWebViewWebKit::IsBusy() const +{ + return m_busy; + + // This code looks nice but returns true after a page was cancelled + /* + WebKitLoadStatus status = webkit_web_view_get_load_status + (WEBKIT_WEB_VIEW(web_view)); + + +#if WEBKIT_CHECK_VERSION(1,1,16) + // WEBKIT_LOAD_FAILED is new in webkit 1.1.16 + if (status == WEBKIT_LOAD_FAILED) + { + return false; + } +#endif + if (status == WEBKIT_LOAD_FINISHED) + { + return false; + } + + return true; + */ +} + +void wxWebViewWebKit::SetEditable(bool enable) +{ + webkit_web_view_set_editable(m_web_view, enable); +} + +bool wxWebViewWebKit::IsEditable() const +{ + return webkit_web_view_get_editable(m_web_view); +} + +void wxWebViewWebKit::DeleteSelection() +{ + webkit_web_view_delete_selection(m_web_view); +} + +bool wxWebViewWebKit::HasSelection() const +{ + return webkit_web_view_has_selection(m_web_view); +} + +void wxWebViewWebKit::SelectAll() +{ + webkit_web_view_select_all(m_web_view); +} + +wxString wxWebViewWebKit::GetSelectedText() const +{ + WebKitDOMDocument* doc; + WebKitDOMDOMWindow* win; + WebKitDOMDOMSelection* sel; + WebKitDOMRange* range; + + doc = webkit_web_view_get_dom_document(m_web_view); + win = webkit_dom_document_get_default_view(WEBKIT_DOM_DOCUMENT(doc)); + sel = webkit_dom_dom_window_get_selection(WEBKIT_DOM_DOM_WINDOW(win)); + range = webkit_dom_dom_selection_get_range_at(WEBKIT_DOM_DOM_SELECTION(sel), + 0, NULL); + return wxString(webkit_dom_range_get_text(WEBKIT_DOM_RANGE(range)), + wxConvUTF8); +} + +wxString wxWebViewWebKit::GetSelectedSource() const +{ + WebKitDOMDocument* doc; + WebKitDOMDOMWindow* win; + WebKitDOMDOMSelection* sel; + WebKitDOMRange* range; + WebKitDOMElement* div; + WebKitDOMDocumentFragment* clone; + WebKitDOMHTMLElement* html; + + doc = webkit_web_view_get_dom_document(m_web_view); + win = webkit_dom_document_get_default_view(WEBKIT_DOM_DOCUMENT(doc)); + sel = webkit_dom_dom_window_get_selection(WEBKIT_DOM_DOM_WINDOW(win)); + range = webkit_dom_dom_selection_get_range_at(WEBKIT_DOM_DOM_SELECTION(sel), + 0, NULL); + div = webkit_dom_document_create_element(WEBKIT_DOM_DOCUMENT(doc), "div", NULL); + + clone = webkit_dom_range_clone_contents(WEBKIT_DOM_RANGE(range), NULL); + webkit_dom_node_append_child(&div->parent_instance, &clone->parent_instance, NULL); + html = (WebKitDOMHTMLElement*)div; + + return wxString(webkit_dom_html_element_get_inner_html(WEBKIT_DOM_HTML_ELEMENT(html)), + wxConvUTF8); +} + +void wxWebViewWebKit::ClearSelection() +{ + WebKitDOMDocument* doc; + WebKitDOMDOMWindow* win; + WebKitDOMDOMSelection* sel; + + doc = webkit_web_view_get_dom_document(m_web_view); + win = webkit_dom_document_get_default_view(WEBKIT_DOM_DOCUMENT(doc)); + sel = webkit_dom_dom_window_get_selection(WEBKIT_DOM_DOM_WINDOW(win)); + webkit_dom_dom_selection_remove_all_ranges(WEBKIT_DOM_DOM_SELECTION(sel)); + +} + +wxString wxWebViewWebKit::GetPageText() const +{ + WebKitDOMDocument* doc; + WebKitDOMHTMLElement* body; + + doc = webkit_web_view_get_dom_document(m_web_view); + body = webkit_dom_document_get_body(WEBKIT_DOM_DOCUMENT(doc)); + return wxString(webkit_dom_html_element_get_inner_text(WEBKIT_DOM_HTML_ELEMENT(body)), + wxConvUTF8); +} + +void wxWebViewWebKit::RunScript(const wxString& javascript) +{ + webkit_web_view_execute_script(m_web_view, + javascript.mb_str(wxConvUTF8)); +} + +void wxWebViewWebKit::RegisterHandler(wxSharedPtr handler) +{ + m_handlerList.push_back(handler); +} + +// static +wxVisualAttributes +wxWebViewWebKit::GetClassDefaultAttributes(wxWindowVariant WXUNUSED(variant)) +{ + return GetDefaultAttributesFromGTKWidget(webkit_web_view_new); +} + + +#endif // wxUSE_WEBVIEW && wxUSE_WEBVIEW_WEBKIT diff --git a/Externals/wxWidgets3/src/gtk/win_gtk.cpp b/Externals/wxWidgets3/src/gtk/win_gtk.cpp index 59d0dc8a02..84e6aaf41e 100644 --- a/Externals/wxWidgets3/src/gtk/win_gtk.cpp +++ b/Externals/wxWidgets3/src/gtk/win_gtk.cpp @@ -2,7 +2,7 @@ // Name: src/gtk/win_gtk.cpp // Purpose: native GTK+ widget for wxWindow // Author: Paul Cornett -// Id: $Id: win_gtk.cpp 64725 2010-06-25 04:31:45Z PC $ +// Id: $Id: win_gtk.cpp 70482 2012-01-31 07:30:11Z PC $ // Copyright: (c) 2007 Paul Cornett // Licence: wxWindows licence /////////////////////////////////////////////////////////////////////////////// @@ -39,34 +39,36 @@ struct wxPizzaClass static void size_allocate(GtkWidget* widget, GtkAllocation* alloc) { - const bool is_resize = - widget->allocation.width != alloc->width || - widget->allocation.height != alloc->height; - const bool is_move = - widget->allocation.x != alloc->x || - widget->allocation.y != alloc->y; - wxPizza* pizza = WX_PIZZA(widget); int border_x, border_y; pizza->get_border_widths(border_x, border_y); int w = alloc->width - 2 * border_x; if (w < 0) w = 0; - if (GTK_WIDGET_REALIZED(widget) && (is_move || is_resize)) + if (gtk_widget_get_realized(widget)) { int h = alloc->height - 2 * border_y; if (h < 0) h = 0; + const int x = alloc->x + border_x; + const int y = alloc->y + border_y; - gdk_window_move_resize(widget->window, - alloc->x + border_x, alloc->y + border_y, w, h); + GdkWindow* window = gtk_widget_get_window(widget); + int old_x, old_y; + gdk_window_get_position(window, &old_x, &old_y); - if (is_resize && (border_x || border_y)) + if (x != old_x || y != old_y || + w != gdk_window_get_width(window) || h != gdk_window_get_height(window)) { - // old and new border areas need to be invalidated, - // otherwise they will not be erased/redrawn properly - GdkWindow* parent = gtk_widget_get_parent_window(widget); - gdk_window_invalidate_rect(parent, &widget->allocation, false); - gdk_window_invalidate_rect(parent, alloc, false); + gdk_window_move_resize(window, x, y, w, h); + + if (border_x + border_y) + { + // old and new border areas need to be invalidated, + // otherwise they will not be erased/redrawn properly + GdkWindow* parent = gtk_widget_get_parent_window(widget); + gdk_window_invalidate_rect(parent, &widget->allocation, false); + gdk_window_invalidate_rect(parent, alloc, false); + } } } @@ -76,7 +78,7 @@ static void size_allocate(GtkWidget* widget, GtkAllocation* alloc) for (const GList* list = pizza->m_fixed.children; list; list = list->next) { const GtkFixedChild* child = static_cast(list->data); - if (GTK_WIDGET_VISIBLE(child->widget)) + if (gtk_widget_get_visible(child->widget)) { GtkAllocation child_alloc; // note that child positions do not take border into @@ -236,7 +238,11 @@ GtkWidget* wxPizza::New(long windowStyle) pizza->m_is_scrollable = (windowStyle & (wxHSCROLL | wxVSCROLL)) != 0; // mask off border styles not useable with wxPizza pizza->m_border_style = int(windowStyle & BORDER_STYLES); +#if GTK_CHECK_VERSION(3,0,0) || defined(GTK_DISABLE_DEPRECATED) + gtk_widget_set_has_window(widget, true); +#else gtk_fixed_set_has_window(GTK_FIXED(widget), true); +#endif gtk_widget_add_events(widget, GDK_EXPOSURE_MASK | GDK_SCROLL_MASK | diff --git a/Externals/wxWidgets3/src/gtk/window.cpp b/Externals/wxWidgets3/src/gtk/window.cpp index cc7ce677b6..3ac730cad6 100644 --- a/Externals/wxWidgets3/src/gtk/window.cpp +++ b/Externals/wxWidgets3/src/gtk/window.cpp @@ -2,7 +2,7 @@ // Name: src/gtk/window.cpp // Purpose: wxWindowGTK implementation // Author: Robert Roebling -// Id: $Id: window.cpp 67280 2011-03-22 14:17:38Z DS $ +// Id: $Id: window.cpp 70734 2012-02-28 05:29:35Z PC $ // Copyright: (c) 1998 Robert Roebling, Julian Smart // Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// @@ -31,42 +31,30 @@ #include "wx/tooltip.h" #include "wx/caret.h" #include "wx/fontutil.h" +#include "wx/scopeguard.h" #include "wx/sysopt.h" #include #include "wx/gtk/private.h" #include "wx/gtk/private/win_gtk.h" +#include "wx/gtk/private/event.h" +using namespace wxGTKImpl; +#ifdef GDK_WINDOWING_X11 #include +#else +typedef guint KeySym; +#endif #include #if GTK_CHECK_VERSION(3,0,0) #include #endif -#if !GTK_CHECK_VERSION(2,10,0) - // GTK+ can reliably detect Meta key state only since 2.10 when - // GDK_META_MASK was introduced -- there wasn't any way to detect it - // in older versions. wxGTK used GDK_MOD2_MASK for this purpose, but - // GDK_MOD2_MASK is documented as: - // - // the fifth modifier key (it depends on the modifier mapping of the X - // server which key is interpreted as this modifier) - // - // In other words, it isn't guaranteed to map to Meta. This is a real - // problem: it is common to map NumLock to it (in fact, it's an exception - // if the X server _doesn't_ use it for NumLock). So the old code caused - // wxKeyEvent::MetaDown() to always return true as long as NumLock was on - // on many systems, which broke all applications using - // wxKeyEvent::GetModifiers() to check modifiers state (see e.g. here: - // http://tinyurl.com/56lsk2). - // - // Because of this, it's better to not detect Meta key state at all than - // to detect it incorrectly. Hence the following #define, which causes - // m_metaDown to be always set to false. - #define GDK_META_MASK 0 -#endif +// gdk_window_set_composited() is only supported since 2.12 +#define wxGTK_VERSION_REQUIRED_FOR_COMPOSITING 2,12,0 +#define wxGTK_HAS_COMPOSITING_SUPPORT GTK_CHECK_VERSION(2,12,0) //----------------------------------------------------------------------------- // documentation on internals @@ -233,29 +221,6 @@ int g_lastButtonNumber = 0; // the trace mask used for the focus debugging messages #define TRACE_FOCUS wxT("focus") -//----------------------------------------------------------------------------- -// missing gdk functions -//----------------------------------------------------------------------------- - -void -gdk_window_warp_pointer (GdkWindow *window, - gint x, - gint y) -{ - if (!window) - window = gdk_get_default_root_window(); - - if (!GDK_WINDOW_DESTROYED(window)) - { - XWarpPointer (GDK_WINDOW_XDISPLAY(window), - None, /* not source window -> move from anywhere */ - GDK_WINDOW_XID(window), /* dest window */ - 0, 0, 0, 0, /* not source window -> move from anywhere */ - x, y ); - } -} - - //----------------------------------------------------------------------------- // "size_request" of m_widget //----------------------------------------------------------------------------- @@ -313,7 +278,8 @@ expose_event_border(GtkWidget* widget, GdkEventExpose* gdk_event, wxWindow* win) if (!win->IsShown()) return false; - const GtkAllocation& alloc = win->m_wxwindow->allocation; + GtkAllocation alloc; + gtk_widget_get_allocation(win->m_wxwindow, &alloc); const int x = alloc.x; const int y = alloc.y; const int w = alloc.width; @@ -325,7 +291,7 @@ expose_event_border(GtkWidget* widget, GdkEventExpose* gdk_event, wxWindow* win) if (win->HasFlag(wxBORDER_SIMPLE)) { gdk_draw_rectangle(gdk_event->window, - widget->style->black_gc, false, x, y, w - 1, h - 1); + gtk_widget_get_style(widget)->black_gc, false, x, y, w - 1, h - 1); } else { @@ -342,9 +308,12 @@ expose_event_border(GtkWidget* widget, GdkEventExpose* gdk_event, wxWindow* win) // for scrollable ones detail = "viewport"; + // clip rect is required to avoid painting background + // over upper left (w,h) of parent window + GdkRectangle clipRect = { x, y, w, h }; gtk_paint_shadow( - win->m_wxwindow->style, gdk_event->window, GTK_STATE_NORMAL, - shadow, NULL, wxGTKPrivate::GetEntryWidget(), detail, x, y, w, h); + gtk_widget_get_style(win->m_wxwindow), gdk_event->window, GTK_STATE_NORMAL, + shadow, &clipRect, wxGTKPrivate::GetEntryWidget(), detail, x, y, w, h); } return false; } @@ -356,16 +325,17 @@ expose_event_border(GtkWidget* widget, GdkEventExpose* gdk_event, wxWindow* win) extern "C" { static void -parent_set(GtkWidget* widget, GtkObject* old_parent, wxWindow* win) +parent_set(GtkWidget* widget, GtkWidget* old_parent, wxWindow* win) { if (old_parent) { g_signal_handlers_disconnect_by_func( old_parent, (void*)expose_event_border, win); } - if (widget->parent) + GtkWidget* parent = gtk_widget_get_parent(widget); + if (parent) { - g_signal_connect_after(widget->parent, "expose_event", + g_signal_connect_after(parent, "expose_event", G_CALLBACK(expose_event_border), win); } } @@ -376,18 +346,6 @@ parent_set(GtkWidget* widget, GtkObject* old_parent, wxWindow* win) // "key_press_event" from any window //----------------------------------------------------------------------------- -// These are used when transforming Ctrl-alpha to ascii values 1-26 -inline bool wxIsLowerChar(int code) -{ - return (code >= 'a' && code <= 'z' ); -} - -inline bool wxIsUpperChar(int code) -{ - return (code >= 'A' && code <= 'Z' ); -} - - // set WXTRACE to this to see the key event codes on the console #define TRACE_KEYS wxT("keyevent") @@ -677,12 +635,6 @@ static void wxFillOtherKeyEventFields(wxKeyEvent& event, wxWindowGTK *win, GdkEventKey *gdk_event) { - int x = 0; - int y = 0; - GdkModifierType state; - if (gdk_event->window) - gdk_window_get_pointer(gdk_event->window, &x, &y, &state); - event.SetTimestamp( gdk_event->time ); event.SetId(win->GetId()); @@ -736,10 +688,8 @@ static void wxFillOtherKeyEventFields(wxKeyEvent& event, event.m_rawCode = (wxUint32) gdk_event->keyval; event.m_rawFlags = gdk_event->hardware_keycode; - wxGetMousePosition( &x, &y ); - win->ScreenToClient( &x, &y ); - event.m_x = x; - event.m_y = y; + wxGetMousePosition(&event.m_x, &event.m_y); + win->ScreenToClient(&event.m_x, &event.m_y); event.SetEventObject( win ); } @@ -782,6 +732,7 @@ wxTranslateGTKKeyEventToWx(wxKeyEvent& event, keysym = (KeySym)gdk_event->string[0]; } +#ifdef GDK_WINDOWING_X11 // we want to always get the same key code when the same key is // pressed regardless of the state of the modifiers, i.e. on a // standard US keyboard pressing '5' or '%' ('5' key with @@ -800,6 +751,9 @@ wxTranslateGTKKeyEventToWx(wxKeyEvent& event, // use the normalized, i.e. lower register, keysym if we've // got one key_code = keysymNormalized ? keysymNormalized : keysym; +#else + key_code = keysym; +#endif // as explained above, we want to have lower register key codes // normally but for the letter keys we want to have the upper ones @@ -877,34 +831,58 @@ struct wxGtkIMData namespace { -// Send wxEVT_CHAR_HOOK event to the parent of the window and if it wasn't -// processed, send wxEVT_CHAR to the window itself. Return true if either of -// them was handled. -bool -SendCharHookAndCharEvents(const wxKeyEvent& event, wxWindow *win) +// Send wxEVT_CHAR_HOOK event to the parent of the window and return true only +// if it was processed (and not skipped). +bool SendCharHookEvent(const wxKeyEvent& event, wxWindow *win) { - // wxEVT_CHAR_HOOK must be sent to the top level parent window to allow it + // wxEVT_CHAR_HOOK must be sent to allow the parent windows (e.g. a dialog + // which typically closes when Esc key is pressed in any of its controls) // to handle key events in all of its children unless the mouse is captured // in which case we consider that the keyboard should be "captured" too. if ( !g_captureWindow ) { - wxWindow * const parent = wxGetTopLevelParent(win); - if ( parent ) - { - // We need to make a copy of the event object because it is - // modified while it's handled, notably its WasProcessed() flag - // is set after it had been processed once. - wxKeyEvent eventCharHook(event); - eventCharHook.SetEventType(wxEVT_CHAR_HOOK); - if ( parent->HandleWindowEvent(eventCharHook) ) - return true; - } + wxKeyEvent eventCharHook(wxEVT_CHAR_HOOK, event); + if ( win->HandleWindowEvent(eventCharHook) + && !event.IsNextEventAllowed() ) + return true; } - // As above, make a copy of the event first. - wxKeyEvent eventChar(event); - eventChar.SetEventType(wxEVT_CHAR); - return win->HandleWindowEvent(eventChar); + return false; +} + +// Adjust wxEVT_CHAR event key code fields. This function takes care of two +// conventions: +// (a) Ctrl-letter key presses generate key codes in range 1..26 +// (b) Unicode key codes are same as key codes for the codes in 1..255 range +void AdjustCharEventKeyCodes(wxKeyEvent& event) +{ + const int code = event.m_keyCode; + + // Check for (a) above. + if ( event.ControlDown() ) + { + // We intentionally don't use isupper/lower() here, we really need + // ASCII letters only as it doesn't make sense to translate any other + // ones into this range which has only 26 slots. + if ( code >= 'a' && code <= 'z' ) + event.m_keyCode = code - 'a' + 1; + else if ( code >= 'A' && code <= 'Z' ) + event.m_keyCode = code - 'A' + 1; + +#if wxUSE_UNICODE + // Adjust the Unicode equivalent in the same way too. + if ( event.m_keyCode != code ) + event.m_uniChar = event.m_keyCode; +#endif // wxUSE_UNICODE + } + +#if wxUSE_UNICODE + // Check for (b) from above. + // + // FIXME: Should we do it for key codes up to 255? + if ( !event.m_uniChar && code < WXK_DELETE ) + event.m_uniChar = code; +#endif // wxUSE_UNICODE } } // anonymous namespace @@ -926,6 +904,13 @@ gtk_window_key_press_callback( GtkWidget *WXUNUSED(widget), if( wxTranslateGTKKeyEventToWx(event, win, gdk_event) ) { + // Send the CHAR_HOOK event first + if ( SendCharHookEvent(event, win) ) + { + // Don't do anything at all with this event any more. + return TRUE; + } + // Emit KEY_DOWN event ret = win->HandleWindowEvent( event ); } @@ -1009,25 +994,15 @@ gtk_window_key_press_callback( GtkWidget *WXUNUSED(widget), if ( key_code ) { + wxKeyEvent eventChar(wxEVT_CHAR, event); + wxLogTrace(TRACE_KEYS, wxT("Char event: %ld"), key_code); - event.m_keyCode = key_code; + eventChar.m_keyCode = key_code; - // To conform to the docs we need to translate Ctrl-alpha - // characters to values in the range 1-26. - if ( event.ControlDown() && - ( wxIsLowerChar(key_code) || wxIsUpperChar(key_code) )) - { - if ( wxIsLowerChar(key_code) ) - event.m_keyCode = key_code - 'a' + 1; - if ( wxIsUpperChar(key_code) ) - event.m_keyCode = key_code - 'A' + 1; -#if wxUSE_UNICODE - event.m_uniChar = event.m_keyCode; -#endif - } + AdjustCharEventKeyCodes(eventChar); - ret = SendCharHookAndCharEvents(event, win); + ret = win->HandleWindowEvent(eventChar); } } @@ -1041,7 +1016,7 @@ gtk_wxwindow_commit_cb (GtkIMContext * WXUNUSED(context), const gchar *str, wxWindow *window) { - wxKeyEvent event( wxEVT_KEY_DOWN ); + wxKeyEvent event( wxEVT_CHAR ); // take modifiers, cursor position, timestamp etc. from the last // key_press_event that was fed into Input Method: @@ -1070,23 +1045,9 @@ gtk_wxwindow_commit_cb (GtkIMContext * WXUNUSED(context), event.m_keyCode = (char)*pstr; #endif // wxUSE_UNICODE - // To conform to the docs we need to translate Ctrl-alpha - // characters to values in the range 1-26. - if ( event.ControlDown() && - ( wxIsLowerChar(*pstr) || wxIsUpperChar(*pstr) )) - { - if ( wxIsLowerChar(*pstr) ) - event.m_keyCode = *pstr - 'a' + 1; - if ( wxIsUpperChar(*pstr) ) - event.m_keyCode = *pstr - 'A' + 1; + AdjustCharEventKeyCodes(event); - event.m_keyCode = *pstr - 'a' + 1; -#if wxUSE_UNICODE - event.m_uniChar = event.m_keyCode; -#endif - } - - SendCharHookAndCharEvents(event, window); + window->HandleWindowEvent(event); } } } @@ -1119,6 +1080,21 @@ gtk_window_key_release_callback( GtkWidget * WXUNUSED(widget), } } +//----------------------------------------------------------------------------- +// key and mouse events, after, from m_widget +//----------------------------------------------------------------------------- + +extern "C" { +static gboolean key_and_mouse_event_after(GtkWidget* widget, GdkEventKey*, wxWindow*) +{ + // If a widget does not handle a key or mouse event, GTK+ sends it up the + // parent chain until it is handled. These events are not supposed to + // propagate in wxWidgets, so prevent it unless widget is in a native + // container. + return WX_IS_PIZZA(gtk_widget_get_parent(widget)); +} +} + // ============================================================================ // the mouse events // ============================================================================ @@ -1127,38 +1103,6 @@ gtk_window_key_release_callback( GtkWidget * WXUNUSED(widget), // mouse event processing helpers // ---------------------------------------------------------------------------- -// init wxMouseEvent with the info from GdkEventXXX struct -template void InitMouseEvent(wxWindowGTK *win, - wxMouseEvent& event, - T *gdk_event) -{ - event.SetTimestamp( gdk_event->time ); - event.m_shiftDown = (gdk_event->state & GDK_SHIFT_MASK) != 0; - event.m_controlDown = (gdk_event->state & GDK_CONTROL_MASK) != 0; - event.m_altDown = (gdk_event->state & GDK_MOD1_MASK) != 0; - event.m_metaDown = (gdk_event->state & GDK_META_MASK) != 0; - event.m_leftDown = (gdk_event->state & GDK_BUTTON1_MASK) != 0; - event.m_middleDown = (gdk_event->state & GDK_BUTTON2_MASK) != 0; - event.m_rightDown = (gdk_event->state & GDK_BUTTON3_MASK) != 0; - event.m_aux1Down = (gdk_event->state & GDK_BUTTON4_MASK) != 0; - event.m_aux2Down = (gdk_event->state & GDK_BUTTON5_MASK) != 0; - - wxPoint pt = win->GetClientAreaOrigin(); - event.m_x = (wxCoord)gdk_event->x - pt.x; - event.m_y = (wxCoord)gdk_event->y - pt.y; - - if ((win->m_wxwindow) && (win->GetLayoutDirection() == wxLayout_RightToLeft)) - { - // origin in the upper right corner - int window_width = win->m_wxwindow->allocation.width; - event.m_x = window_width - event.m_x; - } - - event.SetEventObject( win ); - event.SetId( win->GetId() ); - event.SetTimestamp( gdk_event->time ); -} - static void AdjustEventButtonState(wxMouseEvent& event) { // GDK reports the old state of the button for a button press event, but @@ -1189,9 +1133,23 @@ static void AdjustEventButtonState(wxMouseEvent& event) event.m_rightDown = !event.m_rightDown; return; } + + if ((event.GetEventType() == wxEVT_AUX1_DOWN) || + (event.GetEventType() == wxEVT_AUX1_DCLICK)) + { + event.m_aux1Down = true; + return; + } + + if ((event.GetEventType() == wxEVT_AUX2_DOWN) || + (event.GetEventType() == wxEVT_AUX2_DCLICK)) + { + event.m_aux2Down = true; + return; + } } -// find the window to send the mouse event too +// find the window to send the mouse event to static wxWindowGTK *FindWindowForMouseEvent(wxWindowGTK *win, wxCoord& x, wxCoord& y) { @@ -1241,6 +1199,7 @@ wxWindowGTK *FindWindowForMouseEvent(wxWindowGTK *win, wxCoord& x, wxCoord& y) else { if ((child->m_wxwindow == NULL) && + win->IsClientAreaChild(child) && (child->m_x <= xx) && (child->m_y <= yy) && (child->m_x+child->m_width >= xx) && @@ -1418,6 +1377,42 @@ gtk_window_button_press_callback( GtkWidget *widget, } } + else if (gdk_event->button == 8) + { + switch (gdk_event->type) + { + case GDK_3BUTTON_PRESS: + case GDK_BUTTON_PRESS: + event_type = wxEVT_AUX1_DOWN; + break; + + case GDK_2BUTTON_PRESS: + event_type = wxEVT_AUX1_DCLICK; + break; + + default: + ; + } + } + + else if (gdk_event->button == 9) + { + switch (gdk_event->type) + { + case GDK_3BUTTON_PRESS: + case GDK_BUTTON_PRESS: + event_type = wxEVT_AUX2_DOWN; + break; + + case GDK_2BUTTON_PRESS: + event_type = wxEVT_AUX2_DCLICK; + break; + + default: + ; + } + } + if ( event_type == wxEVT_NULL ) { // unknown mouse button or click type @@ -1501,6 +1496,14 @@ gtk_window_button_release_callback( GtkWidget *WXUNUSED(widget), event_type = wxEVT_RIGHT_UP; break; + case 8: + event_type = wxEVT_AUX1_UP; + break; + + case 9: + event_type = wxEVT_AUX2_UP; + break; + default: // unknown button, don't process return FALSE; @@ -1612,22 +1615,16 @@ window_scroll_event_hscrollbar(GtkWidget*, GdkEventScroll* gdk_event, wxWindow* return false; } - wxMouseEvent event(wxEVT_MOUSEWHEEL); - InitMouseEvent(win, event, gdk_event); - GtkRange *range = win->m_scrollBar[wxWindow::ScrollDir_Horz]; - if (!range) return FALSE; - if (range && GTK_WIDGET_VISIBLE (range)) + if (range && gtk_widget_get_visible(GTK_WIDGET(range))) { - GtkAdjustment *adj = range->adjustment; - gdouble delta = adj->step_increment * 3; + GtkAdjustment* adj = gtk_range_get_adjustment(range); + double delta = gtk_adjustment_get_step_increment(adj) * 3; if (gdk_event->direction == GDK_SCROLL_LEFT) delta = -delta; - gdouble new_value = CLAMP (adj->value + delta, adj->lower, adj->upper - adj->page_size); - - gtk_adjustment_set_value (adj, new_value); + gtk_range_set_value(range, gtk_adjustment_get_value(adj) + delta); return TRUE; } @@ -1659,18 +1656,15 @@ window_scroll_event(GtkWidget*, GdkEventScroll* gdk_event, wxWindow* win) return TRUE; GtkRange *range = win->m_scrollBar[wxWindow::ScrollDir_Vert]; - if (!range) return FALSE; - if (range && GTK_WIDGET_VISIBLE (range)) + if (range && gtk_widget_get_visible(GTK_WIDGET(range))) { - GtkAdjustment *adj = range->adjustment; - gdouble delta = adj->step_increment * 3; + GtkAdjustment* adj = gtk_range_get_adjustment(range); + double delta = gtk_adjustment_get_step_increment(adj) * 3; if (gdk_event->direction == GDK_SCROLL_UP) - delta = -delta; + delta = -delta; - gdouble new_value = CLAMP (adj->value + delta, adj->lower, adj->upper - adj->page_size); - - gtk_adjustment_set_value (adj, new_value); + gtk_range_set_value(range, gtk_adjustment_get_value(adj) + delta); return TRUE; } @@ -1753,7 +1747,7 @@ gtk_window_enter_callback( GtkWidget *widget, int y = 0; GdkModifierType state = (GdkModifierType)0; - gdk_window_get_pointer( widget->window, &x, &y, &state ); + gdk_window_get_pointer(gtk_widget_get_window(widget), &x, &y, &state); wxMouseEvent event( wxEVT_ENTER_WINDOW ); InitMouseEvent(win, event, gdk_event); @@ -1793,7 +1787,7 @@ gtk_window_leave_callback( GtkWidget *widget, int y = 0; GdkModifierType state = (GdkModifierType)0; - gdk_window_get_pointer( widget->window, &x, &y, &state ); + gdk_window_get_pointer(gtk_widget_get_window(widget), &x, &y, &state); InitMouseEvent(win, event, gdk_event); @@ -1885,29 +1879,19 @@ gtk_scrollbar_button_release_event(GtkRange* range, GdkEventButton*, wxWindow* w //----------------------------------------------------------------------------- static void -gtk_window_realized_callback(GtkWidget* widget, wxWindow* win) +gtk_window_realized_callback(GtkWidget* WXUNUSED(widget), wxWindowGTK* win) +{ + win->GTKHandleRealized(); +} + +//----------------------------------------------------------------------------- +// "unrealize" from m_wxwindow +//----------------------------------------------------------------------------- + +static void unrealize(GtkWidget*, wxWindowGTK* win) { if (win->m_imData) - { - gtk_im_context_set_client_window( win->m_imData->context, - win->m_wxwindow ? win->GTKGetDrawingWindow() : widget->window); - } - - // We cannot set colours and fonts before the widget - // been realized, so we do this directly after realization - // or otherwise in idle time - - if (win->m_needsStyleChange) - { - win->SetBackgroundStyle(win->GetBackgroundStyle()); - win->m_needsStyleChange = false; - } - - wxWindowCreateEvent event( win ); - event.SetEventObject( win ); - win->GTKProcessEvent( event ); - - win->GTKUpdateCursor(true, false); + gtk_im_context_set_client_window(win->m_imData->context, NULL); } //----------------------------------------------------------------------------- @@ -1934,8 +1918,10 @@ size_allocate(GtkWidget*, GtkAllocation* alloc, wxWindow* win) win->m_oldClientHeight = h; // this callback can be connected to m_wxwindow, // so always get size from m_widget->allocation - win->m_width = win->m_widget->allocation.width; - win->m_height = win->m_widget->allocation.height; + GtkAllocation a; + gtk_widget_get_allocation(win->m_widget, &a); + win->m_width = a.width; + win->m_height = a.height; if (!win->m_nativeSizeEvent) { wxSizeEvent event(win->GetSize(), win->GetId()); @@ -1977,15 +1963,71 @@ void gtk_window_style_set_callback( GtkWidget *WXUNUSED(widget), { if (win && previous_style) { - wxSysColourChangedEvent event; - event.SetEventObject(win); - - win->GTKProcessEvent( event ); + if (win->IsTopLevel()) + { + wxSysColourChangedEvent event; + event.SetEventObject(win); + win->GTKProcessEvent(event); + } + else + { + // Border width could change, which will change client size. + // Make sure size event occurs for this + win->m_oldClientWidth = 0; + } } } } // extern "C" +void wxWindowGTK::GTKHandleRealized() +{ + if (m_imData) + { + gtk_im_context_set_client_window + ( + m_imData->context, + m_wxwindow ? GTKGetDrawingWindow() + : gtk_widget_get_window(m_widget) + ); + } + + // Use composited window if background is transparent, if supported. + if (m_backgroundStyle == wxBG_STYLE_TRANSPARENT) + { +#if wxGTK_HAS_COMPOSITING_SUPPORT + if (IsTransparentBackgroundSupported()) + { + GdkWindow* const window = GTKGetDrawingWindow(); + if (window) + gdk_window_set_composited(window, true); + } + else +#endif // wxGTK_HAS_COMPOSITING_SUPPORT + { + // We revert to erase mode if transparency is not supported + m_backgroundStyle = wxBG_STYLE_ERASE; + } + } + + + // We cannot set colours and fonts before the widget + // been realized, so we do this directly after realization + // or otherwise in idle time + + if (m_needsStyleChange) + { + SetBackgroundStyle(GetBackgroundStyle()); + m_needsStyleChange = false; + } + + wxWindowCreateEvent event(static_cast(this)); + event.SetEventObject( this ); + GTKProcessEvent( event ); + + GTKUpdateCursor(true, false); +} + // ---------------------------------------------------------------------------- // this wxWindowBase function is implemented here (in platform-specific file) // because it is static and so couldn't be made virtual @@ -2038,6 +2080,7 @@ wxMouseState wxGetMouseState() ms.SetLeftDown((mask & GDK_BUTTON1_MASK) != 0); ms.SetMiddleDown((mask & GDK_BUTTON2_MASK) != 0); ms.SetRightDown((mask & GDK_BUTTON3_MASK) != 0); + // see the comment in InitMouseEvent() ms.SetAux1Down((mask & GDK_BUTTON4_MASK) != 0); ms.SetAux2Down((mask & GDK_BUTTON5_MASK) != 0); @@ -2182,17 +2225,14 @@ bool wxWindowGTK::Create( wxWindow *parent, if (HasFlag(wxALWAYS_SHOW_SB)) { gtk_scrolled_window_set_policy( scrolledWindow, GTK_POLICY_ALWAYS, GTK_POLICY_ALWAYS ); - - scrolledWindow->hscrollbar_visible = TRUE; - scrolledWindow->vscrollbar_visible = TRUE; } else { gtk_scrolled_window_set_policy( scrolledWindow, GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC ); } - m_scrollBar[ScrollDir_Horz] = GTK_RANGE(scrolledWindow->hscrollbar); - m_scrollBar[ScrollDir_Vert] = GTK_RANGE(scrolledWindow->vscrollbar); + m_scrollBar[ScrollDir_Horz] = GTK_RANGE(gtk_scrolled_window_get_hscrollbar(scrolledWindow)); + m_scrollBar[ScrollDir_Vert] = GTK_RANGE(gtk_scrolled_window_get_vscrollbar(scrolledWindow)); if (GetLayoutDirection() == wxLayout_RightToLeft) gtk_range_set_inverted( m_scrollBar[ScrollDir_Horz], TRUE ); @@ -2268,6 +2308,7 @@ wxWindowGTK::~wxWindowGTK() // delete before the widgets to avoid a crash on solaris delete m_imData; + m_imData = NULL; // avoid problem with GTK+ 2.18 where a frozen window causes the whole // TLW to be frozen, and if the window is then destroyed, nothing ever @@ -2300,8 +2341,11 @@ bool wxWindowGTK::PreCreation( wxWindowGTK *parent, const wxPoint &pos, const w m_width = WidthDefault(size.x) ; m_height = HeightDefault(size.y); - m_x = (int)pos.x; - m_y = (int)pos.y; + if (pos != wxDefaultPosition) + { + m_x = pos.x; + m_y = pos.y; + } return true; } @@ -2310,6 +2354,21 @@ void wxWindowGTK::PostCreation() { wxASSERT_MSG( (m_widget != NULL), wxT("invalid window") ); +#if wxGTK_HAS_COMPOSITING_SUPPORT + // Set RGBA visual as soon as possible to minimize the possibility that + // somebody uses the wrong one. + if ( m_backgroundStyle == wxBG_STYLE_TRANSPARENT && + IsTransparentBackgroundSupported() ) + { + GdkScreen *screen = gtk_widget_get_screen (m_widget); + + GdkColormap *rgba_colormap = gdk_screen_get_rgba_colormap (screen); + + if (rgba_colormap) + gtk_widget_set_colormap(m_widget, rgba_colormap); + } +#endif // wxGTK_HAS_COMPOSITING_SUPPORT + if (m_wxwindow) { if (!m_noExpose) @@ -2331,6 +2390,7 @@ void wxWindowGTK::PostCreation() g_signal_connect (m_imData->context, "commit", G_CALLBACK (gtk_wxwindow_commit_cb), this); + g_signal_connect(m_wxwindow, "unrealize", G_CALLBACK(unrealize), this); } // focus handling @@ -2370,10 +2430,30 @@ void wxWindowGTK::PostCreation() ConnectWidget( connect_widget ); - /* We cannot set colours, fonts and cursors before the widget has - been realized, so we do this directly after realization */ - g_signal_connect (connect_widget, "realize", - G_CALLBACK (gtk_window_realized_callback), this); + // connect handler to prevent events from propagating up parent chain + g_signal_connect_after(m_widget, + "key_press_event", G_CALLBACK(key_and_mouse_event_after), this); + g_signal_connect_after(m_widget, + "key_release_event", G_CALLBACK(key_and_mouse_event_after), this); + g_signal_connect_after(m_widget, + "button_press_event", G_CALLBACK(key_and_mouse_event_after), this); + g_signal_connect_after(m_widget, + "button_release_event", G_CALLBACK(key_and_mouse_event_after), this); + g_signal_connect_after(m_widget, + "motion_notify_event", G_CALLBACK(key_and_mouse_event_after), this); + + // We cannot set colours, fonts and cursors before the widget has been + // realized, so we do this directly after realization -- unless the widget + // was in fact realized already. + if ( gtk_widget_get_realized(connect_widget) ) + { + gtk_window_realized_callback(connect_widget, this); + } + else + { + g_signal_connect (connect_widget, "realize", + G_CALLBACK (gtk_window_realized_callback), this); + } if (!IsTopLevel()) { @@ -2422,7 +2502,8 @@ void wxWindowGTK::PostCreation() gtk_widget_show( m_widget ); } -gulong wxWindowGTK::GTKConnectWidget(const char *signal, void (*callback)()) +unsigned long +wxWindowGTK::GTKConnectWidget(const char *signal, wxGTKCallback callback) { return g_signal_connect(m_widget, signal, callback, this); } @@ -2456,15 +2537,13 @@ void wxWindowGTK::ConnectWidget( GtkWidget *widget ) g_signal_connect (widget, "leave_notify_event", G_CALLBACK (gtk_window_leave_callback), this); - if (IsTopLevel() && m_wxwindow) + if (m_wxwindow && (IsTopLevel() || HasFlag(wxBORDER_RAISED | wxBORDER_SUNKEN | wxBORDER_THEME))) g_signal_connect (m_wxwindow, "style_set", G_CALLBACK (gtk_window_style_set_callback), this); } bool wxWindowGTK::Destroy() { - wxASSERT_MSG( (m_widget != NULL), wxT("invalid window") ); - m_hasVMT = false; return wxWindowBase::Destroy(); @@ -2502,12 +2581,15 @@ void wxWindowGTK::DoSetSize( int x, int y, int width, int height, int sizeFlags wxASSERT_MSG( (m_widget != NULL), wxT("invalid window") ); wxASSERT_MSG( (m_parent != NULL), wxT("wxWindowGTK::SetSize requires parent.\n") ); - int currentX, currentY; - GetPosition(¤tX, ¤tY); - if (x == -1 && !(sizeFlags & wxSIZE_ALLOW_MINUS_ONE)) - x = currentX; - if (y == -1 && !(sizeFlags & wxSIZE_ALLOW_MINUS_ONE)) - y = currentY; + if ((sizeFlags & wxSIZE_ALLOW_MINUS_ONE) == 0 && (x == -1 || y == -1)) + { + int currentX, currentY; + GetPosition(¤tX, ¤tY); + if (x == -1) + x = currentX; + if (y == -1) + y = currentY; + } AdjustForParentClientOrigin(x, y, sizeFlags); // calculate the best size if we should auto size the window @@ -2539,7 +2621,7 @@ void wxWindowGTK::DoSetSize( int x, int y, int width, int height, int sizeFlags int bottom_border = 0; /* the default button has a border around it */ - if (GTK_WIDGET_CAN_DEFAULT(m_widget)) + if (gtk_widget_get_can_default(m_widget)) { GtkBorder *default_border = NULL; gtk_widget_style_get( m_widget, "default_border", &default_border, NULL ); @@ -2583,7 +2665,7 @@ void wxWindowGTK::DoSetSize( int x, int y, int width, int height, int sizeFlags bool wxWindowGTK::GTKShowFromOnIdle() { - if (IsShown() && m_showOnIdle && !GTK_WIDGET_VISIBLE (m_widget)) + if (IsShown() && m_showOnIdle && !gtk_widget_get_visible (m_widget)) { GtkAllocation alloc; alloc.x = m_x; @@ -2616,21 +2698,11 @@ void wxWindowGTK::OnInternalIdle() RealizeTabOrder(); } - // Update style if the window was not yet realized when - // SetBackgroundStyle() was called - if (m_needsStyleChange) - { - SetBackgroundStyle(GetBackgroundStyle()); - m_needsStyleChange = false; - } - wxWindowBase::OnInternalIdle(); } void wxWindowGTK::DoGetSize( int *width, int *height ) const { - wxCHECK_RET( (m_widget != NULL), wxT("invalid window") ); - if (width) (*width) = m_width; if (height) (*height) = m_height; } @@ -2682,7 +2754,7 @@ void wxWindowGTK::DoGetClientSize( int *width, int *height ) const case GTK_POLICY_AUTOMATIC: // may be shown or not, check GtkAdjustment *adj = gtk_range_get_adjustment(range); - if ( adj->upper <= adj->page_size ) + if (gtk_adjustment_get_upper(adj) <= gtk_adjustment_get_page_size(adj)) continue; } @@ -2725,39 +2797,17 @@ wxSize wxWindowGTK::DoGetBorderSize() const void wxWindowGTK::DoGetPosition( int *x, int *y ) const { - wxCHECK_RET( (m_widget != NULL), wxT("invalid window") ); - int dx = 0; int dy = 0; - if (!IsTopLevel() && m_parent && m_parent->m_wxwindow) + GtkWidget* parent = NULL; + if (m_widget) + parent = gtk_widget_get_parent(m_widget); + if (WX_IS_PIZZA(parent)) { - wxPizza* pizza = WX_PIZZA(m_parent->m_wxwindow); + wxPizza* pizza = WX_PIZZA(parent); dx = pizza->m_scroll_x; dy = pizza->m_scroll_y; } - - if (m_x == -1 && m_y == -1) - { - GdkWindow *source = NULL; - if (m_wxwindow) - source = m_wxwindow->window; - else - source = m_widget->window; - - if (source) - { - int org_x = 0; - int org_y = 0; - gdk_window_get_origin( source, &org_x, &org_y ); - - if (m_parent) - m_parent->ScreenToClient(&org_x, &org_y); - - const_cast(this)->m_x = org_x; - const_cast(this)->m_y = org_y; - } - } - if (x) (*x) = m_x - dx; if (y) (*y) = m_y - dy; } @@ -2766,13 +2816,13 @@ void wxWindowGTK::DoClientToScreen( int *x, int *y ) const { wxCHECK_RET( (m_widget != NULL), wxT("invalid window") ); - if (!m_widget->window) return; + if (gtk_widget_get_window(m_widget) == NULL) return; GdkWindow *source = NULL; if (m_wxwindow) - source = m_wxwindow->window; + source = gtk_widget_get_window(m_wxwindow); else - source = m_widget->window; + source = gtk_widget_get_window(m_widget); int org_x = 0; int org_y = 0; @@ -2780,10 +2830,12 @@ void wxWindowGTK::DoClientToScreen( int *x, int *y ) const if (!m_wxwindow) { - if (GTK_WIDGET_NO_WINDOW (m_widget)) + if (!gtk_widget_get_has_window(m_widget)) { - org_x += m_widget->allocation.x; - org_y += m_widget->allocation.y; + GtkAllocation a; + gtk_widget_get_allocation(m_widget, &a); + org_x += a.x; + org_y += a.y; } } @@ -2803,13 +2855,13 @@ void wxWindowGTK::DoScreenToClient( int *x, int *y ) const { wxCHECK_RET( (m_widget != NULL), wxT("invalid window") ); - if (!m_widget->window) return; + if (!gtk_widget_get_realized(m_widget)) return; GdkWindow *source = NULL; if (m_wxwindow) - source = m_wxwindow->window; + source = gtk_widget_get_window(m_wxwindow); else - source = m_widget->window; + source = gtk_widget_get_window(m_widget); int org_x = 0; int org_y = 0; @@ -2817,10 +2869,12 @@ void wxWindowGTK::DoScreenToClient( int *x, int *y ) const if (!m_wxwindow) { - if (GTK_WIDGET_NO_WINDOW (m_widget)) + if (!gtk_widget_get_has_window(m_widget)) { - org_x += m_widget->allocation.x; - org_y += m_widget->allocation.y; + GtkAllocation a; + gtk_widget_get_allocation(m_widget, &a); + org_x += a.x; + org_y += a.y; } } @@ -2887,7 +2941,7 @@ int wxWindowGTK::GetCharHeight() const wxCHECK_MSG( (m_widget != NULL), 12, wxT("invalid window") ); wxFont font = GetFont(); - wxCHECK_MSG( font.Ok(), 12, wxT("invalid font") ); + wxCHECK_MSG( font.IsOk(), 12, wxT("invalid font") ); PangoContext* context = gtk_widget_get_pango_context(m_widget); @@ -2913,7 +2967,7 @@ int wxWindowGTK::GetCharWidth() const wxCHECK_MSG( (m_widget != NULL), 8, wxT("invalid window") ); wxFont font = GetFont(); - wxCHECK_MSG( font.Ok(), 8, wxT("invalid font") ); + wxCHECK_MSG( font.IsOk(), 8, wxT("invalid font") ); PangoContext* context = gtk_widget_get_pango_context(m_widget); @@ -2943,7 +2997,7 @@ void wxWindowGTK::DoGetTextExtent( const wxString& string, { wxFont fontToUse = theFont ? *theFont : GetFont(); - wxCHECK_RET( fontToUse.Ok(), wxT("invalid font") ); + wxCHECK_RET( fontToUse.IsOk(), wxT("invalid font") ); if (string.empty()) { @@ -3131,6 +3185,7 @@ void wxWindowGTK::GTKHandleFocusOutNoDeferring() wxFocusEvent event( wxEVT_KILL_FOCUS, GetId() ); event.SetEventObject( this ); + event.SetWindow( FindFocus() ); GTKProcessEvent( event ); } @@ -3174,7 +3229,7 @@ void wxWindowGTK::SetFocus() GtkWidget *widget = m_wxwindow ? m_wxwindow : m_focusWidget; if ( GTK_IS_CONTAINER(widget) && - !GTK_WIDGET_CAN_FOCUS(widget) ) + !gtk_widget_get_can_focus(widget) ) { wxLogTrace(TRACE_FOCUS, wxT("Setting focus to a child of %s(%p, %s)"), @@ -3192,17 +3247,11 @@ void wxWindowGTK::SetFocus() void wxWindowGTK::SetCanFocus(bool canFocus) { - if ( canFocus ) - GTK_WIDGET_SET_FLAGS(m_widget, GTK_CAN_FOCUS); - else - GTK_WIDGET_UNSET_FLAGS(m_widget, GTK_CAN_FOCUS); + gtk_widget_set_can_focus(m_widget, canFocus); if ( m_wxwindow && (m_widget != m_wxwindow) ) { - if ( canFocus ) - GTK_WIDGET_SET_FLAGS(m_wxwindow, GTK_CAN_FOCUS); - else - GTK_WIDGET_UNSET_FLAGS(m_wxwindow, GTK_CAN_FOCUS); + gtk_widget_set_can_focus(m_wxwindow, canFocus); } } @@ -3210,8 +3259,7 @@ bool wxWindowGTK::Reparent( wxWindowBase *newParentBase ) { wxCHECK_MSG( (m_widget != NULL), false, wxT("invalid window") ); - wxWindowGTK *oldParent = m_parent, - *newParent = (wxWindowGTK *)newParentBase; + wxWindowGTK * const newParent = (wxWindowGTK *)newParentBase; wxASSERT( GTK_IS_WIDGET(m_widget) ); @@ -3220,14 +3268,17 @@ bool wxWindowGTK::Reparent( wxWindowBase *newParentBase ) wxASSERT( GTK_IS_WIDGET(m_widget) ); - if (oldParent) - gtk_container_remove( GTK_CONTAINER(m_widget->parent), m_widget ); + // Notice that old m_parent pointer might be non-NULL here but the widget + // still not have any parent at GTK level if it's a notebook page that had + // been removed from the notebook so test this at GTK level and not wx one. + if ( GtkWidget *parentGTK = gtk_widget_get_parent(m_widget) ) + gtk_container_remove(GTK_CONTAINER(parentGTK), m_widget); wxASSERT( GTK_IS_WIDGET(m_widget) ); if (newParent) { - if (GTK_WIDGET_VISIBLE (newParent->m_widget)) + if (gtk_widget_get_visible (newParent->m_widget)) { m_showOnIdle = true; gtk_widget_hide( m_widget ); @@ -3385,18 +3436,20 @@ void wxWindowGTK::RealizeTabOrder() { wxWindowGTK *win = *i; + bool focusableFromKeyboard = win->AcceptsFocusFromKeyboard(); + if ( mnemonicWindow ) { - if ( win->AcceptsFocusFromKeyboard() ) + if ( focusableFromKeyboard ) { // wxComboBox et al. needs to focus on on a different // widget than m_widget, so if the main widget isn't // focusable try the connect widget GtkWidget* w = win->m_widget; - if ( !GTK_WIDGET_CAN_FOCUS(w) ) + if ( !gtk_widget_get_can_focus(w) ) { w = win->GetConnectWidget(); - if ( !GTK_WIDGET_CAN_FOCUS(w) ) + if ( !gtk_widget_get_can_focus(w) ) w = NULL; } @@ -3412,7 +3465,8 @@ void wxWindowGTK::RealizeTabOrder() mnemonicWindow = win; } - chain = g_list_prepend(chain, win->m_widget); + if ( focusableFromKeyboard ) + chain = g_list_prepend(chain, win->m_widget); } chain = g_list_reverse(chain); @@ -3431,13 +3485,13 @@ void wxWindowGTK::Raise() { wxCHECK_RET( (m_widget != NULL), wxT("invalid window") ); - if (m_wxwindow && m_wxwindow->window) + if (m_wxwindow && gtk_widget_get_window(m_wxwindow)) { - gdk_window_raise( m_wxwindow->window ); + gdk_window_raise(gtk_widget_get_window(m_wxwindow)); } - else if (m_widget->window) + else if (gtk_widget_get_window(m_widget)) { - gdk_window_raise( m_widget->window ); + gdk_window_raise(gtk_widget_get_window(m_widget)); } } @@ -3445,19 +3499,19 @@ void wxWindowGTK::Lower() { wxCHECK_RET( (m_widget != NULL), wxT("invalid window") ); - if (m_wxwindow && m_wxwindow->window) + if (m_wxwindow && gtk_widget_get_window(m_wxwindow)) { - gdk_window_lower( m_wxwindow->window ); + gdk_window_lower(gtk_widget_get_window(m_wxwindow)); } - else if (m_widget->window) + else if (gtk_widget_get_window(m_widget)) { - gdk_window_lower( m_widget->window ); + gdk_window_lower(gtk_widget_get_window(m_widget)); } } bool wxWindowGTK::SetCursor( const wxCursor &cursor ) { - if ( !wxWindowBase::SetCursor(cursor.Ok() ? cursor : *wxSTANDARD_CURSOR) ) + if ( !wxWindowBase::SetCursor(cursor.IsOk() ? cursor : *wxSTANDARD_CURSOR) ) return false; GTKUpdateCursor(); @@ -3469,8 +3523,8 @@ void wxWindowGTK::GTKUpdateCursor(bool update_self /*=true*/, bool recurse /*=tr { if (update_self) { - wxCursor cursor(g_globalCursor.Ok() ? g_globalCursor : GetCursor()); - if ( cursor.Ok() ) + wxCursor cursor(g_globalCursor.IsOk() ? g_globalCursor : GetCursor()); + if ( cursor.IsOk() ) { wxArrayGdkWindows windowsThis; GdkWindow* window = GTKGetWindow(windowsThis); @@ -3505,17 +3559,20 @@ void wxWindowGTK::WarpPointer( int x, int y ) { wxCHECK_RET( (m_widget != NULL), wxT("invalid window") ); - // We provide this function ourselves as it is - // missing in GDK (top of this file). - - GdkWindow *window = NULL; - if (m_wxwindow) - window = m_wxwindow->window; - else - window = GetConnectWidget()->window; - - if (window) - gdk_window_warp_pointer( window, x, y ); + ClientToScreen(&x, &y); + GdkDisplay* display = gtk_widget_get_display(m_widget); + GdkScreen* screen = gtk_widget_get_screen(m_widget); +#ifdef __WXGTK30__ + GdkDeviceManager* manager = gdk_display_get_device_manager(display); + gdk_device_warp(gdk_device_manager_get_client_pointer(manager), screen, x, y); +#else +#ifdef GDK_WINDOWING_X11 + XWarpPointer(GDK_DISPLAY_XDISPLAY(display), + None, + GDK_WINDOW_XID(gdk_screen_get_root_window(screen)), + 0, 0, 0, 0, x, y); +#endif +#endif } wxWindowGTK::ScrollDir wxWindowGTK::ScrollDirFromRange(GtkRange *range) const @@ -3538,14 +3595,14 @@ bool wxWindowGTK::DoScrollByUnits(ScrollDir dir, ScrollUnit unit, int units) GtkRange* range = m_scrollBar[dir]; if ( range && units ) { - GtkAdjustment* adj = range->adjustment; - gdouble inc = unit == ScrollUnit_Line ? adj->step_increment - : adj->page_increment; + GtkAdjustment* adj = gtk_range_get_adjustment(range); + double inc = unit == ScrollUnit_Line ? gtk_adjustment_get_step_increment(adj) + : gtk_adjustment_get_page_increment(adj); - const int posOld = int(adj->value + 0.5); + const int posOld = wxRound(gtk_adjustment_get_value(adj)); gtk_range_set_value(range, posOld + units*inc); - changed = int(adj->value + 0.5) != posOld; + changed = wxRound(gtk_adjustment_get_value(adj)) != posOld; } return changed; @@ -3564,49 +3621,37 @@ bool wxWindowGTK::ScrollPages(int pages) void wxWindowGTK::Refresh(bool WXUNUSED(eraseBackground), const wxRect *rect) { - if ( !m_widget ) + if (m_wxwindow) { - // it is valid to call Refresh() for a window which hasn't been created - // yet, it simply doesn't do anything in this case - return; - } - - if (!m_wxwindow) - { - if (rect) - gtk_widget_queue_draw_area( m_widget, rect->x, rect->y, rect->width, rect->height ); - else - gtk_widget_queue_draw( m_widget ); - } - else - { - // Just return if the widget or one of its ancestors isn't mapped - GtkWidget *w; - for (w = m_wxwindow; w != NULL; w = w->parent) - if (!GTK_WIDGET_MAPPED (w)) - return; - - GdkWindow* window = GTKGetDrawingWindow(); - if (rect) + if (gtk_widget_get_mapped(m_wxwindow)) { - int x = rect->x; - if (GetLayoutDirection() == wxLayout_RightToLeft) - x = GetClientSize().x - x - rect->width; - GdkRectangle r; - r.x = rect->x; - r.y = rect->y; - r.width = rect->width; - r.height = rect->height; - gdk_window_invalidate_rect(window, &r, true); + GdkWindow* window = gtk_widget_get_window(m_wxwindow); + if (rect) + { + GdkRectangle r = { rect->x, rect->y, rect->width, rect->height }; + if (GetLayoutDirection() == wxLayout_RightToLeft) + r.x = gdk_window_get_width(window) - r.x - rect->width; + gdk_window_invalidate_rect(window, &r, true); + } + else + gdk_window_invalidate_rect(window, NULL, true); + } + } + else if (m_widget) + { + if (gtk_widget_get_mapped(m_widget)) + { + if (rect) + gtk_widget_queue_draw_area(m_widget, rect->x, rect->y, rect->width, rect->height); + else + gtk_widget_queue_draw(m_widget); } - else - gdk_window_invalidate_rect(window, NULL, true); } } void wxWindowGTK::Update() { - if (m_widget && GTK_WIDGET_MAPPED(m_widget)) + if (m_widget && gtk_widget_get_mapped(m_widget)) { GdkDisplay* display = gtk_widget_get_display(m_widget); // Flush everything out to the server, and wait for it to finish. @@ -3615,7 +3660,7 @@ void wxWindowGTK::Update() GdkWindow* window = GTKGetDrawingWindow(); if (window == NULL) - window = m_widget->window; + window = gtk_widget_get_window(m_widget); gdk_window_process_updates(window, true); // Flush again, but no need to wait for it to finish @@ -3643,7 +3688,9 @@ void wxWindowGTK::GtkSendPaintEvents() m_updateRegion.Clear(); return; } - +#if wxGTK_HAS_COMPOSITING_SUPPORT + cairo_t* cr = NULL; +#endif // Clip to paint region in wxClientDC m_clipPaintRegion = true; @@ -3655,7 +3702,7 @@ void wxWindowGTK::GtkSendPaintEvents() m_updateRegion.Clear(); gint width; - gdk_drawable_get_size(m_wxwindow->window, &width, NULL); + gdk_drawable_get_size(gtk_widget_get_window(m_wxwindow), &width, NULL); wxRegionIterator upd( m_nativeUpdateRegion ); while (upd) @@ -3675,6 +3722,27 @@ void wxWindowGTK::GtkSendPaintEvents() switch ( GetBackgroundStyle() ) { + case wxBG_STYLE_TRANSPARENT: +#if wxGTK_HAS_COMPOSITING_SUPPORT + if (IsTransparentBackgroundSupported()) + { + // Set a transparent background, so that overlaying in parent + // might indeed let see through where this child did not + // explicitly paint. + // NB: it works also for top level windows (but this is the + // windows manager which then does the compositing job) + cr = gdk_cairo_create(m_wxwindow->window); + gdk_cairo_region(cr, m_nativeUpdateRegion.GetRegion()); + cairo_clip(cr); + + cairo_set_operator(cr, CAIRO_OPERATOR_CLEAR); + cairo_paint(cr); + cairo_set_operator(cr, CAIRO_OPERATOR_OVER); + cairo_surface_flush(cairo_get_target(cr)); + } +#endif // wxGTK_HAS_COMPOSITING_SUPPORT + break; + case wxBG_STYLE_ERASE: { wxWindowDC dc( (wxWindow*)this ); @@ -3709,7 +3777,7 @@ void wxWindowGTK::GtkSendPaintEvents() if (!parent) parent = (wxWindow*)this; - if (GTK_WIDGET_MAPPED(parent->m_widget)) + if (gtk_widget_get_mapped(parent->m_widget)) { wxRegionIterator upd( m_nativeUpdateRegion ); while (upd) @@ -3720,9 +3788,9 @@ void wxWindowGTK::GtkSendPaintEvents() rect.width = upd.GetWidth(); rect.height = upd.GetHeight(); - gtk_paint_flat_box( parent->m_widget->style, + gtk_paint_flat_box(gtk_widget_get_style(parent->m_widget), GTKGetDrawingWindow(), - (GtkStateType)GTK_WIDGET_STATE(m_wxwindow), + gtk_widget_get_state(m_wxwindow), GTK_SHADOW_NONE, &rect, parent->m_widget, @@ -3751,6 +3819,39 @@ void wxWindowGTK::GtkSendPaintEvents() paint_event.SetEventObject( this ); HandleWindowEvent( paint_event ); +#if wxGTK_HAS_COMPOSITING_SUPPORT + if (IsTransparentBackgroundSupported()) + { // now composite children which need it + // Overlay all our composite children on top of the painted area + wxWindowList::compatibility_iterator node; + for ( node = m_children.GetFirst(); node ; node = node->GetNext() ) + { + wxWindow *compositeChild = node->GetData(); + if (compositeChild->GetBackgroundStyle() == wxBG_STYLE_TRANSPARENT) + { + if (cr == NULL) + { + cr = gdk_cairo_create(m_wxwindow->window); + gdk_cairo_region(cr, m_nativeUpdateRegion.GetRegion()); + cairo_clip(cr); + } + + GtkWidget *child = compositeChild->m_wxwindow; + GtkAllocation alloc; + gtk_widget_get_allocation(child, &alloc); + + // The source data is the (composited) child + gdk_cairo_set_source_window( + cr, gtk_widget_get_window(child), alloc.x, alloc.y); + + cairo_paint(cr); + } + } + if (cr) + cairo_destroy(cr); + } +#endif // wxGTK_HAS_COMPOSITING_SUPPORT + m_clipPaintRegion = false; m_updateRegion.Clear(); @@ -3767,7 +3868,7 @@ void wxWindowGTK::SetDoubleBuffered( bool on ) bool wxWindowGTK::IsDoubleBuffered() const { - return GTK_WIDGET_DOUBLE_BUFFERED( m_wxwindow ); + return gtk_widget_get_double_buffered( m_wxwindow ); } void wxWindowGTK::ClearBackground() @@ -3778,33 +3879,20 @@ void wxWindowGTK::ClearBackground() #if wxUSE_TOOLTIPS void wxWindowGTK::DoSetToolTip( wxToolTip *tip ) { - wxWindowBase::DoSetToolTip(tip); + if (m_tooltip != tip) + { + wxWindowBase::DoSetToolTip(tip); - if (m_tooltip) - { - m_tooltip->GTKApply( (wxWindow *)this ); - } - else - { - GtkWidget *w = GetConnectWidget(); - wxToolTip::GTKApply(w, NULL); + if (m_tooltip) + m_tooltip->GTKSetWindow(static_cast(this)); + else + GTKApplyToolTip(NULL); } } -void wxWindowGTK::GTKApplyToolTip( GtkTooltips *tips, const gchar *tip ) +void wxWindowGTK::GTKApplyToolTip(const char* tip) { - GtkWidget *w = GetConnectWidget(); - -#if GTK_CHECK_VERSION(2, 12, 0) - if (!gtk_check_version(2, 12, 0)) - { - gtk_widget_set_tooltip_text (w, tip); - } - else -#endif - { - gtk_tooltips_set_tip(tips, w, tip, NULL); - } + wxToolTip::GTKApply(GetConnectWidget(), tip); } #endif // wxUSE_TOOLTIPS @@ -3815,7 +3903,7 @@ bool wxWindowGTK::SetBackgroundColour( const wxColour &colour ) if (!wxWindowBase::SetBackgroundColour(colour)) return false; - if (colour.Ok()) + if (colour.IsOk()) { // We need the pixel value e.g. for background clearing. m_backgroundColour.CalcPixel(gtk_widget_get_colormap(m_widget)); @@ -3837,7 +3925,7 @@ bool wxWindowGTK::SetForegroundColour( const wxColour &colour ) return false; } - if (colour.Ok()) + if (colour.IsOk()) { // We need the pixel value e.g. for background clearing. m_foregroundColour.CalcPixel(gtk_widget_get_colormap(m_widget)); @@ -3859,15 +3947,15 @@ GtkRcStyle *wxWindowGTK::GTKCreateWidgetStyle(bool forceStyle) { // do we need to apply any changes at all? if ( !forceStyle && - !m_font.Ok() && - !m_foregroundColour.Ok() && !m_backgroundColour.Ok() ) + !m_font.IsOk() && + !m_foregroundColour.IsOk() && !m_backgroundColour.IsOk() ) { return NULL; } GtkRcStyle *style = gtk_rc_style_new(); - if ( m_font.Ok() ) + if ( m_font.IsOk() ) { style->font_desc = pango_font_description_copy( m_font.GetNativeFontInfo()->description ); @@ -3878,7 +3966,7 @@ GtkRcStyle *wxWindowGTK::GTKCreateWidgetStyle(bool forceStyle) flagsActive = 0, flagsInsensitive = 0; - if ( m_foregroundColour.Ok() ) + if ( m_foregroundColour.IsOk() ) { const GdkColor *fg = m_foregroundColour.GetColor(); @@ -3895,7 +3983,7 @@ GtkRcStyle *wxWindowGTK::GTKCreateWidgetStyle(bool forceStyle) flagsActive |= GTK_RC_FG | GTK_RC_TEXT; } - if ( m_backgroundColour.Ok() ) + if ( m_backgroundColour.IsOk() ) { const GdkColor *bg = m_backgroundColour.GetColor(); @@ -3930,7 +4018,7 @@ void wxWindowGTK::GTKApplyWidgetStyle(bool forceStyle) if ( style ) { DoApplyWidgetStyle(style); - gtk_rc_style_unref(style); + g_object_unref(style); } // Style change may affect GTK+'s size calculation: @@ -3967,35 +4055,34 @@ void wxWindowGTK::DoApplyWidgetStyle(GtkRcStyle *style) bool wxWindowGTK::SetBackgroundStyle(wxBackgroundStyle style) { - wxWindowBase::SetBackgroundStyle(style); + if (!wxWindowBase::SetBackgroundStyle(style)) + return false; - if ( style == wxBG_STYLE_PAINT ) + GdkWindow *window; + if ( m_wxwindow ) { - GdkWindow *window; - if ( m_wxwindow ) - { - window = GTKGetDrawingWindow(); - } - else - { - GtkWidget * const w = GetConnectWidget(); - window = w ? w->window : NULL; - } + window = GTKGetDrawingWindow(); + } + else + { + GtkWidget * const w = GetConnectWidget(); + window = w ? gtk_widget_get_window(w) : NULL; + } + bool wantNoBackPixmap = style == wxBG_STYLE_PAINT || style == wxBG_STYLE_TRANSPARENT; + + if ( wantNoBackPixmap ) + { if (window) { // Make sure GDK/X11 doesn't refresh the window // automatically. - gdk_window_set_back_pixmap( window, None, False ); -#ifdef __X__ - Display* display = GDK_WINDOW_DISPLAY(window); - XFlush(display); -#endif + gdk_window_set_back_pixmap( window, NULL, FALSE ); m_needsStyleChange = false; } else // window not realized yet { - // Do in OnIdle, because the window is not yet available + // Do when window is realized m_needsStyleChange = true; } @@ -4011,6 +4098,49 @@ bool wxWindowGTK::SetBackgroundStyle(wxBackgroundStyle style) return true; } +bool wxWindowGTK::IsTransparentBackgroundSupported(wxString* reason) const +{ +#if wxGTK_HAS_COMPOSITING_SUPPORT + if (gtk_check_version(wxGTK_VERSION_REQUIRED_FOR_COMPOSITING) != NULL) + { + if (reason) + { + *reason = _("GTK+ installed on this machine is too old to " + "support screen compositing, please install " + "GTK+ 2.12 or later."); + } + + return false; + } + + // NB: We don't check here if the particular kind of widget supports + // transparency, we check only if it would be possible for a generic window + + wxCHECK_MSG ( m_widget, false, "Window must be created first" ); + + if (!gdk_screen_is_composited(gtk_widget_get_screen(m_widget))) + { + if (reason) + { + *reason = _("Compositing not supported by this system, " + "please enable it in your Window Manager."); + } + + return false; + } + + return true; +#else + if (reason) + { + *reason = _("This program was compiled with a too old version of GTK+, " + "please rebuild with GTK+ 2.12 or newer."); + } +#endif // wxGTK_HAS_COMPOSITING_SUPPORT/!wxGTK_HAS_COMPOSITING_SUPPORT + + return false; +} + // ---------------------------------------------------------------------------- // Pop-up menu stuff // ---------------------------------------------------------------------------- @@ -4043,6 +4173,14 @@ bool wxWindowGTK::DoPopupMenu( wxMenu *menu, int x, int y ) { wxCHECK_MSG( m_widget != NULL, false, wxT("invalid window") ); + // For compatibility with other ports, pretend that the window showing the + // menu has focus while the menu is shown. This is needed because the popup + // menu actually steals the focus from the window it's associated it in + // wxGTK unlike, say, wxMSW. + wxWindowGTK* const oldPendingFocus = gs_pendingFocus; + gs_pendingFocus = this; + wxON_BLOCK_EXIT_SET( gs_pendingFocus, oldPendingFocus ); + menu->UpdateUI(); wxPoint pos; @@ -4119,7 +4257,7 @@ bool wxWindowGTK::GTKIsOwnWindow(GdkWindow *window) const GdkWindow *wxWindowGTK::GTKGetWindow(wxArrayGdkWindows& WXUNUSED(windows)) const { - return m_wxwindow ? GTKGetDrawingWindow() : m_widget->window; + return m_wxwindow ? GTKGetDrawingWindow() : gtk_widget_get_window(m_widget); } bool wxWindowGTK::SetFont( const wxFont &font ) @@ -4144,12 +4282,12 @@ void wxWindowGTK::DoCaptureMouse() if (m_wxwindow) window = GTKGetDrawingWindow(); else - window = GetConnectWidget()->window; + window = gtk_widget_get_window(GetConnectWidget()); wxCHECK_RET( window, wxT("CaptureMouse() failed") ); const wxCursor* cursor = &m_cursor; - if (!cursor->Ok()) + if (!cursor->IsOk()) cursor = wxSTANDARD_CURSOR; gdk_pointer_grab( window, FALSE, @@ -4177,7 +4315,7 @@ void wxWindowGTK::DoReleaseMouse() if (m_wxwindow) window = GTKGetDrawingWindow(); else - window = GetConnectWidget()->window; + window = gtk_widget_get_window(GetConnectWidget()); if (!window) return; @@ -4221,17 +4359,14 @@ void wxWindowGTK::SetScrollbar(int orient, thumbVisible = 1; } - GtkAdjustment * const adj = sb->adjustment; - adj->step_increment = 1; - adj->page_increment = - adj->page_size = thumbVisible; - adj->value = pos; - g_signal_handlers_block_by_func( sb, (void*)gtk_scrollbar_value_changed, this); + gtk_range_set_increments(sb, 1, thumbVisible); + gtk_adjustment_set_page_size(gtk_range_get_adjustment(sb), thumbVisible); gtk_range_set_range(sb, 0, range); - m_scrollPos[dir] = sb->adjustment->value; + gtk_range_set_value(sb, pos); + m_scrollPos[dir] = gtk_range_get_value(sb); g_signal_handlers_unblock_by_func( sb, (void*)gtk_scrollbar_value_changed, this); @@ -4251,7 +4386,7 @@ void wxWindowGTK::SetScrollPos(int orient, int pos, bool WXUNUSED(refresh)) sb, (void*)gtk_scrollbar_value_changed, this); gtk_range_set_value(sb, pos); - m_scrollPos[dir] = sb->adjustment->value; + m_scrollPos[dir] = gtk_range_get_value(sb); g_signal_handlers_unblock_by_func( sb, (void*)gtk_scrollbar_value_changed, this); @@ -4263,7 +4398,7 @@ int wxWindowGTK::GetScrollThumb(int orient) const GtkRange * const sb = m_scrollBar[ScrollDirFromOrient(orient)]; wxCHECK_MSG( sb, 0, wxT("this window is not scrollable") ); - return wxRound(sb->adjustment->page_size); + return wxRound(gtk_adjustment_get_page_size(gtk_range_get_adjustment(sb))); } int wxWindowGTK::GetScrollPos( int orient ) const @@ -4271,7 +4406,7 @@ int wxWindowGTK::GetScrollPos( int orient ) const GtkRange * const sb = m_scrollBar[ScrollDirFromOrient(orient)]; wxCHECK_MSG( sb, 0, wxT("this window is not scrollable") ); - return wxRound(sb->adjustment->value); + return wxRound(gtk_range_get_value(sb)); } int wxWindowGTK::GetScrollRange( int orient ) const @@ -4279,7 +4414,7 @@ int wxWindowGTK::GetScrollRange( int orient ) const GtkRange * const sb = m_scrollBar[ScrollDirFromOrient(orient)]; wxCHECK_MSG( sb, 0, wxT("this window is not scrollable") ); - return wxRound(sb->adjustment->upper); + return wxRound(gtk_adjustment_get_upper(gtk_range_get_adjustment(sb))); } // Determine if increment is the same as +/-x, allowing for some small @@ -4296,16 +4431,15 @@ wxEventType wxWindowGTK::GTKGetScrollEventType(GtkRange* range) wxASSERT(range == m_scrollBar[0] || range == m_scrollBar[1]); const int barIndex = range == m_scrollBar[1]; - GtkAdjustment* adj = range->adjustment; - const int value = wxRound(adj->value); + const double value = gtk_range_get_value(range); // save previous position const double oldPos = m_scrollPos[barIndex]; // update current position - m_scrollPos[barIndex] = adj->value; + m_scrollPos[barIndex] = value; // If event should be ignored, or integral position has not changed - if (!m_hasVMT || g_blockEventsOnDrag || value == wxRound(oldPos)) + if (!m_hasVMT || g_blockEventsOnDrag || wxRound(value) == wxRound(oldPos)) { return wxEVT_NULL; } @@ -4314,14 +4448,15 @@ wxEventType wxWindowGTK::GTKGetScrollEventType(GtkRange* range) if (!m_isScrolling) { // Difference from last change event - const double diff = adj->value - oldPos; + const double diff = value - oldPos; const bool isDown = diff > 0; - if (IsScrollIncrement(adj->step_increment, diff)) + GtkAdjustment* adj = gtk_range_get_adjustment(range); + if (IsScrollIncrement(gtk_adjustment_get_step_increment(adj), diff)) { eventType = isDown ? wxEVT_SCROLL_LINEDOWN : wxEVT_SCROLL_LINEUP; } - else if (IsScrollIncrement(adj->page_increment, diff)) + else if (IsScrollIncrement(gtk_adjustment_get_page_increment(adj), diff)) { eventType = isDown ? wxEVT_SCROLL_PAGEDOWN : wxEVT_SCROLL_PAGEUP; } @@ -4398,12 +4533,6 @@ void wxWindowGTK::GTKScrolledWindowSetBorder(GtkWidget* w, int wxstyle) } } -void wxWindowGTK::SetWindowStyleFlag( long style ) -{ - // Updates the internal variable. NB: Now m_windowStyle bits carry the _new_ style values already - wxWindowBase::SetWindowStyleFlag(style); -} - // Find the wxWindow at the current mouse position, also returning the mouse // position. wxWindow* wxFindWindowAtPointer(wxPoint& pt) @@ -4416,38 +4545,25 @@ wxWindow* wxFindWindowAtPointer(wxPoint& pt) // Get the current mouse position. wxPoint wxGetMousePosition() { - /* This crashes when used within wxHelpContext, - so we have to use the X-specific implementation below. - gint x, y; - GdkModifierType *mask; - (void) gdk_window_get_pointer(NULL, &x, &y, mask); - - return wxPoint(x, y); - */ + wxWindow* tlw = NULL; + if (!wxTopLevelWindows.empty()) + tlw = wxTopLevelWindows.front(); + GdkDisplay* display; + if (tlw && tlw->m_widget) + display = gtk_widget_get_display(tlw->m_widget); + else + display = gdk_display_get_default(); int x, y; - GdkWindow* windowAtPtr = gdk_window_at_pointer(& x, & y); - - Display *display = windowAtPtr ? GDK_WINDOW_XDISPLAY(windowAtPtr) : GDK_DISPLAY(); - Window rootWindow = RootWindowOfScreen (DefaultScreenOfDisplay(display)); - Window rootReturn, childReturn; - int rootX, rootY, winX, winY; - unsigned int maskReturn; - - XQueryPointer (display, - rootWindow, - &rootReturn, - &childReturn, - &rootX, &rootY, &winX, &winY, &maskReturn); - return wxPoint(rootX, rootY); - + gdk_display_get_pointer(display, NULL, &x, &y, NULL); + return wxPoint(x, y); } GdkWindow* wxWindowGTK::GTKGetDrawingWindow() const { GdkWindow* window = NULL; if (m_wxwindow) - window = m_wxwindow->window; + window = gtk_widget_get_window(m_wxwindow); return window; } @@ -4462,8 +4578,8 @@ extern "C" // is realized (and so can be frozen): static void wx_frozen_widget_realize(GtkWidget* w, wxWindowGTK* win) { - wxASSERT( w && !GTK_WIDGET_NO_WINDOW(w) ); - wxASSERT( GTK_WIDGET_REALIZED(w) ); + wxASSERT( w && gtk_widget_get_has_window(w) ); + wxASSERT( gtk_widget_get_realized(w) ); g_signal_handlers_disconnect_by_func ( @@ -4472,9 +4588,11 @@ static void wx_frozen_widget_realize(GtkWidget* w, wxWindowGTK* win) win ); - GdkWindow* window = w->window; + GdkWindow* window; if (w == win->m_wxwindow) window = win->GTKGetDrawingWindow(); + else + window = gtk_widget_get_window(w); gdk_window_freeze_updates(window); } @@ -4482,10 +4600,11 @@ static void wx_frozen_widget_realize(GtkWidget* w, wxWindowGTK* win) void wxWindowGTK::GTKFreezeWidget(GtkWidget *w) { - if ( !w || GTK_WIDGET_NO_WINDOW(w) ) + if ( !w || !gtk_widget_get_has_window(w) ) return; // window-less widget, cannot be frozen - if ( !GTK_WIDGET_REALIZED(w) ) + GdkWindow* window = gtk_widget_get_window(w); + if (window == NULL) { // we can't thaw unrealized widgets because they don't have GdkWindow, // so set it up to be done immediately after realization: @@ -4499,7 +4618,6 @@ void wxWindowGTK::GTKFreezeWidget(GtkWidget *w) return; } - GdkWindow* window = w->window; if (w == m_wxwindow) window = GTKGetDrawingWindow(); gdk_window_freeze_updates(window); @@ -4507,10 +4625,11 @@ void wxWindowGTK::GTKFreezeWidget(GtkWidget *w) void wxWindowGTK::GTKThawWidget(GtkWidget *w) { - if ( !w || GTK_WIDGET_NO_WINDOW(w) ) + if ( !w || !gtk_widget_get_has_window(w) ) return; // window-less widget, cannot be frozen - if ( !GTK_WIDGET_REALIZED(w) ) + GdkWindow* window = gtk_widget_get_window(w); + if (window == NULL) { // the widget wasn't realized yet, no need to thaw g_signal_handlers_disconnect_by_func @@ -4522,7 +4641,6 @@ void wxWindowGTK::GTKThawWidget(GtkWidget *w) return; } - GdkWindow* window = w->window; if (w == m_wxwindow) window = GTKGetDrawingWindow(); gdk_window_thaw_updates(window); diff --git a/Externals/wxWidgets3/src/msw/accel.cpp b/Externals/wxWidgets3/src/msw/accel.cpp index b2bd12669f..53d542abf3 100644 --- a/Externals/wxWidgets3/src/msw/accel.cpp +++ b/Externals/wxWidgets3/src/msw/accel.cpp @@ -4,7 +4,7 @@ // Author: Julian Smart // Modified by: // Created: 04/01/98 -// RCS-ID: $Id: accel.cpp 67254 2011-03-20 00:14:35Z DS $ +// RCS-ID: $Id: accel.cpp 67681 2011-05-03 16:29:04Z DS $ // Copyright: (c) Julian Smart // Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// @@ -148,7 +148,7 @@ WXHACCEL wxAcceleratorTable::GetHACCEL() const bool wxAcceleratorTable::Translate(wxWindow *window, WXMSG *wxmsg) const { MSG *msg = (MSG *)wxmsg; - return Ok() && ::TranslateAccelerator(GetHwndOf(window), GetHaccel(), msg); + return IsOk() && ::TranslateAccelerator(GetHwndOf(window), GetHaccel(), msg); } #endif // wxUSE_ACCEL diff --git a/Externals/wxWidgets3/src/msw/anybutton.cpp b/Externals/wxWidgets3/src/msw/anybutton.cpp new file mode 100644 index 0000000000..b9206fdbbd --- /dev/null +++ b/Externals/wxWidgets3/src/msw/anybutton.cpp @@ -0,0 +1,1244 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: src/msw/anybutton.cpp +// Purpose: wxAnyButton +// Author: Julian Smart +// Created: 1998-01-04 (extracted from button.cpp) +// RCS-ID: $Id: anybutton.cpp 70815 2012-03-05 18:26:20Z JS $ +// Copyright: (c) Julian Smart +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +// ============================================================================ +// declarations +// ============================================================================ + +// ---------------------------------------------------------------------------- +// headers +// ---------------------------------------------------------------------------- + +// For compilers that support precompilation, includes "wx.h". +#include "wx/wxprec.h" + +#ifdef __BORLANDC__ + #pragma hdrstop +#endif + +#ifdef wxHAS_ANY_BUTTON + +#include "wx/anybutton.h" + +#ifndef WX_PRECOMP + #include "wx/app.h" + #include "wx/brush.h" + #include "wx/panel.h" + #include "wx/bmpbuttn.h" + #include "wx/settings.h" + #include "wx/dcscreen.h" + #include "wx/dcclient.h" + #include "wx/toplevel.h" + #include "wx/msw/wrapcctl.h" + #include "wx/msw/private.h" + #include "wx/msw/missing.h" +#endif + +#include "wx/imaglist.h" +#include "wx/stockitem.h" +#include "wx/msw/private/button.h" +#include "wx/msw/private/dc.h" +#include "wx/private/window.h" + +#if wxUSE_MARKUP + #include "wx/generic/private/markuptext.h" +#endif // wxUSE_MARKUP + +using namespace wxMSWImpl; + +#if wxUSE_UXTHEME + #include "wx/msw/uxtheme.h" + + // no need to include tmschema.h + #ifndef BP_PUSHBUTTON + #define BP_PUSHBUTTON 1 + + #define PBS_NORMAL 1 + #define PBS_HOT 2 + #define PBS_PRESSED 3 + #define PBS_DISABLED 4 + #define PBS_DEFAULTED 5 + + #define TMT_CONTENTMARGINS 3602 + #endif + + // provide the necessary declarations ourselves if they're missing from + // headers + #ifndef BCM_SETIMAGELIST + #define BCM_SETIMAGELIST 0x1602 + #define BCM_SETTEXTMARGIN 0x1604 + + enum + { + BUTTON_IMAGELIST_ALIGN_LEFT, + BUTTON_IMAGELIST_ALIGN_RIGHT, + BUTTON_IMAGELIST_ALIGN_TOP, + BUTTON_IMAGELIST_ALIGN_BOTTOM + }; + + struct BUTTON_IMAGELIST + { + HIMAGELIST himl; + RECT margin; + UINT uAlign; + }; + #endif +#endif // wxUSE_UXTHEME + +#ifndef WM_THEMECHANGED + #define WM_THEMECHANGED 0x031A +#endif + +#ifndef ODS_NOACCEL + #define ODS_NOACCEL 0x0100 +#endif + +#ifndef ODS_NOFOCUSRECT + #define ODS_NOFOCUSRECT 0x0200 +#endif + +#ifndef DT_HIDEPREFIX + #define DT_HIDEPREFIX 0x00100000 +#endif + +#if wxUSE_UXTHEME +extern wxWindowMSW *wxWindowBeingErased; // From src/msw/window.cpp +#endif // wxUSE_UXTHEME + +// ---------------------------------------------------------------------------- +// button image data +// ---------------------------------------------------------------------------- + +// we use different data classes for owner drawn buttons and for themed XP ones + +class wxButtonImageData +{ +public: + wxButtonImageData() { } + virtual ~wxButtonImageData() { } + + virtual wxBitmap GetBitmap(wxAnyButton::State which) const = 0; + virtual void SetBitmap(const wxBitmap& bitmap, wxAnyButton::State which) = 0; + + virtual wxSize GetBitmapMargins() const = 0; + virtual void SetBitmapMargins(wxCoord x, wxCoord y) = 0; + + virtual wxDirection GetBitmapPosition() const = 0; + virtual void SetBitmapPosition(wxDirection dir) = 0; + +private: + wxDECLARE_NO_COPY_CLASS(wxButtonImageData); +}; + +namespace +{ + +// the gap between button edge and the interior area used by Windows for the +// standard buttons +const int OD_BUTTON_MARGIN = 4; + +class wxODButtonImageData : public wxButtonImageData +{ +public: + wxODButtonImageData(wxAnyButton *btn, const wxBitmap& bitmap) + { + SetBitmap(bitmap, wxAnyButton::State_Normal); + SetBitmap(bitmap.ConvertToDisabled(), wxAnyButton::State_Disabled); + + m_dir = wxLEFT; + + // we use margins when we have both bitmap and text, but when we have + // only the bitmap it should take up the entire button area + if ( btn->ShowsLabel() ) + { + m_margin.x = btn->GetCharWidth(); + m_margin.y = btn->GetCharHeight() / 2; + } + } + + virtual wxBitmap GetBitmap(wxAnyButton::State which) const + { + return m_bitmaps[which]; + } + + virtual void SetBitmap(const wxBitmap& bitmap, wxAnyButton::State which) + { + m_bitmaps[which] = bitmap; + } + + virtual wxSize GetBitmapMargins() const + { + return m_margin; + } + + virtual void SetBitmapMargins(wxCoord x, wxCoord y) + { + m_margin = wxSize(x, y); + } + + virtual wxDirection GetBitmapPosition() const + { + return m_dir; + } + + virtual void SetBitmapPosition(wxDirection dir) + { + m_dir = dir; + } + +private: + // just store the values passed to us to be able to retrieve them later + // from the drawing code + wxBitmap m_bitmaps[wxAnyButton::State_Max]; + wxSize m_margin; + wxDirection m_dir; + + wxDECLARE_NO_COPY_CLASS(wxODButtonImageData); +}; + +#if wxUSE_UXTHEME + +// somehow the margin is one pixel greater than the value returned by +// GetThemeMargins() call +const int XP_BUTTON_EXTRA_MARGIN = 1; + +class wxXPButtonImageData : public wxButtonImageData +{ +public: + // we must be constructed with the size of our images as we need to create + // the image list + wxXPButtonImageData(wxAnyButton *btn, const wxBitmap& bitmap) + : m_iml(bitmap.GetWidth(), bitmap.GetHeight(), true /* use mask */, + wxAnyButton::State_Max), + m_hwndBtn(GetHwndOf(btn)) + { + // initialize all bitmaps except for the disabled one to normal state + for ( int n = 0; n < wxAnyButton::State_Max; n++ ) + { + m_iml.Add(n == wxAnyButton::State_Disabled ? bitmap.ConvertToDisabled() + : bitmap); + } + + m_data.himl = GetHimagelistOf(&m_iml); + + // no margins by default + m_data.margin.left = + m_data.margin.right = + m_data.margin.top = + m_data.margin.bottom = 0; + + // use default alignment + m_data.uAlign = BUTTON_IMAGELIST_ALIGN_LEFT; + + UpdateImageInfo(); + } + + virtual wxBitmap GetBitmap(wxAnyButton::State which) const + { + return m_iml.GetBitmap(which); + } + + virtual void SetBitmap(const wxBitmap& bitmap, wxAnyButton::State which) + { + m_iml.Replace(which, bitmap); + + UpdateImageInfo(); + } + + virtual wxSize GetBitmapMargins() const + { + return wxSize(m_data.margin.left, m_data.margin.top); + } + + virtual void SetBitmapMargins(wxCoord x, wxCoord y) + { + RECT& margin = m_data.margin; + margin.left = + margin.right = x; + margin.top = + margin.bottom = y; + + if ( !::SendMessage(m_hwndBtn, BCM_SETTEXTMARGIN, 0, (LPARAM)&margin) ) + { + wxLogDebug("SendMessage(BCM_SETTEXTMARGIN) failed"); + } + } + + virtual wxDirection GetBitmapPosition() const + { + switch ( m_data.uAlign ) + { + default: + wxFAIL_MSG( "invalid image alignment" ); + // fall through + + case BUTTON_IMAGELIST_ALIGN_LEFT: + return wxLEFT; + + case BUTTON_IMAGELIST_ALIGN_RIGHT: + return wxRIGHT; + + case BUTTON_IMAGELIST_ALIGN_TOP: + return wxTOP; + + case BUTTON_IMAGELIST_ALIGN_BOTTOM: + return wxBOTTOM; + } + } + + virtual void SetBitmapPosition(wxDirection dir) + { + UINT alignNew; + switch ( dir ) + { + default: + wxFAIL_MSG( "invalid direction" ); + // fall through + + case wxLEFT: + alignNew = BUTTON_IMAGELIST_ALIGN_LEFT; + break; + + case wxRIGHT: + alignNew = BUTTON_IMAGELIST_ALIGN_RIGHT; + break; + + case wxTOP: + alignNew = BUTTON_IMAGELIST_ALIGN_TOP; + break; + + case wxBOTTOM: + alignNew = BUTTON_IMAGELIST_ALIGN_BOTTOM; + break; + } + + if ( alignNew != m_data.uAlign ) + { + m_data.uAlign = alignNew; + UpdateImageInfo(); + } + } + +private: + void UpdateImageInfo() + { + if ( !::SendMessage(m_hwndBtn, BCM_SETIMAGELIST, 0, (LPARAM)&m_data) ) + { + wxLogDebug("SendMessage(BCM_SETIMAGELIST) failed"); + } + } + + // we store image list separately to be able to use convenient wxImageList + // methods instead of working with raw HIMAGELIST + wxImageList m_iml; + + // store the rest of the data in BCM_SETIMAGELIST-friendly form + BUTTON_IMAGELIST m_data; + + // the button we're associated with + const HWND m_hwndBtn; + + + wxDECLARE_NO_COPY_CLASS(wxXPButtonImageData); +}; + +#endif // wxUSE_UXTHEME + +} // anonymous namespace + +// ---------------------------------------------------------------------------- +// macros +// ---------------------------------------------------------------------------- + +// ============================================================================ +// implementation +// ============================================================================ + +// ---------------------------------------------------------------------------- +// helper functions from wx/msw/private/button.h +// ---------------------------------------------------------------------------- + +void wxMSWButton::UpdateMultilineStyle(HWND hwnd, const wxString& label) +{ + // update BS_MULTILINE style depending on the new label (resetting it + // doesn't seem to do anything very useful but it shouldn't hurt and we do + // have to set it whenever the label becomes multi line as otherwise it + // wouldn't be shown correctly as we don't use BS_MULTILINE when creating + // the control unless it already has new lines in its label) + long styleOld = ::GetWindowLong(hwnd, GWL_STYLE), + styleNew; + if ( label.find(wxT('\n')) != wxString::npos ) + styleNew = styleOld | BS_MULTILINE; + else + styleNew = styleOld & ~BS_MULTILINE; + + if ( styleNew != styleOld ) + ::SetWindowLong(hwnd, GWL_STYLE, styleNew); +} + +wxSize wxMSWButton::GetFittingSize(wxWindow *win, + const wxSize& sizeLabel, + int flags) +{ + wxSize sizeBtn = sizeLabel; + + // FIXME: The numbers here are pure guesswork, no idea how should the + // button margins be really calculated. + if ( flags & Size_ExactFit ) + { + // We still need some margin or the text would be overwritten, just + // make it as small as possible. + sizeBtn.x += (3*win->GetCharWidth())/2; + } + else + { + sizeBtn.x += 3*win->GetCharWidth(); + sizeBtn.y += win->GetCharHeight()/2; + } + + // account for the shield UAC icon if we have it + if ( flags & Size_AuthNeeded ) + sizeBtn.x += wxSystemSettings::GetMetric(wxSYS_SMALLICON_X); + + return sizeBtn; +} + +wxSize wxMSWButton::ComputeBestFittingSize(wxControl *btn, int flags) +{ + wxClientDC dc(btn); + + wxSize sizeBtn; + dc.GetMultiLineTextExtent(btn->GetLabelText(), &sizeBtn.x, &sizeBtn.y); + + return GetFittingSize(btn, sizeBtn, flags); +} + +wxSize wxMSWButton::IncreaseToStdSizeAndCache(wxControl *btn, const wxSize& size) +{ + wxSize sizeBtn(size); + + // All buttons have at least the standard height and, unless the user + // explicitly wants them to be as small as possible and used wxBU_EXACTFIT + // style to indicate this, of at least the standard width too. + // + // Notice that we really want to make all buttons equally high, otherwise + // they look ugly and the existing code using wxBU_EXACTFIT only uses it to + // control width and not height. + + // The 50x14 button size is documented in the "Recommended sizing and + // spacing" section of MSDN layout article. + // + // Note that we intentionally don't use GetDefaultSize() here, because + // it's inexact -- dialog units depend on this dialog's font. + const wxSize sizeDef = btn->ConvertDialogToPixels(wxSize(50, 14)); + if ( !btn->HasFlag(wxBU_EXACTFIT) ) + { + if ( sizeBtn.x < sizeDef.x ) + sizeBtn.x = sizeDef.x; + } + if ( sizeBtn.y < sizeDef.y ) + sizeBtn.y = sizeDef.y; + + btn->CacheBestSize(sizeBtn); + + return sizeBtn; +} + +// ---------------------------------------------------------------------------- +// creation/destruction +// ---------------------------------------------------------------------------- + +wxAnyButton::~wxAnyButton() +{ + delete m_imageData; +#if wxUSE_MARKUP + delete m_markupText; +#endif // wxUSE_MARKUP +} + +void wxAnyButton::SetLabel(const wxString& label) +{ + wxMSWButton::UpdateMultilineStyle(GetHwnd(), label); + + wxAnyButtonBase::SetLabel(label); + +#if wxUSE_MARKUP + // If we have a plain text label, we shouldn't be using markup any longer. + if ( m_markupText ) + { + delete m_markupText; + m_markupText = NULL; + + // Unfortunately we don't really know whether we can reset the button + // to be non-owner-drawn or not: if we had made it owner-drawn just + // because of a call to SetLabelMarkup(), we could, but not if there + // were [also] calls to Set{Fore,Back}groundColour(). If it's really a + // problem to have button remain owner-drawn forever just because it + // had markup label once, we should record the reason for our current + // owner-drawnness and check it here. + } +#endif // wxUSE_MARKUP +} + +// ---------------------------------------------------------------------------- +// size management including autosizing +// ---------------------------------------------------------------------------- + +void wxAnyButton::AdjustForBitmapSize(wxSize &size) const +{ + wxCHECK_RET( m_imageData, wxT("shouldn't be called if no image") ); + + // account for the bitmap size + const wxSize sizeBmp = m_imageData->GetBitmap(State_Normal).GetSize(); + const wxDirection dirBmp = m_imageData->GetBitmapPosition(); + if ( dirBmp == wxLEFT || dirBmp == wxRIGHT ) + { + size.x += sizeBmp.x; + if ( sizeBmp.y > size.y ) + size.y = sizeBmp.y; + } + else // bitmap on top/below the text + { + size.y += sizeBmp.y; + if ( sizeBmp.x > size.x ) + size.x = sizeBmp.x; + } + + // account for the user-specified margins + size += 2*m_imageData->GetBitmapMargins(); + + // and also for the margins we always add internally (unless we have no + // border at all in which case the button has exactly the same size as + // bitmap and so no margins should be used) + if ( !HasFlag(wxBORDER_NONE) ) + { + int marginH = 0, + marginV = 0; +#if wxUSE_UXTHEME + if ( wxUxThemeEngine::GetIfActive() ) + { + wxUxThemeHandle theme(const_cast(this), L"BUTTON"); + + MARGINS margins; + wxUxThemeEngine::Get()->GetThemeMargins(theme, NULL, + BP_PUSHBUTTON, + PBS_NORMAL, + TMT_CONTENTMARGINS, + NULL, + &margins); + + // XP doesn't draw themed buttons correctly when the client + // area is smaller than 8x8 - enforce this minimum size for + // small bitmaps + size.IncTo(wxSize(8, 8)); + + marginH = margins.cxLeftWidth + margins.cxRightWidth + + 2*XP_BUTTON_EXTRA_MARGIN; + marginV = margins.cyTopHeight + margins.cyBottomHeight + + 2*XP_BUTTON_EXTRA_MARGIN; + } + else +#endif // wxUSE_UXTHEME + { + marginH = + marginV = OD_BUTTON_MARGIN; + } + + size.IncBy(marginH, marginV); + } +} + +wxSize wxAnyButton::DoGetBestSize() const +{ + wxAnyButton * const self = const_cast(this); + + wxSize size; + + // Account for the text part if we have it. + if ( ShowsLabel() ) + { + int flags = 0; + if ( HasFlag(wxBU_EXACTFIT) ) + flags |= wxMSWButton::Size_ExactFit; + if ( DoGetAuthNeeded() ) + flags |= wxMSWButton::Size_AuthNeeded; + +#if wxUSE_MARKUP + if ( m_markupText ) + { + wxClientDC dc(self); + size = wxMSWButton::GetFittingSize(self, + m_markupText->Measure(dc), + flags); + } + else // Normal plain text (but possibly multiline) label. +#endif // wxUSE_MARKUP + { + size = wxMSWButton::ComputeBestFittingSize(self, flags); + } + } + + if ( m_imageData ) + AdjustForBitmapSize(size); + + return wxMSWButton::IncreaseToStdSizeAndCache(self, size); +} + +// ---------------------------------------------------------------------------- +// event/message handlers +// ---------------------------------------------------------------------------- + +WXLRESULT wxAnyButton::MSWWindowProc(WXUINT nMsg, WXWPARAM wParam, WXLPARAM lParam) +{ + if ( nMsg == WM_LBUTTONDBLCLK ) + { + // emulate a click event to force an owner-drawn button to change its + // appearance - without this, it won't do it + (void)wxControl::MSWWindowProc(WM_LBUTTONDOWN, wParam, lParam); + + // and continue with processing the message normally as well + } +#if wxUSE_UXTHEME + else if ( nMsg == WM_THEMECHANGED ) + { + // need to recalculate the best size here + // as the theme size might have changed + InvalidateBestSize(); + } +#endif // wxUSE_UXTHEME + // must use m_mouseInWindow here instead of IsMouseInWindow() + // since we need to know the first time the mouse enters the window + // and IsMouseInWindow() would return true in this case + else if ( (nMsg == WM_MOUSEMOVE && !m_mouseInWindow) || + nMsg == WM_MOUSELEAVE ) + { + if ( + IsEnabled() && + ( +#if wxUSE_UXTHEME + wxUxThemeEngine::GetIfActive() || +#endif // wxUSE_UXTHEME + (m_imageData && m_imageData->GetBitmap(State_Current).IsOk()) + ) + ) + { + Refresh(); + } + } + + // let the base class do all real processing + return wxControl::MSWWindowProc(nMsg, wParam, lParam); +} + +// ---------------------------------------------------------------------------- +// button images +// ---------------------------------------------------------------------------- + +wxBitmap wxAnyButton::DoGetBitmap(State which) const +{ + return m_imageData ? m_imageData->GetBitmap(which) : wxBitmap(); +} + +void wxAnyButton::DoSetBitmap(const wxBitmap& bitmap, State which) +{ +#if wxUSE_UXTHEME + wxXPButtonImageData *oldData = NULL; +#endif // wxUSE_UXTHEME + + // Check if we already had bitmaps of different size. + if ( m_imageData && + bitmap.GetSize() != m_imageData->GetBitmap(State_Normal).GetSize() ) + { + wxASSERT_MSG( (which == State_Normal) || bitmap.IsNull(), + "Must set normal bitmap with the new size first" ); + +#if wxUSE_UXTHEME + if ( ShowsLabel() && wxUxThemeEngine::GetIfActive() ) + { + // We can't change the size of the images stored in wxImageList + // in wxXPButtonImageData::m_iml so force recreating it below but + // keep the current data to copy its values into the new one. + oldData = static_cast(m_imageData); + m_imageData = NULL; + } +#endif // wxUSE_UXTHEME + //else: wxODButtonImageData doesn't require anything special + } + + // allocate the image data when the first bitmap is set + if ( !m_imageData ) + { +#if wxUSE_UXTHEME + // using image list doesn't work correctly if we don't have any label + // (even if we use BUTTON_IMAGELIST_ALIGN_CENTER alignment and + // BS_BITMAP style), at least under Windows 2003 so use owner drawn + // strategy for bitmap-only buttons + if ( ShowsLabel() && wxUxThemeEngine::GetIfActive() ) + { + m_imageData = new wxXPButtonImageData(this, bitmap); + + if ( oldData ) + { + // Preserve the old values in case the user changed them. + m_imageData->SetBitmapPosition(oldData->GetBitmapPosition()); + + const wxSize oldMargins = oldData->GetBitmapMargins(); + m_imageData->SetBitmapMargins(oldMargins.x, oldMargins.y); + + // No need to preserve the bitmaps though as they were of wrong + // size anyhow. + + delete oldData; + } + } + else +#endif // wxUSE_UXTHEME + { + m_imageData = new wxODButtonImageData(this, bitmap); + MakeOwnerDrawn(); + } + } + else + { + m_imageData->SetBitmap(bitmap, which); + } + + // it should be enough to only invalidate the best size when the normal + // bitmap changes as all bitmaps assigned to the button should be of the + // same size anyhow + if ( which == State_Normal ) + InvalidateBestSize(); + + Refresh(); +} + +wxSize wxAnyButton::DoGetBitmapMargins() const +{ + return m_imageData ? m_imageData->GetBitmapMargins() : wxSize(0, 0); +} + +void wxAnyButton::DoSetBitmapMargins(wxCoord x, wxCoord y) +{ + wxCHECK_RET( m_imageData, "SetBitmap() must be called first" ); + + m_imageData->SetBitmapMargins(x, y); + InvalidateBestSize(); +} + +void wxAnyButton::DoSetBitmapPosition(wxDirection dir) +{ + wxCHECK_RET( m_imageData, "SetBitmap() must be called first" ); + + m_imageData->SetBitmapPosition(dir); + InvalidateBestSize(); +} + +// ---------------------------------------------------------------------------- +// markup support +// ---------------------------------------------------------------------------- + +#if wxUSE_MARKUP + +bool wxAnyButton::DoSetLabelMarkup(const wxString& markup) +{ + if ( !wxAnyButtonBase::DoSetLabelMarkup(markup) ) + return false; + + if ( !m_markupText ) + { + m_markupText = new wxMarkupText(markup); + MakeOwnerDrawn(); + } + else + { + // We are already owner-drawn so just update the text. + m_markupText->SetMarkup(markup); + } + + Refresh(); + + return true; +} + +#endif // wxUSE_MARKUP + +// ---------------------------------------------------------------------------- +// owner-drawn buttons support +// ---------------------------------------------------------------------------- + +// drawing helpers +namespace +{ + +// return the button state using both the ODS_XXX flags specified in state +// parameter and the current button state +wxAnyButton::State GetButtonState(wxAnyButton *btn, UINT state) +{ + if ( state & ODS_DISABLED ) + return wxAnyButton::State_Disabled; + + if ( state & ODS_SELECTED ) + return wxAnyButton::State_Pressed; + + if ( btn->HasCapture() || btn->IsMouseInWindow() ) + return wxAnyButton::State_Current; + + if ( state & ODS_FOCUS ) + return wxAnyButton::State_Focused; + + return btn->GetNormalState(); +} + +void DrawButtonText(HDC hdc, + RECT *pRect, + wxAnyButton *btn, + int flags) +{ + const wxString text = btn->GetLabel(); + + if ( text.find(wxT('\n')) != wxString::npos ) + { + // draw multiline label + + // center text horizontally in any case + flags |= DT_CENTER; + + // first we need to compute its bounding rect + RECT rc; + ::CopyRect(&rc, pRect); + ::DrawText(hdc, text.wx_str(), text.length(), &rc, + DT_CENTER | DT_CALCRECT); + + // now center this rect inside the entire button area + const LONG w = rc.right - rc.left; + const LONG h = rc.bottom - rc.top; + rc.left = pRect->left + (pRect->right - pRect->left)/2 - w/2; + rc.right = rc.left+w; + rc.top = pRect->top + (pRect->bottom - pRect->top)/2 - h/2; + rc.bottom = rc.top+h; + + ::DrawText(hdc, text.wx_str(), text.length(), &rc, flags); + } + else // single line label + { + // translate wx button flags to alignment flags for DrawText() + if ( btn->HasFlag(wxBU_RIGHT) ) + { + flags |= DT_RIGHT; + } + else if ( !btn->HasFlag(wxBU_LEFT) ) + { + flags |= DT_CENTER; + } + //else: DT_LEFT is the default anyhow (and its value is 0 too) + + if ( btn->HasFlag(wxBU_BOTTOM) ) + { + flags |= DT_BOTTOM; + } + else if ( !btn->HasFlag(wxBU_TOP) ) + { + flags |= DT_VCENTER; + } + //else: as above, DT_TOP is the default + + // notice that we must have DT_SINGLELINE for vertical alignment flags + // to work + ::DrawText(hdc, text.wx_str(), text.length(), pRect, + flags | DT_SINGLELINE ); + } +} + +void DrawRect(HDC hdc, const RECT& r) +{ + wxDrawLine(hdc, r.left, r.top, r.right, r.top); + wxDrawLine(hdc, r.right, r.top, r.right, r.bottom); + wxDrawLine(hdc, r.right, r.bottom, r.left, r.bottom); + wxDrawLine(hdc, r.left, r.bottom, r.left, r.top); +} + +/* + The button frame looks like this normally: + + WWWWWWWWWWWWWWWWWWB + WHHHHHHHHHHHHHHHHGB W = white (HILIGHT) + WH GB H = light grey (LIGHT) + WH GB G = dark grey (SHADOW) + WH GB B = black (DKSHADOW) + WH GB + WGGGGGGGGGGGGGGGGGB + BBBBBBBBBBBBBBBBBBB + + When the button is selected, the button becomes like this (the total button + size doesn't change): + + BBBBBBBBBBBBBBBBBBB + BWWWWWWWWWWWWWWWWBB + BWHHHHHHHHHHHHHHGBB + BWH GBB + BWH GBB + BWGGGGGGGGGGGGGGGBB + BBBBBBBBBBBBBBBBBBB + BBBBBBBBBBBBBBBBBBB + + When the button is pushed (while selected) it is like: + + BBBBBBBBBBBBBBBBBBB + BGGGGGGGGGGGGGGGGGB + BG GB + BG GB + BG GB + BG GB + BGGGGGGGGGGGGGGGGGB + BBBBBBBBBBBBBBBBBBB +*/ +void DrawButtonFrame(HDC hdc, RECT& rectBtn, + bool selected, bool pushed) +{ + RECT r; + CopyRect(&r, &rectBtn); + + AutoHPEN hpenBlack(GetSysColor(COLOR_3DDKSHADOW)), + hpenGrey(GetSysColor(COLOR_3DSHADOW)), + hpenLightGr(GetSysColor(COLOR_3DLIGHT)), + hpenWhite(GetSysColor(COLOR_3DHILIGHT)); + + SelectInHDC selectPen(hdc, hpenBlack); + + r.right--; + r.bottom--; + + if ( pushed ) + { + DrawRect(hdc, r); + + (void)SelectObject(hdc, hpenGrey); + ::InflateRect(&r, -1, -1); + + DrawRect(hdc, r); + } + else // !pushed + { + if ( selected ) + { + DrawRect(hdc, r); + + ::InflateRect(&r, -1, -1); + } + + wxDrawLine(hdc, r.left, r.bottom, r.right, r.bottom); + wxDrawLine(hdc, r.right, r.bottom, r.right, r.top - 1); + + (void)SelectObject(hdc, hpenWhite); + wxDrawLine(hdc, r.left, r.bottom - 1, r.left, r.top); + wxDrawLine(hdc, r.left, r.top, r.right, r.top); + + (void)SelectObject(hdc, hpenLightGr); + wxDrawLine(hdc, r.left + 1, r.bottom - 2, r.left + 1, r.top + 1); + wxDrawLine(hdc, r.left + 1, r.top + 1, r.right - 1, r.top + 1); + + (void)SelectObject(hdc, hpenGrey); + wxDrawLine(hdc, r.left + 1, r.bottom - 1, r.right - 1, r.bottom - 1); + wxDrawLine(hdc, r.right - 1, r.bottom - 1, r.right - 1, r.top); + } + + InflateRect(&rectBtn, -OD_BUTTON_MARGIN, -OD_BUTTON_MARGIN); +} + +#if wxUSE_UXTHEME +void DrawXPBackground(wxAnyButton *button, HDC hdc, RECT& rectBtn, UINT state) +{ + wxUxThemeHandle theme(button, L"BUTTON"); + + // this array is indexed by wxAnyButton::State values and so must be kept in + // sync with it + static const int uxStates[] = + { + PBS_NORMAL, PBS_HOT, PBS_PRESSED, PBS_DISABLED, PBS_DEFAULTED + }; + + int iState = uxStates[GetButtonState(button, state)]; + + wxUxThemeEngine * const engine = wxUxThemeEngine::Get(); + + // draw parent background if needed + if ( engine->IsThemeBackgroundPartiallyTransparent + ( + theme, + BP_PUSHBUTTON, + iState + ) ) + { + // Set this button as the one whose background is being erased: this + // allows our WM_ERASEBKGND handler used by DrawThemeParentBackground() + // to correctly align the background brush with this window instead of + // the parent window to which WM_ERASEBKGND is sent. Notice that this + // doesn't work with custom user-defined EVT_ERASE_BACKGROUND handlers + // as they won't be aligned but unfortunately all the attempts to fix + // it by shifting DC origin before calling DrawThemeParentBackground() + // failed to work so we at least do this, even though this is far from + // being the perfect solution. + wxWindowBeingErased = button; + + engine->DrawThemeParentBackground(GetHwndOf(button), hdc, &rectBtn); + + wxWindowBeingErased = NULL; + } + + // draw background + engine->DrawThemeBackground(theme, hdc, BP_PUSHBUTTON, iState, + &rectBtn, NULL); + + // calculate content area margins + MARGINS margins; + engine->GetThemeMargins(theme, hdc, BP_PUSHBUTTON, iState, + TMT_CONTENTMARGINS, &rectBtn, &margins); + ::InflateRect(&rectBtn, -margins.cxLeftWidth, -margins.cyTopHeight); + ::InflateRect(&rectBtn, -XP_BUTTON_EXTRA_MARGIN, -XP_BUTTON_EXTRA_MARGIN); + + if ( button->UseBgCol() ) + { + COLORREF colBg = wxColourToRGB(button->GetBackgroundColour()); + AutoHBRUSH hbrushBackground(colBg); + + // don't overwrite the focus rect + RECT rectClient; + ::CopyRect(&rectClient, &rectBtn); + ::InflateRect(&rectClient, -1, -1); + FillRect(hdc, &rectClient, hbrushBackground); + } +} +#endif // wxUSE_UXTHEME + +} // anonymous namespace + +// ---------------------------------------------------------------------------- +// owner drawn buttons support +// ---------------------------------------------------------------------------- + +void wxAnyButton::MakeOwnerDrawn() +{ + if ( !IsOwnerDrawn() ) + { + // make it so + // note that BS_OWNERDRAW is not independent from other style bits + long style = GetWindowLong(GetHwnd(), GWL_STYLE); + style &= ~(BS_3STATE | BS_AUTO3STATE | BS_AUTOCHECKBOX | BS_AUTORADIOBUTTON | BS_CHECKBOX | BS_DEFPUSHBUTTON | BS_GROUPBOX | BS_PUSHBUTTON | BS_RADIOBUTTON | BS_PUSHLIKE); + style |= BS_OWNERDRAW; + SetWindowLong(GetHwnd(), GWL_STYLE, style); + } +} + +bool wxAnyButton::IsOwnerDrawn() const +{ + long style = GetWindowLong(GetHwnd(), GWL_STYLE); + return ( (style & BS_OWNERDRAW) == BS_OWNERDRAW ); +} + +bool wxAnyButton::SetBackgroundColour(const wxColour &colour) +{ + if ( !wxControl::SetBackgroundColour(colour) ) + { + // nothing to do + return false; + } + + MakeOwnerDrawn(); + + Refresh(); + + return true; +} + +bool wxAnyButton::SetForegroundColour(const wxColour &colour) +{ + if ( !wxControl::SetForegroundColour(colour) ) + { + // nothing to do + return false; + } + + MakeOwnerDrawn(); + + Refresh(); + + return true; +} + +bool wxAnyButton::MSWOnDraw(WXDRAWITEMSTRUCT *wxdis) +{ + LPDRAWITEMSTRUCT lpDIS = (LPDRAWITEMSTRUCT)wxdis; + HDC hdc = lpDIS->hDC; + + UINT state = lpDIS->itemState; + switch ( GetButtonState(this, state) ) + { + case State_Disabled: + state |= ODS_DISABLED; + break; + case State_Pressed: + state |= ODS_SELECTED; + break; + case State_Focused: + state |= ODS_FOCUS; + break; + default: + break; + } + + bool pushed = (SendMessage(GetHwnd(), BM_GETSTATE, 0, 0) & BST_PUSHED) != 0; + + RECT rectBtn; + CopyRect(&rectBtn, &lpDIS->rcItem); + + // draw the button background + if ( !HasFlag(wxBORDER_NONE) ) + { +#if wxUSE_UXTHEME + if ( wxUxThemeEngine::GetIfActive() ) + { + DrawXPBackground(this, hdc, rectBtn, state); + } + else +#endif // wxUSE_UXTHEME + { + COLORREF colBg = wxColourToRGB(GetBackgroundColour()); + + // first, draw the background + AutoHBRUSH hbrushBackground(colBg); + FillRect(hdc, &rectBtn, hbrushBackground); + + // draw the border for the current state + bool selected = (state & ODS_SELECTED) != 0; + if ( !selected ) + { + wxTopLevelWindow * + tlw = wxDynamicCast(wxGetTopLevelParent(this), wxTopLevelWindow); + if ( tlw ) + { + selected = tlw->GetDefaultItem() == this; + } + } + + DrawButtonFrame(hdc, rectBtn, selected, pushed); + } + + // draw the focus rectangle if we need it + if ( (state & ODS_FOCUS) && !(state & ODS_NOFOCUSRECT) ) + { + DrawFocusRect(hdc, &rectBtn); + +#if wxUSE_UXTHEME + if ( !wxUxThemeEngine::GetIfActive() ) +#endif // wxUSE_UXTHEME + { + if ( pushed ) + { + // the label is shifted by 1 pixel to create "pushed" effect + OffsetRect(&rectBtn, 1, 1); + } + } + } + } + + + // draw the image, if any + if ( m_imageData ) + { + wxBitmap bmp = m_imageData->GetBitmap(GetButtonState(this, state)); + if ( !bmp.IsOk() ) + bmp = m_imageData->GetBitmap(State_Normal); + + const wxSize sizeBmp = bmp.GetSize(); + const wxSize margin = m_imageData->GetBitmapMargins(); + const wxSize sizeBmpWithMargins(sizeBmp + 2*margin); + wxRect rectButton(wxRectFromRECT(rectBtn)); + + // for simplicity, we start with centred rectangle and then move it to + // the appropriate edge + wxRect rectBitmap = wxRect(sizeBmp).CentreIn(rectButton); + + // move bitmap only if we have a label, otherwise keep it centered + if ( ShowsLabel() ) + { + switch ( m_imageData->GetBitmapPosition() ) + { + default: + wxFAIL_MSG( "invalid direction" ); + // fall through + + case wxLEFT: + rectBitmap.x = rectButton.x + margin.x; + rectButton.x += sizeBmpWithMargins.x; + rectButton.width -= sizeBmpWithMargins.x; + break; + + case wxRIGHT: + rectBitmap.x = rectButton.GetRight() - sizeBmp.x - margin.x; + rectButton.width -= sizeBmpWithMargins.x; + break; + + case wxTOP: + rectBitmap.y = rectButton.y + margin.y; + rectButton.y += sizeBmpWithMargins.y; + rectButton.height -= sizeBmpWithMargins.y; + break; + + case wxBOTTOM: + rectBitmap.y = rectButton.GetBottom() - sizeBmp.y - margin.y; + rectButton.height -= sizeBmpWithMargins.y; + break; + } + } + + wxDCTemp dst((WXHDC)hdc); + dst.DrawBitmap(bmp, rectBitmap.GetPosition(), true); + + wxCopyRectToRECT(rectButton, rectBtn); + } + + + // finally draw the label + if ( ShowsLabel() ) + { + COLORREF colFg = state & ODS_DISABLED + ? ::GetSysColor(COLOR_GRAYTEXT) + : wxColourToRGB(GetForegroundColour()); + + wxTextColoursChanger changeFg(hdc, colFg, CLR_INVALID); + wxBkModeChanger changeBkMode(hdc, wxBRUSHSTYLE_TRANSPARENT); + +#if wxUSE_MARKUP + if ( m_markupText ) + { + wxDCTemp dc((WXHDC)hdc); + dc.SetTextForeground(wxColour(colFg)); + dc.SetFont(GetFont()); + + m_markupText->Render(dc, wxRectFromRECT(rectBtn), + state & ODS_NOACCEL + ? wxMarkupText::Render_Default + : wxMarkupText::Render_ShowAccels); + } + else // Plain text label +#endif // wxUSE_MARKUP + { + // notice that DT_HIDEPREFIX doesn't work on old (pre-Windows 2000) + // systems but by happy coincidence ODS_NOACCEL is not used under + // them neither so DT_HIDEPREFIX should never be used there + DrawButtonText(hdc, &rectBtn, this, + state & ODS_NOACCEL ? DT_HIDEPREFIX : 0); + } + } + + return true; +} + +#endif // wxHAS_ANY_BUTTON diff --git a/Externals/wxWidgets3/src/msw/artmsw.cpp b/Externals/wxWidgets3/src/msw/artmsw.cpp index 7f7ed5a855..b12355da80 100644 --- a/Externals/wxWidgets3/src/msw/artmsw.cpp +++ b/Externals/wxWidgets3/src/msw/artmsw.cpp @@ -4,7 +4,7 @@ // Author: Vaclav Slavik // Modified by: // Created: 2008-10-15 -// RCS-ID: $Id: artmsw.cpp 62199 2009-09-29 17:04:08Z VS $ +// RCS-ID: $Id: artmsw.cpp 70154 2011-12-28 13:51:29Z VZ $ // Copyright: (c) Vaclav Slavik, 2008 // Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// @@ -91,7 +91,7 @@ wxBitmap wxWindowsArtProvider::CreateBitmap(const wxArtID& id, /*static*/ void wxArtProvider::InitNativeProvider() { - Push(new wxWindowsArtProvider); + PushBack(new wxWindowsArtProvider); } // ---------------------------------------------------------------------------- @@ -124,6 +124,10 @@ wxSize wxArtProvider::GetNativeSizeHint(const wxArtClient& client) { return wxSize(16, 16); } + else if (client == wxART_LIST) + { + return wxSize(16, 16); + } return wxDefaultSize; } diff --git a/Externals/wxWidgets3/src/msw/bitmap.cpp b/Externals/wxWidgets3/src/msw/bitmap.cpp index be335ae726..624cabfff6 100644 --- a/Externals/wxWidgets3/src/msw/bitmap.cpp +++ b/Externals/wxWidgets3/src/msw/bitmap.cpp @@ -4,7 +4,7 @@ // Author: Julian Smart // Modified by: // Created: 04/01/98 -// RCS-ID: $Id: bitmap.cpp 65962 2010-10-30 23:51:09Z VZ $ +// RCS-ID: $Id: bitmap.cpp 67681 2011-05-03 16:29:04Z DS $ // Copyright: (c) Julian Smart // Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// @@ -387,7 +387,7 @@ bool wxBitmap::CopyFromCursor(const wxCursor& cursor, wxBitmapTransparency trans { UnRef(); - if ( !cursor.Ok() ) + if ( !cursor.IsOk() ) return false; return CopyFromIconOrCursor(cursor, transp); @@ -397,7 +397,7 @@ bool wxBitmap::CopyFromIcon(const wxIcon& icon, wxBitmapTransparency transp) { UnRef(); - if ( !icon.Ok() ) + if ( !icon.IsOk() ) return false; return CopyFromIconOrCursor(icon, transp); @@ -605,7 +605,7 @@ bool wxBitmap::DoCreate(int w, int h, int d, WXHDC hdc) SetHBITMAP((WXHBITMAP)hbmp); - return Ok(); + return IsOk(); } #if wxUSE_IMAGE @@ -739,7 +739,7 @@ wxImage wxBitmap::ConvertToImage() const // so the 'depth' argument is ignored. // TODO: transparency (create a mask image) - if (!Ok()) + if (!IsOk()) { wxFAIL_MSG( wxT("bitmap is invalid") ); return wxNullImage; @@ -747,7 +747,7 @@ wxImage wxBitmap::ConvertToImage() const wxImage image; - wxCHECK_MSG( Ok(), wxNullImage, wxT("invalid bitmap") ); + wxCHECK_MSG( IsOk(), wxNullImage, wxT("invalid bitmap") ); // create an wxImage object int width = GetWidth(); @@ -823,7 +823,7 @@ bool wxBitmap::CreateFromImage(const wxImage& image, const wxDC& dc) bool wxBitmap::CreateFromImage(const wxImage& image, int depth, WXHDC hdc) { - wxCHECK_MSG( image.Ok(), false, wxT("invalid image") ); + wxCHECK_MSG( image.IsOk(), false, wxT("invalid image") ); UnRef(); @@ -929,7 +929,7 @@ wxImage wxBitmap::ConvertToImage() const // and then DIB to our wxImage wxImage image = dib.ConvertToImage(); - if ( !image.Ok() ) + if ( !image.IsOk() ) { return wxNullImage; } @@ -1039,7 +1039,7 @@ bool wxBitmap::LoadFile(const wxString& filename, wxBitmapType type) else // no bitmap handler found { wxImage image; - if ( image.LoadFile( filename, type ) && image.Ok() ) + if ( image.LoadFile( filename, type ) && image.IsOk() ) { *this = wxBitmap(image); @@ -1084,7 +1084,7 @@ bool wxBitmap::SaveFile(const wxString& filename, { // FIXME what about palette? shouldn't we use it? wxImage image = ConvertToImage(); - if ( image.Ok() ) + if ( image.IsOk() ) { return image.SaveFile(filename, type); } @@ -1106,14 +1106,14 @@ wxBitmap wxBitmap::GetSubBitmap( const wxRect& rect ) const wxBitmap wxBitmap::GetSubBitmapOfHDC( const wxRect& rect, WXHDC hdc ) const { - wxCHECK_MSG( Ok() && + wxCHECK_MSG( IsOk() && (rect.x >= 0) && (rect.y >= 0) && (rect.x+rect.width <= GetWidth()) && (rect.y+rect.height <= GetHeight()), wxNullBitmap, wxT("Invalid bitmap or bitmap region") ); wxBitmap ret( rect.width, rect.height, GetDepth() ); - wxASSERT_MSG( ret.Ok(), wxT("GetSubBitmap error") ); + wxASSERT_MSG( ret.IsOk(), wxT("GetSubBitmap error") ); #ifndef __WXMICROWIN__ // handle alpha channel, if any @@ -1248,7 +1248,7 @@ void wxBitmap::SetMask(wxMask *mask) void *wxBitmap::GetRawData(wxPixelDataBase& data, int bpp) { #if wxUSE_WXDIB - if ( !Ok() ) + if ( !IsOk() ) { // no bitmap, no data (raw or otherwise) return NULL; @@ -1326,7 +1326,7 @@ void *wxBitmap::GetRawData(wxPixelDataBase& data, int bpp) void wxBitmap::UngetRawData(wxPixelDataBase& dataBase) { #if wxUSE_WXDIB - if ( !Ok() ) + if ( !IsOk() ) return; if ( !&dataBase ) @@ -1427,7 +1427,7 @@ wxMask::~wxMask() bool wxMask::Create(const wxBitmap& bitmap) { #ifndef __WXMICROWIN__ - wxCHECK_MSG( bitmap.Ok() && bitmap.GetDepth() == 1, false, + wxCHECK_MSG( bitmap.IsOk() && bitmap.GetDepth() == 1, false, wxT("can't create mask from invalid or not monochrome bitmap") ); if ( m_maskBitmap ) @@ -1468,7 +1468,7 @@ bool wxMask::Create(const wxBitmap& bitmap, int paletteIndex) } #if wxUSE_PALETTE - if (bitmap.Ok() && bitmap.GetPalette()->Ok()) + if (bitmap.IsOk() && bitmap.GetPalette()->IsOk()) { unsigned char red, green, blue; if (bitmap.GetPalette()->GetRGB(paletteIndex, &red, &green, &blue)) @@ -1487,7 +1487,7 @@ bool wxMask::Create(const wxBitmap& bitmap, int paletteIndex) bool wxMask::Create(const wxBitmap& bitmap, const wxColour& colour) { #ifndef __WXMICROWIN__ - wxCHECK_MSG( bitmap.Ok(), false, wxT("invalid bitmap in wxMask::Create") ); + wxCHECK_MSG( bitmap.IsOk(), false, wxT("invalid bitmap in wxMask::Create") ); if ( m_maskBitmap ) { @@ -1625,7 +1625,7 @@ HICON wxBitmapToIconOrCursor(const wxBitmap& bmp, int hotSpotX, int hotSpotY) { - if ( !bmp.Ok() ) + if ( !bmp.IsOk() ) { // we can't create an icon/cursor form nothing return 0; diff --git a/Externals/wxWidgets3/src/msw/bmpbuttn.cpp b/Externals/wxWidgets3/src/msw/bmpbuttn.cpp index ba28d5db69..76a63576c7 100644 --- a/Externals/wxWidgets3/src/msw/bmpbuttn.cpp +++ b/Externals/wxWidgets3/src/msw/bmpbuttn.cpp @@ -4,7 +4,7 @@ // Author: Julian Smart // Modified by: // Created: 04/01/98 -// RCS-ID: $Id: bmpbuttn.cpp 66555 2011-01-04 08:31:53Z SC $ +// RCS-ID: $Id: bmpbuttn.cpp 67931 2011-06-14 13:00:42Z VZ $ // Copyright: (c) Julian Smart // Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// @@ -80,7 +80,8 @@ bool wxBitmapButton::Create(wxWindow *parent, validator, name) ) return false; - SetBitmapLabel(bitmap); + if ( bitmap.IsOk() ) + SetBitmapLabel(bitmap); if ( !size.IsFullySpecified() ) { @@ -92,54 +93,4 @@ bool wxBitmapButton::Create(wxWindow *parent, return true; } -void wxBitmapButton::DoSetBitmap(const wxBitmap& bitmap, State which) -{ - if ( bitmap.IsOk() ) - { - switch ( which ) - { -#if wxUSE_IMAGE - case State_Normal: - if ( !HasFlag(wxBU_AUTODRAW) && !m_disabledSetByUser ) - { - wxImage img(bitmap.ConvertToImage().ConvertToGreyscale()); - wxBitmapButtonBase::DoSetBitmap(img, State_Disabled); - } - break; -#endif // wxUSE_IMAGE - - case State_Focused: - // if the focus bitmap is specified but current one isn't, use - // the focus bitmap for hovering as well if this is consistent - // with the current Windows version look and feel - // - // rationale: this is compatible with the old wxGTK behaviour - // and also makes it much easier to do "the right thing" for - // all platforms (some of them, such as Windows XP, have "hot" - // buttons while others don't) - if ( !m_hoverSetByUser ) - wxBitmapButtonBase::DoSetBitmap(bitmap, State_Current); - break; - - case State_Current: - // don't overwrite it with the focused bitmap - m_hoverSetByUser = true; - break; - - case State_Disabled: - // don't overwrite it with the version automatically created - // from the normal one - m_disabledSetByUser = true; - break; - - default: - // nothing special to do but include the default clause to - // suppress gcc warnings - ; - } - } - - wxBitmapButtonBase::DoSetBitmap(bitmap, which); -} - #endif // wxUSE_BMPBUTTON diff --git a/Externals/wxWidgets3/src/msw/bmpcbox.cpp b/Externals/wxWidgets3/src/msw/bmpcbox.cpp index 37fbfc70b8..ef7deffc98 100644 --- a/Externals/wxWidgets3/src/msw/bmpcbox.cpp +++ b/Externals/wxWidgets3/src/msw/bmpcbox.cpp @@ -3,7 +3,7 @@ // Purpose: wxBitmapComboBox // Author: Jaakko Salli // Created: 2008-04-06 -// RCS-ID: $Id: bmpcbox.cpp 67254 2011-03-20 00:14:35Z DS $ +// RCS-ID: $Id: bmpcbox.cpp 70039 2011-12-17 23:52:43Z VZ $ // Copyright: (c) 2008 Jaakko Salli // Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// @@ -257,6 +257,16 @@ int wxBitmapComboBox::Insert(const wxString& item, return n; } +int wxBitmapComboBox::Insert(const wxString& item, const wxBitmap& bitmap, + unsigned int pos, void *clientData) +{ + OnAddBitmap(bitmap); + const int n = wxComboBox::Insert(item, pos, clientData); + if ( n != wxNOT_FOUND ) + DoSetItemBitmap(n, bitmap); + return n; +} + int wxBitmapComboBox::Insert(const wxString& item, const wxBitmap& bitmap, unsigned int pos, wxClientData *clientData) { diff --git a/Externals/wxWidgets3/src/msw/brush.cpp b/Externals/wxWidgets3/src/msw/brush.cpp index 795a7a773e..a4300be424 100644 --- a/Externals/wxWidgets3/src/msw/brush.cpp +++ b/Externals/wxWidgets3/src/msw/brush.cpp @@ -4,7 +4,7 @@ // Author: Julian Smart // Modified by: // Created: 04/01/98 -// RCS-ID: $Id: brush.cpp 61508 2009-07-23 20:30:22Z VZ $ +// RCS-ID: $Id: brush.cpp 67681 2011-05-03 16:29:04Z DS $ // Copyright: (c) Julian Smart // Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// @@ -277,28 +277,28 @@ wxGDIRefData *wxBrush::CloneGDIRefData(const wxGDIRefData *data) const wxColour wxBrush::GetColour() const { - wxCHECK_MSG( Ok(), wxNullColour, wxT("invalid brush") ); + wxCHECK_MSG( IsOk(), wxNullColour, wxT("invalid brush") ); return M_BRUSHDATA->GetColour(); } wxBrushStyle wxBrush::GetStyle() const { - wxCHECK_MSG( Ok(), wxBRUSHSTYLE_INVALID, wxT("invalid brush") ); + wxCHECK_MSG( IsOk(), wxBRUSHSTYLE_INVALID, wxT("invalid brush") ); return M_BRUSHDATA->GetStyle(); } wxBitmap *wxBrush::GetStipple() const { - wxCHECK_MSG( Ok(), NULL, wxT("invalid brush") ); + wxCHECK_MSG( IsOk(), NULL, wxT("invalid brush") ); return M_BRUSHDATA->GetStipple(); } WXHANDLE wxBrush::GetResourceHandle() const { - wxCHECK_MSG( Ok(), FALSE, wxT("invalid brush") ); + wxCHECK_MSG( IsOk(), FALSE, wxT("invalid brush") ); return (WXHANDLE)M_BRUSHDATA->GetHBRUSH(); } diff --git a/Externals/wxWidgets3/src/msw/button.cpp b/Externals/wxWidgets3/src/msw/button.cpp index fa3bc61418..cdf3a823d8 100644 --- a/Externals/wxWidgets3/src/msw/button.cpp +++ b/Externals/wxWidgets3/src/msw/button.cpp @@ -4,7 +4,7 @@ // Author: Julian Smart // Modified by: // Created: 04/01/98 -// RCS-ID: $Id: button.cpp 67284 2011-03-22 17:15:34Z VZ $ +// RCS-ID: $Id: button.cpp 69984 2011-12-11 17:03:56Z VZ $ // Copyright: (c) Julian Smart // Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// @@ -52,402 +52,24 @@ #include "wx/generic/private/markuptext.h" #endif // wxUSE_MARKUP -using namespace wxMSWImpl; - -#if wxUSE_UXTHEME - #include "wx/msw/uxtheme.h" - - // no need to include tmschema.h - #ifndef BP_PUSHBUTTON - #define BP_PUSHBUTTON 1 - - #define PBS_NORMAL 1 - #define PBS_HOT 2 - #define PBS_PRESSED 3 - #define PBS_DISABLED 4 - #define PBS_DEFAULTED 5 - - #define TMT_CONTENTMARGINS 3602 - #endif - - // provide the necessary declarations ourselves if they're missing from - // headers - #ifndef BCM_SETIMAGELIST - #define BCM_SETIMAGELIST 0x1602 - #define BCM_SETTEXTMARGIN 0x1604 - - enum - { - BUTTON_IMAGELIST_ALIGN_LEFT, - BUTTON_IMAGELIST_ALIGN_RIGHT, - BUTTON_IMAGELIST_ALIGN_TOP, - BUTTON_IMAGELIST_ALIGN_BOTTOM - }; - - struct BUTTON_IMAGELIST - { - HIMAGELIST himl; - RECT margin; - UINT uAlign; - }; - #endif -#endif // wxUSE_UXTHEME - -#ifndef WM_THEMECHANGED - #define WM_THEMECHANGED 0x031A -#endif - -#ifndef ODS_NOACCEL - #define ODS_NOACCEL 0x0100 -#endif - -#ifndef ODS_NOFOCUSRECT - #define ODS_NOFOCUSRECT 0x0200 -#endif - -#ifndef DT_HIDEPREFIX - #define DT_HIDEPREFIX 0x00100000 -#endif - // set the value for BCM_SETSHIELD (for the UAC shield) if it's not defined in // the header #ifndef BCM_SETSHIELD #define BCM_SETSHIELD 0x160c #endif -#if wxUSE_UXTHEME -extern wxWindowMSW *wxWindowBeingErased; // From src/msw/window.cpp -#endif // wxUSE_UXTHEME - -// ---------------------------------------------------------------------------- -// button image data -// ---------------------------------------------------------------------------- - -// we use different data classes for owner drawn buttons and for themed XP ones - -class wxButtonImageData -{ -public: - wxButtonImageData() { } - virtual ~wxButtonImageData() { } - - virtual wxBitmap GetBitmap(wxButton::State which) const = 0; - virtual void SetBitmap(const wxBitmap& bitmap, wxButton::State which) = 0; - - virtual wxSize GetBitmapMargins() const = 0; - virtual void SetBitmapMargins(wxCoord x, wxCoord y) = 0; - - virtual wxDirection GetBitmapPosition() const = 0; - virtual void SetBitmapPosition(wxDirection dir) = 0; - -private: - wxDECLARE_NO_COPY_CLASS(wxButtonImageData); -}; - -namespace -{ - -// the gap between button edge and the interior area used by Windows for the -// standard buttons -const int OD_BUTTON_MARGIN = 4; - -class wxODButtonImageData : public wxButtonImageData -{ -public: - wxODButtonImageData(wxButton *btn, const wxBitmap& bitmap) - { - SetBitmap(bitmap, wxButton::State_Normal); - SetBitmap(bitmap.ConvertToDisabled(), wxButton::State_Disabled); - - m_dir = wxLEFT; - - // we use margins when we have both bitmap and text, but when we have - // only the bitmap it should take up the entire button area - if ( btn->ShowsLabel() ) - { - m_margin.x = btn->GetCharWidth(); - m_margin.y = btn->GetCharHeight() / 2; - } - } - - virtual wxBitmap GetBitmap(wxButton::State which) const - { - return m_bitmaps[which]; - } - - virtual void SetBitmap(const wxBitmap& bitmap, wxButton::State which) - { - m_bitmaps[which] = bitmap; - } - - virtual wxSize GetBitmapMargins() const - { - return m_margin; - } - - virtual void SetBitmapMargins(wxCoord x, wxCoord y) - { - m_margin = wxSize(x, y); - } - - virtual wxDirection GetBitmapPosition() const - { - return m_dir; - } - - virtual void SetBitmapPosition(wxDirection dir) - { - m_dir = dir; - } - -private: - // just store the values passed to us to be able to retrieve them later - // from the drawing code - wxBitmap m_bitmaps[wxButton::State_Max]; - wxSize m_margin; - wxDirection m_dir; - - wxDECLARE_NO_COPY_CLASS(wxODButtonImageData); -}; - -#if wxUSE_UXTHEME - -// somehow the margin is one pixel greater than the value returned by -// GetThemeMargins() call -const int XP_BUTTON_EXTRA_MARGIN = 1; - -class wxXPButtonImageData : public wxButtonImageData -{ -public: - // we must be constructed with the size of our images as we need to create - // the image list - wxXPButtonImageData(wxButton *btn, const wxBitmap& bitmap) - : m_iml(bitmap.GetWidth(), bitmap.GetHeight(), true /* use mask */, - wxButton::State_Max), - m_hwndBtn(GetHwndOf(btn)) - { - // initialize all bitmaps except for the disabled one to normal state - for ( int n = 0; n < wxButton::State_Max; n++ ) - { - m_iml.Add(n == wxButton::State_Disabled ? bitmap.ConvertToDisabled() - : bitmap); - } - - m_data.himl = GetHimagelistOf(&m_iml); - - // no margins by default - m_data.margin.left = - m_data.margin.right = - m_data.margin.top = - m_data.margin.bottom = 0; - - // use default alignment - m_data.uAlign = BUTTON_IMAGELIST_ALIGN_LEFT; - - UpdateImageInfo(); - } - - virtual wxBitmap GetBitmap(wxButton::State which) const - { - return m_iml.GetBitmap(which); - } - - virtual void SetBitmap(const wxBitmap& bitmap, wxButton::State which) - { - m_iml.Replace(which, bitmap); - - UpdateImageInfo(); - } - - virtual wxSize GetBitmapMargins() const - { - return wxSize(m_data.margin.left, m_data.margin.top); - } - - virtual void SetBitmapMargins(wxCoord x, wxCoord y) - { - RECT& margin = m_data.margin; - margin.left = - margin.right = x; - margin.top = - margin.bottom = y; - - if ( !::SendMessage(m_hwndBtn, BCM_SETTEXTMARGIN, 0, (LPARAM)&margin) ) - { - wxLogDebug("SendMessage(BCM_SETTEXTMARGIN) failed"); - } - } - - virtual wxDirection GetBitmapPosition() const - { - switch ( m_data.uAlign ) - { - default: - wxFAIL_MSG( "invalid image alignment" ); - // fall through - - case BUTTON_IMAGELIST_ALIGN_LEFT: - return wxLEFT; - - case BUTTON_IMAGELIST_ALIGN_RIGHT: - return wxRIGHT; - - case BUTTON_IMAGELIST_ALIGN_TOP: - return wxTOP; - - case BUTTON_IMAGELIST_ALIGN_BOTTOM: - return wxBOTTOM; - } - } - - virtual void SetBitmapPosition(wxDirection dir) - { - UINT alignNew; - switch ( dir ) - { - default: - wxFAIL_MSG( "invalid direction" ); - // fall through - - case wxLEFT: - alignNew = BUTTON_IMAGELIST_ALIGN_LEFT; - break; - - case wxRIGHT: - alignNew = BUTTON_IMAGELIST_ALIGN_RIGHT; - break; - - case wxTOP: - alignNew = BUTTON_IMAGELIST_ALIGN_TOP; - break; - - case wxBOTTOM: - alignNew = BUTTON_IMAGELIST_ALIGN_BOTTOM; - break; - } - - if ( alignNew != m_data.uAlign ) - { - m_data.uAlign = alignNew; - UpdateImageInfo(); - } - } - -private: - void UpdateImageInfo() - { - if ( !::SendMessage(m_hwndBtn, BCM_SETIMAGELIST, 0, (LPARAM)&m_data) ) - { - wxLogDebug("SendMessage(BCM_SETIMAGELIST) failed"); - } - } - - // we store image list separately to be able to use convenient wxImageList - // methods instead of working with raw HIMAGELIST - wxImageList m_iml; - - // store the rest of the data in BCM_SETIMAGELIST-friendly form - BUTTON_IMAGELIST m_data; - - // the button we're associated with - const HWND m_hwndBtn; - - - wxDECLARE_NO_COPY_CLASS(wxXPButtonImageData); -}; - -#endif // wxUSE_UXTHEME - -} // anonymous namespace - // ---------------------------------------------------------------------------- // macros // ---------------------------------------------------------------------------- +BEGIN_EVENT_TABLE(wxButton, wxButtonBase) + EVT_CHAR_HOOK(wxButton::OnCharHook) +END_EVENT_TABLE() + // ============================================================================ // implementation // ============================================================================ -// ---------------------------------------------------------------------------- -// helper functions from wx/msw/private/button.h -// ---------------------------------------------------------------------------- - -void wxMSWButton::UpdateMultilineStyle(HWND hwnd, const wxString& label) -{ - // update BS_MULTILINE style depending on the new label (resetting it - // doesn't seem to do anything very useful but it shouldn't hurt and we do - // have to set it whenever the label becomes multi line as otherwise it - // wouldn't be shown correctly as we don't use BS_MULTILINE when creating - // the control unless it already has new lines in its label) - long styleOld = ::GetWindowLong(hwnd, GWL_STYLE), - styleNew; - if ( label.find(wxT('\n')) != wxString::npos ) - styleNew = styleOld | BS_MULTILINE; - else - styleNew = styleOld & ~BS_MULTILINE; - - if ( styleNew != styleOld ) - ::SetWindowLong(hwnd, GWL_STYLE, styleNew); -} - -wxSize wxMSWButton::GetFittingSize(wxWindow *win, - const wxSize& sizeLabel, - int flags) -{ - // FIXME: this is pure guesswork, need to retrieve the real button margins - wxSize sizeBtn = sizeLabel; - - sizeBtn.x += 3*win->GetCharWidth(); - sizeBtn.y += win->GetCharHeight()/2; - - // account for the shield UAC icon if we have it - if ( flags & Size_AuthNeeded ) - sizeBtn.x += wxSystemSettings::GetMetric(wxSYS_SMALLICON_X); - - return sizeBtn; -} - -wxSize wxMSWButton::ComputeBestFittingSize(wxControl *btn, int flags) -{ - wxClientDC dc(btn); - - wxSize sizeBtn; - dc.GetMultiLineTextExtent(btn->GetLabelText(), &sizeBtn.x, &sizeBtn.y); - - return GetFittingSize(btn, sizeBtn, flags); -} - -wxSize wxMSWButton::IncreaseToStdSizeAndCache(wxControl *btn, const wxSize& size) -{ - wxSize sizeBtn(size); - - // All buttons have at least the standard height and, unless the user - // explicitly wants them to be as small as possible and used wxBU_EXACTFIT - // style to indicate this, of at least the standard width too. - // - // Notice that we really want to make all buttons equally high, otherwise - // they look ugly and the existing code using wxBU_EXACTFIT only uses it to - // control width and not height. - - // The 50x14 button size is documented in the "Recommended sizing and - // spacing" section of MSDN layout article. - // - // Note that we intentionally don't use GetDefaultSize() here, because - // it's inexact -- dialog units depend on this dialog's font. - const wxSize sizeDef = btn->ConvertDialogToPixels(wxSize(50, 14)); - if ( !btn->HasFlag(wxBU_EXACTFIT) ) - { - if ( sizeBtn.x < sizeDef.x ) - sizeBtn.x = sizeDef.x; - } - if ( sizeBtn.y < sizeDef.y ) - sizeBtn.y = sizeDef.y; - - btn->CacheBestSize(sizeBtn); - - return sizeBtn; -} - // ---------------------------------------------------------------------------- // creation/destruction // ---------------------------------------------------------------------------- @@ -498,11 +120,6 @@ wxButton::~wxButton() { UnsetTmpDefault(); } - - delete m_imageData; -#if wxUSE_MARKUP - delete m_markupText; -#endif // wxUSE_MARKUP } // ---------------------------------------------------------------------------- @@ -518,7 +135,7 @@ WXDWORD wxButton::MSWGetStyle(long style, WXDWORD *exstyle) const ); // we must use WS_CLIPSIBLINGS with the buttons or they would draw over - // each other in any resizeable dialog which has more than one button in + // each other in any resizable dialog which has more than one button in // the bottom msStyle |= WS_CLIPSIBLINGS; @@ -541,132 +158,6 @@ WXDWORD wxButton::MSWGetStyle(long style, WXDWORD *exstyle) const return msStyle; } -void wxButton::SetLabel(const wxString& label) -{ - wxMSWButton::UpdateMultilineStyle(GetHwnd(), label); - - wxButtonBase::SetLabel(label); - -#if wxUSE_MARKUP - // If we have a plain text label, we shouldn't be using markup any longer. - if ( m_markupText ) - { - delete m_markupText; - m_markupText = NULL; - - // Unfortunately we don't really know whether we can reset the button - // to be non-owner-drawn or not: if we had made it owner-drawn just - // because of a call to SetLabelMarkup(), we could, but not if there - // were [also] calls to Set{Fore,Back}groundColour(). If it's really a - // problem to have button remain owner-drawn forever just because it - // had markup label once, we should record the reason for our current - // owner-drawnness and check it here. - } -#endif // wxUSE_MARKUP -} - -// ---------------------------------------------------------------------------- -// size management including autosizing -// ---------------------------------------------------------------------------- - -void wxButton::AdjustForBitmapSize(wxSize &size) const -{ - wxCHECK_RET( m_imageData, wxT("shouldn't be called if no image") ); - - // account for the bitmap size - const wxSize sizeBmp = m_imageData->GetBitmap(State_Normal).GetSize(); - const wxDirection dirBmp = m_imageData->GetBitmapPosition(); - if ( dirBmp == wxLEFT || dirBmp == wxRIGHT ) - { - size.x += sizeBmp.x; - if ( sizeBmp.y > size.y ) - size.y = sizeBmp.y; - } - else // bitmap on top/below the text - { - size.y += sizeBmp.y; - if ( sizeBmp.x > size.x ) - size.x = sizeBmp.x; - } - - // account for the user-specified margins - size += 2*m_imageData->GetBitmapMargins(); - - // and also for the margins we always add internally (unless we have no - // border at all in which case the button has exactly the same size as - // bitmap and so no margins should be used) - if ( !HasFlag(wxBORDER_NONE) ) - { - int marginH = 0, - marginV = 0; -#if wxUSE_UXTHEME - if ( wxUxThemeEngine::GetIfActive() ) - { - wxUxThemeHandle theme(const_cast(this), L"BUTTON"); - - MARGINS margins; - wxUxThemeEngine::Get()->GetThemeMargins(theme, NULL, - BP_PUSHBUTTON, - PBS_NORMAL, - TMT_CONTENTMARGINS, - NULL, - &margins); - - // XP doesn't draw themed buttons correctly when the client - // area is smaller than 8x8 - enforce this minimum size for - // small bitmaps - size.IncTo(wxSize(8, 8)); - - marginH = margins.cxLeftWidth + margins.cxRightWidth - + 2*XP_BUTTON_EXTRA_MARGIN; - marginV = margins.cyTopHeight + margins.cyBottomHeight - + 2*XP_BUTTON_EXTRA_MARGIN; - } - else -#endif // wxUSE_UXTHEME - { - marginH = - marginV = OD_BUTTON_MARGIN; - } - - size.IncBy(marginH, marginV); - } -} - -wxSize wxButton::DoGetBestSize() const -{ - wxButton * const self = const_cast(this); - - wxSize size; - - // Account for the text part if we have it. - if ( ShowsLabel() ) - { - int flags = 0; - if ( GetAuthNeeded() ) - flags |= wxMSWButton::Size_AuthNeeded; - -#if wxUSE_MARKUP - if ( m_markupText ) - { - wxClientDC dc(self); - size = wxMSWButton::GetFittingSize(self, - m_markupText->Measure(dc), - flags); - } - else // Normal plain text (but possibly multiline) label. -#endif // wxUSE_MARKUP - { - size = wxMSWButton::ComputeBestFittingSize(self, flags); - } - } - - if ( m_imageData ) - AdjustForBitmapSize(size); - - return wxMSWButton::IncreaseToStdSizeAndCache(self, size); -} - /* static */ wxSize wxButtonBase::GetDefaultSize() { @@ -883,6 +374,25 @@ void wxButton::Command(wxCommandEvent & event) // event/message handlers // ---------------------------------------------------------------------------- +void wxButton::OnCharHook(wxKeyEvent& event) +{ + // We want to ensure that the button always processes Enter key events + // itself, even if it's inside some control that normally takes over them + // (this happens when the button is part of an in-place editor control for + // example). + if ( event.GetKeyCode() == WXK_RETURN ) + { + // We should ensure that subsequent key events are still generated even + // if we did handle EVT_CHAR_HOOK (normally this would suppress their + // generation). + event.DoAllowNextEvent(); + } + else + { + event.Skip(); + } +} + bool wxButton::MSWCommand(WXUINT param, WXWORD WXUNUSED(id)) { bool processed = false; @@ -922,44 +432,9 @@ WXLRESULT wxButton::MSWWindowProc(WXUINT nMsg, WXWPARAM wParam, WXLPARAM lParam) { UnsetTmpDefault(); } - else if ( nMsg == WM_LBUTTONDBLCLK ) - { - // emulate a click event to force an owner-drawn button to change its - // appearance - without this, it won't do it - (void)wxControl::MSWWindowProc(WM_LBUTTONDOWN, wParam, lParam); - - // and continue with processing the message normally as well - } -#if wxUSE_UXTHEME - else if ( nMsg == WM_THEMECHANGED ) - { - // need to recalculate the best size here - // as the theme size might have changed - InvalidateBestSize(); - } -#endif // wxUSE_UXTHEME - // must use m_mouseInWindow here instead of IsMouseInWindow() - // since we need to know the first time the mouse enters the window - // and IsMouseInWindow() would return true in this case - else if ( (nMsg == WM_MOUSEMOVE && !m_mouseInWindow) || - nMsg == WM_MOUSELEAVE ) - { - if ( - IsEnabled() && - ( -#if wxUSE_UXTHEME - wxUxThemeEngine::GetIfActive() || -#endif // wxUSE_UXTHEME - (m_imageData && m_imageData->GetBitmap(State_Current).IsOk()) - ) - ) - { - Refresh(); - } - } // let the base class do all real processing - return wxControl::MSWWindowProc(nMsg, wParam, lParam); + return wxAnyButton::MSWWindowProc(nMsg, wParam, lParam); } // ---------------------------------------------------------------------------- @@ -982,586 +457,5 @@ void wxButton::DoSetAuthNeeded(bool show) } } -// ---------------------------------------------------------------------------- -// button images -// ---------------------------------------------------------------------------- - -wxBitmap wxButton::DoGetBitmap(State which) const -{ - return m_imageData ? m_imageData->GetBitmap(which) : wxBitmap(); -} - -void wxButton::DoSetBitmap(const wxBitmap& bitmap, State which) -{ -#if wxUSE_UXTHEME - wxXPButtonImageData *oldData = NULL; -#endif // wxUSE_UXTHEME - - // Check if we already had bitmaps of different size. - if ( m_imageData && - bitmap.GetSize() != m_imageData->GetBitmap(State_Normal).GetSize() ) - { - wxASSERT_MSG( which == State_Normal, - "Must set normal bitmap with the new size first" ); - -#if wxUSE_UXTHEME - if ( ShowsLabel() && wxUxThemeEngine::GetIfActive() ) - { - // We can't change the size of the images stored in wxImageList - // in wxXPButtonImageData::m_iml so force recreating it below but - // keep the current data to copy its values into the new one. - oldData = static_cast(m_imageData); - m_imageData = NULL; - } -#endif // wxUSE_UXTHEME - //else: wxODButtonImageData doesn't require anything special - } - - // allocate the image data when the first bitmap is set - if ( !m_imageData ) - { -#if wxUSE_UXTHEME - // using image list doesn't work correctly if we don't have any label - // (even if we use BUTTON_IMAGELIST_ALIGN_CENTER alignment and - // BS_BITMAP style), at least under Windows 2003 so use owner drawn - // strategy for bitmap-only buttons - if ( ShowsLabel() && wxUxThemeEngine::GetIfActive() ) - { - m_imageData = new wxXPButtonImageData(this, bitmap); - - if ( oldData ) - { - // Preserve the old values in case the user changed them. - m_imageData->SetBitmapPosition(oldData->GetBitmapPosition()); - - const wxSize oldMargins = oldData->GetBitmapMargins(); - m_imageData->SetBitmapMargins(oldMargins.x, oldMargins.y); - - // No need to preserve the bitmaps though as they were of wrong - // size anyhow. - - delete oldData; - } - } - else -#endif // wxUSE_UXTHEME - { - m_imageData = new wxODButtonImageData(this, bitmap); - MakeOwnerDrawn(); - } - } - else - { - m_imageData->SetBitmap(bitmap, which); - } - - // it should be enough to only invalidate the best size when the normal - // bitmap changes as all bitmaps assigned to the button should be of the - // same size anyhow - if ( which == State_Normal ) - InvalidateBestSize(); - - Refresh(); -} - -wxSize wxButton::DoGetBitmapMargins() const -{ - return m_imageData ? m_imageData->GetBitmapMargins() : wxSize(0, 0); -} - -void wxButton::DoSetBitmapMargins(wxCoord x, wxCoord y) -{ - wxCHECK_RET( m_imageData, "SetBitmap() must be called first" ); - - m_imageData->SetBitmapMargins(x, y); - InvalidateBestSize(); -} - -void wxButton::DoSetBitmapPosition(wxDirection dir) -{ - wxCHECK_RET( m_imageData, "SetBitmap() must be called first" ); - - m_imageData->SetBitmapPosition(dir); - InvalidateBestSize(); -} - -// ---------------------------------------------------------------------------- -// markup support -// ---------------------------------------------------------------------------- - -#if wxUSE_MARKUP - -bool wxButton::DoSetLabelMarkup(const wxString& markup) -{ - if ( !wxButtonBase::DoSetLabelMarkup(markup) ) - return false; - - if ( !m_markupText ) - { - m_markupText = new wxMarkupText(markup); - MakeOwnerDrawn(); - } - else - { - // We are already owner-drawn so just update the text. - m_markupText->SetMarkup(markup); - } - - Refresh(); - - return true; -} - -#endif // wxUSE_MARKUP - -// ---------------------------------------------------------------------------- -// owner-drawn buttons support -// ---------------------------------------------------------------------------- - -// drawing helpers -namespace -{ - -// return the button state using both the ODS_XXX flags specified in state -// parameter and the current button state -wxButton::State GetButtonState(wxButton *btn, UINT state) -{ - if ( state & ODS_DISABLED ) - return wxButton::State_Disabled; - - if ( state & ODS_SELECTED ) - return wxButton::State_Pressed; - - if ( btn->HasCapture() || btn->IsMouseInWindow() ) - return wxButton::State_Current; - - if ( state & ODS_FOCUS ) - return wxButton::State_Focused; - - return wxButton::State_Normal; -} - -void DrawButtonText(HDC hdc, - RECT *pRect, - wxButton *btn, - int flags) -{ - const wxString text = btn->GetLabel(); - - if ( text.find(wxT('\n')) != wxString::npos ) - { - // draw multiline label - - // center text horizontally in any case - flags |= DT_CENTER; - - // first we need to compute its bounding rect - RECT rc; - ::CopyRect(&rc, pRect); - ::DrawText(hdc, text.wx_str(), text.length(), &rc, - DT_CENTER | DT_CALCRECT); - - // now center this rect inside the entire button area - const LONG w = rc.right - rc.left; - const LONG h = rc.bottom - rc.top; - rc.left = (pRect->right - pRect->left)/2 - w/2; - rc.right = rc.left+w; - rc.top = (pRect->bottom - pRect->top)/2 - h/2; - rc.bottom = rc.top+h; - - ::DrawText(hdc, text.wx_str(), text.length(), &rc, flags); - } - else // single line label - { - // translate wx button flags to alignment flags for DrawText() - if ( btn->HasFlag(wxBU_RIGHT) ) - { - flags |= DT_RIGHT; - } - else if ( !btn->HasFlag(wxBU_LEFT) ) - { - flags |= DT_CENTER; - } - //else: DT_LEFT is the default anyhow (and its value is 0 too) - - if ( btn->HasFlag(wxBU_BOTTOM) ) - { - flags |= DT_BOTTOM; - } - else if ( !btn->HasFlag(wxBU_TOP) ) - { - flags |= DT_VCENTER; - } - //else: as above, DT_TOP is the default - - // notice that we must have DT_SINGLELINE for vertical alignment flags - // to work - ::DrawText(hdc, text.wx_str(), text.length(), pRect, - flags | DT_SINGLELINE ); - } -} - -void DrawRect(HDC hdc, const RECT& r) -{ - wxDrawLine(hdc, r.left, r.top, r.right, r.top); - wxDrawLine(hdc, r.right, r.top, r.right, r.bottom); - wxDrawLine(hdc, r.right, r.bottom, r.left, r.bottom); - wxDrawLine(hdc, r.left, r.bottom, r.left, r.top); -} - -/* - The button frame looks like this normally: - - WWWWWWWWWWWWWWWWWWB - WHHHHHHHHHHHHHHHHGB W = white (HILIGHT) - WH GB H = light grey (LIGHT) - WH GB G = dark grey (SHADOW) - WH GB B = black (DKSHADOW) - WH GB - WGGGGGGGGGGGGGGGGGB - BBBBBBBBBBBBBBBBBBB - - When the button is selected, the button becomes like this (the total button - size doesn't change): - - BBBBBBBBBBBBBBBBBBB - BWWWWWWWWWWWWWWWWBB - BWHHHHHHHHHHHHHHGBB - BWH GBB - BWH GBB - BWGGGGGGGGGGGGGGGBB - BBBBBBBBBBBBBBBBBBB - BBBBBBBBBBBBBBBBBBB - - When the button is pushed (while selected) it is like: - - BBBBBBBBBBBBBBBBBBB - BGGGGGGGGGGGGGGGGGB - BG GB - BG GB - BG GB - BG GB - BGGGGGGGGGGGGGGGGGB - BBBBBBBBBBBBBBBBBBB -*/ -void DrawButtonFrame(HDC hdc, RECT& rectBtn, - bool selected, bool pushed) -{ - RECT r; - CopyRect(&r, &rectBtn); - - AutoHPEN hpenBlack(GetSysColor(COLOR_3DDKSHADOW)), - hpenGrey(GetSysColor(COLOR_3DSHADOW)), - hpenLightGr(GetSysColor(COLOR_3DLIGHT)), - hpenWhite(GetSysColor(COLOR_3DHILIGHT)); - - SelectInHDC selectPen(hdc, hpenBlack); - - r.right--; - r.bottom--; - - if ( pushed ) - { - DrawRect(hdc, r); - - (void)SelectObject(hdc, hpenGrey); - ::InflateRect(&r, -1, -1); - - DrawRect(hdc, r); - } - else // !pushed - { - if ( selected ) - { - DrawRect(hdc, r); - - ::InflateRect(&r, -1, -1); - } - - wxDrawLine(hdc, r.left, r.bottom, r.right, r.bottom); - wxDrawLine(hdc, r.right, r.bottom, r.right, r.top - 1); - - (void)SelectObject(hdc, hpenWhite); - wxDrawLine(hdc, r.left, r.bottom - 1, r.left, r.top); - wxDrawLine(hdc, r.left, r.top, r.right, r.top); - - (void)SelectObject(hdc, hpenLightGr); - wxDrawLine(hdc, r.left + 1, r.bottom - 2, r.left + 1, r.top + 1); - wxDrawLine(hdc, r.left + 1, r.top + 1, r.right - 1, r.top + 1); - - (void)SelectObject(hdc, hpenGrey); - wxDrawLine(hdc, r.left + 1, r.bottom - 1, r.right - 1, r.bottom - 1); - wxDrawLine(hdc, r.right - 1, r.bottom - 1, r.right - 1, r.top); - } - - InflateRect(&rectBtn, -OD_BUTTON_MARGIN, -OD_BUTTON_MARGIN); -} - -#if wxUSE_UXTHEME -void DrawXPBackground(wxButton *button, HDC hdc, RECT& rectBtn, UINT state) -{ - wxUxThemeHandle theme(button, L"BUTTON"); - - // this array is indexed by wxButton::State values and so must be kept in - // sync with it - static const int uxStates[] = - { - PBS_NORMAL, PBS_HOT, PBS_PRESSED, PBS_DISABLED, PBS_DEFAULTED - }; - - int iState = uxStates[GetButtonState(button, state)]; - - wxUxThemeEngine * const engine = wxUxThemeEngine::Get(); - - // draw parent background if needed - if ( engine->IsThemeBackgroundPartiallyTransparent - ( - theme, - BP_PUSHBUTTON, - iState - ) ) - { - // Set this button as the one whose background is being erased: this - // allows our WM_ERASEBKGND handler used by DrawThemeParentBackground() - // to correctly align the background brush with this window instead of - // the parent window to which WM_ERASEBKGND is sent. Notice that this - // doesn't work with custom user-defined EVT_ERASE_BACKGROUND handlers - // as they won't be aligned but unfortunately all the attempts to fix - // it by shifting DC origin before calling DrawThemeParentBackground() - // failed to work so we at least do this, even though this is far from - // being the perfect solution. - wxWindowBeingErased = button; - - engine->DrawThemeParentBackground(GetHwndOf(button), hdc, &rectBtn); - - wxWindowBeingErased = NULL; - } - - // draw background - engine->DrawThemeBackground(theme, hdc, BP_PUSHBUTTON, iState, - &rectBtn, NULL); - - // calculate content area margins - MARGINS margins; - engine->GetThemeMargins(theme, hdc, BP_PUSHBUTTON, iState, - TMT_CONTENTMARGINS, &rectBtn, &margins); - ::InflateRect(&rectBtn, -margins.cxLeftWidth, -margins.cyTopHeight); - ::InflateRect(&rectBtn, -XP_BUTTON_EXTRA_MARGIN, -XP_BUTTON_EXTRA_MARGIN); - - if ( button->UseBgCol() ) - { - COLORREF colBg = wxColourToRGB(button->GetBackgroundColour()); - AutoHBRUSH hbrushBackground(colBg); - - // don't overwrite the focus rect - RECT rectClient; - ::CopyRect(&rectClient, &rectBtn); - ::InflateRect(&rectClient, -1, -1); - FillRect(hdc, &rectClient, hbrushBackground); - } -} -#endif // wxUSE_UXTHEME - -} // anonymous namespace - -// ---------------------------------------------------------------------------- -// owner drawn buttons support -// ---------------------------------------------------------------------------- - -void wxButton::MakeOwnerDrawn() -{ - long style = GetWindowLong(GetHwnd(), GWL_STYLE); - if ( (style & BS_OWNERDRAW) != BS_OWNERDRAW ) - { - // make it so - style |= BS_OWNERDRAW; - SetWindowLong(GetHwnd(), GWL_STYLE, style); - } -} - -bool wxButton::SetBackgroundColour(const wxColour &colour) -{ - if ( !wxControl::SetBackgroundColour(colour) ) - { - // nothing to do - return false; - } - - MakeOwnerDrawn(); - - Refresh(); - - return true; -} - -bool wxButton::SetForegroundColour(const wxColour &colour) -{ - if ( !wxControl::SetForegroundColour(colour) ) - { - // nothing to do - return false; - } - - MakeOwnerDrawn(); - - Refresh(); - - return true; -} - -bool wxButton::MSWOnDraw(WXDRAWITEMSTRUCT *wxdis) -{ - LPDRAWITEMSTRUCT lpDIS = (LPDRAWITEMSTRUCT)wxdis; - HDC hdc = lpDIS->hDC; - - UINT state = lpDIS->itemState; - bool pushed = (SendMessage(GetHwnd(), BM_GETSTATE, 0, 0) & BST_PUSHED) != 0; - - RECT rectBtn; - CopyRect(&rectBtn, &lpDIS->rcItem); - - // draw the button background - if ( !HasFlag(wxBORDER_NONE) ) - { -#if wxUSE_UXTHEME - if ( wxUxThemeEngine::GetIfActive() ) - { - DrawXPBackground(this, hdc, rectBtn, state); - } - else -#endif // wxUSE_UXTHEME - { - COLORREF colBg = wxColourToRGB(GetBackgroundColour()); - - // first, draw the background - AutoHBRUSH hbrushBackground(colBg); - FillRect(hdc, &rectBtn, hbrushBackground); - - // draw the border for the current state - bool selected = (state & ODS_SELECTED) != 0; - if ( !selected ) - { - wxTopLevelWindow * - tlw = wxDynamicCast(wxGetTopLevelParent(this), wxTopLevelWindow); - if ( tlw ) - { - selected = tlw->GetDefaultItem() == this; - } - } - - DrawButtonFrame(hdc, rectBtn, selected, pushed); - } - - // draw the focus rectangle if we need it - if ( (state & ODS_FOCUS) && !(state & ODS_NOFOCUSRECT) ) - { - DrawFocusRect(hdc, &rectBtn); - -#if wxUSE_UXTHEME - if ( !wxUxThemeEngine::GetIfActive() ) -#endif // wxUSE_UXTHEME - { - if ( pushed ) - { - // the label is shifted by 1 pixel to create "pushed" effect - OffsetRect(&rectBtn, 1, 1); - } - } - } - } - - - // draw the image, if any - if ( m_imageData ) - { - wxBitmap bmp = m_imageData->GetBitmap(GetButtonState(this, state)); - if ( !bmp.IsOk() ) - bmp = m_imageData->GetBitmap(State_Normal); - - const wxSize sizeBmp = bmp.GetSize(); - const wxSize margin = m_imageData->GetBitmapMargins(); - const wxSize sizeBmpWithMargins(sizeBmp + 2*margin); - wxRect rectButton(wxRectFromRECT(rectBtn)); - - // for simplicity, we start with centred rectangle and then move it to - // the appropriate edge - wxRect rectBitmap = wxRect(sizeBmp).CentreIn(rectButton); - - // move bitmap only if we have a label, otherwise keep it centered - if ( ShowsLabel() ) - { - switch ( m_imageData->GetBitmapPosition() ) - { - default: - wxFAIL_MSG( "invalid direction" ); - // fall through - - case wxLEFT: - rectBitmap.x = rectButton.x + margin.x; - rectButton.x += sizeBmpWithMargins.x; - rectButton.width -= sizeBmpWithMargins.x; - break; - - case wxRIGHT: - rectBitmap.x = rectButton.GetRight() - sizeBmp.x - margin.x; - rectButton.width -= sizeBmpWithMargins.x; - break; - - case wxTOP: - rectBitmap.y = rectButton.y + margin.y; - rectButton.y += sizeBmpWithMargins.y; - rectButton.height -= sizeBmpWithMargins.y; - break; - - case wxBOTTOM: - rectBitmap.y = rectButton.GetBottom() - sizeBmp.y - margin.y; - rectButton.height -= sizeBmpWithMargins.y; - break; - } - } - - wxDCTemp dst((WXHDC)hdc); - dst.DrawBitmap(bmp, rectBitmap.GetPosition(), true); - - wxCopyRectToRECT(rectButton, rectBtn); - } - - - // finally draw the label - if ( ShowsLabel() ) - { - COLORREF colFg = state & ODS_DISABLED - ? ::GetSysColor(COLOR_GRAYTEXT) - : wxColourToRGB(GetForegroundColour()); - - wxTextColoursChanger changeFg(hdc, colFg, CLR_INVALID); - wxBkModeChanger changeBkMode(hdc, wxBRUSHSTYLE_TRANSPARENT); - -#if wxUSE_MARKUP - if ( m_markupText ) - { - wxDCTemp dc((WXHDC)hdc); - dc.SetTextForeground(wxColour(colFg)); - dc.SetFont(GetFont()); - - m_markupText->Render(dc, wxRectFromRECT(rectBtn), - state & ODS_NOACCEL - ? wxMarkupText::Render_Default - : wxMarkupText::Render_ShowAccels); - } - else // Plain text label -#endif // wxUSE_MARKUP - { - // notice that DT_HIDEPREFIX doesn't work on old (pre-Windows 2000) - // systems but by happy coincidence ODS_NOACCEL is not used under - // them neither so DT_HIDEPREFIX should never be used there - DrawButtonText(hdc, &rectBtn, this, - state & ODS_NOACCEL ? DT_HIDEPREFIX : 0); - } - } - - return true; -} - #endif // wxUSE_BUTTON diff --git a/Externals/wxWidgets3/src/msw/calctrl.cpp b/Externals/wxWidgets3/src/msw/calctrl.cpp index ddbd321588..badc7e8821 100644 --- a/Externals/wxWidgets3/src/msw/calctrl.cpp +++ b/Externals/wxWidgets3/src/msw/calctrl.cpp @@ -3,7 +3,7 @@ // Purpose: wxCalendarCtrl implementation // Author: Vadim Zeitlin // Created: 2008-04-04 -// RCS-ID: $Id: calctrl.cpp 66558 2011-01-04 09:14:40Z SC $ +// RCS-ID: $Id: calctrl.cpp 70568 2012-02-11 16:26:47Z VZ $ // Copyright: (C) 2008 Vadim Zeitlin // Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// @@ -120,8 +120,8 @@ wxCalendarCtrl::Create(wxWindow *parent, SetDate(dt.IsValid() ? dt : wxDateTime::Today()); - if ( SetHolidayAttrs() ) - UpdateMarks(); + SetHolidayAttrs(); + UpdateMarks(); Connect(wxEVT_LEFT_DOWN, wxMouseEventHandler(wxCalendarCtrl::MSWOnClick)); @@ -396,10 +396,12 @@ void wxCalendarCtrl::SetHoliday(size_t day) void wxCalendarCtrl::UpdateMarks() { - // we show only one full month but there can be some days from the month - // before it and from the one after it so days from 3 different months can - // be partially shown - MONTHDAYSTATE states[3] = { 0 }; + // Currently the native control may show more than one month if its size is + // big enough. Ideal would be to prevent this from happening but there + // doesn't seem to be any obvious way to do it, so for now just handle the + // possibility that we can display several of them: one before the current + // one and up to 12 after it. + MONTHDAYSTATE states[14] = { 0 }; const DWORD nMonths = MonthCal_GetMonthRange(GetHwnd(), GMR_DAYSTATE, NULL); // although in principle the calendar might not show any days from the @@ -412,13 +414,9 @@ void wxCalendarCtrl::UpdateMarks() // in its window if you "zoom out" of it by double clicking on free areas // so the return value can be (much, in case of decades view) greater than // 3 but in this case marks are not visible anyhow so simply ignore it - if ( nMonths < WXSIZEOF(states) ) + if ( nMonths >= 2 && nMonths <= WXSIZEOF(states) ) { - wxFAIL_MSG("unexpectedly few months shown in the control"); - } - else if ( nMonths == WXSIZEOF(states) ) - { - // the fully visible month is the one in the middle + // The current, fully visible month is always the second one. states[1] = m_marks | m_holidays; if ( !MonthCal_SetDayState(GetHwnd(), nMonths, states) ) @@ -462,8 +460,8 @@ bool wxCalendarCtrl::MSWOnNotify(int idCtrl, WXLPARAM lParam, WXLPARAM *result) { // month changed, need to update the holidays if we use // them - if ( SetHolidayAttrs() ) - UpdateMarks(); + SetHolidayAttrs(); + UpdateMarks(); } } } @@ -472,9 +470,24 @@ bool wxCalendarCtrl::MSWOnNotify(int idCtrl, WXLPARAM lParam, WXLPARAM *result) case MCN_GETDAYSTATE: { const NMDAYSTATE * const ds = (NMDAYSTATE *)lParam; + + wxDateTime startDate; + startDate.SetFromMSWSysDate(ds->stStart); + + wxDateTime currentDate = m_date; + // Set to the start of month for comparison with startDate to + // work correctly. + currentDate.SetDay(1); + for ( int i = 0; i < ds->cDayState; i++ ) { - ds->prgDayState[i] = m_marks | m_holidays; + // set holiday/marks only for the "current" month + if ( startDate == currentDate ) + ds->prgDayState[i] = m_marks | m_holidays; + else + ds->prgDayState[i] = 0; + + startDate += wxDateSpan::Month(); } } break; diff --git a/Externals/wxWidgets3/src/msw/checkbox.cpp b/Externals/wxWidgets3/src/msw/checkbox.cpp index 064414e582..371dde59fa 100644 --- a/Externals/wxWidgets3/src/msw/checkbox.cpp +++ b/Externals/wxWidgets3/src/msw/checkbox.cpp @@ -4,7 +4,7 @@ // Author: Julian Smart // Modified by: // Created: 04/01/98 -// RCS-ID: $Id: checkbox.cpp 66555 2011-01-04 08:31:53Z SC $ +// RCS-ID: $Id: checkbox.cpp 70015 2011-12-16 11:03:15Z VZ $ // Copyright: (c) Julian Smart // Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// @@ -147,6 +147,19 @@ wxSize wxCheckBox::DoGetBestSize() const dc.GetMultiLineTextExtent(GetLabelText(str), &wCheckbox, &hCheckbox); wCheckbox += s_checkSize + GetCharWidth(); + if ( ::GetWindowLong(GetHwnd(), GWL_STYLE) & BS_MULTILINE ) + { + // We need to make the checkbox even wider in this case because + // otherwise it wraps lines automatically and not only on "\n"s as + // we need and this makes the size computed here wrong resulting in + // checkbox contents being truncated when it's actually displayed. + // Without this hack simple checkbox with "Some thing\n and more" + // label appears on 3 lines, not 2, under Windows 2003 using + // classic look and feel (although it works fine under Windows 7, + // with or without themes). + wCheckbox += s_checkSize; + } + if ( hCheckbox < s_checkSize ) hCheckbox = s_checkSize; } @@ -260,7 +273,7 @@ bool wxCheckBox::SetForegroundColour(const wxColour& colour) // the only way to change the checkbox foreground colour under Windows XP // is to owner draw it if ( wxUxThemeEngine::GetIfActive() ) - MakeOwnerDrawn(colour.Ok()); + MakeOwnerDrawn(colour.IsOk()); return true; } diff --git a/Externals/wxWidgets3/src/msw/choice.cpp b/Externals/wxWidgets3/src/msw/choice.cpp index eac398a30c..ce5c5510dc 100644 --- a/Externals/wxWidgets3/src/msw/choice.cpp +++ b/Externals/wxWidgets3/src/msw/choice.cpp @@ -4,7 +4,7 @@ // Author: Julian Smart // Modified by: Vadim Zeitlin to derive from wxChoiceBase // Created: 04/01/98 -// RCS-ID: $Id: choice.cpp 67280 2011-03-22 14:17:38Z DS $ +// RCS-ID: $Id: choice.cpp 70870 2012-03-11 05:31:06Z JS $ // Copyright: (c) Julian Smart // Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// @@ -86,10 +86,7 @@ bool wxChoice::CreateAndInit(wxWindow *parent, // initialize the controls contents - for ( int i = 0; i < n; i++ ) - { - Append(choices[i]); - } + Append(n, choices); // and now we may finally size the control properly (if needed) SetInitialSize(size); @@ -358,6 +355,10 @@ void wxChoice::SetString(unsigned int n, const wxString& s) else if ( HasClientObjectData() ) oldObjData = GetClientObject(n); + // and also the selection if we're going to delete the item that was + // selected + const bool wasSelected = static_cast(n) == GetSelection(); + ::SendMessage(GetHwnd(), CB_DELETESTRING, n, 0); ::SendMessage(GetHwnd(), CB_INSERTSTRING, n, (LPARAM)s.wx_str() ); @@ -367,6 +368,11 @@ void wxChoice::SetString(unsigned int n, const wxString& s) else if ( oldObjData ) SetClientObject(n, oldObjData); + // and the selection + if ( wasSelected ) + SetSelection(n); + + // the width could have changed so the best size needs to be recomputed InvalidateBestSize(); } @@ -408,7 +414,7 @@ void wxChoice::DoSetItemClientData(unsigned int n, void* clientData) void* wxChoice::DoGetItemClientData(unsigned int n) const { LPARAM rc = SendMessage(GetHwnd(), CB_GETITEMDATA, n, 0); - if ( rc == CB_ERR ) + if ( rc == CB_ERR && GetLastError() != ERROR_SUCCESS ) { wxLogLastError(wxT("CB_GETITEMDATA")); @@ -544,7 +550,10 @@ void wxChoice::DoSetSize(int x, int y, const int hItem = SendMessage(GetHwnd(), CB_GETITEMHEIGHT, 0, 0); int heightWithItems = 0; if (!HasFlag(wxCB_SIMPLE)) - heightWithItems = height + hItem*nItems; + // The extra item (" + 1") is required to prevent a vertical + // scrollbar from appearing with comctl32.dll versions earlier + // than 6.0 (such as found in Win2k). + heightWithItems = height + hItem*(nItems + 1); else heightWithItems = SetHeightSimpleComboBox(nItems); @@ -749,7 +758,7 @@ bool wxChoice::MSWCommand(WXUINT param, WXWORD WXUNUSED(id)) WXHBRUSH wxChoice::MSWControlColor(WXHDC hDC, WXHWND hWnd) { - if ( !IsEnabled() ) + if ( !IsThisEnabled() ) return MSWControlColorDisabled(hDC); return wxChoiceBase::MSWControlColor(hDC, hWnd); diff --git a/Externals/wxWidgets3/src/msw/clipbrd.cpp b/Externals/wxWidgets3/src/msw/clipbrd.cpp index e64b118fa3..d994fed669 100644 --- a/Externals/wxWidgets3/src/msw/clipbrd.cpp +++ b/Externals/wxWidgets3/src/msw/clipbrd.cpp @@ -4,7 +4,7 @@ // Author: Julian Smart // Modified by: // Created: 04/01/98 -// RCS-ID: $Id: clipbrd.cpp 67280 2011-03-22 14:17:38Z DS $ +// RCS-ID: $Id: clipbrd.cpp 70440 2012-01-23 11:28:01Z VZ $ // Copyright: (c) Julian Smart // Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// @@ -214,7 +214,7 @@ bool wxSetClipboardData(wxDataFormat dataFormat, { wxBitmap *bitmap = (wxBitmap *)data; - if ( bitmap && bitmap->Ok() ) + if ( bitmap && bitmap->IsOk() ) { wxDIB dib(*bitmap); if ( dib.IsOk() ) @@ -332,19 +332,19 @@ bool wxSetClipboardData(wxDataFormat dataFormat, // string when you overwrite it so you follow up with code to replace // the 0 appended at the end with a '\r'... char *ptr = strstr(buf, "StartHTML"); - sprintf(ptr+10, "%08u", strstr(buf, "") - buf); + sprintf(ptr+10, "%08u", (unsigned)(strstr(buf, "") - buf)); *(ptr+10+8) = '\r'; ptr = strstr(buf, "EndHTML"); - sprintf(ptr+8, "%08u", strlen(buf)); + sprintf(ptr+8, "%08u", (unsigned)strlen(buf)); *(ptr+8+8) = '\r'; ptr = strstr(buf, "StartFragment"); - sprintf(ptr+14, "%08u", strstr(buf, "